Context
Currently when a worker agent stops, the shell hook forwards a [DONE] message to the honryu brain, which then decides whether the task was actually completed or needs more work. This adds latency and brain cognitive load.
Opportunity
Claude Code now supports type: "prompt" hooks — a single-turn LLM call that returns {ok: true/false, reason}. On Stop events, if ok: false, Claude continues working instead of stopping, with the reason fed back as context.
{
"Stop": [{
"hooks": [{
"type": "prompt",
"prompt": "The agent was assigned the following task:\n\n$TASK_CONTENT\n\nThe agent's last message was: $ARGUMENTS\n\nDid the agent fully complete the task? Return {\"ok\": false, \"reason\": \"what remains\"} if not done.",
"timeout": 30,
"statusMessage": "Verifying task completion..."
}]
}]
}
Benefits
- Catches incomplete work before it reaches honryu brain
- Reduces brain workload (only truly completed tasks get forwarded)
- Agents self-correct without human intervention
- Uses
stop_hook_active guard to prevent infinite loops (Claude Code sets this on re-entry)
Considerations
- The prompt hook has access to
last_assistant_message in the input JSON — useful for evaluation
stop_hook_active: true is set when Claude is already continuing due to a Stop hook — must check this to avoid infinite loops
- Cost: each Stop event triggers an LLM call (Haiku-level, ~30s timeout)
- Could also use
type: "agent" for deeper verification (50 turns, can Read/Grep files)
- Need to inject the dropbox task content into the prompt somehow (env var or file read)
Files involved
crates/kild-core/src/sessions/integrations/claude.rs — settings patching
crates/kild-core/src/sessions/dropbox.rs — dropbox protocol (task content)
Context
Currently when a worker agent stops, the shell hook forwards a
[DONE]message to the honryu brain, which then decides whether the task was actually completed or needs more work. This adds latency and brain cognitive load.Opportunity
Claude Code now supports
type: "prompt"hooks — a single-turn LLM call that returns{ok: true/false, reason}. OnStopevents, ifok: false, Claude continues working instead of stopping, with the reason fed back as context.{ "Stop": [{ "hooks": [{ "type": "prompt", "prompt": "The agent was assigned the following task:\n\n$TASK_CONTENT\n\nThe agent's last message was: $ARGUMENTS\n\nDid the agent fully complete the task? Return {\"ok\": false, \"reason\": \"what remains\"} if not done.", "timeout": 30, "statusMessage": "Verifying task completion..." }] }] }Benefits
stop_hook_activeguard to prevent infinite loops (Claude Code sets this on re-entry)Considerations
last_assistant_messagein the input JSON — useful for evaluationstop_hook_active: trueis set when Claude is already continuing due to a Stop hook — must check this to avoid infinite loopstype: "agent"for deeper verification (50 turns, can Read/Grep files)Files involved
crates/kild-core/src/sessions/integrations/claude.rs— settings patchingcrates/kild-core/src/sessions/dropbox.rs— dropbox protocol (task content)