Skip to content

[FEATURE] Structured escalation as first-class state transition (teamwork escalate) #183

@JoshLuedeman

Description

@JoshLuedeman

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:

  1. Writes a typed escalation record to the workflow state file with: source role, target role, reason, timestamp, escalation ID
  2. Transitions the workflow to an escalated sub-state (not blocked — work continues, just routed differently)
  3. Logs an escalation_started metrics event
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfeature-requestA new capability proposed through forward-looking design or gap analysis

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions