@kontourai/flow-agents 3.5.0 → 3.7.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 (111) hide show
  1. package/.github/workflows/ci.yml +4 -0
  2. package/CHANGELOG.md +15 -0
  3. package/build/src/builder-flow-run-adapter.d.ts +32 -3
  4. package/build/src/builder-flow-run-adapter.js +113 -20
  5. package/build/src/builder-flow-runtime.d.ts +26 -3
  6. package/build/src/builder-flow-runtime.js +502 -49
  7. package/build/src/builder-lifecycle-authority.d.ts +35 -0
  8. package/build/src/builder-lifecycle-authority.js +219 -0
  9. package/build/src/cli/assignment-provider.d.ts +14 -7
  10. package/build/src/cli/assignment-provider.js +128 -65
  11. package/build/src/cli/builder-run.js +46 -9
  12. package/build/src/cli/workflow-artifact-cleanup-audit.js +3 -0
  13. package/build/src/cli/workflow-sidecar.d.ts +30 -3
  14. package/build/src/cli/workflow-sidecar.js +825 -99
  15. package/build/src/cli/workflow.d.ts +2 -0
  16. package/build/src/cli/workflow.js +769 -0
  17. package/build/src/cli.js +2 -0
  18. package/build/src/flow-kit/validate.d.ts +17 -0
  19. package/build/src/flow-kit/validate.js +340 -2
  20. package/build/src/index.d.ts +4 -0
  21. package/build/src/index.js +7 -5
  22. package/build/src/lib/observed-command.d.ts +7 -0
  23. package/build/src/lib/observed-command.js +100 -0
  24. package/build/src/lib/package-version.d.ts +2 -0
  25. package/build/src/lib/package-version.js +13 -0
  26. package/build/src/lib/pinned-cli-command.d.ts +6 -0
  27. package/build/src/lib/pinned-cli-command.js +21 -0
  28. package/build/src/tools/generate-context-map.js +5 -3
  29. package/context/contracts/artifact-contract.md +1 -1
  30. package/context/scripts/hooks/config-protection.js +8 -1
  31. package/context/scripts/hooks/lib/config-protection-remedies.js +3 -0
  32. package/context/scripts/hooks/lib/kit-catalog.js +1 -1
  33. package/context/scripts/hooks/stop-goal-fit.js +79 -10
  34. package/docs/context-map.md +24 -20
  35. package/docs/developer-architecture.md +1 -1
  36. package/docs/public-workflow-cli.md +132 -0
  37. package/docs/skills-map.md +51 -27
  38. package/docs/spec/builder-flow-runtime.md +78 -40
  39. package/docs/workflow-usage-guide.md +110 -38
  40. package/evals/ci/run-baseline.sh +2 -0
  41. package/evals/fixtures/hook-influence/cases.json +2 -2
  42. package/evals/integration/test_builder_entry_enforcement.sh +57 -45
  43. package/evals/integration/test_builder_step_producers.sh +297 -6
  44. package/evals/integration/test_bundle_install.sh +258 -55
  45. package/evals/integration/test_critique_supersession_roundtrip.sh +21 -8
  46. package/evals/integration/test_current_json_per_actor.sh +12 -0
  47. package/evals/integration/test_dual_emit_flow_step.sh +62 -43
  48. package/evals/integration/test_flowdef_session_activation.sh +145 -25
  49. package/evals/integration/test_flowdef_session_history_preservation.sh +23 -21
  50. package/evals/integration/test_gate_lockdown.sh +3 -5
  51. package/evals/integration/test_goal_fit_hook.sh +60 -2
  52. package/evals/integration/test_liveness_verdict.sh +14 -17
  53. package/evals/integration/test_phase_map_and_gate_claim.sh +63 -38
  54. package/evals/integration/test_public_workflow_cli.sh +573 -0
  55. package/evals/integration/test_pull_work_liveness_preflight.sh +22 -66
  56. package/evals/integration/test_sidecar_field_preservation.sh +36 -11
  57. package/evals/integration/test_workflow_sidecar_writer.sh +277 -44
  58. package/evals/integration/test_workflow_steering_hook.sh +15 -38
  59. package/evals/run.sh +2 -0
  60. package/evals/static/test_builder_skill_coherence.sh +247 -0
  61. package/evals/static/test_library_exports.sh +5 -2
  62. package/evals/static/test_workflow_skills.sh +13 -325
  63. package/kits/builder/flows/build.flow.json +22 -0
  64. package/kits/builder/flows/shape.flow.json +9 -9
  65. package/kits/builder/kit.json +70 -16
  66. package/kits/builder/skills/builder-shape/SKILL.md +75 -75
  67. package/kits/builder/skills/continue-work/SKILL.md +45 -106
  68. package/kits/builder/skills/deliver/SKILL.md +96 -442
  69. package/kits/builder/skills/design-probe/SKILL.md +40 -139
  70. package/kits/builder/skills/evidence-gate/SKILL.md +59 -201
  71. package/kits/builder/skills/execute-plan/SKILL.md +54 -125
  72. package/kits/builder/skills/fix-bug/SKILL.md +42 -132
  73. package/kits/builder/skills/gate-review/SKILL.md +60 -211
  74. package/kits/builder/skills/idea-to-backlog/SKILL.md +63 -244
  75. package/kits/builder/skills/learning-review/SKILL.md +63 -170
  76. package/kits/builder/skills/pickup-probe/SKILL.md +54 -111
  77. package/kits/builder/skills/plan-work/SKILL.md +51 -185
  78. package/kits/builder/skills/pull-work/SKILL.md +136 -485
  79. package/kits/builder/skills/release-readiness/SKILL.md +66 -107
  80. package/kits/builder/skills/review-work/SKILL.md +89 -176
  81. package/kits/builder/skills/tdd-workflow/SKILL.md +53 -147
  82. package/kits/builder/skills/verify-work/SKILL.md +101 -113
  83. package/package.json +2 -2
  84. package/schemas/builder-lifecycle-authorization.schema.json +57 -0
  85. package/schemas/lifecycle-authority-keys.schema.json +25 -0
  86. package/schemas/workflow-state.schema.json +1 -1
  87. package/scripts/hooks/config-protection.js +8 -1
  88. package/scripts/hooks/lib/config-protection-remedies.js +3 -0
  89. package/scripts/hooks/lib/kit-catalog.js +1 -1
  90. package/scripts/hooks/stop-goal-fit.js +79 -10
  91. package/src/builder-flow-run-adapter.ts +156 -23
  92. package/src/builder-flow-runtime.ts +535 -53
  93. package/src/builder-lifecycle-authority.ts +218 -0
  94. package/src/cli/assignment-provider-lock.test.mjs +83 -0
  95. package/src/cli/assignment-provider.ts +91 -22
  96. package/src/cli/builder-flow-run-adapter.test.mjs +4 -2
  97. package/src/cli/builder-flow-runtime.test.mjs +597 -8
  98. package/src/cli/builder-run.ts +54 -9
  99. package/src/cli/kit-metadata-security.test.mjs +232 -6
  100. package/src/cli/public-api.test.mjs +15 -0
  101. package/src/cli/workflow-artifact-cleanup-audit.ts +3 -0
  102. package/src/cli/workflow-sidecar-execution-proof.test.mjs +90 -0
  103. package/src/cli/workflow-sidecar.ts +748 -99
  104. package/src/cli/workflow.ts +708 -0
  105. package/src/cli.ts +2 -0
  106. package/src/flow-kit/validate.ts +320 -2
  107. package/src/index.ts +20 -5
  108. package/src/lib/observed-command.ts +96 -0
  109. package/src/lib/package-version.ts +15 -0
  110. package/src/lib/pinned-cli-command.ts +23 -0
  111. package/src/tools/generate-context-map.ts +5 -3
