Check multiple conditions before stopping
This Stop hook uses a detailed prompt to check three conditions before allowing Claude to stop. SubagentStop hooks use the same format to evaluate whether a subagent should stop. If the model returns "ok": false because the condition isn't met yet, Claude continues working with the provided reason as its next instruction:
{
"hooks": {
"Stop": [
{
"hooks": [
{
"type": "prompt",
"prompt": "You are evaluating whether Claude should stop working. Context: $ARGUMENTS\n\nAnalyze the conversation and determine if:\n1. All user-requested tasks are complete\n2. Any errors need to be addressed\n3. Follow-up work is needed\n\nRespond with JSON: {\"ok\": true} to allow stopping, or {\"ok\": false, \"reason\": \"your explanation\"} to continue working.",
"timeout": 30
}
]
}
]
}
}Agent-based hooks
Agent hooks are experimental. Behavior and configuration may change in future releases. For production workflows, prefer command hooks.
Agent-based hooks (type: "agent") are like prompt-based hooks but with multi-turn tool access. Instead of a single LLM call, an agent hook spawns a subagent that can read files, search code, and inspect the codebase to verify conditions. Agent hooks support the same events as prompt-based hooks.