# Score-Blind Plan Amendment (`PLAN.v3.md`): `P_counterfactual` Format & Prompt-Cache Fix

- **UTC:** `2026-11-24T11:24:00Z`
- **Status at amendment:** Strictly **score-blind** (`PLAN.md` untouched at `be0a8d31`; `PLAN.v2.md` at `138383de`). Prior to completing Part B, `llama3-3b` (`P_counterfactual` 180 items) parsed only `108/180 (60.0%)` because the model emitted `Step 3 (Rule-based Score): 2` or `<5>` angle brackets, and `qwen3-4b` (`P_counterfactual` 137 items before halt) parsed `4/137 (2.9%)` because all `137/137` hit `finish_reason="length"` at `max_tokens=220` while narrating Step 2 prose. Meanwhile both `llama3-3b` and `qwen3-4b` achieved `180/180 (100.0%)` valid parses on both `P_naive` and `P_v0`. Zero arm means, pair accuracies, gaming gaps, or `H2`–`H4` outcomes were computed or read prior to this amendment.

## Exact Technical Changes (Zero Change to `HTV-Unseen-v1`, `P_naive`, `P_v0`, or `H1`–`H4` Rules)
1. **Clean partial removal:** Stripped all prior `P_counterfactual` rollout lines from `out/rollouts_llama3-3b.jsonl` (180 removed) and `out/rollouts_qwen3-4b.jsonl` (137 removed), preserving the exact `360` verified `180 P_naive + 180 P_v0` records in each file (`100.0%` parsed). `mistral-7b` (`0` prior records) runs all `540` items cleanly under the updated runner.
2. **Concise `v0`-matched `P_counterfactual` template (`code/prompts.py`):** Placed the static `V0_RUBRIC_BODY` and 2-step counterfactual substitution rules (`Core swap`, `Extra swap`, and ordered rule `1 -> 5` `Score`) in the `system` prompt, requesting three concise lines (`Core swap: ...`, `Extra swap: ...`, `Score: <1-5>`). Updated `SCORE_LINE_RE` / `SCORE_FALLBACK_RE` to tolerate `Rule-based Score` and optional `<?([1-5])>?`. `V0_RUBRIC_BODY`, `P_naive`, and `P_v0` prompt strings remain byte-identical.
3. **Runner & KV prefix caching (`code/run_mac_eval.py`):** Kept `llama.cpp b12674` CPU (`--n-gpu-layers 0 -t 6`, default `mmap`, `-c 2048`), lowered `P_counterfactual` `max_tokens` to `180`, and enabled `"cache_prompt": True` so shared `system` prefixes reuse cached KV states under deterministic greedy decoding (`temperature=0.0`, `top_k=1`, `seed=0`). Smoke-tested on 1 held-out synthetic item across all three models (`llama3-3b`: 27 tok `finish=stop`, `qwen3-4b`: 50 tok `finish=stop`, `mistral-7b`: 45 tok `finish=stop`, `100%` valid parse).