@@ -8,13 +8,39 @@ This map groups the current skills by the user journey they support. The Builder
8
8
 
9
9
  For practical operator instructions and copy/paste prompts, see https://github.com/kontourai/flow-agents/blob/main/docs/workflow-usage-guide.md. For the shared cross-distribution contracts behind the workflow artifacts and gates, see https://github.com/kontourai/flow-agents/blob/main/docs/workflow-shared-contracts.md.
10
10
 
11
+ ## Builder Skill Roles
12
+
13
+ `kits/builder/kit.json` is the machine-readable source for skill activation.
14
+ Flow Definitions own step order, gates, route-backs, and trust expectations;
15
+ the role matrix only maps each skill to that Flow-owned behavior.
16
+
17
+ | Role | Skills | Activation |
18
+ | --- | --- | --- |
19
+ | Entrypoint | `builder-shape`, `deliver` | User selects the Builder product workflow; the skill coordinates but owns no step evidence. |
20
+ | Profile | `fix-bug`, `tdd-workflow` | Explicit workflow variant; never selected as an automatic step action. |
21
+ | Step producer | `idea-to-backlog`, `pull-work`, `pickup-probe`, `plan-work`, `execute-plan`, `review-work`, `verify-work`, `evidence-gate`, `release-readiness`, `learning-review` | Activated only for its declared Flow step; publishes only its declared expectations. |
22
+ | Shared primitive | `design-probe` | Reused interview behavior with no Builder expectation ownership. |
23
+ | Extension | `continue-work`, `gate-review` | Explicit continuation or retrospective operation outside automatic step actions. |
24
+
25
+ Within the active `verify` step, `review-work` owns `clean-critique`: it records
26
+ a report-only critique slice in `trust.bundle`. `verify-work` owns
27
+ `acceptance-criteria`, `tests-evidence`, and applicable `policy-compliance`
28
+ through command-backed behavior evidence. Use the public `flow-agents workflow`
29
+ CLI for run status, evidence, and critique; skills must not call the
30
+ package-internal writer directly.
31
+
32
+ `builder.build` accepts exactly two public Work Item reference forms:
33
+ `provider:id` and `owner/repo#numeric-id`. The latter is the GitHub-compatible
34
+ adapter form; GitHub remains an optional adapter example. Do not invent
35
+ arbitrary reference formats.
36
+
11
37
  - `builder-shape`: product-level Builder Kit shape invocation that guides `idea-to-backlog` without requiring the user to name the primitive, links `kits/builder/flows/shape.flow.json`, and stops at the backlog gate unless issue sync is explicit.
