@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
@@ -107,21 +107,21 @@ This applies whether the probe is run directly (generic) or as part of a Builder
107
107
  **Claim 1 — Pickup readiness** (probe passed, goal fit and scope confirmed):
108
108
 
109
109
  ```bash
110
- npm run workflow:sidecar -- record-gate-claim .flow-agents/<slug> \
110
+ npm run workflow:sidecar -- record-gate-claim .kontourai/flow-agents/<slug> \
111
111
  --expectation pickup-probe-readiness \
112
112
  --status pass \
113
113
  --summary "Design probe passed: goal fit confirmed, scope aligned, planning readiness verified." \
114
- --evidence-ref-json '{"kind":"artifact","file":".flow-agents/<slug>/<slug>--<artifact>.md","summary":"Design-probe artifact with decisions, accepted gaps, and planning readiness."}'
114
+ --evidence-ref-json '{"kind":"artifact","file":".kontourai/flow-agents/<slug>/<slug>--<artifact>.md","summary":"Design-probe artifact with decisions, accepted gaps, and planning readiness."}'
115
115
  ```
116
116
 
117
117
  **Claim 2 — Probe decisions captured**:
118
118
 
119
119
  ```bash
120
- npm run workflow:sidecar -- record-gate-claim .flow-agents/<slug> \
120
+ npm run workflow:sidecar -- record-gate-claim .kontourai/flow-agents/<slug> \
121
121
  --expectation probe-decisions-or-accepted-gaps \
122
122
  --status pass \
123
123
  --summary "Probe decisions recorded: decisions made, unresolved questions explicit, planning readiness confirmed." \
124
- --evidence-ref-json '{"kind":"artifact","file":".flow-agents/<slug>/<slug>--<artifact>.md","summary":"Design-probe artifact with decisions and accepted gaps."}'
124
+ --evidence-ref-json '{"kind":"artifact","file":".kontourai/flow-agents/<slug>/<slug>--<artifact>.md","summary":"Design-probe artifact with decisions and accepted gaps."}'
125
125
  ```
126
126
 
127
127
  Record both claims when shared understanding exists and the next action is `plan-work` or equivalent. Use `--status fail` when stopping due to an unresolved blocker. Skip these claims entirely when `design-probe` is used outside a Builder Kit flow (no active `builder.build` flow step in `current.json`).
@@ -28,10 +28,13 @@ Evidence Gate is not Release Readiness. It asks whether completed work has enoug
28
28
  - Provider change / branch / check run links when available.
29
29
  - Changed-file summary.
30
30
  - Active TODOs, issue links, and release/rollback notes.
31
+ - Cross-repo dependency/provider coverage matrix when work spans multiple
32
+ products, package-manager roots, generated artifact locations, install
33
+ scripts, CI, or shared workflow guidance.
31
34
 
32
35
  ## Artifact Contract
33
36
 
34
- Write or update `.flow-agents/<slug>/<slug>--evidence-gate.md` with:
37
+ Write or update `.kontourai/flow-agents/<slug>/<slug>--evidence-gate.md` with:
35
38
 
36
39
  - `intent`: issue/brief, acceptance criteria, non-goals, risk class
37
40
  - `evidence_manifest`: command/check name, source, timestamp, result, link/output pointer
@@ -102,6 +105,13 @@ Check for process gaming or accidental drift:
102
105
 
103
106
  Sensitive areas include auth, security middleware, data migrations, CI config, deployment scripts, feature flags, test helpers, lint/type config, payment, crypto, and filesystem/network operations.
104
107
 
108
+ For multi-repo or cross-product changes, require an explicit coverage matrix
109
+ before a clean pass. The matrix must list every affected product/repo root and
110
+ the status of build/test evidence, dependency/security review, provider/CI
111
+ evidence, and any accepted gaps. A clean evidence verdict requires every
112
+ applicable root to be covered or a human-accepted gap recorded with the reason.
113
+ Do not infer cross-product coverage from a passing subset.
114
+
105
115
  ### 4. CI And Flake Assessment
106
116
 
107
117
  Use `github-cli` / `gh` when available.
@@ -179,6 +189,21 @@ Use `git` and the active `ChangeProvider` adapter when available to:
179
189
 
180
190
  If commit, push, provider change publication, or provider checks are blocked, keep the release path at `NOT_VERIFIED` or `HOLD` until the blocker is resolved or explicitly accepted by the user.
181
191
 
192
+ ### 8. Dependency And External-Audit Coverage
193
+
194
+ When dependency review is in scope, evidence-gate must preserve both local
195
+ inventory evidence and external advisory/audit evidence separately. External
196
+ audit commands and registry/advisory lookups may disclose private dependency
197
+ metadata; if the execution policy rejects the command or the user has not
198
+ explicitly approved that disclosure, record the affected roots as
199
+ `NOT_VERIFIED` for external audit and name the privacy/approval blocker.
200
+
201
+ For cross-product work, a dependency/security lane can pass only when every
202
+ applicable package-manager root has one of these recorded outcomes: `pass`,
203
+ `fail`, `skip_no_manifest`, or an accepted `not_verified` gap. Existing
204
+ vulnerabilities are still `FAIL` for the dependency lane unless the user
205
+ explicitly accepts them as unrelated residual risk.
206
+
182
207
  ## Gate
183
208
 
184
209
  Evidence passes only when acceptance criteria, scope integrity, CI/runtime evidence, and residual risk are sufficient for the risk class.
@@ -29,7 +29,7 @@ This skill owns orchestration between waves. The contracts own artifact continui
29
29
 
30
30
  ## Input
31
31
 
32
- - **Plan artifact path**: path to the `-plan.md` file in `.flow-agents/<slug>/`
32
+ - **Plan artifact path**: path to the `-plan.md` file in `.kontourai/flow-agents/<slug>/`
33
33
  - **Session file path**: the session file to update with progress
34
34
 
35
35
  ## Workflow
@@ -67,7 +67,7 @@ This skill owns orchestration between waves. The contracts own artifact continui
67
67
  - Record worker progress with `npm run workflow:sidecar -- record-agent-event --artifact-dir <artifact-dir> --agent-id <worker-id> --kind evidence --status active|done --summary ...`
68
68
  9. After all waves: set session file `status: executed` and update `state.json` / `handoff.json` with `advance-state`
69
69
 
