@kontourai/flow-agents 3.6.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.
- package/CHANGELOG.md +7 -0
- package/build/src/builder-flow-run-adapter.d.ts +22 -2
- package/build/src/builder-flow-run-adapter.js +93 -28
- package/build/src/builder-flow-runtime.d.ts +8 -3
- package/build/src/builder-flow-runtime.js +308 -47
- package/build/src/cli/assignment-provider.d.ts +4 -7
- package/build/src/cli/assignment-provider.js +67 -13
- package/build/src/cli/builder-run.js +14 -18
- package/build/src/cli/workflow-sidecar.d.ts +28 -4
- package/build/src/cli/workflow-sidecar.js +801 -97
- package/build/src/cli/workflow.js +290 -42
- package/build/src/flow-kit/validate.d.ts +17 -0
- package/build/src/flow-kit/validate.js +340 -2
- package/build/src/index.js +5 -5
- package/build/src/lib/observed-command.d.ts +7 -0
- package/build/src/lib/observed-command.js +100 -0
- package/build/src/tools/generate-context-map.js +5 -3
- package/context/scripts/hooks/lib/kit-catalog.js +1 -1
- package/context/scripts/hooks/stop-goal-fit.js +78 -9
- package/docs/context-map.md +22 -20
- package/docs/developer-architecture.md +1 -1
- package/docs/public-workflow-cli.md +76 -7
- package/docs/skills-map.md +51 -27
- package/docs/spec/builder-flow-runtime.md +41 -40
- package/docs/workflow-usage-guide.md +109 -42
- package/evals/fixtures/hook-influence/cases.json +2 -2
- package/evals/integration/test_builder_entry_enforcement.sh +52 -41
- package/evals/integration/test_builder_step_producers.sh +297 -6
- package/evals/integration/test_bundle_install.sh +212 -63
- package/evals/integration/test_critique_supersession_roundtrip.sh +21 -8
- package/evals/integration/test_current_json_per_actor.sh +12 -0
- package/evals/integration/test_dual_emit_flow_step.sh +62 -43
- package/evals/integration/test_flowdef_session_activation.sh +145 -25
- package/evals/integration/test_flowdef_session_history_preservation.sh +23 -21
- package/evals/integration/test_gate_lockdown.sh +3 -5
- package/evals/integration/test_goal_fit_hook.sh +60 -2
- package/evals/integration/test_liveness_verdict.sh +14 -17
- package/evals/integration/test_phase_map_and_gate_claim.sh +63 -38
- package/evals/integration/test_public_workflow_cli.sh +325 -11
- package/evals/integration/test_pull_work_liveness_preflight.sh +22 -66
- package/evals/integration/test_sidecar_field_preservation.sh +36 -11
- package/evals/integration/test_workflow_sidecar_writer.sh +277 -44
- package/evals/integration/test_workflow_steering_hook.sh +15 -38
- package/evals/run.sh +2 -0
- package/evals/static/test_builder_skill_coherence.sh +247 -0
- package/evals/static/test_library_exports.sh +5 -2
- package/evals/static/test_workflow_skills.sh +13 -325
- package/kits/builder/flows/build.flow.json +22 -0
- package/kits/builder/flows/shape.flow.json +9 -9
- package/kits/builder/kit.json +70 -16
- package/kits/builder/skills/builder-shape/SKILL.md +75 -75
- package/kits/builder/skills/continue-work/SKILL.md +45 -106
- package/kits/builder/skills/deliver/SKILL.md +96 -442
- package/kits/builder/skills/design-probe/SKILL.md +40 -139
- package/kits/builder/skills/evidence-gate/SKILL.md +59 -201
- package/kits/builder/skills/execute-plan/SKILL.md +54 -125
- package/kits/builder/skills/fix-bug/SKILL.md +42 -132
- package/kits/builder/skills/gate-review/SKILL.md +60 -211
- package/kits/builder/skills/idea-to-backlog/SKILL.md +63 -244
- package/kits/builder/skills/learning-review/SKILL.md +63 -170
- package/kits/builder/skills/pickup-probe/SKILL.md +54 -111
- package/kits/builder/skills/plan-work/SKILL.md +51 -185
- package/kits/builder/skills/pull-work/SKILL.md +136 -485
- package/kits/builder/skills/release-readiness/SKILL.md +66 -107
- package/kits/builder/skills/review-work/SKILL.md +89 -176
- package/kits/builder/skills/tdd-workflow/SKILL.md +53 -147
- package/kits/builder/skills/verify-work/SKILL.md +101 -113
- package/package.json +2 -2
- package/scripts/hooks/lib/kit-catalog.js +1 -1
- package/scripts/hooks/stop-goal-fit.js +78 -9
- package/src/builder-flow-run-adapter.ts +118 -32
- package/src/builder-flow-runtime.ts +331 -61
- package/src/cli/assignment-provider-lock.test.mjs +83 -0
- package/src/cli/assignment-provider.ts +62 -13
- package/src/cli/builder-flow-run-adapter.test.mjs +4 -2
- package/src/cli/builder-flow-runtime.test.mjs +194 -8
- package/src/cli/builder-run.ts +3 -9
- package/src/cli/kit-metadata-security.test.mjs +232 -6
- package/src/cli/public-api.test.mjs +15 -0
- package/src/cli/workflow-sidecar-execution-proof.test.mjs +90 -0
- package/src/cli/workflow-sidecar.ts +724 -97
- package/src/cli/workflow.ts +277 -40
- package/src/flow-kit/validate.ts +320 -2
- package/src/index.ts +6 -5
- package/src/lib/observed-command.ts +96 -0
- package/src/tools/generate-context-map.ts +5 -3
|
@@ -1,465 +1,119 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: "deliver"
|
|
3
|
-
description: "
|
|
3
|
+
description: "Builder Kit build entrypoint. Starts or continues a selected Work Item through builder.build by composing the build primitives without owning their step evidence."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Deliver
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
## Role and Boundary
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
**Role:** Builder Kit entrypoint for standard `builder.build` delivery.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Select this entrypoint when the user asks to build or deliver a selected Work
|
|
13
|
+
Item without requesting test-first development. For test-first delivery, select
|
|
14
|
+
the `tdd-workflow` `builder.build` profile instead.
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
|---|---|
|
|
16
|
-
| tool-planner | plan-work |
|
|
17
|
-
| tool-worker (x4) | execute-plan |
|
|
18
|
-
| tool-code-reviewer | review-work |
|
|
19
|
-
| tool-security-reviewer | review-work (conditional — security-sensitive changes) |
|
|
20
|
-
| tool-verifier | verify-work |
|
|
21
|
-
| tool-playwright | verify-work |
|
|
16
|
+
`deliver` coordinates the standard build primitives:
|
|
22
17
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
`.datum/config.json` via `npx @kontourai/datum resolve <role> --json`
|
|
27
|
-
(see `context/contracts/execution-contract.md` § Delegation: Model Routing —
|
|
28
|
-
that contract is the consumption instruction, `.datum/config.json` is the
|
|
29
|
-
source of truth for the mapping):
|
|
30
|
-
|
|
31
|
-
| Delegate | Role |
|
|
32
|
-
|---|---|
|
|
33
|
-
| tool-worker | `delegate-mechanical` for fully-specified mechanical tasks, `delegate-implementation` for precisely-planned implementation, `delegate-design` when the task needs design latitude |
|
|
34
|
-
| tool-planner | `delegate-design` |
|
|
35
|
-
| tool-code-reviewer / tool-security-reviewer | `delegate-implementation` by default, raised to the worker's tier when higher — never below the tier of the checked work (Goodhart guard) |
|
|
36
|
-
| tool-verifier / tool-playwright | `delegate-implementation` by default, raised to the worker's tier when higher — never below the tier of the checked work (Goodhart guard) |
|
|
37
|
-
|
|
38
|
-
On a review/verify gate failure, re-dispatch the fix one tier higher on the
|
|
39
|
-
ladder and record the escalation in the session artifact via
|
|
40
|
-
`record-agent-event --kind escalation --role <higher> --escalated-from <lower>`
|
|
41
|
-
(see `context/contracts/execution-contract.md` § Escalation on gate failure and
|
|
42
|
-
§ Routing decisions in the run artifact). If datum or the config is absent, fall
|
|
43
|
-
back to the runtime's inherited model and note the fallback in the session
|
|
44
|
-
artifact.
|
|
45
|
-
|
|
46
|
-
## Orchestrator Rule
|
|
47
|
-
|
|
48
|
-
You never use `read`, `glob`, `grep`, or `code` on source files. You only read/write the session file and artifact files in `.kontourai/flow-agents/<slug>/`.
|
|
49
|
-
|
|
50
|
-
## Shared Contracts
|
|
51
|
-
|
|
52
|
-
Follow:
|
|
53
|
-
- `context/contracts/standing-directives.md`
|
|
54
|
-
- `context/contracts/artifact-contract.md`
|
|
55
|
-
- `context/contracts/planning-contract.md`
|
|
56
|
-
- `context/contracts/execution-contract.md`
|
|
57
|
-
- `context/contracts/review-contract.md`
|
|
58
|
-
- `context/contracts/verification-contract.md`
|
|
59
|
-
- `context/contracts/delivery-contract.md`
|
|
60
|
-
|
|
61
|
-
This skill owns orchestration across the full loop. The contracts own artifact shape, Definition Of Done, execution handoff, verification verdicts, Goal Fit, and Final Acceptance.
|
|
62
|
-
|
|
63
|
-
When you report progress or final evidence, use exact delegate ids such as `tool-planner`, `tool-worker`, `tool-verifier`, and `tool-playwright`. Do not collapse them to generic labels when the gate is part of acceptance evidence.
|
|
64
|
-
|
|
65
|
-
## Sidecar Writer Adoption
|
|
66
|
-
|
|
67
|
-
When the repository provides `npm run workflow:sidecar --`, use it for routine workflow state instead of hand-writing JSON:
|
|
68
|
-
|
|
69
|
-
- `ensure-session` before planning starts
|
|
70
|
-
- `current --format path` when resuming or handing work to delegates
|
|
71
|
-
- `record-agent-event` for delegated progress, handoffs, blockers, and evidence pointers
|
|
72
|
-
- `advance-state` at each phase transition
|
|
73
|
-
- `record-evidence` after verification
|
|
74
|
-
- `record-critique` or `import-critique` after review
|
|
75
|
-
- `record-release` for release-readiness decisions
|
|
76
|
-
- `record-learning` for learning-review outcomes
|
|
77
|
-
- `dogfood-pass` for Flow Agents repo changes that should record evidence, critique, optional learning, state, and handoff in one validated pass
|
|
78
|
-
|
|
79
|
-
After writer updates, run `npm run workflow:validate-artifacts -- --require-sidecars .kontourai/flow-agents/<slug>` when local validation is available. If the writer or validation is unavailable or blocked by sandbox policy, record the exact gap in the session artifact as `NOT_VERIFIED` instead of pretending structured state exists.
|
|
80
|
-
|
|
81
|
-
`ensure-session` maintains `.kontourai/flow-agents/current.json`. The orchestrator is responsible for keeping root `state.json` and `handoff.json` current, but performs every such update **exclusively** through the sidecar writer (`npm run workflow:sidecar -- advance-state` for state transitions, `init-plan` for the initial plan write) — never through a direct Write/Edit tool call against the sidecar path. `config-protection.js` blocks direct tool-mediated writes to `state.json` by design; that block is expected and correct, not a bug to route around. Delegated agents must be given the workflow artifact root and should append events under `agents/<agent-id>/events.jsonl` through `record-agent-event` instead of guessing the slug or rewriting root state.
|
|
82
|
-
|
|
83
|
-
## Input
|
|
84
|
-
|
|
85
|
-
- **Goal**: what to build (from conversation context or explicit instruction)
|
|
86
|
-
- **Directory**: working directory
|
|
87
|
-
- **Selected work evidence**: existing `pull-work` and `pickup-probe` artifacts when the user is continuing provider-backed or productized backlog work
|
|
88
|
-
|
|
89
|
-
## TDD Mode
|
|
90
|
-
|
|
91
|
-
If the user requests test-driven development, activate the `tdd-workflow` skill instead. It wraps the same plan → execute → verify chain with test-first constraints and git checkpoints. deliver is for standard (implementation-first) workflows.
|
|
92
|
-
|
|
93
|
-
## Required Preflight
|
|
94
|
-
|
|
95
|
-
Before planning implementation, determine whether the request is direct ad hoc delivery or pickup of provider-backed/productized backlog work.
|
|
96
|
-
|
|
97
|
-
- If the user asks to pick up work, continue backlog work, build the next item, or deliver a selected issue, run or consume `pull-work` first. `pull-work` must enforce board selection, WIP/shepherding, dependency, grouping, and worktree logic.
|
|
98
|
-
- After `pull-work`, run or consume `pickup-probe` before `plan-work`. The pickup Probe must record selected item ids, scope, acceptance quality, provider state, WIP/conflict scan, dependency freshness, expected modified files, sandbox/worktree mode, decisions, unresolved questions, accepted gaps, and planning readiness.
|
|
99
|
-
- If current artifacts already prove `pull-work` and `pickup-probe` are fresh for the selected item or justified group, consume those artifacts and continue to `plan-work`.
|
|
100
|
-
- If the preflight is missing, stale, contradictory, or for a different selected item, stop before planning and route through `pull-work -> pickup-probe`; for pickup/planning gaps, route `decision_gap` back to `design-probe`.
|
|
101
|
-
- If the user gives a raw product idea instead of ready backlog work, suggest Builder Kit shape (`design-probe` + `idea-to-backlog`) rather than forcing delivery.
|
|
102
|
-
|
|
103
|
-
Direct ad hoc implementation requests that are not provider-backed backlog pickup may still start at `plan-work`, but `deliver` must record why pull/pickup preflight was not applicable.
|
|
104
|
-
|
|
105
|
-
## Session File
|
|
106
|
-
|
|
107
|
-
Path: `.kontourai/flow-agents/<slug>/<slug>--deliver.md`
|
|
108
|
-
|
|
109
|
-
```markdown
|
|
110
|
-
# <Goal one-liner>
|
|
111
|
-
|
|
112
|
-
branch: <branch>
|
|
113
|
-
worktree: <worktree>
|
|
114
|
-
created: <date>
|
|
115
|
-
status: planning | executing | reviewing | verifying | delivered
|
|
116
|
-
type: deliver
|
|
117
|
-
iteration: 0
|
|
118
|
-
|
|
119
|
-
## Workflow Rules (re-read at each phase transition)
|
|
120
|
-
|
|
121
|
-
- Reviewers and verifiers are REPORT ONLY — they never fix code
|
|
122
|
-
- Any code change requires re-review + re-verify before delivery
|
|
123
|
-
- Loop exits only when review + verify are both clean in same iteration
|
|
124
|
-
- Loop exits only after the Goal Fit Gate is fully checked or explicitly accepted
|
|
125
|
-
- CRITICAL/HIGH → re-plan → execute → review → verify
|
|
126
|
-
- MEDIUM/FAIL → execute fix pass → review → verify
|
|
127
|
-
- Temporary planning and execution artifacts live in `.kontourai/flow-agents/<slug>/`; durable feature documentation is promoted after CI/merge
|
|
128
|
-
- Local runtime work stays under `.kontourai/flow-agents/` and remains untracked; durable outcomes must be promoted before merge to `main`
|
|
129
|
-
|
|
130
|
-
## Plan
|
|
131
|
-
|
|
132
|
-
(populated by plan-work)
|
|
133
|
-
|
|
134
|
-
## Definition Of Done
|
|
135
|
-
|
|
136
|
-
(copied from plan-work; this is the user-facing stop condition)
|
|
137
|
-
|
|
138
|
-
## Execution Progress
|
|
139
|
-
|
|
140
|
-
(populated by execute-plan)
|
|
141
|
-
|
|
142
|
-
## Verification Report
|
|
143
|
-
|
|
144
|
-
(populated by verify-work)
|
|
145
|
-
|
|
146
|
-
## Goal Fit Gate
|
|
147
|
-
|
|
148
|
-
Use the Goal Fit Gate from `context/contracts/delivery-contract.md`.
|
|
149
|
-
|
|
150
|
-
## Final Acceptance
|
|
151
|
-
|
|
152
|
-
Use the Final Acceptance checklist from `context/contracts/delivery-contract.md`.
|
|
153
|
-
|
|
154
|
-
## History
|
|
155
|
-
|
|
156
|
-
- iteration 1: partial — auth routes done, form validation missing
|
|
157
|
-
- iteration 2: pass — all acceptance criteria met
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
`<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.
|
|
161
|
-
|
|
162
|
-
The `status:` values in this Markdown session file are human-readable delivery progress labels. They are not the machine-readable `state.phase` enum; structured workflow sidecars must use the canonical lifecycle values from `context/contracts/artifact-contract.md`. In particular, review-work records critique through the critique artifact/sink while the sidecar lifecycle remains in a canonical phase such as `execution`, not a `review` phase.
|
|
163
|
-
|
|
164
|
-
## Workflow
|
|
165
|
-
|
|
166
|
-
### 1. Create session file
|
|
167
|
-
|
|
168
|
-
Create the session file with `status: planning`, `iteration: 0`. Use the sidecar writer when available:
|
|
169
|
-
|
|
170
|
-
```bash
|
|
171
|
-
npm run workflow:sidecar -- ensure-session \
|
|
172
|
-
--source-request "<original request>" \
|
|
173
|
-
--summary "<current delivery goal>" \
|
|
174
|
-
--criterion "<acceptance criterion>" \
|
|
175
|
-
--flow-id builder.build
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
`--flow-id builder.build` activates the FlowDefinition-driven path for this session. Producers fire, gates enforce on builder.* claims, and `advance-state` sets `active_step_id` automatically via the `builder.build` phase_map. Keep this flag on all `deliver`-initiated sessions; do not remove it for direct ad-hoc requests that are not builder-flow pickup.
|
|
179
|
-
|
|
180
|
-
### 2. Plan (plan-work)
|
|
181
|
-
|
|
182
|
-
Invoke plan-work with the goal, directory, session file path, and any pull-work / pickup-probe artifact refs. The plan must include `## Definition Of Done`. Present the plan to the user when a user decision is actually needed; otherwise record the plan artifact and continue automatically to execution.
|
|
183
|
-
|
|
184
|
-
This is a delegation gate. `plan-work` must delegate to `tool-planner` when that delegate is available, even if the environment is read-only or the repo cannot yet be modified. If the gate is blocked, preserve the attempted delegation/blocker in the session artifact and treat the delivery as `NOT_VERIFIED` or incomplete rather than substituting a local plan.
|
|
185
|
-
|
|
186
|
-
### 3. Execute (execute-plan)
|
|
187
|
-
|
|
188
|
-
Re-read the session file `## Workflow Rules` section before proceeding. Then invoke execute-plan with the plan artifact path and session file path.
|
|
189
|
-
|
|
190
|
-
### 4. Review (REPORT ONLY — review-work)
|
|
191
|
-
|
|
192
|
-
Invoke `review-work` with the session file path. Reviewers produce findings through the critique artifact/sink, currently `critique.json` locally. **They NEVER fix code.** No writes, no patches, no "found and fixed."
|
|
193
|
-
|
|
194
|
-
This is a delegation gate. `review-work` must delegate to `tool-code-reviewer` when that delegate is available. If security-sensitive files or behaviors are in scope, it must also delegate to `tool-security-reviewer`. Architecture and standards concerns are part of the code review scope unless the project configures a more specific reviewer.
|
|
195
|
-
|
|
196
|
-
### 5. Verify (REPORT ONLY — verify-work)
|
|
197
|
-
|
|
198
|
-
Invoke verify-work with the session file path. Verifiers run checks and report status, including acceptance criteria and Goal Fit. **They NEVER fix code.** No format fixes, no lint auto-fixes, no patches.
|
|
199
|
-
|
|
200
|
-
This is a delegation gate. `verify-work` must delegate to `tool-verifier` when that delegate is available. If UI or browser-facing behavior is in scope, delegate that evidence collection to `tool-playwright` as well. If the gate is blocked, report the exact `NOT_VERIFIED` evidence gap; do not replace verification with an orchestrator-only summary.
|
|
201
|
-
|
|
202
|
-
### 6. Route on findings
|
|
203
|
-
|
|
204
|
-
Combine the critique artifact/sink verdict + verification verdict:
|
|
205
|
-
|
|
206
|
-
- **Clean** (no issues, all PASS) → deliver
|
|
207
|
-
- **Goal Fit Gate incomplete** → fix pass or final acceptance decision
|
|
208
|
-
- **CRITICAL or HIGH review findings** → re-plan (step 7a)
|
|
209
|
-
- **MEDIUM review findings needing code changes** → fix pass (step 7b)
|
|
210
|
-
- **Any verification FAIL** → fix pass (step 7b)
|
|
211
|
-
- **Any NOT_VERIFIED** → surface to user, they decide
|
|
212
|
-
|
|
213
|
-
When the route is deterministic, continue without asking the user between stages. Use the local stop/steering hooks when available to resume automatically after phase transitions. Ask the user only for explicit approval, missing authority, unsafe escalation, accepted gaps, unresolved `NOT_VERIFIED`, provider decisions, or scope changes.
|
|
214
|
-
|
|
215
|
-
### 7. Loop (mandatory re-verify)
|
|
216
|
-
|
|
217
|
-
**Any code change requires a subsequent clean review + verify pass. No exceptions.**
|
|
218
|
-
|
|
219
|
-
#### 7a. Re-plan (CRITICAL/HIGH issues)
|
|
220
|
-
|
|
221
|
-
1. Increment `iteration` in session file
|
|
222
|
-
2. Re-invoke plan-work with: original goal + failure summary → updated plan
|
|
223
|
-
3. Back to step 3 (Execute) → then step 4 (Review) → step 5 (Verify)
|
|
224
|
-
|
|
225
|
-
#### 7b. Fix pass (MEDIUM issues / verification failures)
|
|
226
|
-
|
|
227
|
-
1. Increment `iteration` in session file
|
|
228
|
-
2. Back to step 3 (Execute) with the specific findings to fix
|
|
229
|
-
3. Then step 4 (Review) → step 5 (Verify)
|
|
230
|
-
|
|
231
|
-
**The loop exits ONLY when review + verify both produce zero findings, all PASS in the same iteration, and Goal Fit Gate is complete.** Not when fixes are applied — when fixes are *verified clean and useful to the user*.
|
|
232
|
-
|
|
233
|
-
### 8. Goal Fit Gate
|
|
18
|
+
`pull-work` -> `design-probe` -> `plan-work` -> `execute-plan` ->
|
|
19
|
+
`review-work` -> `verify-work`, followed by the applicable publish and learning
|
|
20
|
+
activities.
|
|
234
21
|
|
|
235
|
-
|
|
22
|
+
It does not reproduce those primitives' detailed procedure, write source code,
|
|
23
|
+
or own **any step-gate evidence**. Each primitive produces and records the
|
|
24
|
+
evidence for its own step. `deliver` consumes their results only to select the
|
|
25
|
+
next primitive or surface a blocker.
|
|
236
26
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
### 9. Publish Verified Change
|
|
240
|
-
|
|
241
|
-
After review, verification, evidence, and Goal Fit are clean for the same diff:
|
|
242
|
-
|
|
243
|
-
1. Confirm the working tree contains only verified scope.
|
|
244
|
-
2. Publish the session trust bundle so the CI trust-reconcile job can verify what the agent claimed. `record-release` (via the sidecar writer) does this automatically (best-effort). To publish or re-publish explicitly:
|
|
245
|
-
|
|
246
|
-
```bash
|
|
247
|
-
npm run workflow:sidecar -- publish-delivery .kontourai/flow-agents/<slug>
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
**#356 — local reconcile-shape preflight.** `publish-delivery`/`record-release` now run a
|
|
251
|
-
local, pre-push **reconcile-shape preflight** on the session's `trust.bundle` before
|
|
252
|
-
copying anything into `delivery/`. It reuses the exact same claim-shape classification
|
|
253
|
-
`scripts/ci/trust-reconcile.js` enforces in CI (`scripts/lib/reconcile-shape.js`), so it
|
|
254
|
-
can never silently drift from what the required Trust Reconcile check actually does. If
|
|
255
|
-
the bundle is ADR-0020-invalid (e.g. a command-backed claim whose command isn't in the
|
|
256
|
-
reconcile manifest, an unwaived `assumed` claim, or an un-superseded disputed critique),
|
|
257
|
-
publish is **refused, fail-closed** — non-zero exit, a loud `REFUSING to publish` message
|
|
258
|
-
naming each invalid claim and its fix, and nothing is written to `delivery/`. This is
|
|
259
|
-
distinct from the existing fail-**soft** behavior when no `trust.bundle` exists yet at all
|
|
260
|
-
(still a silent no-op). When refused: fix the named claim (re-record evidence, add a
|
|
261
|
-
missing waiver, or supersede the disputed critique), then retry — do not attempt to push
|
|
262
|
-
past the refusal. You can also run the same check manually, any time before publish, to
|
|
263
|
-
catch a shape issue locally instead of discovering it minutes later in CI:
|
|
264
|
-
|
|
265
|
-
```bash
|
|
266
|
-
npm run workflow:sidecar -- reconcile-preflight .kontourai/flow-agents/<slug>
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
**#381 — manifest-lane constraint: which commands may be `kind:"command"` checks.** A check/claim
|
|
270
|
-
is only CI-reconcilable as `kind:"command"` (Surface's `test_output` evidence type) if its
|
|
271
|
-
command is a registered entry in the **trust-reconcile manifest** — the same
|
|
272
|
-
`{"id":..,"command":..,"lanes":[..]}` list `evals/ci/run-baseline.sh --manifest-json` emits
|
|
273
|
-
from its `CHECKS` array (source of truth: `evals/ci/run-baseline.sh` lines 12-67 for the
|
|
274
|
-
array, 166-182 for `emit_manifest_json`). `scripts/ci/trust-reconcile.js` resolves this same
|
|
275
|
-
manifest (`resolveManifest`/`manifestByCmd`, lines 292-370, 1101-1104) and reconciles a
|
|
276
|
-
`kind:"command"` claim's `execution.label` ONLY against it — a command not in the manifest
|
|
277
|
-
can never reconcile, and CI's reconciler names it exactly this way: `trust divergence: agent
|
|
278
|
-
claimed '<cmd>' passed; command is not in the reconcile manifest — a test_output claim must
|
|
279
|
-
name a manifest/required-lane command (CI cannot self-declare an arbitrary command)`. An
|
|
280
|
-
honest capture-backed check recorded against a real, passing, non-manifest command still
|
|
281
|
-
becomes this `not-run` divergence at CI reconcile time — it is not a shape bug to route
|
|
282
|
-
around, it is the manifest boundary working as designed. Anything that is not a registered
|
|
283
|
-
manifest command records as `kind:"external"` (a session-local attestation — e.g. a manual
|
|
284
|
-
code-review judgment) or `kind:"policy"` (a policy/compliance attestation — e.g. `promote`'s
|
|
285
|
-
claim, which carries no `command`/`execution.label` and therefore can never require a
|
|
286
|
-
manifest entry). This matters at every writer call that can produce a `kind:"command"`
|
|
287
|
-
check — `record-evidence`, `record-gate-claim --command`, and `record-check` — and again at
|
|
288
|
-
the `publish-delivery`/`reconcile-preflight` step above, which is where a non-manifest
|
|
289
|
-
command surfaces as a refusal before CI ever sees it. Gate claims recorded earlier in a
|
|
290
|
-
session are not special-cased here: the compose-safe writer path keeps every prior gate
|
|
291
|
-
claim's declared claim type intact across later `record-evidence`/`record-critique`/
|
|
292
|
-
`record-learning` calls, so a gate claim never needs to be the last write of a session to
|
|
293
|
-
survive.
|
|
294
|
-
|
|
295
|
-
- `kind:"command"` (manifest-backed) example — a real, currently-registered manifest entry
|
|
296
|
-
("Source tree validation" → `npm run validate:source --`):
|
|
297
|
-
|
|
298
|
-
```bash
|
|
299
|
-
npm run workflow:sidecar -- record-check .kontourai/flow-agents/<slug> -- npm run validate:source --
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
- `kind:"external"` (non-manifest attestation) example — no `--command`, so nothing is
|
|
303
|
-
ever executed; the prose lives in `--summary`:
|
|
304
|
-
|
|
305
|
-
```bash
|
|
306
|
-
npm run workflow:sidecar -- record-gate-claim .kontourai/flow-agents/<slug> \
|
|
307
|
-
--status pass \
|
|
308
|
-
--summary "Manual code review confirmed no regressions in the affected module."
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
**#379 — per-session delivery paths.** `publishDelivery()` writes to a PER-SESSION path
|
|
312
|
-
`delivery/<slug>/trust.bundle` (+ `trust.checkpoint.json` companions), where `<slug>` is
|
|
313
|
-
your session artifact dir's basename — NOT the old shared flat `delivery/trust.bundle`.
|
|
314
|
-
This is deliberate: a shared path guaranteed a git merge conflict between ANY two
|
|
315
|
-
concurrent deliveries, and a conflicting PR gets no CI (see the loud callout below). The
|
|
316
|
-
CI reconciler discovers both the flat (back-compat) and per-session layouts and selects
|
|
317
|
-
the NEWEST candidate whose checkpoint attests THIS change by commit ancestry — so an older
|
|
318
|
-
inherited bundle that also happens to be an ancestor of your change is ignored in favour of
|
|
319
|
-
your fresh one, and stale siblings from other sessions are ignored. `publishDelivery()`
|
|
320
|
-
also prunes inherited per-session sibling seal dirs (unique-named, never a cross-PR
|
|
321
|
-
conflict) so `delivery/` stays small; it deliberately does NOT delete the shared flat
|
|
322
|
-
`delivery/trust.bundle` legacy path (a concurrent PR may still seal there, and deleting it
|
|
323
|
-
would cause the DIRTY→no-CI conflict in the callout below).
|
|
324
|
-
|
|
325
|
-
Then force-stage the per-session trust dir for the delivery commit. It is gitignored by
|
|
326
|
-
default (runtime artifacts written on every local delivery) — `-f` commits it
|
|
327
|
-
deliberately into THIS delivery PR so CI's trust-reconcile job can reconcile the
|
|
328
|
-
session's claims against fresh CI results:
|
|
329
|
-
|
|
330
|
-
```bash
|
|
331
|
-
git add -f delivery/<slug>/
|
|
332
|
-
```
|
|
333
|
-
|
|
334
|
-
(If `publishDelivery()` pruned a superseded per-session SIBLING dir, stage that deletion
|
|
335
|
-
too — `git add -A delivery/` after the force-add. Do NOT hand-delete the flat
|
|
336
|
-
`delivery/trust.bundle` in a delivery PR while other PRs may still seal to it.)
|
|
337
|
-
|
|
338
|
-
**#293 — verify-hold gate. HARD STOP.** Before committing/pushing/opening a PR/merging,
|
|
339
|
-
run the verify-hold check (it also runs automatically inside `publish-delivery` /
|
|
340
|
-
`record-release` / `advance-state --status delivered`, but run it explicitly here BEFORE
|
|
341
|
-
committing/pushing, since by the time `record-release` runs the branch may already be
|
|
342
|
-
pushed). **The command differs by this repo's configured assignment provider kind — a bare
|
|
343
|
-
`verify-hold <slug>` with no provider flag always defaults to `--assignment-provider
|
|
344
|
-
local-file` (`runVerifyHold`'s documented default), so on a `github`-provider repo it reads
|
|
345
|
-
no local claim record and silently resolves `free`/PASS regardless of the real GitHub hold
|
|
346
|
-
state. The local-file-only invocation below is NOT sufficient for a `github`-provider repo —
|
|
347
|
-
the github branch is MANDATORY for that provider kind:**
|
|
27
|
+
## Model Routing
|
|
348
28
|
|
|
349
|
-
|
|
350
|
-
|
|
29
|
+
Use `delegate-mechanical` for selection bookkeeping, `delegate-design` for
|
|
30
|
+
probing and planning, and `delegate-implementation` for execution, review, and
|
|
31
|
+
verification. Resolve each role from `.datum/config.json` under
|
|
32
|
+
`context/contracts/execution-contract.md`; this entrypoint does not pin models
|
|
33
|
+
or reasoning effort itself.
|
|
351
34
|
|
|
352
|
-
|
|
353
|
-
npm run workflow:sidecar -- verify-hold .kontourai/flow-agents/<slug>
|
|
354
|
-
```
|
|
35
|
+
## Inputs and Provider Adapters
|
|
355
36
|
|
|
356
|
-
|
|
357
|
-
pattern for the same ADR 0021 §1 join — first read the effective state (no live `gh` call
|
|
358
|
-
happens inside `workflow-sidecar.ts`; the skill renders it here), then pass the rendered
|
|
359
|
-
`.effective` JSON into `verify-hold` via `--effective-state-json`:
|
|
37
|
+
Use the following provider-neutral inputs:
|
|
360
38
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
--liveness-stream <path-to-events.jsonl> \
|
|
368
|
-
--self-actor <actor> \
|
|
369
|
-
> /tmp/assignment-status.json
|
|
370
|
-
npm run workflow:sidecar -- verify-hold .kontourai/flow-agents/<slug> \
|
|
371
|
-
--assignment-provider github \
|
|
372
|
-
--effective-state-json /tmp/assignment-status.json
|
|
373
|
-
```
|
|
39
|
+
- **Work Item adapter:** selected work, scope, acceptance context, and identity.
|
|
40
|
+
- **Board adapter:** availability, priority, WIP, dependencies, and selection
|
|
41
|
+
state when work comes from a queue.
|
|
42
|
+
- **Repository adapter:** checkout, branch/worktree policy, and local checks.
|
|
43
|
+
- **Change adapter:** proposed change and, when applicable, review, CI, merge,
|
|
44
|
+
and release state.
|
|
374
45
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
46
|
+
A provider may implement any adapter. A Work Item reference is a stable,
|
|
47
|
+
human-readable provider reference that the configured Work Item adapter can
|
|
48
|
+
resolve; GitHub issues are one example, not the contract. For a direct local
|
|
49
|
+
request, use an already-bound local session. Do not invent a provider record or
|
|
50
|
+
claim a fresh binding when the configured adapter cannot resolve the selected
|
|
51
|
+
reference.
|
|
378
52
|
|
|
379
|
-
|
|
380
|
-
asks exactly one question: is this actor still the fresh, non-superseded holder of this
|
|
381
|
-
subject (or is the subject free/self-held)? **If the check reports not-fresh-holder (exit
|
|
382
|
-
non-zero, `ok:false` in the JSON result): DO NOT commit, push, open a PR, or merge.** This
|
|
383
|
-
is a different failure mode from the `publish-delivery`/reconcile-shape preflight paragraph
|
|
384
|
-
above — that one is about the trust *bundle's shape* being invalid; this one is about
|
|
385
|
-
*actor hold* — another actor holds a fresh claim on this subject, your own claim has gone
|
|
386
|
-
stale, or the subject is assigned to a human. Do not conflate the two "REFUSING to publish"
|
|
387
|
-
messages. When refused, follow the reconcile guidance (the CLI's own `guidance` field, or
|
|
388
|
-
verbatim): re-run `pull-work`/`pickup-probe` to discover the current holder and hand off
|
|
389
|
-
cleanly (`learning-review`/handoff), or, if a human confirms this session should resume
|
|
390
|
-
ownership, run `ensure-session --supersede-stale` before retrying.
|
|
53
|
+
## Flow Selection and Run Behavior
|
|
391
54
|
|
|
392
|
-
|
|
393
|
-
|
|
55
|
+
Before starting a run, require a completed `pull-work` artifact showing readiness,
|
|
56
|
+
WIP and conflict assessment, assignment/liveness preflight, post-claim ownership
|
|
57
|
+
confirmation, and the selected Work Item binding. A Work Item reference alone is
|
|
58
|
+
not sufficient preflight.
|
|
394
59
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
> **schedules NO `pull_request` workflows for it** — zero checks, no error, nothing. The
|
|
398
|
-
> required **Trust Reconcile** gate then silently never runs, and the PR sits unbuildable
|
|
399
|
-
> looking like "CI vanished" rather than "conflict." Per-session delivery paths (#379)
|
|
400
|
-
> remove the STRUCTURAL cause for delivery-artifact conflicts (concurrent seals no longer
|
|
401
|
-
> share a file), but ANY other same-file conflict with `main` can still trigger it.
|
|
402
|
-
> **Diagnose it explicitly — do not assume a missing required check means "not run yet":**
|
|
403
|
-
>
|
|
404
|
-
> ```bash
|
|
405
|
-
> gh pr view <pr> --json mergeStateStatus,mergeable,statusCheckRollup
|
|
406
|
-
> ```
|
|
407
|
-
>
|
|
408
|
-
> `mergeStateStatus: DIRTY` (or `CONFLICTING`) with an ABSENT Trust Reconcile check is the
|
|
409
|
-
> signature. Fix by rebasing/merging `main` to clear the conflict and re-pushing — that
|
|
410
|
-
> re-triggers the `pull_request` workflows. A green-looking PR with the required gate simply
|
|
411
|
-
> MISSING is not "pending"; it is this failure mode until proven otherwise.
|
|
412
|
-
5. Open or update the provider change record with issue links, closing refs, evidence links, and verification summary, or record an explicit no-provider-change reason.
|
|
413
|
-
6. Wait for provider checks/CI or record missing checks as `NOT_VERIFIED`.
|
|
414
|
-
7. Record the gate claim for the Builder Kit `pr-open` step immediately after the PR is opened or updated:
|
|
60
|
+
After those conditions hold, start the selected Work Item with the public
|
|
61
|
+
workflow interface:
|
|
415
62
|
|
|
416
|
-
```
|
|
417
|
-
|
|
418
|
-
--
|
|
419
|
-
--status
|
|
420
|
-
--summary "PR opened: <pr-url>. Linked to <work-item-ref>, implementation summary and verification evidence attached." \
|
|
421
|
-
--evidence-ref-json '{"kind":"provider","url":"<pr-url>"}'
|
|
63
|
+
```sh
|
|
64
|
+
flow-agents workflow start --flow builder.build --work-item <provider-ref> \
|
|
65
|
+
--assignment-provider <configured-kind> \
|
|
66
|
+
[--effective-state-json <provider-status.json>]
|
|
422
67
|
```
|
|
423
68
|
|
|
424
|
-
Use
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
69
|
+
Use `flow-agents workflow status --session-dir <session-dir> --json` to inspect
|
|
70
|
+
an existing canonical run. For an interrupted active run, follow the returned
|
|
71
|
+
`next_action` and use its exact idempotent command. Use `flow-agents workflow
|
|
72
|
+
resume --session-dir <session-dir> --reason "Continue the bound Work Item"` only
|
|
73
|
+
for an existing paused run. Use no private workflow interface, internal writer,
|
|
74
|
+
or caller-selected run/step recovery command.
|
|
75
|
+
|
|
76
|
+
For provider-backed work, begin with `pull-work` and `design-probe`. For a
|
|
77
|
+
direct local Work Item, resume its already-bound session; if none exists, report
|
|
78
|
+
the missing adapter binding rather than bypassing Flow. If the request is only
|
|
79
|
+
a raw idea, offer `builder-shape`; do not start delivery until a Work Item is
|
|
80
|
+
selected.
|
|
81
|
+
|
|
82
|
+
## Orchestration Rules
|
|
83
|
+
|
|
84
|
+
- Delegate planning, implementation, review, and verification to their named
|
|
85
|
+
primitives. Keep model routing and worker parallelism in those primitives;
|
|
86
|
+
this entrypoint sets neither a worker count nor a coverage threshold.
|
|
87
|
+
- A failed review or verification result returns to the appropriate planning or
|
|
88
|
+
execution primitive. A `NOT_VERIFIED` result remains visible as a gap.
|
|
89
|
+
- At each transition, compare the Work Item goal, acceptance criteria, current
|
|
90
|
+
artifacts, and unresolved gaps. Route back to the earliest primitive that can
|
|
91
|
+
correct a failed condition; do not wait until final verification to expose a
|
|
92
|
+
known mismatch.
|
|
93
|
+
- Use the Repository and Change adapters to decide whether publishing,
|
|
94
|
+
release-readiness, or learning applies. Do not treat a remote change or merge
|
|
95
|
+
as implicit authorization.
|
|
96
|
+
- Preserve the exact commands and evidence emitted by primitives rather than
|
|
97
|
+
replacing them with orchestration prose.
|
|
98
|
+
|
|
99
|
+
## Output Responsibility
|
|
100
|
+
|
|
101
|
+
`deliver` produces no separate artifact and no gate evidence. The active
|
|
102
|
+
`builder.build` run and the artifacts produced by its primitives are the output
|
|
103
|
+
of delivery. Report the Work Item, current run status, completed primitive
|
|
104
|
+
outputs, remaining gaps, and any Change-adapter state to the user.
|
|
105
|
+
|
|
106
|
+
Before closeout, perform a Final Acceptance reconciliation across the selected
|
|
107
|
+
Work Item, actual changed scope, criterion verdicts, critique, and Flow status.
|
|
108
|
+
Do not describe delivery as complete while required behavior, evidence, or
|
|
109
|
+
follow-up remains unresolved. Route eligible outcomes into publish/readiness and
|
|
110
|
+
learning through their owning Builder skills.
|
|
111
|
+
|
|
112
|
+
## Standalone and No-Active-Run Behavior
|
|
113
|
+
|
|
114
|
+
If no active run exists, require a selected Work Item and start
|
|
115
|
+
`builder.build` only after the completed preflight above; do not create a partial
|
|
116
|
+
or preflight-bypassing run. If an active run exists,
|
|
117
|
+
inspect its public status and continue only from its canonical next action. If
|
|
118
|
+
selection, adapter access, or authorization is missing, stop and report the
|
|
119
|
+
specific blocker.
|