12
- - `idea-to-backlog`: discovery, idea separation, thinnest meaningful slice, shaping, prioritization, and executable GitHub issue creation.
38
+ - `idea-to-backlog`: discovery, idea separation, thinnest meaningful slice, shaping, prioritization, and executable provider-backed work items; GitHub is an optional adapter.
13
39
  - `pull-work`: dynamic backlog selection, grouping/dependency checks, WIP awareness, worktree decision, and execution handoff; in Builder Kit build, every selected item or justified group needs fresh pickup Probe evidence before planning.
14
40
  - `design-probe`: generic one-question-at-a-time probing interview; Builder Kit uses this step before planning when the build flow needs shared understanding or a pickup decision.
15
41
  - `pickup-probe`: Builder Kit specialization of `design-probe` for selected work items; records scope, provider state, WIP/conflict scans, risks, decisions, unresolved questions, accepted gaps, and planning readiness.
16
42
  - `plan-work` / `execute-plan` / `deliver`: Definition Of Done, execution orchestration, and local delivery closure.
17
- - `continue-work`: advance a multi-slice work item to its next increment via a fresh-context handoff; restores the durable record (resume surface), derives the next undone slice from the issue plus merged PRs, and routes that slice **through** `pull-work` + `pickup-probe` (never around the gate) before handing off fresh per ADR 0013.
43
+ - `continue-work`: advance a multi-slice work item to its next increment via an ephemeral fresh-context handoff; derives the next undone slice from the Work Item plus completed changes, then routes it **through** `pull-work` + `pickup-probe` before handing off fresh per ADR 0013.
18
44
  - `review-work`: report-only critique for quality, security triggers, architecture fit, and standards findings.
19
45
  - `verify-work`: behavior evidence mapped to acceptance criteria and Goal Fit.
20
46
  - `evidence-gate`: trust assessment for completed work: acceptance evidence, integrity checks, CI confidence, and next step.
@@ -35,7 +61,7 @@ flowchart LR
35
61
  Publish[publish-change<br/>commit / push / PR / CI]
36
62
  Release[release-readiness<br/>merge / release / deploy / docs decision]
37
63
  Learn[learning-review<br/>route follow-ups]
38
- Backlog[(GitHub issues)]
64
+ Backlog[(Provider-backed work items)]
39
65
 
40
66
  Idea --> Shape --> Backlog --> Pickup --> Probe --> Build --> Review --> Verify --> GoalFit --> Trust --> Publish --> Release --> Learn
41
67
  Probe -->|not needed| Build
@@ -58,8 +84,8 @@ The operating model now has first-class coverage from idea intake through truste
58
84
  - Design probing is a generic skill named `design-probe`; in the Builder Kit build flow the step is still named `design-probe`, and the `pickup-probe` specialization records selected-work readiness before planning. `decision_gap` route-backs return there for missing pickup/planning decisions.
59
85
  - Product-level Builder Kit build may guide `pull-work -> design-probe / pickup-probe -> plan-work`; direct primitives still stop at their own gates and report the expected next step.
60
86
  - Broad continuation language does not carry across newly selected work after merge. Queue inspection is allowed, but planning the next item requires a fresh pickup Probe record.
61
- - Critique is owned by `review-work` and persisted in `critique.json`.
62
- - Verification is owned by `verify-work` and persisted in `evidence.json`.
87
+ - Critique is owned by `review-work` as `clean-critique`, recorded directly by a delegated reviewer whose runtime identity differs from the active implementation actor, and stored through public `workflow critique` in its `trust.bundle` slice before verification.
88
+ - Verification is owned by `verify-work` as `acceptance-criteria`, `tests-evidence`, and applicable `policy-compliance`, recorded as command-backed `trust.bundle` evidence with one criterion JSON record for every accepted criterion.
63
89
  - Trust evidence is assessed by `evidence-gate`; it decides whether completed work has enough proof and integrity to publish or continue fixing.
