[DOCS] Agent hook docs missing `WorktreeCreate` and `WorktreeRemove` events
Documentation Type
Missing documentation (feature not documented)
Documentation Location
https://platform.claude.com/docs/en/agent-sdk/hooks
https://code.claude.com/docs/en/hooks
Section/Topic
"Available hooks" / event summary tables and the per-event hook documentation sections.
Current Documentation
The docs currently list hook events but do not include the new worktree lifecycle events.
From Agent SDK hooks:
|SubagentStop| Yes | Yes | Subagent completion | Aggregate results from parallel tasks | |PreCompact| Yes | Yes | Conversation compaction request | Archive full transcript before summarizing | |PermissionRequest| No | Yes | Permission dialog would be displayed | Custom permission handling | |SessionStart| No | Yes | Session initialization | Initialize logging and telemetry | |SessionEnd| No | Yes | Session termination | Clean up temporary resources | |Notification| No | Yes | Agent status messages | Send agent status updates to Slack or PagerDuty |
From Claude Code hooks:
|SubagentStart| When a subagent is spawned | |SubagentStop| When a subagent finishes | |Stop| When Claude finishes responding | |TeammateIdle| When an agent team teammate is about to go idle | |TaskCompleted| When a task is being marked as completed |
What's Wrong or Missing?
Claude Code v2.1.50 release notes added WorktreeCreate and WorktreeRemove hook events for custom VCS setup/teardown during agent worktree isolation, but these events are not documented in either hook reference.
Because the events are undocumented, users do not have:
- event trigger definitions,
- input payload schema and fields,
- guidance on expected output/decision behavior,
- example hook handlers for setup/cleanup workflows.
Suggested Improvement
Add WorktreeCreate and WorktreeRemove to both hook event tables and add dedicated event sections with:
- trigger timing (before/after worktree create/remove),
- input fields (for example repository path, worktree path, agent/workflow context),
- whether the events are blocking or observational,
- runnable examples for common setup/teardown tasks.
Impact
High - Prevents users from using a feature
Additional Context
Source: Claude Code release v2.1.50
Release entry: "Added WorktreeCreate and WorktreeRemove hook events, enabling custom VCS setup and teardown when agent worktree isolation creates or removes worktrees."
Affected Pages:
| Page | Line(s) | Context |
|------|---------|---------|
| https://platform.claude.com/docs/en/agent-sdk/hooks | 117-130 | Available hooks table omits new worktree lifecycle events |
| https://code.claude.com/docs/en/hooks | 27-40 | Claude Code hook event table omits new worktree lifecycle events |
Total scope: 2 pages affected
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