Summary
Prompt-based SubagentStop hooks correctly evaluate and send feedback to the subagent, but do not actually prevent the subagent from terminating. The subagent receives the feedback as a user message but never gets another turn to respond.
Expected Behavior
According to the hooks documentation:
Stop/SubagentStop Decision Control
"block" prevents Claude from stopping. You must populate reason for Claude to know how to proceed.
When a prompt-based SubagentStop hook returns {"ok": false, "reason": "..."}, the subagent should continue working with the provided feedback.
Actual Behavior
- Subagent completes its response
- SubagentStop hook fires correctly
- Haiku evaluates and returns
{"ok": false, "reason": "..."}
- Feedback is sent to the subagent as a user message with
isMeta: true
- Subagent session terminates anyway - no additional turn is given
Reproduction Steps
- Add a SubagentStop hook in
.claude/settings.json:
{
"hooks": {
"SubagentStop": [
{
"hooks": [
{
"type": "prompt",
"prompt": "Check if output contains 'REQUIRED'. If yes: {\"ok\": true}. If no: {\"ok\": false, \"reason\": \"Missing. Add it now.\"}",
"timeout": 30
}
]
}
]
}
}
- Invoke any subagent via Task tool
- Observe: hook fires, feedback sent, but subagent terminates without continuing
Evidence from Transcript
{"type":"progress","data":{"type":"hook_progress","hookEvent":"SubagentStop",...}}
{"type":"user","message":{"content":"Stop hook feedback: Prompt hook condition was not met..."},"isMeta":true}
// Transcript ends - no subsequent assistant turn
Configurations Tested
- Hook in agent frontmatter (
hooks: Stop:) - same behavior
- Hook in agent frontmatter (
hooks: SubagentStop:) - same behavior
- Hook in
.claude/settings.json with/without matcher - same behavior
Environment
- Claude Code version: 2.1.17
- Platform: macOS
Related Issues
Summary
Prompt-based
SubagentStophooks correctly evaluate and send feedback to the subagent, but do not actually prevent the subagent from terminating. The subagent receives the feedback as a user message but never gets another turn to respond.Expected Behavior
According to the hooks documentation:
When a prompt-based SubagentStop hook returns
{"ok": false, "reason": "..."}, the subagent should continue working with the provided feedback.Actual Behavior
{"ok": false, "reason": "..."}isMeta: trueReproduction Steps
.claude/settings.json:{ "hooks": { "SubagentStop": [ { "hooks": [ { "type": "prompt", "prompt": "Check if output contains 'REQUIRED'. If yes: {\"ok\": true}. If no: {\"ok\": false, \"reason\": \"Missing. Add it now.\"}", "timeout": 30 } ] } ] } }Evidence from Transcript
{"type":"progress","data":{"type":"hook_progress","hookEvent":"SubagentStop",...}} {"type":"user","message":{"content":"Stop hook feedback: Prompt hook condition was not met..."},"isMeta":true} // Transcript ends - no subsequent assistant turnConfigurations Tested
hooks: Stop:) - same behaviorhooks: SubagentStop:) - same behavior.claude/settings.jsonwith/without matcher - same behaviorEnvironment
Related Issues