okstra 0.205.1 → 0.206.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 (50) hide show
  1. package/dist/commands/lifecycle/install.mjs +1 -0
  2. package/dist/commands/lifecycle/install.mjs.map +1 -1
  3. package/docs/architecture.md +6 -6
  4. package/docs/contributor-change-matrix.md +2 -2
  5. package/docs/project-structure-overview.md +8 -5
  6. package/package.json +2 -3
  7. package/runtime/BUILD.json +2 -2
  8. package/runtime/prompts/lead/okstra-lead-contract.md +1 -1
  9. package/runtime/prompts/lead/phase-routing.md +18 -0
  10. package/runtime/python/okstra_ctl/contract_graph.py +75 -10
  11. package/runtime/python/okstra_ctl/doctor.py +13 -3
  12. package/runtime/python/okstra_ctl/implementation_direction.py +9 -8
  13. package/runtime/python/okstra_ctl/next_phase.py +2 -2
  14. package/runtime/python/okstra_ctl/paths.py +14 -0
  15. package/runtime/python/okstra_ctl/phases/__init__.py +4 -0
  16. package/runtime/python/okstra_ctl/phases/catalog.py +216 -0
  17. package/runtime/python/okstra_ctl/phases/final_verification/__init__.py +4 -0
  18. package/runtime/python/okstra_ctl/phases/final_verification/entry.py +166 -0
  19. package/runtime/{prompts/profiles/final-verification.md → python/okstra_ctl/phases/final_verification/profile.md} +4 -4
  20. package/runtime/python/okstra_ctl/{report_html/view_models/final_verification.py → phases/final_verification/report.py} +12 -3
  21. package/{docs/task-process/final-verification.md → runtime/python/okstra_ctl/phases/final_verification/spec.md} +42 -25
  22. package/runtime/python/okstra_ctl/phases/final_verification/target.py +296 -0
  23. package/runtime/python/okstra_ctl/phases/final_verification/validation.py +190 -0
  24. package/runtime/python/okstra_ctl/phases/final_verification/wizard.py +38 -0
  25. package/runtime/python/okstra_ctl/profile_show.py +7 -1
  26. package/runtime/python/okstra_ctl/render_final_report.py +3 -2
  27. package/runtime/python/okstra_ctl/report_assembly.py +3 -3
  28. package/runtime/python/okstra_ctl/report_html/render.py +3 -2
  29. package/runtime/python/okstra_ctl/report_html/router.py +9 -33
  30. package/runtime/python/okstra_ctl/report_template_loader.py +35 -0
  31. package/runtime/python/okstra_ctl/report_views.py +17 -1
  32. package/runtime/python/okstra_ctl/run.py +46 -154
  33. package/runtime/python/okstra_ctl/stage_targets.py +9 -286
  34. package/runtime/python/okstra_ctl/user_response.py +199 -4
  35. package/runtime/python/okstra_ctl/verification_target.py +1 -1
  36. package/runtime/python/okstra_ctl/wizard/state.py +6 -2
  37. package/runtime/python/okstra_ctl/wizard/steps_plan.py +17 -15
  38. package/runtime/skills/okstra-user-response/SKILL.md +23 -4
  39. package/runtime/validators/validate-run.py +22 -185
  40. package/docs/task-process/README.md +0 -82
  41. package/docs/task-process/common-flow.md +0 -173
  42. package/docs/task-process/error-analysis.md +0 -103
  43. package/docs/task-process/implementation-option-selection.md +0 -70
  44. package/docs/task-process/implementation-planning.md +0 -180
  45. package/docs/task-process/implementation.md +0 -226
  46. package/docs/task-process/release-handoff.md +0 -220
  47. package/docs/task-process/requirements-discovery.md +0 -113
  48. /package/runtime/{prompts/profiles/final-verification.json → python/okstra_ctl/phases/final_verification/profile.json} +0 -0
  49. /package/runtime/{templates/reports/html/tasks → python/okstra_ctl/phases/final_verification/report_assets}/final-verification.template.html +0 -0
  50. /package/runtime/{templates/reports/md/tasks → python/okstra_ctl/phases/final_verification/report_assets}/final-verification.template.md +0 -0