64
90
  - Publishing verified changes is the bridge between evidence and release readiness: commit the verified diff, push the branch, open or update the PR, and collect PR/CI evidence.
65
91
  - Merge/release/deploy decisioning is owned by `release-readiness` after the publish-change gate.
@@ -80,18 +106,18 @@ This view shows how each phase is composed. The left rail is the durable phase s
80
106
  <div class="phase-step"><span>01</span><strong>Discovery & shaping</strong></div>
81
107
  <div class="phase-lanes">
82
108
  <section class="phase-lane phase-lane--primary"><h3>Primary</h3><p><code>builder-shape</code> <code>idea-to-backlog</code></p></section>
83
- <section class="phase-lane"><h3>Support</h3><p><code>search-first</code> <code>explore</code> <code>frontend-design</code> <code>github-cli</code> <code>knowledge-capture</code></p></section>
109
+ <section class="phase-lane"><h3>Support</h3><p><code>search-first</code> <code>explore</code> <code>frontend-design</code> optional <code>github-cli</code> adapter <code>knowledge-capture</code></p></section>
84
110
  <section class="phase-lane"><h3>Nested sections / future primitives</h3><p>intake/dedupe, separate ideas, thinnest meaningful slice, opportunity review, explore options, <code>shape-work</code>, prioritize work, sync executable backlog</p></section>
85
- <section class="phase-lane phase-lane--gate"><h3>Gate & artifact</h3><p>Idea, slice, shape, and backlog gates. Writes shaped briefs and GitHub issue links in <code>.kontourai/flow-agents/&lt;slug&gt;/</code>.</p></section>
111
+ <section class="phase-lane phase-lane--gate"><h3>Gate & artifact</h3><p>Idea, slice, shape, and backlog gates. Writes shaped briefs and provider work-item refs in <code>.kontourai/flow-agents/&lt;slug&gt;/</code>.</p></section>
86
112
  </div>
87
113
  </article>
88
114
  <article class="phase-row">
89
115
  <div class="phase-step"><span>02</span><strong>Backlog pickup</strong></div>
90
116
  <div class="phase-lanes">
91
117
  <section class="phase-lane phase-lane--primary"><h3>Primary</h3><p><code>pull-work</code></p></section>
92
- <section class="phase-lane"><h3>Support</h3><p><code>github-cli</code></p></section>
118
+ <section class="phase-lane"><h3>Support</h3><p>optional <code>github-cli</code> adapter</p></section>
93
119
  <section class="phase-lane"><h3>Nested sections / future primitives</h3><p>board snapshot, WIP check, grouping/dependency check, pickup Probe decision, worktree decision, <code>plan-work</code> handoff</p></section>
94
- <section class="phase-lane phase-lane--gate"><h3>Gate & artifact</h3><p>Pickup gate and pickup Probe handoff. Writes selected issues, blockers, bundle justification, provider state, accepted gaps, worktree policy, expected modified files, conflict risks, and handoff notes.</p></section>
120
+ <section class="phase-lane phase-lane--gate"><h3>Gate & artifact</h3><p>Pickup gate and pickup Probe handoff. Writes selected work items, blockers, bundle justification, provider state, accepted gaps, worktree policy, expected modified files, conflict risks, and handoff notes.</p></section>
95
121
  </div>
96
122
  </article>
97
123
  <article class="phase-row">
@@ -107,9 +133,9 @@ This view shows how each phase is composed. The left rail is the durable phase s
107
133
  <div class="phase-step"><span>04</span><strong>Evidence & release</strong></div>
108
134
  <div class="phase-lanes">
109
135
  <section class="phase-lane phase-lane--primary"><h3>Primary</h3><p><code>evidence-gate</code> <code>release-readiness</code></p></section>
110
- <section class="phase-lane"><h3>Support</h3><p><code>github-cli</code> <code>eval-rebuild</code></p></section>
136
+ <section class="phase-lane"><h3>Support</h3><p>optional <code>github-cli</code> adapter <code>eval-rebuild</code></p></section>
111
137
  <section class="phase-lane"><h3>Nested sections / future primitives</h3><p>criteria-to-evidence map, CI confidence, <code>scope-and-integrity-check</code>, publish-change, rollback review, observability review, post-deploy plan, final acceptance docs, remediate-ci</p></section>
