@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
@@ -87,6 +87,7 @@ for (const entry of required) {
87
87
  const requiredExcludes = [
88
88
  "!evals/cases/dev/node_modules/",
89
89
  "!**/.flow-agents/",
90
+ "!**/.kontourai/",
90
91
  "!**/.surface/",
91
92
  "!**/.telemetry/",
92
93
  "!**/.veritas/",
@@ -99,7 +100,7 @@ const forbidden = [
99
100
  ".agents/",
100
101
  ".codex/",
101
102
  ".claude/",
102
- ".flow-agents/",
103
+ ".kontourai/",
103
104
  ".surface/",
104
105
  ".telemetry/",
105
106
  ".veritas/",
@@ -120,7 +121,7 @@ NODE
120
121
  if node - "$ROOT_DIR/console.telemetry.json" <<'NODE'
121
122
  const fs = require("node:fs");
122
123
  const descriptor = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));
123
- for (const id of ["builder.shape", "builder.build"]) {
124
+ for (const id of ["builder.shape", "builder.build", "builder.publish-learn"]) {
124
125
  const flow = (descriptor.flows || []).find((candidate) => candidate.id === id);
125
126
  if (!flow) throw new Error(`missing ${id} flow descriptor`);
126
127
  if (!flow.detailAttributes || Array.isArray(flow.detailAttributes) || typeof flow.detailAttributes !== "object") {
@@ -142,14 +143,14 @@ NODE
142
143
  else
143
144
  _pass "tracked source has no legacy Flow Agents rename references"
144
145
  fi
145
- if (cd "$ROOT_DIR" && FLOW_AGENTS_CONTENT_BOUNDARY_FILES='.flow-agents/example/state.json' node scripts/check-content-boundary.cjs >/tmp/content-boundary-runtime.out 2>&1); then
146
+ if (cd "$ROOT_DIR" && FLOW_AGENTS_CONTENT_BOUNDARY_FILES='.kontourai/flow-agents/example/state.json' node scripts/check-content-boundary.cjs >/tmp/content-boundary-runtime.out 2>&1); then
146
147
  _fail "content boundary allows ordinary workflow runtime artifacts"
147
148
  elif rg -q 'Flow Agents runtime artifact must not be tracked' /tmp/content-boundary-runtime.out; then
148
149
  _pass "content boundary blocks ordinary workflow runtime artifacts"
149
150
  else
150
151
  _fail "content boundary runtime rejection was not actionable"
151
152
  fi
152
- if (cd "$ROOT_DIR" && FLOW_AGENTS_CONTENT_BOUNDARY_FILES='.flow-agents/nested/example/closeout.md' node scripts/check-content-boundary.cjs >/tmp/content-boundary-nested.out 2>&1); then
153
+ if (cd "$ROOT_DIR" && FLOW_AGENTS_CONTENT_BOUNDARY_FILES='.kontourai/flow-agents/nested/example/closeout.md' node scripts/check-content-boundary.cjs >/tmp/content-boundary-nested.out 2>&1); then
153
154
  _fail "content boundary allows nested workflow runtime artifacts"
154
155
  elif rg -q 'Flow Agents runtime artifact must not be tracked' /tmp/content-boundary-nested.out; then
155
156
  _pass "content boundary blocks nested workflow runtime artifacts"
@@ -157,7 +158,7 @@ NODE
157
158
  _fail "content boundary nested runtime rejection was not actionable"
158
159
  fi
159
160
  current_branch="$(cd "$ROOT_DIR" && git branch --show-current 2>/dev/null || true)"
160
- tracked_runtime_artifacts="$(cd "$ROOT_DIR" && git ls-files -- '.flow-agents' 2>/dev/null || true)"
161
+ tracked_runtime_artifacts="$(cd "$ROOT_DIR" && git ls-files -- '.kontourai/flow-agents' 2>/dev/null || true)"
161
162
  if [[ "$current_branch" == "main" && -n "$tracked_runtime_artifacts" ]]; then
162
163
  printf '%s\n' "$tracked_runtime_artifacts" >/tmp/tracked-flow-agent-runtime-artifacts.txt
163
164
  _fail "main contains tracked workflow runtime artifacts (see /tmp/tracked-flow-agent-runtime-artifacts.txt)"
@@ -174,12 +175,12 @@ NODE
174
175
  else
175
176
  _fail "installed bundle is missing Kit Catalog or Builder Kit manifest"
176
177
  fi
177
- if [[ -f "$PACKAGE_DIR/kits/builder/flows/shape.flow.json" && -f "$PACKAGE_DIR/kits/builder/flows/build.flow.json" ]]; then
178
+ if [[ -f "$PACKAGE_DIR/kits/builder/flows/shape.flow.json" && -f "$PACKAGE_DIR/kits/builder/flows/build.flow.json" && -f "$PACKAGE_DIR/kits/builder/flows/publish-learn.flow.json" ]]; then
178
179
  _pass "installed bundle includes Builder Kit Flow Definitions"
179
180
  else
180
181
  _fail "installed bundle is missing Builder Kit Flow Definitions"
181
182
  fi
182
- if node - "$PACKAGE_DIR/kits/catalog.json" "$PACKAGE_DIR/kits/builder/kit.json" "$PACKAGE_DIR/kits/builder/flows/shape.flow.json" "$PACKAGE_DIR/kits/builder/flows/build.flow.json" <<'NODE'
183
+ if node - "$PACKAGE_DIR/kits/catalog.json" "$PACKAGE_DIR/kits/builder/kit.json" "$PACKAGE_DIR/kits/builder/flows/shape.flow.json" "$PACKAGE_DIR/kits/builder/flows/build.flow.json" "$PACKAGE_DIR/kits/builder/flows/publish-learn.flow.json" <<'NODE'
183
184
  const fs = require("node:fs");
184
185
  for (const file of process.argv.slice(2)) JSON.parse(fs.readFileSync(file, "utf8"));
185
186
  console.log("ok");
@@ -189,9 +190,10 @@ NODE
189
190
  else
190
191
  _fail "installed kit JSON parse failed"
191
192
  fi
192
- if node - "$PACKAGE_DIR/kits/builder/flows/build.flow.json" <<'NODE'
193
+ if node - "$PACKAGE_DIR/kits/builder/flows/build.flow.json" "$PACKAGE_DIR/kits/builder/flows/publish-learn.flow.json" <<'NODE'
193
194
  const fs = require("node:fs");
194
195
  const flow = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));
196
+ const publishLearn = JSON.parse(fs.readFileSync(process.argv[3], "utf8"));
195
197
  const steps = Object.fromEntries((flow.steps || []).map((step) => [step.id, step.next]));
196
198
  if (steps["pull-work"] !== "design-probe") throw new Error("pull-work should route to design-probe");
197
199
  if (steps["design-probe"] !== "plan") throw new Error("design-probe should route to plan");
@@ -208,13 +210,20 @@ for (const gateId of ["verify-gate", "merge-ready-gate"]) {
208
210
  for (const [reason, target] of Object.entries(expected)) if (gate.on_route_back?.[reason] !== target) throw new Error(`${gateId} ${reason} should route to ${target}`);
209
211
  if (gate.route_back_policy?.on_exceeded !== "block") throw new Error(`${gateId} route_back_policy should block on exceeded attempts`);
210
212
  }
211
- const expectations = Object.values(flow.gates || {}).flatMap((gate) => gate.expects || []);
213
+ for (const stepId of ["pr-open", "merge-ready-ci", "learn"]) {
214
+ const step = (flow.steps || []).find((item) => item.id === stepId);
215
+ if (step?.uses_flow !== "builder.publish-learn") throw new Error(`${stepId} should compose builder.publish-learn`);
216
+ }
217
+ const expectations = [
218
+ ...Object.values(flow.gates || {}).flatMap((gate) => gate.expects || []),
219
+ ...Object.values(publishLearn.gates || {}).flatMap((gate) => gate.expects || []),
220
+ ];
212
221
  if (!expectations.length) throw new Error("Builder build flow should declare gate expectations");
213
222
  for (const expectation of expectations) {
214
223
  if (expectation.kind !== "trust.bundle") throw new Error(`${expectation.id || "<unknown>"} should remain a trust.bundle expectation`);
215
224
  if (!expectation.bundle_claim?.claimType || !expectation.bundle_claim?.accepted_statuses) throw new Error(`${expectation.id || "<unknown>"} should declare bundle_claim claimType and accepted statuses`);
216
225
  }
217
- const flowText = JSON.stringify(flow).toLowerCase();
226
+ const flowText = JSON.stringify({ flow, publishLearn }).toLowerCase();
218
227
  for (const term of ["veritas", "trust_provider", "trust-provider", "provider_name", "provider_ref", "veritas_policy", "veritas_readiness"]) {
219
228
  if (flowText.includes(term)) throw new Error(`Builder build flow should not name provider-specific trust field: ${term}`);
220
229
  }
@@ -10,7 +10,7 @@ pass=0
10
10
  fail=0
11
11
 
12
12
  cleanup() {
13
- rm -rf "$REPRO_FIRST_DIR" "$REPRO_SECOND_DIR"
13
+ rm -rf "$REPRO_FIRST_DIR" "$REPRO_SECOND_DIR" "$ROOT_DIR/kits/zzz-collision-eval-probe"
14
14
  }
15
15
  trap cleanup EXIT
16
16
 
@@ -172,11 +172,15 @@ if node - "$DIST_DIR/codex/.codex" <<'NODE'
172
172
  const fs = require("node:fs");
173
173
  const path = require("node:path");
174
174
  const root = process.argv[2];
175
- const expected = ["kdev", "kdev-br"];
175
+ const expected = ["builder", "personal"];
176
176
  const missingFiles = expected.filter((name) => !fs.existsSync(path.join(root, `${name}.config.toml`)));
177
177
  if (missingFiles.length) throw new Error(`profile-v2 config files missing: ${missingFiles.join(", ")}`);
178
+ const extra = fs.readdirSync(root).filter((name) => name.endsWith(".config.toml") && !expected.includes(name.replace(/\.config\.toml$/, "")));
179
+ if (extra.length) throw new Error(`unexpected generated profile files: ${extra.join(", ")}`);
178
180
  const missing = expected.filter((name) => !fs.readFileSync(path.join(root, `${name}.config.toml`), "utf8").includes('approvals_reviewer = "auto_review"'));
179
181
  if (missing.length) throw new Error(`profile auto-review approval reviewer missing: ${missing.join(", ")}`);
182
+ const personal = fs.readFileSync(path.join(root, "personal.config.toml"), "utf8");
183
+ if (!personal.includes("Flow Agents Personal mode") || !personal.includes("knowledge-capture")) throw new Error("personal profile does not carry knowledge-work instructions");
180
184
  console.log("ok");
181
185
  NODE
182
186
  then
@@ -373,7 +377,7 @@ fi
373
377
 
374
378
  echo ""
375
379
  echo "--- Shared Task Dirs ---"
376
- for dir in "$DIST_DIR/claude-code/.flow-agents" "$DIST_DIR/codex/.flow-agents" "$DIST_DIR/opencode/.flow-agents" "$DIST_DIR/pi/.flow-agents"; do
380
+ for dir in "$DIST_DIR/claude-code/.kontourai/flow-agents" "$DIST_DIR/codex/.kontourai/flow-agents" "$DIST_DIR/opencode/.kontourai/flow-agents" "$DIST_DIR/pi/.kontourai/flow-agents"; do
377
381
  if [[ -d "$dir" ]]; then
378
382
  _pass "$(realpath "$dir" 2>/dev/null || echo "$dir") exists"
379
383
  else
@@ -426,6 +430,47 @@ else
426
430
  _fail "pi adapter block path dropped the policy reason"
427
431
  fi
428
432
 
433
+ echo ""
434
+ echo "--- Skill collision detector (AC6) ---"
435
+ # Positive: the real skill set across skills/ and kits/*/kit.json builds with no collision.
436
+ if (cd "$ROOT_DIR" && FLOW_AGENTS_DIST_DIR="$(mktemp -d)" node build/src/cli.js build-bundles) >/tmp/universal-bundle-collision-clean.txt 2>&1; then
437
+ _pass "build succeeds with the current (collision-free) skill set"
438
+ else
439
+ _fail "clean build unexpectedly failed"
440
+ sed -n '1,60p' /tmp/universal-bundle-collision-clean.txt
441
+ fi
442
+
443
+ # Negative: a synthetic kit re-using an existing skill directory name (deliver) must FAIL
444
+ # the build with a diagnostic naming both source kits.
445
+ COLLIDE_KIT="$ROOT_DIR/kits/zzz-collision-eval-probe"
446
+ rm -rf "$COLLIDE_KIT"
447
+ mkdir -p "$COLLIDE_KIT/skills/deliver"
448
+ cat > "$COLLIDE_KIT/kit.json" <<'KITJSON'
449
+ {
450
+ "schema_version": "1.0",
451
+ "id": "zzz-collision-eval-probe",
452
+ "name": "Collision Eval Probe",
453
+ "flows": [],
454
+ "skills": [
455
+ { "id": "zzz.deliver", "path": "skills/deliver/SKILL.md" }
456
+ ]
457
+ }
458
+ KITJSON
459
+ printf '# collision probe skill\n' > "$COLLIDE_KIT/skills/deliver/SKILL.md"
460
+ if (cd "$ROOT_DIR" && FLOW_AGENTS_DIST_DIR="$(mktemp -d)" node build/src/cli.js build-bundles) >/tmp/universal-bundle-collision.txt 2>&1; then
461
+ _fail "build should FAIL when two kits declare the same skill directory name"
462
+ else
463
+ if grep -q "skill name collision" /tmp/universal-bundle-collision.txt \
464
+ && grep -q "kits/builder" /tmp/universal-bundle-collision.txt \
465
+ && grep -q "zzz-collision-eval-probe" /tmp/universal-bundle-collision.txt; then
466
+ _pass "build fails with a clear collision diagnostic naming both source kits"
467
+ else
468
+ _fail "collision diagnostic missing expected text"
469
+ sed -n '1,60p' /tmp/universal-bundle-collision.txt
470
+ fi
471
+ fi
472
+ rm -rf "$COLLIDE_KIT"
473
+
429
474
  echo ""
430
475
  echo "==========================="
431
476
  total=$((pass + fail))
@@ -77,6 +77,7 @@ OPERATING_LAYERS_DOC="$ROOT/docs/operating-layers.md"
77
77
  DEVELOPER_ARCHITECTURE_DOC="$ROOT/docs/developer-architecture.md"
78
78
  GITIGNORE="$ROOT/.gitignore"
79
79
  BUILDER_BUILD_FLOW="$ROOT/kits/builder/flows/build.flow.json"
80
+ BUILDER_PUBLISH_LEARN_FLOW="$ROOT/kits/builder/flows/publish-learn.flow.json"
80
81
  FLOW_AGENTS_FLOW_ADR="$ROOT/docs/adr/0001-flow-agents-consumes-flow.md"
81
82
  ARTIFACT_CONTRACT="$ROOT/context/contracts/artifact-contract.md"
82
83
  PLANNING_CONTRACT="$ROOT/context/contracts/planning-contract.md"
@@ -180,6 +181,7 @@ require_file "$ARTIFACT_LIFECYCLE_DOC" "workflow artifact lifecycle doc"
180
181
  require_file "$OPERATING_LAYERS_DOC" "operating layers doc"
181
182
  require_file "$DEVELOPER_ARCHITECTURE_DOC" "developer architecture doc"
182
183
  require_file "$BUILDER_BUILD_FLOW" "Builder Kit build Flow Definition"
184
+ require_file "$BUILDER_PUBLISH_LEARN_FLOW" "Builder Kit publish-learn Flow Definition"
183
185
  require_file "$FLOW_AGENTS_FLOW_ADR" "Flow Agents Flow boundary ADR"
184
186
  require_file "$ARTIFACT_CONTRACT" "artifact contract"
185
187
  require_file "$PLANNING_CONTRACT" "planning contract"
@@ -294,7 +296,7 @@ require_text "$DELIVERY_CONTRACT" 'Final Acceptance' "delivery contract defines
294
296
  require_text "$DELIVERY_CONTRACT" 'Publish verified changes before release readiness' "delivery contract requires publish-change before release readiness"
295
297
  require_text "$DELIVERY_CONTRACT" 'verified diff committed and pushed' "final acceptance requires committed and pushed diff"
296
298
  require_text "$DELIVERY_CONTRACT" 'provider change record created or updated' "final acceptance requires provider change or explicit no-provider-change reason"
297
- require_text "$DELIVERY_CONTRACT" 'local `\.flow-agents/` runtime artifacts remain untracked' "final acceptance requires runtime artifacts stay untracked"
299
+ require_text "$DELIVERY_CONTRACT" 'local `\.kontourai/flow-agents/` runtime artifacts remain untracked' "final acceptance requires runtime artifacts stay untracked"
298
300
  require_text "$DELIVERY_CONTRACT" 'GitHub PRs are the first `ChangeProvider` adapter example' "delivery contract keeps GitHub PR as adapter example"
299
301
  require_text "$DELIVERY_CONTRACT" 'Delegation Gates' "delivery contract defines delegation gates"
300
302
  require_text "$DELIVERY_CONTRACT" 'Do not replace the delegate gate with a local summary' "delivery contract forbids local gate substitution"
@@ -307,7 +309,7 @@ require_text "$ARTIFACT_LIFECYCLE_DOC" 'Runtime state remains ignored' "artifact
307
309
  require_text "$ARTIFACT_LIFECYCLE_DOC" 'Durable closeout content' "artifact lifecycle doc requires closeout"
308
310
  require_text "$ARTIFACT_LIFECYCLE_DOC" 'durable planning, decisions, evidence pointers, and acceptance notes' "artifact lifecycle doc requires durable promotion"
309
311
  require_text "$ARTIFACT_LIFECYCLE_DOC" 'Promote by ownership' "artifact lifecycle doc defines promotion targets"
310
- require_text "$ARTIFACT_CONTRACT" 'Do not commit local workflow runtime roots such as `\.flow-agents/<slug>/`' "artifact contract forbids committing runtime workspaces"
312
+ require_text "$ARTIFACT_CONTRACT" 'Do not commit local workflow runtime roots such as `\.kontourai/flow-agents/<slug>/`' "artifact contract forbids committing runtime workspaces"
311
313
  require_text "$OPERATING_LAYERS_DOC" 'workflow-artifact-lifecycle.md' "operating layers links artifact lifecycle"
312
314
  require_text "$PAGES_INDEX" 'workflow-artifact-lifecycle.html' "docs index links artifact lifecycle"
313
315
  require_text "$PAGES_INDEX" 'developer-architecture.html' "docs index links developer architecture"
@@ -385,6 +387,8 @@ require_text "$KIT_REPOSITORY_DOC" 'schema_version' "kit repository doc defines
385
387
  require_text "$KIT_REPOSITORY_DOC" 'flows' "kit repository doc defines declared Flow Definitions"
386
388
  require_text "$KIT_REPOSITORY_DOC" '[Aa]bsolute paths are rejected' "kit repository doc defines path safety"
387
389
  require_text "$KIT_REPOSITORY_DOC" 'does not install remote kits' "kit repository doc states remote install non-goal"
390
+ require_text "$ROOT/docs/kit-authoring-guide.md" 'uses_flow' "kit authoring guide documents Flow Definition composition"
391
+ require_text "$ROOT/docs/kit-authoring-guide.md" 'builder.publish-learn' "kit authoring guide documents composed publish-learn example"
388
392
  require_text "$PAGES_INDEX" 'Quick Start' "docs index presents product quick start"
389
393
  require_text "$KIT_REPOSITORY_INTEGRATION" 'valid-local-kit' "kit repository integration covers valid fixture"
390
394
  require_text "$KIT_REPOSITORY_INTEGRATION" 'invalid-schema-version' "kit repository integration covers invalid schema version"
@@ -426,10 +430,10 @@ require_text "$TOOL_WORKER" 'docs/context-map.md' "tool-worker uses context map"
426
430
  require_text "$TOOL_VERIFIER" 'docs/context-map.md' "tool-verifier uses context map"
427
431
  require_text "$TOOL_VERIFIER" 'Report only' "tool-verifier keeps report-only role"
428
432
  require_text "$DEV_PROMPTFOO" 'deep-context contract persistence' "dev evals include deep-context contract persistence case"
429
- require_text "$PACKAGE_MANIFEST" 'plan-work must delegate to tool-planner' "Codex kdev profile requires planner delegation"
430
- require_text "$PACKAGE_MANIFEST" 'verify-work to tool-verifier' "Codex kdev profile requires verifier delegation"
431
- require_text "$PACKAGE_MANIFEST" 'instead of replacing it with a local summary' "Codex kdev profile preserves blocked delegation gates"
432
- require_text "$PACKAGE_MANIFEST" 'name exact delegate ids' "Codex kdev profile requires auditable delegate names"
433
+ require_text "$PACKAGE_MANIFEST" 'plan-work must delegate to tool-planner' "Codex builder profile requires planner delegation"
434
+ require_text "$PACKAGE_MANIFEST" 'verify-work to tool-verifier' "Codex builder profile requires verifier delegation"
435
+ require_text "$PACKAGE_MANIFEST" 'instead of replacing it with a local summary' "Codex builder profile preserves blocked delegation gates"
436
+ require_text "$PACKAGE_MANIFEST" 'name exact delegate ids' "Codex builder profile requires auditable delegate names"
433
437
 
434
438
  echo ""
435
439
  echo "--- delivery goal fit ---"
@@ -441,7 +445,8 @@ require_text "$DELIVER" 'Final Acceptance' "deliver requires Final Acceptance"
441
445
  require_text "$DELIVER" 'Required Preflight' "deliver defines pull/pickup preflight"
442
446
  require_text "$DELIVER" 'pull-work -> pickup-probe' "deliver routes missing pickup evidence through pull-work and pickup-probe"
443
447
  require_text "$DELIVER" 'continue automatically to execution' "deliver can proceed autonomously after planning"
444
- require_text "$DELIVER" '\.flow-agents/<slug>/archive' "deliver archives working artifacts"
448
+ require_text "$DELIVER" '\.kontourai/flow-agents/<slug>/archive' "deliver archives working artifacts"
449
+ require_text "$DELIVER" 'Do not skip learning just because the delivery looked clean' "deliver always routes terminal closeout through learning-review"
445
450
  require_text "$DELIVER" 'Sidecar Writer Adoption' "deliver owns sidecar writer adoption"
446
451
  require_text "$DELIVER" 'record-critique|import-critique' "deliver records critique through sidecar writer"
447
452
  require_text "$VERIFY_WORK" 'Goal Fit' "verify-work reports Goal Fit"
@@ -542,6 +547,11 @@ require_text "$CONTEXT_MAP_INTEGRATION" 'context map generation is deterministic
542
547
  require_text "$WORKFLOW_STEERING_INTEGRATION" 'workflow steering hook neutralizes multiline critique findings' "workflow steering integration covers critique sanitization"
543
548
  require_text "$WORKFLOW_STEERING_INTEGRATION" 'workflow steering hook appends context-map recovery guidance' "workflow steering integration covers context-map guidance"
544
549
  require_text "$WORKFLOW_STEERING_INTEGRATION" 'workflow steering hook emits ambient state guidance at user prompt submit' "workflow steering integration covers ambient state guidance"
550
+ require_text "$WORKFLOW_STEERING_INTEGRATION" 'Claude hook adapter surfaces Builder workflow route for coding prompts' "workflow steering integration covers Claude Builder-route prompt guidance"
551
+ require_text "$WORKFLOW_STEERING_INTEGRATION" 'publish/release-readiness and learning-review' "workflow steering integration covers full Builder lifecycle guidance"
552
+ require_text "$WORKFLOW_STEERING_INTEGRATION" 'does not route explicit review-only prompts into Builder workflow' "workflow steering integration covers review-only prompt suppression"
553
+ require_text "$WORKFLOW_STEERING_INTEGRATION" 'does not route explicit validation-only prompts into Builder workflow' "workflow steering integration covers validation-only prompt suppression"
554
+ require_text "$WORKFLOW_STEERING_INTEGRATION" 'does not route question-only test prompts into Builder workflow' "workflow steering integration covers question-only test prompt suppression"
545
555
  require_text "$ROOT/evals/integration/test_goal_fit_hook.sh" 'goal-fit hook reports actionable sidecar guidance' "goal-fit integration covers specific sidecar guidance"
546
556
  require_text "$HOOK_INFLUENCE_CASES" 'agent_must_do' "hook influence cases define expected agent behavior"
547
557
  require_text "$HOOK_INFLUENCE_CASES" 'live-acceptance' "hook influence cases include live acceptance evidence"
@@ -1068,6 +1078,11 @@ require_text "$BUILDER_BUILD_FLOW" 'Planning is blocked until pickup Probe decis
1068
1078
  require_text "$BUILDER_BUILD_FLOW" 'probe_status' "Builder build flow names probe status"
1069
1079
  require_text "$BUILDER_BUILD_FLOW" 'probe_artifact_ref' "Builder build flow names probe artifact ref"
1070
1080
  require_text "$BUILDER_BUILD_FLOW" 'Stale broad continuation language after a merge is not sufficient' "Builder build flow blocks stale broad continuation"
1081
+ require_text "$BUILDER_BUILD_FLOW" '"uses_flow": "builder.publish-learn"' "Builder build flow composes publish-learn extension"
1082
+ require_text "$BUILDER_PUBLISH_LEARN_FLOW" '"builder.pr-open.pull-request"' "Builder publish-learn flow exports PR-open evidence"
1083
+ require_text "$BUILDER_PUBLISH_LEARN_FLOW" '"builder.merge-ready-ci.readiness"' "Builder publish-learn flow exports CI merge readiness evidence"
1084
+ require_text "$BUILDER_PUBLISH_LEARN_FLOW" '"builder.learn.evidence"' "Builder publish-learn flow exports learning evidence"
1085
+ require_text "$BUILDER_PUBLISH_LEARN_FLOW" '"exports"' "Builder publish-learn flow declares exported claims"
1071
1086
  if node - "$BUILDER_BUILD_FLOW" <<'NODE'; then
1072
1087
  const fs = require("node:fs");
1073
1088
  const flow = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));
