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.
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.
docs/mcp.md): qa_check (structured findings, no run) and
qa_run (exitCode + JSON logs + verdict + summary + trace), plus
session tools — one persistent LuaEngine per session on its own
asyncio loop/thread, idle-reaped on a TTL. An agent boots a house once
and probes it across calls instead of re-running.--start / --speed / --instant /
--step / --max-hours), --replay (recorded house sessions),
--strict-tests, flua test (PASS/FAIL/TIME, --json), --log json,
--syslog, --trace (api/ui/net/timer), --result-json, --watch.createDB (--full: devices, rooms, sections,
globals, scenes, alarms, profiles — QuickApps excluded), the seed's
"emulate" key with base-type fallback (a physical model like
com.fibaro.FGMS001 resolves to motionSensor), downloadQA +
--%%deviceId pins, record/--replay, --tool house/hubList.net.HTTPServer/TCPServer/UDPServer/
WebSocketServer — the QA's own mock servers for testing its clients.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:
--ui defaults to 8090 and the busy-port fallback
probes (port busy, trying N+1) — two racing instances can collide on
the same fallback. The proxy callback port (8080) is the same shape.--%%db:+ files: atomic writes prevent torn files, but two
runs persisting to the same file still lose each other's updates.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.
"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.
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.--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.--ui 0 — explicit free-OS-port binding (print the actual port),
removing the fallback race; same for the proxy callback port.--%%db:+ — an advisory lock or a loud warning when
two runs persist to the same file.--%%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.Items 1–3 are each small to medium. 1 is the highest agent-value, 2 the highest safety-value.
.env excluded, everything
else committed) or disposable? The version/capture-time stamp argues for
committing; the credentials must never be.--net mock: per-route scripted responses (a table the QA seeds) versus
recording-first (capture real traffic once, replay it)? The former fits
net.*Server; the latter fits flua record's philosophy.--watch (CLI-only
today).