Six phases when risk requires them. One evidence standard.
TRW scales the workflow from a three-phase minimal fix to a complete research-through-delivery run. Validation is never skipped, and checkpoints keep long work resumable without pretending every client has the same hooks.
illustrative comprehensive run · client-neutral
Unstructured sessions lose decisions, not just tokens
A chat transcript is not a durable execution record. When context compacts or a session changes hands, decisions, evidence, and remaining work can disappear into prose. TRW gives the run explicit phases, checkpoints, and a resume directive that another session can inspect instead of guessing.
On handoff
The next session reconstructs state from prose
Prior work
Decisions are buried in an expiring context window
Gotchas
Re-discovered the hard way each time
On handoff
trw_checkpointStart from an explicit resume directive
Prior work
events.jsonlRecorded events remain inspectable; unrecorded context stays disclosed
Gotchas
trw_session_startTop-N learnings injected before work begins
The lifecycle expands with consequence
MINIMAL work keeps IMPLEMENT, VALIDATE, and DELIVER. STANDARD adds PLAN and REVIEW. COMPREHENSIVE uses all six phases. Phase discipline defaults to warn-and-proceed unless strict mode is configured; the hard machine gates live at delivery.
RESEARCH
Recall prior work, inspect current evidence, and make open questions explicit. Required only for comprehensive work.
Exit
Source and acceptance identified; open questions explicit
PLAN
Define acceptance, change scope, verification method, dependencies, and ownership boundaries.
Exit
Acceptance, scope, verification, and ownership defined
IMPLEMENT
Implement the scoped change with focused checkpoints and update tests or other proof assets where warranted.
Exit
Changes complete or checkpointed; validation assets updated
VALIDATE
Run project-native checks, inspect the outcome, and record the observed result with trw_build_check.
Exit
Applicable project checks pass; build receipt recorded
REVIEW
Inspect the diff against requirements. STANDARD+ needs substantive review; critical blockers prevent delivery.
Exit
Diff inspected against requirements; blockers resolved
DELIVER
Summarize the result, persist progress and learnings, and use one of the three explicit delivery paths.
Exit
Result summarized; artifacts and learnings preserved
RESEARCH
01/06Recall prior work, inspect current evidence, and make open questions explicit. Required only for comprehensive work.
Exit
Source and acceptance identified; open questions explicit
PLAN
02/06Define acceptance, change scope, verification method, dependencies, and ownership boundaries.
Exit
Acceptance, scope, verification, and ownership defined
IMPLEMENT
03/06Implement the scoped change with focused checkpoints and update tests or other proof assets where warranted.
Exit
Changes complete or checkpointed; validation assets updated
VALIDATE
04/06Run project-native checks, inspect the outcome, and record the observed result with trw_build_check.
Exit
Applicable project checks pass; build receipt recorded
REVIEW
05/06Inspect the diff against requirements. STANDARD+ needs substantive review; critical blockers prevent delivery.
Exit
Diff inspected against requirements; blockers resolved
DELIVER
06/06Summarize the result, persist progress and learnings, and use one of the three explicit delivery paths.
Exit
Result summarized; artifacts and learnings preserved
The context-compaction problem
Long sessions can outgrow their context window. TRW provides trw_pre_compact_checkpoint to persist a recovery directive before compaction. A supported client may add a pre-compact hook, but hooks are adapters—not the recovery contract. The saved recovery record includes { run_path, phase, events_logged, last_checkpoint }. On restart, trw_session_start surfaces that directive so the agent can apply it against the current repository state.
- Context fills → agent compacts → state evicted
- On restart: no memory of the active phase
- Agent re-discovers already-solved problems
- Work done may be repeated or silently lost
- pre-compact adapter can request a checkpoint when the client exposes the event
- Writes the current phase, checkpoint, recent events, and recovery directive to local state
- trw_session_start surfaces the saved directive for the agent to reconcile
- Append-only events preserve the recorded trail; unrecorded context is not recoverable (delegates can use their own checkpoints too)
Durable checkpoints with an explicit next action
trw_checkpoint() persists an explicit milestone message against the active run. Append-only events keep the recorded trail inspectable. Recovery is only as good as the checkpoint: decisions left solely in chat are not magically reconstructed.
RESUME CONTRACT // EXAMPLE
- ACTIVE PHASE
- IMPLEMENT — pricing mobile decision path
- OBSERVED EVIDENCE
- Focused tests pass; full browser suite pending
- NEXT ACTION
- Run desktop/mobile comparison, then independent review
- DO NOT REPEAT
- Navigation root cause already fixed and committed
Resume by reconciling this directive with the current worktree—not by replaying the old conversation.
Common questions
Can I skip phases?
What exactly gets checkpointed?
Does this work offline?
How long does a full phase cycle take?
What happens if VALIDATE fails?
How is DELIVER different from a checkpoint?
Give the next task the ceremony its risk deserves
Keep the evidence obligations. Shed optional ceremony when the work does not need it.