@kontourai/flow-agents 3.2.0 → 3.4.0

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 (281) hide show
  1. package/.github/workflows/add-to-project.yml +15 -0
  2. package/.github/workflows/ci.yml +173 -0
  3. package/CHANGELOG.md +54 -0
  4. package/CONTEXT.md +5 -1
  5. package/README.md +19 -8
  6. package/build/src/builder-flow-run-adapter.d.ts +80 -0
  7. package/build/src/builder-flow-run-adapter.js +241 -0
  8. package/build/src/builder-flow-runtime.d.ts +16 -0
  9. package/build/src/builder-flow-runtime.js +290 -0
  10. package/build/src/cli/assignment-provider.js +10 -1
  11. package/build/src/cli/builder-run.d.ts +1 -0
  12. package/build/src/cli/builder-run.js +27 -0
  13. package/build/src/cli/effective-backlog-settings.js +70 -2
  14. package/build/src/cli/init.d.ts +34 -0
  15. package/build/src/cli/init.js +341 -61
  16. package/build/src/cli/kit.js +55 -12
  17. package/build/src/cli/pull-work-provider.js +346 -5
  18. package/build/src/cli/skill-drift-check.d.ts +1 -0
  19. package/build/src/cli/skill-drift-check.js +165 -0
  20. package/build/src/cli/telemetry-doctor.d.ts +37 -0
  21. package/build/src/cli/telemetry-doctor.js +53 -6
  22. package/build/src/cli/validate-hook-influence.js +37 -7
  23. package/build/src/cli/workflow-artifact-cleanup-audit.js +418 -11
  24. package/build/src/cli/workflow-sidecar.d.ts +310 -1
  25. package/build/src/cli/workflow-sidecar.js +1914 -126
  26. package/build/src/cli.js +5 -0
  27. package/build/src/flow-kit/validate.d.ts +54 -34
  28. package/build/src/flow-kit/validate.js +237 -26
  29. package/build/src/index.d.ts +2 -0
  30. package/build/src/index.js +1 -0
  31. package/build/src/lib/console-connect-options.d.ts +97 -0
  32. package/build/src/lib/console-connect-options.js +199 -0
  33. package/build/src/lib/console-telemetry-validate.d.ts +49 -0
  34. package/build/src/lib/console-telemetry-validate.js +91 -0
  35. package/build/src/lib/flow-resolver.d.ts +54 -1
  36. package/build/src/lib/flow-resolver.js +112 -5
  37. package/build/src/lib/fs.d.ts +17 -0
  38. package/build/src/lib/fs.js +172 -0
  39. package/build/src/lib/local-artifact-root.d.ts +44 -1
  40. package/build/src/lib/local-artifact-root.js +131 -3
  41. package/build/src/runtime-adapters.d.ts +39 -3
  42. package/build/src/runtime-adapters.js +77 -31
  43. package/build/src/tools/build-universal-bundles.js +40 -2
  44. package/build/src/tools/codex-agent-routing.d.ts +2 -0
  45. package/build/src/tools/codex-agent-routing.js +49 -0
  46. package/build/src/tools/generate-context-map.js +1 -0
  47. package/build/src/tools/validate-source-tree.js +30 -3
  48. package/context/contracts/artifact-contract.md +16 -2
  49. package/context/scripts/hooks/lib/kit-catalog.js +235 -0
  50. package/context/scripts/hooks/lib/runnable-command.js +177 -0
  51. package/context/scripts/hooks/stop-goal-fit.js +278 -48
  52. package/context/scripts/hooks/workflow-steering.js +194 -22
  53. package/context/scripts/package.json +3 -0
  54. package/context/scripts/telemetry/install-console-config.sh +25 -4
  55. package/context/scripts/telemetry/lib/config.sh +102 -12
  56. package/context/scripts/telemetry/lib/pricing.sh +50 -0
  57. package/context/scripts/telemetry/lib/session.sh +3 -0
  58. package/context/scripts/telemetry/lib/transport.sh +87 -0
  59. package/context/scripts/telemetry/lib/usage.sh +205 -4
  60. package/context/scripts/telemetry/telemetry.conf +6 -0
  61. package/context/scripts/telemetry/telemetry.sh +48 -0
  62. package/context/settings/workspace-backlog-provider-settings.example.json +48 -0
  63. package/docs/agent-usage-feedback-loop.md +35 -0
  64. package/docs/architecture-engine-and-kits.md +110 -0
  65. package/docs/context-map.md +2 -0
  66. package/docs/coordination-guide.md +370 -0
  67. package/docs/decisions/agent-coordination.md +26 -9
  68. package/docs/decisions/embeddable-engine.md +152 -0
  69. package/docs/decisions/index.md +5 -3
  70. package/docs/decisions/trust-ledger-retention.md +88 -0
  71. package/docs/decisions/trust-reconcile.md +42 -9
  72. package/docs/decisions/workflow-enforcement.md +31 -9
  73. package/docs/fixture-ownership.md +6 -2
  74. package/docs/implementing-trust-reconciliation.md +129 -0
  75. package/docs/index.md +23 -9
  76. package/docs/integrations/flow-agents-console.md +275 -0
  77. package/docs/integrations/index.md +4 -0
  78. package/docs/kit-authoring-guide.md +52 -21
  79. package/docs/spec/builder-flow-runtime.md +80 -0
  80. package/docs/spec/runtime-hook-surface.md +45 -1
  81. package/docs/specs/economics-record-contract.md +270 -0
  82. package/docs/specs/harness-capability-matrix.md +74 -0
  83. package/docs/specs/learning-review-proposals-contract.md +340 -0
  84. package/docs/specs/routing-efficiency-review.md +59 -0
  85. package/docs/verifiable-trust.md +74 -25
  86. package/docs/workflow-artifact-lifecycle.md +38 -1
  87. package/docs/workflow-usage-guide.md +10 -0
  88. package/evals/acceptance/prove-capture-teeth.sh +132 -0
  89. package/evals/ci/antigaming-suite.sh +2 -0
  90. package/evals/ci/run-baseline.sh +78 -4
  91. package/evals/fixtures/economics/acceptance.json +12 -0
  92. package/evals/fixtures/economics/agents/tool-worker-1/events.jsonl +2 -0
  93. package/evals/fixtures/economics/agents/tool-worker-2/events.jsonl +2 -0
  94. package/evals/fixtures/economics/agents/tool-worker-3/events.jsonl +2 -0
  95. package/evals/fixtures/economics/agents/tool-worker-4/events.jsonl +1 -0
  96. package/evals/fixtures/economics/agents/tool-worker-5/events.jsonl +2 -0
  97. package/evals/fixtures/economics/critique.json +22 -0
  98. package/evals/fixtures/economics/expected-record.json +71 -0
  99. package/evals/fixtures/economics/session-usage-event.json +1 -0
  100. package/evals/fixtures/economics/state.json +11 -0
  101. package/evals/fixtures/economics/transcript.jsonl +3 -0
  102. package/evals/fixtures/hook-influence/cases.json +7 -7
  103. package/evals/fixtures/learning-review-proposals/balanced/economics.jsonl +6 -0
  104. package/evals/fixtures/learning-review-proposals/effect-follow-up/economics.jsonl +5 -0
  105. package/evals/fixtures/learning-review-proposals/effect-follow-up/sessions/task-lr-ef-1/trust.bundle +21 -0
  106. package/evals/fixtures/learning-review-proposals/effect-follow-up/sessions/task-lr-ef-2/trust.bundle +21 -0
  107. package/evals/fixtures/learning-review-proposals/effect-follow-up/sessions/task-lr-ef-3/trust.bundle +21 -0
  108. package/evals/fixtures/learning-review-proposals/effect-follow-up/sessions/task-lr-ef-4/trust.bundle +21 -0
  109. package/evals/fixtures/learning-review-proposals/effect-follow-up/sessions/task-lr-ef-5/trust.bundle +21 -0
  110. package/evals/fixtures/learning-review-proposals/pattern-present/economics.jsonl +6 -0
  111. package/evals/fixtures/learning-review-proposals/pattern-present/expected-aggregates.json +30 -0
  112. package/evals/fixtures/learning-review-proposals/pattern-present/expected-aggregates.md +66 -0
  113. package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-1/gate-review.inquiries.json +26 -0
  114. package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-1/trust.bundle +21 -0
  115. package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-2/gate-review.inquiries.json +26 -0
  116. package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-2/trust.bundle +21 -0
  117. package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-3/gate-review.inquiries.json +26 -0
  118. package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-3/trust.bundle +21 -0
  119. package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-4/gate-review.inquiries.json +26 -0
  120. package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-4/trust.bundle +21 -0
  121. package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-5/trust.bundle +21 -0
  122. package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-6/trust.bundle +21 -0
  123. package/evals/fixtures/learning-review-proposals/repeat-window/economics.jsonl +6 -0
  124. package/evals/fixtures/learning-review-proposals/under-threshold/economics.jsonl +3 -0
  125. package/evals/fixtures/reconcile-preflight/disputed-critique-unsuperseded.json +48 -0
  126. package/evals/fixtures/reconcile-preflight/standalone-disputed-session-local.json +59 -0
  127. package/evals/fixtures/telemetry/usage-transcript-sample.jsonl +4 -0
  128. package/evals/fixtures/trust-reconcile-exploits/mcp-degrade.json +42 -0
  129. package/evals/integration/test_builder_entry_enforcement.sh +241 -0
  130. package/evals/integration/test_builder_step_producers.sh +18 -10
  131. package/evals/integration/test_bundle_install.sh +172 -0
  132. package/evals/integration/test_checkpoint_signing.sh +10 -2
  133. package/evals/integration/test_ci_actor_identity.sh +221 -0
  134. package/evals/integration/test_console_tenant_isolation.sh +167 -0
  135. package/evals/integration/test_critique_supersession_roundtrip.sh +4 -1
  136. package/evals/integration/test_dual_emit_flow_step.sh +10 -4
  137. package/evals/integration/test_economics_record.sh +674 -0
  138. package/evals/integration/test_effective_backlog_settings.sh +1 -1
  139. package/evals/integration/test_evidence_capture_hook.sh +17 -2
  140. package/evals/integration/test_exemption_usage_review.sh +198 -0
  141. package/evals/integration/test_fixture_retirement_audit.sh +2 -2
  142. package/evals/integration/test_flow_kit_install_git.sh +83 -0
  143. package/evals/integration/test_flowdef_session_activation.sh +0 -1
  144. package/evals/integration/test_flowdef_session_history_preservation.sh +13 -3
  145. package/evals/integration/test_gate_lockdown.sh +7 -0
  146. package/evals/integration/test_gate_review_inquiry_records.sh +9 -1
  147. package/evals/integration/test_goal_fit_hook.sh +2031 -0
  148. package/evals/integration/test_hook_category_behaviors.sh +8 -1
  149. package/evals/integration/test_hook_influence_cases.sh +25 -1
  150. package/evals/integration/test_install_merge.sh +227 -2
  151. package/evals/integration/test_kit_conformance_levels.sh +6 -6
  152. package/evals/integration/test_learning_review_proposals.sh +329 -0
  153. package/evals/integration/test_liveness_conflict_injection.sh +26 -22
  154. package/evals/integration/test_liveness_console_relay.sh +166 -0
  155. package/evals/integration/test_liveness_heartbeat.sh +17 -17
  156. package/evals/integration/test_liveness_worktree_root.sh +575 -0
  157. package/evals/integration/test_phase_map_and_gate_claim.sh +6 -1
  158. package/evals/integration/test_publish_delivery.sh +389 -2
  159. package/evals/integration/test_pull_work_board.sh +200 -0
  160. package/evals/integration/test_pull_work_provider.sh +1 -1
  161. package/evals/integration/test_reconcile_preflight.sh +304 -0
  162. package/evals/integration/test_record_check.sh +378 -0
  163. package/evals/integration/test_routing_efficiency.sh +71 -0
  164. package/evals/integration/test_runtime_adapter_activation.sh +28 -0
  165. package/evals/integration/test_session_resume_roundtrip.sh +16 -19
  166. package/evals/integration/test_skill_drift_check.sh +870 -0
  167. package/evals/integration/test_takeover_protocol.sh +340 -0
  168. package/evals/integration/test_telemetry.sh +445 -0
  169. package/evals/integration/test_telemetry_doctor.sh +66 -0
  170. package/evals/integration/test_telemetry_usage_pipeline.sh +228 -0
  171. package/evals/integration/test_trust_reconcile_negatives.sh +121 -13
  172. package/evals/integration/test_trust_reconcile_trailer_diagnostic.sh +247 -0
  173. package/evals/integration/test_usage_cost.sh +61 -0
  174. package/evals/integration/test_verify_hold.sh +910 -0
  175. package/evals/integration/test_veritas_governance_kit.sh +257 -0
  176. package/evals/integration/test_workflow_artifact_cleanup_audit.sh +575 -3
  177. package/evals/integration/test_workflow_sidecar_writer.sh +1395 -0
  178. package/evals/integration/test_workflow_steering_hook.sh +157 -16
  179. package/evals/integration/test_workspace_settings.sh +176 -0
  180. package/evals/lib/env.sh +26 -0
  181. package/evals/lib/node.sh +8 -0
  182. package/evals/run.sh +37 -0
  183. package/evals/static/test_ci_integration_coverage.sh +115 -0
  184. package/evals/static/test_declared_scope_forms_documented.sh +114 -0
  185. package/evals/static/test_universal_bundles.sh +34 -0
  186. package/evals/static/test_validate_source_kit_asset_scope.sh +259 -0
  187. package/evals/static/test_workflow_skills.sh +1 -1
  188. package/kits/builder/flows/build.flow.json +9 -18
  189. package/kits/builder/flows/publish-learn.flow.json +5 -1
  190. package/kits/builder/kit.json +120 -0
  191. package/kits/builder/skills/continue-work/SKILL.md +2 -0
  192. package/kits/builder/skills/deliver/SKILL.md +115 -0
  193. package/kits/builder/skills/evidence-gate/SKILL.md +12 -0
  194. package/kits/builder/skills/execute-plan/SKILL.md +9 -0
  195. package/kits/builder/skills/learning-review/SKILL.md +51 -0
  196. package/kits/builder/skills/plan-work/SKILL.md +17 -20
  197. package/kits/builder/skills/pull-work/SKILL.md +33 -2
  198. package/kits/builder/skills/release-readiness/SKILL.md +12 -0
  199. package/kits/knowledge/kit.json +9 -0
  200. package/kits/veritas-governance/docs/README.md +113 -7
  201. package/kits/veritas-governance/fixtures/exemption/approved.trust-bundle.json +74 -0
  202. package/kits/veritas-governance/fixtures/exemption/not-approved.trust-bundle.json +74 -0
  203. package/kits/veritas-governance/fixtures/exemption-review/mixed-fresh-stale.DECLARED.json +14 -0
  204. package/kits/veritas-governance/flows/exemption-issuance.flow.json +35 -0
  205. package/kits/veritas-governance/kit.json +19 -0
  206. package/kits/veritas-governance/skills/exemption-usage-review/SKILL.md +128 -0
  207. package/kits/veritas-governance/skills/exemption-usage-review/review-exemptions.mjs +231 -0
  208. package/package.json +2 -2
  209. package/packaging/manifest.json +29 -0
  210. package/schemas/backlog-provider-settings.schema.json +13 -0
  211. package/schemas/workflow-state.schema.json +44 -0
  212. package/scripts/README.md +4 -0
  213. package/scripts/check-content-boundary.cjs +8 -1
  214. package/scripts/ci/trust-reconcile.js +214 -253
  215. package/scripts/hooks/codex-hook-adapter.js +77 -2
  216. package/scripts/hooks/evidence-capture.js +38 -5
  217. package/scripts/hooks/lib/actor-identity.js +82 -0
  218. package/scripts/hooks/lib/codex-exit-code.js +316 -0
  219. package/scripts/hooks/lib/kit-catalog.js +235 -0
  220. package/scripts/hooks/lib/liveness-write.js +28 -1
  221. package/scripts/hooks/lib/local-artifact-paths.js +97 -1
  222. package/scripts/hooks/lib/runnable-command.js +177 -0
  223. package/scripts/hooks/lib/skill-drift.js +350 -0
  224. package/scripts/hooks/stop-goal-fit.js +278 -48
  225. package/scripts/hooks/workflow-steering.js +194 -22
  226. package/scripts/install-codex-home.sh +97 -47
  227. package/scripts/install-merge.js +72 -14
  228. package/scripts/install-owned-files.js +178 -0
  229. package/scripts/lib/reconcile-shape.js +381 -0
  230. package/scripts/liveness/relay.sh +84 -0
  231. package/scripts/telemetry/economics-record.schema.json +145 -0
  232. package/scripts/telemetry/economics-record.sh +331 -0
  233. package/scripts/telemetry/install-console-config.sh +25 -4
  234. package/scripts/telemetry/learning-review-decide.sh +124 -0
  235. package/scripts/telemetry/learning-review-proposals.schema.json +161 -0
  236. package/scripts/telemetry/learning-review-proposals.sh +484 -0
  237. package/scripts/telemetry/lib/config.sh +102 -12
  238. package/scripts/telemetry/lib/pricing.sh +14 -6
  239. package/scripts/telemetry/lib/session.sh +3 -0
  240. package/scripts/telemetry/lib/transport.sh +133 -15
  241. package/scripts/telemetry/lib/usage.sh +121 -28
  242. package/scripts/telemetry/routing-efficiency.sh +0 -0
  243. package/scripts/telemetry/telemetry.conf +6 -0
  244. package/scripts/telemetry/telemetry.sh +48 -0
  245. package/src/builder-flow-run-adapter.ts +357 -0
  246. package/src/builder-flow-runtime.ts +348 -0
  247. package/src/cli/assignment-provider.ts +12 -1
  248. package/src/cli/builder-flow-run-adapter.test.mjs +495 -0
  249. package/src/cli/builder-flow-runtime.test.mjs +213 -0
  250. package/src/cli/builder-run.ts +28 -0
  251. package/src/cli/codex-agent-routing.test.mjs +44 -0
  252. package/src/cli/codex-exit-code.test.mjs +207 -0
  253. package/src/cli/console-connect-options.test.mjs +329 -0
  254. package/src/cli/console-telemetry-validate.test.mjs +157 -0
  255. package/src/cli/effective-backlog-settings.ts +68 -2
  256. package/src/cli/flow-resolver-composition.test.mjs +72 -0
  257. package/src/cli/init.test.mjs +161 -0
  258. package/src/cli/init.ts +407 -62
  259. package/src/cli/kit-metadata-security.test.mjs +443 -0
  260. package/src/cli/kit.ts +50 -12
  261. package/src/cli/pull-work-provider.ts +377 -3
  262. package/src/cli/sidecar-pure-helpers.test.mjs +64 -0
  263. package/src/cli/skill-drift-check.ts +196 -0
  264. package/src/cli/telemetry-doctor.test.mjs +53 -0
  265. package/src/cli/telemetry-doctor.ts +50 -7
  266. package/src/cli/validate-hook-influence.ts +37 -6
  267. package/src/cli/workflow-artifact-cleanup-audit.ts +483 -10
  268. package/src/cli/workflow-sidecar.ts +1980 -119
  269. package/src/cli.ts +5 -0
  270. package/src/flow-kit/validate.ts +277 -38
  271. package/src/index.ts +19 -0
  272. package/src/lib/console-connect-options.ts +261 -0
  273. package/src/lib/console-telemetry-validate.ts +88 -0
  274. package/src/lib/flow-resolver.ts +117 -4
  275. package/src/lib/fs.ts +160 -0
  276. package/src/lib/local-artifact-root.ts +129 -3
  277. package/src/runtime-adapters.ts +113 -33
  278. package/src/tools/build-universal-bundles.ts +36 -2
  279. package/src/tools/codex-agent-routing.ts +48 -0
  280. package/src/tools/generate-context-map.ts +1 -0
  281. package/src/tools/validate-source-tree.ts +29 -3
