feat(simulation): K4 — closed-loop two-run simulation binds §11 'Closed loop' (closes R-1)

Scripted two-run driver over the run.py composition: run A -> persona verdict
(shared skill artifact) -> §6 promotion gate -> run B on a fresh store. The
marker crosses runs via the promoted wiki layer ONLY - run B reads no inbox,
a rejected verdict is refused fail-closed and its marker never crosses.
Two detach proofs delivered (promotion step removed -> red; verdict exclusion
in bundle_context removed -> red via the '## verdict' section anchor).

Known-limitation note (C-F5, deferred to C3.2): a persona verdict over the
bundle seed's own candidate mints the seed's §4.2 id and is silently shadowed
by first-write-wins; the test has run A propose a distinct candidate.

395 -> 400 tests; README synced (test count + the S10 section now reflects
that D7 has its own scripted closed-loop proof).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-07-17 03:47:05 +02:00
commit d4efdd9a35
3 changed files with 341 additions and 5 deletions

View file

@ -13,7 +13,7 @@ human-in-the-loop, and the system learns from the verdicts.
> **Status:** the D7 build (S5S10) is complete, and the deterministic **ingest layer**
> (CSV and SQL source types) has since been added in front of the loop. The deterministic
> backbone, the agentic loop, the learning loop, and the ingest connectors are wired seam by
> seam, each proven by load-bearing tests (395 tests, all running offline without an API
> seam, each proven by load-bearing tests (400 tests, all running offline without an API
> key). The programme's single budgeted **live model run has been executed and validated**
> its artifacts are committed under [`runs/s10/`](runs/s10/) (see below).
@ -130,9 +130,11 @@ layer works and how one would extend it is documented in [`docs/extending.md`](d
## The live run — S10, executed and validated
Where the MAF sibling proves its loop end-to-end with a scripted offline simulation, this
repo's end-to-end proof is the programme's single budgeted **real** run (D6: exactly one
live API run in the whole programme), executed 2026-07-03 against the micro bundle
The loop's closure is proven offline by a scripted two-run simulation
(`simulation.py`: run A → persona verdict → §6 promotion gate → run B on a fresh store —
the marker crosses runs via the gate, and never without it). On top of that offline proof
sits the programme's single budgeted **real** run (D6: exactly one live API run in the
whole programme), executed 2026-07-03 against the micro bundle
[`shared/examples/bygg-energi-mikro/`](shared/examples/bygg-energi-mikro/):
- exit 0 · validator `validated` · checker `approve` on the first attempt · 2 of 12
@ -156,7 +158,7 @@ Python ≥3.10 · [`claude-agent-sdk`](https://pypi.org/project/claude-agent-sdk
```bash
uv sync # install dependencies
uv run pytest # 395 tests — run without any API key and without network
uv run pytest # 400 tests — run without any API key and without network
uv run ruff check . && uv run ruff format --check .
uv run mypy src # strict
```