@@ -1086,6 +1101,24 @@ NODE
1086
1101
  else
1087
1102
  fail "Builder build flow keeps provider-neutral trust.bundle expectations"
1088
1103
  fi
1104
+ if node - "$BUILDER_BUILD_FLOW" "$BUILDER_PUBLISH_LEARN_FLOW" <<'NODE'; then
1105
+ const fs = require("node:fs");
1106
+ const parent = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));
1107
+ const child = JSON.parse(fs.readFileSync(process.argv[3], "utf8"));
1108
+ for (const stepId of ["pr-open", "merge-ready-ci", "learn"]) {
1109
+ const step = (parent.steps || []).find((item) => item.id === stepId);
1110
+ if (step?.uses_flow !== "builder.publish-learn") throw new Error(`${stepId} should use builder.publish-learn`);
1111
+ const childGate = Object.values(child.gates || {}).find((gate) => gate.step === stepId);
1112
+ if (!childGate) throw new Error(`builder.publish-learn missing gate for ${stepId}`);
1113
+ for (const expectation of childGate.expects || []) {
1114
+ if (expectation.kind !== "trust.bundle") throw new Error(`${expectation.id || "<unknown>"} is not a trust.bundle expectation`);
1115
+ }
1116
+ }
1117
+ NODE
1118
+ pass "Builder publish-learn composition resolves PR, CI, and learning gates"
1119
+ else
1120
+ fail "Builder publish-learn composition resolves PR, CI, and learning gates"
1121
+ fi
1089
1122
  require_text "$MAP" 'pull-work' "map includes pull-work"
