@kontourai/flow-agents 3.6.0 → 3.8.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 (96) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/build/src/builder-flow-run-adapter.d.ts +22 -2
  3. package/build/src/builder-flow-run-adapter.js +93 -28
  4. package/build/src/builder-flow-runtime.d.ts +8 -3
  5. package/build/src/builder-flow-runtime.js +407 -51
  6. package/build/src/cli/assignment-provider.d.ts +4 -7
  7. package/build/src/cli/assignment-provider.js +80 -14
  8. package/build/src/cli/builder-run.js +14 -18
  9. package/build/src/cli/workflow-sidecar.d.ts +28 -4
  10. package/build/src/cli/workflow-sidecar.js +825 -103
  11. package/build/src/cli/workflow.js +301 -43
  12. package/build/src/flow-kit/validate.d.ts +17 -0
  13. package/build/src/flow-kit/validate.js +340 -2
  14. package/build/src/index.js +5 -5
  15. package/build/src/lib/observed-command.d.ts +7 -0
  16. package/build/src/lib/observed-command.js +100 -0
  17. package/build/src/tools/build-universal-bundles.js +53 -3
  18. package/build/src/tools/generate-context-map.js +5 -3
  19. package/context/scripts/hooks/lib/kit-catalog.js +1 -1
  20. package/context/scripts/hooks/stop-goal-fit.js +78 -9
  21. package/docs/context-map.md +22 -20
  22. package/docs/developer-architecture.md +1 -1
  23. package/docs/getting-started.md +9 -1
  24. package/docs/public-workflow-cli.md +76 -7
  25. package/docs/skills-map.md +51 -27
  26. package/docs/spec/builder-flow-runtime.md +75 -40
  27. package/docs/workflow-usage-guide.md +109 -42
  28. package/evals/fixtures/hook-influence/cases.json +2 -2
  29. package/evals/integration/test_builder_entry_enforcement.sh +52 -41
  30. package/evals/integration/test_builder_step_producers.sh +330 -6
  31. package/evals/integration/test_bundle_install.sh +318 -65
  32. package/evals/integration/test_bundle_lifecycle.sh +4 -6
  33. package/evals/integration/test_critique_supersession_roundtrip.sh +21 -8
  34. package/evals/integration/test_current_json_per_actor.sh +12 -0
  35. package/evals/integration/test_dual_emit_flow_step.sh +62 -43
  36. package/evals/integration/test_flowdef_session_activation.sh +145 -25
  37. package/evals/integration/test_flowdef_session_history_preservation.sh +23 -21
  38. package/evals/integration/test_gate_lockdown.sh +3 -5
  39. package/evals/integration/test_goal_fit_hook.sh +60 -2
  40. package/evals/integration/test_install_merge.sh +18 -8
  41. package/evals/integration/test_liveness_verdict.sh +14 -17
  42. package/evals/integration/test_phase_map_and_gate_claim.sh +63 -38
  43. package/evals/integration/test_public_workflow_cli.sh +334 -14
  44. package/evals/integration/test_pull_work_liveness_preflight.sh +22 -66
  45. package/evals/integration/test_sidecar_field_preservation.sh +36 -11
  46. package/evals/integration/test_workflow_sidecar_writer.sh +277 -44
  47. package/evals/integration/test_workflow_steering_hook.sh +15 -38
  48. package/evals/run.sh +2 -0
  49. package/evals/static/test_builder_skill_coherence.sh +247 -0
  50. package/evals/static/test_library_exports.sh +5 -2
  51. package/evals/static/test_universal_bundles.sh +44 -1
  52. package/evals/static/test_workflow_skills.sh +13 -325
  53. package/kits/builder/flows/build.flow.json +22 -0
  54. package/kits/builder/flows/shape.flow.json +9 -9
  55. package/kits/builder/kit.json +70 -16
  56. package/kits/builder/skills/builder-shape/SKILL.md +75 -75
  57. package/kits/builder/skills/continue-work/SKILL.md +45 -106
  58. package/kits/builder/skills/deliver/SKILL.md +96 -442
  59. package/kits/builder/skills/design-probe/SKILL.md +40 -139
  60. package/kits/builder/skills/evidence-gate/SKILL.md +59 -201
  61. package/kits/builder/skills/execute-plan/SKILL.md +54 -125
  62. package/kits/builder/skills/fix-bug/SKILL.md +42 -132
  63. package/kits/builder/skills/gate-review/SKILL.md +60 -211
  64. package/kits/builder/skills/idea-to-backlog/SKILL.md +63 -244
  65. package/kits/builder/skills/learning-review/SKILL.md +63 -170
  66. package/kits/builder/skills/pickup-probe/SKILL.md +54 -111
  67. package/kits/builder/skills/plan-work/SKILL.md +51 -185
  68. package/kits/builder/skills/pull-work/SKILL.md +136 -485
  69. package/kits/builder/skills/release-readiness/SKILL.md +66 -107
  70. package/kits/builder/skills/review-work/SKILL.md +89 -176
  71. package/kits/builder/skills/tdd-workflow/SKILL.md +53 -147
  72. package/kits/builder/skills/verify-work/SKILL.md +101 -113
  73. package/package.json +2 -2
  74. package/packaging/README.md +1 -1
  75. package/scripts/README.md +1 -1
  76. package/scripts/hooks/lib/kit-catalog.js +1 -1
  77. package/scripts/hooks/stop-goal-fit.js +78 -9
  78. package/scripts/install-codex-home.sh +63 -23
  79. package/scripts/install-owned-files.js +18 -2
  80. package/src/builder-flow-run-adapter.ts +118 -32
  81. package/src/builder-flow-runtime.ts +426 -64
  82. package/src/cli/assignment-provider-lock.test.mjs +83 -0
  83. package/src/cli/assignment-provider.ts +75 -14
  84. package/src/cli/builder-flow-run-adapter.test.mjs +4 -2
  85. package/src/cli/builder-flow-runtime.test.mjs +436 -18
  86. package/src/cli/builder-run.ts +3 -9
  87. package/src/cli/kit-metadata-security.test.mjs +232 -6
  88. package/src/cli/public-api.test.mjs +15 -0
  89. package/src/cli/workflow-sidecar-execution-proof.test.mjs +90 -0
  90. package/src/cli/workflow-sidecar.ts +746 -103
  91. package/src/cli/workflow.ts +288 -41
  92. package/src/flow-kit/validate.ts +320 -2
  93. package/src/index.ts +6 -5
  94. package/src/lib/observed-command.ts +96 -0
  95. package/src/tools/build-universal-bundles.ts +51 -3
  96. package/src/tools/generate-context-map.ts +5 -3