112
- <section class="phase-lane phase-lane--gate"><h3>Gate & artifact</h3><p>Evidence, publish-change, release, and docs gates. Writes confidence, integrity, commit/branch/PR/CI links, release scope, risk, rollback, deploy-readiness decisions, and durable documentation links.</p></section>
138
+ <section class="phase-lane phase-lane--gate"><h3>Gate & artifact</h3><p>Evidence, publish-change, release, and docs gates. Writes confidence, integrity, commit/branch/provider-change/CI links, release scope, risk, rollback, deploy-readiness decisions, and durable documentation links.</p></section>
113
139
  </div>
114
140
  </article>
115
141
  <article class="phase-row">
@@ -125,10 +151,10 @@ This view shows how each phase is composed. The left rail is the durable phase s
125
151
 
126
152
  | Phase | Primary workflow skill | Supporting skills | Nested sections / future primitive candidates |
127
153
  | --- | --- | --- | --- |
128
- | Idea discovery and shaping | `builder-shape`, `idea-to-backlog` | `search-first`, `explore`, `frontend-design`, `github-cli`, `knowledge-capture` | intake/dedupe, separate ideas, thinnest meaningful slice, opportunity review, explore options, shape work, prioritize work, sync executable backlog |
129
- | Backlog pickup | `pull-work` | `github-cli` | board snapshot, WIP check, grouping/dependency check, Probe decision, worktree decision, handoff |
154
+ | Idea discovery and shaping | `builder-shape`, `idea-to-backlog` | `search-first`, `explore`, `frontend-design`, optional `github-cli` adapter, `knowledge-capture` | intake/dedupe, separate ideas, thinnest meaningful slice, opportunity review, explore options, shape work, prioritize work, sync executable backlog |
155
+ | Backlog pickup | `pull-work` | optional `github-cli` adapter | board snapshot, WIP check, grouping/dependency check, Probe decision, worktree decision, handoff |
130
156
  | Execution planning and build | `design-probe`, `pickup-probe`, `plan-work`, `execute-plan`, `review-work`, `verify-work` | `feedback-loop`, `browser-test`, `deliver`, `fix-bug`, `tdd-workflow` | Probe notes, Builder Kit Probe record, Definition Of Done, execution plan, parallel waves, implementation session state, critique report, verification report, Goal Fit Gate |
131
- | Evidence and release confidence | `evidence-gate`, `release-readiness` | `github-cli`, `eval-rebuild` | criteria-to-evidence map, CI confidence, scope/integrity check, publish-change, rollback review, observability review, final acceptance docs, post-deploy plan |
157
+ | Evidence and release confidence | `evidence-gate`, `release-readiness` | optional `github-cli` adapter, `eval-rebuild` | criteria-to-evidence map, CI confidence, scope/integrity check, publish-change, rollback review, observability review, final acceptance docs, post-deploy plan |
132
158
  | Learning and improvement | `learning-review` | `knowledge-capture`, `idea-to-backlog`, `eval-rebuild` | facts vs interpretation, docs promotion review, follow-up routing, knowledge updates, eval/skill/backlog improvements |
133
159
 
134
160
  The highest-leverage future extractions are likely `shape-work`, `test-map`, `scope-and-integrity-check`, and `remediate-ci`. They are still nested because their behavior is present, but not yet large enough to need separate activation contracts.
