SpyBara
Go Premium

Documentation 2026-08-28 23:59 UTC to 2026-08-29 18:58 UTC

3 files changed +7 −1. View all changes and history on the product overview
2026
Sat 29 18:58 Thu 27 23:57 Mon 24 23:01 Sat 22 19:01 Fri 21 22:58 Thu 20 23:01 Wed 12 23:59 Tue 11 22:03 Fri 7 23:57 Tue 4 22:59 Sun 2 19:00

hooks.md +3 −1

Details

26 26 

27<div style={{maxWidth: "500px", margin: "0 auto"}}>27<div style={{maxWidth: "500px", margin: "0 auto"}}>

28 <Frame>28 <Frame>

29 <img src="https://mintcdn.com/claude-code/jhXrDR5TrSZ5hgXM/images/hooks-lifecycle.svg?fit=max&auto=format&n=jhXrDR5TrSZ5hgXM&q=85&s=3ca47113d5956460e6e4611b8dbc63b7" alt="Diagrama do ciclo de vida do hook mostrando Setup opcional alimentando SessionStart, depois um loop por turno contendo UserPromptSubmit, UserPromptExpansion para slash commands, o loop agentic aninhado (PreToolUse, PermissionRequest, PostToolUse, PostToolUseFailure, PostToolBatch, SubagentStart/Stop, TaskCreated, TaskCompleted), e Stop ou StopFailure, seguido por TeammateIdle, PreCompact, PostCompact e SessionEnd, com Elicitation e ElicitationResult aninhados dentro da execução de ferramenta MCP, PermissionDenied como um ramo lateral de PermissionRequest para negações em modo automático, WorktreeCreate, WorktreeRemove, Notification, ConfigChange, InstructionsLoaded, CwdChanged e FileChanged como eventos assíncronos independentes, e MessageDisplay como um evento somente de exibição que é executado enquanto o texto da mensagem do assistente é transmitido" width="520" height="1228" data-path="images/hooks-lifecycle.svg" />29 <img src="https://mintcdn.com/claude-code/x7pO8l4XcvAXCoVc/images/hooks-lifecycle.svg?fit=max&auto=format&n=x7pO8l4XcvAXCoVc&q=85&s=81b9256c1bbe8832553485f5d9e9c746" alt="Diagrama do ciclo de vida do hook mostrando Setup opcional alimentando SessionStart, depois um loop por turno contendo UserPromptSubmit, UserPromptExpansion para slash commands, o loop agentic aninhado (PreToolUse, PermissionRequest, PostToolUse, PostToolUseFailure, PostToolBatch, SubagentStart/Stop, TaskCreated, TaskCompleted), e Stop ou StopFailure, seguido por TeammateIdle, PreCompact, PostCompact e SessionEnd, com Elicitation e ElicitationResult aninhados dentro da execução de ferramenta MCP, PermissionDenied como um ramo lateral de PermissionRequest para negações em modo automático, WorktreeCreate, WorktreeRemove, Notification, ConfigChange, InstructionsLoaded, CwdChanged e FileChanged como eventos assíncronos independentes, e MessageDisplay como um evento somente de exibição que é executado enquanto o texto da mensagem do assistente é transmitido" width="520" height="1336" data-path="images/hooks-lifecycle.svg" />

30 </Frame>30 </Frame>

31</div>31</div>

32 32 


62| `WorktreeRemove` | When a worktree is being removed at session exit, when a subagent finishes, or when you delete a background session |62| `WorktreeRemove` | When a worktree is being removed at session exit, when a subagent finishes, or when you delete a background session |

63| `PreCompact` | Before context compaction |63| `PreCompact` | Before context compaction |

64| `PostCompact` | After context compaction completes |64| `PostCompact` | After context compaction completes |

65| `PreModelSwitch` | Before Claude Code applies a model switch that you or a client requested. Can block the switch |

66| `PostModelSwitch` | After the session's model changes, including changes Claude Code makes on its own, such as restoring the model when you resume a session |

65| `Elicitation` | When an MCP server requests user input during a tool call |67| `Elicitation` | When an MCP server requests user input during a tool call |

66| `ElicitationResult` | After a user responds to an MCP elicitation, before the response is sent back to the server |68| `ElicitationResult` | After a user responds to an MCP elicitation, before the response is sent back to the server |

67| `SessionEnd` | When a session terminates |69| `SessionEnd` | When a session terminates |

hooks-guide.md +2 −0

Details

488| `WorktreeRemove` | When a worktree is being removed at session exit, when a subagent finishes, or when you delete a background session |488| `WorktreeRemove` | When a worktree is being removed at session exit, when a subagent finishes, or when you delete a background session |

489| `PreCompact` | Before context compaction |489| `PreCompact` | Before context compaction |

490| `PostCompact` | After context compaction completes |490| `PostCompact` | After context compaction completes |

491| `PreModelSwitch` | Before Claude Code applies a model switch that you or a client requested. Can block the switch |

492| `PostModelSwitch` | After the session's model changes, including changes Claude Code makes on its own, such as restoring the model when you resume a session |

491| `Elicitation` | When an MCP server requests user input during a tool call |493| `Elicitation` | When an MCP server requests user input during a tool call |

492| `ElicitationResult` | After a user responds to an MCP elicitation, before the response is sent back to the server |494| `ElicitationResult` | After a user responds to an MCP elicitation, before the response is sent back to the server |

493| `SessionEnd` | When a session terminates |495| `SessionEnd` | When a session terminates |

Details

148| `WorktreeRemove` | When a worktree is being removed at session exit, when a subagent finishes, or when you delete a background session |148| `WorktreeRemove` | When a worktree is being removed at session exit, when a subagent finishes, or when you delete a background session |

149| `PreCompact` | Before context compaction |149| `PreCompact` | Before context compaction |

150| `PostCompact` | After context compaction completes |150| `PostCompact` | After context compaction completes |

151| `PreModelSwitch` | Before Claude Code applies a model switch that you or a client requested. Can block the switch |

152| `PostModelSwitch` | After the session's model changes, including changes Claude Code makes on its own, such as restoring the model when you resume a session |

151| `Elicitation` | When an MCP server requests user input during a tool call |153| `Elicitation` | When an MCP server requests user input during a tool call |

152| `ElicitationResult` | After a user responds to an MCP elicitation, before the response is sent back to the server |154| `ElicitationResult` | After a user responds to an MCP elicitation, before the response is sent back to the server |

153| `SessionEnd` | When a session terminates |155| `SessionEnd` | When a session terminates |