100%

Validation + staleness + read-only gates

Goal

Wire the generated-view safety gates, mirroring the existing lefthook validate hooks: schema-validate impl-hygiene-rules.json (mirror orchestration-rules-validate), staleness lint (generated .md older than the JSON source -> fail, mirroring render_staleness_lint.py), and a read-only guard blocking hand-edits to the generated impl-hygiene.md / impl-hygiene-authoring.md.

Implementation Sketch

Add a lefthook impl-hygiene-rules-validate hook running the loader’s schema validation on staged impl-hygiene-rules.json. Author a staleness lint comparing source mtime/hash vs generated-view; wire it blocking in lefthook.yml. Add a read-only guard (PreToolUse hook or lefthook) rejecting edits to the generated views that did not come from the generator (the READ-ONLY banner is advisory; the hook is the enforcement). Self-tests for each gate.

Spec References

lefthook.yml (orchestration-rules-validate / commit-push-rules-validate / schema-protection precedents); scripts/plan_corpus/render_staleness_lint.py:1-100 (staleness scan precedent); .claude/hooks/block-route-edits.sh (read-only-edit-guard precedent).

Work Items

  • Add lefthook impl-hygiene-rules-validate hook (schema-validate staged impl-hygiene-rules.json via the loader).
  • Author + wire (blocking) a staleness lint: generated view stale vs JSON source -> fail.
  • Add a read-only guard rejecting non-generator edits to the generated impl-hygiene.md / impl-hygiene-authoring.md.

Success Criteria

  • [sc-49384b51] Schema-validate + staleness + read-only-guard gates are wired and fire on a deliberately-broken fixture. (probe: pytest scripts/impl_hygiene_rules_runtime/tests/test_gates.py -q; expect: passed)

Fresh intel (regenerated)

{ “schema_version”: 1, “target”: { “kind”: “plan-section”, “ref”: “impl-hygiene-rules-as-data/s-587cd8eb” }, “generated_at”: “2026-06-21T05:48:33.010998+00:00”, “graph_state”: { “head_sha”: “b0bd51a8”, “last_code_import_at”: “2026-06-21T05:27:29.206Z”, “embedding_stale”: false, “insights_stale”: false, “cpg_stale”: false }, “surfaces”: {}, “summary”: “intel-package[plan-section:impl-hygiene-rules-as-data/s-587cd8eb] 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/impl-hygiene-rules-as-data” } } }

(full dossier: gates—s-587cd8eb.intel.json)