@@ -137,28 +163,26 @@ The highest-leverage future extractions are likely `shape-work`, `test-map`, `sc
137
163
 
138
164
  Each workflow phase ends with an explicit gate and durable artifact:
139
165
 
140
- - `builder-shape` invokes Builder Kit shape, delegates to `idea-to-backlog`, links `kits/builder/flows/shape.flow.json`, and writes the standard `.kontourai/flow-agents/<slug>/<slug>--idea-to-backlog.md` artifact.
141
- - `idea-to-backlog` writes `.kontourai/flow-agents/<slug>/<slug>--idea-to-backlog.md` and produces shaped briefs plus GitHub issue links.
142
- - `pull-work` writes `.kontourai/flow-agents/<slug>/<slug>--pull-work.md` with selected issues, WIP notes, blockers, pickup Probe decisions or accepted gaps, worktree decision, expected modified files, conflict risks, and a `plan-work` handoff.
143
- - `plan-work` and `deliver` write `.kontourai/flow-agents/<slug>/<slug>--*.md` artifacts with `Definition Of Done`, `Goal Fit Gate`, and `Final Acceptance` sections.
144
- - `review-work` writes reviewer artifacts when available and updates `critique.json` with quality, security, architecture, standards, and resolution state.
145
- - `verify-work` writes verification artifacts and updates `evidence.json` with behavior evidence mapped to acceptance criteria.
146
- - `evidence-gate` writes `.kontourai/flow-agents/<slug>/<slug>--evidence-gate.md` with acceptance evidence, CI summary, integrity report, verdict, and next step.
147
- - `release-readiness` writes `.kontourai/flow-agents/<slug>/<slug>--release-readiness.md` with release scope, evidence reference, risk review, operational plan, rollback plan, observability plan, post-deploy checks, and decision.
148
- - `learning-review` writes `.kontourai/flow-agents/<slug>/<slug>--learning-review.md` with outcomes, evidence, decisions, gaps, follow-ups, knowledge updates, and verdict.
166
+ - `builder-shape` selects a safe-slugged public shape run and delegates to `idea-to-backlog`.
167
+ - `idea-to-backlog` owns `<slug>--idea-to-backlog.md` and the `builder.shape` slices in `trust.bundle`.
168
+ - `pull-work` and `pickup-probe` own the selected-work and Probe sections of `<slug>--pull-work.md` plus their `trust.bundle` slices.
169
+ - `plan-work` owns `<slug>--plan-work.md`, `acceptance.json`, `handoff.json`, and its `trust.bundle` plan slice; `execute-plan` owns the session execution report, `state.json`, and its scope slice.
170
+ - `review-work` records report-only critique through public `workflow critique` and owns `clean-critique`.
171
+ - `verify-work` records command-backed `acceptance-criteria`, `tests-evidence`, and applicable `policy-compliance` evidence in `trust.bundle`.
172
+ - `evidence-gate` owns `<slug>--evidence-gate.md`; `release-readiness` owns `release.json`; `learning-review` owns `learning.json`; each also records its declared `trust.bundle` slice.
149
173
 
150
174
  Core gates:
151
175
 
152
176
  - Idea Gate: raw input is deduped, classified, and routed.
153
177
  - Slice Gate: each candidate has one outcome, one thinnest meaningful slice, and explicit split/bundle/dependency reasoning.
154
178
  - Shape Gate: scope, non-goals, risk, rollout notes, and acceptance criteria are stable enough.
155
- - Backlog Gate: GitHub issues represent executable or near-executable work.
179
+ - Backlog Gate: provider-backed work items represent executable or near-executable work; GitHub issues are an optional adapter example.
156
180
  - Pickup Gate: selected work is ready, WIP is acceptable, and worktree policy is recorded.
157
181
  - Review Gate: report-only reviewers have no open blocking findings, or findings are explicitly accepted/deferred/false positive.
158
182
  - Verification Gate: implementation evidence exists from local, automated, browser, or runtime checks.
159
183
  - Goal Fit Gate: the original user outcome is satisfied, gaps are explicit, and local/project/global scope is clear.
160
184
  - Evidence Gate: acceptance criteria are mapped to falsifiable evidence and scope integrity is checked.
161
- - Publish Change Gate: verified changes are committed, pushed, represented by a PR or explicit no-PR decision, and PR checks/CI are linked.
185
+ - Publish Change Gate: verified changes are committed, pushed, represented by a provider change record or explicit no-provider-change decision, and available provider checks/CI are linked.
162
186
  - Release Gate: CI, docs, rollout, rollback, observability, and owner concerns are addressed for the risk class.
163
187
  - Docs Gate: accepted planning artifacts are archived and promoted into durable docs when useful.
164
188
  - Learning Gate: failures and recurring patterns are routed to tests, evals, skills, backlog, or knowledge capture.
@@ -169,7 +193,7 @@ Core gates:
169
193
  flowchart LR
170
194
  Idea[Idea / vague goal]
171
195
  BacklogSkill[idea-to-backlog]
172
- Issue[Executable GitHub issue]
196
+ Issue[Executable provider-backed work item]
173
197
  Pull[pull-work]
174
198
  Probe[design-probe]
175
199
  Worktree[worktree decision]
@@ -203,7 +227,7 @@ Workflow evals are layered to match this map:
203
227
 
204
228
  - Static contract evals guard non-negotiable skill boundaries.
205
229
  - Behavioral activation evals check that agents choose the right workflow and stop at gates.
206
- - Artifact quality evals inspect durable session artifacts and GitHub issue drafts.
230
+ - Artifact quality evals inspect durable session artifacts and provider work-item drafts; GitHub is an optional adapter example.
207
231
  - Adversarial evals exercise premature coding, vague issues, missing CI, weakened tests, and prototype promotion risks.
208
232
  - End-to-end evals cover `idea-to-backlog -> pull-work -> design-probe -> plan-work -> execute-plan -> review-work -> verify-work -> goal-fit -> evidence-gate` selectively.
209
233
 
@@ -28,26 +28,29 @@ expectations, and Builder Kit's structured action map.
28
28
 
29
29
  ## Entry And Synchronization
30
30
 
31
- A Builder session is created at the Flow Definition's entry step by the workflow
32
- sidecar. If automatic startup reports a failure, retry the canonical operation with:
31
+ A Builder session is created at the Flow Definition's entry step by the public
32
+ workflow command. Start the selected Work Item with its stable, human-readable
33
+ provider reference:
33
34
 
34
35
  ```bash
