PreToolUse hook on mcp__ccd_session_mgmt__archive_session doesn't fire when archiving via the in-app session list

Open 💬 0 comments Opened Jul 10, 2026 by antonnevm-cloud

Setup

I added a PreToolUse hook in ~/.claude/settings.json with "matcher": "mcp__ccd_session_mgmt__archive_session", intended to block archiving a session (exit code 2 + stderr message) while its git repo has stale local branches.

What happened

Archiving the same session through the in-app session list (button/menu, not a programmatic tool call) completed successfully — no hook message, no block — even though the condition the hook checks for was true at the time.

What I verified before reporting

  • The hook is present and valid in settings.json after the attempt (didn't silently revert).
  • The condition it checks for (a merged-but-undeleted local branch) was still true immediately after archiving, so it wasn't a race/timing fluke.
  • A full cold restart of the machine happened between configuring the hook and testing it (the computer was powered off overnight), so this isn't a "hook added mid-session, not reloaded until restart" issue — settings.json was read fresh.

Question

Does the in-app archive action (button/context menu/keyboard shortcut) invoke the same archive_session MCP tool that a PreToolUse hook can intercept, or is it a separate internal path that bypasses the tool-call lifecycle entirely? If it's the latter, this seems worth documenting explicitly (or exposing a lifecycle hook that does cover it) so hook authors don't assume PreToolUse on this tool covers all archive entry points.

Loosely related to #62104 (which lists mcp__ccd_session_mgmt__archive_session as one of several archive paths for pinned sessions, but doesn't address hook interception specifically).

View original on GitHub ↗