@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,144 +1,87 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: "pickup-probe"
|
|
3
|
-
description: "
|
|
3
|
+
description: "Provider-grounded pickup probe used at the Builder design-probe step before planning."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Pickup Probe
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Verify that selected work is understood well enough to plan without implementing it.
|
|
9
9
|
|
|
10
|
-
##
|
|
11
|
-
|
|
12
|
-
`pickup-probe` is the Builder Kit pickup specialization of the `design-probe` flow step. It runs after `pull-work` selects work and before `plan-work` creates an execution plan.
|
|
13
|
-
|
|
14
|
-
Direct `pull-work` and direct `plan-work` remain valid standalone primitives. This skill is required when the productized Builder Kit `build` flow has selected work, when a user asks to pick up work and continue into build/delivery, or when `deliver` needs to prove selected-work readiness before planning.
|
|
15
|
-
|
|
16
|
-
This skill is modeled after Matt Pocock's `grill-with-docs`: challenge the selected work against the existing domain model, sharpen terminology, cross-check docs and code, ask one recommended question at a time, update durable glossary terms inline when they crystallize, and offer ADRs only for hard-to-reverse, surprising, trade-off decisions.
|
|
17
|
-
|
|
18
|
-
## Required Inputs
|
|
19
|
-
|
|
20
|
-
- Selected work item or coherent work item group.
|
|
21
|
-
- Pull-work artifact with board snapshot, WIP assessment, selection rationale, scope, non-goals, pickup gate, and handoff.
|
|
22
|
-
- Provider state, including WorkItemProvider and BoardProvider refs, issue status, labels, milestone/project fields, blockers, PR links, and source artifact refs when available.
|
|
23
|
-
- WIP and conflict scan covering active sessions, open PRs, verification/review/CI remediation queues, expected shared files, and worktree or sandbox mode.
|
|
24
|
-
- Existing acceptance criteria, done criteria, stop-short risks, and known non-goals.
|
|
25
|
-
- Source issue and artifact refs, including issue URLs, source planning or idea artifacts, flow definition refs, and missing-source notes.
|
|
26
|
-
- Repository reality: `CONTEXT.md` when present, relevant docs, ADRs, contracts, skills, schemas, fixtures, and code paths named by the selected work.
|
|
27
|
-
- Domain documentation: root `CONTEXT.md`, `CONTEXT-MAP.md` when present, and relevant `docs/adr/` records. If no durable context file exists, create one lazily only when a resolved project-specific term needs a home.
|
|
28
|
-
- Planned-base drift context: `planned_base_ref`, `planned_base_sha`, current target ref/SHA, `planning_scope_refs`, and a diff summary from the planned/pulled work SHA to current HEAD when available.
|
|
29
|
-
|
|
30
|
-
If a required input is missing, first try to recover it from local artifacts and provider snapshots. Ask one alignment question only when the missing input creates a real decision gap that cannot be resolved from local evidence.
|
|
31
|
-
|
|
32
|
-
If `planned_base_sha` is missing, record that as a `NOT_VERIFIED` drift baseline gap and use current target plus provider history as the best available baseline. Do not invent a planned SHA.
|
|
10
|
+
## Role And Binding
|
|
33
11
|
|
|
34
|
-
|
|
12
|
+
- **Role:** canonical Builder build-step producer and specialized pickup primitive.
|
|
13
|
+
- **Binding:** `builder.build` step `design-probe`.
|
|
14
|
+
- **Produces:** the pickup-probe section in `<slug>--pull-work.md`, plus `pickup-probe-readiness` and `probe-decisions-or-accepted-gaps` for an active matching run.
|
|
15
|
+
- **Standalone no-run behavior:** produce a probe record or conversation summary only. Do not start a Builder run, record Builder evidence, or claim readiness for a non-Builder invocation.
|
|
35
16
|
|
|
36
|
-
##
|
|
37
|
-
|
|
38
|
-
Challenge the selected work against the repository before planning:
|
|
39
|
-
|
|
40
|
-
- Fetch latest for the target ref when available, then compare the current target SHA to `planned_base_sha`. Record current target ref/SHA, planned base ref/SHA, `commits-since`, planned age, changed files reviewed, and changed-file intersections with `planning_scope_refs`.
|
|
41
|
-
- Classify revision freshness as `fresh`, `drifted`, or `stale`. `fresh` may proceed through normal pickup gates. `drifted` prompts alignment and may proceed only when the Probe records accepted decisions or an explicit accepted gap. `stale` routes back to `idea-to-backlog` before implementation planning.
|
|
42
|
-
- If `planned_base_sha` is missing, mark the freshness check `NOT_VERIFIED` and record the concrete fallback baseline, such as current target ref/SHA plus provider history. Treat that as an accepted gap only when the artifact names why planning may continue; do not invent a planned SHA. When using a Builder Kit Probe JSON record, include `resolution_hints` for `revision_freshness_not_verified` so the next planning attempt can see the accepted fallback baseline or route back to `pickup-probe` for missing evidence.
|
|
43
|
-
- Research drift before asking questions: compare the selected work's `planned_base_sha` or pulled-work SHA to current HEAD before running the alignment interview. Inspect changed files, docs, ADRs, contracts, schemas, dependency state, and expected execution areas that overlap `planning_scope_refs` or likely modified files.
|
|
44
|
-
- Classify the diff from planned base to current HEAD as `no_material_drift`, `scope_drift`, `dependency_drift`, `contract_drift`, or `conflict_risk`. Treat material drift as pickup Probe context and ask an alignment question before planning when it changes scope, acceptance criteria, dependency assumptions, terminology, contract expectations, or execution risk.
|
|
45
|
-
- Compare the selected work to `CONTEXT.md`, docs, ADRs, contracts, existing skills, schemas, fixtures, and nearby code.
|
|
46
|
-
- Verify that the acceptance criteria describe an executable outcome rather than only implementation tasks.
|
|
47
|
-
- Sharpen fuzzy domain and workflow terms until the artifact names, scope, gate names, and next step mean one thing.
|
|
48
|
-
- Surface contradictions between issue text, pull-work handoff, provider state, docs, ADRs, contracts, and code reality.
|
|
49
|
-
- Challenge glossary conflicts immediately: if a user or issue uses a term differently than `CONTEXT.md`, ask which meaning is authoritative before planning.
|
|
50
|
-
- Discuss concrete scenarios when boundaries are fuzzy, especially around ownership, provider state, workflow gates, and stop-short behavior.
|
|
51
|
-
- Check whether the selected work is still ready after WIP, conflicts, blockers, dependency freshness, and expected modified files are considered.
|
|
52
|
-
- If the pull-work artifact flags the selected item `reclaimable`, treat the recorded opt-in as a decision to re-confirm (not silently accept) when material drift or time has passed since pull-work's preflight ran.
|
|
53
|
-
- Keep downstream issues and non-goals out of scope unless they are explicit contract consumers for the selected work.
|
|
54
|
-
- Ask one question at a time when a decision is needed, include a recommended answer, and record the answer immediately.
|
|
55
|
-
- Record unresolved questions as blockers unless the user or orchestrator explicitly accepts proceeding with the gap.
|
|
56
|
-
- Update the active workflow artifact immediately when a decision crystallizes; do not rely on chat memory.
|
|
17
|
+
## Contract
|
|
57
18
|
|
|
58
|
-
|
|
19
|
+
- Probe one selected work item or one justified group after `pull-work` and before `plan-work`.
|
|
20
|
+
- Reuse the generic `design-probe` interview behavior for unresolved decisions, but own the Builder pickup record and Builder evidence when the matching flow is active.
|
|
21
|
+
- Do not implement code, revise the backlog, or turn unknowns into assumed requirements.
|
|
22
|
+
- Stop planning when a blocker, contradiction, stale baseline, or material unanswered question lacks an explicit accepted gap.
|
|
59
23
|
|
|
60
|
-
##
|
|
24
|
+
## Provider Boundaries
|
|
61
25
|
|
|
62
|
-
|
|
26
|
+
Use `WorkItemProvider` for item detail and acceptance criteria, `BoardProvider` for current queue and dependency context, `RepositoryAdapter` for revision and source-scope context, and `AssignmentProvider` for durable ownership. A GitHub adapter is optional; provider-specific URLs, labels, Projects, pull requests, and commands are not required.
|
|
63
27
|
|
|
64
|
-
|
|
65
|
-
- Decisions made during the Probe, with source refs when relevant.
|
|
66
|
-
- Unresolved questions, each with owner, impact, and whether it blocks planning.
|
|
67
|
-
- Accepted gaps, including who accepted the gap and why planning may continue.
|
|
68
|
-
- Drift research: planned base ref/SHA, current target ref/SHA, command or provider evidence used, changed files reviewed, drift classification, and whether the drift is material.
|
|
69
|
-
- Builder Kit `resolution_hints` when available for baseline freshness `NOT_VERIFIED` gaps, including `planning.baseline.current`, required baseline evidence, and the accepted fallback baseline behavior.
|
|
70
|
-
- Planning readiness: ready/not ready, required handoff target, and readiness evidence.
|
|
71
|
-
- Expected modified files or file areas, including generated/runtime artifact expectations when relevant.
|
|
72
|
-
- Conflict risks with active work, shared files, provider state, or downstream contract consumers.
|
|
73
|
-
- Route reason and next action, such as `continue -> plan-work`, `decision_gap -> design-probe`, `blocked -> pull-work`, or `split_scope -> pull-work`.
|
|
28
|
+
## Required Inputs
|
|
74
29
|
|
|
75
|
-
|
|
30
|
+
- selected work-item identifier and `pull-work` artifact
|
|
31
|
+
- scope, non-goals, requirements, acceptance criteria, dependencies, and blockers
|
|
32
|
+
- provider state, assignment/liveness result, target revision, and baseline freshness
|
|
33
|
+
- expected modified files, conflict risks, worktree mode, and sandbox constraints
|
|
34
|
+
- existing decisions, unresolved questions, and caller constraints
|
|
76
35
|
|
|
77
|
-
|
|
36
|
+
## Probe Method
|
|
78
37
|
|
|
79
|
-
-
|
|
80
|
-
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
-
|
|
84
|
-
|
|
85
|
-
- The route reason and next action are recorded in an artifact that can be recovered without chat memory.
|
|
38
|
+
1. Re-read the selected item and its upstream artifact. Check that selected identifiers, scope, acceptance criteria, grouping rationale, and next action agree.
|
|
39
|
+
2. Confirm goal fit, user or operator outcome, scope, non-goals, acceptance-criteria quality, dependencies, blockers, provider state, assignment, WIP, and conflict context. When drift now makes a selected item `reclaimable`, re-confirm the recorded takeover opt-in and consequence; do not silently carry an earlier opt-in across changed holder or freshness evidence.
|
|
40
|
+
3. Check target revision against the recorded base and planning scope. Record whether it is fresh, stale, or `NOT_VERIFIED`; identify changed intersections and acceptance-criteria drift.
|
|
41
|
+
4. Identify expected files, sandbox/worktree mode, stop-short risks, and the evidence needed for planning and later verification.
|
|
42
|
+
5. Resolve contradictions through the generic one-question-at-a-time probe. Record each decision, unresolved question, accepted gap with consequence, route reason, and next action.
|
|
43
|
+
6. Set readiness to `ready`, `needs_more_probe`, or `accepted_gap_ready`. Only the first and explicitly accepted third outcome may hand off to `plan-work`.
|
|
86
44
|
|
|
87
|
-
|
|
88
|
-
## Gate Claims: Record Pickup Probe Results
|
|
45
|
+
## Probe Record
|
|
89
46
|
|
|
90
|
-
|
|
47
|
+
Record:
|
|
91
48
|
|
|
92
|
-
|
|
49
|
+
- selected IDs and grouping decision
|
|
50
|
+
- goal fit, scope, non-goals, acceptance-criteria assessment, and provider state
|
|
51
|
+
- dependency and revision freshness, baseline, drift, assignment, WIP, and conflict findings
|
|
52
|
+
- expected modified files, sandbox/worktree mode, risk, and stop-short risks
|
|
53
|
+
- decisions, unresolved questions, accepted gaps, readiness, route reason, and next action
|
|
93
54
|
|
|
94
|
-
|
|
95
|
-
npm run workflow:sidecar -- record-gate-claim .kontourai/flow-agents/<slug> \
|
|
96
|
-
--expectation pickup-probe-readiness \
|
|
97
|
-
--status pass \
|
|
98
|
-
--summary "Pickup probe passed: goal fit confirmed, blockers checked, dependencies reviewed, acceptance criteria verified." \
|
|
99
|
-
--evidence-ref-json '{"kind":"artifact","file":".kontourai/flow-agents/<slug>/<slug>--pull-work.md","summary":"Pull-work artifact recording probe status, scope, and planning readiness."}'
|
|
100
|
-
```
|
|
55
|
+
## Active Builder Evidence
|
|
101
56
|
|
|
102
|
-
|
|
57
|
+
Only for the active `builder.build` `design-probe` step, confirm the run and then record both expectations through the public interface:
|
|
103
58
|
|
|
104
59
|
```bash
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
--status pass \
|
|
108
|
-
--summary "
|
|
109
|
-
--evidence-ref-json '{"kind":"artifact","file":"
|
|
60
|
+
flow-agents workflow status --session-dir <session-dir>
|
|
61
|
+
flow-agents workflow evidence --session-dir <session-dir> \
|
|
62
|
+
--expectation pickup-probe-readiness --status pass \
|
|
63
|
+
--summary "Pickup probe records goal fit, scope, dependencies, risks, and planning readiness." \
|
|
64
|
+
--evidence-ref-json '{"kind":"artifact","file":"<session-dir>/<slug>--pull-work.md","summary":"Pickup readiness, scope, dependencies, risks, and planning decision."}'
|
|
65
|
+
flow-agents workflow evidence --session-dir <session-dir> \
|
|
66
|
+
--expectation probe-decisions-or-accepted-gaps --status pass \
|
|
67
|
+
--summary "Probe decisions and accepted gaps are explicit in the handoff." \
|
|
68
|
+
--evidence-ref-json '{"kind":"artifact","file":"<session-dir>/<slug>--pull-work.md","summary":"Probe decisions, unresolved questions, accepted gaps, route reason, and next action."}'
|
|
110
69
|
```
|
|
111
70
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
When the gate fails, record `--status fail` with `--expectation pickup-probe-readiness` naming the blocker, and omit or defer the decisions claim until the blocker is resolved.
|
|
115
|
-
|
|
71
|
+
Use `fail` for an unresolved planning blocker and `not_verified` when the record cannot prove an expectation. Do not record either claim outside the active matching step.
|
|
116
72
|
|
|
73
|
+
## Durable Decision Notes
|
|
117
74
|
|
|
118
|
-
|
|
75
|
+
When probing resolves a reusable domain decision, follow `context/contracts/probe-docs-write-contract.md`: update the existing vocabulary home when necessary, revise or create the topic-keyed decision record, and retain the probe record as provenance. Keep transient provider snapshots, implementation notes, and open questions in the pickup artifact.
|
|
119
76
|
|
|
120
|
-
|
|
77
|
+
## Handoff
|
|
121
78
|
|
|
122
|
-
|
|
123
|
-
- If a `CONTEXT-MAP.md` exists, update the relevant context instead of assuming the root glossary owns the term.
|
|
124
|
-
- Create a lazy context file only when a resolved term or workflow concept has no existing home.
|
|
125
|
-
- Do not create context files for transient planning notes, open questions, or provider snapshots.
|
|
126
|
-
- Record a decision delta at `docs/decisions/<slug>.md`: consult `docs/decisions/index.md` first and propose revise-vs-create (an existing topic file, including a `needs-decision` stub, is revised in place; only an uncovered subject gets a new file), then run `npm run gen:decisions-index && npm run check:decisions`. Link this Probe's own session artifact as a `session-archive` evidence ref (transcript provenance). Never propose or create a numbered ADR — `docs/adr/` is frozen history; decisions go into the topic-keyed registry.
|
|
127
|
-
- Prefer workflow artifacts for pickup decisions, unresolved questions, accepted gaps, and route reasons until the work is accepted.
|
|
79
|
+
Hand `plan-work` the selected references, probe record, provider and baseline summary, decisions, unresolved questions, accepted gaps, expected modified files, conflict risks, sandbox/worktree mode, route reason, and next action. If the record is absent, contradictory, stale without an accepted gap, or not ready, route back to this probe instead of planning.
|
|
128
80
|
|
|
129
|
-
##
|
|
81
|
+
## Drift And Decision Safeguards
|
|
130
82
|
|
|
131
|
-
|
|
83
|
+
Research drift before asking alignment questions. Record `planned_base_ref`, `planned_base_sha`, current target ref/SHA, commits-since, planned age, changed files, and intersections with `planning_scope_refs`. Classify revision freshness as `fresh`, `drifted`, or `stale`, and material drift as `no_material_drift`, `scope_drift`, `dependency_drift`, `contract_drift`, or `conflict_risk`.
|
|
132
84
|
|
|
133
|
-
-
|
|
134
|
-
- pull-work artifact path
|
|
135
|
-
- pickup Probe record path or section
|
|
136
|
-
- provider state summary
|
|
137
|
-
- planned-base drift summary and drift classification
|
|
138
|
-
- accepted gaps
|
|
139
|
-
- expected modified files
|
|
140
|
-
- conflict risks
|
|
141
|
-
- sandbox/worktree mode
|
|
142
|
-
- route reason and next action
|
|
85
|
+
`drifted` may proceed only with a recorded decision or accepted gap. `stale` routes to `idea-to-backlog`. Missing `planned_base_sha` is `NOT_VERIFIED`, never implicitly fresh; an accepted fallback must name the current target ref/SHA plus provider history. When the Builder Probe shape supports resolution hints, record `gap_id: revision_freshness_not_verified`, `claim_id: planning.baseline.current`, the required evidence, and `resolve_at: pickup-probe`.
|
|
143
86
|
|
|
144
|
-
|
|
87
|
+
Challenge existing domain vocabulary before creating terms. A durable decision follows the probe docs-write contract and topic-keyed decision registry; never propose a numbered ADR. Link the probe artifact as provenance. Create a context file only when a resolved reusable term has no existing home.
|
|
@@ -1,216 +1,82 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: "plan-work"
|
|
3
|
-
description: "Code planning primitive
|
|
3
|
+
description: "Code planning primitive that turns a goal and directory into a structured implementation plan."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Plan
|
|
6
|
+
# Plan Work
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Turn a bounded goal into an execution-ready plan. This skill plans; it does not implement or resume a Builder run.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Role And Binding
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
- **Role:** canonical Builder build-step producer and standalone planning primitive.
|
|
13
|
+
- **Binding:** `builder.build` step `plan`.
|
|
14
|
+
- **Produces:** `<slug>--plan-work.md`, `acceptance.json`, `handoff.json`, and `implementation-plan` for an active matching run.
|
|
15
|
+
- **Standalone no-run behavior:** return a plan artifact without starting a Builder run, recording Builder evidence, or claiming the Builder prefix completed.
|
|
15
16
|
|
|
16
17
|
## Model Routing
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
passes the resolved model explicitly — turning a goal into a plan needs design
|
|
21
|
-
latitude, so it routes to the design tier. See
|
|
22
|
-
`context/contracts/execution-contract.md` § Delegation: Model Routing. Fallback:
|
|
23
|
-
inherit the session model when datum/config is absent, noted in the artifact.
|
|
19
|
+
Delegate codebase analysis and plan writing to `tool-planner`. Resolve `delegate-design` from `.datum/config.json`; when unavailable, inherit the session model and record the fallback.
|
|
20
|
+
Apply the routing and escalation contract in `context/contracts/execution-contract.md`.
|
|
24
21
|
|
|
25
|
-
##
|
|
22
|
+
## Provider Boundaries
|
|
26
23
|
|
|
27
|
-
|
|
24
|
+
For provider-backed planning, consume context supplied by `WorkItemProvider`, `BoardProvider`, `RepositoryAdapter`, and `AssignmentProvider`. Do not assume a GitHub issue, pull request, branch convention, or provider-specific API. GitHub may be an optional adapter example only.
|
|
28
25
|
|
|
29
|
-
##
|
|
26
|
+
## Inputs
|
|
30
27
|
|
|
31
|
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
- `context/contracts/sandbox-policy.md`
|
|
35
|
-
|
|
36
|
-
This skill owns orchestration. The contracts own the required artifact shape, Definition Of Done, acceptance criteria, sandbox mode, evidence expectations, and stop-short risk rules.
|
|
37
|
-
|
|
38
|
-
## Pre-Planning: Research
|
|
39
|
-
|
|
40
|
-
Before delegating to tool-planner, check if the goal can be solved with existing tools or libraries:
|
|
41
|
-
1. Search the current codebase for similar functionality
|
|
42
|
-
2. If the goal involves adding new capabilities, invoke the search-first skill
|
|
43
|
-
3. Pass research findings to tool-planner as additional context
|
|
44
|
-
|
|
45
|
-
**Survey existing concepts before designing new ones.** Before the plan introduces a new
|
|
46
|
-
artifact, schema, type, data shape, status, or derivation/algorithm, check what the project's
|
|
47
|
-
**dependencies and contracts already define** — not just the local codebase. Inspect exported
|
|
48
|
-
types, schemas, and builders from dependencies (e.g. `@kontourai/*` packages and vendored
|
|
49
|
-
schemas) and the resource/data contracts under `context/contracts/`. Prefer **consuming the
|
|
50
|
-
canonical concept over inventing a parallel one**: follow existing patterns, understand the
|
|
51
|
-
dependency surface, and leverage existing concepts. If a planned shape resembles a dependency's
|
|
52
|
-
existing concept, consume theirs and record which one. This operationalizes the consume-never-fork
|
|
53
|
-
guardrail of ADR 0008 and ADR 0010 at planning time — the cheapest place to catch a fork.
|
|
54
|
-
|
|
55
|
-
Skip the codebase-similarity search for pure bug-fix/refactor goals, but still apply the
|
|
56
|
-
survey-existing-concepts check whenever the plan would add a new shape or algorithm.
|
|
57
|
-
|
|
58
|
-
## Input
|
|
59
|
-
|
|
60
|
-
The orchestrator (or user) provides:
|
|
61
|
-
- **Goal**: what to build or change
|
|
62
|
-
- **Directory**: working directory for the codebase
|
|
63
|
-
- **Constraints**: from AGENTS.md, user preferences, conversation context
|
|
64
|
-
- **Session file path** (optional): if part of a larger workflow, the orchestrator passes this
|
|
65
|
-
|
|
66
|
-
Direct `plan-work` remains a standalone planning primitive. Do not require Builder Kit pickup Probe state for ordinary direct planning prompts unless the user is trying to pick up provider-backed backlog work or continue a productized build/delivery workflow.
|
|
28
|
+
- goal, working directory, and user or repository constraints
|
|
29
|
+
- optional selected-work and pickup-probe records for provider-backed work
|
|
30
|
+
- source revision, dependency, acceptance-criteria, sandbox, worktree, and conflict context when available
|
|
67
31
|
|
|
68
|
-
|
|
32
|
+
## Research And Readiness
|
|
69
33
|
|
|
70
|
-
|
|
34
|
+
1. Search the codebase for existing behavior and patterns. Use `search-first` when the work adds a capability that may already exist elsewhere.
|
|
35
|
+
2. Before adding a type, schema, artifact, status, or algorithm, inspect existing contracts and dependency exports. Consume canonical concepts instead of creating parallel ones.
|
|
36
|
+
3. For Builder-backed work, require a fresh pickup record with selected IDs, readiness, grouping decision, decisions or accepted gaps, expected modified files, conflict risks, route reason, and next action. Route a missing or contradictory record to `pickup-probe`.
|
|
37
|
+
4. Carry forward revision freshness, target ref/SHA, planned base, source-scope intersections, dependency state, acceptance-criteria drift, and accepted fallback baseline. A stale or unaccepted unknown baseline stops planning.
|
|
71
38
|
|
|
72
|
-
|
|
39
|
+
## Plan Contract
|
|
73
40
|
|
|
74
|
-
|
|
75
|
-
- `probe_artifact_ref` points to the pickup Probe record
|
|
76
|
-
- selected item ids are present
|
|
77
|
-
- grouping decision is `single-item`, `independent-items`, or `justified-bundle`
|
|
78
|
-
- accepted gaps, expected modified files, conflict risks, route reason, and next action are recorded
|
|
41
|
+
Ask `tool-planner` to produce an implementation plan containing:
|
|
79
42
|
|
|
80
|
-
|
|
43
|
+
- goal, constraints, repository context, source revision, and accepted gaps
|
|
44
|
+
- files or surfaces to change, sequence of work, dependencies, and rollback boundaries
|
|
45
|
+
- `## Definition Of Done`, including stop-short risks and durable documentation target
|
|
46
|
+
- stable acceptance criteria and a mapping from every task or wave to the criteria it supports
|
|
47
|
+
- expected command/test evidence and structured source evidence for behavior changes
|
|
48
|
+
- sandbox mode, escalation conditions, expected modified files, and conflict handling
|
|
49
|
+
- execution handoff and next action
|
|
81
50
|
|
|
82
|
-
|
|
51
|
+
Require evidence that is proportionate to the change and named by the accepted criteria.
|
|
83
52
|
|
|
84
|
-
|
|
53
|
+
## Procedure
|
|
85
54
|
|
|
86
|
-
- `
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
- Builder Kit Probe `resolution_hints` for `revision_freshness_not_verified` when the invocation came through Builder Kit build/deliver/pickup, especially hints for `planning.baseline.current`
|
|
91
|
-
- changed scope intersections with `planning_scope_refs`, contracts, dependencies, expected files, or execution areas
|
|
92
|
-
- dependency freshness and provider state, including blockers, PR links, board/project membership, and any `NOT_VERIFIED` checks
|
|
55
|
+
1. Resolve the artifact location through the host contract when one exists. In an active Builder run, write `<slug>--plan-work.md`, update `acceptance.json` with the stable criteria and evidence plan, and update `handoff.json` with the execution target and next action.
|
|
56
|
+
2. Delegate the goal, directory, constraints, research findings, pickup context, and evidence requirements to `tool-planner`.
|
|
57
|
+
3. Read the returned plan. Send it back for refinement when task-to-criterion traceability, scope, stop-short risks, or evidence expectations are missing.
|
|
58
|
+
4. Present the plan when a user decision is needed; otherwise hand the plan to `execute-plan` only when the caller requests execution.
|
|
93
59
|
|
|
94
|
-
|
|
60
|
+
## Active Builder Evidence
|
|
95
61
|
|
|
96
|
-
|
|
62
|
+
This skill does not create or restamp a Builder run. For an already active `builder.build` `plan` step, confirm the run and record the completed plan through the public interface:
|
|
97
63
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
-
|
|
104
|
-
-
|
|
105
|
-
-
|
|
106
|
-
- any route-back decision already taken or still required
|
|
107
|
-
|
|
108
|
-
## Workflow
|
|
109
|
-
|
|
110
|
-
1. Create session file in `.kontourai/flow-agents/<slug>/` if one wasn't provided:
|
|
111
|
-
- Filename: `<slug>--plan-work.md`
|
|
112
|
-
- `status: planning`, `type: plan-work`
|
|
113
|
-
- Create or update `state.json` (phase `planning`) via `npm run workflow:sidecar -- init-plan`/`ensure-session` — never through a direct Write/Edit tool call (`config-protection.js` blocks that by design)
|
|
114
|
-
- use `npm run workflow:sidecar -- ensure-session --source-request ... --summary ... --criterion ...` when the repository provides it; this also writes `.kontourai/flow-agents/current.json`
|
|
115
|
-
- **Builder Kit build flow**: add `--flow-id builder.build` to the `ensure-session` call when `plan-work` is invoked from `deliver`, from the Builder Kit `build` flow, or from a pick-up-and-build request after `pull-work`. This activates the FlowDefinition-driven path so producers fire and gates enforce on builder.* claims. Do NOT add `--flow-id` for direct/ad-hoc primitive `plan-work` invocations that are not part of a builder-flow.
|
|
116
|
-
2. Delegate to `tool-planner`:
|
|
117
|
-
```
|
|
118
|
-
Goal: <goal>
|
|
119
|
-
Directory: <working directory>
|
|
120
|
-
Constraints: <constraints>
|
|
121
|
-
todo_file: <session file path>
|
|
122
|
-
Workflow artifact root: <path from npm run workflow:sidecar -- current --format path>
|
|
123
|
-
Latest-base confirmation: <current target ref/SHA, revision_freshness, planned base or accepted-gap baseline>
|
|
124
|
-
AC drift findings: <per-AC revalidation, stale assumptions, route-back decisions>
|
|
125
|
-
Evidence expectations: preserve AC ids; require command/test evidence and structured source refs for implementation behavior; require provider/closure `Acceptance Evidence` tables when comments claim behavior
|
|
126
|
-
```
|
|
127
|
-
3. tool-planner explores the codebase and writes the plan to the artifact file:
|
|
128
|
-
- `<session-basename>-plan.md`
|
|
129
|
-
- `acceptance.json` with pending criteria from Definition Of Done
|
|
130
|
-
- `handoff.json` with the execution/user-approval next steps
|
|
131
|
-
- use `npm run workflow:sidecar -- init-plan <artifact> --source-request ... --summary ... --next-action ...` when the repository provides it
|
|
132
|
-
- every acceptance criterion should have a stable id, either in Markdown or mirrored in `acceptance.json`
|
|
133
|
-
- every implementation task/wave should list which acceptance criterion ids it supports
|
|
134
|
-
- acceptance criteria for behavior changes should name expected command/test proof and expected source evidence refs or permalink upgrade expectations
|
|
135
|
-
- `acceptance.json` evidence refs must be structured objects, not legacy strings
|
|
136
|
-
- if task-to-acceptance mapping is unclear, send the planner feedback before presenting the plan as ready
|
|
137
|
-
4. Read the plan artifact
|
|
138
|
-
5. Update session file: paste plan summary into `## Plan`, set `status: planned`
|
|
139
|
-
6. Update `state.json` (`status: planned`, phase `planning`, next action) via `npm run workflow:sidecar -- advance-state` — never through a direct Write/Edit tool call (`config-protection.js` blocks that by design)
|
|
140
|
-
7. For an active Builder Flow run, record the `implementation-plan` gate claim after the plan and structured sidecars are complete:
|
|
141
|
-
```bash
|
|
142
|
-
npm run workflow:sidecar -- record-gate-claim .kontourai/flow-agents/<slug> \
|
|
143
|
-
--expectation implementation-plan \
|
|
144
|
-
--status pass \
|
|
145
|
-
--summary "Implementation plan records files, sequencing, acceptance criteria, and required evidence." \
|
|
146
|
-
--evidence-ref-json '{"kind":"artifact","file":".kontourai/flow-agents/<slug>/<session-basename>-plan.md","summary":"Structured implementation plan with acceptance and evidence traceability."}'
|
|
147
|
-
```
|
|
148
|
-
Use `fail` or `not_verified` instead of `pass` when the plan contract is not satisfied. The sidecar writer synchronizes Flow; Flow, not this skill, decides whether execution is now active.
|
|
149
|
-
8. Present the plan to the user
|
|
150
|
-
9. If the user wants changes, re-delegate to tool-planner with feedback
|
|
151
|
-
|
|
152
|
-
Never rely on conversational memory for the slug. Resolve the active artifact with `npm run workflow:sidecar -- current --format path` and pass that path to delegated agents.
|
|
153
|
-
|
|
154
|
-
## Definition Of Done Contract
|
|
155
|
-
|
|
156
|
-
Every plan artifact must include the `## Definition Of Done` defined in `context/contracts/planning-contract.md`, including `Stop-short risks` and `Durable docs target`. If the goal is exploratory or uncertain, the plan must still name what the user should be able to take away from the work. Do not let acceptance criteria stop at implementation tasks.
|
|
157
|
-
|
|
158
|
-
Every non-trivial implementation plan must include traceability from requirements to acceptance criteria to execution tasks. At minimum, acceptance criteria need stable ids and each wave/task needs a `Supports:` line referencing those ids. Loose wave names without criterion references are not execution-ready.
|
|
159
|
-
|
|
160
|
-
Every behavior-changing plan must also include evidence traceability expectations. The Definition Of Done should tell workers and verifiers which command/test evidence is expected and which source evidence refs should support claimed behavior. Source refs use the structured evidence ref object from `context/contracts/artifact-contract.md`; before publication they may be local file/line/excerpt refs, and provider-facing comments should upgrade them to immutable GitHub blob permalinks pinned to a commit SHA when available. Plans that expect provider, PR, issue, closure, or final acceptance comments must require an `Acceptance Evidence` table with columns `AC id`, `Status`, `Command/Test Evidence`, `Source Evidence / Permalinks`, and `Gaps`.
|
|
161
|
-
|
|
162
|
-
Every plan artifact must also record `Sandbox mode` using `context/contracts/sandbox-policy.md`. If the needed mode is unclear, choose the smallest safe mode for the plan and list the escalation condition that would require a stronger boundary.
|
|
163
|
-
|
|
164
|
-
## Structured Sidecars
|
|
165
|
-
|
|
166
|
-
Follow `context/contracts/artifact-contract.md` and `context/contracts/planning-contract.md`.
|
|
167
|
-
|
|
168
|
-
When `npm run workflow:sidecar --` exists, structured sidecars are not optional ceremony. Use the writer commands above, then validate the artifact directory when local validation is available. If the writer is unavailable or blocked, preserve the exact blocker in the Markdown artifact as a `NOT_VERIFIED` gap.
|
|
169
|
-
|
|
170
|
-
Planning owns:
|
|
171
|
-
|
|
172
|
-
- `state.json`: current phase/status and next action
|
|
173
|
-
- `acceptance.json`: criteria from the Definition Of Done, initially `pending`
|
|
174
|
-
- `handoff.json`: summary and execution/user-approval next steps
|
|
175
|
-
|
|
176
|
-
If a target harness cannot write sidecars, record `NOT_VERIFIED` or an explicit gap in the session file instead of pretending the structured state exists.
|
|
177
|
-
|
|
178
|
-
## Session File Format
|
|
179
|
-
|
|
180
|
-
```markdown
|
|
181
|
-
# <Goal one-liner>
|
|
182
|
-
|
|
183
|
-
branch: <branch>
|
|
184
|
-
worktree: <worktree>
|
|
185
|
-
created: <date>
|
|
186
|
-
status: planning | planned
|
|
187
|
-
type: plan-work
|
|
188
|
-
|
|
189
|
-
## Plan
|
|
190
|
-
|
|
191
|
-
Structured plan from tool-planner (pasted from artifact).
|
|
192
|
-
|
|
193
|
-
## Definition Of Done
|
|
194
|
-
|
|
195
|
-
Copied from the plan artifact. This is the stop condition for delivery.
|
|
64
|
+
```bash
|
|
65
|
+
flow-agents workflow status --session-dir <session-dir>
|
|
66
|
+
flow-agents workflow evidence --session-dir <session-dir> \
|
|
67
|
+
--expectation implementation-plan --status pass \
|
|
68
|
+
--summary "Implementation plan records scope, sequencing, acceptance criteria, and required evidence." \
|
|
69
|
+
--evidence-ref-json '{"kind":"artifact","file":"<session-dir>/<slug>--plan-work.md","summary":"Execution-ready plan with Definition Of Done and task-to-criterion mapping."}' \
|
|
70
|
+
--evidence-ref-json '{"kind":"artifact","file":"<session-dir>/acceptance.json","summary":"Stable acceptance criteria and evidence requirements."}' \
|
|
71
|
+
--evidence-ref-json '{"kind":"artifact","file":"<session-dir>/handoff.json","summary":"Execution handoff, route reason, and next action."}'
|
|
196
72
|
```
|
|
197
73
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
## Output
|
|
74
|
+
Use `fail` or `not_verified` when the plan is incomplete or cannot be evidenced. Do not enter `builder.build` at this step directly and do not use private writer commands.
|
|
201
75
|
|
|
202
|
-
|
|
203
|
-
- Plan artifact: `<session-basename>-plan.md`
|
|
204
|
-
- Structured sidecars: `state.json`, `acceptance.json`, and `handoff.json`
|
|
205
|
-
- The plan artifact is the source of truth — tool-worker agents read it directly
|
|
206
|
-
- Plan artifact follows `context/contracts/planning-contract.md`
|
|
76
|
+
## Baseline And Evidence Safeguards
|
|
207
77
|
|
|
208
|
-
|
|
78
|
+
Follow `context/contracts/planning-contract.md`, `context/contracts/artifact-contract.md`, and `context/contracts/sandbox-policy.md`. In an active Builder run, consume the recorded pickup Probe decisions, accepted gaps, expected modified files, conflict risks, grouping decision, route reason, and `revision_freshness`; direct standalone planning does not require Builder-specific Probe state.
|
|
209
79
|
|
|
210
|
-
|
|
80
|
+
For provider-backed work, require the current target ref/SHA and revalidate each upstream AC id against drift. Record stale assumptions. Missing `planned_base_sha` is never fresh. If baseline freshness is missing or `NOT_VERIFIED`, stop unless an accepted fallback baseline names the current target ref/SHA plus provider history. `stale` shaped work routes to `idea-to-backlog`; missing pickup decisions route to `pickup-probe`.
|
|
211
81
|
|
|
212
|
-
|
|
213
|
-
run enters through `pull-work`, then `design-probe`; Flow advances it to `plan` only after
|
|
214
|
-
the declared upstream gates pass. When `plan-work` is invoked directly outside that
|
|
215
|
-
product workflow, run it as a standalone primitive without `--flow-id builder.build` and
|
|
216
|
-
do not report the omitted Builder prefix as complete.
|
|
82
|
+
Behavior-changing plans require structured evidence ref objects and an `Acceptance Evidence` table mapping AC ids to command/test evidence, source evidence, and gaps. A plan must not be handed to execution when Definition Of Done, Stop-short risks, Durable docs target, sandbox mode, or task-to-AC traceability is missing.
|