cool-workflow 0.1.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/.claude-plugin/plugin.json +20 -0
  2. package/.codex-plugin/mcp.json +10 -0
  3. package/.codex-plugin/plugin.json +38 -0
  4. package/.mcp.json +10 -0
  5. package/LICENSE +24 -0
  6. package/README.md +638 -0
  7. package/apps/architecture-review/app.json +51 -0
  8. package/apps/architecture-review/workflow.js +116 -0
  9. package/apps/end-to-end-golden-path/app.json +30 -0
  10. package/apps/end-to-end-golden-path/workflow.js +33 -0
  11. package/apps/pr-review-fix-ci/app.json +59 -0
  12. package/apps/pr-review-fix-ci/workflow.js +90 -0
  13. package/apps/release-cut/app.json +54 -0
  14. package/apps/release-cut/workflow.js +82 -0
  15. package/apps/research-synthesis/app.json +50 -0
  16. package/apps/research-synthesis/workflow.js +76 -0
  17. package/apps/workflow-app-framework-demo/app.json +29 -0
  18. package/apps/workflow-app-framework-demo/workflow.js +44 -0
  19. package/dist/agent-config.js +223 -0
  20. package/dist/candidate-scoring.js +715 -0
  21. package/dist/capability-core.js +630 -0
  22. package/dist/capability-dispatcher.js +86 -0
  23. package/dist/capability-registry.js +523 -0
  24. package/dist/cli.js +1276 -0
  25. package/dist/collaboration.js +727 -0
  26. package/dist/commit.js +570 -0
  27. package/dist/contract-migration.js +234 -0
  28. package/dist/coordinator.js +1163 -0
  29. package/dist/daemon.js +44 -0
  30. package/dist/dispatch.js +201 -0
  31. package/dist/drive.js +503 -0
  32. package/dist/error-feedback.js +415 -0
  33. package/dist/evidence-grounding.js +179 -0
  34. package/dist/evidence-reasoning.js +733 -0
  35. package/dist/execution-backend.js +1279 -0
  36. package/dist/harness.js +61 -0
  37. package/dist/mcp-server.js +1615 -0
  38. package/dist/multi-agent-eval.js +857 -0
  39. package/dist/multi-agent-host.js +764 -0
  40. package/dist/multi-agent-operator-ux.js +537 -0
  41. package/dist/multi-agent-trust.js +366 -0
  42. package/dist/multi-agent.js +1173 -0
  43. package/dist/node-snapshot.js +270 -0
  44. package/dist/observability.js +922 -0
  45. package/dist/operator-ux.js +971 -0
  46. package/dist/orchestrator/audit-operations.js +182 -0
  47. package/dist/orchestrator/candidate-operations.js +117 -0
  48. package/dist/orchestrator/cli-options.js +288 -0
  49. package/dist/orchestrator/collaboration-operations.js +86 -0
  50. package/dist/orchestrator/feedback-operations.js +81 -0
  51. package/dist/orchestrator/host-operations.js +78 -0
  52. package/dist/orchestrator/lifecycle-operations.js +462 -0
  53. package/dist/orchestrator/migration-operations.js +44 -0
  54. package/dist/orchestrator/multi-agent-operations.js +362 -0
  55. package/dist/orchestrator/report.js +369 -0
  56. package/dist/orchestrator/topology-operations.js +84 -0
  57. package/dist/orchestrator.js +874 -0
  58. package/dist/pipeline-contract.js +92 -0
  59. package/dist/pipeline-runner.js +285 -0
  60. package/dist/reclamation.js +882 -0
  61. package/dist/result-normalize.js +194 -0
  62. package/dist/run-export.js +64 -0
  63. package/dist/run-registry.js +1347 -0
  64. package/dist/run-state-schema.js +67 -0
  65. package/dist/sandbox-profile.js +471 -0
  66. package/dist/scheduler.js +266 -0
  67. package/dist/scheduling.js +184 -0
  68. package/dist/schema-validate.js +98 -0
  69. package/dist/state-explosion.js +1213 -0
  70. package/dist/state-migrations.js +463 -0
  71. package/dist/state-node.js +301 -0
  72. package/dist/state.js +308 -0
  73. package/dist/telemetry-attestation.js +156 -0
  74. package/dist/telemetry-ledger.js +145 -0
  75. package/dist/topology.js +527 -0
  76. package/dist/triggers.js +159 -0
  77. package/dist/trust-audit.js +475 -0
  78. package/dist/types/blackboard.js +2 -0
  79. package/dist/types/boundary.js +29 -0
  80. package/dist/types/candidate.js +2 -0
  81. package/dist/types/collaboration.js +2 -0
  82. package/dist/types/core.js +2 -0
  83. package/dist/types/drive.js +10 -0
  84. package/dist/types/error-feedback.js +2 -0
  85. package/dist/types/evidence-reasoning.js +2 -0
  86. package/dist/types/execution-backend.js +2 -0
  87. package/dist/types/multi-agent.js +2 -0
  88. package/dist/types/observability.js +2 -0
  89. package/dist/types/pipeline.js +2 -0
  90. package/dist/types/reclamation.js +8 -0
  91. package/dist/types/result.js +2 -0
  92. package/dist/types/run-registry.js +2 -0
  93. package/dist/types/run.js +2 -0
  94. package/dist/types/sandbox.js +2 -0
  95. package/dist/types/schedule.js +2 -0
  96. package/dist/types/state-node.js +2 -0
  97. package/dist/types/topology.js +2 -0
  98. package/dist/types/trust.js +2 -0
  99. package/dist/types/workbench.js +2 -0
  100. package/dist/types/worker.js +2 -0
  101. package/dist/types/workflow-app.js +2 -0
  102. package/dist/types.js +43 -0
  103. package/dist/verifier-registry.js +46 -0
  104. package/dist/verifier.js +78 -0
  105. package/dist/version.js +8 -0
  106. package/dist/workbench-host.js +172 -0
  107. package/dist/workbench.js +190 -0
  108. package/dist/worker-isolation.js +1028 -0
  109. package/dist/workflow-api.js +98 -0
  110. package/dist/workflow-app-framework.js +626 -0
  111. package/docs/agent-delegation-drive.7.md +190 -0
  112. package/docs/agent-framework.md +176 -0
  113. package/docs/candidate-scoring.7.md +106 -0
  114. package/docs/canonical-workflow-apps.7.md +137 -0
  115. package/docs/capability-topology-registry.7.md +168 -0
  116. package/docs/cli-mcp-parity.7.md +373 -0
  117. package/docs/contract-migration-tooling.7.md +123 -0
  118. package/docs/control-plane-scheduling.7.md +110 -0
  119. package/docs/coordinator-blackboard.7.md +183 -0
  120. package/docs/dogfood/architecture-review-cool-workflow.md +16 -0
  121. package/docs/dogfood-one-real-repo.7.md +168 -0
  122. package/docs/durable-state-and-locking.7.md +107 -0
  123. package/docs/end-to-end-golden-path.7.md +117 -0
  124. package/docs/error-feedback.7.md +153 -0
  125. package/docs/evidence-adoption-reasoning-chain.7.md +270 -0
  126. package/docs/execution-backends.7.md +300 -0
  127. package/docs/getting-started.md +99 -0
  128. package/docs/index.md +41 -0
  129. package/docs/mcp-app-surface.7.md +235 -0
  130. package/docs/multi-agent-cli-mcp-surface.7.md +265 -0
  131. package/docs/multi-agent-eval-replay-harness.7.md +302 -0
  132. package/docs/multi-agent-operator-ux.7.md +314 -0
  133. package/docs/multi-agent-runtime-core.7.md +231 -0
  134. package/docs/multi-agent-topologies.7.md +103 -0
  135. package/docs/multi-agent-trust-policy-audit.7.md +154 -0
  136. package/docs/node-snapshot-diff-replay.7.md +135 -0
  137. package/docs/observability-cost-accounting.7.md +194 -0
  138. package/docs/operator-ux.7.md +180 -0
  139. package/docs/pipeline-runner.7.md +136 -0
  140. package/docs/project-index.md +261 -0
  141. package/docs/real-execution-backends.7.md +142 -0
  142. package/docs/release-and-migration.7.md +280 -0
  143. package/docs/release-tooling.7.md +159 -0
  144. package/docs/routines.md +48 -0
  145. package/docs/run-registry-control-plane.7.md +312 -0
  146. package/docs/run-retention-reclamation.7.md +191 -0
  147. package/docs/sandbox-profiles.7.md +137 -0
  148. package/docs/scheduled-tasks.md +80 -0
  149. package/docs/security-trust-hardening.7.md +117 -0
  150. package/docs/state-explosion-management.7.md +264 -0
  151. package/docs/state-node.7.md +96 -0
  152. package/docs/team-collaboration.7.md +207 -0
  153. package/docs/unix-principles.md +192 -0
  154. package/docs/verifier-gated-commit.7.md +140 -0
  155. package/docs/web-desktop-workbench.7.md +215 -0
  156. package/docs/worker-isolation.7.md +167 -0
  157. package/docs/workflow-app-framework.7.md +274 -0
  158. package/manifest/README.md +43 -0
  159. package/manifest/plugin.manifest.json +316 -0
  160. package/manifest/pricing.policy.json +14 -0
  161. package/package.json +79 -0
  162. package/scripts/agents/claude-p-agent.js +104 -0
  163. package/scripts/agents/claude-p-agent.sh +9 -0
  164. package/scripts/agents/cw-attest-keygen.js +55 -0
  165. package/scripts/agents/cw-attest-wrap.js +143 -0
  166. package/scripts/block-unapproved-tag.sh +39 -0
  167. package/scripts/bump-version.js +249 -0
  168. package/scripts/canonical-apps.js +171 -0
  169. package/scripts/cw.js +4 -0
  170. package/scripts/dist-drift-check.js +79 -0
  171. package/scripts/dogfood-architecture-review.js +237 -0
  172. package/scripts/dogfood-release.js +624 -0
  173. package/scripts/forward-ref-docs.js +73 -0
  174. package/scripts/gen-manifests.js +232 -0
  175. package/scripts/golden-path.js +300 -0
  176. package/scripts/mcp-server.js +4 -0
  177. package/scripts/new-feature.js +121 -0
  178. package/scripts/parity-check.js +213 -0
  179. package/scripts/release-check.js +118 -0
  180. package/scripts/release-flow.js +272 -0
  181. package/scripts/release-gate.sh +85 -0
  182. package/scripts/sync-project-index.js +387 -0
  183. package/scripts/validate-run-state-schema.js +126 -0
  184. package/scripts/verify-container-selfref.js +64 -0
  185. package/scripts/version-sync-check.js +237 -0
  186. package/skills/cool-workflow/SKILL.md +162 -0
  187. package/skills/cool-workflow/references/commands.md +282 -0
  188. package/tsconfig.json +16 -0
  189. package/ui/workbench/app.css +76 -0
  190. package/ui/workbench/app.js +159 -0
  191. package/ui/workbench/index.html +32 -0
  192. package/workflows/architecture-review.workflow.js +84 -0
  193. package/workflows/research-synthesis.workflow.js +47 -0