@@ -3,7 +3,7 @@
3
3
  "id": "builder",
4
4
  "name": "Builder Kit",
5
5
  "product_name": "Builder Kit",
6
- "description": "A Flow Kit for shaping work, breaking it down, building changes, verifying evidence, preparing pull requests, checking merge readiness, and recording learning.",
6
+ "description": "A Flow Kit for shaping provider-backed work, breaking it down, building changes, verifying evidence, preparing provider change records, checking merge readiness, and recording learning.",
7
7
  "flows": [
8
8
  {
9
9
  "id": "builder.shape",
@@ -13,7 +13,7 @@
13
13
  {
14
14
  "id": "builder.build",
15
15
  "path": "flows/build.flow.json",
16
- "description": "Pull ready work through design probing, planning, implementation, verification, pull request readiness, merge readiness, and learning."
16
+ "description": "Pull ready provider-backed work through design probing, planning, implementation, verification, provider change readiness, merge readiness, and learning."
17
17
  },
18
18
  {
19
19
  "id": "builder.publish-learn",
@@ -48,53 +48,88 @@
48
48
  {
49
49
  "flow_id": "builder.build",
50
50
  "step_id": "pull-work",
51
- "skills": ["pull-work"]
51
+ "skills": ["pull-work"],
52
+ "expectation_ids": ["selected-work"]
52
53
  },
53
54
  {
54
55
  "flow_id": "builder.build",
55
56
  "step_id": "design-probe",
56
- "skills": ["pickup-probe"]
57
+ "skills": ["pickup-probe"],
58
+ "expectation_ids": ["pickup-probe-readiness", "probe-decisions-or-accepted-gaps"]
57
59
  },
58
60
  {
59
61
  "flow_id": "builder.build",
60
62
  "step_id": "plan",
61
- "skills": ["plan-work"]
63
+ "skills": ["plan-work"],
64
+ "expectation_ids": ["implementation-plan"]
62
65
  },
63
66
  {
64
67
  "flow_id": "builder.build",
65
68
  "step_id": "execute",
66
- "skills": ["execute-plan"]
69
+ "skills": ["execute-plan"],
70
+ "expectation_ids": ["implementation-scope"]
67
71
  },
68
72
  {
69
73
  "flow_id": "builder.build",
70
74
  "step_id": "verify",
71
- "skills": ["review-work", "verify-work"]
75
+ "skills": ["review-work", "verify-work"],
76
+ "expectation_ids": ["clean-critique", "acceptance-criteria", "tests-evidence", "policy-compliance"]
72
77
  },
73
78
  {
74
79
  "flow_id": "builder.build",
75
80
  "step_id": "merge-ready",
76
- "skills": ["evidence-gate"]
81
+ "skills": ["evidence-gate"],
82
+ "expectation_ids": ["merge-readiness"]
77
83
  },
78
84
  {
79
85
  "flow_id": "builder.build",
80
86
  "step_id": "pr-open",
81
87
  "skills": [],
82
- "operations": ["publish-change"]
88
+ "operations": ["publish-change"],
89
+ "expectation_ids": ["pull-request-opened"],
90
+ "artifacts": ["release.json"]
83
91
  },
84
92
  {
85
93
  "flow_id": "builder.build",
86
94
  "step_id": "merge-ready-ci",
87
- "skills": ["release-readiness"]
95
+ "skills": ["release-readiness"],
96
+ "expectation_ids": ["ci-merge-readiness"]
88
97
  },
89
98
  {
90
99
  "flow_id": "builder.build",
91
100
  "step_id": "learn",
92
- "skills": ["learning-review"]
101
+ "skills": ["learning-review"],
102
+ "expectation_ids": ["decision-evidence", "learning-evidence"]
93
103
  },
94
104
  {
95
105
  "flow_id": "builder.build",
96
106
  "step_id": "done",
97
- "skills": []
107
+ "skills": [],
108
+ "expectation_ids": []
109
+ },
110
+ {
111
+ "flow_id": "builder.shape",
112
+ "step_id": "shape",
113
+ "skills": ["idea-to-backlog"],
114
+ "expectation_ids": ["shaped-problem", "shaped-outcome", "shaped-constraints", "shaped-non-goals", "shaped-success", "shaped-risk", "open-decisions"]
115
+ },
116
+ {
117
+ "flow_id": "builder.shape",
118
+ "step_id": "breakdown",
119
+ "skills": ["idea-to-backlog"],
120
+ "expectation_ids": ["slices-defined"]
121
+ },
122
+ {
123
+ "flow_id": "builder.shape",
124
+ "step_id": "file-issues",
125
+ "skills": ["idea-to-backlog"],
126
+ "expectation_ids": ["work-items-filed"]
127
+ },
128
+ {
129
+ "flow_id": "builder.shape",
130
+ "step_id": "shape-done",
131
+ "skills": [],
132
+ "expectation_ids": []
98
133
  }
99
134
  ],
100
135
  "hook_influence_expectations": [
@@ -124,7 +159,7 @@
124
159
  ],
125
160
  "must_include_actions": [
126
161
  "review-work for report-only critique before verify-work",
127
- "not count critique.json as verification evidence"
162
+ "not count report-only critique as verification evidence"
128
163
  ]
129
164
  },
130
165
  {
@@ -135,7 +170,7 @@
135
170
  "must_include_guidance": [
136
171
  "KIT WORKFLOW ROUTE",
137
172
  "activate `deliver`",
138
- "--flow-id builder.build",
173
+ "public `flow-agents workflow` interface",
139
174
  "plan-work -> execute-plan -> review-work -> verify-work",
140
175
  "release-readiness and learning-review"
141
176
  ],
@@ -147,6 +182,25 @@
147
182
  ]
148
183
  }