1090
1123
  require_text "$MAP" 'pickup Probe before planning' "map documents pickup Probe before planning"
1091
1124
  require_text "$MAP" 'review-work' "map includes review-work"
@@ -1115,7 +1148,7 @@ require_text "$LEARNING" 'dogfood-pass' "learning-review skill adopts dogfood-pa
1115
1148
  require_text "$EVAL_STRATEGY" 'Activation-only behavioral evals' "eval strategy distinguishes activation evals"
1116
1149
  require_text "$EVAL_STRATEGY" 'Artifact-quality evals' "eval strategy distinguishes artifact evals"
1117
1150
  require_text "$EVAL_STRATEGY" 'Hook-influence behavioral cases' "eval strategy documents hook influence cases"
1118
- require_text "$EVAL_STRATEGY" 'controlled writes to `.flow-agents/<slug>/\*\.md`' "artifact evals allow controlled todo writes"
1151
+ require_text "$EVAL_STRATEGY" 'controlled writes to `.kontourai/flow-agents/<slug>/\*\.md`' "artifact evals allow controlled todo writes"
1119
1152
  require_text "$EVAL_STRATEGY" 'test_workflow_artifacts.sh' "eval strategy documents artifact E2E integration"
1120
1153
  require_text "$EVAL_STRATEGY" 'HOLD' "eval strategy uses release-readiness HOLD decision"
