/omcustom-loop — SubagentStop Advisory Hooks
Overview
When background subagents complete, SubagentStop command hooks record outcomes, count consecutive completions, and emit advisories; none of them continues the orchestrator's workflow. History: the "check pending steps" instruction was dropped from the prompt hook in v1.1.32 (commit 1dd0abef), and the remaining failure-gate prompt hook was replaced by an advisory command hook in d393db06 (#1631).
How It Works
- When a background subagent completes, Claude Code fires the
SubagentStopevent - The command hooks run:
task-outcome-recorder.sh(records an outcome entry, but SubagentStop exposes no failure signal, so entries are always outcome=success (hooks doc lists SubagentStop input fields asstop_hook_active,agent_id,agent_type,agent_transcript_path,last_assistant_message,background_tasks,session_cronsplus common fields; measured payload keys: https://github.com/baekenough/oh-my-customcode/issues/1775#issuecomment-6404861043); see the "Outcome caveat" comment in the script),stall-detection-advisor.sh(stderr advisory on stalled parallel agents; stderr on exit 0 is not fed to the model (the doc says only: "To read it yourself … enable debug logging"); official hooks doc https://code.claude.com/docs/en/hooks.md: "Claude never sees stderr from a hook that exits 0."),auto-continue-guard.sh(counts consecutive completions),r007-r008-drift-advisor.sh(R007/R008 drift advisory); failure advisories for Agent/Task calls come fromPostToolUseFailure(subagent-failure-advisor.sh) instead, not from SubagentStop - None of them continues the orchestrator's workflow; the orchestrator decides the next workflow step itself from the returned results. Exception: when
r007-r008-drift-advisor.shemits an advisory on SubagentStop, CC delivers theadditionalContextto the stopping subagent, which continues its turn to respond (CHANGELOG 2.1.163); hooks doc: SubagentStop hooks supporthookSpecificOutput.additionalContext"for non-error feedback that keeps the subagent running", and "To inject context into the parent session after a subagent returns, use a