Skip to content

Runtime Contract

Nick edited this page Jun 20, 2026 · 2 revisions

Runtime Contract

CW turns a broad task into durable workflow state.

The CW pipeline: ask, plan, dispatch (fanning out to parallel agents), verify, commit, ending in a saved report.md with a clickable file.ts:42 citation

workflow definition
-> input validation
-> task generation
-> dispatch manifests
-> worker result recording
-> evidence-backed verification
-> verifier-gated commit or explicit checkpoint
-> final report

Run State

Run data lives under:

.cw/runs/<run-id>/

Important files and directories include:

  • state.json
  • tasks/
  • dispatches/
  • results/
  • workers/
  • feedback/
  • candidates/
  • commits/
  • multi-agent/
  • blackboard/
  • topologies/
  • report.md

State Nodes

CW uses state nodes to make important runtime objects explicit. Current state node kinds include run and task records, worker records, feedback, candidates, commits, multi-agent records, blackboard records, coordinator decisions, and topology runs.

The point is not a fancy data model. The point is evidence:

  • What happened?
  • Which artifact proves it?
  • Which verifier accepted it?
  • Which commit made it durable?
  • Which report cites it?

Error Feedback

Failures enter the workflow instead of disappearing into stderr:

error output -> feedback record -> correction evidence -> retry or halt

Feedback is classified, persisted, and surfaced in operator summaries. This makes failed verifier/test/linter/worker paths part of the run history.

Worker Isolation And Candidates

Workers create results and candidate outputs. Candidates can be scored, ranked, selected, rejected, and finally committed only after verifier evidence supports them.

This lets CW preserve alternative outputs without letting unverified work silently become the final answer.

Commit Contract

Verifier-gated commits require evidence. Manual non-gated saves are explicit checkpoints, not verified commits.

Common commands:

node scripts/cw.js candidate register <run-id> --worker <worker-id>
node scripts/cw.js candidate score <run-id> <candidate-id> --criterion evidence=4
node scripts/cw.js candidate select <run-id> <candidate-id> --reason "verified winner"
node scripts/cw.js commit <run-id> --selection <selection-id> --reason "verified winner"
node scripts/cw.js commit <run-id> --allow-unverified-checkpoint --reason "manual checkpoint"

Clone this wiki locally