@@ -1,226 +0,0 @@
1
- # implementation process
2
-
3
- ## Index
4
-
5
- - [1. Purpose](#1-purpose)
6
- - [2. okstra-run wizard flow](#2-okstra-run-wizard-flow)
7
- - [Carry-in](#carry-in)
8
- - [3. runtime gate](#3-runtime-gate)
9
- - [3.1 design-preparation preflight](#31-design-preparation-preflight)
10
- - [4. executor and verifier](#4-executor-and-verifier)
11
- - [5. stage and consumers](#5-stage-and-consumers)
12
- - [6. Deliverables](#6-deliverables)
13
- - [7. Forbidden actions](#7-forbidden-actions)
14
- - [8. Verified code](#8-verified-code)
15
-
16
- ## 1. Purpose
17
-
18
- `implementation` executes an approved `implementation-planning` final report into actual code changes and local commits. Source edit is allowed only in this phase, but scope is limited to the approved plan and recorded out-of-plan justification.
19
-
20
- ## 2. okstra-run wizard flow
21
-
22
- ```mermaid
23
- flowchart TD
24
- Start[/okstra-run/] --> Common[common task identity flow]
25
- Common --> Type[task-type = implementation]
26
- Type --> Worktree{active task worktree?}
27
- Worktree -->|yes| PlanPick[approved plan pick/text]
28
- Worktree -->|no| BaseRef[base-ref pick/text]
29
- BaseRef --> PlanPick
30
- PlanPick --> Approved{APPROVED marker present?}
31
- Approved -->|no| Retry[re-prompt same step]
32
- Approved -->|yes| Stage[stage multi-pick<br/>ready/active markers]
33
- Stage --> Chain[render-args<br/>stage + chain-stages]
34
- Chain --> RoleCount[role-count min..max<br/>omit uses recommended; skip if min==max]
35
- RoleCount --> RoleModel[role-model provider/model per slot]
36
- RoleModel --> RoleAdd[min=0 roles via role-add only<br/>default skip]
37
- RoleAdd --> Extras[directive, related tasks, clarification]
38
- Extras --> Confirm
39
- Confirm --> Render[render-bundle]
40
- ```
41
-
42
- Launch selection uses role slots and model refs only: current-session lead is this session (listed on the confirmation summary), then each static role's count in `min..max` (default **recommended**; the count step is skipped when `min == max`), then one `provider/model` per slot. Roles with `min = 0` stay closed unless the user opens them with role-add (default skip). Duplicate model refs in the same role are rejected. There is no provider roster multi-pick and no defaults-vs-customize fork. `executor` is only a compatibility alias for `implementer` in model refs; implementer slots are chosen through role-count / role-model. Dynamic verifiers are not chosen at launch. `--workers` is a CLI compatibility input only, not a launch picker. `stage_pick` is a multi-pick that shows done/in-progress/ready/waiting status. The selected stage set goes through dependency closure and topological sort into a `chain-stages` CSV, and each actual run executes only one of those stages.
43
-
44
- The current okstra-run wizard path does not expose `--approve` that directly flips the approval checkbox. The plan file must already have a recognized approval marker.
45
-
46
- ## Carry-in
47
-
48
- Three facts about what reaches an implementation run from its approved plan, gathered
49
- here because they were previously readable only by tracing the runtime sources.
50
-
51
- - **What is attached automatically.** The user's answers to the approved plan's `## 1.
52
- Clarification Items` rows — the `user-response-*.md` sidecars under
53
- `runs/implementation-planning/user-responses/`, a sibling of the directory holding the
54
- plan itself — are collected into `instruction-set/clarification-response.md`. Those
55
- sidecars are written by the user, not by the report renderer. The report HTML's `Export
56
- user response` button downloads a file the user then saves there. The in-session flow
57
- reads `user-response list-view` and `user-response show-view --report <path>
58
- --project-root <root>`, then uses `user-response begin`, typed `user-response answer`
59
- and decision commands, and `user-response finalize` to publish the sidecar. The
60
- renderer at most pre-creates that directory empty so the user does not
61
- have to; it never puts a sidecar in it.
62
- The plan document is *not* copied: it reaches the run as the `--approved-plan` path and
63
- the executor re-reads it there. An explicit `--clarification-response` wins when given;
64
- the automatic attachment is the fallback for an implementation run that supplies none
65
- (`scripts/okstra_ctl/run.py`, the `implementation` carry-in branch).
66
- - **Who reads it, and when.** The executor, before its first edit
67
- (`prompts/profiles/_implementation-executor.md`). A CLI executor (codex/antigravity)
68
- cannot reach that path from inside its sandbox, so the lead transcribes the file's body
69
- into the dispatched executor prompt — a path reference alone never arrives.
70
- - **What happens when an answer contradicts the plan.** Each answer is an authoritative
71
- refinement of its matching row's scope, but an answer that contradicts the approved plan
72
- or expands scope beyond it is a re-plan trigger: it routes to a new
73
- `implementation-planning` run rather than being absorbed silently mid-run. Quietly
74
- widening scope inside an implementation run is what this branch exists to prevent.
75
-
76
- ## 3. runtime gate
77
-
78
- ```mermaid
79
- sequenceDiagram
80
- participant W as okstra-run
81
- participant P as prepare_task_bundle
82
- participant Plan as approved final-report
83
- participant QA as project.json qaCommands
84
- participant Stage as stage target policy
85
- participant Reg as worktree registry
86
- participant WT as stage worktree
87
-
88
- W->>P: task-type=implementation, approved-plan, stage, executor
89
- P->>Plan: file exists?
90
- P->>Plan: approval marker regex matches?
91
- P->>Plan: unresolved Blocks=approval rows?
92
- P->>Stage: build Stage Lifecycle Snapshot
93
- P->>Reg: read active stage-key reservations
94
- P->>Stage: select exactly one ready stage
95
- P->>Plan: resolve selected stage design preparation
96
- P->>WT: provision stage-N worktree + branch
97
- P->>QA: validate qaCommands deny-list
98
- P->>P: executor provider in resolved roster?
99
- P->>P: namespace run artifacts under stage-N
100
- P-->>W: prepared implementation prompt or PrepareError
101
- ```
102
-
103
- `--approve` exists in the Python runtime, but the okstra-run wizard does not emit it as args. On the shell path, `--approve` sets the report record `frontmatter.approved` to `true` and then follows the same validation path.
104
-
105
- ### 3.1 design-preparation preflight
106
-
107
- Right after stage selection, before worktree provisioning and appending `status:"started"` to `consumers.jsonl`, it resolves the design preparation of the approved plan. The resolver reads only items whose `stageRefs` includes the selected stage, so an undecided decision in another stage does not block the current run.
108
-
109
- | outcome | runtime behavior |
110
- |---|---|
111
- | `proceed` | Inject the effective AI proposal, confirmed override, guardrail, and provisional working assumption into the executor prompt as `DESIGN_PREP_CONTEXT`, and create the worktree. |
112
- | `wait_for_input` | Stop with `stage <N> waits for design input: ...; <request paths>`. Do not create the worktree or the started consumer row. |
113
- | `replan` | Stop with `stage <N> requires implementation-planning rerun: ...`. Let a newly approved/edited decision change the planning snapshot or the Stage Map. |
114
-
115
- `ready`, `not-applicable`, and `no-design-inputs` proceed. `provisional` can proceed even without a response because there is a safe working assumption, and a non-triggering approval/edit states that assumption and override in the prompt. A `blocked` non-response makes only that stage wait, and when a blocked draft is approved/edited, it replans so that authorization is reflected into the approved plan. A markerless legacy plan proceeds with a `legacy-unassessed` warning without modifying the report.
116
-
117
- `manual-user-test` input uses the same flexible status. The planning draft is a seed for implementation to concretize the verification method against the actual diff, and the SSOT of the final execution method is the implementation report's `implementation.manualUserTest`. final-verification does not directly execute the planning sidecar.
118
-
119
- Tier 3 conformance uses the same ownership boundary during execution and
120
- verification.
121
-
122
- | Entry policy | PASS | FAIL / MISSING / unavailable |
123
- |---|---|---|
124
- | `requires` contains `db`, `http`, or `external` | Evidence recorded | Advisory; user rerun method recorded; run continues |
125
- | `requires=[]` or `requires=[io]` | Evidence recorded | Blocking |
126
-
127
- These outcomes are enforced by
128
- `scripts/okstra_ctl/conformance.py::decide_conformance_gate` and
129
- `validators/validate-run.py::_validate_conformance`.
130
-
131
- ## 4. executor and verifier
132
-
133
- ```mermaid
134
- flowchart TD
135
- Lead[Okstra lead<br/>host native] --> Exec[Executor<br/>selected provider]
136
- Lead --> CV[Claude verifier<br/>read-only]
137
- Lead --> XV[Codex verifier<br/>read-only]
138
- Lead --> GV{Antigravity in roster?}
139
- GV -->|yes| Gem[Antigravity verifier<br/>read-only]
140
- Exec --> Diff[Source edits + local commits]
141
- CV --> QA[Independent QA rerun]
142
- XV --> QA
143
- Gem --> QA
144
- QA --> External{External Tier 3<br/>non-PASS?}
145
- External -->|yes| Advisory[ADVISORY<br/>user-owned rerun]
146
- External -->|no| Verdict[PASS / CONCERNS / FAIL]
147
- Advisory --> Report
148
- Verdict --> Report[Final report preserves dissent]
149
- ```
150
-
151
- Only the executor may mutate project files. The verifier independently re-runs the diff and validation command read-only in the same worktree. Even a verifier with the same provider as the executor runs again in a separate fresh CLI session. This is to prevent a structure where the same session approves a diff the same session wrote.
152
-
153
- ## 5. stage and consumers
154
-
155
- ```mermaid
156
- flowchart LR
157
- Plan[approved plan<br/>Stage Map] --> Parse[parse stage map]
158
- Parse --> Snapshot[Stage Lifecycle Snapshot<br/>carry + consumers + reservations]
159
- Snapshot --> Resolve{stage arg}
160
- Resolve -->|auto| Next[lowest ready<br/>not done/started/reserved]
161
- Resolve -->|number| Forced[selected stage]
162
- Next --> Prep{selected-stage<br/>design preflight}
163
- Forced --> Prep
164
- Prep -->|proceed| Base[resolve stage base commit]
165
- Prep -->|wait / replan| Stop[stop before worktree<br/>and started consumer]
166
- Base --> WT[create/reuse stage worktree]
167
- WT --> Started[append consumer status=started]
168
- Started --> Run[implementation executes one selected stage]
169
- ```
170
-
171
- Stage selection is `auto` or a number. If `--stage` comes from another task-type, it is a `PrepareError`. The runtime reads `done`/`started` of `consumers.jsonl`, carry sidecar backfill, and the active stage-key of the registry together in the Stage Lifecycle Snapshot, and excludes occupied stages. The Snapshot is not a new stored file but a read-side view of `stage_targets.py`.
172
-
173
- The stage worktree base is decided by dependency shape. An independent stage uses the task-key worktree HEAD fixed at first implementation entry as its anchor, and a single-dependency stage branches from the predecessor stage's done `head_commit`. A multi-dependency stage branches from a commit holding exactly its predecessors: the predecessor commit that already contains the others, or else an integration branch merging them (`<work-category-namespace>/<task-id-segment>-g<n1>-<n2>`). okstra creates that branch itself, so a predecessor that has not been merged into the task branch no longer blocks the stage; release-handoff later reuses the same branch as that stage's PR base.
174
-
175
- ## 6. Deliverables
176
-
177
- ```mermaid
178
- flowchart TD
179
- Code[Commits] --> Report[implementation final report]
180
- Diff[git diff --stat base..HEAD] --> Report
181
- TDD[TDD evidence] --> Report
182
- Validation[Validation evidence<br/>actual output + exit code] --> Report
183
- Verifiers[Verifier results<br/>command logs + verdicts] --> Report
184
- Rollback[Rollback verification] --> Report
185
- Report --> Next[Routing recommendation<br/>final-verification or loop back]
186
- ```
187
-
188
- The final report requires at least the following.
189
-
190
- - approved plan path and quoted approval marker
191
- - selected stage, isolated stage worktree path, run artifact path (`runs/implementation/stage-<N>/`)
192
- - commit SHA, message, plan step mapping
193
- - diff summary and per-file summary
194
- - out-of-plan edits block
195
- - actual stdout/stderr and exit code of the plan validation command
196
- - TDD failing-then-passing evidence
197
- - per-verifier independent validation rerun result
198
- - `carry/stage-<N>.json` evidence sidecar and `consumers.jsonl` started/done row
199
- - rollback verification
200
- - `implementation.manualUserTest` finalized against the actual diff and whether it is executable
201
- - follow-up tasks table
202
-
203
- ## 7. Forbidden actions
204
-
205
- ```mermaid
206
- flowchart TD
207
- Impl[implementation] --> Allowed[local edit/write/build/test/git add/git commit]
208
- Impl -. forbidden .-> Push[git push]
209
- Impl -. forbidden .-> Publish[publish/release/deploy]
210
- Impl -. forbidden .-> RealDB[source migration or<br/>shared/staging/prod datastore write]
211
- Impl -. forbidden .-> VerifierWrite[verifier edit/write]
212
- Impl -. forbidden .-> Scope[silent scope expansion]
213
- Impl -. forbidden .-> Acceptance[declaring final acceptance]
214
- ```
215
-
216
- This phase does not declare final acceptance. It says only ready for final-verification or needs new loop.
217
-
218
- ## 8. Verified code
219
-
220
- - [`prompts/profiles/implementation.md`](../../prompts/profiles/implementation.md)
221
- - [`templates/reports/implementation-input.template.md`](../../templates/reports/implementation-input.template.md)
222
- - [`scripts/okstra_ctl/run.py`](../../scripts/okstra_ctl/run.py)
223
- - [`scripts/okstra_ctl/wizard/`](../../scripts/okstra_ctl/wizard/)
224
- - [`validators/validate-implementation-plan-stages.py`](../../validators/validate-implementation-plan-stages.py)
225
- - [`scripts/okstra_ctl/qa_commands.py`](../../scripts/okstra_ctl/qa_commands.py)
226
- - [`prompts/lead/okstra-lead-contract.md`](../../prompts/lead/okstra-lead-contract.md)
@@ -1,220 +0,0 @@
1
- # release-handoff process
2
-
3
- ## Index
4
-
5
- - [1. Purpose](#1-purpose)
6
- - [2. okstra-run wizard flow](#2-okstra-run-wizard-flow)
7
- - [3. prepare stage](#3-prepare-stage)
8
- - [4. entry gate](#4-entry-gate)
9
- - [5. lead-only execution flow](#5-lead-only-execution-flow)
10
- - [6. PR template resolution](#6-pr-template-resolution)
11
- - [7. Deliverables](#7-deliverables)
12
- - [8. Forbidden actions](#8-forbidden-actions)
13
- - [9. Verified code](#9-verified-code)
14
-
15
- ## 1. Purpose
16
-
17
- `release-handoff` is the terminal phase that pushes already-committed implementation stages with a release-ready verdict, or hands them off as pull requests. **One stage is one PR.** The PR head is that stage's stack branch; the base comes from its `depends-on` — the release base for a stage with no live dependency, the predecessor's branch for a stage with one (a stacked PR), and a branch merging the predecessors for a stage with several. The only commits this phase may create are the merge commits `okstra handoff pr-plan` makes on such a merge-base branch.
18
-
19
- Because the PRs are a stack, they must be merged in ascending stage order with a merge commit or a rebase-merge. A squash replaces the commits the next PR's base points at, so the stack breaks — every PR body states this, and the lead never merges.
20
-
21
- This phase has no worker dispatch. It does not use a provider or report-writer roster; the host-native Okstra lead performs git/gh inspection, user questions, the PR draft, and the final report inline.
22
-
23
- ## 2. okstra-run wizard flow
24
-
25
- ```mermaid
26
- flowchart TD
27
- Start[/okstra-run/] --> Common[common task identity flow]
28
- Common --> Type[task-type = release-handoff]
29
- Type --> Plan[approved plan auto/pick]
30
- Plan --> Scope[handoff stage pick<br/>eligible stages, one PR each]
31
- Scope --> Worktree{active task worktree?}
32
- Worktree -->|yes| RoleCount[role-count min..max<br/>omit uses recommended; skip if min==max]
33
- Worktree -->|no| BaseRef[base-ref pick/text]
34
- BaseRef --> RoleCount
35
- RoleCount --> RoleModel[role-model provider/model per slot]
36
- RoleModel --> RoleAdd[min=0 roles via role-add only<br/>default skip]
37
- RoleAdd --> Extras[directive, related tasks, clarification]
38
- Extras --> Template[PR template override?]
39
- Template --> TemplateScope[save template to project/global?]
40
- TemplateScope --> Confirm[confirmation]
41
- Confirm --> Render[render-bundle]
42
- ```
43
-
44
- `release-handoff` has no analysis-worker dispatch. Launch selection still shows any applicable role-count / role-model steps; current-session lead is this session and is listed on the confirmation summary. There is no provider roster multi-pick and no `Use defaults / Customize` fork. Dynamic verifiers are not chosen at launch. `--workers` is not a launch picker, and the runtime forces the worker list to empty. The wizard outcome's `renderArgs` includes `pr-template-path` only for release-handoff. Scope selection finishes before prepare, and the project/global save runs before `render-bundle` via the `config.set pr-template-path` action of `outcome.persistActions[]`. Only the stages that were marked `verified` by a release-ready verification in the Stage Lifecycle Snapshot and are not yet covered by a `pr` become candidates; leaving `--stages` empty takes all of them, and the wizard picker offers an all-stages option beside the individual ones. Both verification scopes mark a stage: a single-stage report marks its own stage, and a whole-task report marks every stage in its `stageReports` whose completed commit the verified head contains.
45
-
46
- Note that this phase is also a target of task worktree provisioning. The normal flow reuses the implementation/final-verification result of the same task-key. Starting a new task may create a new branch, and it is likely to be blocked at the entry gate's "implementation commit exists" condition.
47
-
48
- ## 3. prepare stage
49
-
50
- ```mermaid
51
- sequenceDiagram
52
- participant W as okstra-run
53
- participant P as prepare_task_bundle
54
- participant T as PR template resolver
55
- participant WT as worktree registry
56
- participant FS as task artifacts
57
-
58
- W->>P: task-type=release-handoff, approved-plan, stages csv, optional pr-template-path
59
- P->>P: enforce stage eligibility (Stage Lifecycle Snapshot)
60
- P->>FS: generate release-handoff-input.md (cited verification reports)
61
- P->>P: force workers=[]
62
- P->>T: resolve PR template
63
- P->>WT: reuse or provision task worktree
64
- P->>FS: write manifests with empty roster
65
- P->>FS: expose PR_TEMPLATE_PATH and PR_TEMPLATE_SOURCE
66
- P-->>W: lead prompt for current session
67
- ```
68
-
69
- The profile has no `Required workers:` block, and `run.py` also empties the worker override for `release-handoff`. So not going through the general TeamCreate / convergence / report-writer flow of `prompts/lead/okstra-lead-contract.md` is the intended behavior.
70
-
71
- ## 4. entry gate
72
-
73
- ```mermaid
74
- flowchart TD
75
- Brief[release-handoff-input.md<br/>generated by prepare] --> Source{Source Verification Report present?}
76
- Source -->|no| Block[blocked<br/>route final-verification]
77
- Source -->|yes| Verdict{Verdict Token == accepted?}
78
- Verdict -->|no| Block
79
- Verdict -->|yes| Eligible[each selected stage<br/>verified and not in PR]
80
- Eligible --> Status{git status --short clean?}
81
- Status -->|no| Dirty[blocked<br/>dirty tree]
82
- Status -->|yes| Commits{each stage has commits<br/>over its own base?}
83
- Commits -->|no| ImplBlock[blocked<br/>route implementation]
84
- Commits -->|yes| Ready[handoff questions may begin]
85
- ```
86
-
87
- Before asking the user whether to push/PR, the lead confirms the following.
88
-
89
- - The `## Source Verification Report` of the input document (`release-handoff-input.md`) generated by prepare lists the selected stages (`HANDOFF_STAGES`) and the cited report table. The brief is the input of the entry phase, so it does not exist in release-handoff — the user's stage selection finishes before prepare via the wizard `handoff_stage_pick` or the CLI `--stages` (empty takes every eligible stage).
90
- - Each cited report must be the latest validated execution for the run it belongs to — the stage's own run for a single-stage report, the task's run for a whole-task one — and must match the recorded implementation commit. A newer unfinished, broken, or blocked execution prevents fallback to an older success. Prepare and `okstra handoff pr-plan` re-check this evidence. A new implementation start or completion invalidates the earlier approval.
91
- - The working tree is clean.
92
- - The current branch is recorded as evidence, not used as a PR head: every head comes from `okstra handoff pr-plan`. A release base branch such as `main`, `master`, `prod`, `preprod`, `staging`, or `dev` is never pushed.
93
- - Each stage's `<base_commit>..<head_commit>` range is non-empty.
94
-
95
- `accepted` is release-ready. `conditional-accept` is release-ready only when its non-empty condition list explicitly sets every `blocksReleaseHandoff` to `false`; those conditions remain in the generated input and PR body. `blocked`, missing conditions, and ambiguous verdicts stop delivery. `okstra_ctl.release_gate.release_handoff_allowed` owns this rule.
96
-
97
- Verification targets are preserved per execution under the run's state directory. Old records without provable task/stage/commit evidence require re-verification; they are not rewritten. The checks are enforced by `okstra_ctl.handoff_verification`, `consumers.verified_accepted_stages`, and the handoff regression tests.
98
-
99
- ## 5. lead-only execution flow
100
-
101
- ```mermaid
102
- stateDiagram-v2
103
- [*] --> Gate: entry gate
104
- Gate --> Q1: action selection
105
- Q1 --> LocalCheckout: local checkout
106
- Q1 --> Skip: skip
107
- Q1 --> Q2: push + PR
108
- state "okstra handoff pr-plan (head/base per stage)" as Plan
109
- Q2 --> Plan: choose release base
110
- Plan --> Probe: rows ready
111
- Probe --> Q3: no conflict
112
- Probe --> Conflict: conflict detected
113
- Conflict --> Q2: change base branch
114
- Conflict --> Q3: proceed anyway
115
- Conflict --> Cancel: cancel
116
- Q3 --> Push: use as-is or edit then proceed
117
- Q3 --> Cancel: cancel
118
- Push --> ReuseOrCreate: push each branch in stage order
119
- ReuseOrCreate --> FinalReport: gh pr list / gh pr create per stage
120
- LocalCheckout --> FinalReport
121
- Skip --> FinalReport
122
- Cancel --> FinalReport
123
- FinalReport --> [*]
124
- ```
125
-
126
- User interaction is exactly three steps.
127
-
128
- 1. Q1 action: `local checkout`, `push + PR`, `skip`
129
- 2. Q2 release base: a branch from the profile menu such as `staging`, `preprod`, `main`, or Enter directly
130
- 3. Q3 PR title/body: every stage's draft in one question — `use as-is`, `edit then proceed`, `cancel`
131
-
132
- The merge-conflict probe happens only for `push + PR`, once per stage against that stage's own base.
133
-
134
- `local checkout` takes one stage and hands that stage's branch to the main worktree; there is no whole-task target.
135
-
136
- ```mermaid
137
- flowchart TD
138
- PushPR[push + PR selected] --> Fetch[git fetch origin chosen-base]
139
- Fetch --> MergeTree[git merge-tree --write-tree<br/>stage head vs its own PR base]
140
- MergeTree --> Conflict{any stage conflicts?}
141
- Conflict -->|no| Draft[show PR draft]
142
- Conflict -->|yes| Ask[ask proceed/change base/cancel]
143
- Ask -->|proceed anyway| Draft
144
- Ask -->|change base branch| Base[return to Q2]
145
- Ask -->|cancel| Report[final report without push/PR]
146
- ```
147
-
148
- The probe must not change the working tree. `git merge`, `git rebase`, and `git pull` are not part of this probe.
149
-
150
- ## 6. PR template resolution
151
-
152
- ```mermaid
153
- flowchart TD
154
- Override[--pr-template-path from wizard] --> Chosen{exists?}
155
- Chosen -->|yes| UseOverride[use override]
156
- Chosen -->|no| Project[project config template]
157
- Project -->|exists| UseProject[use project template]
158
- Project -->|missing| Global[global config template]
159
- Global -->|exists| UseGlobal[use global template]
160
- Global -->|missing| Default[okstra skill default template]
161
- ```
162
-
163
- When the user picks a template on the customize path, the okstra-run skill performs the project/global scope save before render-bundle. The runtime puts the resolved `PR_TEMPLATE_PATH` and `PR_TEMPLATE_SOURCE` into the run context, and the lead reads this file as-is, removes the HTML comments, and fills the placeholders. The section structure must not be hard-coded.
164
-
165
- ## 7. Deliverables
166
-
167
- ```mermaid
168
- flowchart TD
169
- Verdict[Source Verification Report<br/>accepted token] --> Report[release-handoff final report]
170
- State[feature branch + clean status] --> Report
171
- User[Q1/Q2/Q2b/Q3 user selections] --> Report
172
- Commands[git/gh commands + exit codes] --> Report
173
- Commits[git log base..HEAD commit list] --> Report
174
- Probe[Merge Conflict Probe] --> Report
175
- PR[one PR row per stage:<br/>created / reused / skipped] --> Report
176
- Report --> Done[routing recommendation: done]
177
- ```
178
-
179
- The final report requires at least the following.
180
-
181
- - per selected stage, the originating final-verification report path and its quoted verdict row
182
- - the selected stages and the chosen release base
183
- - the pr-plan rows: stage, head branch, base kind, base branch — the merge order of the stack
184
- - the run's current branch and run start `git status --short`
185
- - record of user selections
186
- - all executed git/gh commands and exit codes
187
- - the implementation commit list, attributed per stage
188
- - merge-conflict probe result
189
- - one PR outcome row per stage: created, reused, or skipped
190
- - routing recommendation `done`
191
-
192
- ## 8. Forbidden actions
193
-
194
- ```mermaid
195
- flowchart TD
196
- RH[release-handoff] --> Allowed[read git/gh, fetch base, merge-tree probe,<br/>push feature branch, create/reuse PR]
197
- RH -. forbidden .-> Commit[git add / commit / stash]
198
- RH -. forbidden .-> Force[force push or +refspec]
199
- RH -. forbidden .-> BasePush[push directly to a release base branch]
200
- RH -. forbidden .-> NoVerify[--no-verify / -n]
201
- RH -. forbidden .-> Publish[release publish / deploy]
202
- RH -. forbidden .-> Edit[source edit]
203
- RH -. forbidden .-> Team[TeamCreate or Agent dispatch]
204
- RH -. forbidden .-> Merge[gh pr merge or squash-merge]
205
- RH -. forbidden .-> Rewrite[rebase / amend / cherry-pick a stage branch]
206
- ```
207
-
208
- A failed `git push` must not be retried with weaker safeguards. When a failure such as non-fast-forward occurs, stop and take the user's instruction, and `--force`-family flags are forbidden even if the user requests them.
209
-
210
- ## 9. Verified code
211
-
212
- - [`prompts/profiles/release-handoff.md`](../../prompts/profiles/release-handoff.md)
213
- - [`templates/reports/release-handoff-input.template.md`](../../templates/reports/release-handoff-input.template.md)
214
- - [`skills/okstra-run/SKILL.md`](../../skills/okstra-run/SKILL.md)
215
- - [`scripts/okstra_ctl/wizard/`](../../scripts/okstra_ctl/wizard/)
216
- - [`scripts/okstra_ctl/run.py`](../../scripts/okstra_ctl/run.py)
217
- - [`scripts/okstra_ctl/pr_template.py`](../../scripts/okstra_ctl/pr_template.py)
218
- - [`src/commands/lifecycle/config.mts`](../../src/commands/lifecycle/config.mts)
219
- - [`scripts/okstra_ctl/handoff.py`](../../scripts/okstra_ctl/handoff.py)
220
- - [`scripts/okstra_ctl/worktree/`](../../scripts/okstra_ctl/worktree/)
@@ -1,113 +0,0 @@
1
- # requirements-discovery process
2
-
3
- ## Index
4
-
5
- - [1. Purpose](#1-purpose)
6
- - [2. okstra-run wizard flow](#2-okstra-run-wizard-flow)
7
- - [3. prepare_task_bundle handling](#3-prepare_task_bundle-handling)
8
- - [4. lead execution flow](#4-lead-execution-flow)
9
- - [5. Deliverables and routing](#5-deliverables-and-routing)
10
- - [6. Code reviewed](#6-code-reviewed)
11
-
12
- ## 1. Purpose
13
-
14
- `requirements-discovery` classifies the request before implementation. It determines which of bugfix, feature, improvement, refactor, or ops it is, and chooses whether the next safe phase is `error-analysis` or `implementation-option-selection`. Going directly to planning or implementation is not valid for a new direction. Implementation can only start once a selected direction has been expanded into a separately approved `implementation-planning` report.
15
-
16
- ## 2. okstra-run wizard flow
17
-
18
- ```mermaid
19
- flowchart TD
20
- Start[/okstra-run/] --> Check[ensure-installed / paths / check-project]
21
- Check --> Pick{new task or existing task?}
22
- Pick -->|new| Brief[brief path]
23
- Brief --> Suggest{brief frontmatter suggestions?}
24
- Suggest -->|yes| GroupPick[task-group pick]
25
- Suggest -->|no| GroupText[task-group text]
26
- GroupPick --> Id
27
- GroupText --> Id
28
- Id[task-id pick/text] --> Type[task-type = requirements-discovery]
29
- Pick -->|existing| Type
30
- Type --> Keep{existing brief?}
31
- Keep -->|keep| Base
32
- Keep -->|change/no brief| Brief
33
- Type --> Base{active task worktree?}
34
- Base -->|yes| RoleCount[role-count min..max<br/>omit uses recommended; skip if min==max]
35
- Base -->|no| BaseRef[base-ref pick/text]
36
- BaseRef --> RoleCount
37
- RoleCount --> RoleModel[role-model provider/model per slot]
38
- RoleModel --> RoleAdd[min=0 roles via role-add only<br/>default skip]
39
- RoleAdd --> Extras[directive, related tasks, clarification]
40
- Extras --> Confirm
41
- Confirm --> Render[render-bundle]
42
- ```
43
-
44
- Launch selection uses role slots and model refs only: current-session lead is this session (listed on the confirmation summary), then each static role's count in `min..max` (default **recommended**; the count step is skipped when `min == max`), then one `provider/model` per slot. Roles with `min = 0` stay closed unless the user opens them with role-add (default skip). Duplicate model refs in the same role are rejected. There is no provider roster multi-pick and no `Use defaults / Customize` fork. Dynamic verifiers are not chosen at launch. `--workers` is a CLI compatibility input only, not a launch picker.
45
-
46
- ## 3. prepare_task_bundle handling
47
-
48
- ```mermaid
49
- sequenceDiagram
50
- participant W as wizard/render-bundle
51
- participant P as prepare_task_bundle
52
- participant Prof as requirements-discovery.md
53
- participant Git as worktree registry
54
- participant FS as task artifacts
55
-
56
- W->>P: task-type=requirements-discovery, brief, base-ref, workers
57
- P->>Prof: profile exists, Required workers parsed
58
- P->>P: verify installation, upsert project.json
59
- P->>P: resolve workers from profile + override
60
- P->>Git: create or reuse task worktree
61
- P->>P: expand _common-contract include
62
- P->>FS: write instruction-set and manifests
63
- P->>FS: render workflow currentPhase=requirements-discovery
64
- P-->>W: prepared lead prompt
65
- ```
66
-
67
- There is no additional hard gate in the runtime for this phase alone. The important gates are: the profile file exists, the brief file exists, the worktree gate requiring base-ref to be resolvable at the first phase, and the gate requiring worker overrides to stay within the profile roster range.
68
-
69
- ## 4. lead execution flow
70
-
71
- ```mermaid
72
- flowchart TD
73
- P1[Phase 1 intake<br/>manifest, brief, profile, run manifest, team-state] --> P2[Phase 2 prompts]
74
- P2 --> P3[Phase 3 TeamCreate]
75
- P3 --> P4[Phase 4/5 dispatch analysers<br/>claude/codex + optional antigravity]
76
- P4 --> C[Phase 5.5 convergence<br/>default maxRounds = 1]
77
- C --> R[Phase 6 report-writer authors final report]
78
- R --> P7[Phase 7 token usage, validate, persist]
79
- ```
80
-
81
- `requirements-discovery` has a convergence default of 1 round. This exception is stated in both `render._build_convergence_block()` and `prompts/lead/okstra-lead-contract.md`.
82
-
83
- ## 5. Deliverables and routing
84
-
85
- ```mermaid
86
- flowchart LR
87
- RD[requirements-discovery final report] --> Class[work-category classification]
88
- RD --> Missing[missing materials / clarification items]
89
- RD --> Domain[Domain Alignment<br/>terminology resolution]
90
- RD --> Route{next safe phase}
91
- Route --> EA[error-analysis]
92
- Route --> IOS[implementation-option-selection]
93
- Route -. invalid .-> Impl[implementation<br/>not allowed directly]
94
- ```
95
-
96
- The final report emphasizes the following in particular.
97
-
98
- - evidence-backed routing decision
99
- - missing input and uncertainty boundary
100
- - the next phase and safe resume guidance
101
- - canonical term resolution for `terminology:*` brief items
102
- - if there is blocking input, `Blocks=next-phase` in the `## 1. Clarification Items` unified table
103
-
104
- Non-goals are source edit, plan authoring, build, and deployment.
105
-
106
- ## 6. Code reviewed
107
-
108
- - [`skills/okstra-run/SKILL.md`](../../skills/okstra-run/SKILL.md)
109
- - [`scripts/okstra_ctl/wizard/`](../../scripts/okstra_ctl/wizard/)
110
- - [`scripts/okstra_ctl/run.py`](../../scripts/okstra_ctl/run.py)
111
- - [`scripts/okstra_ctl/workflow.py`](../../scripts/okstra_ctl/workflow.py)
112
- - [`prompts/profiles/requirements-discovery.md`](../../prompts/profiles/requirements-discovery.md)
113
- - [`prompts/lead/okstra-lead-contract.md`](../../prompts/lead/okstra-lead-contract.md)