1121
1154
  require_text "$SHARED_CONTRACTS_DOC" 'Codex, Kiro, Claude Code' "shared contracts doc captures cross-distribution scope"
@@ -18,9 +18,9 @@
18
18
  { "id": "execute", "next": "verify" },
19
19
  { "id": "verify", "next": "merge-ready" },
20
20
  { "id": "merge-ready", "next": "pr-open" },
21
- { "id": "pr-open", "next": "merge-ready-ci" },
22
- { "id": "merge-ready-ci", "next": "learn" },
23
- { "id": "learn", "next": "done" },
21
+ { "id": "pr-open", "next": "merge-ready-ci", "uses_flow": "builder.publish-learn" },
22
+ { "id": "merge-ready-ci", "next": "learn", "uses_flow": "builder.publish-learn" },
23
+ { "id": "learn", "next": "done", "uses_flow": "builder.publish-learn" },
24
24
  { "id": "done", "next": null }
25
25
  ],
26
26
  "gates": {
@@ -189,77 +189,6 @@
189
189
  }
190
190
  }
191
191
  ]
192
- },
193
- "pr-open-gate": {
194
- "step": "pr-open",
195
- "expects": [
196
- {
197
- "id": "pull-request-opened",
198
- "kind": "trust.bundle",
199
- "required": true,
200
- "description": "A pull request exists with linked work, implementation summary, and verification evidence.",
201
- "bundle_claim": {
202
- "claimType": "builder.pr-open.pull-request",
203
- "subjectType": "pull-request",
204
- "accepted_statuses": [
205
- "trusted",
206
- "accepted"
207
- ]
208
- }
209
- }
210
- ]
211
- },
212
- "merge-ready-ci-gate": {
213
- "step": "merge-ready-ci",
214
- "expects": [
215
- {
216
- "id": "ci-merge-readiness",
217
- "kind": "trust.bundle",
218
- "required": true,
219
- "description": "CI and review status support a merge-ready decision.",
220
- "bundle_claim": {
221
- "claimType": "builder.merge-ready-ci.readiness",
222
- "subjectType": "pull-request",
223
- "accepted_statuses": [
224
- "trusted",
225
- "accepted"
226
- ]
227
- }
228
- }
229
- ]
230
- },
231
- "learn-gate": {
232
- "step": "learn",
233
- "expects": [
234
- {
235
- "id": "decision-evidence",
236
- "kind": "trust.bundle",
237
- "required": true,
238
- "description": "Durable decision evidence from the build is recorded.",
239
- "bundle_claim": {
240
- "claimType": "builder.learn.decisions",
241
- "subjectType": "decision",
242
- "accepted_statuses": [
243
- "trusted",
244
- "accepted"
245
- ]
246
- }
247
- },
248
- {
249
- "id": "learning-evidence",
250
- "kind": "trust.bundle",
251
- "required": true,
252
- "description": "Learning evidence from delivery is recorded for future work.",
253
- "bundle_claim": {
254
- "claimType": "builder.learn.evidence",
255
- "subjectType": "release",
256
- "accepted_statuses": [
257
- "trusted",
258
- "accepted"
259
- ]
260
- }
261
- }
262
- ]
263
192
  }
