Skip to content

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 DoD

Not 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

TierSignalBehaviour
TrivialSingle job, no ambiguitySkip grill + DoD entirely — proceed directly to task/execute.
MechanicalMulti-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 / ambiguousFeature-shaped, open-ended, or unclear scopeBounded 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` green

Each 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_coverage reports 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:

ToolPurpose
dod_generateWrites DoD-N lines to .plans/<slug>/06-definition-of-done.md. Deterministic — no LLM call.
dod_coverageReturns 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:reference run.


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:

  1. Calls dod_generate to author missing DoD-N: <requirement> — VERIFY: <method> items.
  2. Maps unmapped tasks — new tasks via task_create dod_ids, existing unmapped tasks via task_update dod_ids (in-place remapping).
  3. Re-runs dod_coverage to 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

ValueBehaviour
offNo 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.
enforceAuto-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:

  1. Tasks created before activePlanSlug was set may not appear in dod_coverage reports — but they can be remapped in-place via task_update dod_ids once the plan slug is active (the self-healing gate handles this automatically).
  2. Zero tasks + existing DoD items yields fullyMapped: false with an allow signal (cosmetic inconsistency).
  3. No .max() bound on the dod_generate items array — callers could theoretically pass an unbounded list.
  4. O(n) max-DoD regex scan on append — negligible in practice.