mati_core/hooks/post_task.rs
1/// Claude PostToolUse(Task) hook — record a nested subagent→subagent spawn edge.
2/// Fires after a Task/Agent tool call returns; the payload's top-level `agent_id`
3/// is the spawner and `tool_response.agentId` is the child. Only nested spawns
4/// (spawner is itself a subagent) are recorded — a root spawn is already covered
5/// by the SubagentStart hook. Fire-and-forget, fail-open.
6pub const SCRIPT: &str = r#"#!/usr/bin/env bash
7HOOKS_DIR="$(cd "$(dirname "$0")" && pwd)" && export PATH="$HOOKS_DIR:$PATH"
8command -v mati >/dev/null 2>&1 || exit 0
9exec mati hook-decide claude-post-task
10"#;