70
- The orchestrator owns root `state.json` updates. Workers should receive the workflow artifact root explicitly and append agent events under that root instead of inferring the slug or rewriting shared sidecars.
70
+ The orchestrator is responsible for keeping root `state.json` current, and performs that update **exclusively** through `npm run workflow:sidecar -- advance-state` — 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. Workers should receive the workflow artifact root explicitly and append agent events under that root instead of inferring the slug or rewriting shared sidecars.
71
71
 
72
72
  ## Pre-Fan-Out Freshness Re-Check
73
73
 
@@ -70,6 +70,8 @@ Root cause from tool-planner.
70
70
  - iteration 2: pass — bug fixed, no regressions
71
71
  ```
72
72
 
73
+ `<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.
74
+
73
75
  ## Workflow
74
76
 
75
77
  ### 1. Create session file
@@ -12,7 +12,7 @@ Classify gate fires and suspected misses from the session's `trust.bundle` by ca
12
12
  - **Advisory-only**: proposes fixes, never applies them. No finding may instruct auto-application of any fix.
13
13
  - Never writes to `scripts/hooks/` or any flow file.
14
14
  - Reads the local `trust.bundle` file only. Does NOT fall back to `command-log.jsonl`, `.goal-fit-block-streak.json`, or `evidence.json` direct reads as primary inputs.
15
- - If no `trust.bundle` is present at `.flow-agents/<slug>/trust.bundle`, reports `NOT_VERIFIED` and stops. Does not silently degrade to bespoke sidecar reads.
15
+ - If no `trust.bundle` is present at `.kontourai/flow-agents/<slug>/trust.bundle`, reports `NOT_VERIFIED` and stops. Does not silently degrade to bespoke sidecar reads.
16
16
  - Routes all telemetry, `learning.json` writes, and correction routing through `learning-review`. Gate-review never calls `record-learning` directly.
17
17
  - Reads `state.json` for lifecycle context only (phase, status). `state.json` is NOT a trust claim per ADR 0010.
18
18
  - Reads `context/gate-awareness.md` for vocabulary alignment when available.
@@ -23,7 +23,7 @@ Classify gate fires and suspected misses from the session's `trust.bundle` by ca
23
23
 
24
24
  ## Inputs
25
25
 
26
- - `trust.bundle` at `.flow-agents/<slug>/trust.bundle` (produced by ADR 0010 Phase 1 dual-write in `workflow-sidecar`).
26
+ - `trust.bundle` at `.kontourai/flow-agents/<slug>/trust.bundle` (produced by ADR 0010 Phase 1 dual-write in `workflow-sidecar`).
27
27
 
28
28
  **Dependency**: this file is NOT present at `origin/main @ a9b8fd6`; it requires ADR 0010 Phase 1 to be built and merged (owned by `arch/goal-fit-gate-trust-bundle`). Do not begin execution until Phase 1 has landed or a fixture is agreed with that owner.
29
29
 
@@ -64,12 +64,12 @@ Classify gate fires and suspected misses from the session's `trust.bundle` by ca
64
64
  | `stale` | Claim data is outdated; gate had stale input. |
65
65
  | `unknown` | No event found; claim was never evaluated. |
66
66
 
67
- - `state.json` at `.flow-agents/<slug>/state.json` (lifecycle context; not a trust input).
67
+ - `state.json` at `.kontourai/flow-agents/<slug>/state.json` (lifecycle context; not a trust input).
68
68
  - Optional: seeded fixture `trust.bundle` path for testing before Phase 1 produces real bundles.
69
69
 
70
70
  ## Artifact Contract
71
71
 
72
- Write the following artifacts under `.flow-agents/<slug>/`:
72
+ Write the following artifacts under `.kontourai/flow-agents/<slug>/`:
73
73
 
74
74
  ### `<slug>--gate-review.md`
75
75
 
@@ -161,7 +161,7 @@ Cross-reference with `state.json` phase at the time of the block to confirm the
161
161
 
162
162
  ### Step 1 — Locate trust.bundle
163
163
 
164
- Resolve `.flow-agents/<slug>/trust.bundle`. The slug is the most recent active session (by `current.json` or `state.json` newest-mtime). If absent, surface the blocker:
164
+ Resolve `.kontourai/flow-agents/<slug>/trust.bundle`. The slug is the most recent active session (by `current.json` or `state.json` newest-mtime). If absent, surface the blocker:
165
165
 
166
166
  ```
167
167
  [gate-review] trust.bundle absent — NOT_VERIFIED. Build ADR 0010 Phase 1 first.
@@ -209,7 +209,7 @@ Pass the `gate-review.inquiries.json` path as additional reviewer notes to `lear
209
209
 
210
210
  Example invocation note:
211
211
  ```
212
- gate-review InquiryRecords at .flow-agents/<slug>/gate-review.inquiries.json:
212
+ gate-review InquiryRecords at .kontourai/flow-agents/<slug>/gate-review.inquiries.json:
213
213
  - <N> record(s): calibration counts
214
214
  - gate fired: <true/false>
215
215
  - calibration: correct=<n>, false_block=<n>, missed_block=<n>
@@ -23,7 +23,7 @@ Convert raw ideas into shaped, prioritized, executable backlog without starting
23
23
 
24
24
  ## Artifact Contract
25
25
 
26
- Create or update `.flow-agents/<slug>/<slug>--idea-to-backlog.md` with:
26
+ Create or update `.kontourai/flow-agents/<slug>/<slug>--idea-to-backlog.md` with:
27
27
 
28
28
  - `source_ideas`: raw inputs and dedupe links
29
29
  - `idea_inventory`: one record per distinct idea, classification, outcome, and reason
@@ -14,7 +14,7 @@ Turn delivery outcomes into durable learning and follow-up work.
14
14
  - Capture facts, decisions, and follow-up issues separately.
15
15
  - Feed actionable changes back to `idea-to-backlog`, GitHub issues, tests, docs, or knowledge.
16
16
  - Use `knowledge-capture` or `observe` when the learning should persist beyond the repo.
17
- - Compare long-lived docs against the local `.flow-agents/<slug>/` plan and the final acceptance artifact so implementation intent is not lost after merge.
17
+ - Compare long-lived docs against the local `.kontourai/flow-agents/<slug>/` plan and the final acceptance artifact so implementation intent is not lost after merge.
18
18
  - Treat `learning-review` as the terminal closeout decision point for correction telemetry. Compare intended behavior to observed behavior before writing `learning.json`, then record either `correction.needed: false` for a clean run or `correction.needed: true` for a mismatch.
19
19
 
20
20
  ## Inputs
@@ -23,7 +23,7 @@ Turn delivery outcomes into durable learning and follow-up work.
23
23
 
24
24
  ## Artifact Contract
25
25
 
26
- Create or update `.flow-agents/<slug>/<slug>--learning-review.md` with:
26
+ Create or update `.kontourai/flow-agents/<slug>/<slug>--learning-review.md` with:
27
27
 
28
28
  - `scope`: delivered work, issue/PR/release links, dates
29
29
  - `outcomes`: expected vs observed behavior and signals
@@ -39,7 +39,7 @@ Create or update `.flow-agents/<slug>/<slug>--learning-review.md` with:
39
39
  When the repository provides `npm run workflow:sidecar --`, also write `learning.json` with:
40
40
 
41
41
  ```bash