149
184
  ],
185
+ "skill_roles": [
186
+ { "skill_id": "builder.builder-shape", "role": "entrypoint", "flow_id": "builder.shape", "step_ids": [], "artifacts": [], "expectation_ids": [] },
187
+ { "skill_id": "builder.deliver", "role": "entrypoint", "flow_id": "builder.build", "step_ids": [], "artifacts": [], "expectation_ids": [] },
188
+ { "skill_id": "builder.fix-bug", "role": "profile", "flow_id": "builder.build", "step_ids": [], "artifacts": [], "expectation_ids": [] },
189
+ { "skill_id": "builder.tdd-workflow", "role": "profile", "flow_id": "builder.build", "step_ids": [], "artifacts": [], "expectation_ids": [] },
190
+ { "skill_id": "builder.idea-to-backlog", "role": "step", "flow_id": "builder.shape", "step_ids": ["shape", "breakdown", "file-issues"], "artifacts": ["<slug>--idea-to-backlog.md", "trust.bundle#builder.shape"], "expectation_ids": ["shaped-problem", "shaped-outcome", "shaped-constraints", "shaped-non-goals", "shaped-success", "shaped-risk", "open-decisions", "slices-defined", "work-items-filed"] },
191
+ { "skill_id": "builder.pull-work", "role": "step", "flow_id": "builder.build", "step_ids": ["pull-work"], "artifacts": ["<slug>--pull-work.md", "trust.bundle#selected-work"], "expectation_ids": ["selected-work"] },
192
+ { "skill_id": "builder.pickup-probe", "role": "step", "flow_id": "builder.build", "step_ids": ["design-probe"], "artifacts": ["<slug>--pull-work.md", "trust.bundle#pickup-probe"], "expectation_ids": ["pickup-probe-readiness", "probe-decisions-or-accepted-gaps"] },
193
+ { "skill_id": "builder.plan-work", "role": "step", "flow_id": "builder.build", "step_ids": ["plan"], "artifacts": ["<slug>--plan-work.md", "acceptance.json", "handoff.json", "trust.bundle#implementation-plan"], "expectation_ids": ["implementation-plan"] },
194
+ { "skill_id": "builder.execute-plan", "role": "step", "flow_id": "builder.build", "step_ids": ["execute"], "artifacts": ["<slug>--deliver.md", "state.json", "trust.bundle#implementation-scope"], "expectation_ids": ["implementation-scope"] },
195
+ { "skill_id": "builder.review-work", "role": "step", "flow_id": "builder.build", "step_ids": ["verify"], "artifacts": ["trust.bundle#critique"], "expectation_ids": ["clean-critique"] },
196
+ { "skill_id": "builder.verify-work", "role": "step", "flow_id": "builder.build", "step_ids": ["verify"], "artifacts": ["trust.bundle#acceptance-criteria", "trust.bundle#tests-evidence", "trust.bundle#policy-compliance"], "expectation_ids": ["acceptance-criteria", "tests-evidence", "policy-compliance"] },
197
+ { "skill_id": "builder.evidence-gate", "role": "step", "flow_id": "builder.build", "step_ids": ["merge-ready"], "artifacts": ["<slug>--evidence-gate.md", "trust.bundle#merge-readiness"], "expectation_ids": ["merge-readiness"] },
198
+ { "skill_id": "builder.release-readiness", "role": "step", "flow_id": "builder.publish-learn", "step_ids": ["merge-ready-ci"], "artifacts": ["release.json", "trust.bundle#ci-merge-readiness"], "expectation_ids": ["ci-merge-readiness"] },
199
+ { "skill_id": "builder.learning-review", "role": "step", "flow_id": "builder.publish-learn", "step_ids": ["learn"], "artifacts": ["learning.json", "trust.bundle#decision-evidence", "trust.bundle#learning-evidence"], "expectation_ids": ["decision-evidence", "learning-evidence"] },
200
+ { "skill_id": "builder.design-probe", "role": "shared-primitive", "step_ids": [], "artifacts": ["ephemeral decision record"], "expectation_ids": [] },
201
+ { "skill_id": "builder.continue-work", "role": "extension", "step_ids": [], "artifacts": [], "expectation_ids": [] },
202
+ { "skill_id": "builder.gate-review", "role": "extension", "step_ids": [], "artifacts": ["<slug>--gate-review.md", "gate-review.inquiries.json"], "expectation_ids": [] }
203
+ ],
150
204
  "skills": [
151
205
  {
152
206
  "id": "builder.builder-shape",
@@ -191,7 +245,7 @@
191
245
  {
192
246
  "id": "builder.idea-to-backlog",
193
247
  "path": "skills/idea-to-backlog/SKILL.md",
194
- "description": "Turn raw ideas into shaped, prioritized, executable GitHub issue backlog."
248
+ "description": "Turn raw ideas into shaped, prioritized, executable provider-backed work items; GitHub is an optional adapter."
195
249
  },
196
250
  {
197
251
  "id": "builder.learning-review",
@@ -211,7 +265,7 @@
211
265
  {
212
266
  "id": "builder.pull-work",
213
267
  "path": "skills/pull-work/SKILL.md",
214
- "description": "Select ready GitHub issues from the executable backlog for implementation."
268
+ "description": "Select ready provider-backed work items from the executable backlog for implementation; GitHub is an optional adapter."
215
269
  },
216
270
  {
217
271
  "id": "builder.release-readiness",
@@ -1,86 +1,86 @@
1
1
  ---
2
2
  name: "builder-shape"
3
- description: "Invoke Builder Kit shape from a raw idea or the current conversation context without requiring the user to name idea-to-backlog. Delegates shaping to idea-to-backlog, records the Builder Kit Flow Definition link, and stops at the backlog gate unless GitHub issue sync is explicitly requested."
3
+ description: "Builder Kit shaping entrypoint. Turns a raw idea into a provider-neutral, reviewable backlog proposal and stops before build selection unless the user explicitly continues."
4
4
  ---
5
5
 
6
6
  # Builder Shape
7
7
 
8
- Invoke the Builder Kit `shape` flow for raw product ideas, vague build goals, current conversation context, PRD-like concepts, spikes, prototypes, or work that needs alignment before implementation.
8
+ ## Role and Boundary
9
9
 
10
- ## Contract
10
+ **Role:** Builder Kit entrypoint for `builder.shape`.
11
11
 
12
- - Product surface: let the user ask for "Builder Kit shape", "builder shape", or "shape this with Builder Kit" without naming `idea-to-backlog`.
13
- - Proactive suggestion: when a user starts planning a feature, product, PRD, roadmap item, or vague build idea without naming a workflow, briefly suggest Builder Kit shape as the structured path before implementation. Phrase it as an option, not a forced gate, unless the request is too ambiguous to plan responsibly.
14
- - Delegation: use `kits/builder/skills/idea-to-backlog/SKILL.md` as the shaping primitive. Do not duplicate or replace its workflow, artifact contract, issue shape, or gate rules.
15
- - Product-level auto-guidance: when the user invokes Builder Kit shape, guide them through `design-probe` alignment and then the `idea-to-backlog` workflow directly; do not require them to type `design-probe` or `idea-to-backlog` as additional skill names.
16
- - do not require them to type `idea-to-backlog`; Builder Kit shape owns the user-facing route into that primitive.
17
- - Flow reference: link every Builder Kit shape artifact to the Builder Kit Flow Definition at `kits/builder/flows/shape.flow.json`.
18
- - Input: start from the user's raw idea, pasted notes, or the current conversation context.
19
- - Probe/alignment: when the idea, user outcome, constraints, non-goals, success signal, risk, or bundle relationship is unclear, run `design-probe` style alignment before continuing.
20
- - Default stop: stop at the backlog gate by default. Do not create GitHub issues, sync to a project, or hand off to `pull-work` unless the user explicitly asks for that next step.
21
- - Boundary: do not run Builder Kit build execution, remote kit install, package extraction, downstream delivery workflows, `plan-work`, `execute-plan`, `review-work`, `verify-work`, `evidence-gate`, or release workflows from this invocation.
22
- - Compatibility: Direct `idea-to-backlog` usage remains valid and should behave exactly as described in `kits/builder/skills/idea-to-backlog/SKILL.md`.
23
- - Primitive recovery: if a user invokes `idea-to-backlog` or another primitive with missing shaping context and appears to want the product flow, explain that Builder Kit shape is the entry point and offer to route there.
12
+ Use this surface only when the user explicitly asks to shape an idea with Builder
13
+ Kit, or accepts it after it is offered as an option. It delegates shaping to
14
+ `idea-to-backlog`; it does not implement, select, or deliver work.
15
+
16
+ `builder.shape` is selected for raw ideas, vague outcomes, PRD-like concepts,
17
+ spikes, and prototypes. It is not a generic routing rule for every planning
18
+ request. Direct `idea-to-backlog` remains a valid standalone primitive.
19
+
20
+ This entrypoint owns **no step-gate evidence**. `idea-to-backlog` owns its
21
+ shaping artifact and any evidence required by its own contract.
24
22
 
25
23
  ## Model Routing
26
24
 
27
- When this skill delegates its shaping work (to `idea-to-backlog` / `design-probe`
28
- alignment), resolve the `delegate-design` role from `.datum/config.json`
29
- (`npx @kontourai/datum resolve delegate-design --json`) and pass the resolved
30
- model explicitly shaping needs design latitude, so it routes to the design
31
- tier. See `context/contracts/execution-contract.md` § Delegation: Model Routing.
32
- Fallback: inherit the session model when datum/config is absent, noted in the
33
- artifact.
34
-
35
- ## Invocation
36
-
37
- Use this skill when the user says things like:
38
-
39
- - `Use Builder Kit shape for this idea: ...`
40
- - `Builder shape the current conversation into backlog candidates.`
41
- - `Shape this with Builder Kit, but do not create issues yet.`
42
- - `Run Builder Kit shape and sync GitHub issues only after I confirm.`
43
-
44
- When activated:
45
-
46
- 1. Read `kits/builder/skills/idea-to-backlog/SKILL.md`.
47
- 2. State that Builder Kit shape delegates to `idea-to-backlog` and uses `kits/builder/flows/shape.flow.json`.
48
- 3. Gather the raw idea or current conversation context.
49
- 4. If needed, use `design-probe`: ask one Probe/alignment question at a time before shaping. Prefer questions that clarify user outcome, constraints, non-goals, success criteria, risk, or whether bundled ideas truly belong together.
50
- 5. Create or update the standard `.kontourai/flow-agents/<slug>/<slug>--idea-to-backlog.md` artifact using the `idea-to-backlog` artifact contract.
51
- 6. Add a `builder_kit_shape` or equivalent note in the artifact that links to `kits/builder/flows/shape.flow.json` and records that the product-level Builder Kit shape surface was used.
52
- 7. Stop at `next_gate: Backlog Gate` unless the user explicitly requested GitHub issue sync.
53
- 8. If the user asked for guided Builder Kit continuation, record the expected next step as `pull-work` after issue sync or backlog approval; otherwise record manual mode and stop.
54
-
55
- ## Artifact Requirements
56
-
57
- The artifact must keep the standard `idea-to-backlog` sections:
58
-
59
- - `source_ideas`
60
- - `idea_inventory`
61
- - `slice_candidates`
62
- - `bundle_justification`
63
- - `dependency_map`
64
- - `phase`
65
- - `decisions`
66
- - `opportunity_briefs`
67
- - `shaped_work`
68
- - `risk_release_notes`
69
- - `backlog_links`
70
- - `parked_or_rejected`
71
- - `open_questions`
72
- - `next_gate`
73
-
74
- For Builder Kit shape invocations, also include:
75
-
76
- - Builder Kit Flow Definition: `kits/builder/flows/shape.flow.json`
77
- - Explicit issue-sync status, such as `not_requested`, `requested`, or `completed`
78
- - A backlog-gate decision that says whether the workflow stopped before issue creation
79
-
80
- ## GitHub Issue Sync
81
-
82
- Issue sync is explicit-only.
83
-
84
- - If the user did not ask to create or sync issues, set `backlog_links` to `not_requested` or an empty recorded status and stop at the backlog gate.
85
- - If the user asks to create or sync issues, follow the GitHub issue rules in `kits/builder/skills/idea-to-backlog/SKILL.md`.
86
- - If provider details are missing, ask for them instead of assuming a GitHub repository, project, labels, milestone, or assignee.
25
+ Resolve `delegate-design` from `.datum/config.json` for shaping and alignment.
26
+ Model choice and reasoning effort follow
27
+ `context/contracts/execution-contract.md`; if the mapping is unavailable,
28
+ inherit the session model and record the fallback.
29
+
30
+ ## Inputs and Providers
31
+
32
+ Start from the user's raw idea, notes, or current conversation context. Ask
33
+ one focused alignment question at a time when outcome, constraints, non-goals,
34
+ success signal, risk, or the relationship between ideas is unclear.
35
+
36
+ Describe backlog targets through adapters:
37
+
38
+ - **Work Item adapter:** the proposed buildable unit and its acceptance context.
39
+ - **Board adapter:** the destination queue or backlog, when one is requested.
40
+ - **Repository adapter:** the repository or product boundary affected by the item.
41
+
42
+ No adapter is required merely to shape an idea. A GitHub issue or project may
43
+ be a labeled example of a Work Item or Board adapter, never a required
44
+ contract.
45
+
46
+ ## Flow Behavior
47
+
48
+ 1. Derive a safe explicit slug from the selected shape title: lowercase ASCII
49
+ words separated by single hyphens. Never interpolate raw request text into a
50
+ shell command, slug, or quoted argument.
51
+ 2. Start and inspect the public shape run using the safe slug and a fixed,
52
+ operator-authored summary:
53
+
54
+ ```bash
55
+ flow-agents workflow start --flow builder.shape \
56
+ --task-slug <safe-shape-slug> \
57
+ --summary "Shape the selected work into independently actionable slices."
58
+ flow-agents workflow status --session-dir .kontourai/flow-agents/<safe-shape-slug> --json
59
+ ```
60
+
61
+ 3. State that this entrypoint selects `builder.shape` and delegates to
62
+ `idea-to-backlog`.
63
+ 4. Gather and clarify the idea.
64
+ 5. Have `idea-to-backlog` produce its normal shaping result, including
65
+ candidate Work Items, slicing, risks, decisions, and a next-action.
66
+ 6. Stop at the backlog decision. Create or synchronize provider records only
67
+ when the user explicitly requests it and the relevant adapters are known.
68
+
69
+ Do not duplicate `idea-to-backlog`'s intake, prioritization, slicing, artifact,
70
+ or gate logic. Do not invoke `pull-work`, `plan-work`, `execute-plan`,
71
+ `review-work`, `verify-work`, or release activities from this entrypoint.
72
+
73
+ ## Output Responsibility
74
+
75
+ The produced result is the standard `idea-to-backlog` shaping report. It must
76
+ identify the selected flow (`builder.shape`), the source ideas, candidate Work
77
+ Items, provider-sync status, decisions, open questions, and the backlog
78
+ decision. This entrypoint creates no step evidence; `idea-to-backlog` records
79
+ the owning trust-bundle slices through the public CLI.
80
+
81
+ ## Standalone and No-Active-Run Behavior
82
+
83
+ `builder.shape` may run independently of `builder.build`. If a prior shaping
84
+ report exists, use it as context; do not assume it authorizes provider
85
+ synchronization or build execution. If the public shape interface is unavailable,
86
+ report an unsupported-runtime blocker rather than using an internal writer.
@@ -1,125 +1,64 @@
1
1
  ---
2
2
  name: "continue-work"
3
- description: "Advance a multi-slice work item to its next increment via a fresh-context handoff. Use when one or more slices of a multi-slice issue have landed and the next undone slice should be built. Routes the next slice through pull-work + pickup-probe (never around the gate), restores prior slices from the durable record as precedent, and hands off in a fresh context per ADR 0013."
3
+ description: "Explicit Builder Kit continuation extension. Prepares a fresh-context handoff for the next unfinished increment of a multi-slice Work Item."
4
4
  ---
5
5
 
6
6
  # Continue Work
7
7
 
8
- Advance a multi-slice work item to its **next increment**, in a fresh context, with the already-landed slices as precedent.
8
+ ## Role and Boundary
9
9
 
10
- This skill is **orchestration, not new machinery.** It composes existing pieces and must never reimplement them:
10
+ **Role:** explicit continuation extension outside generic routing.
11
11
 
12
- - `pull-work` already owns *selection* plus the `pickup-probe` gate, and already handles "continue / keep going / pick up the next" intents. continue-work routes the chosen slice **through** `pull-work` / `pickup-probe`, never around it.
13
- - The **resume surface** (#153) owns restoring an item's durable record (`state.json` lifecycle + `handoff.json` next-steps/blockers + plan artifact + `trust.bundle` trust summary) into context. continue-work consumes that surface; it does not re-derive the record.
14
- - **ADR 0013** establishes `pull-work` as the clean *context-reset* seam: a fresh window per increment, selective compaction, status-gated reuse. continue-work spawns the next increment as a fresh-context workflow seamed at `pull-work`.
15
- - The **fresh-handoff** pattern (spawn a new context for the next increment) is the delivery mechanism.
12
+ Use only when the user explicitly asks to advance the next unfinished increment
13
+ of a multi-slice Work Item that has prior completed increments. This extension
14
+ does not select a new flow, resume an interrupted increment, or run build
15
+ steps in-line. It prepares a fresh-context handoff that routes the next
16
+ increment through the normal `builder.build` entrypoint.
16
17
 
17
- continue-work ties these together for **one job**: take a multi-slice work item that has at least one slice landed and more remaining, determine the next undone slice, route it through the gate, and hand it off fresh with the prior slices as the model.
18
+ It owns **no step-gate evidence**. `pull-work`, `design-probe`, and the build
19
+ primitives own selection, probe, planning, execution, review, and verification
20
+ evidence.
18
21
 
19
- ## When To Use / When Not
22
+ ## Inputs and Provider Adapters
20
23
 
21
- **Use** when:
24
+ Use the Work Item adapter for slice status and acceptance context, the Board
25
+ adapter for selection and dependencies, the Repository adapter for local
26
+ history and working agreements, and the Change adapter for prior completed
27
+ increments. GitHub issues and pull requests are optional examples of Work Item
28
+ and Change adapters, not mandatory inputs.
22
29
 
23
- - A multi-slice issue has **at least one slice landed and more remaining** (for example #106), and the request is "continue", "pick up the next slice", "keep going on this issue", or "do the next increment".
30
+ Restore durable context when available: prior plans, handoffs, verified
31
+ outcomes, completed changes, and unresolved blockers. If it is unavailable,
32
+ state the gap and rely on the Work Item and repository history without
33
+ inventing missing facts.
24
34
 
25
- **Do not use** when:
35
+ ## Extension Behavior
26
36
 
27
- - The request is **brand-new work** with nothing landed yet that is selection from the backlog. Route to `pull-work`.
28
- - The request is to **resume the *same* interrupted slice** after a restart (same in-flight slice, mid-execution, picking up new hooks/logic) — that is the resume surface (#153), which reconstructs `state.json` + `handoff.json` + plan + `trust.bundle` for the *same* increment. continue-work advances to the *next* increment; it does not re-enter an unfinished one.
37
+ 1. Confirm this is the next increment, not a restart of the same interrupted
38
+ increment. Ask one focused question when that boundary is unclear.
39
+ 2. Determine the thinnest remaining meaningful slice from the Work Item and
40
+ completed Change-adapter history.
41
+ 3. Build a minimal fresh-context handoff containing the next slice, acceptance
42
+ context, repository working agreements, relevant prior changes, known
43
+ blockers, and adapter references.
44
+ 4. Hand the new context to `deliver`, which starts or continues `builder.build`
45
+ and routes the item through its canonical primitives.
29
46
 
30
- For that same-slice case, when a canonical Builder Flow run already exists, restore
31
- its sidecar/current projection with `flow-agents builder-run recover --session-dir
32
- .kontourai/flow-agents/<slug>` before following the resume surface. The command
33
- derives run identity from the session slug and only loads, validates, and projects;
34
- never invent or supply a run id or step, and use `builder-run sync` separately only
35
- when recorded evidence should be attached and evaluated.
47
+ Do not repeat the detailed `pull-work` or `design-probe` procedure, attach
48
+ evidence on their behalf, or treat a continuation request as authority to skip
49
+ selection and probe work.
36
50
 
37
- If the boundary is ambiguous (is this the next slice or the same one?), stop and ask one question before routing. Do not silently assume.
51
+ ## Output Responsibility
38
52
 
39
- ## Boundary (ADR 0014)
53
+ The output is a concise, ephemeral fresh-context handoff delivered to a new
54
+ agent or operator. It creates no persistent artifact, trust slice, or gate
55
+ evidence of its own.
40
56
 
41
- Home is the **Builder Kit** — developer orchestration over issues, slices, and PRs — alongside `pull-work` and `deliver`. The underlying *fresh-handoff primitive* is generic. If a non-developer kit later needs continuation, **graduate the primitive** per ADR 0014; do not fork continue-work into each kit.
57
+ ## Standalone and No-Active-Run Behavior
42
58
 
43
- ## Inputs
44
-
45
- - The multi-slice work item (an issue ref) with at least one slice landed and more remaining.
46
- - Repository or working directory and the owning kit/kit-dir.
47
- - The durable record for the item when one exists, restored via the resume surface (#153): `state.json`, `handoff.json` next-steps/blockers, the plan artifact, and a one-line `trust.bundle` summary of what is already verified.
48
- - The merged PRs and commits that reference the issue (the landed slices), available as `git show <sha>` precedent.
49
- - `AGENTS.md` "Operating discipline (working agreements)" — the operating agreements that travel with every increment.
50
-
51
- ## Workflow
52
-
53
- ### 1. Restore the durable record (resume surface, #153)
54
-
55
- Before doing anything else, restore the item's durable record into context through the resume surface (#153) rather than re-deriving it from chat memory: `state.json` lifecycle, `handoff.json` next-steps and blockers, the plan artifact, and a one-line `trust.bundle` summary of what is already verified. This is *restore for context*, not *resume the slice* — continue-work is advancing to the next increment, so already-verified prior slices stay verified and are not re-proven.
56
-
57
- If no durable record exists for the item, record that gap and rely on the issue body plus merged PRs/commits as the authoritative history.
58
-
59
- If the item was taken over from a stale incumbent (a `reclaimable` selection resumed via pull-work's **Takeover Protocol**, #294 / ADR 0021 §5), restoring the durable record IS the resumption: the deterministic slug points at the incumbent's existing `.kontourai/flow-agents/<slug>/`, and you continue the incumbent's branch (the `resume_branch` from `takeover-preflight`/the supersede output) — never a new branch, never a restarted plan. Takeover is resumption, not restart.
60
-
61
- ### 2. Determine the next undone slice
62
-
63
- From the issue body plus the merged PRs and commits referencing the issue, determine which slices have **landed** and which is the **next undone slice**.
64
-
65
- - Read the issue body for the slice list / acceptance breakdown.
66
- - List merged PRs and commits referencing the issue (`gh pr list --search <issue>`, `git log --grep`) to see which slices are done.
67
- - The next undone slice is the thinnest remaining meaningful increment. If the remaining work is ambiguous or no longer matches the issue, route back to `idea-to-backlog` instead of inventing scope.
68
-
69
- ### 3. Route the slice THROUGH pull-work + pickup-probe (the gate, never around it)
70
-
71
- Hand the chosen next slice to `pull-work`, then `pickup-probe`. **Never bypass this gate.** A continuation instruction ("continue", "pick up the next") may justify inspecting the queue, but it must not skip per-item pickup Probe evidence — see pull-work's Pickup Gate ("A stale broad continuation instruction … may allow queue inspection but must not bypass per-item pickup Probe evidence") and its post-merge rule ("automatic continuation … cannot enter planning or execution for the next work item until a fresh pickup Probe record exists for that newly selected item").
72
-
73
- - `pull-work` enforces board selection, WIP/shepherding, dependency, grouping, freshness (planned-base drift), and worktree logic for the selected slice, and writes the pull-work artifact.
74
- - `pickup-probe` then challenges the slice against the repository — scope, acceptance quality, provider state, drift, conflict risks — and records the pickup Probe outcome, planning readiness, decisions, unresolved questions, and accepted gaps.
75
- - continue-work does **not** reimplement either step's logic. It supplies them the next slice and the precedent (prior slices) and consumes their artifacts. The evidence that the gate ran lives in the pull-work / pickup-probe artifact referenced by the handoff (`probe_status`, `probe_artifact_ref`).
76
-
77
- Do not enter planning or execution until a fresh pickup Probe record exists for this slice.
78
-
79
- ### 4. Assemble the minimal handoff
80
-
81
- Once the slice passes the gate, assemble the **minimal handoff** — the smallest durable context a fresh agent needs:
82
-
83
- - the **slice's spec**: `gh issue view <issue>` (the issue is the spec);
84
- - the **operating agreements**: `AGENTS.md` "Operating discipline";
85
- - the **precedent**: the prior slices' merged PRs as the model (`git show` them);
86
- - the **gate evidence**: the pull-work / pickup-probe artifact ref proving the slice passed the gate.
87
-
88
- The minimal template it encodes:
89
-
90
- ```
91
- Implement [slice N of #ISSUE] in <repo> — the <kit>.
92
- Read first: AGENTS.md 'Operating discipline'; gh issue view ISSUE (your slice's spec);
93
- the prior slices as your model (PRs … — git show them).
94
- Then: scope → minimal impl reusing existing ops (consume-never-fork) → tests stay green +
95
- cover new code → PR referencing #ISSUE, <kit-dir> only. Don't merge; get CI green and report.
96
- ```
97
-
98
- ### 5. Execute in a fresh context (ADR 0013)
99
-
100
- Hand the minimal template off into a **fresh context** — either spawn a sub-agent for the next increment, or hand the prompt to the operator for a fresh session. Per ADR 0013, the new increment rebuilds its context from durable artifacts (the issue, AGENTS.md, prior PRs, the gate artifact), not from this conversation's history. The fresh-handoff is the delivery seam: a sharp window for the new slice, continuity carried by the durable system.
101
-
102
- The fresh-context agent runs the standard Builder Kit build for its slice (`plan-work` → `execute-plan` → `review-work` → `verify-work`), which it may reach via `deliver`. continue-work does not re-run those primitives in-line; it sets up the handoff and lets the fresh context execute.
103
-
104
- ### 6. Verify and report — do not merge
105
-
106
- After the slice is built:
107
-
108
- - Confirm the **boundary held** (only `<kit-dir>` changed) and the **suites are green** (the slice's tests cover the new code and nothing regressed).
109
- - Report: which slice advanced, the gate evidence (pull-work / pickup-probe artifact), the precedent PRs used, the verification result, and the PR.
110
- - **Do not merge without authorization.** Get CI green and report back.
111
-
112
- ## Composition Gate
113
-
114
- continue-work has correctly composed the pieces only when:
115
-
116
- - the durable record was restored via the resume surface (#153), or a missing-record gap is recorded;
117
- - the next undone slice was derived from the issue body plus merged PRs/commits, not invented;
118
- - the slice was routed **through** `pull-work` + `pickup-probe`, with a fresh pickup Probe record (`probe_status`, `probe_artifact_ref`) referenced by the handoff — the gate was not bypassed;
119
- - the minimal handoff carries the issue spec, `AGENTS.md` operating agreements, and the precedent PRs;
120
- - the next increment runs in a **fresh context** per ADR 0013;
121
- - the boundary held, suites are green, and the change is reported without merging.
122
-
123
- If any item fails, stop and surface the gap rather than proceeding.
124
-
125
- Refs: #106 (proving ground), #153 (resume surface), #168 / ADR 0013 (context lifecycle), #164 (operating agreements), ADR 0014 (core vs domain-kit boundary).
59
+ This extension may run without an active workflow run because it only prepares
60
+ the next handoff. It does not create, recover, or mutate a run. If an active
61
+ run exists, inspect it only through `flow-agents workflow status --session-dir
62
+ <session-dir>` and do not redirect or advance it. For an interrupted current
63
+ increment, route to the run's public resume behavior instead of using this
64
+ extension.