@kontourai/flow-agents 2.3.0 → 2.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 (250) hide show
  1. package/.github/CODEOWNERS +8 -0
  2. package/.github/workflows/ci.yml +32 -0
  3. package/AGENTS.md +4 -4
  4. package/CHANGELOG.md +39 -0
  5. package/CONTEXT.md +14 -0
  6. package/README.md +9 -3
  7. package/agents/dev.json +1 -1
  8. package/agents/tool-code-reviewer.json +1 -1
  9. package/agents/tool-planner.json +3 -3
  10. package/agents/tool-verifier.json +3 -3
  11. package/build/src/cli/console-learning-projection.js +3 -2
  12. package/build/src/cli/init.js +104 -21
  13. package/build/src/cli/kit.js +37 -6
  14. package/build/src/cli/pull-work-provider.js +1 -1
  15. package/build/src/cli/usage-feedback.js +3 -3
  16. package/build/src/cli/validate-hook-influence.js +1 -0
  17. package/build/src/cli/validate-workflow-artifacts.js +22 -6
  18. package/build/src/cli/workflow-artifact-cleanup-audit.js +36 -2
  19. package/build/src/cli/workflow-sidecar.d.ts +14 -7
  20. package/build/src/cli/workflow-sidecar.js +792 -69
  21. package/build/src/flow-kit/validate.d.ts +23 -0
  22. package/build/src/flow-kit/validate.js +67 -1
  23. package/build/src/index.d.ts +1 -1
  24. package/build/src/index.js +1 -1
  25. package/build/src/lib/flow-resolver.d.ts +6 -4
  26. package/build/src/lib/flow-resolver.js +125 -58
  27. package/build/src/lib/local-artifact-root.d.ts +14 -2
  28. package/build/src/lib/local-artifact-root.js +22 -5
  29. package/build/src/lib/workflow-learning-projection.js +2 -2
  30. package/build/src/runtime-adapters.d.ts +12 -0
  31. package/build/src/runtime-adapters.js +56 -16
  32. package/build/src/tools/build-universal-bundles.js +49 -16
  33. package/build/src/tools/generate-context-map.js +10 -8
  34. package/build/src/tools/validate-source-tree.js +23 -1
  35. package/console.telemetry.json +22 -0
  36. package/context/contracts/artifact-contract.md +38 -7
  37. package/context/contracts/builder-kit-workflow-state-contract.md +3 -2
  38. package/context/contracts/decision-registry-contract.md +263 -0
  39. package/context/contracts/delivery-contract.md +1 -1
  40. package/context/contracts/planning-contract.md +2 -1
  41. package/context/contracts/review-contract.md +5 -3
  42. package/context/contracts/verification-contract.md +9 -1
  43. package/context/contracts/work-item-contract.md +1 -1
  44. package/context/deferred/parallelization.md +1 -1
  45. package/context/gate-awareness.md +4 -4
  46. package/context/scripts/git-status.sh +2 -2
  47. package/context/scripts/hooks/config-protection.js +502 -2
  48. package/context/scripts/hooks/lib/config-protection-remedies.js +69 -0
  49. package/context/scripts/hooks/run-hook.js +14 -1
  50. package/context/scripts/hooks/stop-goal-fit.js +1140 -99
  51. package/context/scripts/hooks/workflow-steering.js +212 -6
  52. package/docs/adr/0007-flow-skill-kit-tool-boundary.md +2 -0
  53. package/docs/adr/0015-flow-flow-agents-boundary-reconciliation.md +35 -0
  54. package/docs/adr/0019-kit-dependency-ownership.md +62 -0
  55. package/docs/adr/0020-trust-reconcile-manifest-and-claim-classification.md +290 -0
  56. package/docs/adr/0021-assignment-leases-and-stale-claim-takeover.md +221 -0
  57. package/docs/adr/0022-fail-closed-delivery-reconciliation-with-governed-exemptions.md +283 -0
  58. package/docs/agent-system-guidebook.md +3 -3
  59. package/docs/agent-usage-feedback-loop.md +6 -6
  60. package/docs/context-map.md +9 -7
  61. package/docs/decisions/decision-records.md +57 -0
  62. package/docs/decisions/index.md +14 -0
  63. package/docs/decisions/promotion-gate.md +52 -0
  64. package/docs/developer-architecture.md +1 -1
  65. package/docs/fixture-ownership.md +3 -0
  66. package/docs/flow-kit-repository-contract.md +5 -5
  67. package/docs/getting-started.md +12 -2
  68. package/docs/integrations/harness-install.md +2 -1
  69. package/docs/kit-authoring-guide.md +64 -5
  70. package/docs/knowledge-kit.md +5 -1
  71. package/docs/learnings/2026-07-improvement-program.md +203 -0
  72. package/docs/migrations.md +6 -5
  73. package/docs/north-star.md +2 -2
  74. package/docs/operating-layers.md +4 -3
  75. package/docs/repository-structure.md +5 -5
  76. package/docs/skills-map.md +8 -8
  77. package/docs/spec/runtime-hook-surface.md +19 -15
  78. package/docs/spikes/graph-provider-2026-07.md +155 -0
  79. package/docs/standards-register.md +7 -7
  80. package/docs/trust-anchor-adoption.md +105 -4
  81. package/docs/work-item-adapters.md +1 -1
  82. package/docs/workflow-artifact-lifecycle.md +72 -9
  83. package/docs/workflow-eval-strategy.md +3 -3
  84. package/docs/workflow-shared-contracts.md +1 -1
  85. package/docs/workflow-usage-guide.md +254 -21
  86. package/evals/acceptance/DEMO-false-completion.md +20 -11
  87. package/evals/acceptance/prove-capture-teeth-declared.sh +15 -15
  88. package/evals/acceptance/prove-capture-teeth.sh +11 -11
  89. package/evals/acceptance/test_kiro_harness.sh +1 -1
  90. package/evals/ci/antigaming-suite.sh +5 -0
  91. package/evals/ci/run-baseline.sh +65 -1
  92. package/evals/fixtures/flow-kit-repository/invalid-bad-dependency/flows/review.flow.json +26 -0
  93. package/evals/fixtures/flow-kit-repository/invalid-bad-dependency/kit.json +13 -0
  94. package/evals/fixtures/flow-kit-repository/valid-with-dependency/flows/review.flow.json +26 -0
  95. package/evals/fixtures/flow-kit-repository/valid-with-dependency/kit.json +13 -0
  96. package/evals/fixtures/hook-influence/cases.json +32 -0
  97. package/evals/fixtures/pull-work-provider/github-issues.json +6 -6
  98. package/evals/fixtures/trust-reconcile-exploits/fabricated-attestation.json +59 -0
  99. package/evals/fixtures/trust-reconcile-exploits/no-label-bypass.json +36 -0
  100. package/evals/fixtures/trust-reconcile-exploits/skip-assumed-bypass.json +59 -0
  101. package/evals/fixtures/trust-reconcile-exploits/status-misassertion.json +48 -0
  102. package/evals/fixtures/trust-reconcile-exploits/waived-command-check.json +44 -0
  103. package/evals/fixtures/trust-reconcile-mixed-bundle/mixed-bundle.json +159 -0
  104. package/evals/fixtures/trust-reconcile-ws3/ws3-bundle.json +920 -0
  105. package/evals/integration/test_actor_identity.sh +254 -0
  106. package/evals/integration/test_builder_step_producers.sh +33 -23
  107. package/evals/integration/test_bundle_install.sh +22 -16
  108. package/evals/integration/test_bundle_lifecycle.sh +11 -11
  109. package/evals/integration/test_captured_fail_reconciliation.sh +50 -50
  110. package/evals/integration/test_checkpoint_signing.sh +43 -0
  111. package/evals/integration/test_claim_lookup.sh +4 -4
  112. package/evals/integration/test_codex_hook_resolution.sh +114 -0
  113. package/evals/integration/test_command_log_concurrency.sh +8 -8
  114. package/evals/integration/test_command_log_fork_classification.sh +3 -3
  115. package/evals/integration/test_command_log_integrity.sh +16 -16
  116. package/evals/integration/test_console_learning_projection.sh +1 -1
  117. package/evals/integration/test_dual_emit_flow_step.sh +145 -0
  118. package/evals/integration/test_enforcer_expects_driven.sh +12 -12
  119. package/evals/integration/test_evidence_capture_hook.sh +14 -13
  120. package/evals/integration/test_fixture_retirement_audit.sh +2 -2
  121. package/evals/integration/test_flow_agents_statusline.sh +2 -2
  122. package/evals/integration/test_flow_kit_install_git.sh +52 -0
  123. package/evals/integration/test_flow_kit_repository.sh +2 -0
  124. package/evals/integration/test_flowdef_session_activation.sh +6 -6
  125. package/evals/integration/test_flowdef_union_floor_regression.sh +429 -0
  126. package/evals/integration/test_gate_bypass_chain.sh +52 -40
  127. package/evals/integration/test_gate_lockdown.sh +97 -73
  128. package/evals/integration/test_gate_review_inquiry_records.sh +3 -3
  129. package/evals/integration/test_goal_fit_escape_hatch.sh +10 -10
  130. package/evals/integration/test_goal_fit_ghost_session.sh +104 -0
  131. package/evals/integration/test_goal_fit_hook.sh +32 -32
  132. package/evals/integration/test_goal_fit_rederive.sh +9 -9
  133. package/evals/integration/test_hook_category_behaviors.sh +103 -0
  134. package/evals/integration/test_hook_influence_cases.sh +1 -0
  135. package/evals/integration/test_install_merge.sh +262 -1
  136. package/evals/integration/test_kit_identity_trust.sh +6 -6
  137. package/evals/integration/test_liveness_conflict_injection.sh +587 -0
  138. package/evals/integration/test_liveness_heartbeat.sh +677 -0
  139. package/evals/integration/test_liveness_verdict.sh +394 -0
  140. package/evals/integration/test_local_flow_kit_install.sh +15 -0
  141. package/evals/integration/test_phase_map_and_gate_claim.sh +63 -11
  142. package/evals/integration/test_promote_gate.sh +178 -0
  143. package/evals/integration/test_publish_delivery.sh +2 -2
  144. package/evals/integration/test_pull_work_liveness_preflight.sh +386 -0
  145. package/evals/integration/test_pull_work_provider.sh +2 -2
  146. package/evals/integration/test_reconcile_soundness.sh +4 -4
  147. package/evals/integration/test_resolvefirststep_security.sh +22 -0
  148. package/evals/integration/test_runtime_adapter_activation.sh +87 -18
  149. package/evals/integration/test_session_resume_roundtrip.sh +147 -0
  150. package/evals/integration/test_sidecar_field_preservation.sh +249 -0
  151. package/evals/integration/test_trust_reconcile.sh +2 -2
  152. package/evals/integration/test_trust_reconcile_manifest.sh +79 -0
  153. package/evals/integration/test_trust_reconcile_mixed_bundle.sh +96 -0
  154. package/evals/integration/test_trust_reconcile_negatives.sh +151 -0
  155. package/evals/integration/test_usage_feedback_global.sh +5 -5
  156. package/evals/integration/test_validate_artifacts_portability.sh +60 -0
  157. package/evals/integration/test_verify_cli.sh +2 -2
  158. package/evals/integration/test_veritas_governance_kit.sh +117 -0
  159. package/evals/integration/test_workflow_artifact_cleanup_audit.sh +26 -1
  160. package/evals/integration/test_workflow_artifacts.sh +33 -0
  161. package/evals/integration/test_workflow_sidecar_writer.sh +723 -74
  162. package/evals/integration/test_workflow_steering_hook.sh +175 -5
  163. package/evals/lib/codex-provider.sh +1 -1
  164. package/evals/lib/node.sh +19 -1
  165. package/evals/run.sh +22 -0
  166. package/evals/static/test_decisions.sh +150 -0
  167. package/evals/static/test_flowdef_codeowners_coverage.sh +56 -0
  168. package/evals/static/test_package.sh +19 -10
  169. package/evals/static/test_universal_bundles.sh +48 -3
  170. package/evals/static/test_workflow_skills.sh +41 -8
  171. package/kits/builder/flows/build.flow.json +3 -74
  172. package/kits/builder/flows/publish-learn.flow.json +90 -0
  173. package/kits/builder/kit.json +11 -0
  174. package/kits/builder/skills/builder-shape/SKILL.md +1 -1
  175. package/kits/builder/skills/deliver/SKILL.md +13 -11
  176. package/kits/builder/skills/design-probe/SKILL.md +4 -4
  177. package/kits/builder/skills/evidence-gate/SKILL.md +26 -1
  178. package/kits/builder/skills/execute-plan/SKILL.md +2 -2
  179. package/kits/builder/skills/fix-bug/SKILL.md +2 -0
  180. package/kits/builder/skills/gate-review/SKILL.md +6 -6
  181. package/kits/builder/skills/idea-to-backlog/SKILL.md +1 -1
  182. package/kits/builder/skills/learning-review/SKILL.md +7 -7
  183. package/kits/builder/skills/pickup-probe/SKILL.md +5 -4
  184. package/kits/builder/skills/plan-work/SKILL.md +27 -5
  185. package/kits/builder/skills/pull-work/SKILL.md +80 -5
  186. package/kits/builder/skills/release-readiness/SKILL.md +4 -4
  187. package/kits/builder/skills/review-work/SKILL.md +24 -1
  188. package/kits/builder/skills/tdd-workflow/SKILL.md +2 -0
  189. package/kits/builder/skills/verify-work/SKILL.md +8 -1
  190. package/kits/catalog.json +6 -0
  191. package/kits/veritas-governance/adapter/readiness-to-trust-bundle.mjs +178 -0
  192. package/kits/veritas-governance/docs/README.md +75 -0
  193. package/kits/veritas-governance/fixtures/readiness/not-ready.readiness-report.json +4645 -0
  194. package/kits/veritas-governance/fixtures/readiness/ready.readiness-report.json +4403 -0
  195. package/kits/veritas-governance/flows/readiness-check.flow.json +35 -0
  196. package/kits/veritas-governance/kit.json +16 -0
  197. package/package.json +8 -4
  198. package/packaging/README.md +2 -2
  199. package/packaging/conformance/fixtures/config-protection--allow-read-state-json.json +20 -0
  200. package/packaging/conformance/fixtures/config-protection--block-write-state-json.json +20 -0
  201. package/packaging/conformance/fixtures/stop-goal-fit--block-bundle-disputed-claim.json +1 -1
  202. package/packaging/conformance/fixtures/stop-goal-fit--block-capture-contradicts-claimed-pass.json +1 -1
  203. package/packaging/manifest.json +9 -10
  204. package/schemas/decision-record.schema.json +109 -0
  205. package/schemas/workflow-evidence.schema.json +1 -1
  206. package/schemas/workflow-state.schema.json +5 -0
  207. package/scripts/README.md +8 -3
  208. package/scripts/check-content-boundary.cjs +1 -1
  209. package/scripts/check-decisions.cjs +356 -0
  210. package/scripts/ci/derive-claim-status.mjs +74 -0
  211. package/scripts/ci/trust-reconcile.js +436 -79
  212. package/scripts/git-status.sh +2 -2
  213. package/scripts/hooks/claude-telemetry-hook.js +37 -3
  214. package/scripts/hooks/codex-telemetry-hook.js +36 -2
  215. package/scripts/hooks/config-protection.js +102 -30
  216. package/scripts/hooks/evidence-capture.js +3 -3
  217. package/scripts/hooks/lib/actor-identity.js +368 -0
  218. package/scripts/hooks/lib/config-protection-remedies.js +69 -0
  219. package/scripts/hooks/lib/liveness-heartbeat.js +361 -0
  220. package/scripts/hooks/lib/liveness-policy.js +127 -0
  221. package/scripts/hooks/lib/liveness-read.js +105 -12
  222. package/scripts/hooks/lib/liveness-write.js +46 -0
  223. package/scripts/hooks/lib/local-artifact-paths.js +12 -6
  224. package/scripts/hooks/opencode-telemetry-hook.js +27 -1
  225. package/scripts/hooks/pi-telemetry-hook.js +27 -1
  226. package/scripts/hooks/stop-goal-fit.js +157 -26
  227. package/scripts/hooks/workflow-steering.js +77 -3
  228. package/scripts/install-codex-home.sh +138 -38
  229. package/scripts/statusline/flow-agents-statusline.js +2 -2
  230. package/src/cli/console-learning-projection.ts +3 -2
  231. package/src/cli/init.ts +101 -21
  232. package/src/cli/kit.ts +37 -6
  233. package/src/cli/public-api.test.mjs +58 -6
  234. package/src/cli/pull-work-provider.ts +1 -1
  235. package/src/cli/trust-bundle-policy-order.test.mjs +87 -0
  236. package/src/cli/usage-feedback.ts +3 -3
  237. package/src/cli/validate-hook-influence.ts +1 -0
  238. package/src/cli/validate-workflow-artifacts.ts +22 -6
  239. package/src/cli/veritas-readiness-adapter.test.mjs +267 -0
  240. package/src/cli/workflow-artifact-cleanup-audit.ts +35 -2
  241. package/src/cli/workflow-sidecar.ts +795 -71
  242. package/src/flow-kit/validate.ts +74 -1
  243. package/src/index.ts +6 -2
  244. package/src/lib/flow-resolver.ts +123 -55
  245. package/src/lib/local-artifact-root.ts +24 -5
  246. package/src/lib/workflow-learning-projection.ts +2 -2
  247. package/src/runtime-adapters.ts +61 -15
  248. package/src/tools/build-universal-bundles.ts +49 -16
  249. package/src/tools/generate-context-map.ts +10 -8
  250. package/src/tools/validate-source-tree.ts +23 -1