42
- npm run workflow:sidecar -- record-learning .flow-agents/<slug> \
42
+ npm run workflow:sidecar -- record-learning .kontourai/flow-agents/<slug> \
43
43
  --status learned \
44
44
  --record-json '{"id":"...","source_refs":["release.json"],"outcome":"success","facts":["..."],"interpretation":"...","routing":[{"target":"none","action":"No follow-up required after intended-vs-observed closeout.","status":"completed"}],"correction":{"needed":false,"evidence":"Acceptance, release, docs promotion, and learning closeout behaved as intended."}}' \
45
45
  --summary "..."
@@ -112,21 +112,21 @@ After `learning.json` is written and the learning verdict is `LEARNED` or `FOLLO
112
112
  **Claim 1 — Decision evidence** (durable decisions from the build are recorded):
113
113
 
114
114
  ```bash
115
- npm run workflow:sidecar -- record-gate-claim .flow-agents/<slug> \
115
+ npm run workflow:sidecar -- record-gate-claim .kontourai/flow-agents/<slug> \
116
116
  --expectation decision-evidence \
117
117
  --status pass \
118
118
  --summary "Build decisions recorded: <decision-count> decisions captured, correction.<needed> recorded." \
119
- --evidence-ref-json '{"kind":"artifact","file":".flow-agents/<slug>/learning.json","summary":"learning.json with decisions and correction state."}'
119
+ --evidence-ref-json '{"kind":"artifact","file":".kontourai/flow-agents/<slug>/learning.json","summary":"learning.json with decisions and correction state."}'
120
120
  ```
121
121
 
122
122
  **Claim 2 — Learning evidence** (learnings from delivery are recorded for future work):
123
123
 
124
124
  ```bash
125
- npm run workflow:sidecar -- record-gate-claim .flow-agents/<slug> \
125
+ npm run workflow:sidecar -- record-gate-claim .kontourai/flow-agents/<slug> \
126
126
  --expectation learning-evidence \
127
127
  --status pass \
128
128
  --summary "Learning evidence captured: <outcome> outcome, facts recorded, routing complete." \
129
- --evidence-ref-json '{"kind":"artifact","file":".flow-agents/<slug>/learning.json","summary":"learning.json with outcomes, facts, and routing."}'
129
+ --evidence-ref-json '{"kind":"artifact","file":".kontourai/flow-agents/<slug>/learning.json","summary":"learning.json with outcomes, facts, and routing."}'
130
130
  ```
131
131
 
132
132
  Record both claims immediately after `record-learning` succeeds and artifact validation passes. Use `--status fail` when `record-learning` fails or when learning cannot be captured (verdict `BLOCKED`). Use `--status not_verified` only when the session has no active Builder Kit flow step.
@@ -49,6 +49,7 @@ Challenge the selected work against the repository before planning:
49
49
  - Challenge glossary conflicts immediately: if a user or issue uses a term differently than `CONTEXT.md`, ask which meaning is authoritative before planning.
50
50
  - Discuss concrete scenarios when boundaries are fuzzy, especially around ownership, provider state, workflow gates, and stop-short behavior.
51
51
  - Check whether the selected work is still ready after WIP, conflicts, blockers, dependency freshness, and expected modified files are considered.
52
+ - If the pull-work artifact flags the selected item `reclaimable`, treat the recorded opt-in as a decision to re-confirm (not silently accept) when material drift or time has passed since pull-work's preflight ran.
52
53
  - Keep downstream issues and non-goals out of scope unless they are explicit contract consumers for the selected work.
53
54
  - Ask one question at a time when a decision is needed, include a recommended answer, and record the answer immediately.
54
55
  - Record unresolved questions as blockers unless the user or orchestrator explicitly accepts proceeding with the gap.
@@ -91,21 +92,21 @@ When the Planning Gate passes, record the two gate claims for the Builder Kit `d
91
92
  **Claim 1 — Pickup readiness** (probe passed, goal fit and scope confirmed):
92
93
 
93
94
  ```bash
94
- npm run workflow:sidecar -- record-gate-claim .flow-agents/<slug> \
95
+ npm run workflow:sidecar -- record-gate-claim .kontourai/flow-agents/<slug> \
95
96
  --expectation pickup-probe-readiness \
96
97
  --status pass \
97
98
  --summary "Pickup probe passed: goal fit confirmed, blockers checked, dependencies reviewed, acceptance criteria verified." \
98
- --evidence-ref-json '{"kind":"artifact","file":".flow-agents/<slug>/<slug>--pull-work.md","summary":"Pull-work artifact recording probe status, scope, and planning readiness."}'
99
+ --evidence-ref-json '{"kind":"artifact","file":".kontourai/flow-agents/<slug>/<slug>--pull-work.md","summary":"Pull-work artifact recording probe status, scope, and planning readiness."}'
99
100
  ```
100
101
 
101
102
  **Claim 2 — Probe decisions captured** (decisions, accepted gaps, and planning readiness are recorded):
102
103
 
103
104
  ```bash
104
- npm run workflow:sidecar -- record-gate-claim .flow-agents/<slug> \
105
+ npm run workflow:sidecar -- record-gate-claim .kontourai/flow-agents/<slug> \
105
106
  --expectation probe-decisions-or-accepted-gaps \
106
107
  --status pass \
107
108
  --summary "Probe decisions recorded: <decision-count> decisions, <gap-count> accepted gaps. Planning readiness: <ready|accepted_gap_ready>." \
108
- --evidence-ref-json '{"kind":"artifact","file":".flow-agents/<slug>/<slug>--pull-work.md","summary":"Pull-work artifact with decisions, accepted gaps, and planning handoff."}'
109
+ --evidence-ref-json '{"kind":"artifact","file":".kontourai/flow-agents/<slug>/<slug>--pull-work.md","summary":"Pull-work artifact with decisions, accepted gaps, and planning handoff."}'
109
110
  ```
110
111
 
