SubagentStop
Runs when a Claude Code subagent has finished responding. Matches on agent type, same values as SubagentStart.
SubagentStop input
In addition to the common input fields, SubagentStop hooks receive stop_hook_active, agent_id, agent_type, agent_transcript_path, and last_assistant_message. The agent_type field is the value used for matcher filtering. The transcript_path is the main session's transcript, while agent_transcript_path is the subagent's own transcript stored in a nested subagents/ folder. The last_assistant_message field contains the text content of the subagent's final response, so hooks can access it without parsing the transcript file.
SubagentStop hooks also receive the background_tasks and session_crons arrays described under Stop input. Both arrays are scoped to the parent session, not the subagent.
{
"session_id": "abc123",
"transcript_path": "~/.claude/projects/.../abc123.jsonl",
"cwd": "/Users/...",
"permission_mode": "default",
"hook_event_name": "SubagentStop",
"stop_hook_active": false,
"agent_id": "def456",
"agent_type": "Explore",
"agent_transcript_path": "~/.claude/projects/.../abc123/subagents/agent-def456.jsonl",
"last_assistant_message": "Analysis complete. Found 3 potential issues...",
"background_tasks": [],
"session_crons": []
}SubagentStop hooks use the same decision control format as Stop hooks, including hookSpecificOutput.additionalContext with hookEventName set to "SubagentStop", for non-error feedback that keeps the subagent running. Returning decision: "block" with a reason keeps the subagent running and delivers reason to the subagent as its next instruction. A hook that blocks by exiting 2 delivers its stderr message the same way. To inject context into the parent session after a subagent returns, use a PostToolUse hook on the Agent tool instead.