⚠️ Enforcement note: The writeback contract (task_update + thought_record) is a design-level requirement. In the reference implementation (AMS), enforcement is at convention level — agents that skip writeback are flagged but not blocked at runtime. Colibri’s implementation WILL enforce this at runtime (hard block).
S15 — GSD Contract
Defines the task execution state machine used by the orchestration layer.
States
GATHER → SYNC → DISPATCH → VERIFY → DONE
↓
RETRY → GATHER
| State | Purpose |
|---|---|
| GATHER | Collect task definition, dependencies, context, memory |
| SYNC | Validate preconditions, resolve dependency order, check blockers |
| DISPATCH | Assign to agent pool, execute phase work, track progress |
| VERIFY | Run acceptance criteria, tests, lint, generate proofs |
| DONE | Write results, update task status, seal audit trail |
| RETRY | Classify error, backoff, re-enter GATHER or DISPATCH |
Multi-phase workflows
A task may decompose into ordered phases:
- Audit (research)
- Contract (define interface)
- Execution packet (plan implementation)
- Implementation (write code)
- Verification (test and prove)
Each phase gets an agent pool allocation. Phases execute sequentially — phase N+1 starts only when phase N completes.
Writeback contract
Every completed task must produce:
task_update: status=done, progress=100thought_record: task_id, branch, commit SHA, tests run, summary, blockers
Failure to write back marks the task as orphaned.
Enforcement note: Writeback tools are available but enforcement is at convention level, not runtime. No hard block prevents a task from closing without writeback. Orphan detection is a warning scan, not an automated rollback.
Error recovery
- Classify: transient (timeout, rate limit) vs permanent (invalid input)
- Retry: exponential backoff, max 3 attempts for transient errors
- Fallback: simpler execution path or partial completion
- Escalate: mark as blocked, log error, notify parent workflow
Implementation Status
⚠ Donor genealogy table — not a Phase 0 claim. The table below was assembled in R40 against the pre-R53 donor AMS runtime in
projects/unified-mcp/src/. That source tree no longer exists —src/was deleted in R53 and everysrc/controllers/*.js,src/gsd/*.js, andsrc/intelligence/*.jsreference in the table below is heritage genealogy only. Phase 0 Colibri has zero code for GSD (colibri_code: noneacross the entire β axis). The authoritative Phase 0 β state model is the 8-state FSMINIT → GATHER → ANALYZE → PLAN → APPLY → VERIFY → DONE (+ CANCELLED)in../concepts/β-task-pipeline.md, not theGATHER → SYNC → DISPATCH → VERIFY → DONEspec draft at the top of this file. When Colibri’s β engine actually ships, this table should be rebuilt against the then-currentsrc/domains/tasks/tree.
Runtime: Verified against donor AMS Node.js (projects/unified-mcp/src/, deleted R53); not yet ported to Colibri Node.js
Verified against source: 2026-04-06 (donor, pre-R53)
| Claim | Status | Notes |
|---|---|---|
| State machine: GATHER -> SYNC -> DISPATCH -> VERIFY -> DONE -> RETRY | Partial | Autonomous pipeline uses INIT -> GATHER -> ANALYZE -> PLAN -> [DRY_RUN/APPLY] -> VERIFY -> DONE (7 steps in src/controllers/autonomous/intents.js). SYNC and DISPATCH do not exist as named states. GSD workflow engine (src/gsd/engine.js) uses PENDING -> RUNNING -> PAUSED -> COMPLETED -> FAILED -> ROLLED_BACK. Neither matches the spec exactly. |
| GATHER: collect task definition, dependencies, context, memory | Implemented | gatherPhase() in src/controllers/autonomous.js collects project context, git state, roadmap, codebase scan |
| SYNC: validate preconditions, resolve dependency order | Partial | Precondition validation happens inside initPhase() (project existence, auto-register). No dedicated SYNC state. |
| DISPATCH: assign to agent pool, execute phase work | Implemented | src/gsd/agent-pool.js provides full agent pool with lifecycle management, load balancing; src/gsd/task-queue.js handles dispatch with priority queuing |
| VERIFY: run acceptance criteria, tests, lint, generate proofs | Implemented | verifyPhase() in autonomous controller; src/gsd/verifier.js provides goal-backward verification, artifact checking, quality gates |
| DONE: write results, update task status, seal audit trail | Implemented | Autonomous pipeline marks session complete, updates DB status |
| RETRY: classify error, backoff, re-enter | Implemented | src/gsd/task-queue.js classifies errors, retries with exponential backoff (default 3 attempts), re-queues to PENDING |
| Multi-phase workflows (5 ordered phases) | Implemented | src/gsd/engine.js supports ordered phases with dependency graphs; src/gsd/planner.js provides sequential/parallel/DAG/pipeline templates |
| Phase N+1 starts only when phase N completes | Implemented | Sequential dependency pattern enforced; phase dependencies normalized in normalizePhaseDependencies() |
Writeback: task_update with status=done, progress=100 |
Implemented | task_update tool in src/controllers/tasks.js accepts id, status, progress fields |
Writeback: thought_record with task_id, branch, commit SHA |
Partial | thought_record tool in src/controllers/thought.js accepts session_id, thought_type, content – but no explicit task_id, branch, or commit SHA fields in schema; these go in the content string |
| Failure to write back marks task as orphaned | Spec-only | No automatic orphan detection for missing writebacks found in source |
| Exponential backoff, max 3 attempts for transient errors | Implemented | src/gsd/task-queue.js: retry.attempts = 3, backoff = "exponential", delay calculated as delay * 2^(attempts-1) |
| Fallback: simpler execution path or partial completion | Spec-only | No fallback-to-simpler-path logic found; tasks fail after max retries |
| Escalate: mark as blocked, log error, notify parent workflow | Partial | Tasks emit “failed” event with error details; no explicit “blocked” marking or parent workflow notification |
| Agent pool allocation per phase | Implemented | src/gsd/agent-pool.js manages pools with max agents (default 20), health checks (30s interval), agent types (worker/orchestrator/specialist/supervisor) |
| Checkpoint and rollback | Implemented | src/gsd/checkpoint.js provides state snapshots, rollback; autonomous controller uses git-checkpoint for rollback on failure |
| Default timeout 5 minutes | Implemented | src/gsd/engine.js: DEFAULT_TIMEOUT_MS = 5 * 60 * 1000; src/gsd/task-queue.js: default timeout 30s per task |