@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
@@ -24,6 +24,16 @@ npx @kontourai/flow-agents init --runtime opencode --dest . --yes
24
24
 
25
25
  The installer copies agents, skills, context contracts, hook scripts, Kit assets, and the Flow Agents telemetry descriptor into the workspace. The Builder Kit installs automatically. Your agent reads those files at startup; no plugin registry required.
26
26
 
27
+ For a normal Codex global install, target the Codex home instead of a project workspace:
28
+
29
+ ```bash
30
+ npx @kontourai/flow-agents init --runtime codex --global --activate-kits --yes
31
+ ```
32
+
33
+ That installs into `CODEX_HOME` when it is set, otherwise `~/.codex`. Use `--dest /path/to/codex-home` only when you need an explicit override for an isolated install, CI fixture, or test.
34
+
35
+ Keep generated Codex base config lean. Put profile-specific model, provider, and approval settings in separate `<profile>.config.toml` files and select them with `codex --profile <name>`.
36
+
27
37
  **What lands in the workspace:**
28
38
 
29
39
  - `agents/`, `skills/`, `context/` — skill definitions and shared contracts the agent follows
@@ -84,7 +94,7 @@ The agent will run the `builder-shape` / `idea-to-backlog` skill, which:
84
94
  3. drafts a shaped work item with a stated outcome, non-goals, acceptance criteria, and a verification expectation
85
95
  4. stops at the `breakdown-gate` and waits for you to confirm before creating GitHub issues
86
96
 
87
- You will see the agent write a local artifact at `.flow-agents/<slug>/<slug>--idea-to-backlog.md`. That artifact is the machine-readable input to the next stage — not a summary in the chat window.
97
+ You will see the agent write a local artifact at `.kontourai/flow-agents/<slug>/<slug>--idea-to-backlog.md`. That artifact is the machine-readable input to the next stage — not a summary in the chat window.
88
98
 
89
99
  To continue and file the GitHub issue:
90
100
 
@@ -128,7 +138,7 @@ Use verify-work on the current branch and report what evidence is present.
128
138
 
129
139
  ### What you observe
130
140
 
131
- - **Between each step**, the agent writes a local session sidecar under `.flow-agents/<slug>/` — `state.json`, `acceptance.json`, `evidence.json`, and `handoff.json`. These survive compaction, tab close, or a new session. A future session resumes from recorded state.
141
+ - **Between each step**, the agent writes a local session sidecar under `.kontourai/flow-agents/<slug>/` — `state.json`, `acceptance.json`, `evidence.json`, and `handoff.json`. These survive compaction, tab close, or a new session. A future session resumes from recorded state.
132
142
  - **At each gate**, the agent either presents the evidence and moves forward, or blocks and explains what is missing. It does not make up a confident summary and proceed.
133
143
  - **The stop-goal-fit hook** (at L2) prevents the agent from stopping when evidence is still incomplete — you see a warning or block rather than "all done!" on partial work.
134
144
  - **If verify fails**, the verify-gate routes back to execution (or plan, or design-probe, depending on the failure class) and tries again — up to three times before hard-blocking.
@@ -79,7 +79,8 @@ The install appends rather than replaces, so existing hooks are not removed. Rev
79
79
 
80
80
  skills/
81
81
 
