Coordinators

Four coordinator skills that orchestrate multi-step workflows end to end

Overview

Four Coordinators

Each coordinator delegates to subagents -- it never writes code itself.

CoordinatorPhasesScopeModel Strategy
dx-req4 stepsRequirements gatheringSonnet + Opus (checklist)
dx-step-allN steps (dynamic)Plan execution loopSonnet + Opus (fix/heal) + Haiku (test/commit)
dx-bug-all3 stepsBug triage, verify, fixSonnet + Opus (fix planning)
dx-agent-all12 phases (max 13)Full story to PR pipelineAll tiers
Architecture

Common Patterns

Shared design principles across all coordinators.

Coordinator-Only Architecture

All coordinators use disable-model-invocation: true — they NEVER write code themselves. Every phase is delegated via direct Skill() invocation, keeping the main context lean (approximately 10 tokens per status update vs approximately 200 for full file reads).

Isolated Context Management

Task tool calls use isolated subagents. Skills invoked via Skill tool have context: fork. The main orchestrator only sees compact return summaries, never reads spec files. Prevents context compaction in long-running pipelines.

Idempotent Execution

Every skill checks if its output file already exists and is still valid before regenerating. Steps report one of: created, updated, or skipped.

Convention-Based Data Flow

No data is passed between skills. All skills find each other’s output by predictable filenames in .ai/specs/<id>-<slug>/.

Self-Healing Architecture

step-fix (first responder): one attempt to fix compilation/test/review failures. step-heal (deep analysis): creates corrective steps after 2 consecutive fix failures. 3-cycle review loop: code review, auto-fix, rebuild, re-review (max 3 cycles). 2 healing cycles max: if healing fails twice, stop for human intervention.

Cross-Repo Delegation

When DX_PIPELINE_MODE is set, code-writing coordinators check if the work targets another repo. If so, they write delegate.json and STOP — the YAML step reads it and queues the equivalent pipeline in the target repo.

Coordinator

dx-req

Requirements gathering pipeline -- 4 steps

Requirements Pipeline /dx-req <work-item-id>
requirements Full pipeline (fetch, DoR, explain, research, share)
/dx-req

DoR Gate

The DoR step is a gate — if blocking questions exist, the pipeline pauses. The BA checks items in the ADO comment. Re-running /dx-req reads the checkbox state and re-validates. Already-completed steps are skipped on re-run.

Coordinator

dx-step-all

Plan execution loop -- dynamic number of steps

Execution Loop (per step) /dx-step-all
dx-step Execute + test + review + commit
/dx-step
dx-step-fix Fix on failure
/dx-step-fix

On Failure: step-fix

If a step fails (compile error, test failure, review rejection), dx-step-fix makes one attempt to diagnose and fix the issue.

On 2 Consecutive Failures: step-heal

After 2 consecutive fix failures, dx-step-fix escalates to root cause analysis and creates corrective steps in implement.md. Maximum 2 escalation cycles before stopping for human intervention.

Self-Learning

dx-step-all logs fix patterns to .ai/learning/raw/fixes.jsonl. When a pattern reaches 3+ successes with 0 failures, it is promoted to .claude/rules/learned-fix-*.md — auto-loaded on every future run.

Coordinator

dx-bug-all

Bug fix pipeline -- 3 steps

Bug Fix Pipeline /dx-bug-all <bug-id>
triage Fetch + identify
/dx-bug-triage
verify Reproduce via browser
/dx-bug-verify
fix Plan + execute + PR
/dx-bug-fix

Hotspot Detection

dx-bug-all logs bug patterns to .ai/learning/raw/bugs.jsonl. When a component has 3+ bugs, it warns about a hotspot — helping identify fragile areas in the codebase.

Coordinator

dx-agent-all

The most comprehensive coordinator -- up to 13 phases from ticket to PR

Full Pipeline /dx-agent-all <work-item-id>

Interactive by default -- pauses after requirements. Add 'autonomous' to skip pauses.

Phase 1 Requirements
dx-req
Phase 1.5 Figma extract
dx-figma-extract
Phase 2 Figma prototype
dx-figma-prototype
Phase 2b Planning
dx-plan
Phase 3 Execution
dx-step-all
Phase 4 Build
dx-step-build
Phase 4.5 Code review
dx-step-verify
Phase 5a Commit
dx-pr-commit
Phase 5 AEM verify
aem-verify
Phase 6 Create PR
dx-pr
Phase 7 Documentation
dx-doc-gen
Deep Dive

Phase Details

Each phase of dx-agent-all explained.

Phase 1: Requirements (dx-req)

Subagent runs the full requirements pipeline: fetch, dor, explain, research, share. Interactive: Pauses for human review of dor-report.md and explain.md. Autonomous: Continues immediately. Fail condition: ADO fetch fails = ABORT.

Phase 1.5a: Cross-Repo Check (pipeline mode only)

Only runs when DX_PIPELINE_MODE is set. Reads research.md for cross-repo scope. If current repo is not the target: writes delegate.json and STOPS. Skipped in local mode.

Phase 1.5 + 2: Figma (optional)

Scans raw-story.md for Figma URLs. If found, extracts design context (Phase 1.5) and generates a standalone HTML/CSS prototype using 2 parallel Haiku agents for convention discovery (Phase 2). Non-blocking: If Figma MCP fails, continues with a warning.

Phase 2b: Planning

