@kontourai/flow-agents 2.3.0 → 3.0.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 (301) hide show
  1. package/.github/CODEOWNERS +16 -0
  2. package/.github/workflows/ci.yml +44 -0
  3. package/.github/workflows/trust-reconcile.yml +62 -4
  4. package/AGENTS.md +4 -4
  5. package/CHANGELOG.md +62 -0
  6. package/CONTEXT.md +35 -0
  7. package/README.md +9 -3
  8. package/agents/dev.json +1 -1
  9. package/agents/tool-code-reviewer.json +1 -1
  10. package/agents/tool-planner.json +3 -3
  11. package/agents/tool-verifier.json +3 -3
  12. package/build/src/cli/assignment-provider.d.ts +1 -0
  13. package/build/src/cli/assignment-provider.js +748 -0
  14. package/build/src/cli/console-learning-projection.js +3 -2
  15. package/build/src/cli/effective-assignment-provider-settings.d.ts +1 -0
  16. package/build/src/cli/effective-assignment-provider-settings.js +125 -0
  17. package/build/src/cli/init.js +104 -21
  18. package/build/src/cli/kit.js +37 -6
  19. package/build/src/cli/pull-work-provider.js +1 -1
  20. package/build/src/cli/usage-feedback.js +3 -3
  21. package/build/src/cli/validate-hook-influence.js +1 -0
  22. package/build/src/cli/validate-workflow-artifacts.js +27 -7
  23. package/build/src/cli/workflow-artifact-cleanup-audit.js +36 -2
  24. package/build/src/cli/workflow-sidecar.d.ts +14 -7
  25. package/build/src/cli/workflow-sidecar.js +938 -168
  26. package/build/src/cli.js +6 -0
  27. package/build/src/flow-kit/validate.d.ts +23 -0
  28. package/build/src/flow-kit/validate.js +67 -1
  29. package/build/src/index.d.ts +1 -1
  30. package/build/src/index.js +1 -1
  31. package/build/src/lib/flow-resolver.d.ts +6 -4
  32. package/build/src/lib/flow-resolver.js +125 -58
  33. package/build/src/lib/local-artifact-root.d.ts +14 -2
  34. package/build/src/lib/local-artifact-root.js +22 -5
  35. package/build/src/lib/workflow-learning-projection.js +2 -2
  36. package/build/src/runtime-adapters.d.ts +12 -0
  37. package/build/src/runtime-adapters.js +56 -16
  38. package/build/src/tools/build-universal-bundles.js +49 -16
  39. package/build/src/tools/generate-context-map.js +10 -8
  40. package/build/src/tools/validate-source-tree.js +24 -1
  41. package/console.telemetry.json +22 -0
  42. package/context/contracts/artifact-contract.md +40 -7
  43. package/context/contracts/assignment-provider-contract.md +239 -0
  44. package/context/contracts/builder-kit-workflow-state-contract.md +5 -2
  45. package/context/contracts/decision-registry-contract.md +265 -0
  46. package/context/contracts/delivery-contract.md +3 -1
  47. package/context/contracts/execution-contract.md +25 -0
  48. package/context/contracts/governance-adapter-contract.md +2 -0
  49. package/context/contracts/knowledge-store-contract.md +197 -0
  50. package/context/contracts/planning-contract.md +4 -1
  51. package/context/contracts/review-contract.md +7 -3
  52. package/context/contracts/sandbox-policy.md +2 -0
  53. package/context/contracts/standing-directives.md +13 -0
  54. package/context/contracts/verification-contract.md +11 -1
  55. package/context/contracts/work-item-contract.md +3 -1
  56. package/context/deferred/parallelization.md +1 -1
  57. package/context/gate-awareness.md +4 -4
  58. package/context/scripts/git-status.sh +2 -2
  59. package/context/scripts/hooks/config-protection.js +502 -2
  60. package/context/scripts/hooks/lib/config-protection-remedies.js +69 -0
  61. package/context/scripts/hooks/run-hook.js +14 -1
  62. package/context/scripts/hooks/stop-goal-fit.js +1140 -99
  63. package/context/scripts/hooks/workflow-steering.js +212 -6
  64. package/context/settings/assignment-provider-settings.json +33 -0
  65. package/docs/adr/0007-flow-skill-kit-tool-boundary.md +2 -0
  66. package/docs/adr/0015-flow-flow-agents-boundary-reconciliation.md +35 -0
  67. package/docs/adr/0019-kit-dependency-ownership.md +62 -0
  68. package/docs/adr/0020-trust-reconcile-manifest-and-claim-classification.md +290 -0
  69. package/docs/adr/0021-assignment-leases-and-stale-claim-takeover.md +221 -0
  70. package/docs/adr/0022-fail-closed-delivery-reconciliation-with-governed-exemptions.md +463 -0
  71. package/docs/agent-system-guidebook.md +3 -3
  72. package/docs/agent-usage-feedback-loop.md +6 -6
  73. package/docs/context-map.md +10 -7
  74. package/docs/decisions/decision-records.md +57 -0
  75. package/docs/decisions/index.md +17 -0
  76. package/docs/decisions/knowledge-store-provider.md +51 -0
  77. package/docs/decisions/model-routing.md +63 -0
  78. package/docs/decisions/promotion-gate.md +52 -0
  79. package/docs/decisions/standing-directives.md +66 -0
  80. package/docs/developer-architecture.md +1 -1
  81. package/docs/fixture-ownership.md +4 -0
  82. package/docs/flow-kit-repository-contract.md +5 -5
  83. package/docs/getting-started.md +12 -2
  84. package/docs/integrations/harness-install.md +2 -1
  85. package/docs/kit-authoring-guide.md +64 -5
  86. package/docs/knowledge-kit.md +5 -1
  87. package/docs/learnings/2026-07-improvement-program.md +203 -0
  88. package/docs/migrations.md +6 -5
  89. package/docs/north-star.md +2 -2
  90. package/docs/operating-layers.md +4 -3
  91. package/docs/repository-structure.md +5 -5
  92. package/docs/skills-map.md +8 -8
  93. package/docs/spec/runtime-hook-surface.md +19 -15
  94. package/docs/spikes/graph-provider-2026-07.md +155 -0
  95. package/docs/standards-register.md +7 -7
  96. package/docs/trust-anchor-adoption.md +105 -4
  97. package/docs/work-item-adapters.md +1 -1
  98. package/docs/workflow-artifact-lifecycle.md +72 -9
  99. package/docs/workflow-eval-strategy.md +3 -3
  100. package/docs/workflow-shared-contracts.md +3 -2
  101. package/docs/workflow-usage-guide.md +260 -21
  102. package/evals/acceptance/DEMO-false-completion.md +20 -11
  103. package/evals/acceptance/prove-capture-teeth-declared.sh +15 -15
  104. package/evals/acceptance/prove-capture-teeth.sh +11 -11
  105. package/evals/acceptance/test_kiro_harness.sh +1 -1
  106. package/evals/ci/antigaming-suite.sh +5 -0
  107. package/evals/ci/run-baseline.sh +71 -1
  108. package/evals/fixtures/assignment-provider/actor-a.json +6 -0
  109. package/evals/fixtures/assignment-provider/actor-b.json +6 -0
  110. package/evals/fixtures/assignment-provider/github-issue-claimed.json +27 -0
  111. package/evals/fixtures/assignment-provider/github-issue-unassigned.json +7 -0
  112. package/evals/fixtures/assignment-provider/liveness-fresh.json +9 -0
  113. package/evals/fixtures/assignment-provider/liveness-stale.json +9 -0
  114. package/evals/fixtures/flow-kit-repository/invalid-bad-dependency/flows/review.flow.json +26 -0
  115. package/evals/fixtures/flow-kit-repository/invalid-bad-dependency/kit.json +13 -0
  116. package/evals/fixtures/flow-kit-repository/valid-with-dependency/flows/review.flow.json +26 -0
  117. package/evals/fixtures/flow-kit-repository/valid-with-dependency/kit.json +13 -0
  118. package/evals/fixtures/hook-influence/cases.json +32 -0
  119. package/evals/fixtures/pull-work-provider/github-issues.json +6 -6
  120. package/evals/fixtures/trust-reconcile-exploits/fabricated-attestation.json +59 -0
  121. package/evals/fixtures/trust-reconcile-exploits/no-label-bypass.json +36 -0
  122. package/evals/fixtures/trust-reconcile-exploits/skip-assumed-bypass.json +59 -0
  123. package/evals/fixtures/trust-reconcile-exploits/status-misassertion.json +48 -0
  124. package/evals/fixtures/trust-reconcile-exploits/waived-command-check.json +44 -0
  125. package/evals/fixtures/trust-reconcile-mixed-bundle/mixed-bundle.json +159 -0
  126. package/evals/fixtures/trust-reconcile-ws3/ws3-bundle.json +920 -0
  127. package/evals/integration/test_actor_identity.sh +254 -0
  128. package/evals/integration/test_assignment_provider_github.sh +318 -0
  129. package/evals/integration/test_assignment_provider_local_file.sh +222 -0
  130. package/evals/integration/test_builder_step_producers.sh +33 -23
  131. package/evals/integration/test_bundle_install.sh +22 -16
  132. package/evals/integration/test_bundle_lifecycle.sh +11 -11
  133. package/evals/integration/test_captured_fail_reconciliation.sh +50 -50
  134. package/evals/integration/test_checkpoint_signing.sh +43 -0
  135. package/evals/integration/test_claim_lookup.sh +4 -4
  136. package/evals/integration/test_codex_hook_resolution.sh +114 -0
  137. package/evals/integration/test_command_log_concurrency.sh +8 -8
  138. package/evals/integration/test_command_log_fork_classification.sh +3 -3
  139. package/evals/integration/test_command_log_integrity.sh +16 -16
  140. package/evals/integration/test_console_learning_projection.sh +1 -1
  141. package/evals/integration/test_critique_supersession_roundtrip.sh +182 -0
  142. package/evals/integration/test_dual_emit_flow_step.sh +145 -0
  143. package/evals/integration/test_enforcer_expects_driven.sh +12 -12
  144. package/evals/integration/test_evidence_capture_hook.sh +14 -13
  145. package/evals/integration/test_fixture_retirement_audit.sh +2 -2
  146. package/evals/integration/test_flow_agents_statusline.sh +2 -2
  147. package/evals/integration/test_flow_kit_install_git.sh +52 -0
  148. package/evals/integration/test_flow_kit_repository.sh +2 -0
  149. package/evals/integration/test_flowdef_session_activation.sh +6 -6
  150. package/evals/integration/test_flowdef_union_floor_regression.sh +429 -0
  151. package/evals/integration/test_gate_bypass_chain.sh +52 -40
  152. package/evals/integration/test_gate_lockdown.sh +97 -73
  153. package/evals/integration/test_gate_review_inquiry_records.sh +3 -3
  154. package/evals/integration/test_goal_fit_escape_hatch.sh +10 -10
  155. package/evals/integration/test_goal_fit_ghost_session.sh +104 -0
  156. package/evals/integration/test_goal_fit_hook.sh +32 -32
  157. package/evals/integration/test_goal_fit_rederive.sh +9 -9
  158. package/evals/integration/test_hook_category_behaviors.sh +103 -0
  159. package/evals/integration/test_hook_influence_cases.sh +1 -0
  160. package/evals/integration/test_install_merge.sh +262 -1
  161. package/evals/integration/test_kit_identity_trust.sh +6 -6
  162. package/evals/integration/test_liveness_conflict_injection.sh +587 -0
  163. package/evals/integration/test_liveness_heartbeat.sh +677 -0
  164. package/evals/integration/test_liveness_verdict.sh +394 -0
  165. package/evals/integration/test_local_flow_kit_install.sh +15 -0
  166. package/evals/integration/test_phase_map_and_gate_claim.sh +63 -11
  167. package/evals/integration/test_promote_gate.sh +178 -0
  168. package/evals/integration/test_publish_delivery.sh +23 -6
  169. package/evals/integration/test_pull_work_assignment_join.sh +132 -0
  170. package/evals/integration/test_pull_work_liveness_preflight.sh +394 -0
  171. package/evals/integration/test_pull_work_provider.sh +2 -2
  172. package/evals/integration/test_reconcile_soundness.sh +37 -13
  173. package/evals/integration/test_resolvefirststep_security.sh +22 -0
  174. package/evals/integration/test_runtime_adapter_activation.sh +87 -18
  175. package/evals/integration/test_session_resume_roundtrip.sh +147 -0
  176. package/evals/integration/test_sidecar_field_preservation.sh +249 -0
  177. package/evals/integration/test_trust_reconcile.sh +11 -10
  178. package/evals/integration/test_trust_reconcile_manifest.sh +79 -0
  179. package/evals/integration/test_trust_reconcile_mixed_bundle.sh +96 -0
  180. package/evals/integration/test_trust_reconcile_negatives.sh +759 -0
  181. package/evals/integration/test_usage_feedback_global.sh +5 -5
  182. package/evals/integration/test_validate_artifacts_portability.sh +60 -0
  183. package/evals/integration/test_verify_cli.sh +2 -2
  184. package/evals/integration/test_veritas_governance_kit.sh +117 -0
  185. package/evals/integration/test_workflow_artifact_cleanup_audit.sh +26 -1
  186. package/evals/integration/test_workflow_artifacts.sh +33 -0
  187. package/evals/integration/test_workflow_sidecar_writer.sh +802 -74
  188. package/evals/integration/test_workflow_steering_hook.sh +175 -5
  189. package/evals/lib/codex-provider.sh +1 -1
  190. package/evals/lib/node.sh +19 -1
  191. package/evals/run.sh +32 -0
  192. package/evals/static/test_decisions.sh +150 -0
  193. package/evals/static/test_flowdef_codeowners_coverage.sh +62 -0
  194. package/evals/static/test_knowledge_providers.sh +23 -0
  195. package/evals/static/test_package.sh +19 -10
  196. package/evals/static/test_universal_bundles.sh +48 -3
  197. package/evals/static/test_workflow_skills.sh +41 -8
  198. package/kits/builder/flows/build.flow.json +3 -74
  199. package/kits/builder/flows/publish-learn.flow.json +90 -0
  200. package/kits/builder/kit.json +11 -0
  201. package/kits/builder/skills/builder-shape/SKILL.md +1 -1
  202. package/kits/builder/skills/deliver/SKILL.md +32 -11
  203. package/kits/builder/skills/design-probe/SKILL.md +4 -4
  204. package/kits/builder/skills/evidence-gate/SKILL.md +26 -1
  205. package/kits/builder/skills/execute-plan/SKILL.md +2 -2
  206. package/kits/builder/skills/fix-bug/SKILL.md +2 -0
  207. package/kits/builder/skills/gate-review/SKILL.md +6 -6
  208. package/kits/builder/skills/idea-to-backlog/SKILL.md +1 -1
  209. package/kits/builder/skills/learning-review/SKILL.md +7 -7
  210. package/kits/builder/skills/pickup-probe/SKILL.md +5 -4
  211. package/kits/builder/skills/plan-work/SKILL.md +27 -5
  212. package/kits/builder/skills/pull-work/SKILL.md +148 -5
  213. package/kits/builder/skills/release-readiness/SKILL.md +4 -4
  214. package/kits/builder/skills/review-work/SKILL.md +24 -1
  215. package/kits/builder/skills/tdd-workflow/SKILL.md +2 -0
  216. package/kits/builder/skills/verify-work/SKILL.md +8 -1
  217. package/kits/catalog.json +6 -0
  218. package/kits/knowledge/kit.json +35 -0
  219. package/kits/knowledge/providers/conformance/fixtures/git-repo/CONTEXT.md +12 -0
  220. package/kits/knowledge/providers/conformance/fixtures/git-repo/docs/decisions/old-sprocket-shape.md +13 -0
  221. package/kits/knowledge/providers/conformance/fixtures/git-repo/docs/decisions/sprocket-shape.md +14 -0
  222. package/kits/knowledge/providers/conformance/fixtures/git-repo/docs/decisions/widget-format.md +14 -0
  223. package/kits/knowledge/providers/conformance/fixtures/git-repo/docs/learnings/fixture-learning.md +7 -0
  224. package/kits/knowledge/providers/conformance/fixtures/work-item/issues.json +30 -0
  225. package/kits/knowledge/providers/conformance/suite.test.js +125 -0
  226. package/kits/knowledge/providers/git-repo/index.js +236 -0
  227. package/kits/knowledge/providers/health/health-pass.test.js +99 -0
  228. package/kits/knowledge/providers/health/index.js +153 -0
  229. package/kits/knowledge/providers/index.js +24 -0
  230. package/kits/knowledge/providers/lib/model.js +91 -0
  231. package/kits/knowledge/providers/lib/schema-validate.js +119 -0
  232. package/kits/knowledge/providers/markdown-vault/index.js +169 -0
  233. package/kits/knowledge/providers/work-item/index.js +204 -0
  234. package/kits/veritas-governance/adapter/readiness-to-trust-bundle.mjs +178 -0
  235. package/kits/veritas-governance/docs/README.md +75 -0
  236. package/kits/veritas-governance/fixtures/readiness/not-ready.readiness-report.json +4645 -0
  237. package/kits/veritas-governance/fixtures/readiness/ready.readiness-report.json +4403 -0
  238. package/kits/veritas-governance/flows/readiness-check.flow.json +35 -0
  239. package/kits/veritas-governance/kit.json +16 -0
  240. package/package.json +11 -5
  241. package/packaging/README.md +2 -2
  242. package/packaging/conformance/fixtures/config-protection--allow-read-state-json.json +20 -0
  243. package/packaging/conformance/fixtures/config-protection--block-write-state-json.json +20 -0
  244. package/packaging/conformance/fixtures/stop-goal-fit--block-bundle-disputed-claim.json +1 -1
  245. package/packaging/conformance/fixtures/stop-goal-fit--block-capture-contradicts-claimed-pass.json +1 -1
  246. package/packaging/manifest.json +9 -10
  247. package/schemas/assignment-provider-settings.schema.json +125 -0
  248. package/schemas/decision-record.schema.json +109 -0
  249. package/schemas/knowledge/edge.schema.json +54 -0
  250. package/schemas/knowledge/health-report.schema.json +45 -0
  251. package/schemas/knowledge/node.schema.json +49 -0
  252. package/schemas/knowledge/proposal.schema.json +53 -0
  253. package/schemas/workflow-evidence.schema.json +1 -1
  254. package/schemas/workflow-state.schema.json +5 -0
  255. package/scripts/README.md +8 -3
  256. package/scripts/check-content-boundary.cjs +1 -1
  257. package/scripts/check-decisions.cjs +356 -0
  258. package/scripts/ci/derive-claim-status.mjs +74 -0
  259. package/scripts/ci/trust-reconcile.js +957 -103
  260. package/scripts/git-status.sh +2 -2
  261. package/scripts/hooks/claude-telemetry-hook.js +37 -3
  262. package/scripts/hooks/codex-telemetry-hook.js +36 -2
  263. package/scripts/hooks/config-protection.js +102 -30
  264. package/scripts/hooks/evidence-capture.js +3 -3
  265. package/scripts/hooks/lib/actor-identity.js +368 -0
  266. package/scripts/hooks/lib/config-protection-remedies.js +69 -0
  267. package/scripts/hooks/lib/liveness-heartbeat.js +361 -0
  268. package/scripts/hooks/lib/liveness-policy.js +127 -0
  269. package/scripts/hooks/lib/liveness-read.js +105 -12
  270. package/scripts/hooks/lib/liveness-write.js +46 -0
  271. package/scripts/hooks/lib/local-artifact-paths.js +12 -6
  272. package/scripts/hooks/opencode-telemetry-hook.js +27 -1
  273. package/scripts/hooks/pi-telemetry-hook.js +27 -1
  274. package/scripts/hooks/stop-goal-fit.js +157 -26
  275. package/scripts/hooks/workflow-steering.js +77 -3
  276. package/scripts/install-codex-home.sh +138 -38
  277. package/scripts/statusline/flow-agents-statusline.js +2 -2
  278. package/src/cli/assignment-provider.ts +845 -0
  279. package/src/cli/console-learning-projection.ts +3 -2
  280. package/src/cli/effective-assignment-provider-settings.ts +112 -0
  281. package/src/cli/init.ts +101 -21
  282. package/src/cli/kit.ts +37 -6
  283. package/src/cli/public-api.test.mjs +58 -6
  284. package/src/cli/pull-work-provider.ts +1 -1
  285. package/src/cli/trust-bundle-policy-order.test.mjs +87 -0
  286. package/src/cli/usage-feedback.ts +3 -3
  287. package/src/cli/validate-hook-influence.ts +1 -0
  288. package/src/cli/validate-workflow-artifacts.ts +27 -7
  289. package/src/cli/veritas-readiness-adapter.test.mjs +267 -0
  290. package/src/cli/workflow-artifact-cleanup-audit.ts +35 -2
  291. package/src/cli/workflow-sidecar.ts +933 -168
  292. package/src/cli.ts +6 -0
  293. package/src/flow-kit/validate.ts +74 -1
  294. package/src/index.ts +6 -2
  295. package/src/lib/flow-resolver.ts +123 -55
  296. package/src/lib/local-artifact-root.ts +24 -5
  297. package/src/lib/workflow-learning-projection.ts +2 -2
  298. package/src/runtime-adapters.ts +61 -15
  299. package/src/tools/build-universal-bundles.ts +49 -16
  300. package/src/tools/generate-context-map.ts +10 -8
  301. package/src/tools/validate-source-tree.ts +24 -1
