Problem It Solves
Closes gap: #170
Agent-to-agent escalation today produces no state record, no metrics event, and no routing. All escalations default to "ask the human." There is no way to route a coder's design question to the architect, or a tester's defect report back to the coder, without human mediation.
Proposed Behavior
New CLI command: teamwork escalate
teamwork escalate <workflow-id> --from coder --to architect --reason "Authentication design conflict — JWT claims structure doesn't match what the API spec requires"
This command:
- Writes a typed escalation record to the workflow state file with: source role, target role, reason, timestamp, escalation ID
- Transitions the workflow to an
escalated sub-state (not blocked — work continues, just routed differently)
- Logs an
escalation_started metrics event
- Updates
teamwork next output to prompt the target role
Escalation resolution
When the target role completes its escalation response, they run:
teamwork escalate resolve <workflow-id> <escalation-id> --summary "Aligned on using sub-claims for role scopes. See ADR-012."
This resumes the original step with the escalation resolution appended to the active handoff context.
Escalation matrix in docs/protocols.md
A documented routing table (see also #128) defines valid escalation routes per role, so agents have a lookup rather than a judgment call. Invalid routes (e.g., coder → tester for a design question) emit a validation warning suggesting the correct target.
Dependencies
Complexity Estimate
Large — 6 files: new CLI command, state schema escalation record, metrics event, teamwork next output, escalation matrix validation, tests
Problem It Solves
Closes gap: #170
Agent-to-agent escalation today produces no state record, no metrics event, and no routing. All escalations default to "ask the human." There is no way to route a coder's design question to the architect, or a tester's defect report back to the coder, without human mediation.
Proposed Behavior
New CLI command:
teamwork escalateThis command:
escalatedsub-state (not blocked — work continues, just routed differently)escalation_startedmetrics eventteamwork nextoutput to prompt the target roleEscalation resolution
When the target role completes its escalation response, they run:
This resumes the original step with the escalation resolution appended to the active handoff context.
Escalation matrix in docs/protocols.md
A documented routing table (see also #128) defines valid escalation routes per role, so agents have a lookup rather than a judgment call. Invalid routes (e.g., coder → tester for a design question) emit a validation warning suggesting the correct target.
Dependencies
Complexity Estimate
Large — 6 files: new CLI command, state schema escalation record, metrics event,
teamwork nextoutput, escalation matrix validation, tests