Quality Gates for Agent Teams
Hooks on agent team events — TeammateIdle, TaskCompleted, TaskCreated — let you enforce quality standards automatically. When a hook exits with code 2, it sends feedback to the teammate, which must address the issue before the event can proceed.
Quick Reference
- →TeammateIdle: fires when a teammate is about to go idle — use to enforce output standards
- →TaskCompleted: fires when a task is marked done — use to run acceptance tests
- →TaskCreated: fires when a new task is added — use to enforce task format
- →Exit code 2 rejects the event and sends stderr as feedback to the teammate
- →The pattern: hook → validate → pass (exit 0) or reject with feedback (exit 2)
- →Quality gates are automatic enforcement — not agent-to-agent messaging
- →Test hook scripts manually before deploying to real team runs
- →Known limitation: task lag can cause TaskCompleted hooks to fire late or not at all
Quality Gates vs Communication
Quality gates are hooks that fire on team events and can block those events from proceeding. They are not agent-to-agent messages — they are automatic validators that run before a teammate finishes or a task closes. The teammate receives the hook's stderr output as feedback and must address it before proceeding.
Without quality gates, a teammate can mark a task complete even if tests fail, the output is missing, or the code violates project standards. Quality gates close this gap: a task cannot be marked complete until the gate's validation script passes.
| Hook | Fires When | Use For |
|---|---|---|
| TeammateIdle | A teammate finishes a turn and is about to go idle | Enforce output standards before a teammate stops working |
| TaskCompleted | A teammate marks a task done | Run acceptance tests — block completion if tests fail |
| TaskCreated | A new task is added to the Shared Task List | Enforce task format or prevent invalid scope |