Context
The OBS-09 rule audit (#2) classifies some rules as "Case C" — prose-only but enforceable. Today, spec quality rules are enforced only by prose instructions inside agent definitions. There is no automatic gate between Phase 2 (spec-writer) and Phase 3 (ingestion). The user must manually invoke /ido4dev:decompose-validate.
The ido4shape plugin (upstream) uses a two-layer validation pattern that addresses this:
- Layer 1 — deterministic structural validation via
dist/spec-validator.js (bundled parser)
- Layer 2 — qualitative LLM-based content validation via parallel reviewer agents
ido4dev already has both layers in pieces:
- Layer 1:
ingest_spec dry-run mode (deterministic parser, already called in decompose-validate)
- Layer 2:
agents/spec-reviewer.md (currently invoked inline during decompose-validate)
What's missing is automatic invocation — neither layer runs until the user manually starts Phase 3.
Proposal — Option A (advisory, extends existing pattern)
Add a PostToolUse hook entry to hooks/hooks.json that fires after Write/Edit when the file path matches technical spec patterns. The hook runs the existing spec-reviewer agent and surfaces the verdict as a governance signal.
Behavior
- Trigger:
PostToolUse on Write or Edit where the file path matches **/specs/*technical*.md
- Action: Run
spec-reviewer.md protocol on the written file
- Output: Governance signal with verdict (PASS / PASS WITH WARNINGS / FAIL) and key findings
- Does NOT block — consistent with current advisory-hook pattern in
hooks/hooks.json
- If verdict is FAIL, the signal recommends the user run full
/ido4dev:decompose-validate before proceeding
Why advisory (Option A) not blocking (Option B)
We already have an advisory PostToolUse hook for governance signals (lines 15-34 of hooks/hooks.json — fires after task state-transition tools). The new hook follows the same pattern. This means:
- Consistent with existing architecture — no new hook types
- User learns about quality issues without being blocked mid-session
- Can upgrade to blocking (Option B) later if advisory signals are routinely ignored
Architectural context
The current hook architecture:
hooks/hooks.json
├─ SessionStart: MCP server install (@ido4/mcp)
└─ PostToolUse:
├─ matcher: task state-transition tools → advisory governance signal
└─ NEW: matcher: Write/Edit to specs/*technical*.md → advisory spec-reviewer
The BRE (Business Rule Engine) is not involved here. BRE governs runtime state transitions on GitHub issues, not spec authoring. This hook lives in the spec-authoring layer, before ingestion. See investigation findings in #2 (OBS-09) for the architectural boundary.
ido4shape precedent
In ido4shape, Layer 2 runs four parallel reviewer agents (spec-reviewer, technical-reviewer, scope-reviewer, dependency-auditor), each with a distinct quality lens, producing a rollup verdict. For ido4dev Round 4, we start with one reviewer (the existing spec-reviewer.md) and can expand to parallel lenses later if needed.
The key architectural lesson from ido4shape: Layer 1 (deterministic parser) and Layer 2 (LLM reviewers) are separate tools invoked by a skill, not a single pass. If we adopt this for ido4dev, the hook invokes Layer 2 (spec-reviewer), while Layer 1 (ingest_spec dry-run) stays in decompose-validate where it currently lives.
Deliverables
Acceptance criteria
Open questions for investigation during implementation
- Should the hook fire on every write, or only on writes that happen outside of
decompose-tasks skill context? (To avoid double-review when the spec-writer is still composing)
- Should the hook call
ingest_spec dry-run as a quick Layer 1 check before invoking the full Layer 2 reviewer?
- What's the latency impact of an automatic reviewer on every spec write?
Dependencies
References
hooks/hooks.json — current hook definitions (SessionStart + PostToolUse governance signals)
agents/spec-reviewer.md — the reviewer agent this hook invokes
skills/decompose-validate/SKILL.md — current manual invocation path
- Claude Code hooks reference — full hook taxonomy
- ido4shape two-layer pattern:
ido4shape/skills/validate-spec/SKILL.md, ido4shape/skills/review-spec/SKILL.md
Context
The OBS-09 rule audit (#2) classifies some rules as "Case C" — prose-only but enforceable. Today, spec quality rules are enforced only by prose instructions inside agent definitions. There is no automatic gate between Phase 2 (spec-writer) and Phase 3 (ingestion). The user must manually invoke
/ido4dev:decompose-validate.The ido4shape plugin (upstream) uses a two-layer validation pattern that addresses this:
dist/spec-validator.js(bundled parser)ido4dev already has both layers in pieces:
ingest_specdry-run mode (deterministic parser, already called indecompose-validate)agents/spec-reviewer.md(currently invoked inline duringdecompose-validate)What's missing is automatic invocation — neither layer runs until the user manually starts Phase 3.
Proposal — Option A (advisory, extends existing pattern)
Add a
PostToolUsehook entry tohooks/hooks.jsonthat fires after Write/Edit when the file path matches technical spec patterns. The hook runs the existingspec-revieweragent and surfaces the verdict as a governance signal.Behavior
PostToolUseonWriteorEditwhere the file path matches**/specs/*technical*.mdspec-reviewer.mdprotocol on the written filehooks/hooks.json/ido4dev:decompose-validatebefore proceedingWhy advisory (Option A) not blocking (Option B)
We already have an advisory PostToolUse hook for governance signals (lines 15-34 of
hooks/hooks.json— fires after task state-transition tools). The new hook follows the same pattern. This means:Architectural context
The current hook architecture:
The BRE (Business Rule Engine) is not involved here. BRE governs runtime state transitions on GitHub issues, not spec authoring. This hook lives in the spec-authoring layer, before ingestion. See investigation findings in #2 (OBS-09) for the architectural boundary.
ido4shape precedent
In ido4shape, Layer 2 runs four parallel reviewer agents (spec-reviewer, technical-reviewer, scope-reviewer, dependency-auditor), each with a distinct quality lens, producing a rollup verdict. For ido4dev Round 4, we start with one reviewer (the existing
spec-reviewer.md) and can expand to parallel lenses later if needed.The key architectural lesson from ido4shape: Layer 1 (deterministic parser) and Layer 2 (LLM reviewers) are separate tools invoked by a skill, not a single pass. If we adopt this for ido4dev, the hook invokes Layer 2 (spec-reviewer), while Layer 1 (
ingest_specdry-run) stays indecompose-validatewhere it currently lives.Deliverables
hooks/hooks.json— PostToolUse matcher for spec file writesAcceptance criteria
spec-reviewer.mdprotocol — no new agent neededclaude plugin validate .passes with the new hook entryOpen questions for investigation during implementation
decompose-tasksskill context? (To avoid double-review when the spec-writer is still composing)ingest_specdry-run as a quick Layer 1 check before invoking the full Layer 2 reviewer?Dependencies
References
hooks/hooks.json— current hook definitions (SessionStart + PostToolUse governance signals)agents/spec-reviewer.md— the reviewer agent this hook invokesskills/decompose-validate/SKILL.md— current manual invocation pathido4shape/skills/validate-spec/SKILL.md,ido4shape/skills/review-spec/SKILL.md