@@ -0,0 +1,283 @@
1
+ ---
2
+ title: "ADR 0022: Fail-Closed Delivery Reconciliation with Governed Exemptions"
3
+ ---
4
+
5
+ # ADR 0022: Fail-Closed Delivery Reconciliation with Governed Exemptions
6
+
7
+ **Date:** 2026-07-02
8
+ **Status:** Proposed (shaped with Brian Anderson, 2026-07-02). Refines the Layer-2 CI
9
+ anchor established in [ADR 0017](./0017-anti-gaming-trust-security-model.md) and hardened in
10
+ [ADR 0020](./0020-trust-reconcile-manifest-and-claim-classification.md); does not change
11
+ their layered-defense posture.
12
+
13
+ ---
14
+
15
+ ## Context
16
+
17
+ `scripts/ci/trust-reconcile.js` — the external CI trust anchor ADR 0017 designed as the
18
+ un-forgeable Layer-2 boundary — has run **fail-open on bundle absence** since it existed. Its
19
+ own header states the behavior plainly:
20
+
21
+ > "Fail-open on bundle absence: if no bundle is provided (and none auto-discovered at
22
+ > `delivery/trust.bundle` or `delivery/trust.checkpoint.json`), only the fresh verify is
23
+ > enforced."
24
+
25
+ `discoverBundle()` (trust-reconcile.js:461-470) returns `null` when neither file exists, and
26
+ `runTrustReconcile()` (trust-reconcile.js:529-533) treats `null` as "Step 2 does not apply" —
27
+ Step 1 (fresh `npm run build && npm run eval:static`) still runs, but the actual anti-gaming
28
+ machinery ADR 0017/0020 built — reconciling claimed-pass commands, catching laundering,
29
+ catching never-captured claims, catching status-misassertion — never engages. The bundle is
30
+ also **fail-soft to produce**: `publishDelivery()` (`src/cli/workflow-sidecar.ts`, documented
31
+ in `delivery/README.md`) "does nothing if `trust.bundle` is absent (no crash, no error)." So
32
+ the single condition that turns Layer 2 on or off — whether a bundle exists in the diff — is
33
+ entirely under the delivering agent's control, and skipping it costs nothing and raises no
34
+ alarm.
35
+
36
+ That is a **kill switch by omission**: the agent, not an external anchor, decides whether the
37
+ anchor applies. This directly contradicts ADR 0017's own threat model ("no purely-local
38
+ control is airtight; the authoritative anchor must live somewhere the agent cannot
39
+ pre-disable or post-forge") — except here the "pre-disable" move is not a local hack at all,
40
+ it is simply *not delivering the artifact CI depends on to reconcile*, and CI accepts that
41
+ silently.
42
+
43
+ The historical record makes the exposure concrete, not theoretical: every PR before #265
44
+ passed the Trust Reconcile lane trivially via bundle absence (`git log --follow --
45
+ delivery/trust.bundle` shows the file's first appearance at #269, "veritas-governance kit —
46
+ readiness→trust-bundle adapter with settled gate semantics" — the first live,
47
+ capture-backed publish this repository ever produced). For roughly the entire history of the
48
+ anchor, Layer 2 has been running Step 1 only.
49
+
50
+ ## Decision
51
+
52
+ ### 1. The predicate: every change is agent-delivered by default; identification signals inform, never gate
53
+
54
+ Research into how agent-delivered changes are identifiable today turned up three candidate
55
+ signals, and all three share the same flaw: **they are agent-writable, agent-omittable, or
56
+ both.**
57
+
58
+ | Signal | Where it lives | What it proves when present | Why it cannot gate alone |
59
+ |---|---|---|---|
60
+ | Runtime-session commit trailer (`Claude-Session: https://claude.ai/code/session_...`, and the analogous `Codex-Session:` / `Opencode-Session:` / `Pi-Session:` forms implied by the same runtime set the actor-identity resolver already enumerates, `scripts/hooks/lib/actor-identity.js:58-65` `RUNTIME_SESSION_ID_VARS`) | Free text the agent appends to its own commit message | Positive proof of agent delivery, attributable to a runtime/session | Purely self-asserted; an agent that wants to hide simply omits the trailer. No repo code enforces its presence today — it is observed convention (present on essentially every recent merged PR per `git log`), not a contract. |
61
+ | `delivery/trust.bundle` / `trust.checkpoint.json` present in the diff | Committed transport path (`delivery/README.md`) | Positive proof of agent delivery (only `publishDelivery()` writes these) | This is the exact signal already in play — its **absence** is today's loophole. Trusting presence-only leaves absence exactly as exploitable as it is now. |
62
+ | A "required marker" naming the delivering agent | Does not exist today | Would prove delivery mechanism | Nothing in the codebase currently stamps a required, non-omittable, non-agent-writable marker of agent origin. |
63
+
64
+ No positive-detection signal can be the enforcement gate, because closing a gap that an agent
65
+ controls by omission with *another* agent-controlled, omittable signal reproduces the same
66
+ bug one layer up. The predicate therefore **inverts**: reconciliation applies to every change
67
+ by default. The three signals above are retained as **diagnostic and audit inputs only** —
68
+ they explain and attribute what the anchor already treats as agent-delivered; they do not
69
+ decide whether it treats it that way. Concretely, per signal:
70
+
71
+ 1. **Commit trailer present** — logged by the reconciler (new `[trust-reconcile] identified:
72
+ runtime-session trailer '<trailer>' on <ref>` line) for audit; does not change the exit
73
+ path. Reconciliation already applies (default).
74
+ 2. **`delivery/trust.bundle` present** — unchanged from today: Step 2's existing
75
+ reconcile-against-manifest logic (ADR 0020) runs exactly as it does now.
76
+ 3. **Neither present (today's common "nothing shipped" case, indistinguishable from a
77
+ legitimate human-only PR)** — this is the ambiguous case, and it is the one the fail-open
78
+ bug lived in. It now resolves to **agent-delivered, fail closed**: `trust-reconcile.js`'s
79
+ bundle-absence branch gains a new check — is there a well-formed DECLARED marker (§2) in
80
+ scope for this ref? No → **new divergence type**, `bundle-required-no-declared-marker`,
81
+ job exits 1. Yes → exempted, see below.
82
+ 4. **Malformed DECLARED marker** (missing any of the four required fields, §2) — treated as
83
+ absent; falls through to case 3's fail-closed default, with a diagnostic naming the
84
+ missing field(s) so a human fixing it does not have to guess the schema.
85
+
86
+ ### 2. The DECLARED no-agent-delivery marker
87
+
88
+ Humans and other legitimate non-agent changes (release-automation bots, direct maintainer
89
+ pushes) opt out via a committed `delivery/DECLARED` JSON file — the same `delivery/`
90
+ transport path `trust.bundle` already uses, so the anchor gains exactly one new
91
+ auto-discovery target, not a new mechanism:
92
+
93
+ ```json
94
+ {
95
+ "scope": "ref:release-please--branches--main",
96
+ "reason": "release-please automation PR; no agent delivery involved",
97
+ "approved_by": "briananderson1222",
98
+ "declared_at": "2026-07-02T00:00:00Z"
99
+ }
100
+ ```
101
+
102
+ All four fields are required for "well-formed." `scope` matches either a single ref/commit
103
+ range or a durable pattern (author or branch-prefix match — see Consequences for why this
104
+ matters for bot PRs). Presence and content are printed **loudly**, mirroring ADR 0020's
105
+ `WAIVED:` convention exactly:
106
+
107
+ ```
108
+ [trust-reconcile] DECLARED (no-agent-delivery): <scope> — <reason> (approved by <approved_by>, declared <declared_at>)
109
+ ```
110
+
111
+ A DECLARED marker exempts **Step 2 only** (bundle-required enforcement). Step 1 (fresh
112
+ verify) is never exempted by anything in this ADR — a human PR still has to build and pass
113
+ static evals; only the anti-gaming reconcile step, which presumes an agent-produced bundle
114
+ to reconcile against, is skippable, and only with attribution.
115
+
116
+ `delivery/DECLARED` is added to `.github/CODEOWNERS` alongside the other verify-config and
117
+ anchor paths (`/scripts/ci/`, `/package.json`, `/evals/run.sh`) it already lists — the same
118
+ mitigation ADR 0017 Layer 4 uses for every other self-asserted, unauthenticated field
119
+ (`approved_by` on a waiver has the identical shape and the identical residual; carried over
120
+ here rather than re-solved).
121
+
122
+ ### 3. Layering: the governance kit issues and audits; the anchor enforces
123
+
124
+ Per ADR 0017's own framing ("kits declare process; the anchor enforces"), exemption
125
+ *issuance* and *audit* — the human-approval workflow, not the enforcement decision — belong
126
+ in `kits/veritas-governance`, the kit this repository already stood up (#269, migrated #285)
127
+ for exactly this class of "turn a governance verdict into gate evidence" concern. It ships
128
+ today as a single flow/single gate (`flows/readiness-check.flow.json`: step `readiness` →
129
+ gate `gate-check-gate`, requiring a verified `software-readiness-verdict` trust.bundle
130
+ claim). This ADR specifies a second flow of the identical shape:
131
+
132
+ - **`flows/exemption-issuance.flow.json`** — agentless, K0, mirroring
133
+ `readiness-check.flow.json`'s structure: step `request` → gate `human-approval-gate`
134
+ (`expects` a trust.bundle claim of `claimType: "no-agent-delivery-exemption-approval"`,
135
+ `subjectType: "delivery-scope"`, `accepted_statuses: ["verified"]` — satisfiable only by
136
+ human-attached evidence, the same pattern `gate-check-gate` uses for the readiness verdict)
137
+ → step `issue`, which writes the resulting `delivery/DECLARED` file once the gate passes.
138
+ - **`exemption-usage-review`** — a periodic audit skill/flow that walks
139
+ `delivery/DECLARED` history (`git log --follow -- delivery/DECLARED`) merged in a review
140
+ window and surfaces every standing exemption (scope, reason, approver, age) for owner
141
+ re-confirmation — process visibility, not enforcement.
142
+
143
+ The load-bearing property: **uninstalling `veritas-governance` must never weaken
144
+ enforcement.** `trust-reconcile.js`'s marker-reading logic — auto-discover
145
+ `delivery/DECLARED`, require all four fields, print the DECLARED line, exempt Step 2 only —
146
+ lives in `scripts/ci/` (already CODEOWNERS-protected, already anchor-owned) and has zero
147
+ runtime dependency on the kit. A human can hand-author a compliant `delivery/DECLARED`
148
+ without the kit installed; they simply lose the guided issuance flow and the periodic-review
149
+ tooling. This is the concrete test of the layering claim, not just its statement.
150
+
151
+ ### 4. Breaking change — no legacy fallback
152
+
153
+ This changes the exit code of every future agent-delivered change (which, under the inverted
154
+ default, is every change unless explicitly DECLARED otherwise) that does not ship a
155
+ `delivery/trust.bundle`. There is no flag, no grace window, no opt-in period — matching the
156
+ owner's explicit direction to document this as a breaking change rather than carry a legacy
157
+ fail-open path indefinitely. Concretely:
158
+
159
+ - Any PR that today merges by passing Trust Reconcile "trivially via absence" starts failing
160
+ the moment this ships, until it either (a) publishes a bundle via the existing
161
+ `publishDelivery()` path, or (b) carries a DECLARED marker in scope.
162
+ - **Repos consuming `.github/workflows/trust-reconcile.yml` as a template** (ADR 0017 §
163
+ Consequences names this the intended reuse path) must pin to the pre-ADR-0022 commit until
164
+ ready, then adopt in one migration PR that either wires bundle publication into their
165
+ delivery flow or authors an initial `delivery/DECLARED` covering their known non-agent
166
+ actors (see Consequences below for the concrete bot case).
167
+
168
+ ## Scope boundaries
169
+
170
+ **`hasBuild` fail-open in `stop-goal-fit.js` (line 185; `loadActiveFlowStep`,
171
+ lines 305-316) is the same absence-controls-enforcement asymmetry in miniature — it is
172
+ explicitly out of scope for this ADR.** One-line rationale: it is a Layer-1, local,
173
+ **non-authoritative** fallback (its own comment: "Fail-open: returns null when build/ is
174
+ absent... the caller treats null as 'no active FlowDefinition' and falls back to the
175
+ `workflow.*` path") — Layer-1 heuristics were explicitly frozen by
176
+ [ADR 0018](./0018-freeze-local-shell-heuristics.md), which routes *all* new enforcement
177
+ concerns to the external anchor rather than adding local surface. This ADR *is* that
178
+ external-anchor hardening; extending the local `hasBuild` check would both violate the
179
+ freeze and buy nothing, since a determined agent controls its own local `build/` presence
180
+ regardless of what the local heuristic does. Cross-ref: ADR 0017 §Layer 1 vs Layer 2;
181
+ ADR 0018 §Decision.
182
+
183
+ ## Residuals (honest — ADR 0017 §Residuals / ADR 0020 §Residuals style; a bar-raiser, not a wall)
184
+
185
+ - **Forged human attribution.** `approved_by` on `delivery/DECLARED` is free text, not bound
186
+ to an authenticated identity — the identical residual ADR 0020 already carries for
187
+ `WAIVED`'s `approved_by`, and the identical mitigation: the loud, un-suppressible DECLARED
188
+ line plus CODEOWNERS review, not identity attestation. Not solved here; explicitly
189
+ inherited.
190
+ - **Shared credentials collapse the human/agent distinction.** An agent operating under
191
+ commit/push rights indistinguishable from a human collaborator (a shared PAT, a service
192
+ account with CODEOWNERS review rights) can author and approve its own DECLARED marker. This
193
+ is ADR 0017's already-named "trust-the-humans boundary... documented, not closed" —
194
+ unchanged by this ADR.
195
+ - **Identification signals undercount, they do not overcount.** Because the enforcement
196
+ default no longer depends on the commit-trailer or delivery-artifact signals (§1), an agent
197
+ can still freely omit both. Any future audit tooling built on those signals ("which PRs
198
+ were agent-delivered") will therefore undercount attribution — this ADR fixes the
199
+ enforcement default, not attribution completeness.
200
+ - **CI checkout depth limits trailer detection today.** `trust-reconcile.yml`'s
201
+ `actions/checkout` step does not currently widen fetch depth to cover a PR's full commit
202
+ range, so the commit-trailer diagnostic in §1's table is aspirational for CI-side logging
203
+ until checkout is widened. This does not block the ADR: the trailer is diagnostic-only,
204
+ never gating, per §1.
205
+ - **Bot/automation PRs need a durable, not per-PR, DECLARED scope**, or every dependabot /
206
+ release-please PR starts failing the moment this ships (see Consequences). `scope`
207
+ supports author/branch-pattern matching for exactly this reason, but the pattern-matching
208
+ logic itself is new surface this ADR specifies and a future implementation must get right;
209
+ a narrow pattern match is itself a residual surface (a scope pattern that is too broad
210
+ re-opens a blanket exemption).
211
+
212
+ ## Consequences
213
+
214
+ - Trust Reconcile stops being satisfiable by doing nothing. The anti-gaming machinery ADR
215
+ 0017/0020 built (reconcile, laundering screen, status re-derivation, `ATTESTED`/`WAIVED`
216
+ disclosure) now actually runs on every agent-delivered change by default, closing the gap
217
+ the historical record (`delivery/trust.bundle`'s first appearance at #269) shows has been
218
+ open for the anchor's entire prior history.
219
+ - **`dependabot.yml` and `release-please.yml`-authored PRs** (both present in this repo's
220
+ `.github/`) will start failing Trust Reconcile the moment this ships unless a durable,
221
+ author/branch-scoped `delivery/DECLARED` marker is authored for each before rollout — a
222
+ concrete, non-hypothetical migration item, not a theoretical edge case.
223
+ - `veritas-governance` gains a second flow and a periodic-review surface; its "unverified,
224
+ not first-party-allowlisted" trust status (per its own README) is unaffected by this ADR —
225
+ the anchor-side enforcement this ADR specifies works whether or not the kit is installed.
226
+ - `.github/CODEOWNERS` gains one new protected path (`/delivery/DECLARED` or a `/delivery/`
227
+ pattern narrow enough to exclude `trust.bundle`/`trust.checkpoint*`, which remain
228
+ agent-written).
229
+ - Downstream repos treating `trust-reconcile.yml` as a template inherit a breaking change on
230
+ adoption, not a gradual one — flagged explicitly per the owner's direction (§ Decision 4).
231
+
232
+ ## Alternatives Considered
233
+
234
+ - **Positive-detection predicate (trust the commit trailer or bundle presence as the sole
235
+ signal).** Rejected in §1: any agent-writable/omittable positive signal reproduces the
236
+ fail-open bug at one remove — an agent that wants to evade omits the signal being checked,
237
+ exactly as it omits the bundle today.
238
+ - **Extend `hasBuild` / Layer-1 heuristics to close the analogous gap locally.** Rejected —
239
+ violates the ADR 0018 freeze and cannot be authoritative regardless (Scope boundaries,
240
+ above); the correct fix lives in Layer 2, which is what this ADR does.
241
+ - **Grace period / opt-in flag before flipping the default.** Rejected per the owner's
242
+ explicit direction: document as a breaking change, do not carry a legacy fail-open path.
243
+ - **Require cryptographic (Sigstore-signed) attribution for the DECLARED marker instead of
244
+ free-text `approved_by`.** Deferred, not rejected — this is exactly the Assurance-profile
245
+ remedy ADR 0020's Residuals names for the identical `WAIVED` gap ("extending Layer 3's
246
+ keyless-Sigstore minting... to individual human-attestation events"). It does not exist yet
247
+ for waivers; inventing it first for DECLARED markers alone would be inconsistent scope.
248
+ When/if that Assurance profile lands, both `WAIVED` and `DECLARED` should adopt it together.
249
+ - **Put exemption enforcement inside `veritas-governance` itself (kit owns both issuance and
250
+ enforcement).** Rejected — this is precisely the layering ADR 0017 already establishes
251
+ ("kits declare process; the anchor enforces") and the explicit requirement that uninstalling
252
+ a kit must never weaken enforcement; enforcement logic must live anchor-side regardless of
253
+ which kit (if any) is installed.
254
+
255
+ ## References
256
+
257
+ - [ADR 0017: The Anti-Gaming Trust Security Model](./0017-anti-gaming-trust-security-model.md)
258
+ — the layered defense this ADR refines Layer 2 of; the threat-model framing ("no purely-local
259
+ control is airtight") this ADR's problem statement is a direct instance of.
260
+ - [ADR 0018: Freeze the Local Shell-Parsing Heuristics](./0018-freeze-local-shell-heuristics.md)
261
+ — the freeze that puts the `hasBuild` miniature explicitly out of scope and routes this
262
+ ADR's fix to the external anchor instead.
263
+ - [ADR 0020: Trust-Reconcile Manifest, Claim Classification, and Waivers](./0020-trust-reconcile-manifest-and-claim-classification.md)
264
+ — the `WAIVED`/`ATTESTED` disclosure conventions this ADR's `DECLARED` marker mirrors; its
265
+ Residuals section (`approved_by` unauthenticated, mitigated by CODEOWNERS + the loud log
266
+ line) is inherited verbatim for `DECLARED`.
267
+ - `scripts/ci/trust-reconcile.js` (`discoverBundle`, lines 461-470; `runTrustReconcile`
268
+ bundle-absence branch, lines 529-533) — the code this ADR changes.
269
+ - `src/cli/workflow-sidecar.ts` `publishDelivery()` / `delivery/README.md` — confirms the
270
+ bundle is fail-soft to produce today, the root of the omission loophole.
271
+ - `scripts/hooks/lib/actor-identity.js` (`RUNTIME_SESSION_ID_VARS`, lines 58-65) — the
272
+ runtime enumeration the commit-trailer signal's naming is grounded in.
273
+ - `scripts/hooks/stop-goal-fit.js` (`hasBuild`, line 185; `loadActiveFlowStep`, lines
274
+ 305-316) — the Layer-1 miniature explicitly scoped out.
275
+ - `kits/veritas-governance/` (`kit.json`, `flows/readiness-check.flow.json`,
276
+ `docs/README.md`) — the existing kit shape §3's `exemption-issuance.flow.json` mirrors.
277
+ - `.github/CODEOWNERS` — the existing self-asserted-field mitigation pattern extended to
278
+ `delivery/DECLARED`.
279
+ - `.github/dependabot.yml`, `.github/workflows/release-please.yml` — the concrete bot-PR
280
+ migration case named in Consequences.
281
+ - #274 — the issue this ADR resolves; #269 — the first live capture-backed bundle publish
282
+ cited in Context; #265 — the last PR to merge before that (i.e. the boundary of "every PR
283
+ before #265 passed Trust Reconcile trivially via absence").
@@ -73,7 +73,7 @@ The hidden supports are:
73
73
  | “Keep going until nothing is left.” | Use hooks and workflow state to avoid stopping early, then continue through verification and docs. |
74
74
  | “Use subagents to critique.” | Delegate critique as report-only work, record findings, fix failures, and re-run verification. |
75
75
  | “Can we validate this on Flow Agents itself?” | Use Flow Agents artifacts, hooks, evals, and learning loops on Flow Agents itself. |
76
- | “What slug are we on?” | Resolve `.flow-agents/current.json`; do not depend on memory from chat. |
76
+ | “What slug are we on?” | Resolve `.kontourai/flow-agents/current.json`; do not depend on memory from chat. |
77
77
 
78
78
  ## Mental Model
79
79
 
@@ -192,7 +192,7 @@ npm run workflow:sidecar -- current --format path
192
192
  npm run workflow:sidecar -- record-agent-event ...
193
193
  ```
194
194
 
195
- `ensure-session` creates or selects the workflow and writes `.flow-agents/current.json`. `current` resolves the active workflow path. `record-agent-event` lets parallel workers append progress to `agents/<agent-id>/events.jsonl` without guessing the slug.
195
+ `ensure-session` creates or selects the workflow and writes `.kontourai/flow-agents/current.json`. `current` resolves the active workflow path. `record-agent-event` lets parallel workers append progress to `agents/<agent-id>/events.jsonl` without guessing the slug.
196
196
 
197
197
  This is the key answer to multi-agent coordination: agents should not rely on conversational memory for the current slug. The orchestrator resolves the active workflow and passes the path to delegates. Delegates append events. The orchestrator consolidates those events into root state, evidence, critique, and handoff.
198
198
 
@@ -320,7 +320,7 @@ flowchart LR
320
320
  Prompt --> Current --> State --> Handoff --> Evidence --> Action
321
321
  ```
322
322
 
323
- The agent should not reconstruct the session from memory. It should resolve the active workflow from `.flow-agents/current.json`, read the sidecars, and continue from the recorded next action. If evidence is missing, it should say `NOT_VERIFIED` or keep working. If critique is open, it should fix or route the finding. If everything is clean, it can deliver.
323
+ The agent should not reconstruct the session from memory. It should resolve the active workflow from `.kontourai/flow-agents/current.json`, read the sidecars, and continue from the recorded next action. If evidence is missing, it should say `NOT_VERIFIED` or keep working. If critique is open, it should fix or route the finding. If everything is clean, it can deliver.
324
324
 
325
325
  ## One-Page Cheat Sheet
326
326
 
@@ -12,7 +12,7 @@ The loop has three parts:
12
12
  2. Sync quality outcomes from task artifacts, evals, release gates, or humans.
13
13
  3. Report usage and outcome metrics by repo, runtime, profile, prompt, skill, or task type.
14
14
 
15
- Quality outcomes are not inferred from raw telemetry alone. The CLI can automatically derive coarse outcomes from task artifacts such as `.flow-agents/<slug>/*.md`: `delivered` and `complete` become `success`, `failed` becomes `failure`, and optionally open artifacts can be recorded as `not_verified`. It does not invent `quality_score` or `human_minutes_saved`; those remain human/eval/release-gate facts.
15
+ Quality outcomes are not inferred from raw telemetry alone. The CLI can automatically derive coarse outcomes from task artifacts such as `.kontourai/flow-agents/<slug>/*.md`: `delivered` and `complete` become `success`, `failed` becomes `failure`, and optionally open artifacts can be recorded as `not_verified`. It does not invent `quality_score` or `human_minutes_saved`; those remain human/eval/release-gate facts.
16
16
 
17
17
  ## Storage Defaults
18
18
 
@@ -158,7 +158,7 @@ Usage-only metrics can be computed from telemetry. Quality and value metrics req
158
158
 
159
159
  ### Project Dashboard
160
160
 
161
- Generate the local HTML dashboard. This syncs terminal task artifacts from `.flow-agents` into `.telemetry/outcomes.jsonl` before rendering:
161
+ Generate the local HTML dashboard. This syncs terminal task artifacts from `.kontourai/flow-agents` into `.telemetry/outcomes.jsonl` before rendering:
162
162
 
163
163
  ```bash
164
164
  npm run usage-feedback -- dashboard --force
@@ -170,7 +170,7 @@ Sync artifacts without rendering the dashboard:
170
170
 
171
171
  ```bash
172
172
  npm run usage-feedback -- sync-artifacts \
173
- --artifact-dir .flow-agents \
173
+ --artifact-dir .kontourai/flow-agents \
174
174
  --repo flow-agents \
175
175
  --profile-id codex-default \
176
176
  --prompt-id deliver-v1 \
@@ -185,7 +185,7 @@ npm run usage-feedback -- import-codex \
185
185
  --telemetry-dir .telemetry/repo-a \
186
186
  --source-id repo-a \
187
187
  --repo repo-a \
188
- --profile-id codex-kdev \
188
+ --profile-id codex-builder \
189
189
  --prompt-id deliver-v1 \
190
190
  --skill-id deliver
191
191
  ```
@@ -213,7 +213,7 @@ npm run usage-feedback -- record-outcome \
213
213
  --runtime codex \
214
214
  --repo repo-a \
215
215
  --agent dev \
216
- --profile-id codex-kdev \
216
+ --profile-id codex-builder \
217
217
  --prompt-id deliver-v1 \
218
218
  --skill-id deliver \
219
219
  --task-type delivery \
@@ -221,7 +221,7 @@ npm run usage-feedback -- record-outcome \
221
221
  --result success \
222
222
  --quality-score 5 \
223
223
  --human-minutes-saved 35 \
224
- --evidence .flow-agents/agent-usage-feedback-loop/agent-usage-feedback-loop--deliver.md
224
+ --evidence .kontourai/flow-agents/agent-usage-feedback-loop/agent-usage-feedback-loop--deliver.md
225
225
  ```
226
226
 
227
227
  Generate a report:
@@ -10,7 +10,7 @@ Generated by `npm run context-map`. Regenerate after changing agents, skills, sc
10
10
 
11
11
  - Start here when a session is long, resumed, or context-constrained.
12
12
  - Load only the specific skill, contract, schema, or doc that matches the task.
13
- - Treat `.flow-agents` as runtime state and `dist/` as generated output.
13
+ - Treat `.kontourai/flow-agents` as runtime state and `dist/` as generated output.
14
14
 
15
15
  ## Repository Shape
16
16
 
@@ -29,7 +29,8 @@ Generated by `npm run context-map`. Regenerate after changing agents, skills, sc
29
29
  | scripts | canonical copy | Build, validation, hook, telemetry, workflow, and import/export utilities. |
30
30
  | skills | canonical copy | On-demand capability instructions and workflow primitives. |
31
31
  | dist | generated | Generated bundle exports. Do not edit by hand. |
32
- | .flow-agents | runtime | Cross-session workflow artifacts and sidecars. Not committed by default. |
32
+ | .kontourai/flow-agents | runtime | Non-durable workflow artifacts, sidecars, and generated projections. Not committed by default. |
33
+ | .flow-agents | durable local state | Explicit Flow Agents config/install state. Not a runtime artifact fallback. |
33
34
 
34
35
  ## Core Commands
35
36
 
@@ -38,7 +39,7 @@ Generated by `npm run context-map`. Regenerate after changing agents, skills, sc
38
39
  | Source tree | npm run validate:source |
39
40
  | Static suite | bash evals/run.sh static |
40
41
  | Integration suite | bash evals/run.sh integration |
41
- | Workflow artifacts | npm run workflow:validate-artifacts -- --require-sidecars --require-critique .flow-agents/<slug> |
42
+ | Workflow artifacts | npm run workflow:validate-artifacts -- --require-sidecars --require-critique .kontourai/flow-agents/<slug> |
42
43
  | Workflow sidecars | npm run workflow:sidecar -- --help |
43
44
  | Claim lookup | npm run workflow:sidecar -- claim <id> <dir> |
44
45
  | Context map drift | npm run context-map:check |
@@ -46,11 +47,12 @@ Generated by `npm run context-map`. Regenerate after changing agents, skills, sc
46
47
 
47
48
  ## Workflow Sidecars
48
49
 
49
- Machine-readable workflow state lives beside Markdown artifacts in `.flow-agents/<slug>/`.
50
+ Machine-readable workflow state lives beside Markdown artifacts in `.kontourai/flow-agents/<slug>/`.
50
51
 
51
52
  | Schema | Title | ID |
52
53
  | --- | --- | --- |
53
54
  | backlog-provider-settings.schema.json | Flow Agents Backlog Provider Settings | https://flow-agents.dev/schemas/backlog-provider-settings.schema.json |
55
+ | decision-record.schema.json | Flow Agents Decision Record | https://flow-agents.dev/schemas/decision-record.schema.json |
54
56
  | flow-agents-settings.schema.json | Flow Agents Settings | https://flow-agents.dev/schemas/flow-agents-settings.schema.json |
55
57
  | workflow-acceptance.schema.json | Flow Agents Workflow Acceptance | https://flow-agents.dev/schemas/workflow-acceptance.schema.json |
56
58
  | workflow-critique.schema.json | Flow Agents Workflow Critique | https://flow-agents.dev/schemas/workflow-critique.schema.json |
@@ -109,10 +111,10 @@ Primary tools: `npm run workflow:sidecar`, `npm run workflow:validate-artifacts`
109
111
  | tool-explore-patterns | kimi-k2.5 | 6 | Delegate to me for Pattern detection - identifies architectural patterns, frameworks, and coding conventions |
110
112
  | tool-explore-structure | kimi-k2.5 | 6 | Delegate to me to scout out the project structure - maps directory layout and identifies key folders in a codebase |
111
113
  | tool-explore-tests | kimi-k2.5 | 6 | Delegate to me to find and understand testing strategies - locates test files and understands testing strategy |
112
- | tool-planner | claude-sonnet-4.6-1m | 7 | Delegate to me for codebase analysis and execution planning. Explores code, identifies patterns and dependencies, and writes plan/sidecar artifacts under .flow-agents. No production file modifications. |
114
+ | tool-planner | claude-sonnet-4.6-1m | 7 | Delegate to me for codebase analysis and execution planning. Explores code, identifies patterns and dependencies, and writes plan/sidecar artifacts under .kontourai/flow-agents. No production file modifications. |
113
115
  | tool-playwright | claude-sonnet-4.6-1m | 25 | Delegate to me for browser automation, testing, and debugging - loading real pages, testing navigation, checking accessibility via structured snapshots, evaluating scripts, and visual verification. Anything that would otherwise require a... |
114
116
  | tool-security-reviewer | claude-sonnet-4.6-1m | 7 | Delegate to me for security analysis. Checks OWASP Top 10, secrets detection, input validation, injection vulnerabilities, auth/authz, and rate limiting. Read-only analysis with shell for scanning tools. |
115
- | tool-verifier | claude-sonnet-4.6-1m | 8 | Delegate to me for implementation verification. Read-only + shell for source code; writes review/evidence artifacts under .flow-agents. Verifies acceptance criteria and produces PASS/FAIL/NOT_VERIFIED verdicts with evidence. No productio... |
117
+ | tool-verifier | claude-sonnet-4.6-1m | 8 | Delegate to me for implementation verification. Read-only + shell for source code; writes review/evidence artifacts under .kontourai/flow-agents. Verifies acceptance criteria and produces PASS/FAIL/NOT_VERIFIED verdicts with evidence. No... |
116
118
  | tool-worker | claude-sonnet-4.6-1m | 1 | Delegate to me for writing and developing source code for a project. Works best when a detailed plan can be provided. NO access to web tools. Can be used in parallel for any coding tasks that require trusted access to the write and shell... |
117
119
 
118
120
  ## Optional Powers
@@ -125,7 +127,7 @@ Primary tools: `npm run workflow:sidecar`, `npm run workflow:validate-artifacts`
125
127
  ## Current Workflow State
126
128
 
127
129
  Runtime workflow state is excluded from the committed map.
128
- Regenerate locally with `npm run context-map -- --include-runtime` to include recent `.flow-agents` state.
130
+ Regenerate locally with `npm run context-map -- --include-runtime` to include recent `.kontourai/flow-agents` state.
129
131
 
130
132
  ## Context Loading Rules
131
133
 
@@ -0,0 +1,57 @@
1
+ ---
2
+ status: current
3
+ subject: Decision records
4
+ decided: 2026-07-03
5
+ evidence:
6
+ - kind: issue
7
+ ref: https://github.com/kontourai/flow-agents/issues/310
8
+ - kind: session-archive
9
+ ref: .kontourai/flow-agents/decision-registry-shape/decision-registry-shape--idea-to-backlog.md
10
+ - kind: pr
11
+ ref: https://github.com/kontourai/flow-agents/pull/316
12
+ ---
13
+
14
+ # Decision records
15
+
16
+ New decisions are recorded as **topic-keyed living decision records** at
17
+ `docs/decisions/<topic-slug>.md`, one file per decision subject. Numbered ADRs
18
+ (`docs/adr/NNNN-*.md`) are frozen history and are never written for new
19
+ decisions.
20
+
21
+ ## Decision
22
+
23
+ - Topic files are keyed by decision **subject** slugs drawn from the CONTEXT.md
24
+ domain vocabulary; the vocabulary is the topic namespace. This removes ADR
25
+ numbering collisions and makes topic identity downstream of ubiquitous
26
+ language.
27
+ - **Supersession is an edit** to the topic file. Contradicting appendices are
28
+ impossible by construction; the file always holds the current answer plus lean
29
+ rationale. `superseded_by` / `merged_into` tombstones cover the rarer case of a
30
+ subject moving or merging to another slug.
31
+ - The context that led to a decision is **linked** to archived session artifacts,
32
+ PRs, and frozen ADRs via `evidence[]`, never inlined. This fixes ADR bloat;
33
+ promotion-as-retirement provides the archive.
34
+ - **CONTEXT.md is the only external compatibility surface** (grill-with-docs
35
+ interop). The numbered-ADR file format is not adopted for new decisions — the
36
+ behavior is inherited, not the failure mode.
37
+ - Existing ADRs are **frozen and indexed, never converted**; history stays
38
+ immutable provenance. (Freeze tooling is issue #314.)
39
+ - Frontmatter is YAML validated by `schemas/decision-record.schema.json`
40
+ (`status`, `subject`, `decided`, `evidence[]`, and the relationship fields),
41
+ enabling machine health checks.
42
+ - A generated `docs/decisions/index.md` (slug + one-liner) is referenced from
43
+ CONTEXT.md so retrieval-at-write matching has a cheap, always-loaded index.
44
+
45
+ ## Rationale
46
+
47
+ Numbered ADRs accumulate contradictions (new decisions append rather than
48
+ supersede), bloat (derivation context inlined with the decision), and numbering
49
+ collisions at multi-contributor scale — observed across ~6 portfolio repos and
50
+ owner-ratified as a redesign on 2026-07-03. Topic-keyed living records make the
51
+ current answer to any settled question findable in one place, make supersession
52
+ an edit rather than a contradicting appendix, and let multiple contributors work
53
+ without colliding on sequence numbers.
54
+
55
+ flow-agents is the first consumer: this record self-hosts the decision, and the
56
+ full normative contract lives at
57
+ `context/contracts/decision-registry-contract.md`.
@@ -0,0 +1,14 @@
1
+ ---
2
+ title: Decision Index
3
+ ---
4
+
5
+ # Decision Index
6
+
7
+ Generated by `npm run gen:decisions-index`. Do not edit by hand.
8
+ Topic-keyed living decision records per `context/contracts/decision-registry-contract.md`.
9
+ Numbered ADRs under `docs/adr/` are frozen history and are not listed here.
10
+
11
+ | Topic | Status | Decision |
12
+ | --- | --- | --- |
13
+ | [decision-records](./decision-records.md) | current | Decision records |
14
+ | [promotion-gate](./promotion-gate.md) | current | Promotion gate |
@@ -0,0 +1,52 @@
1
+ ---
2
+ status: current
3
+ subject: Promotion gate
4
+ decided: 2026-07-02
5
+ evidence:
6
+ - kind: issue
7
+ ref: https://github.com/kontourai/flow-agents/issues/312
8
+ - kind: session-archive
9
+ ref: .kontourai/flow-agents/decision-registry-shape/decision-registry-shape--idea-to-backlog.md
10
+ - kind: doc
11
+ ref: docs/workflow-artifact-lifecycle.md
12
+ ---
13
+
14
+ # Promotion gate
15
+
16
+ Archiving a delivered session is **gated on** promoting its durable residue. The
17
+ sequence is `final acceptance -> promote -> archive`; durable-residue extraction
18
+ is the archival act, not a parallel checklist chore.
19
+
20
+ ## Decision
21
+
22
+ - The sidecar `promote` step records **what was promoted where** and writes a
23
+ **promotion claim** into the session `trust.bundle`. The claim is
24
+ **session-local by construction** — check kind `policy`, evidence type
25
+ `policy_rule`, no command / `execution.label` — so it needs **no new
26
+ reconcile-manifest entry** and can **never** become a `[not-run]` /
27
+ unbacked-command divergence at CI `trust-reconcile`. The reconciler classifies
28
+ it session-local and accepts it as an ATTESTED claim.
29
+ - The claim's evidence refs are the **durable doc paths written**
30
+ (`docs/decisions/<slug>.md`, `CONTEXT.md`, `docs/learnings/*`, …); each is
31
+ verified to exist on disk at record time (a missing path fails loud) and is
32
+ mirrored into an auditable `promotion.json`. The claim is detected by the
33
+ archive gate and validators via `claim.metadata.promotion`.
34
+ - An **explicit empty-promotion** path (`promote --none --reason "<why>"`) records
35
+ an auditable no-residue claim, so "nothing needed promoting" is a recorded
36
+ decision rather than a silent skip.
37
+ - `workflow-artifact-cleanup-audit` classifies a **delivered/accepted** session
38
+ that reached a terminal shape **without** a promotion claim as a
39
+ `cleanup_candidate` (archive blocked) with a remedy naming the `promote` step;
40
+ **with** the claim (real residue or `--none`) it stays `terminal_done`.
41
+ Already-`archived` sessions are past the gate and are never re-flagged (no
42
+ backfill of historical archives).
43
+
44
+ ## Rationale
45
+
46
+ Docs-promotion was a Final Acceptance checklist item done inconsistently; the
47
+ 2026-07 archival sweep retired ~40 sessions whose promotion had happened ad hoc.
48
+ Making promotion **structural** — a claim the archive classifier checks — means no
49
+ delivered work is retired without its knowledge extracted. Reusing the existing
50
+ trust.bundle / stop-gate machinery (rather than a parallel mechanism) keeps the
51
+ signal visible to validators without new manifest surface, and the session-local
52
+ claim shape guarantees the gate can never masquerade as a CI-reconcilable command.
@@ -106,7 +106,7 @@ flowchart TB
106
106
  Evidence -->|missing evidence| Plan
107
107
  ```
108
108
 
109
- **Current state:** The durable handoff surface is a pair of human-readable Markdown artifacts and machine-readable JSON sidecars under `.flow-agents/<slug>/`. Verification, critique, release, and learning records are explicit artifacts rather than hidden chat memory.
109
+ **Current state:** The durable handoff surface is a pair of human-readable Markdown artifacts and machine-readable JSON sidecars under `.kontourai/flow-agents/<slug>/`. Verification, critique, release, and learning records are explicit artifacts rather than hidden chat memory.
110
110
 
111
111
  **Programmatic API (for native hosts):** The canonical sidecar writer/validator is importable as a library, not only via the `flow-agents-workflow-sidecar` CLI. A host that records workflow evidence natively should import the package root rather than reimplement validated read / merge / write:
112
112
 
@@ -22,6 +22,9 @@ run `npm run validate:source --` and `npm run fixture:retirement-audit --`.
22
22
  | `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. |
23
23
  | `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. |
24
24
  | `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. |
25
+ | `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. |
26
+ | `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. |
27
+ | `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). |
25
28
  | `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. |
26
29
  | `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. |
27
30
 
@@ -30,7 +30,7 @@ npm run kit -- status example-kit --dest /path/to/installed-flow-agents
30
30
  npm run kit -- activate --dest /path/to/installed-flow-agents --format json
31
31
  ```
32
32
 
33
- `--dest` is the installed bundle or workspace root. When omitted, the command uses the current working directory. Tests and automation should pass a temp destination; the command does not need to write to a user home directory.
33
+ `--dest` is the installed bundle, workspace root, isolated Codex home, or test fixture destination. When omitted, Codex-oriented kit commands install into the normal Codex home: `CODEX_HOME` when it is set, otherwise `~/.codex`. Pass `--dest` to override that destination for workspace installs, isolated homes, or tests.
34
34
 
35
35
  Install always runs the same repository validation used by `npm run validate:source -- --kit` before it creates or updates local install state. A validation failure exits nonzero and leaves the destination registry and copied kits unchanged.
36
36
 
@@ -64,7 +64,7 @@ Reinstalling the same kit id from the same source with the same content is idemp
64
64
 
65
65
  ## Runtime Activation
66
66
 
67
- `activate` reads the built-in Kit Catalog and local install overlay, selects a runtime adapter, and writes generated runtime-local files into the destination workspace. When `--adapter` is omitted, Flow Agents selects the only implemented adapter:
67
+ `activate` reads the built-in Kit Catalog and local install overlay, selects a runtime adapter, and writes generated non-durable projection files into the destination workspace. When `--adapter` is omitted, Flow Agents selects the only implemented adapter:
68
68
 
69
69
  ```text
70
70
  codex-local
@@ -80,13 +80,13 @@ The `codex-local` adapter supports only Flow Definition assets declared in `flow
80
80
 
81
81
  Activation reuses the installed local kit registry at `<dest>/kits/local/installed-kits.json`; it does not duplicate installed kit state and does not edit `kits/catalog.json`.
82
82
 
83
- Generated files are written under:
83
+ Generated adapter projections are written under:
84
84
 
85
85
  ```text
86
- <dest>/.flow-agents/runtime/codex/
86
+ <dest>/.kontourai/flow-agents/projections/codex/
87
87
  ```
88
88
 
89
- Flow Definition copies are placed under `flows/<kit-id>/<flow-id>.flow.json`, and activation writes an `activation.json` manifest in the same runtime-local area.
89
+ Flow Definition copies are placed under `flows/<kit-id>/<flow-id>.flow.json`, and activation writes an `activation.json` manifest in the same projection area. These files are regenerable from the Kit Catalog plus `kits/local`; they are not the durable run state for a workflow.
90
90
 
91
91
  The stable activation diagnostics include:
92
92