111
112
  Record both claims together immediately when the gate passes. Use `--status fail` when the gate fails (unresolved blocker or decision gap). Use `--status not_verified` only when the session has no active flow step.
@@ -98,11 +98,11 @@ The `tool-planner` prompt context must include the latest-base confirmation and
98
98
 
99
99
  ## Workflow
100
100
 
101
- 1. Create session file in `.flow-agents/<slug>/` if one wasn't provided:
101
+ 1. Create session file in `.kontourai/flow-agents/<slug>/` if one wasn't provided:
102
102
  - Filename: `<slug>--plan-work.md`
103
103
  - `status: planning`, `type: plan-work`
104
- - Create or update `state.json` with phase `planning`
105
- - use `npm run workflow:sidecar -- ensure-session --source-request ... --summary ... --criterion ...` when the repository provides it; this also writes `.flow-agents/current.json`
104
+ - Create or update `state.json` (phase `planning`) via `npm run workflow:sidecar -- init-plan`/`ensure-session` — never through a direct Write/Edit tool call (`config-protection.js` blocks that by design)
105
+ - use `npm run workflow:sidecar -- ensure-session --source-request ... --summary ... --criterion ...` when the repository provides it; this also writes `.kontourai/flow-agents/current.json`
106
106
  - **Builder Kit build flow**: add `--flow-id builder.build` to the `ensure-session` call when `plan-work` is invoked from `deliver`, from the Builder Kit `build` flow, or from a pick-up-and-build request after `pull-work`. This activates the FlowDefinition-driven path so producers fire and gates enforce on builder.* claims. Do NOT add `--flow-id` for direct/ad-hoc primitive `plan-work` invocations that are not part of a builder-flow.
107
107
  2. Delegate to `tool-planner`:
108
108
  ```
@@ -127,7 +127,7 @@ The `tool-planner` prompt context must include the latest-base confirmation and
127
127
  - if task-to-acceptance mapping is unclear, send the planner feedback before presenting the plan as ready
128
128
  4. Read the plan artifact
129
129
  5. Update session file: paste plan summary into `## Plan`, set `status: planned`
130
- 6. Update `state.json` with `status: planned`, phase `planning`, and the next action
130
+ 6. Update `state.json` (`status: planned`, phase `planning`, next action) via `npm run workflow:sidecar -- advance-state` — never through a direct Write/Edit tool call (`config-protection.js` blocks that by design)
131
131
  7. Present the plan to the user
132
132
  8. If the user wants changes, re-delegate to tool-planner with feedback
133
133
 
@@ -177,12 +177,34 @@ Structured plan from tool-planner (pasted from artifact).
177
177
  Copied from the plan artifact. This is the stop condition for delivery.
178
178
  ```
179
179
 
180
+ `<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.
181
+
180
182
  ## Output
181
183
 
182
- - Session file in `.flow-agents/<slug>/` with status `planned`
184
+ - Session file in `.kontourai/flow-agents/<slug>/` with status `planned`
183
185
  - Plan artifact: `<session-basename>-plan.md`
184
186
  - Structured sidecars: `state.json`, `acceptance.json`, and `handoff.json`
185
187
  - The plan artifact is the source of truth — tool-worker agents read it directly
186
188
  - Plan artifact follows `context/contracts/planning-contract.md`
187
189
 
188
190
  {context?}
191
+
192
+ ## Ad-hoc Direct Entry (Planning-Only or Non-`pull-work` Sessions)
193
+
194
+ `ensure-session --flow-id <id>` without `--step-id` defaults `active_step_id` to the
195
+ flow's FIRST step (`pull-work` for `builder.build`). For a session that legitimately
196
+ enters mid-flow — e.g. planning directly from a portfolio work item without a
197
+ `pull-work`/pickup artifact — pass the sanctioned override:
198
+
199
+ ```
200
+ npm run workflow:sidecar -- ensure-session \
201
+ --flow-id builder.build --task-slug <slug> --step-id plan \
202
+ [--ad-hoc-reason "planning a directly-issued work item; no pull-work artifact"]
203
+ ```
204
+
205
+ When `--step-id` names a step other than the flow's first step, `ensure-session` records
206
+ `ad_hoc_entry: true` + `ad_hoc_reason` in `current.json`. This is the sanctioned way to
207
+ enter a flow mid-stream: the explicit marker lets `stop-goal-fit` / `gate-review`
208
+ distinguish an intentional direct entry from a stale or mis-stamped `active_step_id`,
209
+ instead of silently defaulting to the first step and looking like a normal `pull-work`
210
+ start.
@@ -10,6 +10,8 @@ Select ready backlog work and prepare a bounded execution handoff without implem
10
10
  ## Contract
11
11
 
12
12
  - Use `context/contracts/work-item-contract.md` as the source vocabulary for provider-backed work item shape, provider roles, and capability flags.
13
+ - Use `context/contracts/assignment-provider-contract.md` as the second source vocabulary for durable ownership: the `AssignmentProvider` operations (`claim`/`release`/`supersede`/`status`/`list`), the assignment ⋈ liveness join's effective-state enum (`held`/`reclaimable`/`human-held`/`free`), and the versioned claim-record format come from that contract, not from this skill.
14
+ - `pull-work` may perform exactly two provider-adjacent writes at selection: the liveness claim (ADR 0012, ephemeral, local runtime presence stream — see "1a. Liveness Selection Preflight" / "Liveness Claim On Selection") and the durable assignment claim (`context/contracts/assignment-provider-contract.md`, GitHub assignee/label/comment or a local-file record — see "Assignment Claim On Selection"); no other provider mutation is added to this skill.
13
15
  - Read the configured backlog provider dynamically.
14
16
  - Select one issue or a coherent issue group.
15
17
  - Do not implement code.
@@ -29,14 +31,18 @@ Select ready backlog work and prepare a bounded execution handoff without implem
29
31
  - Repository or working directory.
30
32
  - Optional labels, milestone, project board, assignee, or priority filter.
31
33
  - Optional WIP limit or current in-progress context.
32
- - Existing `.flow-agents/<slug>/` artifacts, PRs, and CI/review queues.
34
+ - Existing `.kontourai/flow-agents/<slug>/` artifacts, PRs, and CI/review queues.
33
35
 
34
36
  ## Artifact Contract
35
37
 
36
- Create or update `.flow-agents/<slug>/<slug>--pull-work.md` with:
38
+ Create or update `.kontourai/flow-agents/<slug>/<slug>--pull-work.md` with:
37
39
 