35
- flow-agents builder-run start --session-dir .kontourai/flow-agents/<slug>
36
+ flow-agents workflow start --flow builder.build --work-item <provider-ref> \
37
+ --assignment-provider <configured-kind> \
38
+ [--effective-state-json <provider-status.json>]
36
39
  ```
37
40
 
38
- `ensure-session --flow-id builder.build` starts or loads this canonical run before
39
- returning. When the local assignment provider durably assigns the exact Work Item
40
- to the resolved workflow actor, `ensure-session` rereads that record and produces
41
- the declared `builder.pull-work.selected` claim through the normal Surface trust
42
- bundle path. Flow evaluates that subject-bound evidence and advances to
43
- `design-probe`; Flow Agents does not write a transition or gate outcome directly.
44
- Skipped ownership, unresolved actors, precomputed state, and non-local providers do
45
- not produce selection evidence and remain at `pull-work`.
41
+ The configured provider resolves and durably assigns the exact Work Item to the
42
+ workflow actor. Non-local adapters pass their standard status result to start;
43
+ Flow Agents retains it as provenance and creates a local runtime lease mirror.
44
+ The start path then produces the declared
45
+ `builder.pull-work.selected` claim through the normal Surface trust bundle path.
46
+ Flow evaluates that subject-bound evidence and advances to `design-probe`; Flow
47
+ Agents does not write a transition or gate outcome directly. Skipped ownership,
48
+ unresolved actors, precomputed state, and unavailable provider resolution do not
49
+ produce selection evidence and remain at `pull-work`.
46
50
 
47
- The command remains the explicit recovery path if Flow startup fails after sidecar
48
- creation; the failure is returned to the caller and no substitute run state is
49
- invented. Runtime hooks keep projected actions advisory while the agent performs
50
- their declared skills and operations.
51
+ If start fails, the failure is returned to the caller and no substitute run state
52
+ is invented. Runtime hooks keep projected actions advisory while the agent
53
+ performs their declared skills and operations.
51
54
 
52
55
  Sidecars written by 3.4.2 may still contain `next_action.enforcement`. The 1.0
53
56
  schema accepts that deprecated field for artifact compatibility, but current
@@ -58,38 +61,36 @@ Item reference as the Flow run subject. It is idempotent for an existing canonic
58
61
  run. A direct primitive session without a Builder Flow stamp remains independent and
59
62
  does not create a Flow run.
60
63
 
61
- After a gate producer writes `trust.bundle`, the sidecar writer synchronizes an
62
- existing run automatically. Interrupted clients can replay the projected command:
64
+ After a gate producer writes `trust.bundle`, the public evidence path
65
+ synchronizes the existing run while holding the assignment subject lock.
66
+ Synchronization is digest-idempotent: the same trust bundle is not attached
67
+ twice.
68
+
69
+ ## Public Status And Recovery
70
+
71
+ Inspect an interrupted canonical Builder session with:
63
72
 
64
73
  ```bash
65
- flow-agents builder-run sync --session-dir .kontourai/flow-agents/<slug>
74
+ flow-agents workflow status --session-dir .kontourai/flow-agents/<slug> --json
66
75
  ```
67
76
 
68
- Synchronization is digest-idempotent. The same trust bundle is not attached twice.
69
- Inspection loads the run without evaluating it, so invalid evidence is rejected
70
- before Flow mutation.
71
-
72
- ## Recovery
77
+ `workflow status` is read-only. It loads the canonical run and reports its run
78
+ identity, definition, status, current step, projected `next_action`, and bound
79
+ session directory. Callers cannot select a different run or force a step.
73
80
 
74
- Recover an interrupted canonical Builder session with:
81
+ For an active interrupted run, continue from the reported `next_action` and use
82
+ its exact idempotent command to recheck the canonical state. The current step's
83
+ producer records gate evidence through `flow-agents workflow evidence`; that
84
+ public operation validates assignment and observations before attaching the new
85
+ trust-bundle digest and evaluating the gate. For a paused run, the current
86
+ assignment actor resumes it with an explicit reason:
75
87
 
76
88
  ```bash