@@ -0,0 +1,88 @@
1
+ ---
2
+ status: needs-decision
3
+ subject: Trust-ledger retention and console-as-projection
4
+ decided: 2026-07-07
5
+ evidence:
6
+ - kind: adr
7
+ ref: docs/adr/0017-anti-gaming-trust-security-model.md
8
+ - kind: adr
9
+ ref: docs/adr/0020-trust-reconcile-manifest-and-claim-classification.md
10
+ - kind: adr
11
+ ref: docs/adr/0022-fail-closed-delivery-reconciliation-with-governed-exemptions.md
12
+ - kind: doc
13
+ ref: docs/implementing-trust-reconciliation.md
14
+ - kind: issue
15
+ ref: kontourai/console#118
16
+ - kind: issue
17
+ ref: kontourai/console#125
18
+ - kind: issue
19
+ ref: kontourai/flow-agents#463
20
+ - kind: issue
21
+ ref: kontourai/flow-agents#73
22
+ ---
23
+ # Trust-ledger retention and console-as-projection
24
+
25
+ > Status: **needs-decision** (proposed direction (shaped with Brian Anderson, 2026-07-07). Not yet
26
+ > fully built. Ratify + carry forward as ADR on implementation.
27
+
28
+ **Decision.** Git is the **authoritative store** for trust bundles and delivery
29
+ records; the Console (and any hosted DB projection) is a **rebuildable, queryable
30
+ projection** over them, never the source of truth. Three rules follow:
31
+
32
+ 1. **Two stores, two retention tiers.** The authoritative bundle is committed
33
+ (`delivery/<slug>/trust.bundle` + checkpoint) and pinned to the merge commit —
34
+ permanent, distributed, surviving any console outage. The console DB keeps a
35
+ projection: **coarse audit records** (bundles, decisions, gate/claim outcomes)
36
+ retained long; the **fine-grained raw telemetry firehose** kept for a short
37
+ window and rolled up into aggregates. Retention in the projection is a **cost**
38
+ decision, not a **correctness** one.
39
+
40
+ 2. **"Needs attention" is a view-filter, never a delete-sweep.** An item leaves
41
+ the operational attention set when it reaches a terminal state or ages past a
42
+ recency cutoff — the underlying record is retained, it just stops surfacing as
43
+ actionable. Deleting audit history to quiet a dashboard is a category error.
44
+
45
+ 3. **The gate fires at PR time; post-merge the bundle is an audit record.** A
46
+ bundle seals to the work-commit and tolerates lag (the ancestor check + fresh
47
+ CI re-run absorb later commits); it is not regenerated per push. After a
48
+ (squash) merge it rides into the merge commit as a committed file and becomes
49
+ provenance, not enforcement. See `docs/implementing-trust-reconciliation.md`.
50
+
51
+ **Rationale.** "Console isn't the source of truth" is the *enabling* property, not
52
+ a caveat: because git holds the authority, the projection is free to be pruned,
53
+ tiered, or rebuilt for cost/perf without losing anything. This dissolves the
54
+ tension between "keep an auditable delivery history" and "don't let a dashboard
55
+ fill with days-old noise" — they are different concerns (retention vs. attention)
56
+ that were previously conflated in one store. Observed data motivates the tiering:
57
+ in one live snapshot the coarse audit table held ~38 rows while the raw
58
+ telemetry-event table held ~30,000 — bundles are not what grows; the event stream
59
+ is.
60
+
61
+ **A "stale" bundle is a presentation problem, not a data problem.** A bundle is an
62
+ immutable dated receipt ("verified this way at commit X"); it never becomes
63
+ *wrong*, only misleading if surfaced as *current* truth. The query layer answers
64
+ "true now?" from latest-state-per-subject and "true at commit X?" from the bundle.
65
+
66
+ **Consequences / what to build.**
67
+
68
+ - **Reframe the console "janitor" ([console#125]) from reaper to attention
69
+ view-filter**: terminal-state + recency cutoff over the operating-state
70
+ projection, with no deletion of underlying events. (Today the gap is
71
+ structural: there is no terminal-close/expiry event type, so nothing ever
72
+ leaves the active set — a process that stops emitting without a terminal status
73
+ flags as "long-running / needs attention" forever.)
74
+ - **Make the projection genuinely rebuildable** ([flow-agents#463],
75
+ [flow-agents#73]): add a backfill/import that re-hydrates the console from the
76
+ committed `delivery/*/trust.bundle` files across repos. Until this exists, "the
77
+ DB is just a cache of git" is false in practice — a wipe/restart loses
78
+ queryability until producers re-push (observed 2026-07-07: a hosted-DB wipe
79
+ required a manual service restart and had no re-hydration path).
80
+ - **Add retention + rollup for raw telemetry** (relates to the console noise
81
+ cleanup, [flow-agents#7-equivalent]): keep raw events N days, keep aggregates
82
+ long.
83
+ - **Trust-bundle registry** ([console#118]) is the research home for org-scoped
84
+ retention, sharing, and third-party verification of the ledger.
85
+
86
+ **Non-goals.** This decision does not change the layered-defense posture of ADR
87
+ 0017/0020/0022, the PR-time gate semantics, or claim classification. It adds the
88
+ retention/projection design layer on top.
@@ -1,20 +1,53 @@
1
1
  ---
2
- status: needs-decision
2
+ status: current
3
3
  subject: Trust-reconcile and delivery reconciliation
4
- decided: 2026-07-03
4
+ decided: 2026-07-04
5
5
  evidence:
6
6
  - kind: adr
7
7
  ref: docs/adr/0020-trust-reconcile-manifest-and-claim-classification.md
8
8
  - kind: adr
9
9
  ref: docs/adr/0022-fail-closed-delivery-reconciliation-with-governed-exemptions.md
10
+ - kind: doc
11
+ ref: docs/coordination-guide.md
10
12
  ---
11
13
  # Trust-reconcile and delivery reconciliation
12
14
 
13
- This subject has provenance in frozen ADR history ([0020-trust-reconcile-manifest-and-claim-classification.md](../adr/0020-trust-reconcile-manifest-and-claim-classification.md), [0022-fail-closed-delivery-reconciliation-with-governed-exemptions.md](../adr/0022-fail-closed-delivery-reconciliation-with-governed-exemptions.md)) but no living
14
- decision has been ratified yet under the topic-keyed decision registry
15
- (`context/contracts/decision-registry-contract.md`). This stub records that the
16
- subject is open and links the frozen ADR(s) as provenance; it is not a decision.
15
+ **Decision.** Delivery is **fail-closed with governed exemptions**. `publishDelivery()` passes a
16
+ bundle through three distinct, type-discriminated tiers fail-soft (absent bundle tolerated) →
17
+ shape gate (`InvalidBundleShapeError`, #356) hold gate (`NotFreshHolderError`, #293) — and CI's
18
+ reconcile is fail-closed by default (`onUnderivable: 'fail'`). A local `reconcile-preflight`
19
+ mirrors CI's shape check via the *shared* `scripts/lib/reconcile-shape.js` so the two cannot
20
+ drift. Concurrent deliveries are isolated by **per-session paths** (`delivery/<slug>/`, #379), and
21
+ a checkpoint's `commit_sha` must be an ancestor of HEAD (seal-at-parent) so a stale bundle can't be
22
+ replayed onto a moved branch. See the [coordination guide](../coordination-guide.md#how-delivery-itself-is-made-tamper-resistant).
17
23
 
18
- When a living decision is ratified for Trust-reconcile and delivery reconciliation, update this
19
- file's `status` to `current`, add rationale, and keep the `adr` evidence
20
- links as provenance for the history that led here.
24
+ **Rationale.** The default must be safe: an underivable status fails the run rather than passing
25
+ it, and a hard block on the shared publish path is applied only on high-confidence signals so it
26
+ never false-blocks legitimate work. The frozen ADRs ([0020](../adr/0020-trust-reconcile-manifest-and-claim-classification.md),
27
+ [0022](../adr/0022-fail-closed-delivery-reconciliation-with-governed-exemptions.md)) hold the
28
+ immutable rationale.
29
+
30
+ ## Implementation note (#356, iteration 1)
31
+
32
+ A local, pre-push `reconcile-preflight` now exists (`workflow-sidecar reconcile-preflight
33
+ <artifact-dir>`), reusing — never forking — the shape-classification logic CI's
34
+ `scripts/ci/trust-reconcile.js` enforces via the shared `scripts/lib/reconcile-shape.js`
35
+ module. `publishDelivery()` is itself fail-closed on shape-invalidity: it calls the same
36
+ preflight before copying anything into `delivery/`, and refuses to publish a bundle that
37
+ fails the shape check.
38
+
39
+ The reduced-coverage degradation (trusting a session-local claim's self-reported status when
40
+ CI-side re-derivation is unavailable) is a **LOCAL-preflight-only** opt-in
41
+ (`sessionLocalShapeIssues(..., { onUnderivable: 'reduce' })`). CI's `trust-reconcile.js`
42
+ always calls the shared function with `{ onUnderivable: 'fail' }` (also the function's
43
+ default when no mode is given) and remains fail-closed: when status re-derivation is
44
+ unavailable, every session-local pass-asserting claim becomes a `status-underivable`
45
+ divergence and the run fails, exactly as before the shape logic was extracted.
46
+
47
+ ## Implementation note (#379, per-session delivery paths)
48
+
49
+ Concurrent deliveries no longer contend on a shared `delivery/trust.bundle`. Each session writes
50
+ its bundle under `delivery/<slug>/`; CI selects prefer-newest. Publishing must **restore sibling
51
+ `delivery/<slug>/` directories** from `origin/main` before committing — after a soft-reset,
52
+ `git add -A` would otherwise stage the deletion of other sessions' delivery dirs that the branch
53
+ predates. This is the standard step in the publish sequence documented in the coordination guide.
@@ -1,18 +1,40 @@
1
1
  ---
2
- status: needs-decision
2
+ status: current
3
3
  subject: Workflow Enforcement
4
- decided: 2026-07-03
4
+ decided: 2026-07-10
5
5
  evidence:
6
6
  - kind: adr
7
7
  ref: docs/adr/0001-flow-agents-consumes-flow.md
8
+ - kind: issue
9
+ ref: https://github.com/kontourai/flow-agents/issues/438
10
+ - kind: session-archive
11
+ ref: .kontourai/flow-agents/builder-enforcement-remediation/builder-enforcement-remediation--pull-work.md
8
12
  ---
9
13
  # Workflow Enforcement
10
14
 
11
- This subject has provenance in frozen ADR history ([0001-flow-agents-consumes-flow.md](../adr/0001-flow-agents-consumes-flow.md)) but no living
12
- decision has been ratified yet under the topic-keyed decision registry
13
- (`context/contracts/decision-registry-contract.md`). This stub records that the
14
- subject is open and links the frozen ADR(s) as provenance; it is not a decision.
15
+ **Decision.** A new Workflow Run always starts at the first step declared by its canonical
16
+ Flow Definition. A caller cannot choose a later starting step, and metadata such as an ad-hoc
17
+ reason cannot grant that authority. Flow-native accepted exceptions may satisfy a named gate in
18
+ an existing run; they do not authorize skipping the prefix that precedes that gate.
15
19
 
16
- When a living decision is ratified for workflow enforcement, update this
17
- file's `status` to `current`, add rationale, and keep the `adr` evidence
18
- links as provenance for the history that led here.
20
+ Recovery resumes persisted run state rather than creating a replacement run at an arbitrary
21
+ step. The recovered state must validate against the canonical definition identity and preserve
22
+ its transitions, gate outcomes, attached evidence, and accepted exceptions. An import surface,
23
+ when provided, must validate the same complete durable record before making it active; it is not
24
+ a step-selection escape hatch.
25
+
26
+ Direct primitives remain valid outside a product Workflow Run. For example, standalone
27
+ `plan-work` may execute with its own primitive contract, but it must not stamp or report itself
28
+ as a completed `builder.build` prefix. A request that intends the Builder Kit product flow must
29
+ enter through `pull-work`, then `design-probe`, before planning.
30
+
31
+ **Rationale.** The Flow Definition is the executable ordering authority. Allowing callers to
32
+ self-declare a later step makes every upstream gate advisory and lets the artifact being created
33
+ justify its own creation. Separating standalone primitives from product-flow runs preserves
34
+ useful composability without weakening ordered workflows.
35
+
36
+ **Consequences.** `ensure-session --flow-id builder.build --step-id plan` is invalid for a new
37
+ run, even with `--ad-hoc-reason`. Existing run recovery is identified by durable run identity,
38
+ not by a reason string. Refusal must happen before session files, assignment claims, or other
39
+ side effects. Builder skills must route productized work through the declared prefix and describe
40
+ direct primitive use as standalone.
@@ -17,14 +17,18 @@ run `npm run validate:source --` and `npm run fixture:retirement-audit --`.
17
17
  | `evals/fixtures/backlog-provider-settings` | settings precedence fixtures | `evals/integration/test_effective_backlog_settings.sh` | Keep while backlog provider settings resolution supports global defaults and project overrides. |
18
18
  | `evals/fixtures/builder-kit-workflow-state` | Builder Kit workflow-state fixtures | `evals/static/test_workflow_skills.sh` | Keep while Builder Kit state contract and resume behavior are documented in workflow skill contracts. |
19
19
  | `evals/fixtures/console-learning-projection` | console learning projection fixtures | `evals/integration/test_console_learning_projection.sh` | Keep while learning projection supports correction and open-route examples. |
20
+ | `evals/fixtures/economics` | per-run kit-economics record fixtures (#349): a transcript with .message.usage blocks, state.json/acceptance.json/critique.json join sources, a session.usage event, and the golden expected kontour.console.economics record | `evals/integration/test_economics_record.sh` | Keep while the `kontour.console.economics` v0.1 record contract (docs/specs/economics-record-contract.md) is enforced; the golden proves cost-from-transcript, defects-from-critique, verdict-from-state, and the R7 co-required guard. |
20
21
  | `evals/fixtures/flow-kit-repository` | Flow Kit repository contract fixtures | `evals/integration/test_flow_kit_repository.sh`, `evals/integration/test_local_flow_kit_install.sh`, `evals/integration/test_runtime_adapter_activation.sh`, `evals/integration/test_activate_npx_context.sh`, `evals/integration/test_flow_kit_install_git.sh`, `evals/static/test_workflow_skills.sh` | Keep valid and invalid cases paired with the Flow Kit repository contract. |
21
22
  | `evals/fixtures/kit-conformance-levels` | K-level conformance and consumer-target derivation fixtures | `evals/integration/test_kit_conformance_levels.sh` | Keep while K-level derivation, degradation invariant, and consumer-target badge rules are tested. |
22
23
  | `evals/fixtures/hook-influence` | hook influence behavioral cases | `evals/integration/test_hook_influence_cases.sh`, `evals/static/test_workflow_skills.sh`, `scripts/validate-hook-influence-cases.js` | Keep while hook influence cases define agent guidance behavior. |
24
+ | `evals/fixtures/learning-review-proposals` | learning-review kit/gate tuning proposal fixtures (#352): pattern-present (engineered cost-inflation + gate false-block-rate pattern, with sessions/ trust.bundle + gate-review.inquiries.json joins and a hand-computed expected-aggregates.json), balanced (proportional cost/findings movement -> zero proposals), under-threshold (below LR_MIN_WINDOW_SAMPLE), repeat-window (idempotency), and effect-follow-up (later-window effect-fill pass for a ratified proposal) | `evals/integration/test_learning_review_proposals.sh` | Keep while `scripts/telemetry/learning-review-proposals.sh`/`learning-review-decide.sh` (docs/specs/learning-review-proposals-contract.md) are enforced: hand-computed aggregates, evidence-cited proposals, zero-mutation, idempotency, and the ratify -> effect-fill trail. |
23
25
  | `evals/fixtures/pull-work-provider` | work item provider normalization fixtures | `evals/integration/test_pull_work_provider.sh` | Keep while provider normalization preserves blockers, artifact refs, board membership, and freshness metadata. |
24
26
  | `evals/fixtures/pull-work-wip-shepherding` | WIP shepherding state fixtures | `evals/static/test_workflow_skills.sh` | Keep while pull-work documents personal versus global WIP behavior. |
27
+ | `evals/fixtures/reconcile-preflight` | #356 reconcile-preflight shape fixtures not already covered by trust-reconcile-exploits (un-superseded disputed critique, standalone disputed session-local claim) | `evals/integration/test_reconcile_preflight.sh` | Keep while the local `reconcile-preflight` subcommand (#356) is proven against the two shapes trust-reconcile-exploits does not already fixture (un-superseded disputed critique, standalone disputed session-local claim); the other four shapes reuse trust-reconcile-exploits/trust-reconcile-mixed-bundle directly rather than forking near-duplicates. |
25
28
  | `evals/fixtures/surface-trust` | Surface trust evidence fixtures | `evals/integration/test_workflow_sidecar_writer.sh` | Keep while sidecar writer maps Surface trust evidence into workflow records. |
26
- | `evals/fixtures/trust-reconcile-exploits` | WS8 trust-reconcile anti-gaming exploit fixtures (frozen negative regressions) | `evals/integration/test_trust_reconcile_negatives.sh` | Keep while trust-reconcile.js enforces the WS8 iteration-2 soundness properties (no-label test_output, unwaived-assumed, status-misassertion, waiver-on-command); each fixture is a permanent negative regression. |
27
- | `evals/fixtures/trust-reconcile-mixed-bundle` | WS8 trust-reconcile mixed-evidence end-to-end proof fixture | `evals/integration/test_trust_reconcile_mixed_bundle.sh` | Keep while the trust-reconcile manifest/classification/waiver contract (ADR 0020) is enforced; proves a mixed test_output + session-local + waived bundle passes the CI anchor. |
29
+ | `evals/fixtures/telemetry` | hermetic Stop-hook usage transcript fixture (#defect-2026-07 telemetry-usage-cost-extraction): a multi-model JSONL transcript with .message.model + .message.usage token blocks proving real token/cost/model extraction end-to-end | `evals/integration/test_usage_cost.sh`, `evals/integration/test_telemetry_usage_pipeline.sh` | Keep while telemetry.sh's Stop-hook usage pipeline (usage_parse_transcript / usage_model_from_transcript_usage) is proven against a hermetic multi-model transcript rather than relying on live runtime data. |
30
+ | `evals/fixtures/trust-reconcile-exploits` | WS8 trust-reconcile anti-gaming exploit fixtures (frozen negative regressions); also reused by the #356 local reconcile-preflight eval (same shapes, no forked copies) | `evals/integration/test_trust_reconcile_negatives.sh`, `evals/integration/test_reconcile_preflight.sh` | Keep while trust-reconcile.js enforces the WS8 iteration-2 soundness properties (no-label test_output, unwaived-assumed, status-misassertion, waiver-on-command); each fixture is a permanent negative regression. |
31
+ | `evals/fixtures/trust-reconcile-mixed-bundle` | WS8 trust-reconcile mixed-evidence end-to-end proof fixture; also reused by the #356 reconcile-preflight eval as its CLEAN-BUNDLE (AC4) case | `evals/integration/test_trust_reconcile_mixed_bundle.sh`, `evals/integration/test_reconcile_preflight.sh` | Keep while the trust-reconcile manifest/classification/waiver contract (ADR 0020) is enforced; proves a mixed test_output + session-local + waived bundle passes the CI anchor. |
28
32
  | `evals/fixtures/trust-reconcile-ws3` | WS8 AC6 backward-compat fixture: real ws3-kit-dependencies-namespacing old-style bundle | `evals/integration/test_trust_reconcile_negatives.sh` | Keep while backward compatibility with pre-classification (all-test_output) bundles is asserted; proves an old-style bundle still FAILS the same way (no silent pass). |
29
33
  | `evals/fixtures/usage-feedback` | usage feedback import/outcome fixtures | `evals/integration/test_usage_feedback_import.sh`, `evals/integration/test_usage_feedback_outcomes.sh`, `evals/integration/test_usage_feedback_report.sh` | Keep while usage feedback import, outcome, and report flows accept JSONL fixture input. |
30
34
  | `evals/fixtures/veritas-governance-adapter` | Veritas governance adapter fixtures | `evals/integration/test_veritas_governance_adapter.sh` | Keep while the Veritas adapter supports pass, unconfigured, and secret-failure governance paths. |
@@ -0,0 +1,129 @@
1
+ # Implementing Trust Reconciliation Correctly
2
+
3
+ > Status: DRAFT for review (not yet a merged doc). Companion to
4
+ > ADR 0017 (anti-gaming trust/security model), ADR 0020 (reconcile manifest +
5
+ > claim classification), and ADR 0022 (fail-closed delivery reconciliation).
6
+
7
+ This guide is the "how to build it without re-breaking it" companion to the
8
+ trust ADRs. Every principle below either drew blood in a real delivery or is
9
+ load-bearing config in `.github/workflows/trust-reconcile.yml`. If you are
10
+ porting this pattern to another repo/org, read this first.
11
+
12
+ ## The one sentence to internalize
13
+
14
+ **The trust gate fires at PR time; after merge, the same bundle becomes an
15
+ audit record, not a gate.**
16
+
17
+ That single framing decides where the check lives and what the artifact is
18
+ _for_ at each stage:
19
+
20
+ - **At PR time** the reconcile job is a required, admin-enforced status check.
21
+ It is the thing that prevents a bad merge.
22
+ - **After merge** the committed bundle is a dated, immutable receipt of what was
23
+ claimed and how it was verified — provenance, not enforcement.
24
+
25
+ Get this wrong and you either gate on the post-merge `main` push (which either
26
+ no-ops or falsely fails — see §2) or you misjudge what the bundle is worth once
27
+ the work has landed.
28
+
29
+ ## Gate mechanics (the non-obvious CI gotchas)
30
+
31
+ ### 1. CI must re-run verification fresh; the bundle is only a divergence detector
32
+
33
+ Never let the reconcile job _believe_ the bundle's "pass." Re-run the canonical
34
+ verification in a clean CI environment the agent does not control, and use the
35
+ bundle solely to detect divergence ("claimed pass, CI fails" / "claimed pass,
36
+ command CI never ran" / "checkpoint-only bundle"). If your job reads the bundle
37
+ and trusts it, you have built theater, not a gate. This is invariant #1.
38
+
39
+ ### 2. Fail closed on ambiguity — which forces full git history
40
+
41
+ Ownership is decided by: _is the bundle's checkpoint commit a git-ancestor of
42
+ (or equal to) the change's HEAD?_ (`git merge-base --is-ancestor`). On a shallow
43
+ clone that check is unresolvable (exit 128) and MUST be treated as stale/fail,
44
+ never pass. Therefore the reconcile job's checkout needs full history
45
+ (`fetch-depth: 0`); the default shallow clone would falsely stale every
46
+ legitimate bundle. Cause and required config travel together.
47
+
48
+ ### 3. Compare against the PR head SHA, not the synthetic merge SHA
49
+
50
+ On a `pull_request` trigger, `github.sha` is GitHub's ephemeral merge commit
51
+ (`refs/pull/N/merge`) — a commit no locally-sealed checkpoint ever stamps. Use
52
+ `pull_request.head.sha` for the ownership comparison (fall back to `github.sha`
53
+ only on `push`/`workflow_dispatch`, where it IS the real commit). Get this wrong
54
+ and every bundle falsely stales. Silent footgun; call it out.
55
+
56
+ ### 4. Post-merge is a deliberate no-op — don't re-gate it
57
+
58
+ A squash-merge creates a new commit with no git ancestry back to the
59
+ feature-branch commit the checkpoint was sealed against. The reconcile job on
60
+ the post-merge `main` push must be a loud no-op: gating already happened at PR
61
+ time. Event-scope enforcement by trigger (`pull_request` gates; `push` to `main`
62
+ observes). Do not "strengthen" this into a main-branch gate — it will only ever
63
+ falsely fail on squash ancestry.
64
+
65
+ ### 5. Bundles seal to the work-commit and tolerate lag — don't regenerate per push
66
+
67
+ The ancestor check (§2) plus the fresh re-run (§1) absorb new commits landing on
68
+ top of a sealed checkpoint. Re-seal only when the _claim set_ materially
69
+ changes, not on every commit. A bundle sealed at commit A is still valid at
70
+ HEAD B as long as A is an ancestor of B. Building "regenerate on every push"
71
+ flows is brittle and unnecessary.
72
+
73
+ ## Claims (and the single worst trap)
74
+
75
+ ### 6. Separate executable manifest commands from human-readable evidence — never `bash -lc` the prose
76
+
77
+ If you build any re-check/backstop layer, it must reconcile ONLY against
78
+ declared, runnable manifest commands. Attestation summaries, check descriptions,
79
+ and acceptance-criteria prose are DATA, not code. Re-executing a check's
80
+ _summary_ as `bash -lc "<summary text>"` yields garbage exit codes (2/127) and
81
+ false "caught false-completion" alarms — noise that can mask a real failure
82
+ sitting in the same run. This is the highest-frequency failure mode observed in
83
+ practice; guard against it explicitly.
84
+
85
+ ### 7. `not_verified`-by-design is correct, not a gap
86
+
87
+ An agent that cannot run a command-backed check should record it at
88
+ `not_verified` with the exact reconcile-manifest command attached; CI runs it
89
+ for real and reconciles. This is the auditor-session pattern. Do not let agents
90
+ "helpfully" self-mark those `pass` — that reintroduces gaming. Require every
91
+ command-backed claim to either name its exact manifest command or be typed
92
+ `external` (an independent-review/human attestation that CI does not re-run).
93
+
94
+ ## Storage & retention (git is the authority)
95
+
96
+ ### 8. Two stores, two retention tiers
97
+
98
+ Git is the authority: the bundle is committed (`delivery/<slug>/trust.bundle`)
99
+ and pinned to the merge commit — permanent, distributed, survives any console
100
+ outage. The database/console is a _rebuildable, queryable projection_ over those
101
+ bundles. Keep coarse audit records (bundles, decisions, gate/claim outcomes)
102
+ long; expire and roll up the fine-grained raw telemetry firehose. Retention here
103
+ is a cost decision, not a correctness one.
104
+
105
+ Rule of thumb from real data: one delivery ≈ a handful of small bundle rows; a
106
+ single working session ≈ tens of thousands of raw tool-event rows. The bundles
107
+ are not what grows — the raw event stream is. Prune the firehose; keep the
108
+ ledger.
109
+
110
+ ### 9. Make the projection actually rebuildable from the authority
111
+
112
+ If the console cannot re-hydrate itself from the committed bundles across repos,
113
+ then "the DB is just a cache of git" is false in practice — a restart/wipe loses
114
+ queryability until producers re-push. If you claim the projection is derived,
115
+ build the backfill/import from `delivery/*/trust.bundle` that proves it.
116
+
117
+ ### Bonus: "stale as history" is not "stale as current state"
118
+
119
+ A bundle is a dated receipt; it never becomes _wrong_, it only misleads if you
120
+ surface an old one as _current_ truth. The query layer answers "true now?" from
121
+ latest-state-per-subject and "true at commit X?" from the bundle. The same
122
+ principle keeps the audit ledger from leaking into the operational
123
+ "needs-attention" view — attention is a view-filter (terminal-state + recency),
124
+ never a delete-sweep of history.
125
+
126
+ ## The tagline
127
+
128
+ **The agent proposes, CI disposes, git remembers, the console indexes — and
129
+ nothing re-executes prose.**
package/docs/index.md CHANGED
@@ -4,24 +4,24 @@ title: Kontour Flow Agents
4
4
 
5
5
  # Flow Agents
6
6
 
7
- <p class="home-lede">A portable process-discipline layer for agentic work: canonical policies, evidence, and telemetry that compile to whatever hook surface a host exposescoding-agent harnesses today, agent frameworks next. Flow Agents keeps work inspectable from idea to release readiness so you ask for outcomes and the system supplies the path, the state, the checks, and the proof.</p>
7
+ <p class="home-lede">A portable process-discipline layer for agentic work: a kit-neutral engine for FlowDefinition interpretation, gates, runtime adapters, evidence, trust, and kit validationplus opt-in kits such as Builder, Knowledge, Release Evidence, and Veritas Governance. Flow Agents keeps work inspectable so you ask for outcomes and the selected kit supplies the path, the state, the checks, and the proof.</p>
8
8
 
9
9
  <div class="value-grid">
10
10
  <section>
11
- <strong>Four canonical policies</strong>
12
- <span>Workflow steering, quality gate, stop-goal-fit, and config protection — each a canonical script under <code>scripts/hooks/</code> that compiles to the host's native hook format. Claude Code and Codex are the L2 reference implementations.</span>
11
+ <strong>Kit-neutral engine</strong>
12
+ <span>FlowDefinition interpretation, gates, runtime and harness adapters, SDK/evidence/trust primitives, and kit validation. The engine is not Builder Kit; Builder is one kit on top.</span>
13
13
  </section>
14
14
  <section>
15
15
  <strong>Survive context loss</strong>
16
- <span>Durable sidecar state under <code>.flow-agents/</code> records acceptance criteria, evidence, critique, and handoff, so any session resumes from recorded state instead of chat memory.</span>
16
+ <span>Durable sidecar state under <code>.kontourai/flow-agents/</code> records acceptance criteria, evidence, critique, and handoff, so any session resumes from recorded state instead of chat memory.</span>
17
17
  </section>
18
18
  <section>
19
- <strong>Evidence over confidence</strong>
20
- <span>Hooks catch stop-short behavior, and important work ends with tests, browser checks, CI results, review findings, or an explicit <code>NOT_VERIFIED</code> gap never just a confident summary.</span>
19
+ <strong>Tamper-evident trust</strong>
20
+ <span>Local capture is advisory and best-effort; the controlled CI re-run reconciles manifest commands and git diff as the authoritative anchor before evidence is treated as CI-verified.</span>
21
21
  </section>
22
22
  <section>
23
23
  <strong>Flow Kits — workflow + output shape</strong>
24
- <span>A kit bundles a workflow and its opinionated output shape as a validated, installable unit. Two reference kits ship today: Builder Kit (shaping → delivery pipeline) and Knowledge Kit (gated store with five pipeline flows, pluggable adapters, and an Obsidian rendering layer). <a href="kit-authoring-guide.html">Author your own</a> using the same path.</span>
24
+ <span>A kit bundles flows and optional skills, docs, adapters, evals, and assets as a validated, installable unit. The catalog lists Builder, Knowledge, Release Evidence, and Veritas Governance; <a href="kit-authoring-guide.html">bring your own kit</a> through the same manifest path.</span>
25
25
  </section>
26
26
  </div>
27
27
 
@@ -45,7 +45,9 @@ flowchart LR
45
45
  Evidence -->|not verified| Plan
46
46
  ```
47
47
 
48
- Flow Agents adds the operating layer around the model: skills choose the right workflow, sidecars preserve state, hooks enforce the four canonical policies, and evals keep the bundle honest as it changes. The gate semantics underneath — definitions, runs, evidence, route-back — belong to <a href="https://kontourai.github.io/flow/">Kontour Flow</a>; Flow Agents compiles those policies to whatever hook surface a host exposes.
48
+ Flow Agents adds the operating layer around the model: the engine preserves state, evaluates evidence, activates selected kits, renders structured kit triggers, and compiles canonical policies to host hooks. The gate semantics underneath — definitions, runs, evidence, route-back — belong to <a href="https://kontourai.github.io/flow/">Kontour Flow</a>.
49
+
50
+ Kits supply the workflow. Builder and Knowledge are examples on the engine, not the engine itself. The built-in catalog also includes Release Evidence and Veritas Governance, both useful proof points that a kit can be agentless and still run through the same manifest and gate model.
49
51
 
50
52
  ## Process-discipline layer
51
53
 
@@ -78,7 +80,11 @@ Install into your workspace in one command:
78
80
  npx @kontourai/flow-agents init --runtime <your-agent> --dest .
79
81
  ```
80
82
 
81
- Where `--runtime` is `claude-code`, `codex`, `kiro`, `opencode`, or `pi`. The Builder Kit installs automatically and gives your agent two gated flows: `builder.shape` (idea → slices → filed work items) and `builder.build` (selected work item → design probe → plan → execute → verify → PR → learn).
83
+ Where `--runtime` is `claude-code`, `codex`, `kiro`, `opencode`, or `pi`. Kits are opt-in. Activate Builder when you want its two gated flows: `builder.shape` (idea → slices → filed work items) and `builder.build` (selected work item → design probe → plan → execute → verify → PR → learn).
84
+
85
+ ```bash
86
+ npx @kontourai/flow-agents init --runtime <your-agent> --dest . --activate-kit builder
87
+ ```
82
88
 
83
89
  Ask your agent to shape an idea:
84
90
 
@@ -110,6 +116,10 @@ Use fix-bug. Reproduce the problem, diagnose root cause, implement the fix, and
110
116
  <strong>Builder Kit Quick Start</strong>
111
117
  <span>Zero to a running, gated build flow in two minutes: install, shape an idea into a work item, build it through the builder.shape and builder.build flows, and see what the evidence gates do.</span>
112
118
  </a>
119
+ <a class="doc-card" href="architecture-engine-and-kits.html">
120
+ <strong>Engine and Kits</strong>
121
+ <span>The canonical split: product-neutral engine, opt-in kits, catalog + kit.json plugin model, structured workflow triggers, and marketplace metadata with no runtime privilege.</span>
122
+ </a>
113
123
  <a class="doc-card" href="workflow-usage-guide.html">
114
124
  <strong>Workflow Usage Guide</strong>
115
125
  <span>Every stage from shaping ideas to learning review, with example prompts and expected behavior.</span>
@@ -118,6 +128,10 @@ Use fix-bug. Reproduce the problem, diagnose root cause, implement the fix, and
118
128
  <strong>System Guidebook</strong>
119
129
  <span>The plain-language map of how Flow Agents is assembled and how it should feel to use.</span>
120
130
  </a>
131
+ <a class="doc-card" href="coordination-guide.html">
132
+ <strong>Parallel-Session Coordination</strong>
133
+ <span>Run many sessions against one repo without collisions: the two-stream model (liveness + assignment), the four guard points, the one hard publish fence, and how delivery defends itself.</span>
134
+ </a>
121
135
  <a class="doc-card" href="skills-map.html">
122
136
  <strong>Workflow Map</strong>
123
137
  <span>See the core skills, gates, artifacts, and route-back behavior.</span>