Fix enforcement nits: dottie config, hook bugs, new safety hooks #84
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#84
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-pal-e-agency→ Phase 2 (Enforcement nits)Repo
forgejo_admin/claude-customUser Story
As the agency operating model,
I want all hooks and agent configs to be correct and complete,
So that the four-agent model works reliably without manual workarounds.
Context
Six small fixes accumulated as TODOs/bugs. All target hooks or agent configs in claude-custom. Grouped into one PR since they're all small and independent.
File Targets
Files to modify:
schemas/agent-spawn-requirements.json— Add "dottie" as recognized agent type (currently missing, spawn gate blocks Dottie spawns)hooks/remind-mcp-review-loop.sh— Line 10 referencesmcp__pal-e-docs__get_note(slug="pr-review-loop")but dev/QA agents have no pal-e-docs access. Replace with plain text guidance: "Follow the review-fix loop: review, post findings, stop."hooks/check-note-template.sh— Lines 91-98 useecho "$DECODED_CONTENT" | grepwhich silently truncates large HTML. Fix: write content to a temp file, grep from file. See root cause analysis below.Files to create:
hooks/warn-delete-note.sh— New PreToolUse hook that warns beforemcp__pal-e-docs__delete_notecalls. Should output a reminder to follow sop-note-deletion (backup first). Exit 0 (warn, don't block).Files to NOT touch:
agents/dev.md,agents/qa.md— These are correctsettings.json— Only touch if adding the new warn-delete-note hook to the PreToolUse hooks listFix Details
1. Dottie agent type (
schemas/agent-spawn-requirements.json)Add
"dottie"with spawn requirements: plan ref required, no issue ref needed (Dottie does doc work, not repo work). Match the structure of existing entries (dev, qa, etc.).2. Stale pal-e-docs reference (
hooks/remind-mcp-review-loop.sh)Line 10 tells agents to call
mcp__pal-e-docs__get_note— a tool dev/QA agents don't have. Replace with plain English instructions about the review-fix loop.3. Large HTML truncation (
hooks/check-note-template.sh)Root cause:
echo "$DECODED_CONTENT" | grephits shell argument limits on multi-KB HTML. Fix:4. Delete note warning hook (
hooks/warn-delete-note.sh)New PreToolUse hook. Trigger: tool_name matches
mcp__pal-e-docs__delete_note. Output: "WARNING: Follow sop-note-deletion before deleting notes. Steps: 1) Force WAL switch, 2) JSON export, 3) pg_dump, 4) Then delete. Backups go to ~/backups/." Exit 0 (advisory, not blocking).Register in
settings.jsonunderhooks.preToolUseif needed (check existing hook registration pattern).Acceptance Criteria
"dottie"recognized by spawn gate — spawning withsubagent_type: "dottie"no longer errorsremind-mcp-review-loop.shcontains nomcp__pal-e-docsreferencescheck-note-template.shwhen all required sections are presentcheck-note-template.shstill correctly rejects notes that genuinely miss required sectionswarn-delete-note.shoutputs warning text whendelete_noteis calledTest Expectations
Constraints
~/.claude/hooks/— the repo files ARE the live hookssettings.jsonhook registration uses the pattern in existing PreToolUse entriesChecklist
Related
project-pal-e-agency— project this affectsPR #85 Review
BLOCKERS
1. SubagentStart matcher does not include "dottie" -- context injection will silently fail
The spawn schema (
schemas/agent-spawn-requirements.json) now recognizes"dottie"as a valid agent type, so the spawn gate (check-agent-spawn.sh) will allow it. However, theSubagentStartmatcher insettings.jsonline 216 is still"qa|dev|general-purpose"-- it does not include"dottie". Andinject-subagent-context.shline 18 only handlesqa,dev, andgeneral-purposein its case statement (no"dottie"branch).This means spawning an agent with
subagent_type: "dottie"will:This is a functional gap: the PR adds the spawn gate entry but not the SubagentStart plumbing. The
agents/dottie.mdconfig file exists, which provides frontmatter constraints, but the runtime context injection is missing for the"dottie"type.Fix: Add
"dottie"to the SubagentStart matcher ("qa|dev|general-purpose|dottie") and add adottie)case ininject-subagent-context.sh. Alternatively, if Dottie is always spawned asgeneral-purposeand the schema entry is only a fallback, document that decision in the schema description.NITS
1. Temp file trap override is correct but could be cleaner
In
check-note-template.sh, the secondtrapon line 92 overrides the global ERR trap from line 18. This works correctly (cleanup + fail-open), but the override is implicit and easy to miss. A comment like# Override global ERR trap to include tmpfile cleanupwould improve readability.2.
block-docs-writes.shstill references stale sprint tools (out of scope but worth tracking)The
block-docs-writes.shblocklist still has the old sprint tools (create_sprint,update_sprint, etc.) but is missing the new board tools (create_board,update_board,delete_board,create_board_item,update_board_item,remove_board_item,bulk_move_board_items). This is NOT in scope for this PR, but it means the security boundary has a gap for board writes by non-Dottie agents. Recommend filing a follow-up issue.3.
delete_projectmissing fromblock-docs-writes.sh(out of scope)Similarly,
mcp__pal-e-docs__delete_projectandmcp__pal-e-docs__delete_boardare not in the blocklist. Same recommendation: follow-up issue.CODE QUALITY
All five changed files are well-structured:
warn-delete-note.sh-- Clean advisory hook. Correct use ofpermissionDecision: "allow"with a warning reason. Exit 0 is correct for non-blocking. Thetool_nameguard is defensive and appropriate since the matcher already filters, but belt-and-suspenders is fine for hooks.check-note-template.shtemp file fix -- Correct fix for the shell argument limit bug. Usingmktemp+grepfrom file avoidsARG_MAXon large HTML. Cleanup is handled on both happy path (rm -f) and error path (trap).remind-mcp-review-loop.sh-- Good removal of themcp__pal-e-docs__get_notereference. Dev/QA agents cannot access pal-e-docs, so this was a broken reference. The replacement text is actionable.agent-spawn-requirements.json-- The"dottie"entry correctly mirrors"general-purpose"withplan-pattern andisolation: false.settings.json-- The newdelete_notematcher and hook registration follow the existing pattern exactly.SOP COMPLIANCE
84-fix-enforcement-nitsreferences issue #84)plan-pal-e-agency)Closes #84VERDICT: NOT APPROVED
One blocker: the
SubagentStartmatcher andinject-subagent-context.shcase statement need to handle the"dottie"agent type, or the schema description needs to clarify that Dottie is always spawned asgeneral-purpose. Without this fix, spawning adottie-typed agent skips context injection silently.PR #85 Review (Re-review)
PREVIOUS BLOCKER STATUS
Both previously identified blockers are now fixed:
"qa|dev|general-purpose|dottie". Fixed.dottie)case with appropriate context. Fixed.BLOCKERS
None.
NITS
dottie context missing
get_noteand block-first convention -- Thegeneral-purposecase (line 25-26 ofinject-subagent-context.sh) includesget_note(slug="agent-dottie")and the block-first access convention. The newdottiecase (line 28-30) includes neither. This means a "dottie" agent type will not be told to read its own profile or follow the token-saving convention. Theagents/dottie.mdfile exists and provides some of this context via frontmatter, so this may be intentional (the agent definition file provides the profile, the hook provides behavioral guidance). But the block-first convention is missing from both the hook context andagents/dottie.md. Non-blocking since the agent definition file compensates, but worth noting for consistency.Duplicate Dottie identity across general-purpose and dottie -- Both
general-purposeanddottieagent types in the schema serve the same role (doc librarian,plan-required,doc-updatesoutput,isolation: false). Thegeneral-purposetype is presumably kept for backward compatibility. This is fine for now but creates a maintenance surface where changes to Dottie's spawn requirements need to be made in two places.SOP COMPLIANCE
84-fix-enforcement-nitsreferences issue #84plan-pal-e-agencyCloses #84present in PR bodyCODE QUALITY NOTES
mktemp+ file-basedgrepavoids ARG_MAX limits on large HTML. Trap correctly overrides to clean up on error. Normal path cleanup on line 105. No temp file leak paths.permissionDecision: "allow"with descriptive reason.mcp__pal-e-docs__get_notereference. Replaced with plain English guidance appropriate for agents without pal-e-docs access.dottieentry mirrorsgeneral-purposestructure correctly.mcp__pal-e-docs__delete_notePreToolUse matcher and the SubagentStart matcher update are correctly placed.VERDICT: APPROVED