38
40
  - `board_snapshot`: filters, issue list, labels, milestone/provider milestone state, project fields, state, blockers
39
41
  - `wip_assessment`: active work, reviews, verification, CI remediation, with personal WIP separated from global conflict context
42
+ - `liveness_preflight`: per-candidate `{subjectId, state: held|reclaimable|human-held|free|mine, holder_actor?, status_raw, effective_reason?}` plus `self_actor`/`self_actor_source`, computed via `liveness status --json` + `liveness whoami --json` joined with `assignment-provider status`'s `effective_state`/`reason` (see "1a. Liveness Selection Preflight"); `self_actor` is captured exactly once per pull-work pass and pinned for reuse (see "1a. Liveness Selection Preflight" and "Liveness Claim On Selection" — never re-derived per claim call); this is now the **full** ADR 0021 §1 `assignment ⋈ liveness` join (previously liveness-only pending #290 — #290 has landed)
43
+ - `reclaimable_override`: recorded only when a `reclaimable` (stale) candidate is selected, or when `--force`/an explicit user instruction overrides a `held` exclusion — the explicit opt-in decision and its stated reason (see "1a. Liveness Selection Preflight")
44
+ - `liveness_claim`: per selected item, `{subjectId, actor, emitted_at, ttl_seconds}`; on any claim-emit failure, `{skipped: <stderr reason>}` instead — fail-open (never block selection on a liveness-emit failure) but never silent: the skip reason is also surfaced in pull-work's user-facing output, and an unresolved-actor failure additionally names the remediation (`--actor <id>` / `FLOW_AGENTS_ACTOR=<id>` / a supported runtime), matching ADR 0012; also carries an optional `post_claim_conflict: {other_actor, detected_at}` when the post-claim re-check (see "Post-Claim Conflict Re-check") detects a double-hold
45
+ - `assignment_claim`: per selected item, `{provider: "github"|"local-file", subject_id, actor, command_evidence, confirmed_status}` — the durable-claim analog of `selected_item_ids`: provider kind, subject id, actor, the rendered/executed command evidence (`gh_commands`/`claim_comment_body` for `github`, the local-file `claim` invocation for `local-file`), and the confirmed `assignment-provider status` result for each selected item, recorded once the post-claim confirmation in "Assignment Claim On Selection" succeeds; see `context/contracts/assignment-provider-contract.md` for the underlying claim-record shape
40
46
  - `my_active_work`: local worktrees, dirty branches, open PRs by the current user, active sidecars, and in-flight review/verification/release work owned by the current user
41
47
  - `shepherding_candidates`: personal PRs, worktrees, or sidecars that should be reviewed, fixed, published, merged, abandoned, or cleaned before starting more work
42
48
  - `stale_worktrees`: worktrees with no open PR, no recent activity, merged/abandoned branches, or unclear ownership that need an explicit keep/remove decision
@@ -111,6 +117,56 @@ Missing `planned_base_sha` is not fresh. Record it as an explicit `NOT_VERIFIED`
111
117
 
112
118
  Return vague work to `idea-to-backlog` instead of inventing scope.
113
119
 
