Coordinator Planning: Grill + Auto-DoD
The coordinator follows a graduated planning motion before executing work:
grill (gradient) → generate DoD → task DAG (linked to DoD) → critic → execute → verify DoDNot every prompt needs full ceremony. The coordinator self-classifies incoming work into one of three tiers and applies the appropriate level of rigour.
Trigger Gradient
| Tier | Signal | Behaviour |
|---|---|---|
| Trivial | Single job, no ambiguity | Skip grill + DoD entirely — proceed directly to task/execute. |
| Mechanical | Multi-part but well-defined (bugfix, refactor, chore) | Silent self-grill — the coordinator internally answers 3 inquisitor angles (UX, technical, edge-cases) without prompting the user — then auto-generates a DoD. |
| Novel / ambiguous | Feature-shaped, open-ended, or unclear scope | Bounded interactive grill — ≤1 round, ≤5 questions via ask_user — followed by a user-confirmed DoD. |
Unattended / no ask_user fallback
Under --unattended or when the ask_user tool is unavailable, the interactive tier degrades to the self-answered path. Any assumptions the coordinator makes are prefixed with ⚠️ ASSUMPTION. The planning motion never blocks — it always respects the "stay responsive" rule.
Definition of Done (DoD)
After grilling, the coordinator calls dod_generate to write structured DoD lines into .plans/<slug>/06-definition-of-done.md:
DoD-1: All endpoints return 200 on valid input — VERIFY: integration test passes
DoD-2: Error responses include machine-readable code — VERIFY: grep response schema
DoD-3: No regressions in existing test suite — VERIFY: `npm test` greenEach line follows the format DoD-N: <requirement> — VERIFY: <method>.
The coordinator auto-creates the .plans/<slug>/ directory for ad-hoc DAG planning so DoD and grill artifacts always have a home.
Task ↔ DoD Linking
When the coordinator creates tasks via task_create, it can include dod_ids: string[] to link each task to the DoD items it satisfies.
For already-created tasks, task_update also accepts dod_ids for in-place remapping (replace-on-provided; omit = unchanged; empty array = clears all links). This allows the self-healing gate to remap existing unmapped tasks without recreating them.
Coverage tracking:
dod_coveragereports which tasks lack a DoD mapping and which DoD items have no implementing task.- The coordinator uses this feedback to fill gaps before spawning workers.
Ordering note
dod_generate should be called before task_create so that DoD IDs exist when tasks are created. Tasks created before activePlanSlug was set may not appear in coverage reports.
Coordinator Tools
Two new coordinator tools power the DoD workflow:
| Tool | Purpose |
|---|---|
dod_generate | Writes DoD-N lines to .plans/<slug>/06-definition-of-done.md. Deterministic — no LLM call. |
dod_coverage | Returns a coverage report: unmapped tasks, uncovered DoD items, and an allow/warn signal. |
These tools will appear in the auto-generated Coordinator Tools Reference after the next
npm run gen:referencerun.
DoD Gate — AGENTS_FLEET_DOD_GATE
An environment variable controls enforcement at execute-wave time. The gate is self-healing (remediate-first): on a coverage gap the coordinator auto-remediates before deciding whether to proceed or escalate.
Remediation behaviour
When dod_coverage detects a gap (unmapped tasks or uncovered DoD items), the coordinator automatically:
- Calls
dod_generateto author missingDoD-N: <requirement> — VERIFY: <method>items. - Maps unmapped tasks — new tasks via
task_create dod_ids, existing unmapped tasks viatask_update dod_ids(in-place remapping). - Re-runs
dod_coverageto verify the gap is closed.
Remediation is capped at one pass — the coordinator never loops. After the single remediation attempt, the gate mode determines what happens next.
Gate modes
| Value | Behaviour |
|---|---|
off | No gating — coverage is informational only. |
warn (default) | Auto-remediates, then proceeds regardless; only emits a chip/warning if a gap genuinely could not be closed. |
enforce | Auto-remediates, then holds the execute wave (escalates to the user) if a gap remains. Under --unattended or when ask_user is unavailable, proceeds after the remediation pass. |
Safety guarantees
- The gate can never wedge the coordinator: if no DoD file exists, no DoD items are present, coverage is fully mapped, or the gate value is
off, execution proceeds unconditionally. - An unrecognised env value is treated as
warn. - Remediation is bounded to one pass — no infinite loop risk.
Known Cosmetic Edges
These are non-blocking and documented for future hardening:
- Tasks created before
activePlanSlugwas set may not appear indod_coveragereports — but they can be remapped in-place viatask_update dod_idsonce the plan slug is active (the self-healing gate handles this automatically). - Zero tasks + existing DoD items yields
fullyMapped: falsewith anallowsignal (cosmetic inconsistency). - No
.max()bound on thedod_generateitems array — callers could theoretically pass an unbounded list. - O(n) max-DoD regex scan on append — negligible in practice.