60%

Section 03: drift_classes dossier_constraint_violation detector (HALT_GATING)

Goal

Detect, at the registry layer, when a downstream section’s planned work targets a registered do-not-touch symbol, and emit a halt-gating finding that forces the section back through /review-section before it executes.

Implementation Sketch

register_drift_class entry (drift_classes.py:178); DetectorFn(plan_dir, section_arg) -> list[DriftFinding]; make_finding (240) with Severity.HALT_GATING (66); classify_fn -> CureKind.LLM_REQUIRED (48). Per-class detector module under scripts/plan_corpus/.

Spec References

scripts/plan_orchestrator/drift_classes.py (register_drift_class:178, make_finding:240, CureKind:48, Severity:66); scripts/plan_orchestrator/drift_scanner.py (scan_plan).

Work Items

  • TDD-first: pin that a downstream section whose work-items/dossier symbols intersect a registered constraint produces a HALT_GATING DriftFinding routing to /review-section; failing tests in scripts/plan_corpus/tests/.
  • Register a dossier_constraint_violation drift class via register_drift_class(class_id, detector_fn, classify_fn, cure_fn=None); detector scans the next section’s work-items + dossier symbols against binding_constraints[]; make_finding(…, severity=Severity.HALT_GATING, halt_gating=True); classify_fn -> CureKind.LLM_REQUIRED (route to /review-section with mission_drift_detected forced).
  • Layer-closure: the detector is discovered mechanically by drift_scanner.scan_plan; halt-gating finding blocks the loop until cured; tests cover positive (intersection) + negative (no intersection).

Items

  • TDD-first: author scripts/plan_orchestrator/tests/test_forward_coherence_03.py (this section’s registered success-criterion probe) as a FAILING pin that drift_scanner.scan_plan, given a served/downstream section whose body references a do-not-touch symbol declared by a DIFFERENT section’s intel dossier, surfaces a HALT_GATING DriftFinding (cure_kind=LLM_REQUIRED, routes to /review-section) whose constrained_symbols + declared_by are SOURCED from route_walk.dossier_constraint_violation_or_none (the §00 predicate), NOT a re-derived intersection. Negative pin: a non-intersecting served section yields no finding (no thrash). The test fails today because the dossier_constraint_violation drift class is not yet registered.
  • Register a dossier_constraint_violation drift class in drift_classes._register_initial_classes via register_drift_class(class_id, detector_fn, classify_fn, cure_fn=None); place the per-class detector module under scripts/plan_corpus/detectors/ (matching the existing per-class-detector convention). detector_fn(plan_dir, section_arg) resolves the served/next section’s body from plan content and DELEGATES to route_walk.dossier_constraint_violation_or_none(plan_dir, served_section_id, served_body_text) — the §00 predicate that owns the sibling-dossier constrained_symbols aggregation + do-not-touch intersection. It MUST NOT independently re-scan binding_constraints[] or re-derive the aggregation. On a non-None verdict, wrap it via make_finding(…, severity=Severity.HALT_GATING, halt_gating=True, cure_kind=CureKind.LLM_REQUIRED) carrying verdict[‘constrained_symbols’] + verdict[‘declared_by’] as evidence/suggested_cure; classify_fn -> CureKind.LLM_REQUIRED (route to /review-section with mission_drift_detected forced). Exception-safe: a None verdict yields zero findings.

Fresh intel (regenerated)

{ “schema_version”: 1, “target”: { “kind”: “plan-section”, “ref”: “plan-forward-coherence/s-428dea2f” }, “generated_at”: “2026-06-26T00:45:13.419484+00:00”, “graph_state”: { “head_sha”: “8f006d26”, “last_code_import_at”: “2026-06-26T00:45:06.937Z”, “embedding_stale”: false, “insights_stale”: false, “cpg_stale”: false }, “surfaces”: {}, “summary”: “intel-package[plan-section:plan-forward-coherence/s-428dea2f] agent-authored dossier”, “degraded”: false, “dossier”: { “objective_symbols”: [], “tiers”: {}, “agent_authored”: true, “constrained_symbols”: [ “dossier_constraint_violation_or_none”, “resolve_scheme_var” ], “difficulty”: { “class”: “routine”, “research_online”: false, “research_mode”: “auto”, “signals”: [], “plan_dir”: “/home/eric/projects/ori_lang/plans/plan-forward-coherence” } } }

(full dossier: dossier-constraint-detector—s-428dea2f.intel.json)