Epic Lifecycle
Every epic in OSTwin is driven by two fundamental roles: the Worker and the Evaluator. Their interaction forms a closed loop that ensures quality β the Worker produces, the Evaluator inspects, and the cycle repeats until the work passes or the system escalates. This page explains how those roles interact through the lifecycle states and what happens when the loop canβt close on its own.
The Workshop Analogy
Think of an OSTwin epic as a craft workshop:
-
The Worker is the artisan at the bench β shaping, assembling, and building the deliverable. In different epics the Worker might be an engineer writing code, a researcher gathering findings, or a writer drafting documentation. The role changes, but the function is the same: produce.
-
The Evaluator is the master inspector β examining the work against acceptance criteria, finding defects, and deciding whether itβs ready to ship. In different epics the Evaluator might be a QA tester, a security auditor, or an architect reviewing design. The role changes, but the function is the same: verify.
In a real workshop, the artisan doesnβt self-certify their own work. They hand it to the inspector, who either stamps it passed or sends it back with a list of defects. If the artisan canβt fix the defects after several attempts, the workshop master steps in for triage β deciding whether to provide guidance, restructure the work, or scrap it entirely.
OSTwin follows exactly this pattern. The lifecycle is the protocol that governs every handoff between Worker and Evaluator.
Core State Flow
The essential loop every epic follows:
Worker Evaluator Outcomeββββββββββββ ββββββββββββ ββββββββββββββββββdevelopingβββββΊβ review βββββΊβ passed β β Ship itβ β β βββββΊβ failed ββββΊ back to developingβ β β β β failed-finalββββΊ triageββββββββββββ ββββββββββββ βββββββββββββββββExpanding this into the full state diagram:
βββββββββββββββ β planning β ββββββββ¬βββββββ β ββββββββΌβββββββ β planned β ββββββββ¬βββββββ β ββββββββΌβββββββ β ready β ββββββββ¬βββββββ β ββββββββΌβββββββ βββββββ developing βββββββββββββββ β ββββββββ¬βββββββ β β β β β ββββββββΌβββββββ β β β review β β β ββββββββ¬βββββββ β β β β β βββββββ΄ββββββ β β β β β β ββββββΌββββ ββββββΌβββββ β β β passed β β failed βββββββββββββ β ββββββββββ ββββββ¬βββββ (retry) β β β ββββββββΌβββββββ β βfixing ββββΊ review β βββββββββββββββ β β ββββββββββββββββ ββββββΊβ blocked β ββββββββ¬ββββββββ β ββββββββΌβββββββ βfailed-final β βββββββββββββββStates and the Roles That Own Them
Each lifecycle state belongs to either the Worker or the Evaluator. Understanding who owns what makes the flow intuitive:
Worker-Owned States
| State | Who | Description |
|---|---|---|
developing | Worker | The Worker is actively building β writing code, running tests, producing artifacts |
fixing | Worker | The Worker is addressing specific feedback from the Evaluatorβs review |
Evaluator-Owned States
| State | Who | Description |
|---|---|---|
review | Evaluator | The Evaluator is inspecting the Workerβs deliverables against acceptance criteria |
System-Owned States
| State | Terminal | Description |
|---|---|---|
planning | No | Epic is being decomposed into tasks by the manager |
planned | No | Tasks are defined, waiting for dependency gates to clear |
ready | No | All dependencies satisfied, room can be created |
passed | Yes | Evaluator approved β all acceptance criteria met, work is done |
failed | No | Evaluator rejected β specific issues documented, retry is possible |
failed-final | Yes | Max retries exhausted β the Worker-Evaluator loop cannot close |
blocked | No | Waiting on external dependency or human input |
timeout | No | Execution exceeded the configured time limit |
escalated | No | Sent to architect for design review |
redesign | No | Architect determined a design change is needed |
cancelled | Yes | Manually cancelled by the manager or user |
The Worker-Evaluator Handoff
The core cycle is a handoff protocol between two roles:
developing β review
The Worker finishes a task and posts a done message. This triggers the transition to review, where control passes from Worker to Evaluator. The Worker cannot self-approve β the handoff is mandatory.
{"type":"done","from":"worker"} β developing β reviewreview β passed or failed
The Evaluator examines the deliverables against the Definition of Done and Acceptance Criteria:
{"type":"pass","from":"evaluator"} β review β passed{"type":"fail","from":"evaluator"} β review β failedIf the Evaluator passes the work, the epic reaches its terminal state. If the Evaluator fails it, the loop continues:
failed β fixing β review
The Worker receives the Evaluatorβs feedback and enters fixing. Once fixes are complete, the Worker hands off to the Evaluator again:
failed β fixing β review β passed? or β failed again?Each failure counts toward the retry limit. When retries are exhausted, the system enters triage.
Triage: When the Loop Canβt Close
In the workshop analogy, triage is what happens when the artisan has tried three times and the inspector still wonβt sign off. The workshop master steps in.
Attempt 1: develop β review β FAILAttempt 2: fix β review β FAILAttempt 3: fix β review β FAIL β βΌfailed-final β manager notified β triage β βββΊ FIX verdict: architect provides guidance, retry allowed βββΊ REDESIGN verdict: epic restructured, loop restarts βββΊ REPLAN verdict: plan modified, DAG rebuiltAfter triage, the manager receives one of three verdicts:
- FIX β the implementation approach is sound, the Worker just needs specific guidance. The loop restarts with a clearer direction.
- REDESIGN β the epicβs architecture needs changes before the Worker can succeed. The epic is restructured and the loop restarts from
developing. - REPLAN β the epic itself is flawed (too large, wrong scope, missing dependency). The plan is modified and the DAG is rebuilt.
Retry Parameters
| Parameter | Default | Description |
|---|---|---|
max_retries | 3 | Maximum Evaluator rejection cycles before triage |
timeout_seconds | 900 | Max time per Worker attempt (15 minutes) |
retry_delay_seconds | 0 | Delay between retry attempts |
Transition Mechanisms
State transitions are triggered by four mechanisms:
1. Agent Messages (Worker β Evaluator Handoff)
The most common trigger. The Workerβs done message hands control to the Evaluator. The Evaluatorβs pass or fail message determines the outcome.
{"type":"done","from":"worker"} β developing β review{"type":"pass","from":"evaluator"} β review β passed{"type":"fail","from":"evaluator"} β review β failed2. Manager Orchestration
The manager controls transitions that require cross-room awareness:
planningβplanned(after task decomposition)plannedβready(after dependency check)failedβdeveloping(after retry decision)failedβfailed-final(after max retries β triggers triage)
3. Timeout Enforcement
The system monitors execution time and forces transitions when limits are exceeded:
developingfor >timeout_secondsβtimeouttimeoutβescalated(automatic)
4. Manual Override
Users can force state transitions through the dashboard or CLI.
lifecycle.json Format
Each war-room contains a lifecycle.json that defines its state machine:
{ "states": [ "planning", "planned", "ready", "developing", "review", "fixing", "passed", "failed", "failed-final", "blocked", "timeout", "escalated", "redesign", "cancelled" ], "initial": "planning", "terminal": ["passed", "failed-final", "cancelled"], "transitions": { "planning": ["planned", "cancelled"], "planned": ["ready", "blocked", "cancelled"], "ready": ["developing", "blocked", "cancelled"], "developing": ["review", "blocked", "timeout", "cancelled"], "review": ["passed", "failed", "blocked", "cancelled"], "failed": ["fixing", "failed-final", "escalated"], "fixing": ["review", "blocked", "timeout"], "timeout": ["escalated", "developing", "cancelled"], "escalated": ["redesign", "developing", "failed-final"], "redesign": ["developing", "cancelled"], "blocked": ["developing", "cancelled"] }, "manager_only": ["passed", "failed-final", "cancelled"]}Timeout Enforcement
The system tracks elapsed time for each non-terminal state:
Room entered "developing" at 2025-01-15T10:00:00ZTimeout configured: 900 secondsCurrent time: 2025-01-15T10:16:00ZElapsed: 960 seconds β TIMEOUT triggeredWhen a timeout fires:
- Room status transitions to
timeout - The manager is notified via the channel
- The manager decides whether to retry, escalate, or cancel
- If no action is taken within 300 seconds, auto-escalation occurs
Audit Trail
Every state transition is logged to lifecycle-audit.jsonl in the war-room:
{"ts":"2025-01-15T10:00:00Z","from":"planning","to":"planned","actor":"manager","reason":"Tasks decomposed"}{"ts":"2025-01-15T10:00:05Z","from":"planned","to":"ready","actor":"system","reason":"Dependencies satisfied"}{"ts":"2025-01-15T10:00:10Z","from":"ready","to":"developing","actor":"manager","reason":"Worker assigned"}{"ts":"2025-01-15T10:15:00Z","from":"developing","to":"review","actor":"worker","reason":"TASK-001 done"}{"ts":"2025-01-15T10:20:00Z","from":"review","to":"failed","actor":"evaluator","reason":"Test coverage 72%, required 95%"}{"ts":"2025-01-15T10:20:05Z","from":"failed","to":"fixing","actor":"manager","reason":"Retry 1/3"}This creates a complete, timestamped record of every lifecycle event for debugging and compliance.
Progress Tracking
Agents report progress through two complementary mechanisms:
progress.json
Machine-readable progress updated by agents via the report_progress MCP tool:
{ "percent": 65, "message": "Implementing TASK-003 of 5. Tests passing for TASK-001 and TASK-002.", "updated_at": "2025-01-15T10:12:00Z"}The percent field is clamped to 0β100 and drives the dashboard progress bars.
PROGRESS.md
Human-readable progress notes maintained by the Worker:
## Progress
- [x] TASK-001: Login endpoint (done, tests passing)- [x] TASK-002: Token validation (done, tests passing)- [ ] TASK-003: Rate limiting (in progress)- [ ] TASK-004: Integration tests- [ ] TASK-005: OpenAPI docsLifecycle Customization
The lifecycle can be customized per plan or per epic using the create-lifecycle skill. This skill generates specialized lifecycles for different epic types β for example, a βdocumentationβ lifecycle might skip the QA review step entirely, while a βsecurityβ epic might add an additional security-review stage between developing and review.
Custom lifecycles can also be configured using the Pipeline directive in PLAN.md, which inserts additional review stages with their own correction loops:
Pipeline: architect -> engineer -> security-review -> qaEach stage containing βreviewβ, βqaβ, βauditβ, βcheckβ, or βverifyβ gets pass/fail/escalate transitions with correction loops back through fixing.
Key Files
| File | Purpose |
|---|---|
.agents/war-rooms/*/lifecycle.json | Per-room state machine definition |
.agents/war-rooms/*/status.txt | Current state |
.agents/war-rooms/*/progress.json | Completion tracking |
.agents/mcp/warroom-server.py | Status and progress MCP tools |