82
- .flow-agents/ ← runtime workflow artifacts (not committed)
82
+ .kontourai/
83
+ flow-agents/ ← runtime workflow artifacts (not committed)
83
84
  ```
84
85
 
85
86
  ## opencode
@@ -54,7 +54,7 @@ Required fields:
54
54
  | `name` | Non-empty display name |
55
55
  | `flows` | Non-empty list; each entry must have `id` and `path` |
56
56
 
57
- Optional fields: `product_name`, `description`, `skills`, `docs`, `adapters`, `evals`, `assets`. Optional fields list relative asset paths or objects with `id`, `path`, and optional `description`. `skills` and `docs` assets are activated by both adapters alongside flows. `adapters`, `evals`, and `assets` appear in diagnostics as `skipped_assets` (see the Activate section for the full per-adapter table).
57
+ Optional fields: `product_name`, `description`, `skills`, `docs`, `adapters`, `evals`, `assets`, `dependencies` (cross-kit dependency declarations; see [Cross-kit dependencies](#cross-kit-dependencies)). Optional fields list relative asset paths or objects with `id`, `path`, and optional `description`. `skills` and `docs` assets are activated by both adapters alongside flows. `adapters`, `evals`, and `assets` appear in diagnostics as `skipped_assets` (see the Activate section for the full per-adapter table).
58
58
 
59
59
  ## Minimal flow file
60
60
 
@@ -91,6 +91,22 @@ A Flow Definition at minimum needs `id`, `version`, `steps`, and `gates`. Steps
91
91
 
92
92
  The `id` in the flow file should match the `id` declared in `kit.json`'s `flows` list. Look at `kits/builder/flows/shape.flow.json` and `kits/builder/flows/build.flow.json` in this repository for fuller examples of multi-step flows with required and optional gate evidence.
93
93
 
94
+ Flow Definitions may compose another declared Flow Definition at a step with `uses_flow`. The parent keeps lifecycle ownership (`active_flow_id` can remain the parent flow), while gate resolution for that step comes from the child flow with the same step id. Use this for reusable extensions such as publish, CI merge readiness, or learning closeout:
95
+
96
+ ```json
97
+ {
98
+ "id": "builder.build",
99
+ "steps": [
100
+ { "id": "verify", "next": "pr-open" },
101
+ { "id": "pr-open", "next": "merge-ready-ci", "uses_flow": "builder.publish-learn" },
102
+ { "id": "merge-ready-ci", "next": "learn", "uses_flow": "builder.publish-learn" },
103
+ { "id": "learn", "next": "done", "uses_flow": "builder.publish-learn" }
104
+ ]
105
+ }
106
+ ```
107
+
108
+ The child flow should declare the gates for those step ids and list the claim types it intentionally exposes in `exports` (expectation ids are also accepted for non-claim expectations). Composition fails closed when a child gate expectation is not exported. Parent verification is still determined by trust-bundle claims: required child claims that are missing, disputed, or `not_verified` prevent the composed parent from being treated as verified.
109
+
94
110
  ## Validate
95
111
 
96
112
  Before installing or sharing a kit, run validation from the flow-agents checkout:
@@ -144,13 +160,13 @@ The `codex-local` adapter is selected automatically. To activate for Strands, pa
144
160
 
145
161
  ### What each adapter activates
146
162
 
147
- Each adapter copies declared assets into `.flow-agents/runtime/<adapter>/` and produces an `activation.json` manifest. The table below shows which asset classes are activated today:
163
+ Each adapter copies declared assets into `.kontourai/flow-agents/projections/<adapter>/` and produces an `activation.json` manifest. The table below shows which asset classes are activated today:
148
164
 
149
165
  | Asset class | `codex-local` | `strands-local` | Notes |
150
166
  |---|---|---|---|
151
- | `flows` | Activated — `.flow-agents/runtime/codex/flows/<kit-id>/<asset-id>.flow.json` | Activated — `.flow-agents/runtime/strands/flows/<kit-id>/<asset-id>.flow.json` | Gate definitions read by each adapter's flow-routing layer. |
152
- | `skills` | Activated — `.flow-agents/runtime/codex/skills/<kit-id>/<filename>` | Activated — `.flow-agents/runtime/strands/skills/<kit-id>/<filename>` | Agent guidance markdown. For codex-local, reference these paths from AGENTS.md. For strands-local, the Strands steering layer can glob for `*.md` under `skills/` during system-prompt injection. |
153
- | `docs` | Activated — `.flow-agents/runtime/codex/docs/<kit-id>/<filename>` | Activated — `.flow-agents/runtime/strands/docs/<kit-id>/<filename>` | Documentation assets. Co-located with skill files for easy reference. |
167
+ | `flows` | Activated — `.kontourai/flow-agents/projections/codex/flows/<kit-id>/<asset-id>.flow.json` | Activated — `.kontourai/flow-agents/projections/strands/flows/<kit-id>/<asset-id>.flow.json` | Gate definitions read by each adapter's flow-routing layer. |
168
+ | `skills` | Activated — `.kontourai/flow-agents/projections/codex/skills/<kit-id>/<filename>` | Activated — `.kontourai/flow-agents/projections/strands/skills/<kit-id>/<filename>` | Agent guidance markdown. For codex-local, reference these paths from AGENTS.md. For strands-local, the Strands steering layer can glob for `*.md` under `skills/` during system-prompt injection. |
169
+ | `docs` | Activated — `.kontourai/flow-agents/projections/codex/docs/<kit-id>/<filename>` | Activated — `.kontourai/flow-agents/projections/strands/docs/<kit-id>/<filename>` | Documentation assets. Co-located with skill files for easy reference. |
154
170
  | `adapters` | `skipped_assets` | `skipped_assets` | Framework or runtime adapter code — not copied by the activation layer. |
155
171
  | `evals` | `skipped_assets` | `skipped_assets` | Evaluation suites — not run or copied during activation. |
156
172
  | `assets` | `skipped_assets` | `skipped_assets` | General supporting assets — not copied during activation. |
@@ -179,6 +195,14 @@ For path errors: all declared paths must be relative, must not contain `..`, and
179
195
 
180
196
  For conflicts on re-install: if you install a different source with an existing kit id, the command fails unless you pass `--update`. Use `--force` to re-copy an existing same-source install after validation.
181
197
 
198
+ For cross-kit dependency errors:
199
+
200
+ - `kit.json: dependencies[N].kit_id must be a kebab-case kit id` — the entry's `kit_id` is missing or not lowercase kebab-case. Fix the id.
201
+ - `kit.json: dependencies[N].kit_id must not reference the declaring kit itself` — remove the self-referential entry; a kit cannot depend on itself.
202
+ - `kit.json: dependencies[N].kit_id duplicates '<id>'` — collapse the duplicate declaration to a single entry.
203
+ - `warning: kit '<id>' declares a dependency on '<dep>' ... which is not installed` (at install) — advisory only; install the depended-on kit with `flow-agents kit install <source>` before activating, or activation will fail.
204
+ - `<id>: declares a dependency on kit '<dep>' ... which is not installed or activated` (at activate, non-zero exit) — install the missing kit and re-activate, or remove the dependency declaration if it is no longer needed.
205
+
182
206
  See the [Flow Kit Repository Contract](flow-kit-repository-contract.md) for the full validation rules, registry schema, activation diagnostics, and the install/update/force semantics.
183
207
 
184
208
  ## Layering: container vs. agent extension
@@ -212,6 +236,41 @@ The **agent extension** is owned by Flow Agents. It defines the optional asset c
212
236
 
213
237
  Each extension field is an optional array of entries with `id`, `path`, and optional `description`. Extension fields are validated by Flow Agents using the same path rules as the container layer (relative, no `..`, must exist). Unknown extension entries are recorded as `skipped_assets` during activation rather than treated as errors.
214
238
 
239
+ ### Cross-kit dependencies
240
+
241
+ A kit may declare that it depends on **another kit** whose skills it invokes at runtime. This is a Flow Agents extension-layer concern (a skill in one kit calling a skill in another), not part of the Flow-owned container contract — see [ADR 0019](adr/0019-kit-dependency-ownership.md) for the ownership rationale (grounded in the container schema's `additionalProperties: true` and ADR 0008's Dividing Test). It is **not** a package manager: it declares and validates *presence*, it does not fetch kits or resolve versions.
242
+
243
+ Shape:
244
+
245
+ ```json
246
+ {
247
+ "schema_version": "1.0",
248
+ "id": "builder",
249
+ "name": "Builder Kit",
250
+ "flows": [ /* ... */ ],
251
+ "dependencies": [
252
+ {
253
+ "kit_id": "knowledge",
254
+ "reason": "learning-review invokes knowledge-capture for durable knowledge storage"
255
+ }
256
+ ],
257
+ "skills": [ /* ... */ ]
258
+ }
259
+ ```
260
+
261
+ | Field | Rule |
262
+ |---|---|
263
+ | `kit_id` | Required. Kebab-case kit id (`^[a-z][a-z0-9-]*$`) of the depended-on kit. Must not reference the declaring kit itself, and must not be duplicated across entries. |
264
+ | `reason` | Optional string explaining why the dependency exists (which skill invokes which). |
265
+
266
+ Where it is checked:
267
+
268
+ - **Shape** — at `flow-agents kit install`, `inspect`, and `validate` time. A malformed entry (bad `kit_id`, self-reference, duplicate) is a **hard error**.
269
+ - **Presence at install** — `flow-agents kit install` prints a **non-blocking warning** when a declared dependency is not present in the destination's **local** registry, then exits 0. This check sees only the local installed-kits registry, not the built-in Kit Catalog (an accepted v1 limitation).
270
+ - **Presence at activation** — `flow-agents kit activate` is a **hard error** (non-zero exit) when a declared `kit_id` is not present among the union of built-in catalog kits and locally-installed kits.
271
+
272
+ `dependencies` is metadata, not evaluable-gate content, so it does **not** affect K0/K1/K2 conformance scoring (see the K-levels section below).
273
+
215
274
  ### When a kit "is" a Flow Agents Kit
216
275
 
217
276
  A kit is a **Flow Agents Kit** when it satisfies both layers:
@@ -43,7 +43,11 @@ The vector detector is fail-closed: infrastructure failures throw `EMBED_FAILURE
43
43
  ## Quick reference
44
44
 