264
193
  }
265
194
  }
@@ -0,0 +1,90 @@
1
+ {
2
+ "id": "builder.publish-learn",
3
+ "version": "1.0",
4
+ "description": "Reusable delivery closeout extension: publish the verified change, confirm merge readiness from provider/CI evidence, and record learning feedback.",
5
+ "steps": [
6
+ { "id": "pr-open", "next": "merge-ready-ci" },
7
+ { "id": "merge-ready-ci", "next": "learn" },
8
+ { "id": "learn", "next": "done" },
9
+ { "id": "done", "next": null }
10
+ ],
11
+ "exports": [
12
+ "builder.pr-open.pull-request",
13
+ "builder.merge-ready-ci.readiness",
14
+ "builder.learn.decisions",
15
+ "builder.learn.evidence"
16
+ ],
17
+ "gates": {
18
+ "pr-open-gate": {
19
+ "step": "pr-open",
20
+ "expects": [
21
+ {
22
+ "id": "pull-request-opened",
23
+ "kind": "trust.bundle",
24
+ "required": true,
25
+ "description": "A pull request exists with linked work, implementation summary, and verification evidence.",
26
+ "bundle_claim": {
27
+ "claimType": "builder.pr-open.pull-request",
28
+ "subjectType": "pull-request",
29
+ "accepted_statuses": [
30
+ "trusted",
31
+ "accepted"
32
+ ]
33
+ }
34
+ }
35
+ ]
36
+ },
37
+ "merge-ready-ci-gate": {
38
+ "step": "merge-ready-ci",
39
+ "expects": [
40
+ {
41
+ "id": "ci-merge-readiness",
42
+ "kind": "trust.bundle",
43
+ "required": true,
44
+ "description": "CI and review status support a merge-ready decision.",
45
+ "bundle_claim": {
46
+ "claimType": "builder.merge-ready-ci.readiness",
47
+ "subjectType": "pull-request",
48
+ "accepted_statuses": [
49
+ "trusted",
50
+ "accepted"
51
+ ]
52
+ }
53
+ }
54
+ ]
55
+ },
56
+ "learn-gate": {
57
+ "step": "learn",
58
+ "expects": [
59
+ {
60
+ "id": "decision-evidence",
61
+ "kind": "trust.bundle",
62
+ "required": true,
63
+ "description": "Durable decision evidence from the build is recorded.",
64
+ "bundle_claim": {
65
+ "claimType": "builder.learn.decisions",
66
+ "subjectType": "decision",
67
+ "accepted_statuses": [
68
+ "trusted",
69
+ "accepted"
70
+ ]
71
+ }
72
+ },
73
+ {
74
+ "id": "learning-evidence",
75
+ "kind": "trust.bundle",
76
+ "required": true,
77
+ "description": "Learning evidence from delivery is recorded for future work.",
78
+ "bundle_claim": {
79
+ "claimType": "builder.learn.evidence",
80
+ "subjectType": "release",
81
+ "accepted_statuses": [
82
+ "trusted",
83
+ "accepted"
84
+ ]
85
+ }
86
+ }
87
+ ]
88
+ }
89
+ }
90
+ }
@@ -14,6 +14,17 @@
14
14
  "id": "builder.build",
