Hook infrastructure causes 80% time waste in multi-agent workflows

Resolved 💬 3 comments Opened Mar 23, 2026 by juanandresgs Closed Mar 27, 2026

Problem

The ~/.claude hook system (task-track.sh, pre-bash.sh, check-guardian.sh) causes severe velocity loss in real project work. In a session fixing 3 bugs + doing backlog cleanup, ~80% of wall-clock time was spent fighting hook gates rather than doing actual work.

Specific Issues

1. Stale guardian markers with live PIDs cause permanent blocking

  • marker_cleanup() only clears dead-PID markers
  • If a guardian agent completes but SubagentStop fails to update the marker, the marker retains the parent process PID (still alive)
  • All subsequent guardian dispatches are blocked indefinitely
  • Workaround: manually query SQLite and force-update marker status — requires understanding the internal schema

2. Branch deletion blocked outside Guardian context

  • pre-bash.sh blocks git branch -d and git branch -D unless dispatched via Guardian
  • But Guardian can't dispatch due to issue #1 (stale markers)
  • Result: dead branches accumulate and can never be cleaned

3. Worktree requirement for trivial documentation edits

  • Even updating a single line in MASTER_PLAN.md requires: create worktree → edit → commit → merge → remove worktree → delete branch (blocked by #2)
  • 6 operations for a 1-line change

4. Orphan worktrees accumulate in ~/.claude

  • 14 orphan worktrees with ~400-600 files each found in ~/.claude/.worktrees/
  • Sweep tool reports them but doesn't clean them by default
  • They persist across sessions

Impact

A session that should have taken 30 minutes took 2+ hours. The user explicitly expressed frustration ("why is this taking so fucking long?").

Suggested Fixes

  1. Add a TTL to guardian markers regardless of PID liveness (e.g., 10 min max)
  2. Allow git branch -d (merged branches) without Guardian dispatch
  3. Add a fast path for plan/doc-only edits that skips worktree ceremony
  4. Auto-clean orphan worktrees older than 24h

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