Isolates the two effects conflated in builder-adversary-stateless: keeps all the CONTEXT HYGIENE (compact/diffs/lean loads) but ENFORCES full per-gate review granularity (one claim per gate, one independent verdict per gate, no batching). Tests whether the token saving is real efficiency vs reduced scrutiny. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
33 lines
1.8 KiB
Markdown
33 lines
1.8 KiB
Markdown
# Phase `json` — machine-readable output
|
||
|
||
**Mission.** Extend the `wc.py` from the previous phase with a `--json` mode, without regressing any
|
||
`wc`-phase behaviour. Single source of truth for this phase.
|
||
|
||
(The phase config gives the Builder `claude-opus-4-8` for this phase — an example of a per-phase
|
||
model override; the Adversary stays on the default model.)
|
||
|
||
## Definition of Done
|
||
|
||
- **D1 — json output.** `python wc.py --json FILE` prints a single JSON object:
|
||
`{"lines": N, "words": N, "chars": N, "file": "FILE"}` (valid JSON, parseable by `json.loads`).
|
||
With stdin (no FILE), `"file"` is `null`.
|
||
- **D2 — composes with flags.** `--json` honours `-l/-w/-c`: only the requested counts appear as keys
|
||
(plus `file`). E.g. `wc.py --json -l FILE` → `{"lines": N, "file": "FILE"}`.
|
||
- **D3 — no regression.** Every `wc`-phase gate (D1–D4 there) still passes unchanged.
|
||
- **D4 — tests green.** `test_wc.py` is extended for the JSON cases and `pytest -q` is all-green.
|
||
|
||
## How the Adversary verifies (cold)
|
||
|
||
```bash
|
||
pytest -q # D4 + D3 regression
|
||
printf 'a b c\nd e\n' > /tmp/f.txt
|
||
python wc.py --json /tmp/f.txt | python -c 'import sys,json; d=json.load(sys.stdin); \
|
||
assert d=={"lines":2,"words":5,"chars":10,"file":"/tmp/f.txt"}, d; print("ok")' # D1
|
||
python wc.py --json -l /tmp/f.txt # D2: expect {"lines": 2, "file": "/tmp/f.txt"}
|
||
```
|
||
|
||
The Builder restates the exact commands, expected JSON, and commit sha in
|
||
`machine-docs/STATUS-json.md`. When every DoD item has a fresh PASS in `machine-docs/REVIEW-json.md`
|
||
and there is no `## VETO`, the Builder writes `## DONE` to `STATUS-json.md` — this is the last phase,
|
||
so the watchdog then fires the one-shot `reporter` (see `agents.toml` `[loop].on_complete`).
|