86%

Three boundary hygiene rules (enforce + least-resistance)

Goal

  • Author the three gap-rules research confirmed absent; each cites the registry/lint as backing.
  • Extend PHASE-54, never restate it — restating the umbrella would be the LEAK this plan guards against.

Implementation Sketch

  • Registration-required (COVER family): a new canon-IR consumer MUST appear in ori_ir::canon::consumers with its pool subset; lint-enforced.
  • Least-resistance (PHASE/SSOT family): the canonical read-API MUST be at least as ergonomic as re-deriving; a canonical query more painful than the re-derivation shortcut is itself a LEAK:frontend-reimplementation risk factor.
  • Proactive-at-add (mirrors DESIGN-23 fires-on-first shape, scoped to MEANING re-derivation): the first hand-rolled name-res/type-inf/trait-op-res/pattern-compilation in a NEW consumer is LEAK:frontend-reimplementation, caught at authoring; scope ori_eval runtime-dispatch as allowed.
  • Add matching finding-categories.md subcats; no-duplication check vs PHASE-54 (cite/extend, never restate).

Spec References

impl-hygiene.md PHASE-54 / DESIGN-23 / COVER-* / SSOT-*; finding-categories.md LEAK:frontend-reimplementation; skill-vocabulary.md §3 (prescriptive-only).

Work Items

  • Complete the registration-required rule by replacing the existing COVER-35 STUB text at impl-hygiene.md:272 in place — do NOT allocate a new COVER number (COVER-35 is already the highest COVER id in the file and its own stub sentence names this section as the landing site). Land the full rule text (severity, cure, pin-via, matching the - PREFIX-NN (was CATEGORY:subcat): directive (Severity); cure; pin via ... shape every other rule follows) citing ori_ir::canon::consumers::CANON_CONSUMERS (compiler/ori_ir/src/canon/consumers.rs) as the registry and compiler_repo/scripts/crate-dag-lint.py check_registered_consumers / check_unregistered_consumers as the lint-enforced backing. Extend PHASE-54 + COVER-09, never restate either.
  • Author the least-resistance rule (PHASE/SSOT family) with the ergonomics-risk-factor directive.
  • Author the proactive-at-add rule mirroring DESIGN-23’s shape, scoped to meaning re-derivation, ori_eval dispatch carved out.
  • Add finding-categories.md subcats + run the no-duplication check against PHASE-54.
  • Add finding-categories.md subcats: one new/extended LEAK:* sibling to the shipped LEAK:frontend-reimplementation (finding-categories.md:25) per new/completed rule in this section (the completed COVER-35 registration-gap, the new least-resistance rule, the new proactive-at-add rule) — cite/extend PHASE-54, never restate it. Then regenerate the frozen token surface: run python -m scripts.finding_categories freeze and verify with python -m scripts.finding_categories freeze --check (must report ‘freeze in sync’) so category_tokens() reflects the new subcats, not just the .md. Finally run the no-duplication check the section’s own Goal demands: re-read PHASE-54’s full text (impl-hygiene.md:112) immediately before finalizing each new rule’s wording, and confirm python3 -c "from scripts.impl_hygiene_review_runtime.rules_parser import load_rules; from scripts.impl_hygiene_review_runtime.rule_metadata import finding_categories_tier_drift; rs=load_rules('.claude/rules/impl-hygiene.md'); print(finding_categories_tier_drift(rs, '.claude/rules/finding-categories.md'))" reports only the 2 pre-existing, unrelated drift entries (dead-instrumentation-dependency, trace-target-naming-drift) with no new drift introduced by this section’s edits.
  • Fix the section’s own plan-wide success criterion sc-20775d1462 BEFORE authoring any of the three rules: its probe_ref (python -m scripts.plan_corpus check-rules impl-hygiene finding-categories) names a nonexistent scripts.plan_corpus subcommand — verified live, argparse rejects ‘check-rules’ and lists the real choices as check|discover|docgen|migrate|coherence|export|resolve-content-hash-drift-detected|advance-section|set-cross-plan-needs|recover-layer-criteria. This is the THIRD instance of the identical phantom-probe_ref defect class in this plan (walking-skeleton’s dossier flagged its own instance; consumer-registration-lint’s w-8a2865ab already fixed sc-5a808987f4’s phantom scripts.consumer_ssot_lint the same way). Amend sc-20775d1462 via scripts/plan_corpus/write.py:amend_success_criterion (never a hand-edit — plan.json is script-only per plan-read-discipline.md Sec2.1) to point at the real, working parity machinery: rules_parser.load_rules('.claude/rules/impl-hygiene.md') (verified: parses 610 rules) composed with rule_metadata.finding_categories_tier_drift(rule_set, '.claude/rules/finding-categories.md') (verified: runs clean modulo 2 pre-existing unrelated drift entries), or a thin —self-test wrapper over them — never the fictional check-rules CLI verb. This section cannot honestly claim its own north-star gate is provable while its criterion’s probe_ref does not resolve to a real command.
  • (abandoned) COVER family, next free number

