0%

Three-role taxonomy + state->rule-slice mapping

Goal

Formalize the trigger-axis taxonomy every rule sorts into: CORE (universal, already CLAUDE.md + ori-syntax.md paths: **), DOMAIN (path-sensitive, existing paths: globs, kept as-is), PROTOCOL (workflow-state-sensitive — the 9 no-paths: rules). Author the plan-agnostic state->rule-slice mapping: which rule §anchor slice is relevant at which workflow state, keyed to the engine’s ComponentMetadata.spec_ref {doc, anchor, pin} binding.

Implementation Sketch

  • Author the three-role classification registry over every .claude/rules/*.md (exactly-one-role) + a classification test; assert all 9 no-paths: files are PROTOCOL (research finding: none are genuinely CORE).
  • Author the plan-agnostic (script-first.md §11 — generic feeder + declared mapping, no hard-coded rule/plan names) state->rule-slice mapping data: each workflow state (served-unit state, cure-cycle, routing decision, review, authoring) -> the PROTOCOL rule §anchor slices relevant there.
  • Pin each mapped §anchor via spec_ref {doc, anchor, pin} (SHA-256 of the anchored section) so drift is detectable, reusing the engine’s spec_ref shape.

Spec References

  • plans/workflow-engine-rework/content/engine-core--s-e585be74.md (ComponentMetadata.spec_ref shape).
  • .claude/rules/script-first.md §11 (plan-agnostic / domain-agnostic tooling).
  • .claude/rules/routing.md §7, .claude/rules/skill-template.md §2 (the per-skill @-include declaration convention the mapping complements).

Work Items

  • Author the three-role classification registry + test (every rule in exactly one role; all 9 no-paths: files => PROTOCOL)
  • Author the plan-agnostic state->rule-slice mapping data (workflow state -> PROTOCOL rule §anchor slices)
  • Pin each mapped §anchor via spec_ref {doc, anchor, pin}; add a drift probe that fails on pin mismatch

Test strategy / acceptance

Pin: every .claude/rules/*.md classifies into exactly one role; the mapping resolves each PROTOCOL rule to >=1 workflow state; the pin-drift probe fails when an anchored section changes without re-pinning. Engine-INDEPENDENT; startable now.