@@ -32,12 +32,40 @@ When running in RPC mode (VS Code, Zed, etc.), hook events are also emitted as J
3232| ` file-modified ` | When a file is created, modified, or deleted | file path, change type |
3333| ` pre-prompt ` | Before sending instruction to LLM | instruction, mentioned files |
3434| ` stop ` | After agent finishes responding (turn complete) | tokens used, tool calls count, duration |
35+ | ` post-response ` | Alias for ` stop ` for backward compatibility | tokens used, tool calls count, duration |
3536| ` session-start ` | When a session begins | session type (startup/resume/clear) |
3637| ` session-end ` | When a session ends | reason (quit/clear/exit/error), duration |
38+ | ` pre-clear ` | Before memory extraction on ` /clear ` or ` /new ` | session id, cwd |
3739| ` session-error ` | When an error occurs | error message, code, context |
3840| ` subagent-stop ` | When a subagent finishes execution | subagent id, name, type, success, duration |
3941| ` permission-request ` | Before showing permission dialog | tool, path, permission type |
4042| ` notification ` | When a notification is sent to user | notification type, message |
43+ | ` automode:start ` | When auto-mode starts | auto-mode session id, prompt, max iterations |
44+ | ` automode:iteration ` | On each auto-mode iteration | iteration, actions, files created/modified, cost |
45+ | ` automode:checkpoint ` | When auto-mode creates a checkpoint | iteration, checkpoint commit |
46+ | ` automode:pause ` | When auto-mode pauses | auto-mode session id, iteration |
47+ | ` automode:resume ` | When auto-mode resumes | auto-mode session id, iteration |
48+ | ` automode:cancel ` | When auto-mode is cancelled | cancel reason, iteration, cost |
49+ | ` automode:complete ` | When auto-mode completes successfully | iterations, actions, files changed, cost |
50+ | ` automode:error ` | When auto-mode encounters an error | error message, iteration |
51+ | ` pre-learn ` | Before a learn operation begins | instruction, cwd |
52+ | ` post-learn ` | After a learn operation completes | instruction, duration, success |
53+ | ` team-created ` | When a team is created | team name, member count |
54+ | ` teammate-spawned ` | When a teammate process starts | team name, teammate name, agent name, pid |
55+ | ` teammate-idle ` | When a teammate becomes idle | team name, teammate name |
56+ | ` task-assigned ` | When a task is assigned to a teammate | task id, owner, teammate name |
57+ | ` task-completed ` | When a task is marked complete | task id, owner, result |
58+ | ` team-shutdown ` | When team cleanup completes | team name, completed task count, total task count |
59+ | ` review:start ` | When a code review begins | review path, scope, instructions |
60+ | ` review:end ` | When a code review session ends | review path, scope, duration |
61+ | ` review:paused ` | When a code review pauses | review path, scope |
62+ | ` review:failed ` | When a code review fails | review path, scope, review error |
63+ | ` review:completed ` | When a code review completes successfully | review path, scope, duration |
64+ | ` mode-change ` | When permission mode changes | permission mode |
65+ | ` context:compact ` | When context is compacted | context lifecycle details |
66+ | ` context:overflow ` | When context overflow is detected | context lifecycle details |
67+ | ` context:warning ` | When context usage crosses the warning threshold | context lifecycle details |
68+ | ` context:critical ` | When context usage crosses the critical threshold | context lifecycle details |
4169
4270> ** Note** : ` post-response ` is an alias for ` stop ` for backward compatibility.
4371
@@ -115,6 +143,11 @@ What the matcher matches against depends on the event type:
115143| ` session-start ` | Session type (startup/resume/clear) |
116144| ` session-end ` | End reason (quit/clear/exit/error) |
117145| ` subagent-stop ` | Subagent type |
146+ | ` automode:* ` | Event-specific auto-mode prompt, iteration, or reason |
147+ | ` review:* ` | Event-specific review path, scope, instructions, or error |
148+ | ` team-created ` , ` team-shutdown ` | Team name |
149+ | ` teammate-spawned ` , ` teammate-idle ` | Team name, teammate name, or teammate agent name |
150+ | ` task-assigned ` , ` task-completed ` | Task id, task owner, or task result |
118151
119152---
120153
@@ -149,6 +182,7 @@ echo "Tool: $TOOL_NAME with args: $TOOL_ARGS"
149182 "instruction" : null ,
150183 "mentioned_files" : null ,
151184 "tokens_used" : null ,
185+ "tokens_usage_status" : null ,
152186 "tool_calls_count" : null ,
153187 "turn_tool_calls" : null ,
154188 "turn_duration" : null ,
@@ -165,7 +199,32 @@ echo "Tool: $TOOL_NAME with args: $TOOL_ARGS"
165199 "subagent_duration" : null ,
166200 "permission_type" : null ,
167201 "notification_type" : null ,
168- "notification_message" : null
202+ "notification_message" : null ,
203+ "automode_session_id" : null ,
204+ "automode_prompt" : null ,
205+ "automode_iteration" : null ,
206+ "automode_max_iterations" : null ,
207+ "automode_actions" : null ,
208+ "automode_files_created" : null ,
209+ "automode_files_modified" : null ,
210+ "automode_cancel_reason" : null ,
211+ "automode_checkpoint_commit" : null ,
212+ "automode_total_cost" : null ,
213+ "review_path" : null ,
214+ "review_scope" : null ,
215+ "review_instructions" : null ,
216+ "review_error" : null ,
217+ "team_name" : null ,
218+ "teammate_name" : null ,
219+ "teammate_agent_name" : null ,
220+ "teammate_pid" : null ,
221+ "team_task_id" : null ,
222+ "team_task_owner" : null ,
223+ "team_task_result" : null ,
224+ "team_member_count" : null ,
225+ "team_tasks_completed" : null ,
226+ "team_tasks_total" : null ,
227+ "additional_workspaces" : null
169228}
170229```
171230
@@ -295,6 +354,31 @@ When your hook command executes, these environment variables are available:
295354| ` HOOK_PERMISSION_TYPE ` | Permission type being requested | permission-request |
296355| ` HOOK_NOTIFICATION_TYPE ` | Type of notification | notification |
297356| ` HOOK_NOTIFICATION_MSG ` | Notification message | notification |
357+ | ` HOOK_AUTOMODE_SESSION_ID ` | Auto-mode session ID | automode:* |
358+ | ` HOOK_AUTOMODE_PROMPT ` | Auto-mode prompt/task | automode: start , automode: iteration |
359+ | ` HOOK_AUTOMODE_ITERATION ` | Current auto-mode iteration | automode:* |
360+ | ` HOOK_AUTOMODE_MAX_ITERATIONS ` | Maximum auto-mode iterations | automode: start , automode: iteration |
361+ | ` HOOK_AUTOMODE_ACTIONS ` | JSON array of actions | automode: iteration , automode: complete |
362+ | ` HOOK_AUTOMODE_FILES_CREATED ` | Number of files created | automode:* |
363+ | ` HOOK_AUTOMODE_FILES_MODIFIED ` | Number of files modified | automode:* |
364+ | ` HOOK_AUTOMODE_CANCEL_REASON ` | Cancellation reason | automode: cancel |
365+ | ` HOOK_AUTOMODE_CHECKPOINT ` | Checkpoint commit hash | automode: checkpoint |
366+ | ` HOOK_AUTOMODE_COST ` | Total auto-mode cost | automode:* |
367+ | ` HOOK_REVIEW_PATH ` | Review target path | review:* |
368+ | ` HOOK_REVIEW_SCOPE ` | Review scope | review:* |
369+ | ` HOOK_REVIEW_ERROR ` | Review error message | review: failed |
370+ | ` HOOK_REVIEW_INSTRUCTIONS ` | Review instructions/focus | review:* |
371+ | ` HOOK_TEAM_NAME ` | Team name | team-created, teammate-spawned, teammate-idle, task-assigned, task-completed, team-shutdown |
372+ | ` HOOK_TEAMMATE_NAME ` | Teammate name | teammate-spawned, teammate-idle, task-assigned, task-completed |
373+ | ` HOOK_TEAMMATE_AGENT ` | Teammate agent definition | teammate-spawned |
374+ | ` HOOK_TEAMMATE_PID ` | Teammate process ID | teammate-spawned |
375+ | ` HOOK_TEAM_TASK_ID ` | Team task ID | task-assigned, task-completed |
376+ | ` HOOK_TEAM_TASK_OWNER ` | Team task owner | task-assigned, task-completed |
377+ | ` HOOK_TEAM_TASK_RESULT ` | Team task result | task-completed |
378+ | ` HOOK_TEAM_MEMBER_COUNT ` | Number of team members | team-created, teammate-spawned, teammate-idle, team-shutdown |
379+ | ` HOOK_TEAM_TASKS_COMPLETED ` | Completed task count | team-shutdown |
380+ | ` HOOK_TEAM_TASKS_TOTAL ` | Total task count | team-shutdown |
381+ | ` HOOK_ADDITIONAL_WORKSPACES ` | JSON array of additional workspaces | All events when configured |
298382
299383---
300384
0 commit comments