@@ -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,17 @@
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
+ | [knowledge-store-provider](./knowledge-store-provider.md) | current | Knowledge store provider |
15
+ | [model-routing](./model-routing.md) | current | Model routing |
16
+ | [promotion-gate](./promotion-gate.md) | current | Promotion gate |
17
+ | [standing-directives](./standing-directives.md) | current | Standing directives |
@@ -0,0 +1,51 @@
1
+ ---
2
+ status: current
3
+ subject: Knowledge store provider
4
+ decided: 2026-07-02
5
+ evidence:
6
+ - kind: issue
7
+ ref: https://github.com/kontourai/flow-agents/issues/317
8
+ - kind: doc
9
+ ref: context/contracts/knowledge-store-contract.md
10
+ - kind: session-archive
11
+ ref: .kontourai/flow-agents/decision-registry-shape/decision-registry-shape--idea-to-backlog.md
12
+ ---
13
+
14
+ # Knowledge store provider
15
+
16
+ The Knowledge Kit owns a storage-independent **Knowledge Graph** model — typed
17
+ nodes (`note`, `decision`, `issue`, `session`, `person`; extensible), a closed
18
+ edge vocabulary (`supersedes`, `merged-into`, `blocks`, `evidence-of`,
19
+ `mentions`, `relates`), and provenance on both — with storage and sync as
20
+ pluggable **providers**. The same read and health verbs run over every provider.
21
+
22
+ ## Decision
23
+
24
+ - The normative model + provider interface live in
25
+ `context/contracts/knowledge-store-contract.md`, backed by JSON schemas at
26
+ `schemas/knowledge/{node,edge,proposal,health-report}.schema.json`.
27
+ - The write side is **proposals-only**, expressed structurally: a provider's
28
+ `proposeWrite` can only return a proposal whose `status` is the const
29
+ `"proposed"` and MUST NOT mutate the store. Enactment is downstream — the
30
+ git-repo provider renders a decision-registry topic file for the **promote
31
+ sub-flow**; work-item renders a draft `gh` comment/label; markdown-vault
32
+ renders a native frontmatter+wikilink note. This mirrors the store contract's
33
+ `propose → apply/reject` gate rather than forking a new write path.
34
+ - Three reference providers ship: **markdown-vault** (a thin read+propose wrapper
35
+ over the existing store adapter — existing skills unaffected), **git-repo**
36
+ (decision-registry tombstones/evidence, CONTEXT.md glossary, learnings), and
37
+ **work-item** (GitHub issues via an injectable `gh` runner, so backlog hygiene
38
+ becomes a knowledge-health pass).
39
+ - Health verbs (duplicate detection, dependency-link integrity) are
40
+ **provider-agnostic** functions over `{nodes, edges}` and emit schema-valid
41
+ health reports. A parameterized conformance suite gates every provider.
42
+
43
+ ## Rationale
44
+
45
+ The portfolio provider pattern (hachure format/adapters; Builder Kit
46
+ work-item contract/providers) had not been applied to knowledge, which was fused
47
+ to the markdown-vault shape. Rule-of-three passes on stores operated today: a
48
+ duplicate backlog issue (traverse#14) caught manually is now caught mechanically
49
+ by a graph pass over the work-item adapter. A graph-database provider stays a
50
+ gated spike (#318) — adoption waits on a real query failing over file providers,
51
+ not speculation.
@@ -0,0 +1,63 @@
1
+ ---
2
+ status: current
3
+ subject: Model routing
4
+ decided: 2026-07-03
5
+ evidence:
6
+ - kind: issue
7
+ ref: https://github.com/kontourai/flow-agents/issues/364
8
+ - kind: url
9
+ ref: https://claude.ai/code/session_01CEPxsn2GuWdysEMACRHsFQ
10
+ ---
11
+
12
+ # Model routing
13
+
14
+ Which model backs which delegate role is **data resolved by the orchestrator
15
+ at delegation time**, not code baked into generated files or per-agent
16
+ frontmatter.
17
+
18
+ ## Decision
19
+
20
+ - Model-routing policy is committed data in `.datum/config.json` (read by the
21
+ `@kontourai/datum` registry, `datum.schema.json`): a `providers` map
22
+ (`anthropic`, `zai`) and a `roles` map keyed by delegate role name
23
+ (`delegate-mechanical`, `delegate-implementation`, `delegate-design`,
24
+ `orchestrator`, `extraction-default`) to a `model@provider` ref.
25
+ - **The orchestrator resolves the role via datum at delegation time** —
26
+ `datum resolve <role> --json` or the library `resolve()` — and passes the
27
+ resolved model **explicitly** when spawning each delegate. The consumption
28
+ instruction lives in `context/contracts/execution-contract.md` § Delegation:
29
+ Model Routing (where orchestrators actually read it), with a matching
30
+ summary table in `kits/builder/skills/deliver/SKILL.md` § Model Routing.
31
+ `.datum/config.json` is the single source of truth for the mapping; the
32
+ contracts/skills only say where to read it.
33
+ - No generated files and no per-agent frontmatter changes. Roles are the
34
+ stable reference; which model a role resolves to can change without
35
+ touching any delegation call site, skill, or agent definition.
36
+ - When datum or the config is absent, delegation falls back to the runtime's
37
+ inherited model and the fallback is noted in the session/task artifact
38
+ rather than blocking delegation.
39
+
40
+ ## Rejected alternatives
41
+
42
+ - **Generated per-agent frontmatter** (a build step stamping a model into
43
+ each agent definition file) — rejected because it reintroduces a generated
44
+ artifact that drifts from the data it was generated from and requires a
45
+ regeneration step on every routing-policy change, which this program has
46
+ standing directives against (no generated files as the routing surface).
47
+ - **Environment-variable-only selection** (e.g. one global
48
+ `ANTHROPIC_MODEL`-style override with no role granularity) — rejected
49
+ because it collapses distinct delegate shapes (mechanical vs.
50
+ precisely-planned implementation vs. design-latitude vs. orchestrator) onto
51
+ a single model choice, losing the per-role routing this design exists to
52
+ express, and because it is not resolvable per-delegate-spawn within a
53
+ single process the way an explicit per-call model override is.
54
+
55
+ ## Rationale
56
+
57
+ Routing policy changes independently of, and more often than, the skills and
58
+ contracts that consume it (new models, new providers, retuned role-to-model
59
+ mappings). Keeping it as data in `.datum/config.json` — the same registry
60
+ shape the `extraction-default` role already establishes as portfolio
61
+ precedent — means a routing change is a config edit reviewed like any other
62
+ data change, not a source/doc change scattered across every delegating
63
+ skill.
@@ -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.
@@ -0,0 +1,66 @@
1
+ ---
2
+ status: current
3
+ subject: Standing directives
4
+ decided: 2026-07-03
5
+ evidence:
6
+ - kind: issue
7
+ ref: https://github.com/kontourai/flow-agents/issues/348
8
+ - kind: pr
9
+ ref: https://github.com/kontourai/datum/pull/3
10
+ - kind: pr
11
+ ref: https://github.com/kontourai/flow-agents/pull/344
12
+ - kind: issue
13
+ ref: https://github.com/kontourai/flow-agents/issues/347
14
+ - kind: issue
15
+ ref: https://github.com/kontourai/surface/issues/110
16
+ - kind: pr
17
+ ref: https://github.com/kontourai/surface/pull/113
18
+ - kind: doc
19
+ ref: docs/repository-structure.md
20
+ ---
21
+
22
+ # Standing directives
23
+
24
+ Ratified owner directives get a durable, quotable home at
25
+ `context/contracts/standing-directives.md` instead of living only in the
26
+ ephemeral context of whichever orchestrator session ratified them.
27
+
28
+ ## Decision
29
+
30
+ - `context/contracts/standing-directives.md` holds a short, numbered list of
31
+ owner-ratified directives, each with a one-line rationale and the date it
32
+ was ratified.
33
+ - Every other file under `context/contracts/` carries a one-line pointer in
34
+ its header area to `standing-directives.md`, so any agent that loads a
35
+ phase contract also receives the standing directives regardless of which
36
+ task in a plan it was delegated.
37
+ - A standing directive overrides default engineering conservatism (e.g.
38
+ keeping a compatibility path reachable "just in case") wherever it applies.
39
+ An agent that believes a directive does not fit a situation stops and
40
+ reports the conflict rather than silently choosing a side.
41
+ - The seeded July 2026 directives: no legacy fallbacks (migrate hard, loud
42
+ typed error naming the regeneration command); durable-vs-runtime path
43
+ convention (`.kontourai/` is gitignored runtime state, `.<product>/` is a
44
+ product's durable committed directory); evidence must be executable;
45
+ standalone-first then integrate; and the regression rule for cutovers
46
+ (large regressions are surfaced as an explicit owner decision with data,
47
+ never papered over, but do not block the cutover by default).
48
+
49
+ ## Rationale
50
+
51
+ A delegated agent working one slice of a plan only sees the task prompt it
52
+ was given. If a ratified correction — such as "no legacy fallbacks" — lives
53
+ only in the orchestrator's context from the session that ratified it, the
54
+ delegate never receives it and can reintroduce the exact behavior the owner
55
+ already corrected. Wiring a pointer into every contract header makes receipt
56
+ structural rather than dependent on the orchestrator remembering to restate
57
+ the correction in every task prompt.
58
+
59
+ The individual directives are evidenced by hard-cutover precedent
60
+ ([datum#3](https://github.com/kontourai/datum/pull/3)), the fallback-removal
61
+ follow-up to [flow-agents#344](https://github.com/kontourai/flow-agents/pull/344)
62
+ tracked as [flow-agents#347](https://github.com/kontourai/flow-agents/issues/347),
63
+ and the durable-vs-runtime path convention already documented in
64
+ [docs/repository-structure.md](../repository-structure.md) and applied in
65
+ [surface#110](https://github.com/kontourai/surface/issues/110) /
66
+ [surface#113](https://github.com/kontourai/surface/pull/113).
@@ -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
 
@@ -13,6 +13,7 @@ run `npm run validate:source --` and `npm run fixture:retirement-audit --`.
13
13
 
14
14
  | Fixture directory | Classification | Owners | Cleanup rule |
15
15
  | --- | --- | --- | --- |
16
+ | `evals/fixtures/assignment-provider` | AssignmentProvider local-file and GitHub render/status fixtures (#290) | `evals/integration/test_assignment_provider_local_file.sh`, `evals/integration/test_assignment_provider_github.sh`, `evals/integration/test_pull_work_assignment_join.sh` | Keep while the assignment provider contract's claim/release/supersede/status/list operations and the assignment ⋈ liveness join are tested against local-file and GitHub fixture inputs. |
16
17
  | `evals/fixtures/backlog-provider-settings` | settings precedence fixtures | `evals/integration/test_effective_backlog_settings.sh` | Keep while backlog provider settings resolution supports global defaults and project overrides. |
17
18
  | `evals/fixtures/builder-kit-workflow-state` | Builder Kit workflow-state fixtures | `evals/static/test_workflow_skills.sh` | Keep while Builder Kit state contract and resume behavior are documented in workflow skill contracts. |
18
19
  | `evals/fixtures/console-learning-projection` | console learning projection fixtures | `evals/integration/test_console_learning_projection.sh` | Keep while learning projection supports correction and open-route examples. |
@@ -22,6 +23,9 @@ run `npm run validate:source --` and `npm run fixture:retirement-audit --`.
22
23
  | `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
24
  | `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
25
  | `evals/fixtures/surface-trust` | Surface trust evidence fixtures | `evals/integration/test_workflow_sidecar_writer.sh` | Keep while sidecar writer maps Surface trust evidence into workflow records. |
26
+ | `evals/fixtures/trust-reconcile-exploits` | WS8 trust-reconcile anti-gaming exploit fixtures (frozen negative regressions) | `evals/integration/test_trust_reconcile_negatives.sh` | Keep while trust-reconcile.js enforces the WS8 iteration-2 soundness properties (no-label test_output, unwaived-assumed, status-misassertion, waiver-on-command); each fixture is a permanent negative regression. |
27
+ | `evals/fixtures/trust-reconcile-mixed-bundle` | WS8 trust-reconcile mixed-evidence end-to-end proof fixture | `evals/integration/test_trust_reconcile_mixed_bundle.sh` | Keep while the trust-reconcile manifest/classification/waiver contract (ADR 0020) is enforced; proves a mixed test_output + session-local + waived bundle passes the CI anchor. |
28
+ | `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
29
  | `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
30
  | `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
31
 
@@ -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
 
@@ -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