Skip to content

Orchestration Patterns

The 20 instruction tools are classified into four routing tiers. bootstrap, meta-routing, and onboard-project act as discovery entrypoints that route consumers to the right tier for their request.

Instruction tool tiers — light

Instruction tool tiers — dark

The runtime does not bind workflows to hard-coded provider model names. Model selection is resolved through capability tags and workload profiles declared in orchestration.toml, then mapped to physical model IDs by src/models/model-router.ts.

xstate manages workflow state — it is not the model resolver.

Implemented capability tags:

TagMeaning
fast_draftSpeed-optimized generation
deep_reasoningMulti-step causal chain reasoning
large_contextLong-context coherence
adversarialIndependent critique, low self-agreement bias
classificationFast label/route assignment
cost_sensitiveMinimize token cost
structured_outputSchema-bound JSON/code output
code_analysisCode understanding and review
security_auditSecurity threat modeling
synthesisMulti-source reconciliation
math_physicsSymbolic math and physics reasoning
low_latencySub-500ms response priority

22 named workload profiles in orchestration.toml:

ProfileRequired TagsFan-OutNotes
meta_routingclassification1low_latency preferred
implementcode_analysis, structured_output2cost_sensitive preferred
researchsynthesis3cost_sensitive preferred
evaluationstructured_output3cost_sensitive preferred
governancesecurity_audit, adversarial1Human-in-the-loop required
physics_analysismath_physics, deep_reasoning1No fallback configured
documentationstructured_output3cost_sensitive preferred
benchmarkingstructured_output3
prompt_engineeringstructured_output2

Pattern 1: Parallel Critique → Synthesis

Section titled “Pattern 1: Parallel Critique → Synthesis”

Use for: architecture decisions, wave gating, high-risk design.

flowchart LR
    A([Request]) --> B[Advanced Model\nGenerate plan]
    A --> C[Advanced Model\nIndependent critique\n— no prior context]
    B --> D{Disagreement\ndelta}
    C --> D
    D --> E[Advanced Model\nReconcile + synthesize]
    E --> F([Final output])
    style C fill:#f97316,color:#fff,stroke:#ea580c
    style D fill:#334155,color:#e2e8f0,stroke:#475569

The disagreement delta between steps 1 and 2 is itself signal — review it before step 3.

Use for: code generation, mechanical implementation. Cuts advanced-model token cost ~60%.

flowchart LR
    A([Request]) --> B[Zero-Cost\nFirst draft]
    B --> C[Advanced\nReview + security check]
    C --> D[Zero-Cost\nApply review notes]
    D --> E([Final output])
    style B fill:#16a34a,color:#fff,stroke:#15803d
    style C fill:#dc2626,color:#fff,stroke:#b91c1c
    style D fill:#16a34a,color:#fff,stroke:#15803d

Refactoring variant: Single-file → Zero-Cost only. Cross-module → add Advanced boundary review. Parallel batch → 3× Zero-Cost lanes in parallel → single Advanced diff-review.

Pattern 3: Majority Vote for Classification

Section titled “Pattern 3: Majority Vote for Classification”

Use for: eval-*, bench-* skills.

flowchart TD
    A([Request]) --> B[Efficient\nBaseline vote]
    A --> C[Zero-Cost\nSecond vote]
    A --> D[Zero-Cost\nThird vote]
    B --> E{Consensus?}
    C --> E
    D --> E
    E -- Yes --> G([Output])
    E -- Split --> F[Advanced\nTiebreak]
    F --> H{Resolved?}
    H -- Yes --> G
    H -- Split --> I[Advanced\nFinal arbitration]
    I --> G
    style B fill:#d97706,color:#fff,stroke:#b45309
    style C fill:#16a34a,color:#fff,stroke:#15803d
    style D fill:#16a34a,color:#fff,stroke:#15803d
    style F fill:#dc2626,color:#fff,stroke:#b91c1c
    style I fill:#dc2626,color:#fff,stroke:#b91c1c

Use for: resilience-oriented dispatch. Implements resil_homeostatic_module’s PID setpoint concept.

flowchart LR
    A([Request]) --> B{Try Efficient}
    B -- pass --> OUT([Output])
    B -- fail --> C{Try Advanced}
    C -- pass --> OUT
    C -- fail --> D[Emergency fallback]
    D --> OUT
    style B fill:#d97706,color:#fff,stroke:#b45309
    style C fill:#dc2626,color:#fff,stroke:#b91c1c
    style D fill:#7c3aed,color:#fff,stroke:#6d28d9
ConditionFirst tryFallbackEmergency
Simple skill dispatchCheapFreeFree
Complex skill dispatchFreeStrong
Physics skills (qm-*, gr-*)StrongStrong (back-translation)
Governance (gov-*)Strong (first-pass)Strong (final judgment)

Pattern 5: Free Triple Parallel + Single Strong Synthesis

Section titled “Pattern 5: Free Triple Parallel + Single Strong Synthesis”

Use for: research, synthesis, roadmap generation (zero marginal cost for 3× Zero-Cost lanes).

flowchart LR
    A([Request]) --> B[Zero-Cost\nPerspective A\nspeed-optimized]
    A --> C[Zero-Cost\nPerspective B\nanalysis-optimized]
    A --> D[Zero-Cost\nPerspective C\nalternative framing]
    B --> E[Advanced\nSynthesis]
    C --> E
    D --> E
    E --> F([Final output])
    style B fill:#16a34a,color:#fff,stroke:#15803d
    style C fill:#16a34a,color:#fff,stroke:#15803d
    style D fill:#16a34a,color:#fff,stroke:#15803d
    style E fill:#dc2626,color:#fff,stroke:#b91c1c

Cost model: 3 zero-cost calls + 1 Advanced synthesis pass on 300–500 tokens ≈ 80% cheaper than running Advanced end-to-end.

Parallelism is driven by profile fan_out and pattern — not legacy tier names. The server uses p-queue with concurrency: 3 for fan-out workflows. Strong model stays in synthesis/review lane only.

Never free-parallel (strong required): qm-*, gr-*, gov-*, adapt-*, resil-*, orch-agent-orchestrator

src/models/model-router.ts resolves model role classes to physical model IDs at runtime. Physical model names are never hardcoded in source. Use role classes in code:

Role classPurpose
freeBroad drafting, fan-out lanes, template fill
cheapFast aggregation, classification, merge
strongSynthesis, physics, security, final judgment
reviewerCross-model audit, independent critique

Always call mcp_ai-agent-guid_model-discover to get current model IDs — the roster changes.

Use the MCP Inspector CLI to verify the real routing path:

Terminal window
npm run build
npx -y @modelcontextprotocol/inspector --cli node dist/index.js \
--method tools/call \
--tool-name system-design \
--tool-arg 'request="Design a session token store"'

See MCP Debugging Reference for full debugging workflow.