Lua API — brainstorm integrations
Complete Lua surface for features from this chat (Discovery, Cutlass/TF32, portal, IIS, PHP, graphs).
Registered by _BrainstormIntegrations::RegisterLuaGlobals from:
- _SpeechCommands::RunLuaScriptFile (every script run)
- AgentRuntime common + per-type agent Lua states
Related: BrainstormIntegrations.md (BrainstormIntegrations.md) · DiscoveryWordPress.md (DiscoveryWordPress.md) · TF32MatrixMultiply.md (TF32MatrixMultiply.md)
Running scripts
[text]
integrate lua
or (if your build routes Lua run this way):
[text]
lua run lua_scripts/Brainstorm-Integrations.lua
Harness script path: `lua_scripts/Brainstorm-Integrations.lua`.
Scripts also receive existing WordPress helpers:
[lua]
wordpress_post(title, content, status) → ok, post_id, link, error
wordpress_test() → ok, details
wordpress_status() → string
Integration / orchestration
| Function | Returns | Description |
| integrate_status() | string | Hub status (php root, discovery, cutlass, WP) |
| integrate_doctor() | string | Operator checklist |
| integrate_all() | string | Seed discovery + portal export + graphs + cutlass check |
| integrate_selftest() | string | Offline dry-run self-test |
Globals (strings, snapshot at register time):
- integrate_status_text
- php_site_root
- php_site_url
Discovery journal
| Function | Args | Returns | Description |
| discovery_status() | — | string | Journal status |
| discovery_seed_all() | — | integer | Entries touched (paper+session) |
| discovery_list(pending) | bool | string | List text |
| discovery_record(title, summary, category, detail) | strings | id, auto_posted | Log discovery |
| discovery_post_pending() | — | count, note | Post unposted |
| discovery_wordpress(on) | bool or “on”/”off” | bool | Auto-post toggle |
| discovery_dry_run(on) | bool or string | bool | Dry-run toggle |
Example:
[lua]
discovery_dry_run(true)
discovery_seed_all()
local id, auto = discovery_record(
“Lua finding”,
“Observed X when Y”,
“platform”,
“Detail lines…”)
print(id, auto)
— Live only when WP configured:
— discovery_dry_run(false)
— discovery_wordpress(true)
— local n, note = discovery_post_pending()
Cutlass / TF32
| Function | Args | Returns | Description |
| cutlass_status() | — | string | Backend + precision |
| cutlass_set_precision(p) | “fp32″/”tf32″/”fp16″/”bf16” | string | New precision name |
| cutlass_gemm(M,N,K) | ints (default 64) | ok, detail | Run GEMM fill |
| cutlass_bench(size, n) | ints | string | Timing report |
| cutlass_check(size) | int | string | FP32 + TF32 correctness |
Example:
[lua]
cutlass_set_precision(“tf32”)
local ok, detail = cutlass_gemm(256, 256, 256)
print(ok, detail)
print(cutlass_check(64))
Graphs (PHP export)
| Function | Returns |
| graphs_architecture() | JSON string |
| graphs_discovery() | JSON string |
| graphs_rl() | JSON string |
| graphs_all() | JSON string |
| graphs_export() | status string (writes files) |
Portal
| Function | Args | Returns |
| portal_status() | — | string |
| portal_export() | — | path/status string |
| portal_enable(on) | bool | enabled bool |
IIS
| Function | Args | Returns |
| iis_status() | — | string |
| iis_doctor() | — | string |
| iis_recycle(name, apply) | string, bool | string |
Never pass apply=true from unattended scripts unless explicitly intended.
PHP site
| Function | Args | Returns |
| php_site_status() | — | string |
| php_site_health() | — | string |
| php_site_config_root(path) | string | status |
| php_site_config_url(url) | string | status |
| php_site_deploy(apply) | bool | status |
Minimal integration script
[lua]
print(integrate_doctor())
discovery_seed_all()
cutlass_set_precision(“tf32”)
print(cutlass_check(64))
print(portal_export())
print(graphs_export())
print(php_site_health())
print(iis_doctor())
print(integrate_all())
Full harness: lua_scripts/Brainstorm-Integrations.lua.
Registration notes
- If a function is missing, the harness prints missing binding: name (script uses safe pcall wrappers).
- Rebuild after adding BrainstormIntegrations.cpp so symbols link.
- Agent scripts get the same globals when the agent Lua state is created after this registration was wired in.
Files
- BrainstormIntegrations.cpp — all lua_* bindings
- lua_scripts/Brainstorm-Integrations.lua
- SpeechCommands.cpp — RunLuaScriptFile registration
- AgentRuntime.cpp — agent registration
Filed under: Uncategorized - @ July 18, 2026 6:40 am