Run a second Claude call after an agent finishes, for notifications or anything else.
Place an ON_FINISH.md file alongside AGENT.md to run a post-run hook. After an agent completes (success or failure), the orchestrator spawns a second claude -p call with the run outcome injected as context.
This lets you add notifications, logging, or any other post-run action without modifying vteam itself. Claude handles the integration using whatever MCPs or CLI tools are available in your environment.
ON_FINISH.md is the hook’s system prompt:
You are a notification bot. Post the run result to the #eng-prs Slack channel.If the run failed, also ping @oncall.The hook’s model and tools go in the onFinish section of agent.json:
{ "onFinish": { "model": "haiku", "allowedTools": ["Bash(curl *)", "mcp__slack__send_message"] }}The hook’s prompt
Section titled “The hook’s prompt”The user prompt is generated from the run outcome and includes: agent name, status (completed/failed), timestamps, task details, branch name, PR URL, reviewed PR info, agent content output (review text, analysis, etc.), and error message (if any). When the agent returns content in its output, the hook receives it in a ## Content section. This lets hooks act on the agent’s primary deliverable (e.g. post a PR review as a GitHub comment).
onFinish fields
Section titled “onFinish fields”onFinish field |
Default | Description |
|---|---|---|
model |
none | Claude model override for the hook |
allowedTools |
none | Tools the hook may use |
disallowedTools |
none | Tools the hook may NOT use |
Behavior
Section titled “Behavior”The hook runs in the main project directory (not the worktree). Hook failures are logged but do not affect the agent run’s exit status. The hook does not run after a stopped run.
The hook is opt-in: agents without an ON_FINISH.md skip it entirely. The onFinish section is optional; having one without ON_FINISH.md is a load error.