Hook updates: board tools, dottie consolidation, code-write block, worktree cleanup #87
No reviewers
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!87
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "86-epilogue-hook-updates"
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?
Summary
Resolves 5 epilogue nits from PR #85 QA review: updates block-docs-writes.sh to current board tools (removing stale sprint references), consolidates dottie/general-purpose agent types into a single code path, enhances Dottie context injection, adds a new PreToolUse hook to block Dottie from writing to repo files, and adds a SessionStart hook to clean stale worktrees older than 7 days.
Changes
hooks/block-docs-writes.sh-- Replaced 7 stale sprint tool references (create_sprint, update_sprint, delete_sprint, add_sprint_item, move_sprint_item, remove_sprint_item, bulk_move_items) with 7 current board tools (delete_project, create_board, update_board, delete_board, create_board_item, update_board_item, remove_board_item, bulk_move_board_items)schemas/agent-spawn-requirements.json-- Removed duplicatedottietype entry;general-purposenow covers both with updated descriptionhooks/check-agent-spawn.sh-- Added normalization:dottiemaps togeneral-purposebefore schema lookup (single code path)hooks/inject-subagent-context.sh-- Mergedgeneral-purposeanddottiecases into single branch with consolidated context including agent-dottie note reference, block-first convention, Forgejo read-only access, and execution-only rolehooks/block-dottie-code-writes.sh-- NEW: PreToolUse hook that blocks Write/Edit/NotebookEdit targeting repo directories and blocks Bash entirely for Dottie; allows writes to /tmp and non-repo pathshooks/cleanup-worktrees.sh-- NEW: SessionStart hook that scans known repo directories for worktrees older than 7 days and removes them; reports cleaned count as additionalContextagents/dottie.md-- Added PreToolUse hook registration for block-dottie-code-writes.shsettings.json-- Registered cleanup-worktrees.sh in SessionStart hooksTest Plan
block-docs-writes.shblocksdelete_boardandbulk_move_board_items(exit 2) and allows read ops (exit 0)block-dottie-code-writes.shblocks Write to/home/ldraney/pal-e-docs/src/file.py(exit 2), allows Write to/tmp/test.txt(exit 0), blocks Bash (exit 2), allows Read (exit 0)check-agent-spawn.shaccepts dottie type with plan reference, rejects dottie without plan reference (normalizes to general-purpose)cleanup-worktrees.shruns successfully and cleaned 3 real stale worktreesbash -nsyntax checkReview Checklist
Related
plan-pal-e-agency(traceability)Closes #86
Self-Review (Dev agent)
Acceptance Criteria Verification
block-docs-writes.shblocks all current board write tools and has no references to removed sprint tools -- confirmed via grep and functional testsgeneral-purposeentry in schema, normalization incheck-agent-spawn.shagent-dottienote reference and block-first convention -- consolidated case withget_note(slug="agent-dottie")andconvention-block-first-accessreferences/home/ldraney/pal-e-docs/src/file.py(blocked) and/tmp/test.txt(allowed)Functional Tests Passed
block-docs-writes.sh: blocksdelete_board(exit 2), blocksbulk_move_board_items(exit 2), allowsget_note(exit 0)block-dottie-code-writes.sh: blocks Write to repo path (exit 2), allows Write to /tmp (exit 0), blocks Bash (exit 2), allows Read (exit 0)check-agent-spawn.sh: accepts dottie+plan (exit 0), rejects dottie without plan (deny)cleanup-worktrees.sh: cleaned 3 stale worktrees, valid JSON outputbash -nsyntax check passedDiscovered Scope (out of scope for this PR)
mcp__pal-e-docs__create_note_from_templateis a write operation not currently inblock-docs-writes.sh. Pre-existing gap, not introduced by this PR. Should be added in a follow-up.VERDICT: Clean for QA review
PR #87 Review
BLOCKERS
create_note_from_templatemissing fromblock-docs-writes.sh-- The MCP toolmcp__pal-e-docs__create_note_from_templateis a write operation available in the current pal-e-docs MCP server. It is not listed in the block hook's case statement. This means a non-Dottie agent (dev, QA) could bypass the docs-write block by callingcreate_note_from_templateinstead ofcreate_note. The dev agent flagged this as discovered scope -- it should be addressed in this PR since the stated goal is to bringblock-docs-writes.shup to date with current tools. Addmcp__pal-e-docs__create_note_from_template|\to the case statement.NITS
PR body count mismatch -- The Changes section says "7 current board tools" were added, but the diff actually adds 8 entries:
delete_projectplus 7 board-specific tools (create_board,update_board,delete_board,create_board_item,update_board_item,remove_board_item,bulk_move_board_items). Minor documentation inaccuracy.cleanup-worktrees.shfail-open claim vsset -euo pipefail-- Line 8 comments "Fail-open: any error exits 0 silently" but line 11 setsset -euo pipefail, which causes immediate non-zero exit on unhandled errors. The individual commands are well-guarded with2>/dev/null,|| continue, and|| true, so this is unlikely to cause real problems. But the comment is misleading about the failure mode. Either remove the-eflag (true fail-open) or correct the comment to say "errors are handled per-command; unhandled errors will surface but not block session start."agents/dottie.mdline 39 says "sprints" -- The MCP Tools table saysFull read/write access to notes, blocks, sprints, projects, tags. The word "sprints" is stale now that boards replaced sprints. Should read "boards" instead.Discovered scope (out of PR):
commands/update-docs.mdlines 76-78 still reference stale sprint tools (get_sprint_board,move_sprint_item). Not in scope for this PR, but should be tracked as a follow-up item.SOP COMPLIANCE
86-epilogue-hook-updatesreferences issue #86)plan-pal-e-agency)Closes #86present in PR bodyhookSpecificOutputJSON for SessionStart)VERDICT: NOT APPROVED
One blocker:
create_note_from_templatemust be added toblock-docs-writes.sh. This is a real security gap -- the hook's purpose is to block ALL write operations, and this tool was identified as missing during development. The fix is a single line addition.QA Fix Push (commit
6406b47)Addressed the QA blocker and 3 non-blocking nits:
Blocker fix:
mcp__pal-e-docs__create_note_from_templateto the blocked tools list inhooks/block-docs-writes.sh. Verified with test input: exit code 2 (blocked), while read tools still exit 0.Nit fixes:
create_board,update_board,delete_board,create_board_item,update_board_item,remove_board_item,bulk_move_board_items), which is accurate. The 8th new entry (delete_project) is not a board tool. No count exists in the code itself.Out of scope (per instructions):
commands/update-docs.mdnit deferred.PR #87 Re-Review (post fix round)
Previous review found 1 blocker and 4 nits. Dev agent pushed commit
6406b47addressing 3 of them (1 blocker + 2 nits). Fourth nit (board tool count in PR body) was explained as non-code, and fifth nit (stale sprint refs incommands/update-docs.md) was correctly deferred as out of scope.BLOCKER FIX VERIFICATION
create_note_from_templatenow blocked -- confirmed present at line 33 ofblock-docs-writes.sh. The tool is correctly placed in the case statement alongside the other 18 write tools.Full write tool coverage audit -- cross-referenced the complete
mcp__pal-e-docs__*tool inventory against the blocked list:Zero write tools missed. All
mcp__pal-e-docs__*write operations are covered.NIT FIX VERIFICATION
cleanup-worktrees.shcomment -- Lines 7-9 now correctly describeset -euo pipefailwith|| continue / || truefor graceful per-repo failures. Matches actual behavior. Clean fix.agents/dottie.md"sprints" to "boards" -- Line 39 (MCP Tools table) and line 56 (Capabilities section) both updated. Clean fix.Board tool count nit -- Dev explained the "7 board tools" count appears only in the PR body narrative, not in code. Acceptable -- PR body is not executable. No action needed.
commands/update-docs.mdstale sprint refs -- Correctly deferred as out of scope. Should be tracked in a separate issue.BLOCKERS
None.
NITS
None remaining. All actionable nits from the first review have been addressed.
SOP COMPLIANCE
86-epilogue-hook-updatesreferences issue #86)plan-pal-e-agencyCloses #86present in PR bodyNO REGRESSIONS
Verified that all 8 changed files are consistent with the original PR intent plus the 3 targeted fixes. No unintended changes introduced in the fix commit.
VERDICT: APPROVED