Fresh intel (regenerated)

This section authors PROSE (three impl-hygiene.md rules + finding-categories.md subcats), not code — its “terrain” is a rule-catalog gap, not a Rust symbol surface. The registry+lint spine it cites (ori_ir::canon::consumers + crate-dag-lint.py) is ALREADY FULLY BUILT, WIRED, AND GREEN on the real tree (verified live: crate-dag-lint.py exits 0, --self-test passes, lefthook + test-all.sh both invoke it in --warn-only mode). This section’s entire job is to turn three implicit facts into three explicit, citable rules.

Three decisions this package forces before any prose is written:

  1. The section’s own plan-wide success criterion (sc-20775d1462) is a phantom-primitive-ref — the THIRD instance of this exact defect class in this plan. Its probe_ref is python -m scripts.plan_corpus check-rules impl-hygiene finding-categoriescheck-rules is not a valid scripts.plan_corpus subcommand (verified live: argparse rejects it, real choices are check|discover|docgen|migrate|coherence|export|resolve-content-hash-drift-detected|advance-section|set-cross-plan-needs|recover-layer-criteria). Both sibling sections already hit and fixed the identical shape on their own criteria (walking-skeleton’s dossier flagged it; consumer-registration-lint’s w-8a2865ab fixed sc-5a808987f4’s phantom scripts.consumer_ssot_lint). This section MUST fix sc-20775d1462’s probe_ref via scripts/plan_corpus/write.py before it can honestly claim its own north-star gate — never author the three rules while leaving the criterion unprovable.
  2. A real, working parity-checker already exists for exactly this criterion’s intent — reuse it, don’t invent a new probe. scripts/impl_hygiene_review_runtime/rules_parser.py:load_rules('.claude/rules/impl-hygiene.md') (verified live: parses 610 rules across the 14 canonical PREFIX-NN families) + rule_metadata.py:finding_categories_tier_drift(rule_set, fc_path) (verified live: runs clean against the current tree modulo 2 PRE-EXISTING, unrelated drift entries — dead-instrumentation-dependency and trace-target-naming-drift tier mismatches, neither touching this section’s rules) is the SSOT parity machinery. scripts/finding_categories/api.py:category_tokens() is the sibling machine-readable token freeze. The corrected probe_ref should invoke one of these (or a thin --self-test wrapper over them), never a fictional CLI verb.
  3. COVER-35 (the walking-skeleton’s stub) currently has NO finding-categories.md counterpart at all — confirmed by the drift-checker’s silence. finding_categories_tier_drift only flagged 2 UNRELATED pre-existing mismatches; it said nothing about COVER-35 because COVER-35 carries no (was CATEGORY:subcat) tag to check. This section’s w-bdd9abd3 (“Add finding-categories.md subcats”) is not cosmetic — it is closing a real, currently-invisible-to-tooling gap. The natural home is a LEAK:* sibling family to the ALREADY-SHIPPED LEAK:frontend-reimplementation (finding-categories.md line 25) — one new/extended subcat per rule (COVER-35 registration-gap, the new least-resistance rule, the new proactive-at-add rule), never a restatement of frontend-reimplementation itself.

DIG DEEPER

scripts/intel-query.sh plan-status canonical-consumer-boundary --human
scripts/intel-query.sh dag-ascii canonical-consumer-boundary --human
python -m scripts.plan_corpus.read plans/canonical-consumer-boundary --criteria --section s-8001a4b8
python -m scripts.plan_corpus check-rules impl-hygiene finding-categories   # confirms: invalid choice, reproduces finding #1
python3 -c "from scripts.impl_hygiene_review_runtime.rules_parser import load_rules; from scripts.impl_hygiene_review_runtime.rule_metadata import finding_categories_tier_drift; rs=load_rules('.claude/rules/impl-hygiene.md'); print(rs.rule_count, finding_categories_tier_drift(rs, '.claude/rules/finding-categories.md'))"

(full dossier: boundary-hygiene-rules—s-8001a4b8.intel.md)