120
+ ### 1a. Liveness Selection Preflight
121
+
122
+ Resolve the current actor once per `pull-work` pass and pin it for reuse:
123
+
124
+ ```bash
125
+ npm run workflow:sidecar -- liveness whoami --json
126
+ ```
127
+
128
+ Capture the returned `actor` value as `self_actor` (and its `source` as `self_actor_source`) exactly once per pass. Reuse this pinned `self_actor` value explicitly via `--actor <self_actor>` on every subsequent `liveness claim` call in the same pass (see "Liveness Claim On Selection" below) — never re-derive the actor mid-pass, since ancestry/session-based resolution could otherwise resolve to a different value across separate calls within the same pass and silently defeat the "who am I" pinning this preflight depends on.
129
+
130
+ Read the full liveness stream once per pass (omit `--subject` to get every row):
131
+
132
+ ```bash
133
+ npm run workflow:sidecar -- liveness status --json
134
+ ```
135
+
136
+ For each ready candidate, derive `subjectId` via:
137
+
138
+ ```bash
139
+ npm run workflow:sidecar -- resolve-slug <owner>/<repo>#<issue-number>
140
+ ```
141
+
142
+ then group all rows for that `subjectId` by subject (classify per subject, not per row), reading each row's raw `status` field (never `label`). Detect the liveness-only double-hold case first, before computing the full assignment ⋈ liveness join below: when a `verified` row for an actor other than self and a `verified` row for the resolved self actor both exist on the same subject, that is a double-hold — surface it as `held` plus an explicit conflict warning (per ADR 0012 §4 detection: "a false-stale double-hold ... is detected ... not prevented"), never silently resolve it to `mine`.
143
+
144
+ Otherwise, compute the full ADR 0021 §1 `assignment ⋈ liveness` join per candidate via `assignment-provider status` (using the effective provider kind, repo, artifact root, `label_name`, and `claim_comment_marker` from `effective-assignment-provider-settings` — see "Assignment Claim On Selection" below — joined against the same liveness stream already read above):
145
+
146
+ ```bash
147
+ npm run assignment-provider -- status \
148
+ --provider <github|local-file> \
149
+ --subject-id <subjectId> \
150
+ --liveness-stream <path-to-events.jsonl> \
151
+ --self-actor <self_actor>
152
+ # github: --issue-json <path-to-gh-issue-view-json|-> --label-name <label> --claim-comment-marker <marker>
153
+ # local-file: --artifact-root <dir>
154
+ ```
155
+
156
+ Read the returned `.effective.effective_state` and `.effective.reason` and classify in this precedence order:
157
+
158
+ 1. `effective_state: "held"` with `reason: "self_is_holder"` ⇒ `mine`: hand to `### 2. Enforce WIP And Shepherding`'s existing personal-WIP logic; do not re-offer as new, do not exclude as held-by-other.
159
+ 2. else `effective_state: "held"` (`reason: "fresh_liveness_heartbeat"` or `"liveness_claim_present_assignment_lagging"`) ⇒ excluded from the ready set by default.
160
+ 3. else `effective_state: "reclaimable"` ⇒ offered, flagged, with a warning; selecting it requires an explicit recorded opt-in (record in `reclaimable_override`, and/or `alignment_questions`), never a silent normal pick. This issue does not implement takeover — offering a `reclaimable` candidate, never auto-reclaiming it, is the correct scope boundary (Design Decision 2; full takeover protocol is ADR 0021 §5 / #294).
161
+ 4. else `effective_state: "human-held"` ⇒ surfaced, never auto-reclaimed (Design Decision 3 / ADR 0021 §6): record the assignee identity and idle duration (`effective.holder.assignee`, `effective.holder.idle_days`) in `alignment_questions` with a recommended answer (e.g. "assigned to `<assignee>`, idle `<idle_days>` days — reclaim?" recommending confirmation before proceeding), and select only on the user's explicit confirmation.
162
+ 5. else `effective_state: "free"` ⇒ offered normally — except a `superseded` liveness row (no active assignment, no fresh liveness) is surfaced but never auto-selected (full takeover semantics are #294; this is an accepted gap, not silently ignored), exactly as before this join upgrade.
163
+
164
+ An explicit user instruction to proceed despite a `held` or `reclaimable` classification (`--force`, "take it anyway", equivalent) overrides the exclusion/opt-in requirement; the override and its stated reason must be recorded in the artifact (`liveness_preflight`, `reclaimable_override`, and/or `priority_rationale`). A `human-held` classification is never overridden by `--force` alone — only the user's explicit answer to the recorded `alignment_questions` entry authorizes selecting it.
165
+
166
+ This preflight now computes the **full** ADR 0021 §1 `assignment ⋈ liveness` join (previously liveness-only, pending #290): the assignment dimension is `#290`'s `AssignmentProvider` `status()` (`context/contracts/assignment-provider-contract.md`), joined against the same liveness stream this preflight already reads.
167
+
168
+ `liveness claim`/`status`/`whoami` read/write the local runtime liveness stream, never GitHub issue/label/assignee state — this is not a provider mutation, and the two-provider-writes-only invariant in `## Contract` is unchanged by this slice. `#290` adds the one narrow, audited durable assignment claim that pairs with this liveness emit — see "Assignment Claim On Selection" below.
169
+
114
170
  ### 2. Enforce WIP And Shepherding
115
171
 
116
172
  Before selecting new work, check whether review, verification, release, or CI remediation is congested. Separate the current user's active work from global conflict context.
@@ -119,7 +175,7 @@ Personal WIP scan:
119
175
 
120
176
  - Inspect local worktrees and branches for dirty state, unpublished commits, merged branches, abandoned branches, and unclear ownership.
121
177
  - Inspect open PRs authored by the current user and record review/check state, requested changes, mergeability, and whether the PR needs shepherding.
122
- - Inspect active `.flow-agents/<slug>/` sidecars owned by the current user or current session, especially `planning`, `planned`, `in_progress`, `verifying`, `needs_decision`, `not_verified`, `failed`, and `blocked`.
178
+ - Inspect active `.kontourai/flow-agents/<slug>/` sidecars owned by the current user or current session, especially `planning`, `planned`, `in_progress`, `verifying`, `needs_decision`, `not_verified`, `failed`, and `blocked`.
123
179
  - Classify personal items into `my_active_work`, `shepherding_candidates`, `stale_worktrees`, and `open_prs_by_me`.
124
180
 
125
181
  Global conflict scan:
@@ -187,6 +243,93 @@ Use these compact examples as the expected artifact shape when selecting or reje
187
243
  - **dogfood-alpha implementation work**: `selected_scope`: single-item implementation slice in the dogfood-alpha milestone; `priority_rationale`: high delivery alignment and unlocks product dogfood evidence, but only selected if dependencies are closed or explicitly accepted; `dependencies`: list blocked-by issues, required artifacts, and pickup Probe freshness; `wip_conflict_notes`: require worktree isolation when implementation overlaps active files or release lanes; `grouping_check`: Work Item Group only when one item hard-blocks the implementation and the dependency sequence is part of the same acceptance signal; `alignment_questions`: ask the narrow scope question before `plan-work` if the issue could expand into provider adapters or runtime orchestration.
188
244
  - **blocked cross-product dependency**: `selected_scope`: no implementation selection; `priority_rationale`: defer because a higher-priority item in another product/repo is blocked by an unresolved dependency or missing provider state; `dependencies`: name the blocker, owner/repo when known, and freshness check; `wip_conflict_notes`: record any release-lane or provider-state conflict as the reason to stop; `grouping_check`: unsafe-group unless explicit dependency sequencing and shared acceptance justify a bundle; `alignment_questions`: ask whether to shepherd/unblock the dependency, return to shaping, or choose the next ready independent item.
189
245
 
246
+ ### Liveness Claim On Selection
247
+
248
+ Once `selected_item_ids` is finalized at the end of `### 3. Select Work`, before handoff to `plan-work`, for each selected item run:
249
+
250
+ ```bash
251
+ npm run workflow:sidecar -- liveness claim <subjectId> --actor <self_actor>
252
+ ```
253
+
254
+ using the same `subjectId` computed via `resolve-slug` during the preflight, and the same pinned `self_actor` captured once from `liveness whoami --json` at the start of this pass (`### 1a. Liveness Selection Preflight`) — always pass `--actor <self_actor>` explicitly on every claim in this pass; never a fresh derivation per claim call.
255
+
256
+ Record the result in `liveness_claim` as `{subjectId, actor, emitted_at, ttl_seconds}`. On any claim-emit failure (non-zero exit, unresolved actor, or liveness disabled/unavailable), record `{skipped: <stderr reason>}` in `liveness_claim` instead — fail-open, never block selection on a liveness-emit failure — and also surface that skip reason in pull-work's user-facing output; never silent. When the failure is specifically an unresolved-actor failure, additionally name the remediation (`--actor <id>` / `FLOW_AGENTS_ACTOR=<id>` / a supported runtime), matching `liveness claim`'s own error message.
257
+
258
+ ### Post-Claim Conflict Re-check
259
+
260
+ After emitting claims for the selected item(s) above, re-read liveness status for those same subjects:
261
+
262
+ ```bash
263
+ npm run workflow:sidecar -- liveness status --json --subject <subjectId>
264
+ ```
265
+
266
+ If another actor's fresh (`verified`) claim now coexists with this session's own just-emitted claim on the same subject — a double-hold, per ADR 0012 §4 ("a false-stale double-hold (two fresh claims on one subject) is detected ... via Hachure `conflictRules`/`conflictedClaims`, not prevented") — surface the conflict prominently in the user-facing output and instruct the user to coordinate before proceeding; do not silently continue as if the selection were exclusive. Record the detected conflict in `liveness_claim`'s `post_claim_conflict` field.
267
+
268
+ When a double-hold is detected, immediately run the deterministic tiebreaker using the same pinned `self_actor` and the same `subjectId` already in scope:
269
+
270
+ ```bash
271
+ npm run workflow:sidecar -- liveness verdict <subjectId> --json
272
+ ```
273
+
274
+ `liveness verdict` is a read-only, lock-free CLI action that computes `{subjectId, winner, losers, reason, holders}` as a pure function of the shared liveness stream: among the subject's currently-fresh claim holders, the one whose current `claim` event has the earliest `at` wins; an exact-timestamp tie breaks by ascending actor-id string comparison (`reason: "tie-actor-lexicographic"`) — the SAME verdict for the SAME stream state regardless of which actor invokes it.
275
+
276
+ Branch on the returned `winner.actor`:
277
+
278
+ - If `winner.actor !== self_actor`, this session is the loser: immediately run `npm run workflow:sidecar -- liveness release <subjectId> --actor <self_actor>`, extend `post_claim_conflict` with `{verdict_reason, winner_actor, conceded: true}`, and return to `### 3. Select Work` to reselect within the same `pull-work` pass — excluding the just-released subject — before any handoff to `plan-work`.
279
+ - If `winner.actor === self_actor`, this session wins: record the verdict for transparency (`{verdict_reason, winner_actor: self_actor, conceded: false}`) in `post_claim_conflict` and proceed normally; do not release.
280
+
281
+ Honesty note: this re-check narrows, but does not close, the read-then-write race between the preflight's read and the claim's write. The verdict-and-release loop above closes the "detected but advisory-only" gap ADR 0012 §4 names for THIS session's own double-hold — the loser deterministically concedes and re-selects within the same pass, a new convergence guarantee this slice adds — but it still does not provide true mutual exclusion across the read-then-write race window itself; that residual is unchanged from before. `#290`'s provider assignment lease closes this gap for the **local-file** provider only: `claim`/`release`/`supersede` there are wrapped in a per-subject `mkdir`-lock (atomic create, EEXIST-spin, staleness reclaim), so two concurrent local-file `claim` calls on the same subject genuinely cannot both win — true mutual exclusion, not just detection. The **GitHub** provider (assignee/label/claim-comment) remains advisory/last-writer: `render-claim`/`render-supersede` emit `gh` argv for the calling skill to run, and nothing about a GitHub issue's assignee/label/comment state gives atomic compare-and-swap across two concurrent skill invocations — the post-claim `status` re-check above still only *detects* a lost race after the fact, it does not *prevent* one. Do not read "provider assignment lease" as closing the GitHub race; only the `verify-hold` publish gate (#293), not yet implemented, would do that for GitHub.
282
+
283
+ ### Assignment Claim On Selection
284
+
285
+ After the post-claim liveness conflict re-check above resolves (no double-hold detected, or this session won the deterministic tiebreaker and any loser has reselected) and `selected_item_ids` is otherwise ready to finalize, perform the durable assignment claim — the second and last provider-adjacent write this skill performs (see `## Contract`) — before recording `selected_item_ids` as final and before any handoff to `plan-work`.
286
+
287
+ Resolve the effective assignment provider settings once per pass:
288
+
289
+ ```bash
290
+ npm run effective-assignment-provider-settings -- --repo-path . --json
291
+ ```
292
+
293
+ If the result is `status: ask_user`, ask the user which `AssignmentProvider` (`github` or `local-file`) to use before claiming; do not silently assume. If `status: configured`, use the returned `settings.provider.kind`, `settings.provider.repo`, `settings.policy.label_name`, and `settings.policy.claim_comment_marker` for every call below.
294
+
295
+ For each selected item's `subjectId` (the same `subjectId` resolved via `resolve-slug` and used throughout this pass):
296
+
297
+ - **`kind: "github"`**: build an `--input-json` payload with `repo` (`{owner, name}`), `issue_number`, `assignee_login` (the current actor's GitHub login when known), `existing_assignee_login` and `existing_comment_id` (only when superseding an already-recorded `reclaimable`/confirmed `human-held` candidate — otherwise omit), `label_name`, `claim_comment_marker`, `ttl_seconds`, `branch`, and `artifact_dir`, then render:
298
+
299
+ ```bash
300
+ npm run assignment-provider -- render-claim \
301
+ --provider github \
302
+ --subject-id <subjectId> \
303
+ --input-json <path> \
304
+ --actor-json <path>
305
+ ```
306
+
307
+ Execute every command in the returned `gh_commands` array **verbatim** via the Bash tool, in order — never freehand `gh` text. Each `gh_commands` entry is an **argv array** (one element per argument, e.g. `["gh", "issue", "comment", "9101", "--repo", "kontourai/flow-agents", "--body", "..."]`) and MUST be executed as argv — every element passed as its own separate Bash-tool argument — **never** concatenated into a single shell-command string, and **never** run via `bash -c "..."` or any other shell re-interpretation of the joined elements. `claim_comment_body` (and, when superseding, `previous_record`) can carry attacker-influenced text (see the GitHub claim-record sanitization note in `context/contracts/assignment-provider-contract.md`); concatenating argv elements into a shell string before execution would reintroduce a shell-injection surface this render/execute split is designed to avoid. Record the rendered `record`, `claim_comment_body`, and each executed `gh_commands` entry as evidence.
308
+
309
+ - **`kind: "local-file"`**: call the local-file `claim` subcommand directly — no render step, since this is the one path that performs real I/O inside the CLI itself:
310
+
311
+ ```bash
312
+ npm run assignment-provider -- claim \
313
+ --provider local-file \
314
+ --artifact-root <artifact-root> \
315
+ --subject-id <subjectId> \
316
+ --branch <branch> \
317
+ --artifact-dir <artifact_dir> \
318
+ --actor-json <path>
319
+ ```
320
+
321
+ A non-zero exit (already claimed by a different actor) must not be silently retried or overwritten — treat it exactly like a `held`/`reclaimable` conflict and return to `### 3. Select Work` to reselect.
322
+
323
+ Then, regardless of provider kind, re-fetch current state — re-fetch the GitHub issue via `gh issue view --json assignees,labels,comments` for `github` (the local-file record is already current on disk) — and call `assignment-provider status` again, passing the same pinned `self_actor`, to **confirm** the claim landed before treating `selected_item_ids` as final:
324
+
325
+ ```bash
326
+ npm run assignment-provider -- status --provider <github|local-file> --subject-id <subjectId> --self-actor <self_actor> ...
327
+ ```
328
+
329
+ Confirm `effective.effective_state === "held"` with `effective.reason === "self_is_holder"` (the join function's signal that this session's own actor is the confirmed holder). Only after this confirmation does `selected_item_ids` become final for handoff. If confirmation fails — the claim did not land, or a different actor's record now appears — treat this exactly like a liveness double-hold: do not proceed to `plan-work` with this subject; return to `### 3. Select Work` to reselect, excluding the contested subject.
330
+
331
+ Record the render/status evidence — provider kind, subject id, actor, the rendered/executed command(s), and the confirmed `status()` result — for every selected item under `selection` and in the dedicated `assignment_claim` artifact field (see Artifact Contract above).
332
+
190
333
  ### 4. Anchor Check
191
334
 
192
335
  Before planning, restate:
@@ -298,11 +441,11 @@ When the Pickup Gate passes and work is selected (not just a shepherding scan or
298
441
  Use the `selected_item_ids` as the evidence artifact ref and confirm that scope and acceptance criteria are present in the pull-work artifact:
299
442
 
300
443
  ```bash
301
- npm run workflow:sidecar -- record-gate-claim .flow-agents/<slug> \
444
+ npm run workflow:sidecar -- record-gate-claim .kontourai/flow-agents/<slug> \
302
445
  --expectation selected-work \
303
446
  --status pass \
304
447
  --summary "Selected <work-item-ref>: scope clear, acceptance criteria present." \
305
- --evidence-ref-json '{"kind":"artifact","file":".flow-agents/<slug>/<slug>--pull-work.md","summary":"Pull-work artifact with selected_item_ids, scope, and acceptance criteria."}'
448
+ --evidence-ref-json '{"kind":"artifact","file":".kontourai/flow-agents/<slug>/<slug>--pull-work.md","summary":"Pull-work artifact with selected_item_ids, scope, and acceptance criteria."}'
306
449
  ```
307
450
 
308
451
  Use `--status fail` when the gate fails (blocker recorded but no selection made). Use `--status not_verified` only when the session has no active flow step (non-Builder-Kit usage).
@@ -28,7 +28,7 @@ Release Readiness is not Evidence Gate. Evidence Gate decides whether completed
28
28
 
29
29
  ## Artifact Contract
30
30
 
31
- Create or update `.flow-agents/<slug>/<slug>--release-readiness.md` with:
31
+ Create or update `.kontourai/flow-agents/<slug>/<slug>--release-readiness.md` with:
32
32
 
33
33
  - `release_scope`: work included, excluded, issue/provider-change links
34
34
  - `evidence_reference`: evidence artifact, verdict, residual risks
@@ -37,13 +37,13 @@ Create or update `.flow-agents/<slug>/<slug>--release-readiness.md` with:
37
37
  - `rollback_plan`: trigger, steps, owner, expected recovery signal
38
38
  - `observability_plan`: metrics, logs, traces, alerts, dashboards
39
39
  - `post_deploy_checks`: checks, commands, URLs, timing, expected signals
40
- - `final_acceptance_docs`: long-lived docs updated, archived `.flow-agents/<slug>/` links, and deferred docs follow-ups
40
+ - `final_acceptance_docs`: long-lived docs updated, archived `.kontourai/flow-agents/<slug>/` links, and deferred docs follow-ups
41
41
  - `decision`: MERGE, RELEASE, DEPLOY, HOLD, or ROLLBACK_REQUIRED
42
42
 
43
43
  When the repository provides `npm run workflow:sidecar --`, also write `release.json` with:
44
44
 
45
45
  ```bash
46
- npm run workflow:sidecar -- record-release .flow-agents/<slug> \
46
+ npm run workflow:sidecar -- record-release .kontourai/flow-agents/<slug> \
47
47
  --decision merge \
48
48
  --scope "..." \
49
49
  --evidence-ref evidence.json \
@@ -108,7 +108,7 @@ When CI has passed and merge/release acceptance is clear, require a docs decisio
108
108
 
109
109
  - update long-lived docs with what changed, how to use it, and important why/how decisions; or
110
110
  - record why no durable docs are needed; and
111
- - link back to the archived `.flow-agents/<slug>/` plan/session artifact for implementation history.
111
+ - link back to the archived `.kontourai/flow-agents/<slug>/` plan/session artifact for implementation history.
112
112
 
113
113
  ## Gates
114
114
 
@@ -48,7 +48,7 @@ If a fix is needed, report it as a finding. The orchestrator routes it back to e
48
48
 
49
49
  ## Input
50
50
 
51
- - Session file path in `.flow-agents/<slug>/` when available
51
+ - Session file path in `.kontourai/flow-agents/<slug>/` when available
52
52
  - Plan artifact or implementation summary
53
53
  - Modified files from execution progress or `git diff --name-only`
54
54
  - Project standards, especially `context/code-review-standards.md` when present
@@ -85,6 +85,29 @@ package-registry behavior, update dependencies, or install scanners. If the
85
85
  required dependency review cannot run, record the dependency lane as
86
86
  `not_verified`.
87
87
 
88
+ For multi-repo or cross-product work, dependency review must preserve the full
89
+ scope. Before delegating, enumerate every affected repo/package-manager root and
90
+ record one status per root:
91
+
92
+ - `pass`: dependency review ran and found no blocking issue
93
+ - `fail`: dependency review ran and found a blocking advisory, version, or
94
+ lockfile issue
95
+ - `skip_no_manifest`: the root has no supported dependency manifest
96
+ - `not_verified`: review could not run or the result is unavailable
97
+
98
+ Do not narrow the dependency lane to only roots that failed build/test. If the
99
+ work changed shared conventions, generated artifact paths, install scripts, CI,
100
+ or workspace-wide guidance, the dependency review summary must say which product
101
+ roots were included and which were out of scope.
102
+
103
+ External advisory/audit services can disclose private dependency metadata. Before
104
+ running tools such as `npm audit`, registry lookups, or vendor advisory APIs,
105
+ record whether the user explicitly approved that disclosure for the affected
106
+ roots. If approval is absent, rejected, or too ambiguous for the local execution
107
+ policy, keep local inventory evidence and mark the external-audit portion
108
+ `not_verified` with the approval/privacy blocker. Do not convert that blocker
109
+ into a clean pass.
110
+
88
111
  ## IaC/Policy Review Triggers
89
112
 
90
113
  Run security and configured IaC/policy review when modified files touch
@@ -137,4 +137,6 @@ coverage_target: 80
137
137
  - iteration 1: RED ✓, GREEN ✓, REFACTOR ✓, coverage 85%
138
138
  ```
139
139
 
140
+ `<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.
141
+
140
142
  {context?}