45
45
  ```bash
46
- # Install the kit into a workspace
46
+ # Install the kit into the default Codex/global kit destination:
47
+ # CODEX_HOME, or ~/.codex when CODEX_HOME is unset
48
+ npx @kontourai/flow-agents kit install kits/knowledge
49
+
50
+ # Override the destination for a workspace, isolated home, or test
47
51
  npx @kontourai/flow-agents kit install kits/knowledge --dest /path/to/workspace
48
52
 
49
53
  # Run the contract suite against the default adapter
@@ -0,0 +1,203 @@
1
+ ---
2
+ title: "2026-07 Improvement Program — Learning Review"
3
+ ---
4
+
5
+ # 2026-07 Improvement Program — Learning Review
6
+
7
+ This document records durable learnings from a multi-week, multi-repository improvement
8
+ program run across the Kontour portfolio in June and July 2026. The program touched
9
+ Flow Agents, Surface, Veritas, Flow, Survey, Traverse, and the shared hachure trust-bundle
10
+ schema. Every finding below was hit empirically during the program and resolved or worked
11
+ around; none are speculative.
12
+
13
+ It is written for a future maintainer who was not present for the program. Where a finding
14
+ implies a rule you should keep following, that rule is stated explicitly. Cross-repository
15
+ pull requests and issues are linked so you can trace the underlying change.
16
+
17
+ ## Scope and source material
18
+
19
+ - Corroborating provider issues: [flow-agents#267](https://github.com/kontourai/flow-agents/issues/267),
20
+ [flow-agents#268](https://github.com/kontourai/flow-agents/issues/268),
21
+ [flow-agents#281](https://github.com/kontourai/flow-agents/issues/281).
22
+ - Representative pull requests:
23
+ - Flow Agents: [#264](https://github.com/kontourai/flow-agents/pull/264) (cross-kit
24
+ dependencies, skill-collision fixes, sidecar governance),
25
+ [#266](https://github.com/kontourai/flow-agents/pull/266) (manifest-based reconcile,
26
+ claim classification, loud attestations),
27
+ [#269](https://github.com/kontourai/flow-agents/pull/269) (veritas-governance kit —
28
+ readiness→trust-bundle adapter),
29
+ [#277](https://github.com/kontourai/flow-agents/pull/277) (migrate to
30
+ `@kontourai/surface` 2.0.0, `Claim.facet` rename).
31
+ - Surface: [#103](https://github.com/kontourai/surface/pull/103) (order-independent
32
+ multi-producer merge; hachure 0.7.0 conformance),
33
+ [#104](https://github.com/kontourai/surface/pull/104) (sync to hachure 0.8.0,
34
+ vendor-neutral `$id`s), [#105](https://github.com/kontourai/surface/pull/105)
35
+ (`Claim.surface` → `facet`, spec 0.9.0 parity — a breaking change).
36
+ - Veritas: [#107](https://github.com/kontourai/veritas/pull/107) (blocking failures win
37
+ over `promotion_allowed` short-circuit), [#109](https://github.com/kontourai/veritas/pull/109)
38
+ (migrate `Claim.surface` → `facet`, Surface ^2.0.0, schemaVersion 5).
39
+ - Flow: [#100](https://github.com/kontourai/flow/pull/100) (migrate to Surface 2.0.0 —
40
+ shipped as a `chore:` and therefore went unreleased; see Finding 6),
41
+ [#101](https://github.com/kontourai/flow/pull/101) (trust bundles emit `facet` +
42
+ schemaVersion 5; Surface 2.0, hachure 0.9).
43
+ - Survey: [#100](https://github.com/kontourai/survey/pull/100) (migrate to Surface 2.0.0
44
+ facet rename), released via [#99](https://github.com/kontourai/survey/pull/99) /
45
+ [#101](https://github.com/kontourai/survey/pull/101).
46
+ - hachure trust-bundle schema releases 0.6.0 through 0.9.0, which drove the coordinated
47
+ Surface / Veritas / Flow / Survey / Flow Agents migrations above.
48
+
49
+ The rest of this document is organized by finding. Each finding states what happened, why
50
+ it matters, and the working discipline or fix to carry forward.
51
+
52
+ ## 1. Trust-ledger write discipline
53
+
54
+ The trust ledger (`trust.bundle` plus its `evidence.json` / critique inputs) has write
55
+ semantics that are easy to corrupt if you interleave commands:
56
+
57
+ - `record-evidence` **replaces** `trust.bundle` wholesale. At the time of the program it
58
+ rebuilt the bundle with a hardcoded `critiques: []`, so any previously recorded critique
59
+ was silently dropped.
60
+ - `record-critique` is **append-only** and has no supersession mechanism: a reviewer cannot
61
+ close or retract a disputed finding once written ([flow-agents#267](https://github.com/kontourai/flow-agents/issues/267)).
62
+ - The checks/critiques round-trip through the bundle is contaminating: prior critique claims
63
+ get re-absorbed as command-less `test_output` checks, turning a critique claim into a
64
+ divergent, command-less check ([flow-agents#268](https://github.com/kontourai/flow-agents/issues/268)).
65
+ This is amplified under `--flow-id`, where a **single** critique write is enough to
66
+ contaminate the ledger.
67
+
68
+ **Working discipline until the tooling is fixed:**
69
+
70
+ 1. Record **all** evidence first.
71
+ 2. Record **at most one** critique write, and make it the **last** write.
72
+ 3. Never run any `record-*` command after that final critique write.
73
+ 4. If a ledger becomes contaminated, **restart the session** rather than trying to iterate
74
+ or repair a contaminated ledger in place.
75
+
76
+ This program's learning-review session itself follows the rule: it was created with
77
+ `ensure-session` **without** `--flow-id` precisely to avoid the single-critique-write
78
+ amplification described above.
79
+
80
+ ## 2. Post-merge ledger staleness
81
+
82
+ A session whose `trust.bundle` was frozen mid-iteration causes stop-gate "caught
83
+ false-completion" storms after the branch merges. The stale iteration claims are recomputed
84
+ in a changed context (the merged tree no longer matches the frozen claims), and the stop gate
85
+ repeatedly flags the session as falsely complete.
86
+
87
+ **Pattern to recover:** rebuild the bundle from the current `evidence.json` via
88
+ `record-evidence`, then re-advance state. Do not hand-edit the frozen bundle; regenerate it
89
+ from current evidence so the claims match the post-merge tree.
90
+
91
+ ## 3. Evidence must be executable in the CI/backstop context
92
+
93
+ Evidence checks are re-run by CI and by the backstop reconciler, not just locally. Several
94
+ checks passed locally but failed in CI because they were not executable in that context. Keep
95
+ evidence portable:
96
+
97
+ - Check commands must be **repo-root-relative** and must reference files that live **inside
98
+ the session directory** (for example under `verify-scratch/`), never an agent's private
99
+ scratchpad that does not exist in CI.
100
+ - Summaries must be **runnable commands**. For prose that is not a command, use the
101
+ `true # ...` form so the "command" still exits zero when executed.
102
+ - Reconcilable claims need **manifest-exact bare labels** — no environment-variable
103
+ annotations on the label — so the reconciler can match them against the manifest.
104
+ - Keep reconcilable sets **small**. `runCommand` enforces a 180-second per-command timeout;
105
+ heavy test suites trip that timeout in CI while passing locally. Split or scope the suite
106
+ so each reconciled command finishes well under the limit.
107
+
108
+ ## 4. Critique semantics and resolved sessions
109
+
110
+ Under the current validator rule, a top-level `pass` verdict forbids any `fail` or
111
+ `not_verified` member claims. Consequently a **resolved** session cannot retain historical
112
+ `verdict: fail` critiques — the validator rejects the bundle even though the failure was
113
+ genuine and later fixed.
114
+
115
+ **Reconciliation pattern:** move the historical failing critique to `superseded` and then
116
+ `comment`, preserving the original outcome in the summary text so the audit trail survives.
117
+ The `fail` verdict is not deleted from history; it is superseded, and the summary records
118
+ what the original verdict was and how it was resolved.
119
+
120
+ This deserves an explicit convention note, and possibly a validator/schema affordance for a
121
+ first-class `superseded_by` relationship so the original verdict can be preserved structurally
122
+ rather than only in prose. That tooling gap is filed as a follow-up issue (see below).
123
+
124
+ ## 5. Shim scope coupling in cross-repo schema migrations
125
+
126
+ Surface 2.0's read-tolerance shim (the compatibility layer that accepts both the old
127
+ `Claim.surface` and new `Claim.facet` shapes) only protects consumers that go through
128
+ **Surface's JavaScript API**. Anything that validates against the hachure JSON Schema
129
+ **directly** bypasses the shim and breaks. During this program that included:
130
+
131
+ - Flow's Ajv gate (validates bundles against the raw schema),
132
+ - Veritas's schema dependency,
133
+ - Flow Agents `attach-evidence` using a **vendored** copy of the old hachure schema.
134
+
135
+ Each of these had to bump hachure **in lockstep** with the Surface bump; the shim did not
136
+ cover them.
137
+
138
+ **Rule for future cross-repo schema migrations:** map **both** axes before you start —
139
+ (a) the JS-API consumers, which the shim protects, and (b) the raw-schema validators, which
140
+ it does not. Every raw-schema validator (including vendored schema copies) must be bumped in
141
+ the same coordinated wave. See Surface [#105](https://github.com/kontourai/surface/pull/105),
142
+ Veritas [#109](https://github.com/kontourai/veritas/pull/109), Flow
143
+ [#101](https://github.com/kontourai/flow/pull/101), Survey
144
+ [#100](https://github.com/kontourai/survey/pull/100), and Flow Agents
145
+ [#277](https://github.com/kontourai/flow-agents/pull/277) for the coordinated set.
146
+
147
+ ## 6. Release mechanics
148
+
149
+ Two independent release-mechanics traps surfaced:
150
+
151
+ - **release-please ignores `chore:` commits.** Flow [#100](https://github.com/kontourai/flow/pull/100)
152
+ shipped real functionality (the Surface 2.0 migration) as a `chore:` commit, so
153
+ release-please never cut a release and the functionality sat unreleased until a subsequent
154
+ `feat!:` signal commit ([#101](https://github.com/kontourai/flow/pull/101)) triggered the
155
+ release. If a `chore:` PR changes shipped behavior, it will not be released on its own —
156
+ pair it with a `feat:`/`fix:`/`feat!:` signal commit or it stays dark.
157
+ - **GitHub App installation repo-access is a separate axis from org secrets/vars grants.**
158
+ A Traverse release was blocked because the GitHub App was not installed on that repository,
159
+ which is distinct from whether org-level secrets and variables were granted. App
160
+ installation repo-access is org-owner-only, so this class of block cannot be self-resolved
161
+ by the release author and must be escalated to an org owner.
162
+
163
+ ## 7. Runtime-artifact hygiene
164
+
165
+ Bulk worktree operations reset filesystem `mtime`s en masse. Any recency heuristic based on
166
+ `mtime` is therefore unreliable after a sweep. Session recency must be read from
167
+ `state.json`'s `updated_at` field, not from file `mtime` (established during the WS6 sweep —
168
+ the WS6 sweep was the pass that audited and pruned stale local runtime sessions).
169
+
170
+ The `workflow-artifact-cleanup-audit` CLI is **dry-run only**: it classifies sessions into
171
+ active WIP, cleanup candidates, terminal done records, active learning follow-ups, and
172
+ invalid sidecars, but it does not delete, archive, or rewrite anything and has no apply mode.
173
+ An apply mode may be worth filing so cleanup can be executed, not just recommended. That
174
+ tooling gap is filed as a follow-up issue (see below).
175
+
176
+ ## 8. Gate operations
177
+
178
+ Operational discipline for running gates and merging, learned the hard way during parallel
179
+ waves:
180
+
181
+ - **Never dispatch fixes while gates are running.** Wait for **all** outstanding gates to
182
+ finish before acting on any result; dispatching a fix mid-run races the gate and produces
183
+ confusing, interleaved state.
184
+ - **Run mutation testing only in scratch copies**, never against the working tree the gate is
185
+ evaluating.
186
+ - **Keep `gh pr merge` stderr visible.** Do not swallow it; the merge failure reasons you
187
+ need (behind-base, pending checks, blocked) come through stderr.
188
+ - Use `gh pr merge --auto` for pending checks so the merge lands when checks go green, and use
189
+ branch update (`update-branch`) when a PR is `BEHIND` the base.
190
+
191
+ ## Follow-up tooling issues
192
+
193
+ Findings 4 and 7 imply concrete Flow Agents tool changes. Both were checked against the open
194
+ issue list for duplicates and filed fresh:
195
+
196
+ - Finding 4 → [flow-agents#282](https://github.com/kontourai/flow-agents/issues/282): a
197
+ validator/schema affordance for `superseded_by` on critique claims, so a resolved session
198
+ can preserve a historical `fail` verdict structurally rather than only in the summary prose.
199
+ - Finding 7 → [flow-agents#283](https://github.com/kontourai/flow-agents/issues/283): an
200
+ apply mode for `workflow-artifact-cleanup-audit`, so the dry-run classification can be
201
+ executed.
202
+
203
+ Both issues were checked against the open issue list before filing; no duplicates existed.
@@ -6,11 +6,12 @@ title: Migrations
6
6
 
7
7
  ## Unreleased
8
8
 
9
- - Workflow runtime artifacts now live under `.flow-agents/` instead of
10
- `.agents/flow-agents/`. Move any local session directories, sidecars, or
11
- `current.json` pointers you want to keep into the new root. Runtime state
12
- remains ignored; promote durable outcomes into docs, source, schemas, or
13
- provider records before merge.
9
+ - Workflow runtime artifacts now live under `.kontourai/flow-agents/` instead
10
+ of earlier runtime roots such as `.flow-agents/` or `.agents/flow-agents/`.
11
+ Move any local session directories, sidecars, or `current.json` pointers you
12
+ want to keep into the new root. Runtime readers do not fall back to old roots.
13
+ Runtime state remains ignored; promote durable outcomes into docs, source,
14
+ schemas, or provider records before merge.
14
15
  - Flow Agents setup no longer accepts Console bearer tokens as CLI arguments.
15
16
  Replace `--console-token TOKEN` with `--console-token-file PATH` for
16
17
  headless installs, or use the prompted `flow-agents init` flow. Interactive
@@ -206,7 +206,7 @@ Exit criteria:
206
206
 
207
207
  - A workflow can resume from artifacts without relying on the model remembering prior turns.
208
208
  - Goal Fit, evidence status, and next action can be read mechanically.
209
- - Multiple agents can share one workflow root by resolving `.flow-agents/current.json` and appending agent-local events instead of racing on root state.
209
+ - Multiple agents can share one workflow root by resolving `.kontourai/flow-agents/current.json` and appending agent-local events instead of racing on root state.
210
210
 
211
211
  ## Phase 3: Add Just-In-Time Guidance
212
212
 
@@ -261,7 +261,7 @@ Tasks:
261
261
  - Add promotion gates so guidance becomes stricter only after evidence shows it helps.
262
262
  - Make dashboards answer whether Flow Agents is improving outcomes over time.
263
263
  - Dogfood the workflow artifacts on Flow Agents changes: each substantial pass should produce sidecars, run artifact validation, delegate critique, update durable docs, and route accepted critique into the next slice. **Started:** `npm run workflow:sidecar -- dogfood-pass` records evidence, required critique, optional release readiness, optional learning, state, and handoff in one fail-closed validated pass.
264
- - Automatically create or select the current session artifact so self-validation does not depend on the user or orchestrator hand-picking `.flow-agents/<slug>`. **Started:** `npm run workflow:sidecar -- ensure-session` creates or selects a delivery session artifact plus initial state, acceptance, and handoff sidecars.
264
+ - Automatically create or select the current session artifact so self-validation does not depend on the user or orchestrator hand-picking `.kontourai/flow-agents/<slug>`. **Started:** `npm run workflow:sidecar -- ensure-session` creates or selects a delivery session artifact plus initial state, acceptance, and handoff sidecars.
265
265
 
266
266
  Exit criteria:
267
267
 
@@ -18,7 +18,7 @@ For the concrete directory-by-directory source map, generated output policy, run
18
18
  | Skills | Reusable procedures an agent can invoke when a task matches | Always-on policy, credentials, or long-lived memory | Agent Skills / `SKILL.md` |
19
19
  | Powers | Tool bundles, MCP configs, and activation guidance | Workflow gates or repo-specific policy semantics | MCP, OpenAPI, OAuth/OIDC |
20
20
  | Agents | Role prompts, delegation boundaries, and scoped tool access | Generic task procedures that should be skills | Harness-native subagents/profiles |
21
- | Workflows | Durable state, gates, handoffs, acceptance criteria, and phase transitions | Domain-specific knowledge records or tool internals | JSON Schema sidecars plus Markdown summaries |
21
+ | Workflows | Resumable state, gates, handoffs, acceptance criteria, and phase transitions | Domain-specific knowledge records or tool internals | JSON Schema sidecars plus Markdown summaries |
22
22
  | Knowledge | People, organizations, meetings, decisions, commitments, notes, and follow-ups | Verification verdicts or runtime telemetry | CommonMark, JSContact, iCalendar, JMAP, WebVTT/SRT, JSON-LD |
23
23
  | Evidence | Proof, telemetry, findings, evals, provenance, and quality outcomes | User-facing procedure instructions | OpenTelemetry, SARIF, CycloneDX, SLSA, JSON Schema |
24
24
 
@@ -37,7 +37,8 @@ Governance tools such as Veritas belong at the Evidence boundary. Flow Agents sh
37
37
  | `kits/` | Flow Kits | Kit Catalog entries, Flow Kit manifests, Flow Definitions, and supporting assets. Builder Kit is the first proof point. |
38
38
  | `prompts/` | Skills / Rules | Saved invocations. Promote repeatable procedures into skills when they grow stable. |
39
39
  | `docs/workflow-*.md` | Workflows | Human-readable workflow contracts and usage guidance. |
40
- | `.flow-agents/` | Workflows | Cross-session task artifacts. Runtime state stays local and ignored; durable outcomes are promoted into docs, source, schemas, or provider records before merge. |
40
+ | `.kontourai/flow-agents/` | Workflows | Non-durable cross-session task artifacts and generated projections. Runtime state stays local and ignored; durable outcomes are promoted into docs, source, schemas, or provider records before merge. |
41
+ | `.flow-agents/` | Workflows | Flow Agents-owned durable config/install state when a distribution explicitly owns that path. Not a runtime artifact fallback. |
41
42
  | `scripts/` | Evidence / Workflows / Packaging | Validation, build, telemetry, hooks, and artifact tooling. |
42
43
  | `src/` | Workflows / Evidence / Packaging | TypeScript CLI, runtime adapter, Flow Kit, shared library, build, validation, context-map, packaging, and CLI helper source compiled into `build/src/`. |
43
44
  | `evals/` | Evidence | Static, behavioral, integration, and acceptance checks. |
@@ -80,7 +81,7 @@ Builder Kit evidence gates can reference Surface trust state without naming a pr
80
81
  Workflow artifacts have their own lifecycle policy:
81
82
  https://github.com/kontourai/flow-agents/blob/main/docs/workflow-artifact-lifecycle.md
82
83
 
83
- Use `.flow-agents/<slug>/` for local runtime/session state. If in-progress planning needs review or handoff, promote the durable decision, behavior, and evidence summary into normal docs or provider records before merge; keep runtime artifacts out of git.
84
+ Use `.kontourai/flow-agents/<slug>/` for local runtime/session state. Keep `.flow-agents/` for explicit durable Flow Agents config/install state. If in-progress planning needs review or handoff, promote the durable decision, behavior, and evidence summary into normal docs or provider records before merge; keep runtime artifacts out of git.
84
85
 
85
86
  If a proposed artifact seems to belong to multiple layers, split it. For example, a dependency-checking capability may have:
86
87
 
@@ -10,7 +10,7 @@ This is the canonical developer-facing map for the Flow Agents repository. Use i
10
10
 
11
11
  - Edit canonical source in the repo root areas listed below, then regenerate derived output with the documented commands.
12
12
  - Do not edit `dist/`, `build/`, or `_site/` by hand. They are generated from tracked source.
13
- - Do not commit local runtime state from `.flow-agents/<slug>/`, `.kontourai/`, `.codex/`, `.claude/`, `.omx/`, `.promptfoo/`, `.telemetry/`, `.surface/`, generated `.veritas/` output, or tool caches; intentionally tracked `.veritas/` governance/config remains durable source.
13
+ - Do not commit local runtime state from `.kontourai/flow-agents/<slug>/`, `.codex/`, `.claude/`, `.omx/`, `.promptfoo/`, `.telemetry/`, `.surface/`, generated `.veritas/` output, or tool caches; intentionally tracked `.veritas/` governance/config remains durable source.
14
14
  - Runtime workflow artifacts stay local and ignored; promote reviewable or durable outcomes to docs, source, schemas, or provider records before merging to `main`.
15
15
  - Treat generated exports and installed runtime config as products of `packaging/manifest.json`, `src/tools/build-universal-bundles.ts`, `scripts/install-*.sh`, and the source directories they copy.
16
16
  - Use `.kontourai/` for non-durable local or generated Kontour workspace state. Keep durable tracked files in intuitive product-owned paths such as `.veritas/`, `.flow/`, `.agents/`, `.claude/commands`, and `docs/`; existing transition ignores remain during migration.
@@ -33,15 +33,15 @@ This is the canonical developer-facing map for the Flow Agents repository. Use i
33
33
  docs/ # durable docs and GitHub Pages source
34
34
  integrations/ # optional external integration config
35
35
  dist/ build/ _site/ # generated output; ignored
36
- .flow-agents/ .kontourai/ .codex/ .claude/ ... # local runtime state; ignored by default
36
+ .kontourai/ .flow-agents/ .codex/ .claude/ ... # local/generated or installed state; ignored by default
37
37
  ```
38
38
 
39
39
  ## Top-Level Inventory
40
40
 
41
41
  | Path | Classification | Source of truth | Generated or runtime policy | Safe cleanup rule |
42
42
  | --- | --- | --- | --- | --- |
43
- | `.flow-agents/` | runtime state | Workflow tools write local session artifacts. | Ignored. | Do not commit task runtime roots; promote durable decisions to docs, source, schemas, or providers before merge. |
44
- | `.kontourai/` | local/generated workspace state | Local Kontour tools and developer workflows. | Ignored. | Safe local cleanup when no active workflow needs it; durable source and decisions stay in product-owned tracked paths. |
43
+ | `.kontourai/` | local/generated workspace state | Local Kontour tools and developer workflows, including `.kontourai/flow-agents/<slug>/` runtime sessions. | Ignored. | Safe local cleanup when no active workflow needs it; durable source and decisions stay in product-owned tracked paths. |
44
+ | `.flow-agents/` | durable local Flow Agents state | Explicit Flow Agents config/install records when documented. | Ignored unless a repo-specific contract intentionally tracks a durable file. | Do not use for non-durable workflow sessions; migrate old runtime artifacts into `.kontourai/flow-agents/`. |
45
45
  | `.claude/` | installed runtime config | Generated bundle or local runtime install. | Ignored. | Reinstall from `dist/claude-code/` instead of editing as source. |
46
46
  | `.codex/` | installed runtime config | Generated bundle or local runtime install. | Ignored. | Reinstall from `dist/codex/` or `scripts/install-codex-home.sh`; do not treat local hooks as canonical. |
47
47
  | `.githooks/` | canonical repo tooling | Tracked repository hook scripts. | Source, not runtime agent hooks. | Keep compatible with `npm run setup:repo-hooks` and `npm run validate:repo-hooks --`. |
@@ -115,7 +115,7 @@ The package requires Node `>=22`, and GitHub Actions runs CI on Node 22. Keep `@
115
115
 
116
116
  `.codex/` and `.claude/` at the repo root are installed runtime configuration surfaces. They can be useful for local testing, but canonical hook scripts and runtime config live in `scripts/hooks/`, `context/`, `packaging/`, and generated bundle output. The stale local `.codex/hooks.json` incident came from treating an installed runtime file as if it were canonical source. The fix is to regenerate or reinstall runtime config and update the canonical builder/install sources when behavior must change.
117
117
 
118
- `.flow-agents/<slug>/` is workflow working memory. Keep plans, sidecars, evidence, and handoffs there while work is active. Promote stable outcomes into `docs/`, schemas, source, or provider records before final acceptance.
118
+ `.kontourai/flow-agents/<slug>/` is workflow working memory. Keep plans, sidecars, evidence, and handoffs there while work is active. `.flow-agents/` is reserved for Flow Agents-owned durable config/install state when explicitly documented; do not use it for non-durable sessions. Promote stable outcomes into `docs/`, schemas, source, or provider records before final acceptance.
119
119
 
120
120
  Across Kontour repos, `.kontourai/` is the simple ignored home for non-durable local/generated workspace state. It is not a durable source root. Keep durable governance, Flow config, agent source, command source, and documentation in the product-owned tracked paths where developers expect them, including `.veritas/`, `.flow/`, `.agents/`, `.claude/commands`, and `docs/`. Existing transition ignores such as `.flow-agents/`, `.kontour/`, `.surface/`, `.veritas/evidence/`, `.flow/runs/`, and `.telemetry/` remain in place during migration.
121
121
 
@@ -82,7 +82,7 @@ This view shows how each phase is composed. The left rail is the durable phase s
82
82
  <section class="phase-lane phase-lane--primary"><h3>Primary</h3><p><code>builder-shape</code> <code>idea-to-backlog</code></p></section>
83
83
  <section class="phase-lane"><h3>Support</h3><p><code>search-first</code> <code>explore</code> <code>frontend-design</code> <code>github-cli</code> <code>knowledge-capture</code></p></section>
84
84
  <section class="phase-lane"><h3>Nested sections / future primitives</h3><p>intake/dedupe, separate ideas, thinnest meaningful slice, opportunity review, explore options, <code>shape-work</code>, prioritize work, sync executable backlog</p></section>
85
- <section class="phase-lane phase-lane--gate"><h3>Gate & artifact</h3><p>Idea, slice, shape, and backlog gates. Writes shaped briefs and GitHub issue links in <code>.flow-agents/&lt;slug&gt;/</code>.</p></section>
85
+ <section class="phase-lane phase-lane--gate"><h3>Gate & artifact</h3><p>Idea, slice, shape, and backlog gates. Writes shaped briefs and GitHub issue links in <code>.kontourai/flow-agents/&lt;slug&gt;/</code>.</p></section>
86
86
  </div>
87
87
  </article>
88
88
  <article class="phase-row">
@@ -137,15 +137,15 @@ The highest-leverage future extractions are likely `shape-work`, `test-map`, `sc
137
137
 
138
138
  Each workflow phase ends with an explicit gate and durable artifact:
139
139
 
140
- - `builder-shape` invokes Builder Kit shape, delegates to `idea-to-backlog`, links `kits/builder/flows/shape.flow.json`, and writes the standard `.flow-agents/<slug>/<slug>--idea-to-backlog.md` artifact.
141
- - `idea-to-backlog` writes `.flow-agents/<slug>/<slug>--idea-to-backlog.md` and produces shaped briefs plus GitHub issue links.
142
- - `pull-work` writes `.flow-agents/<slug>/<slug>--pull-work.md` with selected issues, WIP notes, blockers, pickup Probe decisions or accepted gaps, worktree decision, expected modified files, conflict risks, and a `plan-work` handoff.
143
- - `plan-work` and `deliver` write `.flow-agents/<slug>/<slug>--*.md` artifacts with `Definition Of Done`, `Goal Fit Gate`, and `Final Acceptance` sections.
140
+ - `builder-shape` invokes Builder Kit shape, delegates to `idea-to-backlog`, links `kits/builder/flows/shape.flow.json`, and writes the standard `.kontourai/flow-agents/<slug>/<slug>--idea-to-backlog.md` artifact.
141
+ - `idea-to-backlog` writes `.kontourai/flow-agents/<slug>/<slug>--idea-to-backlog.md` and produces shaped briefs plus GitHub issue links.
142
+ - `pull-work` writes `.kontourai/flow-agents/<slug>/<slug>--pull-work.md` with selected issues, WIP notes, blockers, pickup Probe decisions or accepted gaps, worktree decision, expected modified files, conflict risks, and a `plan-work` handoff.
143
+ - `plan-work` and `deliver` write `.kontourai/flow-agents/<slug>/<slug>--*.md` artifacts with `Definition Of Done`, `Goal Fit Gate`, and `Final Acceptance` sections.
144
144
  - `review-work` writes reviewer artifacts when available and updates `critique.json` with quality, security, architecture, standards, and resolution state.
145
145
  - `verify-work` writes verification artifacts and updates `evidence.json` with behavior evidence mapped to acceptance criteria.
146
- - `evidence-gate` writes `.flow-agents/<slug>/<slug>--evidence-gate.md` with acceptance evidence, CI summary, integrity report, verdict, and next step.
147
- - `release-readiness` writes `.flow-agents/<slug>/<slug>--release-readiness.md` with release scope, evidence reference, risk review, operational plan, rollback plan, observability plan, post-deploy checks, and decision.
148
- - `learning-review` writes `.flow-agents/<slug>/<slug>--learning-review.md` with outcomes, evidence, decisions, gaps, follow-ups, knowledge updates, and verdict.
146
+ - `evidence-gate` writes `.kontourai/flow-agents/<slug>/<slug>--evidence-gate.md` with acceptance evidence, CI summary, integrity report, verdict, and next step.
147
+ - `release-readiness` writes `.kontourai/flow-agents/<slug>/<slug>--release-readiness.md` with release scope, evidence reference, risk review, operational plan, rollback plan, observability plan, post-deploy checks, and decision.
148
+ - `learning-review` writes `.kontourai/flow-agents/<slug>/<slug>--learning-review.md` with outcomes, evidence, decisions, gaps, follow-ups, knowledge updates, and verdict.
149
149
 
150
150
  Core gates:
151
151
 
@@ -86,8 +86,8 @@ Flow Agents currently ships five canonical policy classes. Each policy class has
86
86
  **Canonical trigger event**: `userPromptSubmit` and `agentSpawn`/`SessionStart` (active-goal re-grounding), `postToolUse` (after `InvokeSubagents` tool calls)
87
87
 
88
88
  **Inputs consumed**:
89
- - `.flow-agents/<slug>/state.json` — current workflow phase and status
90
- - `.flow-agents/<slug>/critique.json` — open critique findings
89
+ - `.kontourai/flow-agents/<slug>/state.json` — current workflow phase and status
90
+ - `.kontourai/flow-agents/<slug>/critique.json` — open critique findings
91
91
  - `docs/context-map.md` — structure hint for repo navigation
92
92
 
93
93
  **Decision contract**: Non-blocking. Always exits 0. Appends steering text to the agent's context via `additionalContext` in the hook response. Does not block any action. It re-grounds the active workflow goal (status, phase, recorded next step) at the start of every user turn — not only for flagged/blocked states — and on `SessionStart`, which fires after context compaction and on resume. This is the mechanism that keeps an in-flight goal alive across context loss instead of relying on the model voluntarily re-reading the sidecar.
@@ -125,12 +125,14 @@ Flow Agents currently ships five canonical policy classes. Each policy class has
125
125
  **Canonical trigger event**: `stop`
126
126
 
127
127
  **Inputs consumed**:
128
- - `.flow-agents/<slug>/*.md` — workflow artifact files (scanned for active status, DOD, Goal Fit Gate sections)
129
- - `.flow-agents/<slug>/state.json` — workflow phase and next action
130
- - `.flow-agents/<slug>/evidence.json` — verification verdict and NOT_VERIFIED gaps
131
- - `.flow-agents/<slug>/critique.json` — critique status and open findings
132
- - `.flow-agents/<slug>/command-log.jsonl` — the deterministic capture log written by the Evidence Capture policy (see §2.5); cross-referenced against `evidence.json` claimed-pass command checks
133
- - `.flow-agents/<slug>/acceptance.json` — acceptance criteria; a criterion's `command`-kind `evidence_ref` (`excerpt`) is the most-trusted backstop command
128
+ - `.kontourai/flow-agents/<slug>/*.md` — workflow artifact files (scanned for active status, DOD, Goal Fit Gate sections)
129
+ - `.kontourai/flow-agents/<slug>/state.json` — workflow phase and next action
130
+ - `.kontourai/flow-agents/<slug>/evidence.json` — verification verdict and NOT_VERIFIED gaps
131
+ - `.kontourai/flow-agents/<slug>/critique.json` — critique status and open findings
132
+ - `.kontourai/flow-agents/<slug>/command-log.jsonl` — the deterministic capture log written by the Evidence Capture policy (see §2.5); cross-referenced against `evidence.json` claimed-pass command checks
133
+ - `.kontourai/flow-agents/<slug>/acceptance.json` — acceptance criteria; a criterion's `command`-kind `evidence_ref` (`excerpt`) is the most-trusted backstop command
134
+ - `.kontourai/flow-agents/current.json` (`active_flow_id`/`active_step_id`) — when present, resolves the active kit FlowDefinition's gate `expects[]` via the compiled `build/src/lib/flow-resolver.js` (`loadActiveFlowStep`, ADR 0016 Abstraction A P-c); requires `build/` to exist and fails open to the legacy `workflow.*`-only behavior when it does not (the `hasBuild` guard — the same fail-open pattern already used for the trust-bundle validator)
135
+ - The active kit's `kits/<kit>/flows/<flow>.flow.json` — the FlowDefinition file `current.json` resolves against; the matching gate's `expects[].bundle_claim.claimType` values become the declared claim types enforced for the active step (see FlowDefinition-driven claim selection below)
134
136
  - `FLOW_AGENTS_GOAL_FIT_MODE` env var — `block` | `warn` | `off` (the legacy `FLOW_AGENTS_GOAL_FIT_STRICT=true` is an alias for `block`)
135
137
  - `FLOW_AGENTS_GOAL_FIT_MAX_BLOCKS` env var — consecutive-identical-block cap before the escape hatch releases (default 3)
136
138
  - `FLOW_AGENTS_GOAL_FIT_BACKSTOP` env var — `block` (default) | `off`/`warn` | `skip`; controls the capture backstop re-run (see Capture cross-reference below)
@@ -143,6 +145,8 @@ Flow Agents currently ships five canonical policy classes. Each policy class has
143
145
  - `off`: silent (exits 0, no stderr).
144
146
  - Escape hatch: in `block` mode the same goal-fit gap is refused up to `FLOW_AGENTS_GOAL_FIT_MAX_BLOCKS` (default 3) consecutive times, then released (exit 0 with a loud notice) so a genuinely-unsatisfiable goal cannot trap the agent. A changing gap resets the streak.
145
147
 
148
+ **FlowDefinition-driven claim selection (ADR 0016 Abstraction A)**: When `current.json` resolves an active flow/step, `bundleEnforcement`'s claim-selection predicate (`isSelectedClaim`) is a **union**: `workflow.*`-prefixed claims are always selected as a baseline floor, and the active gate's declared `claimType` set (from `expects[].bundle_claim.claimType`, e.g. `builder.verify.tests`) is selected *in addition to* that floor — never instead of it. An earlier design used a pure if/else (declared types selected only when a FlowDefinition was active, with no `workflow.*` fallback) and was found in PR #215 to compose into a HIGH-severity gate-bypass chain: a forged `current.json` pointing at an `expects: []` flow made the if/else select zero claims, silently skipping all re-derivation, tamper-detection, and high/critical enforcement. The union floor closed that chain and is a **permanent** design decision, not a transitional step toward the if/else — see [ADR 0016](../adr/0016-three-hard-boundary-model.md) and the PR #215 post-mortem in [ADR 0015](../adr/0015-flow-flow-agents-boundary-reconciliation.md). Consequently, an active FlowDefinition whose gate resolves to an **empty** `expects[]` is always a `HARD_BLOCK` (`gate misconfiguration: active FlowDefinition has empty expects[]...`) — an empty declared set is treated as a possible tampered flow definition, never as a legitimately-empty gate that quietly enforces nothing beyond the floor.
149
+
146
150
  **Capture cross-reference (capture-first determinism)**: For each `evidence.checks[]` of `kind:"command"` claiming `status:"pass"` that carries a `command`, the gate cross-references the deterministic capture log (`command-log.jsonl`, §2.5) *before* trusting the model's claim:
147
151
 
148
152
  1. **Log shows the command ran and FAILED** → this is a caught false-completion → a blocking goal-fit gap (feeds the existing block/`MAX_BLOCKS` machinery).
@@ -186,9 +190,9 @@ Flow Agents currently ships five canonical policy classes. Each policy class has
186
190
  **Inputs consumed**:
187
191
  - `tool_name` + `tool_input.command` — identifies a command/shell execution (a command string present, with a command-shaped tool name; when no tool name is present but a command string is, it is still captured).
188
192
  - `tool_response` / `tool_output` / `error` — the host tool result (per §1, `postToolUse`); the source of the deterministically-observed outcome.
189
- - `.flow-agents/current.json` (`active_slug` / `artifact_dir`) then newest-mtime `state.json` — resolves the active artifact dir, the same way Workflow Steering and Stop-Goal-Fit do.
193
+ - `.kontourai/flow-agents/current.json` (`active_slug` / `artifact_dir`) then newest-mtime `state.json` — resolves the active artifact dir, the same way Workflow Steering and Stop-Goal-Fit do.
190
194
 
191
- **Output**: appends one JSON object per line to `.flow-agents/<slug>/command-log.jsonl`:
195
+ **Output**: appends one JSON object per line to `.kontourai/flow-agents/<slug>/command-log.jsonl`:
192
196
 
193
197
  ```json
194
198
  { "command": "npm test", "observedResult": "pass", "exitCode": 0, "capturedAt": "2026-06-23T00:00:00Z", "source": "postToolUse-capture" }
@@ -561,7 +565,7 @@ The CLI command is:
561
565
  flow-agents kit activate --adapter strands-local [--dest DIR] [--source-root DIR]
562
566
  ```
563
567
 
564
- This writes activated flow files to `.flow-agents/runtime/strands/flows/<kit-id>/<asset-id>.flow.json` and produces a parity-diagnostic `activation.json` (same schema as codex-local: `schema_version`, `adapter`, `supported_asset_classes`, `generated_runtime_files`, `skipped_assets`, `warnings`, `errors`).
568
+ This writes activated flow files to `.kontourai/flow-agents/projections/strands/flows/<kit-id>/<asset-id>.flow.json` and produces a parity-diagnostic `activation.json` (same schema as codex-local: `schema_version`, `adapter`, `supported_asset_classes`, `generated_runtime_files`, `skipped_assets`, `warnings`, `errors`).
565
569
 
566
570
  ### 9.2 Steering context surfacing (AC2)
567
571
 
@@ -572,7 +576,7 @@ This writes activated flow files to `.flow-agents/runtime/strands/flows/<kit-id>
572
576
  ```
573
577
  hooks = FlowAgentsHooks(workspace=".")
574
578
  system_prompt = base_prompt + hooks.steering_context()
575
- # steering_context() includes KIT FLOWS section if .flow-agents/runtime/strands/flows/ is populated
579
+ # steering_context() includes KIT FLOWS section if .kontourai/flow-agents/projections/strands/flows/ is populated
576
580
  ```
577
581
 
578
582
  **TypeScript usage**:
@@ -580,14 +584,14 @@ system_prompt = base_prompt + hooks.steering_context()
580
584
  ```typescript
581
585
  const hooks = new FlowAgentsHooks({ workspace: "." });
582
586
  const systemPrompt = basePrompt + hooks.steeringContext();
583
- // steeringContext() includes KIT FLOWS section if .flow-agents/runtime/strands/flows/ is populated
587
+ // steeringContext() includes KIT FLOWS section if .kontourai/flow-agents/projections/strands/flows/ is populated
584
588
  ```
585
589
 
586
590
  ### 9.3 Co-existence with codex-local
587
591
 
588
592
  The `codex-local` and `strands-local` runtime directories are independent:
589
593
 
590
- - `codex-local` writes to `.flow-agents/runtime/codex/`
591
- - `strands-local` writes to `.flow-agents/runtime/strands/`
594
+ - `codex-local` writes to `.kontourai/flow-agents/projections/codex/`
595
+ - `strands-local` writes to `.kontourai/flow-agents/projections/strands/`
592
596
 
593
597
  Running either adapter does not affect the other's runtime directory. Both adapters skip non-flow asset classes (skills, docs, adapters, evals, assets) with `reason: "asset class is diagnostic-only for <adapter>"`.