77
- flow-agents builder-run recover --session-dir .kontourai/flow-agents/<slug>
89
+ flow-agents workflow resume --session-dir .kontourai/flow-agents/<slug> --reason <text>
78
90
  ```
79
91
 
80
- `recover` derives the Flow run id from the session directory slug; callers cannot
81
- select a run id or step. It requires exactly one non-empty
82
- `state.work_item_refs` entry, loads the existing run through Flow's canonical load
83
- API, and verifies that the ref matches persisted `state.subject` and, when present,
84
- `state.params.subject`. A missing, foreign, or corrupt run fails closed and is not
85
- created or repaired.
86
-
87
- Recovery is load/validate/project only. It computes the complete projection before
88
- updating `state.json`, the matching global `current.json`, and matching per-actor
89
- current pointers. It does not inspect or attach `trust.bundle`, evaluate gates, or
90
- write any file in `.kontourai/flow/runs/<slug>/`; the complete Flow run tree remains
91
- byte-identical. Use `sync`, not `recover`, to attach recorded evidence and evaluate
92
- the current gate.
92
+ Do not use a private synchronization or recovery command, manually project run
93
+ state, or create a replacement run for a missing, foreign, or corrupt binding.
93
94
 
94
95
  ## Trust Binding
95
96
 
@@ -99,7 +100,7 @@ claims are ignored for that gate. A relevant claim with a missing or different
99
100
  subject reference is rejected; Flow is not mutated.
100
101
 
101
102
  A failed gate claim may include a Flow classifier through
102
- `record-gate-claim --status fail --route-reason <reason>`. Flow validates the reason
103
+ `flow-agents workflow evidence --status fail --route-reason <reason>`. Flow validates the reason
103
104
  against the gate's `on_route_back` map and owns both the destination and attempt
104
105
  budget. Flow Agents only projects the resulting attempt and maximum into `state.json`.
105
106
 
@@ -112,9 +113,46 @@ While a run is active, `state.json` contains:
112
113
  - `next_action.skills`: ordered Builder skills for the current step.
113
114
  - `next_action.operations`: ordered non-skill product operations when present.
114
115
  - `next_action.summary`: required gate claims derived from the Flow Definition.
115
- - `next_action.command`: the exact idempotent synchronization command.
116
+ - `next_action.command`: the exact idempotent public status command for reorientation.
116
117
 
117
118
  Workflow steering surfaces these fields on session start and prompt submission. The
118
119
  Stop hook treats an unfinished canonical Flow run as active even during pickup or
119
120
  planning, blocks a premature stop in block mode, and does not release its liveness
120
121
  claim. A run is complete only when Flow reaches its terminal step.
122
+ # Builder Lifecycle Authority
123
+
124
+ The canonical Flow run owns pause, resume, and cancellation. The current assignment actor may
125
+ pause, resume, or release its own assignment with a reason. Cancellation and archival require
126
+ an Ed25519-signed authorization record conforming to
127
+ `schemas/builder-lifecycle-authorization.schema.json`. The record is operation-bound and binds
128
+ the request to the run id, selected Work Item, current assignment actor, immutable external
129
+ request reference, nonce, and expiry. Its signing key must be pinned in the durable
130
+ `.flow-agents/lifecycle-authority-keys.json` registry. Runtime or harness adapters hold the
131
+ private key and capture the signed record from a user/operator channel they trust; agent-authored
132
+ prose or an unsigned model-written file is not cancellation authority.
133
+
134
+ This is an audit and policy boundary, not authentication against a process with unrestricted
135
+ access as the same operating-system user. The harness must keep its signing key outside the
136
+ agent process and enforce its own filesystem or process isolation when the agent is adversarial.
137
+ The repository hooks protect the pinned public-key registry from ordinary agent writes, but are
138
+ explicitly not an operating-system security boundary.
139
+ Adversarial-runtime authentication is tracked separately in Flow Agents issue #545. Flow's
140
+ current lifecycle authority vocabulary also requires agent-owned pause/resume events to use the
141
+ closest available `operator_request` shape; a distinct canonical runtime authority is tracked in
142
+ Flow issue #118.
143
+
144
+ ```text
145
+ flow-agents builder-run pause --session-dir <dir> --reason <text>
146
+ flow-agents builder-run resume --session-dir <dir> --reason <text>
147
+ flow-agents builder-run cancel --session-dir <dir> --authorization-file <record.json>
148
+ flow-agents builder-run release-assignment --session-dir <dir> --reason <text>
149
+ flow-agents builder-run archive --session-dir <dir> --authorization-file <record.json>
150
+ ```
151
+
152
+ Pause and resume verify the live assignment actor under the assignment lock, and preserve the
153
+ current Flow step and assignment. Assignment release does not
154
+ change the Flow run. Cancellation changes Flow first and then idempotently releases the owning
155
+ assignment while holding the same lock; a successfully consumed cancellation nonce cannot be
156
+ replayed. Archive accepts only completed or canceled runs, moves the session under
157
+ `.kontourai/flow-agents/archive/<slug>/`, and retains the canonical Flow run. None of these
158
+ operations deletes a branch or worktree; cleanup requires a separate provider-aware action.