Runs dx-plan, dx-plan-validate, and optionally dx-plan-resolve. Uses Opus with ultrathink for deep reasoning about dependencies. Fail condition: Validation FAIL = STOP.

Phase 3: Execution (dx-step-all)

For each pending step: execute, test, review, commit. Self-healing: step-fix (1 attempt), step-heal (corrective steps, max 2 cycles). Commits deferred to after build verification.

Phase 4: Build Verification

Max 6 fix attempts. One error at a time, minimal fixes. Fail condition: Still broken after 6 = skip review/commit, continue to summary.

Phase 4.5: Full Code Review (dx-step-verify)

6-phase gate: compile, lint, test, secret scan, architecture, code review. Code review uses dx-code-reviewer (Opus, 80%+ confidence). Review-fix loop: max 3 cycles. If FAILED after 3 cycles, step-heal creates corrective steps, rebuilds, and re-reviews (max 2 healing cycles).

Phase 5a + 6: Commit + PR

Only if build AND review passed. Reads auto_commit and auto_pr from config preferences.

Phase 7: Documentation (optional)

Only if PR created. aem-doc-gen runs first (AEM projects), then dx-doc-gen reads its output and posts wiki page to sprint subfolder.

Models

Model Usage Per Phase

Each phase uses the right model tier for cost and quality.

PhaseModelReasoning
Requirements (fetch/explain/research)SonnetExecution tasks
Requirements (checklist)OpusDeep analysis of ambiguities
Figma extractSonnetMCP data extraction
Figma prototype (conventions)HaikuCSS/HTML convention discovery
Figma prototype (generation)SonnetStandalone HTML/CSS prototype
Planning (plan/validate/resolve)OpusDeep reasoning, ultrathink
Step executionSonnetCode writing
Step testingHaikuSimple command execution
Step reviewOpusCode quality analysis
Step fix / healOpusRoot cause analysis, strategy change
Step commitHaikuSimple git operations
BuildSonnetError diagnosis
Code review (full)OpusConfidence-based quality filter
PR creationSonnetSummary writing
DocumentationSonnetContent generation
Cost

Token Budget Estimate

Typical story without healing or failures.

PhaseEstimated TokensNotes
req-all≈50K4 sub-steps, parallel agents
plan + validate≈80KUltrathink, deep codebase analysis
step-all (5 steps)≈150KMost expensive phase
build≈20KQuick fix loops
code review≈60KFull diff review, Opus
commit + PR≈10KLightweight
Total≈370KWithout healing/fixes

With Failures

With failures and healing, a story can reach 500K-800K tokens. The self-healing architecture trades tokens for autonomy — most issues resolve without human intervention.

Comparison

Phase Comparison

Which coordinator covers which phases.

Phasedx-reqdx-step-alldx-bug-alldx-agent-all
Fetch / Triagefetchtriagereq-all
Explainyesvia req-all
Researchyesvia req-all
Figmaoptional
Planningplan+validate+resolve
Feature Branchyesyes
Bug Verifybrowser
Step Executionloopvia bug-fixvia step-all
Buildvia bug-fixstep-build
Code Reviewstep-verify
Commitper stepvia bug-fixstep-commit
PR Creationvia bug-fixdx-pr
Documentationdoc-gen
Modes

Interactive vs Autonomous

Only dx-agent-all pauses by default.

CoordinatorInteractive (default)Autonomous
dx-reqNo pausesNo pauses
dx-step-allNo pausesNo pauses
dx-bug-allNo pausesNo pauses
dx-agent-allPause after requirements, auto-continue after planningStraight through
Autonomous mode
/dx-agent-all 2416553 autonomous
Superpowers

Superpowers Integration

Optional structured methodology hooks that enhance planning, debugging, and verification.

Design Exploration (Planning)

dx-plan supports an optional pre-planning step that invokes superpowers:brainstorming to surface alternative approaches before committing to an implementation strategy. Helps avoid tunnel vision on complex stories.

Verification Gate (Review)

After the review-fix loop concludes, dx-step-verify optionally invokes superpowers:verification-before-completion for a final cross-cutting check — confirming all acceptance criteria are met before marking the step done.

Systematic Debugging (Fix)

dx-step-fix optionally invokes superpowers:systematic-debugging for structured 4-phase diagnosis (Observe, Hypothesize, Test, Fix) when the error is ambiguous or multi-layered.

Execution Methodology

Before Phase 1 begins, dx-agent-all runs an “Execution Methodology” setup step that optionally invokes superpowers:executing-plans to bootstrap structured plan-execution behaviour. All superpowers hooks fall back gracefully when the plugin is not installed.

Reasoning

Extended Thinking / Ultrathink

Deep reasoning modes used in planning and healing phases.

Planning Phase (Opus)

dx-plan and dx-plan-validate use ultrathink mode for deep reasoning about dependencies, step ordering, and risk assessment. This is the most token-intensive phase (≈80K tokens) but produces higher-quality plans with fewer downstream failures.

Escalation Phase (Opus)

dx-step-fix escalates to extended thinking for deep root-cause analysis when 2 consecutive fix attempts fail. The escalated fix sees the full error context, previous fix attempts, and the original step intent to devise a fundamentally different approach.

Token Budget with Healing

The base token budget of ≈370K assumes no failures. With healing and fix cycles, a story can reach 500K-800K tokens. Each healing cycle adds ≈40-80K tokens for deep analysis plus the cost of executing corrective steps. The system trades tokens for autonomy — most issues resolve without human intervention.

KAI by Dragan Filipovic