How the engine works
From the prescriptive architecture to the actual dispatch loop: the 4-stage pipeline as designed, then the code that runs engagements.
Core Decision Architecture
Every request flows through a 4-stage pipeline. This is the backbone. Everything else hangs off it.
┌─────────────────────────────────────────────────────────┐
│ │
│ REQUEST IN │
│ │ │
│ ▼ │
│ ┌─────────┐ │
│ │ ROUTER │ ── Is this a direct answer or a workflow? │
│ └────┬────┘ Which specialist(s)? │
│ │ How much machinery does this need? │
│ ▼ │
│ ┌──────────────┐ │
│ │ SPECIALIST(S)│ ── Execute: retrieve, draft, │
│ │ │ calculate, use tools │
│ └──────┬───────┘ │
│ │ │
│ ▼ │
│ ┌──────────────┐ │
│ │ EVALUATOR │ ── Gate check against rubric: │
│ │ GATE │ correctness, citations, policy, │
│ │ │ consistency with tool outputs │
│ └──────┬───────┘ │
│ │ │
│ PASS │ FAIL │
│ │ │ │
│ ▼ ▼ │
│ OUTPUT LOOP (max 2x) │
│ │ │
│ ▼ │
│ Revise / re-run tools │
│ │ │
│ ▼ │
│ Back to EVALUATOR GATE │
│ │ │
│ If still fails after 2 loops: │
│ STOP + escalate to human │
│ │
└─────────────────────────────────────────────────────────┘