A harness is a governance and reliability control plane around an autonomous agent: the agent has intelligence, the harness has authority. The agent proposes; the harness decides what's allowed to happen next; evidence decides whether the result is accepted. Every non-trivial turn walks the same eleven layers of it, in the same order, whether it's Aielia (Build A Harness's own reference chat agent) or a flow drawn on the canvas. This is that loop — World Model through Reviewer Pass — read out of the harness source (packages/harness, with its Python twin in adapter/harness/). Click any layer below to open its internal flowchart.
The chart follows one non-trivial turn in the order the harness actually executes it. Before the loop the assistant's adaptive layer control decides how much of the harness the turn needs, and the harness initializes its state. Then every iteration thinks (contradiction check, hypotheses, diagnostics, control state, planning), acts (the execution gate, the tool call, then the evidence and world model are updated from what came back) and checks (diagnostics and control state re-scored, verification, and recovery if the task failed), and repeats until every task is complete. The reviewer pass runs once after the loop, and again if it reopens a task; then the answer is validated. Layers keep the numbers used in the code and docs, drawn in execution order. Click any layer, or any 🤖 hook, for its own flowchart.
A single consolidated call up front (adaptive layer control) (risk, triviality, decomposition, plan-abandonment, plan-template matching) flags a genuinely self-contained factual one-liner as trivial — that reply returns directly and none of the eleven layers above run. Everything else walks the full loop. See Aielia for how this applies turn by turn in the reference chat agent.
The eleven layers above run inside a single proposer loop (ASSISTANT_ONE_LOOP, on by default): the harness drives one tool-calling iteration at a time instead of reviewing a finished reply. Four mechanisms wrap that loop. The diagram shows one turn with all of them enabled: the goal graph decides which thread has focus, the steering channel is polled at the start of every iteration, the Supervisor is consulted only if an iteration stalls, and once the reply is out, up to three next-step options appear under it. Click any card, or any 🤖 hook in the chain above, for its flow.
All four are on by default in Aielia's CLI and chat-ui (the assistant library itself leaves steering, the goal graph and next-step options off): the one-loop proposer (ASSISTANT_ONE_LOOP), the Trajectory Supervisor (HARNESS_TRAJECTORY_SUPERVISOR), and mid-turn steering with the goal graph (ASSISTANT_GOAL_GRAPH), and the next-step options (ASSISTANT_GOAL_GRAPH_SUGGEST). Each has an explicit disabled (or 0) escape hatch. With steering and the goal graph disabled, a message sent during a turn waits in line exactly as it did before, and no goal graph is kept.
Also by default: the lexical checks under the semantic layers are off (ASSISTANT_LEXICAL_MODE=disabled since 2026-09-28, so contradiction, failure matching and injection detection run on the LLM check alone), the grounding check behind a verified label is on, and so is the semantic judge for caller constraints. Also on: the single retry of a system-error failure (AUDIT_RETRY_SYSTEM_ERRORS), semantic failure matching, resuming a stuck plan only when the message continues it, and the budgeted, priority-ranked facts render with keyed supersession (AUDIT_MEMORY_BUDGETED_RENDER; =0 restores the old 20-fact slice). Off by default, behind AUDIT_* flags: semantic hypotheses, reviewer revision, semantic transcript compaction, experience learning, source reliability, the memory write gate, memory audit log, episodic digests with the recall tool, the memory reviewer and memory consolidation (AUDIT_MEMORY_WRITE_GATE, AUDIT_MEMORY_AUDIT_LOG, AUDIT_EPISODIC_DIGEST, AUDIT_RECALL_TOOL, AUDIT_MEMORY_REVIEWER, AUDIT_MEMORY_CONSOLIDATION), the per-step task-completion check, contradiction severity, code plan templates, retrying every failed task, and ask mode (ASSISTANT_ASK_MODE, which lets the Supervisor and the harness put a structured question to you). The adaptive layer policy is also off: the static policy is the default.
Memory is separate from the World Model, which is rebuilt empty every turn. Everything that reaches it goes through one service, so no writer can choose its own route: where a candidate lands depends on where it came from, how confident it is, and the configured write mode. By default only the budgeted facts block with keyed corrections is new; the write gate and the cross-turn writers are opt-in and grayed below. Click any box for its details.
/memory confirm), and stays session-only at low. With memoryWriteMode=user_only even a high-confidence inference waits for you.memoryWriteMode · AUDIT_MODEL_INFERRED_FACTS/memory off stops all memory writes. Cross-turn writers are staged for your approval by default and nothing is deleted automatically. The write gate redacts secrets and flags instruction-like text, failing closed when its check cannot run; it is off by default and showed no outcome gain, because the base model already resisted.memoryWriteMode · AUDIT_MEMORY_WRITE_GATErecall_memory tool, and the result is wrapped as untrusted data. Digests are kept 90 days by default.AUDIT_RECALL_TOOL · AUDIT_EPISODIC_RETENTION_DAYSThe corrections behaviour is the only memory change with a demonstrated outcome difference. The write gate, audit log, digest and recall, reviewer and consolidation are mechanisms that work in testing; their value on real use is unmeasured or small-sample, and a plain-language forget request is only staged for your approval (a known gap).
All eleven layers above are drawable, composable node types on the canvas — tested, with architectural invariants permanently enforced as CI gates. Apache 2.0, runs locally via Docker.