Note: flua as an agent tool (analysis + improvement candidates)

Status: analysis delivered 2026-11-28; recommendations pending the author's pick. Nothing here is built yet — the note is the durable copy of the design discussion.

Context

From an agent's perspective, flua's core value is being a safe test environment for verifying QA code it is writing — the write → run → fail → fix loop, without touching the real HC3. This note evaluates that loop, parallel flua instances, and easy setup of a test environment mirroring the user's real HC3, grounded in what the repo already offers.

What already exists (the loop is stronger than most tools give it)

The three questions

Parallel flua instances — mostly yes, with two real hazards

Every run is its own process with pid-scoped temp dirs, and MCP sessions are isolated engines on separate threads — N agents can already hold N independent worlds. The hazards:

Test-environment setup mirroring the real HC3 — manual 3-step today

The pieces exist but must be wired by hand: createDB --full → downloadQA per QA → run with the seed + downloaded files (+ "emulate"). There is no one-shot.

Write → run → fail → fix — one big gap

"Offline" names the HC3 surface only: net.HTTPClient and friends still make real outbound calls in offline mode. For an agent running code it just wrote, that is both a determinism problem and the main safety hole — untested QA code can reach the real internet. There is no way to fail closed or mock the whole outbound network at the runtime boundary.

Recommendations (prioritized)

  1. flua --tool snapshot [-o project/] — one command: createDB --full + enumerate the hub's QAs + downloadQA each + write a runner/ directives + stamp the flua version and capture time. The "agents set up a test env mirroring the user's HC3" tool; mostly wiring together things that exist.
  2. Outbound network control — a --net off (fail closed) / mock mode at the runtime boundary, reusing the net.*Server machinery for the mock form. Makes the loop hermetic and safe for untrusted code.
  3. --ui 0 — explicit free-OS-port binding (print the actual port), removing the fallback race; same for the proxy callback port.
  4. Guard concurrent --%%db:+ — an advisory lock or a loud warning when two runs persist to the same file.
  5. Standing policy — the --%%keep-alive direction generalized: every flua-only feature needs a directive form (a comment on the real HC3), so agent-written QA code remains HC3-safe. _FLUA.* calls stay the flua-only programmatic form.
  6. Record-on-failure (nice-to-have) — auto-capture the house state to a replay file when a run exits nonzero, so agents can re-run the exact failing world.

Items 1–3 are each small to medium. 1 is the highest agent-value, 2 the highest safety-value.

Open design points