fix(doc-guardian): Hook blocks workflow and fires excessively #287

Closed
opened 2026-01-28 22:39:16 +00:00 by lmiranda · 1 comment
Owner

Summary

The doc-guardian PostToolUse hook has several usability issues that disrupt normal workflow.

Issues

1. Hook Blocks Workflow Instead of Running in Background

Current behavior: When documentation drift is detected, the hook outputs a message and stops continuation, requiring user to say "move forward" to proceed.

Expected behavior: Non-blocking notification + spawn background agent (doc-guardian:doc-analyzer) to address drift in parallel.

Current behavior: During a single task involving sequential edits (e.g., updating 4 files in a migration), the hook fires 4+ times, each time blocking for user input.

Expected behavior: Batch related changes within a session/task, or remember user intent ("continue without checking") for the duration of the task.

3. Hook Over-Restricts Internal URLs

Current behavior: Tried to add Gitea Wiki URL to CLAUDE.md, hook blocked it claiming "infrastructure/network information exposure".

Expected behavior: Should be context-aware - internal documentation URLs (especially to the same Gitea instance) should not be flagged. The CLAUDE.md already contains the Gitea host elsewhere.

Observed In

  • Session on 2026-01-23 in personal-projects/personal-portfolio
  • Session on 2026-01-28 in personal-projects/leo-claude-mktplace

Proposed Solutions

  1. Convert to non-blocking notification - Use notify.sh pattern (like the current command hook) but don't stop workflow
  2. Spawn background agent - If drift is significant, spawn doc-guardian:doc-analyzer agent to handle it
  3. Add session-level intent tracking - If user says "continue" once, don't ask again for related edits
  4. Whitelist internal URLs - Don't flag URLs to the same Gitea instance configured in .env

Acceptance Criteria

  • Hook does not block workflow continuation
  • Related edits in same task don't trigger multiple prompts
  • Internal Gitea URLs are not flagged as security issues
  • Drift is still detected and queued (in .doc-guardian-queue)
  • Original hook implementation in v3.2.0
  • Similar pattern needed: projman SessionStart hook (non-blocking)
## Summary The doc-guardian PostToolUse hook has several usability issues that disrupt normal workflow. ## Issues ### 1. Hook Blocks Workflow Instead of Running in Background **Current behavior:** When documentation drift is detected, the hook outputs a message and stops continuation, requiring user to say "move forward" to proceed. **Expected behavior:** Non-blocking notification + spawn background agent (`doc-guardian:doc-analyzer`) to address drift in parallel. ### 2. Hook Fires Multiple Times for Related Edits **Current behavior:** During a single task involving sequential edits (e.g., updating 4 files in a migration), the hook fires 4+ times, each time blocking for user input. **Expected behavior:** Batch related changes within a session/task, or remember user intent ("continue without checking") for the duration of the task. ### 3. Hook Over-Restricts Internal URLs **Current behavior:** Tried to add Gitea Wiki URL to CLAUDE.md, hook blocked it claiming "infrastructure/network information exposure". **Expected behavior:** Should be context-aware - internal documentation URLs (especially to the same Gitea instance) should not be flagged. The CLAUDE.md already contains the Gitea host elsewhere. ## Observed In - Session on 2026-01-23 in `personal-projects/personal-portfolio` - Session on 2026-01-28 in `personal-projects/leo-claude-mktplace` ## Proposed Solutions 1. **Convert to non-blocking notification** - Use `notify.sh` pattern (like the current command hook) but don't stop workflow 2. **Spawn background agent** - If drift is significant, spawn `doc-guardian:doc-analyzer` agent to handle it 3. **Add session-level intent tracking** - If user says "continue" once, don't ask again for related edits 4. **Whitelist internal URLs** - Don't flag URLs to the same Gitea instance configured in `.env` ## Acceptance Criteria - [ ] Hook does not block workflow continuation - [ ] Related edits in same task don't trigger multiple prompts - [ ] Internal Gitea URLs are not flagged as security issues - [ ] Drift is still detected and queued (in `.doc-guardian-queue`) ## Related - Original hook implementation in v3.2.0 - Similar pattern needed: projman SessionStart hook (non-blocking)
lmiranda added the Type/BugPriority/MediumComplexity/Medium labels 2026-01-28 22:39:16 +00:00
Author
Owner

Fix proposed in PR #291

Changes:

  • Message wording changed from actionable "update needed" to passive "drift queued"
  • Added 5-second debouncing to prevent rapid-fire notifications
  • Added queue clearing step to /doc-sync command

Note: The URL restriction issue (#3 in this report) was not found in the current codebase. It may have been caused by a different component or already fixed separately.

Next Steps:

  1. Review and merge PR #291
  2. Test in a project with batch edits to verify reduced interruptions
  3. Come back to close this issue and optionally capture a lesson learned
Fix proposed in PR #291 **Changes:** - Message wording changed from actionable "update needed" to passive "drift queued" - Added 5-second debouncing to prevent rapid-fire notifications - Added queue clearing step to `/doc-sync` command **Note:** The URL restriction issue (#3 in this report) was not found in the current codebase. It may have been caused by a different component or already fixed separately. **Next Steps:** 1. Review and merge PR #291 2. Test in a project with batch edits to verify reduced interruptions 3. Come back to close this issue and optionally capture a lesson learned
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: personal-projects/leo-claude-mktplace#287