Phase 4: check-phase-template.sh enforcement hook #63
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ldraney/claude-custom#63
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Lineage
plan-2026-03-07-note-hierarchy-conventions→ Phase 4 (Enforcement Hook)Repo
forgejo_admin/claude-customUser Story
As Betty Sue (main session)
I want phase notes to be validated against
template-phasewhen createdSo that every phase and subphase follows the standard structure and I don't drift into ad-hoc formats
Context
We just created
template-phasein pal-e-docs, which defines required sections for phase notes. The existingcheck-issue-template.shhook already validates Forgejo issues againsttemplate-issueby fetching the template live from the pal-e-docs API and extracting required headings. This hook follows the exact same pattern but formcp__pal-e-docs__create_notecalls withnote_type=phase.The hook is template-driven (not hardcoded) — it fetches
template-phaseat runtime and extracts validation rules from the content. This means template changes don't require hook changes.Key difference from issue template hook: Phase notes use HTML content (not markdown), and the required fields are a mix of bold-text header fields (
Goal:,Owner:,Repo:,Depends on:) and HTML headings (<h3>Scope</h3>or<h3>Problem</h3>+<h3>Fix</h3>, plus<h3>Related</h3>).File Targets
Files the agent should create:
hooks/check-phase-template.sh— PreToolUse hook that validates phase note contentFiles the agent should modify:
settings.json— register the new hook under PreToolUse with matchermcp__pal-e-docs__create_noteFiles the agent should reference (read-only):
hooks/check-issue-template.sh— the pattern to follow (same fetch-from-API, fail-open approach)hooks/check-note-template.sh— may already exist and handle plan notes; if so, extend it rather than creating a new fileFiles the agent should NOT touch:
.mdfilesAcceptance Criteria
note_type=phasethat is missing required fields gets blocked with a helpful error messageGoal:,Owner:,Repo:,Depends on:(bold-text in<strong>tags or plain text)<h3>Scope</h3>OR (<h3>Problem</h3>AND<h3>Fix</h3>) — the two shapes from template-phase<h3>Related</h3>section requirednote_typeother thanphaseis NOT affected (fail-open for non-phase notes)template-phasecreate_notecalls for plans, SOPs, etc. are unaffectedTest Expectations
Constraints
check-issue-template.shpattern exactly: fail-open on all errors, usejqfor JSON parsing,curlfor API fetchtool_input.note_type == "phase"first — bail early for non-phase notescontentfield), not markdown<strong>Goal:</strong>pattern (or justGoal:in content) for header fieldsgrep -qifor case-insensitive matching where appropriateset -eo pipefailwithtrap 'exit 0' ERRfor fail-openChecklist
Related
template-phase— the template this hook enforcesconvention-subphase— documents the two-shape pattern (full phase vs subphase)plan-2026-03-07-note-hierarchy-conventions— parent planai-agency— project