15
15
  "path": "flows/build.flow.json",
16
16
  "description": "Pull ready work through design probing, planning, implementation, verification, pull request readiness, merge readiness, and learning."
17
+ },
18
+ {
19
+ "id": "builder.publish-learn",
20
+ "path": "flows/publish-learn.flow.json",
21
+ "description": "Reusable delivery closeout extension for publish, provider/CI merge readiness, and learning feedback gates."
22
+ }
23
+ ],
24
+ "dependencies": [
25
+ {
26
+ "kit_id": "knowledge",
27
+ "reason": "learning-review invokes knowledge-capture (kits/knowledge/skills/knowledge-capture/SKILL.md) for durable knowledge storage"
17
28
  }
18
29
  ],
19
30
  "skills": [
@@ -37,7 +37,7 @@ When activated:
37
37
  2. State that Builder Kit shape delegates to `idea-to-backlog` and uses `kits/builder/flows/shape.flow.json`.
38
38
  3. Gather the raw idea or current conversation context.
39
39
  4. If needed, use `design-probe`: ask one Probe/alignment question at a time before shaping. Prefer questions that clarify user outcome, constraints, non-goals, success criteria, risk, or whether bundled ideas truly belong together.
40
- 5. Create or update the standard `.flow-agents/<slug>/<slug>--idea-to-backlog.md` artifact using the `idea-to-backlog` artifact contract.
40
+ 5. Create or update the standard `.kontourai/flow-agents/<slug>/<slug>--idea-to-backlog.md` artifact using the `idea-to-backlog` artifact contract.
41
41
  6. Add a `builder_kit_shape` or equivalent note in the artifact that links to `kits/builder/flows/shape.flow.json` and records that the product-level Builder Kit shape surface was used.
42
42
  7. Stop at `next_gate: Backlog Gate` unless the user explicitly requested GitHub issue sync.
43
43
  8. If the user asked for guided Builder Kit continuation, record the expected next step as `pull-work` after issue sync or backlog approval; otherwise record manual mode and stop.
@@ -20,13 +20,32 @@ Inherited from primitives:
20
20
  | tool-verifier | verify-work |
21
21
  | tool-playwright | verify-work |
22
22
 
23
+ ## Model Routing
24
+
25
+ Delegates are spawned with an explicit model override resolved from
26
+ `.datum/config.json` via `npx @kontourai/datum resolve <role> --json`
27
+ (see `context/contracts/execution-contract.md` § Delegation: Model Routing —
28
+ that contract is the consumption instruction, `.datum/config.json` is the
29
+ source of truth for the mapping):
30
+
31
+ | Delegate | Role |
32
+ |---|---|
33
+ | tool-worker | `delegate-mechanical` for fully-specified mechanical tasks, `delegate-implementation` for precisely-planned implementation, `delegate-design` when the task needs design latitude |
34
+ | tool-planner | `delegate-design` |
35
+ | tool-code-reviewer / tool-security-reviewer | `delegate-implementation` |
36
+ | tool-verifier / tool-playwright | `delegate-implementation` |
37
+
38
+ If datum or the config is absent, fall back to the runtime's inherited model
39
+ and note the fallback in the session artifact.
40
+
23
41
  ## Orchestrator Rule
24
42
 
25
- You never use `read`, `glob`, `grep`, or `code` on source files. You only read/write the session file and artifact files in `.flow-agents/<slug>/`.
43
+ You never use `read`, `glob`, `grep`, or `code` on source files. You only read/write the session file and artifact files in `.kontourai/flow-agents/<slug>/`.
26
44
 
27
45
  ## Shared Contracts
28
46
 
29
47
  Follow:
48
+ - `context/contracts/standing-directives.md`
30
49
  - `context/contracts/artifact-contract.md`
31
50
  - `context/contracts/planning-contract.md`
32
51
  - `context/contracts/execution-contract.md`
@@ -52,9 +71,9 @@ When the repository provides `npm run workflow:sidecar --`, use it for routine w
52
71
  - `record-learning` for learning-review outcomes
53
72
  - `dogfood-pass` for Flow Agents repo changes that should record evidence, critique, optional learning, state, and handoff in one validated pass
54
73
 
55
- After writer updates, run `npm run workflow:validate-artifacts -- --require-sidecars .flow-agents/<slug>` when local validation is available. If the writer or validation is unavailable or blocked by sandbox policy, record the exact gap in the session artifact as `NOT_VERIFIED` instead of pretending structured state exists.
74
+ After writer updates, run `npm run workflow:validate-artifacts -- --require-sidecars .kontourai/flow-agents/<slug>` when local validation is available. If the writer or validation is unavailable or blocked by sandbox policy, record the exact gap in the session artifact as `NOT_VERIFIED` instead of pretending structured state exists.
56
75
 
57
- `ensure-session` maintains `.flow-agents/current.json`. The orchestrator owns root `state.json` and `handoff.json` updates. Delegated agents must be given the workflow artifact root and should append events under `agents/<agent-id>/events.jsonl` through `record-agent-event` instead of guessing the slug or rewriting root state.
76
+ `ensure-session` maintains `.kontourai/flow-agents/current.json`. The orchestrator is responsible for keeping root `state.json` and `handoff.json` current, but performs every such update **exclusively** through the sidecar writer (`npm run workflow:sidecar -- advance-state` for state transitions, `init-plan` for the initial plan write) — never through a direct Write/Edit tool call against the sidecar path. `config-protection.js` blocks direct tool-mediated writes to `state.json` by design; that block is expected and correct, not a bug to route around. Delegated agents must be given the workflow artifact root and should append events under `agents/<agent-id>/events.jsonl` through `record-agent-event` instead of guessing the slug or rewriting root state.
58
77
 
59
78
  ## Input
60
79
 
@@ -80,7 +99,7 @@ Direct ad hoc implementation requests that are not provider-backed backlog picku
80
99
 
81
100
  ## Session File
82
101
 
83
- Path: `.flow-agents/<slug>/<slug>--deliver.md`
102
+ Path: `.kontourai/flow-agents/<slug>/<slug>--deliver.md`
84
103
 
85
104
  ```markdown
86
105
  # <Goal one-liner>
@@ -100,8 +119,8 @@ iteration: 0
100
119
  - Loop exits only after the Goal Fit Gate is fully checked or explicitly accepted
101
120
  - CRITICAL/HIGH → re-plan → execute → review → verify
102
121
  - MEDIUM/FAIL → execute fix pass → review → verify
103
- - Temporary planning and execution artifacts live in `.flow-agents/<slug>/`; durable feature documentation is promoted after CI/merge
104
- - Local runtime work stays under `.flow-agents/` and remains untracked; durable outcomes must be promoted before merge to `main`
122
+ - Temporary planning and execution artifacts live in `.kontourai/flow-agents/<slug>/`; durable feature documentation is promoted after CI/merge
123
+ - Local runtime work stays under `.kontourai/flow-agents/` and remains untracked; durable outcomes must be promoted before merge to `main`
105
124
 
106
125
  ## Plan
107
126
 
@@ -133,6 +152,8 @@ Use the Final Acceptance checklist from `context/contracts/delivery-contract.md`
133
152
  - iteration 2: pass — all acceptance criteria met
134
153
  ```
135
154
 
155
+ `<branch>` is the branch recorded in `state.json`'s `branch` field (`ensure-session` derives `agent/<actor>/<slug>`; an explicit `--branch` flag overrides on a new session). `ensure-session` only records the name — creating and checking out the actual git branch/worktree remains this skill's responsibility.
156
+
136
157
  The `status:` values in this Markdown session file are human-readable delivery progress labels. They are not the machine-readable `state.phase` enum; structured workflow sidecars must use the canonical lifecycle values from `context/contracts/artifact-contract.md`. In particular, review-work records critique through the critique artifact/sink while the sidecar lifecycle remains in a canonical phase such as `execution`, not a `review` phase.
137
158
 
138
159
  ## Workflow
@@ -218,7 +239,7 @@ After review, verification, evidence, and Goal Fit are clean for the same diff:
218
239
  2. Publish the session trust bundle to `delivery/` so the CI trust-reconcile job can verify what the agent claimed. `record-release` (via the sidecar writer) does this automatically (best-effort). To publish or re-publish explicitly:
219
240
 
220
241
  ```bash
221
- npm run workflow:sidecar -- publish-delivery .flow-agents/<slug>
242
+ npm run workflow:sidecar -- publish-delivery .kontourai/flow-agents/<slug>
222
243
  ```
223
244
 
224
245
  Then force-stage the trust artifacts for the delivery commit. They are gitignored
@@ -237,7 +258,7 @@ After review, verification, evidence, and Goal Fit are clean for the same diff:
237
258
  7. Record the gate claim for the Builder Kit `pr-open` step immediately after the PR is opened or updated:
238
259
 
239
260
  ```bash
240
- npm run workflow:sidecar -- record-gate-claim .flow-agents/<slug> \
261
+ npm run workflow:sidecar -- record-gate-claim .kontourai/flow-agents/<slug> \
241
262
  --expectation pull-request-opened \
242
263
  --status pass \
243
264
  --summary "PR opened: <pr-url>. Linked to <work-item-ref>, implementation summary and verification evidence attached." \
@@ -253,13 +274,13 @@ Do not invoke `release-readiness` before this gate unless the user explicitly ac
253
274
  After CI passes and the work is merged or otherwise accepted:
254
275
 
255
276
  1. Update `## Final Acceptance` in the session file.
256
- 2. Archive the working artifacts under `.flow-agents/<slug>/archive/` or keep a stable link to them.
277
+ 2. Archive the working artifacts under `.kontourai/flow-agents/<slug>/archive/` or keep a stable link to them.
257
278
  3. Record provider records, verification evidence, durable docs targets, accepted gaps, and follow-up routing in durable docs or provider records.
258
279
  4. Promote the relevant plan, decision, evidence, and usage notes into long-lived docs such as `docs/`, `README.md`, or a project decision record.
259
280
  5. Link the long-lived doc back to the provider record, archived plan artifact, or accepted evidence when useful so future readers can see why and how the feature was built.
260
- 6. Confirm `.flow-agents/` runtime artifacts remain untracked before merge to `main`.
281
+ 6. Confirm `.kontourai/flow-agents/` runtime artifacts remain untracked before merge to `main`.
261
282
  7. **Clean up the workspace once the merge is confirmed.** First verify the merge actually happened from the provider's own record (a merge commit / `mergedAt`) — not a green check or a watcher's exit code. Then honor the `worktree_lifecycle` recorded by `pull-work` (`retain_until: pr_merged`): remove the isolated worktree (`git worktree remove <path>`) and delete the now-merged branch locally and on the remote. Never delete a branch or worktree before the merge is confirmed — a closed-but-unmerged PR or a prematurely deleted branch loses work. The task is not done while it leaves a stale worktree or merged branch behind.
262
- 8. Hand off to `learning-review` when the delivery exposed workflow, testing, documentation, or product follow-up.
283
+ 8. Hand off to `learning-review` for terminal closeout. Clean runs record a lightweight no-correction-needed learning record (`correction.needed: false`, closed routing such as `target: "none"`); mismatches, friction, missing docs, failed gates, incidents, or product follow-up record `correction.needed: true` or `FOLLOWUP_REQUIRED` with routed prevention/follow-up. Do not skip learning just because the delivery looked clean.
263
284
 
264
285
  ### 11. Deliver
265
286