Apply reshuffles/rewrites via sanctioned restructure primitives
Goal
The forensic pass APPLIES the reorganization (locked decision: apply, not propose), driving the existing /review-section restructure ops (move/abandon/reorder/split/rewrite-from-intel) from the per-section forensic verdicts + the hardship dossier: abandon/reorder OBE/superseded sections, relocate work_items off dead-end approaches, rewrite drifted bodies toward the mission. Every applied mutation is logged to the committed dossier with its WHY.
Implementation Sketch
Restructure ops are the sanctioned plan.json mutators (review-section/SKILL.md restructure —op <move|abandon|reorder|split|append|section-create|rewrite-from-intel>; review_section_runtime/api.apply_restructure). plan.json is script-only (plan-read-discipline.md §2.1) so EVERY mutation routes through that API; raw plan.json edits are BANNED. The aims-burden case has a concrete OBE class (the §12-partition marked OBE) + 132 dead-ends to relocate work off.
Spec References
scripts/review_section_runtime/api.py (apply_restructure — the sole mutator); scripts/plan_orchestrator/review_plan.py (map forensic verdict -> restructure op); scripts/review_plan_runtime/forensic_dossier.py (append_mutation audit log).
Work Items
- Map each per-section forensic verdict (from 03) to a sanctioned restructure op: OBE/superseded -> abandon/reorder; dead-end-aligned work_item -> move; drifted body -> rewrite-from-intel; oversized -> split. The mapping is data-driven (a verdict->op table), not ad-hoc.
- Cross-section reshuffle pass: reorder the section chain toward mission order, abandon OBE sections (e.g. the §12-partition-OBE class), relocate work_items off DO-NOT-RE-TRY approaches. All via apply_restructure; the linear-DAG (INV-19) stays valid after each move (re-run the DAG check).
- forensic_dossier.append_mutation: log every applied mutation {op, target, before, after, why (the dead-end/evolution/OBE finding that justified it)} to the committed dossier — the reshuffle audit trail.
- Guardrail test: assert NO raw plan.json Write/Edit occurs in the forensic apply path (every mutation goes through apply_restructure); INV-15 flat-node invariant preserved (no parent_id/depends_on regression).
- pytest scripts/plan_orchestrator/tests/test_forensic_restructure_apply.py: a fixture with an OBE section + a dead-end-aligned work_item gets abandoned/relocated via the primitives AND logged to the dossier; semantic pin on the verdict->op mapping.
Fresh intel (regenerated)
{ “schema_version”: 1, “target”: { “kind”: “plan-section”, “ref”: “zeroed-plan-forensic-review/s-27dd3651” }, “generated_at”: “2026-06-20T03:23:24.187040+00:00”, “graph_state”: { “head_sha”: “e4b7c39a”, “last_code_import_at”: “2026-06-20T03:20:27.714Z”, “embedding_stale”: false, “insights_stale”: false, “cpg_stale”: false }, “surfaces”: {}, “summary”: “intel-package[plan-section:zeroed-plan-forensic-review/s-27dd3651] agent-authored dossier”, “degraded”: false, “dossier”: { “objective_symbols”: [], “tiers”: {}, “agent_authored”: true, “difficulty”: { “class”: “routine”, “research_online”: false, “research_mode”: “auto”, “signals”: [], “plan_dir”: “/home/eric/projects/ori_lang/plans/zeroed-plan-forensic-review” } } }
(full dossier: restructure-application-sanctioned-primitives—s-27dd3651.intel.json)