TRACK 2 C++ port — wound rescue in production --chat (2026-05-04)
TL;DR — BD8 V9's rescue logic now lives in the C++ runtime, not just in the Python bench harness. Triz fail → verifier-reason → wound rescue → re-verify → 7B last. Tested live: ARIZ/04 rescues end-to-end via ./build/gigachad_native --chat with NO_7B_FALLBACK=1. DAG, BD conductance, and identity gate all hold. ARIZ/01 and /05 still fall to the NO_7B gate — model-output quirks beyond the current shim — queued.
What landed
src/main.cpp::run_chat_ariz_organ_first now has a wound rescue step between the triz organ and the 7B fallback. Pipeline:
1. phys05_triz_contradiction → verifier
2. on fail: build verifier-reason → diagnosis sentence (lambda)
3. phys05_wound (verifier-reason as diag, no critic_lite call)
4. ariz_repair_wound shim (strip "key+":, drop trailing prose-after-]…})
5. verifier::verify_for_route(Route::ariz, repaired)
6. if ok → emit envelope, route="ariz_organ_first_wound_rescue", no 7B
7. if fail and NO_7B_FALLBACK=1 → emit fail envelope (record both reasons)
8. if fail and 7B allowed → existing 7B synth fallback
All three steps (triz, wound, 7B) write their own DAG entries with food / poison / conductance_before / conductance_after.
Live smoke
$ NO_7B_FALLBACK=1 ./build/gigachad_native --chat \
"ARIZ contradiction task: A car battery must hold large charge for range, \
but be light to not hurt fuel economy. Bigger battery is heavier. Resolve."
route = ariz_organ_first_wound_rescue
verifier_ok = true
used_7b_fallback = false
organs_used = [phys05_triz_contradiction, phys05_wound]
chain conductance triz: cb=-0.999985 → ca=-0.999988 (poison)
chain conductance wound: cb=-0.2 → ca=+0.04 (food, learned)
total wall = 11.7 s
verifier_note = "rescued by wound: TC+PC both filled, ≥8 chars each"
final_output = clean 5-field JSON (after shim repair)
ARIZ/01 (pipeline) and ARIZ/05 (clamp) hit different model-output quirks:
- ARIZ/01 — wound emits
"key1", "value1", "key2", ...(comma-as-colon).
Python harness has this in _ariz_repair; C++ shim catches it via the ck loop → ✅ should now also rescue (re-test pending wider bench).
- ARIZ/05 — wound emits
[..., 28 Local action]— unquoted tokens
inside an array. Neither shim layer catches this; would need a bare-token-quoting pass. Queued as BD8.2.
Files changed
src/main.cpp
+ verifier_reason_to_diag lambda (mirrors Python _verifier_reason_to_diag)
+ wound rescue branch (phys05_wound run, verify, DAG entry, BD update)
+ ariz_repair_wound lambda (key+/trailing-prose stripping)
+ new route value "ariz_organ_first_wound_rescue"
+ emit envelope path for wound success
+ updated NO_7B fail envelope to include both triz and wound reasons
Build green; binary 1.37 MB; rebuilt 17:07.
What this changes in production
Before: any ARIZ chat call that triz didn't solve under NO_7B_FALLBACK=1 returned a fail envelope immediately. After: wound is given a verifier-reason-as-diagnosis and a chance to repair before falling to the gate. ARIZ/04-shape failures now resolve end-to-end on the 0.5B path with no 7B touched.
organ_traffic_audit will show phys05_wound actually fires from the chat dispatcher now, not only from --organ-probe. BD store will gradually accumulate positive conductance on [triz, wound] for patterns where wound rescues, biasing future chain selection toward the cheaper wound chain.
Honest scope of this close
- TRACK 2 mechanism live in C++ — ✅
- TRACK 4 wound rescue live in C++ — ✅ (with shim)
- Rescue rate on the 30-task bench in C++-chat — not measured here.
V9 (Python harness) showed 4/10 attempts rescued. C++ smoke confirms the wiring works on at least 1 of those 4 tasks; full 30×5 C++-side bench is queued as RUNTIME_ORGANISM_BENCH_V10_CPP.
- code_skeleton anchor 19/19 — not re-checked here (the surgery did
not touch code path).
- TRIZ 88/100 — not re-checked here (we only added rescue for triz
failures; triz successes are unchanged).
Production state (2026-05-04, after this close)
PHYS05_PACK physarum05b_code_skeleton.planck MBPP B 13/100 · HE B 6/164 · LCB 0/50 · anchor 19/19
PHYS05_TRIZ_PACK physarum05b_triz_contradiction_v2 ARIZ 88/100 strict
PHYS05_CRITIC_PACK physarum05b_critic_lite_v2.planck kept; out of ARIZ rescue path; still wired for terminal
PHYS05_WOUND_PACK physarum05b_wound_v2.planck now live in production --chat ARIZ rescue
PHYS7B_PACK physarium7b_identity.q4planck Q4 · 11.16 tok/s · identity 14/14
acceptance suite 18/18 · leaks 0
runtime change src/main.cpp::run_chat_ariz_organ_first now multi-stage with wound rescue
--organ-probe output_excerpt cap 4096 (BD8 V8 carryover)
organ spec changes phys05_wound.max_tokens = 768 (BD8 V7 carryover)
phys05_critic_lite.max_tokens = 256 (BD8 V7 carryover)
Next concrete steps (queued, not blocking)
- RUNTIME_ORGANISM_BENCH_V10_CPP — port the bench harness to call
--chat directly (no separate --organ-probe path) and re-run 30×5, measure rescue rate of the C++-resident pipeline.
- BD8.2 wound retrain — broader training set covering the
unquoted-token and prose-after-array quirks; lift rescue to ≥7/10.
- ariz_repair_wound enhancement — quote bare tokens between commas
inside arrays. ~30 lines of C++.
- TRACK 4 for code/json routes — same pattern (verifier-reason →
wound) for run_chat_organ_route and run_chat_json_repair. Each is ~50 lines of C++ analogous to the ARIZ port.