Skip to content

The harness loop

The harness is everything around the model: turn bookkeeping, the todo list, the transcript. Since the model writes those itself, ka reads them back and pushes on claims that do not hold up. Every check in this loop is data-driven (it reads the todo list and the transcript; it never guesses at code correctness) and every action it takes rides the strand as a normal record, visible on every surface.

The todo hand accepts an optional confidence 0-100 per item, rated when the item is assigned and re-rated when it is marked done. An item flipping from pending to done with a low-to-high jump (≤40 to ≥90) is a claim, not a measurement: the tool result carries a re-check advisory and the transcript gets a matching note, prompting the model to actually verify what it just declared finished.

Unrated items never trip it. The wire omits confidence when absent, so older strands and simpler models are unaffected.

A turn that settles while the model’s own todo list still has pending items is an early exit, not a finish. ka continues the work itself with a bounded continuation round: the prompt names the pending items, asks for verification of any confidence spikes, and rides the strand as a normal user message.

[pokes]
max = 3 # continuation rounds per settling; 0 disables

Pokes stop on non-done stops (aborts and errors; wire retries have already run for transient failures), in plan mode, when the pending set stops moving, and at max. The same loop drives headless ka run, so one prompt keeps iterating until the todo list is actually clear.

When a plan-mode turn finishes, the fast role rates the goal 0-100 for hill-climbability: is there a measurable, iterable objective to optimize against? Below 70, the harness pushes back with a note asking for a verifiable objective (a test to pass, a benchmark to move) and suggests wiring the [verify] loop. One cheap call per plan turn; without a fast role configured, or on a failed call, it stays silent. Non-plan modes never rate.

The harness-authored core of the system prompt (identity, todo discipline, the plan-mode block) is contract-capped at 2 KiB, about 500 tokens; a CI test fails if it grows. Project instructions, skills, memory, and digest summaries are session data layered outside that budget, so the core stays cheap and prompt-cache-stable across projects.