@@ -0,0 +1,80 @@
1
+ # Scheduled Tasks
2
+
3
+ CW scheduled tasks support looping prompts, cron-like schedules, one-shot
4
+ reminders, expiration, jitter, and explicit completion.
5
+
6
+ CW stores schedules in:
7
+
8
+ ```text
9
+ .cw/schedules/tasks.json
10
+ ```
11
+
12
+ ## Commands
13
+
14
+ Create a `/loop`-compatible schedule:
15
+
16
+ ```bash
17
+ node scripts/cw.js loop \
18
+ --intervalMinutes 30 \
19
+ --prompt "Check this workflow and continue if work is due."
20
+ ```
21
+
22
+ Create a loop:
23
+
24
+ ```bash
25
+ node scripts/cw.js schedule create \
26
+ --kind loop \
27
+ --intervalMinutes 30 \
28
+ --prompt "Check this workflow and continue if work is due."
29
+ ```
30
+
31
+ Create a cron schedule:
32
+
33
+ ```bash
34
+ node scripts/cw.js schedule create \
35
+ --kind cron \
36
+ --cron "*/15 * * * *" \
37
+ --prompt "Run the due workflow scan."
38
+ ```
39
+
40
+ Create a reminder:
41
+
42
+ ```bash
43
+ node scripts/cw.js schedule create \
44
+ --kind reminder \
45
+ --delayMinutes 60 \
46
+ --prompt "Remind me to inspect the report."
47
+ ```
48
+
49
+ List and scan:
50
+
51
+ ```bash
52
+ node scripts/cw.js schedule list
53
+ node scripts/cw.js schedule due
54
+ node scripts/cw.js schedule complete <schedule-id>
55
+ node scripts/cw.js schedule pause <schedule-id>
56
+ node scripts/cw.js schedule resume <schedule-id>
57
+ node scripts/cw.js schedule run-now <schedule-id>
58
+ node scripts/cw.js schedule history <schedule-id>
59
+ node scripts/cw.js schedule delete <schedule-id>
60
+ ```
61
+
62
+ Run the local desktop-style daemon once:
63
+
64
+ ```bash
65
+ node scripts/cw.js schedule daemon --once
66
+ ```
67
+
68
+ Run it continuously:
69
+
70
+ ```bash
71
+ node scripts/cw.js schedule daemon --intervalSeconds 60
72
+ ```
73
+
74
+ ## Notes
75
+
76
+ - Resolution is minute-level.
77
+ - Default expiration is 7 days.
78
+ - `jitterSeconds` can spread runs.
79
+ - CW does not start the daemon by default. Use `schedule daemon`, cron, or
80
+ another supervisor to call `schedule due` and execute due prompts.
@@ -0,0 +1,117 @@
1
+ # Security / Trust Hardening
2
+
3
+ CW v0.1.15 adds a local trust audit layer for worker sandbox decisions,
4
+ evidence provenance, candidate selection, and verifier-gated commits.
5
+ CW v0.1.22 reuses this same layer for multi-agent role policy, blackboard
6
+ write audit, message provenance, judge rationale, panel decisions, and policy
7
+ violations.
8
+
9
+ ## Audit Records
10
+
11
+ Every run has an audit directory:
12
+
13
+ ```text
14
+ .cw/runs/<run-id>/audit/
15
+ events.jsonl
16
+ index.json
17
+ summary.json
18
+ ```
19
+
20
+ `events.jsonl` is append-friendly. `index.json` and `summary.json` are
21
+ deterministic inspection files regenerated by CW commands.
22
+
23
+ Each event records:
24
+
25
+ - schema version, event id, timestamp, run id, kind, decision, and source
26
+ - actor, worker id, task id, node id, candidate id, score id, selection id, or commit id when relevant
27
+ - sandbox profile id and policy snapshot/reference
28
+ - normalized path, command, network target, or env variable names when relevant
29
+ - evidence references and parent audit event ids
30
+ - feedback ids for denied or failed decisions
31
+
32
+ Event sources are explicit:
33
+
34
+ - `cw-validated`: CW checked a policy or gate locally.
35
+ - `host-attested`: the agent host or operator recorded what the host enforced.
36
+ - `operator-recorded`: a human or caller supplied the record.
37
+ - `runtime-derived`: CW derived the event from run state.
38
+
39
+ CW does not store secrets or raw environment values. Environment audit records
40
+ store names only.
41
+
42
+ ## Enforcement Boundary
43
+
44
+ CW validates sandbox profiles, normalizes paths, validates worker output
45
+ acceptance, validates command/network/env decisions when asked, and records
46
+ durable feedback for denied worker decisions.
47
+
48
+ The agent host must still enforce OS-level read isolation, write isolation,
49
+ process execution restrictions, network restrictions, and environment filtering.
50
+ The audit layer makes that boundary inspectable; it is not a kernel.
51
+
52
+ ## CLI
53
+
54
+ ```bash
55
+ node scripts/cw.js audit summary <run-id>
56
+ node scripts/cw.js audit worker <run-id> <worker-id>
57
+ node scripts/cw.js audit provenance <run-id> [--worker ID|--candidate ID|--commit ID]
58
+ node scripts/cw.js audit multi-agent <run-id>
59
+ node scripts/cw.js audit policy <run-id>
60
+ node scripts/cw.js audit role <run-id> <role-id>
61
+ node scripts/cw.js audit blackboard <run-id>
62
+ node scripts/cw.js audit judge <run-id>
63
+ node scripts/cw.js audit attest <run-id> --worker <worker-id> --hostEnforced true
64
+ node scripts/cw.js audit decision <run-id> <worker-id> --path <path>
65
+ node scripts/cw.js audit decision <run-id> <worker-id> --command "npm test"
66
+ node scripts/cw.js audit decision <run-id> <worker-id> --network example.com
67
+ node scripts/cw.js audit decision <run-id> <worker-id> --env SECRET_NAME
68
+ ```
69
+
70
+ Denied audit decisions are written to audit files and linked to feedback/error
71
+ records. Environment values are redacted to names.
72
+
73
+ ## Evidence Provenance
74
+
75
+ `StateEvidence` remains backward compatible. v0.1.15 adds optional
76
+ `provenance` metadata that can point from:
77
+
78
+ ```text
79
+ worker result -> result node -> verifier node -> candidate -> score -> selection -> commit
80
+ ```
81
+
82
+ Candidate scores, selections, and verifier-gated commits preserve provenance
83
+ links instead of only copying evidence arrays.
84
+
85
+ ## Why Accepted
86
+
87
+ Selected candidates and verifier-gated commits carry an acceptance rationale:
88
+
89
+ - selected candidate id
90
+ - score id and score criteria
91
+ - verifier node id
92
+ - evidence count
93
+ - sandbox profile id
94
+ - worker id
95
+ - commit gate result
96
+ - audit event ids
97
+
98
+ Verifier-gated commits fail closed when the acceptance rationale cannot explain
99
+ the evidence chain.
100
+
101
+ ## MCP
102
+
103
+ The MCP server exposes matching tools:
104
+
105
+ - `cw_audit_summary`
106
+ - `cw_audit_worker`
107
+ - `cw_audit_provenance`
108
+ - `cw_audit_multi_agent`
109
+ - `cw_audit_policy`
110
+ - `cw_audit_role`
111
+ - `cw_audit_blackboard`
112
+ - `cw_audit_judge`
113
+ - `cw_audit_attest`
114
+ - `cw_audit_decision`
115
+
116
+ Existing MCP tool names remain stable.
117
+ 0.1.51
@@ -0,0 +1,264 @@
1
+ # State Explosion Management
2
+
3
+ CW v0.1.25 adds State Explosion Management. As multi-agent collaboration grows,
4
+ blackboard and graph output can become too large to read. This release adds a
5
+ first-class summarization and compaction layer that makes complex runs
6
+ understandable without hiding source truth.
7
+
8
+ CW v0.1.26 builds on this layer with the Evidence Adoption Reasoning Chain, which
9
+ reuses the same derived, fingerprinted, fail-closed discipline and whose
10
+ reasoning steps are exempt from the compaction described here. See
11
+ [evidence-adoption-reasoning-chain.7.md](evidence-adoption-reasoning-chain.7.md).
12
+
13
+ The design follows a base-system observability philosophy:
14
+
15
+ - raw state is the source of truth
16
+ - summaries are derived userland indexes, never replacements for source records
17
+ - plain files, stable JSON, deterministic output
18
+ - small composable commands and readable console views with full
19
+ machine-readable output available
20
+ - fail closed when a summary is stale, incomplete, ambiguous, or loses
21
+ provenance
22
+ - backward compatible; no hidden daemon; no lossy deletion of blackboard,
23
+ graph, audit, or evidence records
24
+
25
+ ## Derived summary model
26
+
27
+ Summary records are durable, versioned, and provenance-backed. Each carries
28
+ `schemaVersion`, `runId`, a summary `id`, a `scope`
29
+ (`run`, `topology`, `multi-agent-run`, `group`, `role`, `membership`, `fanout`,
30
+ `fanin`, `blackboard`, `topic`, `evidence`, `trust`, or `eval`),
31
+ `sourceRecordIds`, a deterministic `sourceFingerprint`, `includedCount` and
32
+ `omittedCount`, `importantRefs`, `evidenceRefs`, `trustAuditEventRefs`,
33
+ `generatedAt`, a `status` (`valid`, `stale`, or `absent`), a `deterministic`
34
+ flag, and a `nextAction`.
35
+
36
+ Record types:
37
+
38
+ - `MultiAgentSummaryIndex` - the index of all summary records for a run
39
+ - `BlackboardSummaryRecord` - the deterministic blackboard digest
40
+ - `GraphSummaryRecord` - a compact or focused graph view
41
+ - `OperatorDigest` - the combined operator-facing digest
42
+ - `StateExplosionReport` - the top-level report with all panels and freshness
43
+
44
+ Summaries are written under `.cw/runs/<run-id>/summaries/` as plain JSON. Raw
45
+ blackboard messages, graph nodes, graph edges, audit events, evidence refs, and
46
+ eval artifacts are never deleted or overwritten.
47
+
48
+ ## Blackboard summarization
49
+
50
+ `blackboard summarize <run-id>` (MCP: `cw_blackboard_summarize`) returns a
51
+ deterministic structural digest with topic rollups, message thread summaries,
52
+ unresolved questions, conflicts, decisions, artifacts, adopted evidence,
53
+ missing evidence, policy violations, judge rationale, recent changes, and
54
+ high-signal records. Every entry preserves links back to source messages,
55
+ contexts, artifacts, snapshots, coordinator decisions, and audit events, plus an
56
+ expansion command for the raw records. Structural summaries exist without any
57
+ LLM output; any semantic summary must be explicit, provenance-backed, and
58
+ evidence-linked.
59
+
60
+ ## Graph compaction
61
+
62
+ `multi-agent graph <run-id> --view <view>` produces compact graph views.
63
+ Supported views: `full`, `compact`, `critical-path`, `failures`, `evidence`,
64
+ `trust`, `topology`, `blackboard`, `candidate`, and `commit-gate`. Use
65
+ `--focus <id>` and `--depth <n>` to center the view on a node and its
66
+ neighborhood.
67
+
68
+ Compact views collapse high-volume groups, topics, fanouts, fanins, message
69
+ clusters, and evidence chains into synthetic summary nodes. Each synthetic node
70
+ exposes `collapsedNodeCount`, `collapsedEdgeCount`, `sourceIds`,
71
+ `dominantStatus`, an optional `blockedReason`, and an `expansionCommand`.
72
+
73
+ The critical path is always preserved, and failures, blocked records,
74
+ conflicts, missing evidence, policy violations, and judge rationale are never
75
+ collapsed.
76
+
77
+ ## CLI
78
+
79
+ ```text
80
+ node scripts/cw.js summary refresh <run-id> [--json] [--view <view> ...]
81
+ node scripts/cw.js summary show <run-id> [--json]
82
+ node scripts/cw.js blackboard summarize <run-id> [--json]
83
+ node scripts/cw.js multi-agent summarize <run-id> [--json]
84
+ node scripts/cw.js multi-agent graph <run-id> --view compact [--json]
85
+ node scripts/cw.js multi-agent graph <run-id> --view critical-path [--json]
86
+ node scripts/cw.js multi-agent graph <run-id> --focus <id> --depth <n> [--json]
87
+ node scripts/cw.js report <run-id> --show
88
+ ```
89
+
90
+ Every command supports deterministic JSON with `--json` or `--format json`.
91
+ Human output is organized into stable panels: State Size, Compact Graph,
92
+ Blackboard Digest, Critical Path, Failures / Blockers, Evidence Digest,
93
+ Trust / Policy Digest, Hidden Source Records, Expansion Commands, and Next
94
+ Action. JSON output is never silently compacted; compaction is applied only to
95
+ human views or when a compact view is explicitly requested.
96
+
97
+ When thresholds are exceeded, human output automatically shows compact
98
+ summaries and tells the operator how to inspect the full data, for example:
99
+
100
+ ```text
101
+ Graph compacted: 420 nodes collapsed into 18 summary nodes
102
+ Use: node scripts/cw.js multi-agent graph <run-id> --view full --json
103
+ Use: node scripts/cw.js blackboard message list <run-id> --topic <topic-id>
104
+ ```
105
+
106
+ ## MCP parity
107
+
108
+ - `cw_summary_refresh`
109
+ - `cw_summary_show`
110
+ - `cw_blackboard_summarize`
111
+ - `cw_multi_agent_summarize`
112
+ - `cw_multi_agent_graph_compact`
113
+
114
+ MCP responses include source refs and expansion hints.
115
+
116
+ ## Eval / replay integration
117
+
118
+ Eval snapshots include summary artifacts, and replay comparison treats them as
119
+ regression-gated. Metrics: `summary_freshness`, `compact_graph_parity`,
120
+ `blackboard_digest_parity`, `critical_path_parity`, `evidence_digest_parity`,
121
+ and `expansion_ref_integrity`. The eval gate fails closed on stale summaries,
122
+ missing source refs, changed compact-graph shape, lost evidence refs, hidden
123
+ policy violations, lost judge rationale, changed critical path, and
124
+ summary/report mismatch.
125
+
126
+ ## Trust and audit
127
+
128
+ Summary generation is recorded in the trust-audit log. `summary refresh` records
129
+ a `summary.refresh` event noting who or what generated the summary, which scopes
130
+ were summarized, how many records were included and omitted, whether the summary
131
+ is deterministic, the source fingerprint, and whether it is stale. `summary
132
+ show` records a `summary.stale` event when the persisted fingerprint no longer
133
+ matches current source state. Audit metadata never stores secrets or large raw
134
+ message bodies.
135
+
136
+ ## Freshness and fail-closed behavior
137
+
138
+ `summary show` recomputes the current source fingerprint and compares it to the
139
+ persisted record. If they differ, the report status is `stale`, stale scopes are
140
+ listed, and the next action is `summary refresh`. This keeps derived indexes
141
+ honest: a summary is never trusted once its source records change.
142
+
143
+ ## Migration
144
+
145
+ Pre-0.1.25 runs have no `summaries/` directory; `summary show` reports `absent`
146
+ and recommends `summary refresh`. Pre-0.1.25 eval snapshots load with empty
147
+ summary sections, so existing fixtures and replays remain backward compatible.
148
+ Newer unsupported run-state schemas still fail closed.
149
+ ## CLI ↔ MCP Parity (v0.1.27)
150
+
151
+ Every command and tool referenced above is declared in the v0.1.27 capability
152
+ registry (`src/capability-registry.ts`) and validated by `npm run parity:check`,
153
+ so `cw <cmd> --json` and the matching `cw_<tool>` result render one data source.
154
+ See [cli-mcp-parity.7.md](cli-mcp-parity.7.md).
155
+
156
+ ## Run Registry / Control Plane (v0.1.28)
157
+
158
+ The runs described here are indexed, searchable, resumable, archivable, and
159
+ rerunnable across repos by the v0.1.28 Run Registry / Control Plane, which derives
160
+ a fingerprinted, fail-closed index over the same per-run `.cw/runs/<id>/state.json`
161
+ source of truth. See [run-registry-control-plane.7.md](run-registry-control-plane.7.md).
162
+
163
+ ## Execution Backends (v0.1.29)
164
+
165
+ v0.1.29 lifts execution into a pluggable driver layer: one narrow `ExecutionBackend`
166
+ contract with interchangeable `node`/`bun`/`shell`/`container`/`remote`/`ci`
167
+ drivers, selected by `--backend` (parallel to `--sandbox`) and inspected via
168
+ `backend list|show|probe`. The result/evidence envelope is schema-identical across
169
+ backends; the backend id + sandbox attestation are recorded as provenance, so this
170
+ surface is unchanged regardless of which backend executed a run. See
171
+ [execution-backends.7.md](execution-backends.7.md).
172
+ ## Web / Desktop Workbench (v0.1.30)
173
+
174
+ v0.1.30 adds the Web / Desktop Workbench: a read-only, localhost-only human
175
+ console that renders this surface (and the other four operator panels — run
176
+ graph, blackboard, worker logs, candidate compare, audit timeline) for any run,
177
+ reading the SAME capability `--json` payloads. It is a THIRD FRONT DOOR alongside
178
+ the CLI and MCP that holds no authoritative state and forks no schema: each panel
179
+ equals its `cw <cmd> --json` payload byte-for-byte (parity-gated), and refresh
180
+ re-derives everything from disk. See
181
+ [web-desktop-workbench.7.md](web-desktop-workbench.7.md).
182
+
183
+ ## Observability + Cost Accounting (v0.1.31)
184
+
185
+ v0.1.31 adds Observability + Cost Accounting: `metrics show`/`metrics summary`
186
+ derive durations, failure/verifier/acceptance rates (with sample counts and
187
+ fail-closed `n/a`), and host-attested token/cost from existing durable run state
188
+ — no metrics database, no collector daemon, no hidden counter. Usage is additive
189
+ and optional (absent ⇒ `unreported`, never 0); cost is `attested` (attested usage
190
+ × a recorded pricing policy) or clearly `estimated`, with pricing as policy. Both
191
+ verbs are parity-gated and render read-only in the v0.1.30 Workbench. See
192
+ [observability-cost-accounting.7.md](observability-cost-accounting.7.md).
193
+
194
+
195
+ ## Team Collaboration (v0.1.32)
196
+
197
+ v0.1.32 adds Team Collaboration: a host-attested actor and append-only
198
+ approvals/rejections/comments/handoffs provenance-linked to a durable target,
199
+ plus a review gate that STACKS ON the verifier gate — required approvals from
200
+ authorized roles, enforced inside `resolveCommitGate` AFTER the verifier checks
201
+ and never instead of them, failing closed on quorum/authority/self-approval and
202
+ recording who approved the very artifact that shipped. Policy (required approvals,
203
+ authorized roles, self-approval) is data, default off (pre-v0.1.32 behavior
204
+ unchanged). The verbs are parity-gated and render read-only in the v0.1.30
205
+ Workbench. See [Team Collaboration](team-collaboration.7.md).
206
+
207
+ ## Release Tooling (v0.1.33)
208
+
209
+ the per-tag mechanical surfaces (version bump across 17 surfaces, feature scaffold, and the forward-reference docs) become deterministic scripts, with a de-duplicated release gate. See release-tooling(7).
210
+
211
+ ## Real Execution Backend Integrations (v0.1.34)
212
+
213
+ container/remote/ci backends really execute (docker/podman run, remote/CI POST-and-poll) under the sandbox contract, with byte-stable evidence vs node and fail-closed refusal when a runtime/endpoint is unavailable. See real-execution-backends(7).
214
+
215
+ ## Node Snapshot / Diff / Replay (v0.1.35)
216
+
217
+ per-node snapshot, structural diff, and isolated deterministic replay over StateNode, reusing the v0.1.23 eval harness; fail-closed on source drift (valid|stale|absent). See node-snapshot-diff-replay(7).
218
+
219
+ ## Contract Migration Tooling (v0.1.36)
220
+
221
+ first-class declared migration registry (run-state + workflow-app) with per-edge compatibility proofs, fail-closed reachability, and a round-trip/non-destruction prover. See contract-migration-tooling(7).
222
+
223
+ ## Control-Plane Scheduling (v0.1.37)
224
+
225
+ priority + concurrency limits + lease lifecycle + retry/backoff + fail-closed park over the v0.1.28 Run Registry queue; policy-as-data, deterministic. See control-plane-scheduling(7).
226
+
227
+ ## Agent Delegation Drive (v0.1.38)
228
+
229
+ spawn an external agent process per worker, capture result.md + attestation, auto-drive plan->dispatch->fulfill->accept->commit
230
+
231
+ ## Run Retention & Provable Reclamation (v0.1.39)
232
+
233
+ tiered, append-only, cryptographically-verifiable run reclamation: seal the audit skeleton, free the reconstructable bulk, prove it
234
+
235
+ ## Durable State & Locking (v0.1.40)
236
+
237
+ atomic temp->rename writes + fsync-durability for authoritative stores; portable stale-stealing file lock serializing the cross-process read-modify-write stores
238
+
239
+ ## Self-Audit Hardening & Pure-Router Decomposition (v0.1.41)
240
+
241
+ evidence grounding + durable audit append + symlink-hardened containment + deterministic worker ids + recursive redaction; BackendRegistry self-describing drivers (no per-id switches); orchestrator god-object decomposed into per-domain operation modules (pure loadRun->delegate router)
242
+
243
+ ## Robust Result Ingest (v0.1.42)
244
+
245
+ capture findings/evidence from any reasonable agent shape (alt keys + prose), CW derives grounded evidence itself, warn on empty capture — closes the v0.1.41 live-drive 'accepted with 0 captured' failure
246
+
247
+ ## No-False-Green Gate & Launch Prep (v0.1.43)
248
+
249
+ Hard gate blocking empty-capture verifier-gated commits, plus quickstart and launch-prep docs.
250
+
251
+ ## Release-Gate Determinism & Agents Vendor (v0.1.44)
252
+
253
+ Release-readiness checks now validate the committed blob (`git show HEAD:<path>`) instead of the mutable working tree — eliminating false-red/false-green from concurrent working-tree writes (iCloud/Spotlight/editor). Adds the `agents` vendor manifest target: a generated `.agents/plugins/cool-workflow/` adapter giving any non-Claude AI agent one common interface to CW.
254
+
255
+ ## P1-P2 Fixes & CI Content Surfaces (v0.1.49)
256
+
257
+ Migration DAG with reversible edges (v0.1.45), capability auto-discovery (v0.1.46), vendor-adapter registry (v0.1.47), state auto-compaction and P2 fixes (v0.1.48), plus CI content-surface determinism hardening (v0.1.49).
258
+ 0.1.51
259
+
260
+ 0.1.76
261
+
262
+ 0.1.77
263
+
264
+ 0.1.78
@@ -0,0 +1,96 @@
1
+ # STATE-NODE(7)
2
+
3
+ ## NAME
4
+
5
+ StateNode, PipelineContract - inspectable CW runtime state and pipeline ABI
6
+
7
+ ## SYNOPSIS
8
+
9
+ ```ts
10
+ import {
11
+ assertNodeSatisfiesContract,
12
+ createStateNode,
13
+ transitionStateNode
14
+ } from "./state-node";
15
+ import { createDefaultPipelineContract } from "./pipeline-contract";
16
+
17
+ const contract = createDefaultPipelineContract();
18
+ const result = createStateNode({
19
+ kind: "result",
20
+ status: "completed",
21
+ loopStage: "observe",
22
+ artifacts: [{ id: "result", kind: "markdown", path: "/repo/.cw/runs/run/results/task.md" }],
23
+ evidence: [{ id: "result", locator: "/repo/src/file.ts:42" }]
24
+ });
25
+
26
+ assertNodeSatisfiesContract(result, contract, "verify");
27
+ const verified = transitionStateNode(result, { status: "verified", loopStage: "adjust" });
28
+ ```
29
+
30
+ ## DESCRIPTION
31
+
32
+ `StateNode` is the small runtime object used to represent meaningful CW transitions as JSON. It is not a workflow app model and does not encode domain behavior.
33
+
34
+ The kernel owns node creation, explicit status transitions, artifact paths, contract validation, and structured errors. Workflow apps own prompts, phase order, and domain-specific interpretation.
35
+
36
+ CW writes node JSON artifacts under:
37
+
38
+ ```text
39
+ .cw/runs/<run-id>/nodes/
40
+ ```
41
+
42
+ The normal flow is:
43
+
44
+ ```text
45
+ input node -> task node -> dispatch node -> result node -> verifier node -> commit/report node
46
+ ```
47
+
48
+ ## CONTRACT
49
+
50
+ Every `StateNode` includes `schemaVersion`, `id`, `kind`, `status`, `loopStage`, timestamps, `inputs`, `outputs`, `artifacts`, `evidence`, `errors`, `parents`, `children`, optional `contractId`, and optional `metadata`.
51
+
52
+ Every `PipelineContract` includes `schemaVersion`, `id`, `title`, `stages`, optional input/output schemas, artifact/evidence/failure/commit policies, and compatibility bounds.
53
+
54
+ Each stage declares accepted input node kinds and statuses, produced output kind, required artifacts, required evidence, verifier gate, and retry/failure behavior.
55
+
56
+ ## FAILURE MODES
57
+
58
+ Contract failures are raised as `PipelineContractError`. Each error carries a structured `StateNodeError` with:
59
+
60
+ - `code`
61
+ - `message`
62
+ - `at`
63
+ - optional `nodeId`
64
+ - optional `path`
65
+ - optional `retryable`
66
+ - optional `details`
67
+
68
+ Illegal status transitions fail before mutating the node. Missing artifacts and missing evidence fail with locatable error records suitable for saving into a failure node.
69
+
70
+ Commit status is verifier-gated. A node cannot transition into `committed` unless it is already `verified`.
71
+
72
+ ## COMPATIBILITY
73
+
74
+ `schemaVersion` is required on both nodes and contracts. The current schema is `1`.
75
+
76
+ New fields should be optional unless the runtime cannot proceed without them. Older run state without `nodes` or `contracts` remains readable; those arrays are initialized when loaded.
77
+
78
+ ## EXAMPLES
79
+
80
+ Create a failure node:
81
+
82
+ ```ts
83
+ const failed = recordNodeError(node, {
84
+ code: "missing-required-evidence",
85
+ message: "Verifier stage requires evidence",
86
+ path: "/repo/.cw/runs/run/results/task.md",
87
+ retryable: true
88
+ });
89
+ ```
90
+
91
+ Link a verifier node to a commit node:
92
+
93
+ ```ts
94
+ const [verifier, commit] = linkStateNodes(verifierNode, commitNode);
95
+ ```
96
+ 0.1.51