Status: design draft — nothing implemented (2026-11-09); parked
2026-11-10 for the owner to think through. ADR 0013 is the mandate;
this note is the shape exploration. The state machine, the sub-agent
brief, the house-as-seed, the Tasks-driven interview, the
fact/thinking division, and the spec-format draft
(requirements-flow-spec-format.md) are all captured here — resume
from these files.
ADR 0013 committed flua to two surfaces instead of a wizard: requirements elicitation (spec + skeleton + test scaffold, CLI-first) and verification legibility (requirements → PASS/FAIL, judgeable by non-coders). This note explores what those are, and picks directions.
The core idea in one sentence: make the requirement a first-class, versioned artifact that compiles to the prompt driving an agent's whole loop — build, test in the testbed, verify against the requirements, and loop back to the user (or the requirements editor) for refinements until the product is solved. The forum post said "the requirement is the product; the code is just how it compiles" — this is that made mechanical.
The whole process is one state machine, driven by a single initial prompt — the brief — that tells the agent how to interact with flua through every state until "done":
LOOP 1 — requirements (user ⇄ agent ⇄ flua)
user speaks in natural language; the agent
formalizes it into the spec (rendered, diffed);
repeat until the user APPROVES the spec
│ spec approved
┌────────────▼────────────┐
│ LOOP 2 — implementation │
│ (agent ⇄ flua testbed) │
│ write → run → R1..Rn │
│ PASS/FAIL → fix, until │
│ every check passes │
└────────────┬────────────┘
│ all checks pass
┌────────────▼────────────┐
│ 3. "is this ok?" — the │
│ demo gate │
└────────────┬────────────┘
"not quite" │ "yes"
(back to loop 1 with the │
correction, as a spec ▼
diff) 4b. done — the user
approves; the agent
never deploys
Three things fall out of this shape:
--tool spec prompt renders.The two loops are not equal in importance. Loop 2 is becoming commodity — agents implement against a testbed in their own ways, and flua already makes that mechanical. Loop 1 is where the value is, because the two participants have wildly different budgets: the agent can run a thousand analysis iterations, the user can answer a handful of questions. A requirements tool that makes the user do the agent's work is a typing monkey; the whole point of treating the requirement as a first-class artifact is that the agent can think about it before anything runs.
The loop-1 protocol therefore gains an analyze-before-ask phase, on every user utterance:
The division of labor: flua checks facts, the agent checks
thinking. flua's loop-1 surface is a fact-checker, not an oracle of
requirement quality: --tool spec check validates the spec against
reality, with no implementation run and no opinions about what makes a
requirement good:
setValue 0–99; the catalog knows the canonical actions);Everything else — trigger completeness, timing and failure edges, contradictions, interactions, whether a check verifies the transition — is agent-side analysis. The agent runs its reasoning; flua answers the questions of fact it can answer a thousand times for free. The user only sees what survives both.
The resulting division of labor: the agent explores the requirement space; the user decides. The spec is where the exploration is recorded, so the user can review thinking, not just conclusions — a decision the user accepts is one line; a question the user asked the agent to settle is a diff.
--tool newQA — device-type templates (30 types) with substitution:
the proven "template + slots" mechanism, but for device shape, not
behavior.--tool house — ground truth: devices with id/name/type/room, globals,
scenes, customEvents. Elicitation can be concrete: real rooms, real
devices, not abstractions.--tool setup — project scaffold; the spec compilation extends it.flua test + flua-test — self-asserting runs with exit codes; the
verification half already exists, it just doesn't speak requirements.--ui, timeline, HTML) — where a rendered checklist can
live without building a new app.1. Natural-language chat. Keep it as the input channel — agents already interview users in prose. But prose is a terrible artifact: not diffable, not compilable, not checkable. Chat feeds the spec; it is not the spec.
2. Guided interview (wizard-lite, multiple choice). The good half of
the wizard: rooms → devices → trigger → conditions → actions →
exceptions, with the choices pulled from --tool house (real names, real
types) and the trigger vocabulary from the skills (device change, cron,
sunrise/sunset, global variable, custom event). The difference from a
wizard: its output is a spec, not code. Deterministic, testable,
CLI-first (flua --tool spec ask). Works for the standard 80% of
automations.
3. Visual flow diagram (Node-RED style). Rejected as an editor — ADR 0013's discipline, and agents read text, not boxes. A diagram is at most a render of the spec later (mermaid already renders our forum diagrams; a spec → flowchart render is cheap and optional).
4. Solution requirement template library. The strongest entry point
for non-coders: pick a known-good behavior pattern ("motion turns on a
light for N minutes, only after dark", "notify when a door opens and
nobody's home", "thermostat follows a daily schedule") and substitute the
house specifics (which sensor, which light, which times). Distinct from
newQA's device-type templates: this is behavior, and it seeds from
quickapp-patterns + the examples. This is also how humans already learn
home automation — by copying a neighbor's automation and swapping names.
Recommended shape: template library + guided interview → structured spec. The template gets the user 80% there by substitution; the interview fills the gaps with grounded choices; the spec is what everything compiles from. Natural language stays the agent-side channel.
A structured, diffable, agent-readable, renderable document. Direction:
markdown with YAML frontmatter (human- and agent-readable in one file —
json.decode-friendly where needed), something like:
---
name: Hall light on motion
template: motion-light
house: HT # symbolic refs only — never baked ids
devices:
sensor: HT.hall.motion
light: HT.hall.light
requirements:
- id: R1
text: motion after sunset turns the hall light on
- id: R2
text: the light turns off after 5 minutes with no motion
- id: R3
text: manual switch off during the 5 minutes wins
---
HT.hall.motion) — the homeTable idiom (ADR
of ids: names in code, ids behind them). The interview resolves the
user's words through --tool house; the spec keeps names.The user edits the spec by dialogue, not by editing files. Shape: two panes in one surface.
Each chat turn flows through the interpreter, which turns prose into spec edits: the top pane updates, the user sees their words reflected (or mis-reflected — which is the point: the interpretation is visible and correctable, not hidden).
Who asks the questions: the agent, via MCP Tasks. The interview is agent-driven work — the agent asks the user questions and translates the answers into spec edits, and the user answers in the chat UI they already have. flua's role shrinks to the part only flua can do: hold the spec state, validate edits, and render it. Two mechanisms, primary and fallback:
io.modelcontextprotocol/tasks, the official way) —
the spec becomes a long-running task: the agent starts it, drives the
dialogue through the task's input request, writes spec edits through
its update tool, and flua validates + persists + renders each state.
The capability is announced in the session capability exchange, so
agents discover the task surface. flua holds no LLM keys — the
user's own agent account does the interpretation; flua never asks for
access tokens. Exact tool shapes are pinned against the Tasks
extension spec when implemented, not here.spec/start returns a specId, spec/update/spec/state carry the
conversation and a spec/stop closes it. This is precisely the
pattern flua-mcp's session tier already proves (qa_start →
{sessionId, qaIds}, qa_probe, qa_action, TTL reaping,
transport-stateless) — the spec task reuses the same machinery.The trust argument settles the earlier interpreter question: with Tasks
(or the fallback), the interpreter is always the user's agent, never
flua — no LLM endpoint config, no .env keys, no dependency. The direct
LLM backend (open question 12) is dropped unless a standalone editor
without any agent ever materializes.
The two panes become two windows. The interaction model is still
"requirements on top, chat below" — but the chat pane is the user's
agent UI, and the top pane is flua's rendered spec (the checklist page
under --ui, or the terminal render). The cost: no single integrated
surface. The gain: nothing new to build for the chat half, and the
rendered spec is the same artifact the demo gate reviews. A later TUI or
a spec page with a chat box is an optional integration, not v1.
Launcher discipline unchanged: --tool spec ... first (ask/prompt/report
+ the task/session tools), apps on top.
This is the current trend made concrete: the spec/prompt is the brief for a specialized QA sub-agent. The user's everyday agent is the parent — it interviews the user, hands the QA sub-agent the brief, and shows the user the results. The sub-agent's entire world is:
qa_check,
qa_run, qa_test, --tool house (ground truth), --tool newQA
(device templates), the sim with its bundled sim devices;flua://skills/*
(best-practice code, patterns, write-safety), served resources;flua's role in this framing is not to write code but to be the best possible environment a sub-agent can be dropped into — ADR 0013's moat thesis, stated as architecture. The brief makes the sub-agent specialized; the environment makes it succeed.
Part of requirements collection is the user's home environment — rooms, devices, their types. In the spec this section does double duty:
HT.hall.motion);--seed/--%%db)
that stands up the simulated house with the right devices (types,
names, rooms; the bundled sim devices and newQA templates cover the
catalog). The testbed then mirrors the user's house shape, so the
sub-agent tests against the user's world, not an abstract one.When the user has a real HC3, --tool house provides the ground truth
instead of interview answers — the house section is fetched, not guessed.
The interview's "which rooms, which devices" questions only fire when
that is not available.
flua test/qa_run; every requirement maps to a
check that prints R<n>: <requirement> — PASS/FAIL;--tool house. Bounded retries (e.g. three attempts on one
requirement, then ask) so the loop never spins silently;--tool spec report → the spec with each
requirement's latest verdict — the judgment surface. A non-coder reads
"R2: PASS" and knows what to say next; they never read Lua.CLI-first throughout (--tool spec ask|prompt|check|report), so agents get the
identical surface via flua_tool/MCP — the app discipline from ADR 0013.
The driving prompt may also ship as an MCP prompt (the existing prompt
tier: qa_spec taking the spec and rendering the bound brief), so
MCP-only hosts get the loop protocol without installing anything. A thin
web form for the interview/editor can come later under the existing
--ui server; it must emit and read the same spec format.
Not a visual editor. Not a code-generation platform — flua generates zero code; it elicits the spec, renders the driving prompt, and reports the verdicts. The agent writes the code; templates give the agent a reference approach. Not a block-scene clone — the HC3's block editor owns that; our specs that compile to scenes do so deliberately (literal-id caveat).
setup_templates/specs dir vs both?--tool
house, an interview-built seed, or both (fetch when reachable, ask
when not)? And who compiles the seed — the spec tool or the sub-agent
itself from the spec's house section?--ui viewer/timeline (interactive), the rendered
checklist, or both? The answer decides whether the viewer grows a
"confirm/refine" affordance.--tool spec
render suffice, or does the --ui viewer get the spec page early so
the demo gate and the spec share a surface?spec check surface.
Which facts are checkable keeps growing as the house ground truth
and the device catalog deepen — the linter's scope is whatever flua
can answer about the world, never about requirement quality.--tool spec ask --from-template motion-light against a --tool house
snapshot → emit the spec markdown and --tool spec prompt renders the
driving brief (spec + house refs + loop protocol) → hand it to an agent
(Copilot/Claude/MCP) that loops in the sim → --tool spec report renders
the checklist from the last flua test run. One template, end to end,
proves the loop — with flua generating zero code.