orchid-sdd 0.2.0 → 0.3.1

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "orchid-sdd",
3
3
  "displayName": "orchid-sdd",
4
- "version": "0.2.0",
4
+ "version": "0.3.1",
5
5
  "description": "Memory-backed, specification-driven development for Claude Code. Explicit-only /orchid-sdd:run workflow with a local Node CLI.",
6
6
  "author": {
7
7
  "name": "orchid-sdd contributors"
@@ -16,17 +16,23 @@ The project must declare one repository workflow and use it consistently:
16
16
  - **XP mainline:** direct integration to main is allowed only for small, tested, reversible
17
17
  changes with the configured review or pairing evidence.
18
18
 
19
- If no repository preset is active, orchid-sdd's default build flow uses an integration branch and
20
- does not merge to the default branch during build. If `repository-trunk-based`,
21
- `repository-gitflow`, or `repository-xp-mainline` is active, that preset is authoritative for
22
- the concrete branch flow; this core rule checks that the declared workflow and the actual
23
- commands agree. A project selecting XP mainline must also update its execution and release
24
- configuration and record the decision in an ADR.
19
+ If no repository preset is active, orchid-sdd's build flow uses the iteration's
20
+ feature/integration branch only when the user opted in; otherwise prompt branches merge into
21
+ the current branch. The default branch is not touched during build. If
22
+ `repository-trunk-based`, `repository-gitflow`, or `repository-xp-mainline` is active, that
23
+ preset is authoritative for the concrete branch flow; this core rule checks that the declared
24
+ workflow and the actual commands agree. A project selecting XP mainline must also update its
25
+ execution and release configuration and record the decision in an ADR.
25
26
 
26
27
  # Checks
27
28
 
28
29
  - The default branch is named and protected by policy.
29
30
  - The branch owner and merge target are clear before work starts.
31
+ - A feature branch is created only when the user asks for one; otherwise work stays on the
32
+ current branch.
33
+ - Each prompt uses one disposable worktree and temporary branch, deleted immediately after CR
34
+ and merge.
35
+ - No orphan `orchid/<iteration>/<prompt-id>` branch or worktree remains at G5 or closure.
30
36
  - Changes are small enough to review and reverse.
31
37
  - Commit messages identify the requirement or prompt when the project uses traceability.
32
38
  - Direct pushes to the default branch are either explicitly allowed by the selected preset or
@@ -37,12 +43,14 @@ configuration and record the decision in an ADR.
37
43
 
38
44
  # Evidence
39
45
 
40
- - Discovery: record the workflow and any repository constraints in `discovery/steering.md`.
46
+ - Discovery: record the workflow, feature-branch decision, and base branch in
47
+ `discovery/steering.md`.
41
48
  - Assessment: note branch/release impact and rollback strategy.
42
- - Build: branch names, commits, and merge target are visible in the prompt report.
49
+ - Build: branch names, worktree path, commits, merge target, and branch deletion are visible
50
+ in the prompt report.
43
51
  - Code review: review the integration diff, not the implementer’s local branch.
44
- - Logic review: confirm the delivered change is on the expected branch and no stray merge or
45
- release action occurred.
52
+ - Logic review: confirm the delivered change is on the expected branch; no prompt branch,
53
+ worktree, or stray merge remains.
46
54
 
47
55
  # Exceptions
48
56
 
@@ -27,5 +27,11 @@ What could break; how it is guarded.
27
27
  ## Versioning and release
28
28
  Compatibility, flags, rollout, rollback.
29
29
 
30
+ ## Branch strategy
31
+ - Feature branch: yes/no
32
+ - Base branch: main/develop
33
+ - Integration target: <feature branch, or the current branch when no feature branch is used>
34
+ - Prompt branches: one disposable worktree/branch per prompt, deleted after CR and merge
35
+
30
36
  ## Criticalities
31
37
  Top risks and open technical questions.
package/README.md CHANGED
@@ -220,6 +220,7 @@ orchid-sdd gate pass G1 --evidence intent/prd.md
220
220
  orchid-sdd discover
221
221
  # ... assess, plan, build, review ...
222
222
  orchid-sdd close --approve
223
+ # Agent: "Do you want to start the technical handover?"
223
224
  orchid-sdd handover --approve
224
225
  ```
225
226
 
@@ -392,6 +393,11 @@ Use `--global` for a user-wide install, `--dest DIR` for a custom directory, `--
392
393
  preview, and `--force` only after reviewing an existing installation. There is no
393
394
  `postinstall` side effect.
394
395
 
396
+ `setup` and `skill install` are independent: `setup` initializes the project artifacts
397
+ (`.orchid/`, `.knowledge/`, `orchid-sdd.yml`), while `skill install` writes the agent skill
398
+ (`.opencode/skills/orchid-sdd`). Either order works; run `setup` first if you want the skill
399
+ usable immediately. Installing the npm package does not create `.opencode/skills`.
400
+
395
401
  For the Vercel Agent Skills catalog:
396
402
 
397
403
  ```bash
@@ -910,7 +916,7 @@ Every referenced persona must exist and be enabled.
910
916
  | `execution.max_parallel` | `4` | Maximum simultaneous prompts/reviews | Agent |
911
917
  | `execution.isolation` | `worktree` | `worktree`, `clone`, or `branch`; `branch` requires `max_parallel: 1` | Agent/CLI (doctor) |
912
918
  | `execution.require_clean_tree` | `true` | `start` refuses a dirty root/repo | CLI |
913
- | `execution.integration_branch` | `orchid/{iteration}/integration` | Build merge target | Agent |
919
+ | `execution.integration_branch` | `orchid/{iteration}/integration` | Feature/integration branch used only when the user opts in; otherwise prompts merge into the current branch | Agent |
914
920
  | `execution.release_strategy` | `squash` | `squash`, `pr`, or `none` at closure | Agent/Policy |
915
921
  | `execution.merge` | `orchestrator` | Who performs merges | Agent/Policy |
916
922
  | `execution.max_fix_loops` | `3` | CR fix attempts before escalation | Agent |
@@ -918,6 +924,12 @@ Every referenced persona must exist and be enabled.
918
924
  | `execution.test_commands.integration` | profile default | Integration test command | Agent/Setup |
919
925
  | `execution.test_commands.e2e` | profile default | End-to-end test command | Agent/Setup |
920
926
 
927
+ At Intent, the skill asks whether to create a feature branch and which base branch to use
928
+ (`main`/`develop`; default `project.default_branch`, or `develop` for Git-flow). If the answer
929
+ is no, it stays on each affected repository's current branch. Every prompt uses one disposable
930
+ worktree and temporary branch (`orchid/<iteration>/<prompt-id>`), deleted immediately after CR
931
+ and merge; closure verifies that no prompt branch or worktree remains.
932
+
921
933
  ### Reviews
922
934
 
923
935
  | Key | Default | Meaning / values | Acted on by |
@@ -1183,7 +1195,7 @@ example fit (closest approved shape), and conflict check (requirements that cont
1183
1195
  blocking rule). Record them in `discovery/steering.md`; G2 can cite that file.
1184
1196
 
1185
1197
  **Suggested Logic Review rules.** Use `logic-review-steering`: rule coverage (every active
1186
- blocking rule has a verdict), evidence freshness (integration branch, not a local branch),
1198
+ blocking rule has a verdict), evidence freshness (chosen integration target, not a throwaway prompt branch),
1187
1199
  scope integrity (no deleted tests or hidden suppressions), exception integrity (waivers name
1188
1200
  owner and expiry), and behavioral fit (the delivered behavior still matches the requirement).
1189
1201
  Record them in `reviews/steering-review.md`; G6 can cite that file.
@@ -1369,7 +1381,7 @@ gates marked below. The CLI cannot verify who invoked it, so the process must no
1369
1381
  The agent asks before a human gate and only runs the command after an explicit answer:
1370
1382
 
1371
1383
  ```text
1372
- Agent: "G1 evidence is ready: intent/prd.md. Do you approve?"
1384
+ Agent: "G1 evidence is ready: intent/prd.md. Approve the changes and move forward."
1373
1385
  Human: "Approved."
1374
1386
  Agent: orchid-sdd gate pass G1 --evidence intent/prd.md
1375
1387
  ```
package/SKILL.md CHANGED
@@ -25,7 +25,8 @@ Implementers, reviewers, and assessment lenses run as subagents with fresh conte
25
25
  - The CLI is the only writer of state, events, manifest, indexes, and the matrix.
26
26
  - Never edit `.knowledge/**`, `manifest.jsonld`, or the index files by hand.
27
27
  - Deterministic operations go through the CLI: setup, record, index, lint, gates, close.
28
- - Code reaches the default branch only at closure. Build merges go to the integration branch.
28
+ - Code reaches the default branch only at closure. Build merges go to the iteration's
29
+ feature/integration branch, or to the current branch when no feature branch was chosen.
29
30
 
30
31
  # User-facing output
31
32
 
@@ -116,11 +117,20 @@ A gate passes only with evidence. Never pass a gate on a promise.
116
117
  | G4 Plan | valid DAG, disjoint waves, coverage, cost estimate within budget | yes |
117
118
  | G5 Prompt | acceptance met, tests green, CR passed, anchors/docblocks valid, merged to integration | per prompt, no |
118
119
  | G6 Logic review | scenarios verified; steering review complete; no open business or blocking steering findings; scope matches intent | yes |
119
- | G7 Closure | prompts done/waived; audit archived; integration merged; release notes | yes |
120
+ | G7 Closure | prompts done/waived; audit archived; feature/integration merged to base or current branch already base; prompt branches deleted; release notes | yes |
120
121
  | G8 Handover | HANDOVER.md + tour.md verified | yes |
121
122
 
122
123
  Use `--evidence <iteration-relative path>` or `--note "why"`; both are logged.
123
124
 
125
+ Before a human gate, end the message with this exact request:
126
+
127
+ > **Approve the changes and move forward.**
128
+ >
129
+ > Evidence: `<iteration-relative paths>`. Reply `approve` to record the gate, or list
130
+ > the changes required.
131
+
132
+ Wait for an explicit answer. Do not run `gate pass` or advance the phase first.
133
+
124
134
  The orchestrator executes `gate pass|fail` after the required authorization. The CLI
125
135
  records the decision; it cannot verify human identity or semantic quality. Never treat a
126
136
  passing command as proof of human approval, and never auto-pass a human gate. G5 is the
@@ -147,6 +157,11 @@ before G1.
147
157
 
148
158
  Artifacts: `intent/title.md`, `intent/prd.md`, `intent/trd.md`.
149
159
 
160
+ - Branch strategy: before implementation, ask whether to create a feature branch. If yes,
161
+ ask the base branch (`main`/`develop`; default `project.default_branch`, or `develop` for
162
+ Git-flow) and record the answer in `intent/trd.md`. Use one feature/integration branch for
163
+ the iteration; do not create both a feature branch and a separate integration branch. If
164
+ the answer is no, use the current branch of each affected repo.
150
165
  - Validate the title: ≤500 chars, names subject + change + outcome. If vague, ask at most
151
166
  five clarifying questions with examples.
152
167
  - PRD: problem, users, current behaviour, desired outcome, flows, business rules, metrics,
@@ -214,11 +229,13 @@ Artifacts: `plan/plan.json`, `plan/matrix.md`, `plan/matrix.json`, `plan/cost-es
214
229
 
215
230
  ## Phase 5 — Build and adversarial CR
216
231
 
217
- - Select ready prompts; create a worktree and branch `orchid/<iteration>/<prompt-id>`.
232
+ - Select ready prompts. Create one worktree and one temporary branch
233
+ `orchid/<iteration>/<prompt-id>` per prompt; never reuse a prompt branch.
218
234
  - Run `orchid-sdd route --phase build --prompt <prompt-id>` before execution and alert the user
219
235
  on `unknown` or `mismatch`.
220
236
  - Record the prompt with `orchid-sdd prompt start <prompt-id> --step implement`; advance safe
221
- steps with `prompt step` and finish with `prompt complete|fail|waive`.
237
+ steps with `prompt step`. Finish with `prompt complete|fail|waive` only after tests, CR,
238
+ merge, and branch cleanup.
222
239
  - Give each implementer a context pack, not the repository.
223
240
  - Keep inline comments why-only; update the anchor and docblock for significant units, with
224
241
  history in the docblock.
@@ -228,10 +245,16 @@ Artifacts: `plan/plan.json`, `plan/matrix.md`, `plan/matrix.json`, `plan/cost-es
228
245
  S-size work; independence and the rubric are unchanged. Check active steering rules and cite
229
246
  violations in `reviews/steering.md`.
230
247
  - Fix loop up to `max_fix_loops`; then `escalated`: accept with ADR, split, or revert.
231
- - Merge to `orchid/<iteration>/integration` in wave order. Do not merge to the default branch
232
- during build unless an active repository steering rule explicitly permits direct mainline
233
- integration and records the evidence.
234
- - A prompt is done only when acceptance, tests, CR, anchors/docblocks, and the matrix agree.
248
+ - Merge to the iteration's feature/integration branch in wave order, or to the current branch
249
+ when the user chose no feature branch. Do not merge to the default branch during build
250
+ unless an active repository steering rule explicitly permits direct mainline integration
251
+ and records the evidence.
252
+ - Immediately after CR passes and the merge lands, remove the prompt worktree
253
+ (`git worktree remove <path>`) and delete its temporary branch
254
+ (`git branch -D orchid/<iteration>/<prompt-id>`). This is mandatory: a prompt is not done
255
+ while its worktree or branch still exists. Clean up failed and waived prompts the same way.
256
+ - A prompt is done only when acceptance, tests, CR, anchors/docblocks, branch cleanup, and the
257
+ matrix agree.
235
258
 
236
259
  ## Phase 6 — Logic review (PM)
237
260
 
@@ -241,24 +264,34 @@ Artifacts: `reviews/logic-review.md`, `reviews/steering-review.md`.
241
264
  - Review behaviour against PRD/TRD/Gherkin, the integration diff, and the steering rules.
242
265
  - Walk every scenario; check invariants, scope creep, dropped requirements, copy, error
243
266
  states, accessibility, and prior regressions.
267
+ - Verify the change is explainable in business terms. The full human tutorial is Phase 8
268
+ (`HANDOVER.md` + `tour.md`); it is not a Phase 6 artifact.
244
269
  - For each steering rule, record `satisfied`, `not applicable`, `finding`, or `waived` with
245
270
  current evidence in `reviews/steering-review.md`; a blocking rule without evidence stops G6.
246
271
  - Findings become new prompts (spec version increments) or a waived risk with an ADR.
247
272
  - Loop capped at `reviews.logic.max_loops`; survivors become a follow-up iteration.
248
- - Pass G6, then `orchid-sdd close --approve`.
273
+ - End with the human-gate request: **Approve the changes and move forward.** Include the
274
+ verdict and evidence. After explicit approval, pass G6 and run
275
+ `orchid-sdd close --approve`.
249
276
 
250
277
  ## Phase 7 — Closure
251
278
 
252
279
  - Confirm every prompt is `done` or `waived`; tests green; lint/index current.
280
+ - Verify branch hygiene: no prompt worktrees and no `orchid/<iteration>/<prompt-id>`
281
+ branches remain.
253
282
  - Move prompts, bus, and runs to `audit/`; keep the matrix as the index.
254
- - Write `release-notes.md`; merge integration to the default branch per
255
- `execution.release_strategy`; tag/freeze the iteration.
283
+ - Write `release-notes.md`; merge the feature/integration branch to the chosen base per
284
+ `execution.release_strategy`, then delete it unless repository policy explicitly requires
285
+ retention and records it. If no feature branch was used, the current branch is already the
286
+ base.
256
287
  - Mark closed and rebuild the manifest. A closed iteration is immutable.
257
288
  - If it will not ship, use `orchid-sdd abandon "<reason>"` instead.
289
+ - After closure, ask: **Do you want to start the technical handover?** Wait for the
290
+ answer before starting Phase 8.
258
291
 
259
292
  ## Phase 8 — Handover
260
293
 
261
- Generate `handover/HANDOVER.md` and `handover/tour.md`. Explain what changed, why, where
294
+ On confirmation, generate `handover/HANDOVER.md` and `handover/tour.md`. Explain what changed, why, where
262
295
  to look, how to run/test, how to roll back, and what remains. The tour is 10–15 ordered
263
296
  stops with anchors and test commands. Verify links and commands, then
264
297
  `orchid-sdd handover --approve`.
@@ -280,8 +313,8 @@ explicit project decisions that must be checked and cited.
280
313
  language example and adapt it to the project’s real conventions.
281
314
  - Discovery converts applicable rules into requirements, scenarios, questions, assumptions, or
282
315
  ADR-backed exceptions. It does not review implementation style.
283
- - Logic review verifies every active rule against the integration branch, records a verdict and
284
- evidence in `reviews/steering-review.md`, and stops on an unresolved blocking rule.
316
+ - Logic review verifies every active rule against the chosen integration target, records a
317
+ verdict and evidence in `reviews/steering-review.md`, and stops on an unresolved blocking rule.
285
318
  - Do not enable competing architecture, style-tool, or repository presets. An exception is an
286
319
  ADR, not a silent waiver.
287
320
  - The CLI validates references, but the agent owns semantic compliance. `steering context`
package/cli/phases.mjs CHANGED
@@ -91,13 +91,13 @@ function validateTitle(raw, maxChars) {
91
91
 
92
92
  function nextAction(phase) {
93
93
  const actions = {
94
- intent: "Write intent/prd.md and intent/trd.md, then `orchid-sdd gate pass G1 --evidence intent/prd.md`.",
94
+ intent: "Ask whether to create a feature branch and which base (main/develop); write intent/prd.md and intent/trd.md, then `orchid-sdd gate pass G1 --evidence intent/prd.md`.",
95
95
  discovery: "Apply steering, capture discovery/Gherkin/questionnaires, write discovery/steering.md; then `orchid-sdd gate pass G2 --evidence discovery/gherkin`.",
96
96
  assessment: "Run the impact lenses and negotiation; then `orchid-sdd gate pass G3 --evidence assessment/negotiation.md`.",
97
97
  planning: "Generate the prompt DAG and cost estimate; then `orchid-sdd gate pass G4 --evidence plan/plan.json`.",
98
98
  build: "Execute ready prompts with `orchid-sdd build --all`; then `orchid-sdd gate pass G5 --note \"all prompts reviewed\"`.",
99
- logic_review: "Verify steering, write reviews/steering-review.md, then `orchid-sdd gate pass G6 --evidence reviews/steering-review.md`.",
100
- closed: "Run `orchid-sdd handover`, then `orchid-sdd handover --approve`.",
99
+ logic_review: "Verify scenarios and steering, write reviews/logic-review.md and reviews/steering-review.md; ask the human \"Approve the changes and move forward.\" Then `orchid-sdd gate pass G6 --evidence reviews/logic-review.md`.",
100
+ closed: "Ask \"Do you want to start the technical handover?\" If yes, run `orchid-sdd handover`, then `orchid-sdd handover --approve`.",
101
101
  handover: "Iteration complete.",
102
102
  abandoned: "Start a new iteration with `orchid-sdd start`.",
103
103
  setup: "Run `orchid-sdd setup`.",
package/cli/setup.mjs CHANGED
@@ -34,6 +34,8 @@ export function agentsBlock(knowledgeFolder, constitutionFolder = ".orchid/const
34
34
  - Read \`orchid-sdd steering context --phase <phase>\` before Discovery and Logic Review; apply every active rule and cite its ID.
35
35
  - Run \`orchid-sdd route --phase <phase>\` before work; if the current model/agent is unknown or mismatched, tell the user. Never switch automatically.
36
36
  - Track development prompts with \`orchid-sdd prompt start|step|complete\`; save a checkpoint with \`orchid-sdd handoff prepare\` before changing harness.
37
+ - Ask before starting whether to create a feature branch and from which base; record the answer in the TRD. If not, stay on the current branch.
38
+ - Each prompt gets one disposable worktree and temporary branch; remove both immediately after CR and merge. Never leave an \`orchid/<iteration>/<prompt-id>\` branch behind.
37
39
  ${AGENTS_END}
38
40
  `;
39
41
  }
package/cli/util.mjs CHANGED
@@ -2,7 +2,10 @@ import crypto from "node:crypto";
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
4
 
5
- export const SKILL_VERSION = "0.2.0";
5
+ const packageJson = JSON.parse(
6
+ fs.readFileSync(new URL("../package.json", import.meta.url), "utf8"),
7
+ );
8
+ export const SKILL_VERSION = packageJson.version;
6
9
  export const SCHEMA_VERSION = "1.0.0";
7
10
 
8
11
  export class OrchidError extends Error {
@@ -21,7 +21,7 @@
21
21
  2. Keep **intent, discovery, and assessment separate**; do not ask technical personas to define business meaning, or business personas to estimate code impact.
22
22
  3. Make the manifest a **generated projection of append-only events**, not a hand-edited JSON file.
23
23
  4. Document code in **three tiers**: a one-line `ORCHID-MEM` anchor, a Markdown docblock, and the manifest graph.
24
- 5. Turn work into **prompt contracts** with dependencies, disjoint write scopes, tests, and acceptance commands; parallelism is proven by the plan, code lands on an integration branch, and the default branch is touched only at closure unless an explicit XP-mainline steering rule permits otherwise.
24
+ 5. Turn work into **prompt contracts** with dependencies, disjoint write scopes, tests, and acceptance commands; parallelism is proven by the plan, code lands on the iteration's feature/integration branch when the user opts in (otherwise on the current branch), and the default branch is touched only at closure unless an explicit XP-mainline steering rule permits otherwise.
25
25
  6. Review with **independent, persona-routed adversarial CR**, then a separate **PM logic review** against Gherkin.
26
26
  7. Treat personas as **role contracts** (phase, authority, triggers), not chatbots; treat the constitution as a **layered, lockable source of truth** for *how* code is written.
27
27
  8. Make the skill **explicit-only, portable, and self-contained**: an explicit command (`/orchid-sdd` in OpenCode, `orchid-sdd` at the CLI) is the only entry point, and the skill package is versioned separately from project knowledge.
@@ -356,8 +356,8 @@ execution:
356
356
  max_parallel: 4
357
357
  isolation: worktree # worktree | clone | branch (§11.2)
358
358
  require_clean_tree: true
359
- integration_branch: "orchid/{iteration}/integration"
360
- release_strategy: squash # squash | pr | none — how integration reaches the default branch at G7
359
+ integration_branch: "orchid/{iteration}/integration" # feature branch when the user opts in; otherwise the current branch
360
+ release_strategy: squash # squash | pr | none — how the iteration branch reaches its base at G7
361
361
  merge: orchestrator
362
362
  max_fix_loops: 3
363
363
  test_commands:
@@ -503,9 +503,9 @@ The orchestrator is the primary agent session in the host harness — in OpenCod
503
503
  | **G2** | Discovery signed off | Business impact, boundaries, Gherkin, traceability, zero blocking questions or recorded `Assumption` nodes; PM sign-off | Yes, if answers changed scope |
504
504
  | **G3** | Assessment decided | Impact map, contracts, regressions, options, ADRs; go/no-go decision | Yes |
505
505
  | **G4** | Plan approved | Valid DAG, disjoint waves, complete coverage, matrix generated, cost estimate within budget or explicitly overridden | Yes |
506
- | **G5** | Prompt done | Acceptance met, tests pass in a clean environment, CR passed, anchors/docblocks valid, merged to the integration branch | No, per prompt |
506
+ | **G5** | Prompt done | Acceptance met, tests pass in a clean environment, CR passed, anchors/docblocks valid, merged to the chosen integration target, prompt worktree/branch deleted | No, per prompt |
507
507
  | **G6** | Logic review passed | Scenarios verified; no open business findings; scope matches intent | Yes |
508
- | **G7** | Closure complete | All prompts done or waived; manifest/index rebuilt; transients archived; integration merged to the default branch; release notes written | Yes |
508
+ | **G7** | Closure complete | All prompts done or waived; manifest/index rebuilt; transients archived; feature/integration merged to its base (or current branch already base); prompt branches deleted; release notes written | Yes |
509
509
  | **G8** | Handover accepted | Handover and tour complete; links resolve; human acknowledges | Yes |
510
510
 
511
511
  Gates are enforced by the orchestrator, not by prompt instructions alone. A command that would cross a gate without evidence fails with the missing evidence listed.
@@ -518,7 +518,9 @@ the caller or the semantic quality of the evidence. A passing command is therefo
518
518
  proof of human approval, and a human gate must never be auto-passed. G5 is the
519
519
  agent/reviewer gate; G2 requires human confirmation only when answers changed scope. When no
520
520
  agent is running, the developer runs the same command manually. The agent-facing rules are
521
- in `SKILL.md`.
521
+ in `SKILL.md`. At a human gate, the agent presents the evidence and ends with the exact
522
+ request: **Approve the changes and move forward.** It records the gate only after an explicit
523
+ answer.
522
524
 
523
525
  ### 4.7 Right-sizing and scope constraints
524
526
 
@@ -559,7 +561,7 @@ The skill exposes one explicit entry point with subcommands. Running `/orchid-sd
559
561
  | `/orchid-sdd discover` | 2 | PM-led requirements capture, Gherkin, consistency scan, questionnaires | G2 |
560
562
  | `/orchid-sdd assess` | 3 | Parallel technical impact analysis, negotiation, ADRs, go/no-go | G3 |
561
563
  | `/orchid-sdd plan` | 4 | Decompose into prompts, validate the DAG, generate the matrix | G4 |
562
- | `/orchid-sdd build [--all\|--wave N\|--prompt P-003]` | 5 | Execute ready prompts, verify tests, run adversarial CR, merge to the integration branch | G5 per prompt |
564
+ | `/orchid-sdd build [--all\|--wave N\|--prompt P-003]` | 5 | Execute ready prompts, verify tests, run adversarial CR, merge to the feature/integration or current branch, delete prompt branches | G5 per prompt |
563
565
  | `/orchid-sdd review` | 6 | PM logic review against PRD/TRD/Gherkin; generate follow-up prompts if needed | G6 |
564
566
  | `/orchid-sdd close` | 7 | Freeze, archive transients, rebuild manifest/index, write release notes | G7 |
565
567
  | `/orchid-sdd handover` | 8 | Generate and verify the human tutorial | G8 |
@@ -709,6 +711,8 @@ intent/
709
711
  | "Fix performance" | "Reduce checkout API p95 latency from 1.8s to under 600ms for carts with more than 50 items" |
710
712
  | "Add Redis" | "Introduce a shared cache for product catalog reads to remove the repeated database fan-out during peak traffic" |
711
713
 
714
+ **Branch strategy.** Before implementation, ask whether to create a feature branch. If yes, ask the base branch (`main`/`develop`; default `project.default_branch`, or `develop` for Git-flow) and record the answer in the TRD. The feature branch is the iteration's single integration target; do not create a separate feature branch and integration branch. If no, use each affected repository's current branch. Prompt branches are always disposable and are deleted after CR and merge.
715
+
712
716
  **PRD contents:** problem, affected users and personas, current behaviour, desired outcome, primary and alternate flows, business rules, success metrics, non-goals, assumptions, risks, open questions. No technology choices.
713
717
 
714
718
  **TRD contents:** technical constraints, proposed architecture direction, patterns to follow (with constitution references), expected deliverables (unit, integration, e2e), infrastructure/API/data hypotheses, regression strategy, versioning and release strategy, criticalities. The TRD is explicitly a **hypothesis**: Phase 3 validates or rejects it.
@@ -911,16 +915,16 @@ plan/ # the prompt folder for this spec
911
915
 
912
916
  1. **Select ready prompts** whose dependencies are done and whose write scopes are disjoint.
913
917
  2. **Resolve routing** with `orchid-sdd route --phase build --prompt <prompt-id>`; if the current agent/model is unknown or mismatched, notify the user and do not switch automatically.
914
- 3. **Isolate** each prompt in a worktree and branch (`orchid/<iteration>/<prompt-id>`), following the isolation and knowledge protocol (§11.2).
918
+ 3. **Isolate** each prompt in one disposable worktree and temporary branch (`orchid/<iteration>/<prompt-id>`), following the isolation and knowledge protocol (§11.2). Never reuse a prompt branch.
915
919
  4. **Build a context pack**, not a repository dump: the prompt, relevant spec slice, constitution sections, 1-hop memory, affected code, test commands, and known constraints.
916
920
  5. **Implement** the prompt, run the tests, keep inline comments why-only, update or create the anchor and docblock (including `History`), and write run artifacts and any message to the outbox; the orchestrator copies both back when the prompt completes.
917
921
  6. **Verify independently:** the orchestrator runs the acceptance commands in a clean environment. The implementer's claim is not evidence.
918
922
  7. **Review adversarially** with a fresh-context reviewer, routed by changed paths and topics.
919
923
  8. **Fix loop** up to `max_fix_loops`. A prompt that exhausts the loop enters `escalated` (§11.5): arbitration, split, or revert. A prompt never merges on a promise to fix later.
920
- 9. **Merge into the integration branch** (`orchid/<iteration>/integration`) in wave order, through the orchestrator; the default branch is untouched during build unless an XP-mainline steering rule explicitly permits otherwise. Update the matrix and emit events. Commit and PR metadata carry the iteration and prompt IDs, the matrix slice, test evidence, and the CR verdict.
924
+ 9. **Merge into the iteration's feature/integration branch**, or into the current branch when the user chose no feature branch, in wave order through the orchestrator; the default branch is untouched during build unless an XP-mainline steering rule explicitly permits otherwise. Immediately after the merge lands, remove the prompt worktree and delete its temporary branch. Cleanup is mandatory; a prompt is not done while either exists. Update the matrix and emit events. Commit and PR metadata carry the iteration and prompt IDs, the matrix slice, test evidence, and the CR verdict.
921
925
  10. **Refresh indexes at wave boundaries**, not on every file write.
922
926
 
923
- **Exit:** G5 for each prompt — acceptance met, tests green, CR passed, anchors/docblocks valid, merged to the integration branch, matrix updated. The iteration can proceed to logic review only when all prompts are done or explicitly waived.
927
+ **Exit:** G5 for each prompt — acceptance met, tests green, CR passed, anchors/docblocks valid, merged to the chosen integration target, prompt worktree/branch deleted, matrix updated. The iteration can proceed to logic review only when all prompts are done or explicitly waived.
924
928
 
925
929
  ### Phase 6 — Logic review
926
930
 
@@ -928,7 +932,7 @@ plan/ # the prompt folder for this spec
928
932
 
929
933
  **Lead:** PM, with any persona configured for `phases.logic_review`.
930
934
 
931
- **Inputs:** PRD, TRD, Gherkin, test evidence, the integration branch diff, manifest history, the active steering rules and examples, and the prompt outcomes. The PM does not replace the technical reviewer; steering verification may cite specialist evidence, but the PM owns the final coverage statement.
935
+ **Inputs:** PRD, TRD, Gherkin, test evidence, the chosen integration target diff, manifest history, the active steering rules and examples, and the prompt outcomes. The PM does not replace the technical reviewer; steering verification may cite specialist evidence, but the PM owns the final coverage statement.
932
936
 
933
937
  **Checks:**
934
938
 
@@ -938,12 +942,14 @@ plan/ # the prompt folder for this spec
938
942
  - error states, copy, accessibility, and edge cases match the intent;
939
943
  - prior regressions are still guarded;
940
944
  - every active steering rule has a verdict and current evidence: `satisfied`, `not applicable`, `finding`, or `waived`;
941
- - style gates ran on the integration branch and no new suppression hides a violation;
945
+ - style gates ran on the chosen integration target and no new suppression hides a violation;
942
946
  - repository flow and architecture boundaries match the declared rules;
943
947
  - the implementation is explainable to a non-engineer.
944
948
 
945
949
  **Output:** `reviews/logic-review.md`, with findings by severity and a verdict, plus `reviews/steering-review.md` mapping each active rule to evidence. A blocking rule with no verdict or current evidence stops G6. Logic review must not become a second technical review; technical findings go back to CR or assessment with the right persona.
946
950
 
951
+ The “explainable to a non-engineer” check verifies that the PM can state the behaviour in business terms. The full human tutorial — `handover/HANDOVER.md` and `handover/tour.md` — is generated and walked in Phase 8, after closure.
952
+
947
953
  - **Gaps or incoherences** → generate follow-up prompts in Phase 4, increment the spec version, and loop.
948
954
  - **Minor fixes** → small prompts, same loop.
949
955
  - **Loops are capped** at `reviews.logic.max_loops` (default 2): findings that survive the cap become either a **follow-up iteration** (linked `followUpTo`, planned immediately) or a **waived risk** with an ADR. G6 records which path was taken; the loop never runs unbounded.
@@ -962,6 +968,7 @@ plan/ # the prompt folder for this spec
962
968
  - the full test suite is green in a clean environment;
963
969
  - anchors and docblocks resolve; `lint --check` and `index --check` pass;
964
970
  - the manifest matches the artifacts;
971
+ - no prompt worktree or `orchid/<iteration>/<prompt-id>` branch remains;
965
972
  - release notes and rollback notes exist.
966
973
 
967
974
  **Actions:**
@@ -971,9 +978,11 @@ plan/ # the prompt folder for this spec
971
978
  - freeze the archived prompts and all artifacts by hash;
972
979
  - rebuild the root `manifest.jsonld` and all indexes;
973
980
  - write `release-notes.md`: changes, breaking changes, migrations, rollback, version bump;
974
- - merge the integration branch into the default branch per `execution.release_strategy` (squash merge, release PR, or manual);
981
+ - merge the feature/integration branch into the chosen base branch per `execution.release_strategy` (squash merge, release PR, or manual); when no feature branch was used, the current branch is already the base;
982
+ - delete the feature/integration branch after a successful merge unless repository policy explicitly requires retention and records it;
975
983
  - tag or prepare the release according to project convention;
976
- - mark the iteration `closed`; it becomes read-only.
984
+ - mark the iteration `closed`; it becomes read-only;
985
+ - ask whether the human wants to start the technical handover, and wait for the answer before Phase 8.
977
986
 
978
987
  **Rule:** archive, don't destroy. A closed iteration is immutable. Reopening it creates a new iteration linked with `followUpTo` and a new spec version. An iteration that will not ship is ended with `/orchid-sdd abandon` instead: same archival, no release, and the manifest records `abandoned` plus the reason.
979
988
 
@@ -1868,6 +1877,8 @@ This is the difference between "we hope they don't collide" and "the plan proves
1868
1877
 
1869
1878
  The knowledge protocol applies in every mode: agents never write `.knowledge`, and the context pack stays authoritative regardless of where the checkout lives.
1870
1879
 
1880
+ **Branch lifecycle.** Prompt worktrees and temporary branches are disposable. Create one per prompt (`orchid/<iteration>/<prompt-id>`), merge it, then remove the worktree and delete the branch immediately after CR passes. A leftover prompt branch is a build failure, not cleanup debt. The iteration has at most one long-lived feature/integration branch, and only when the user asked for one; otherwise prompt branches merge into the current branch of each affected repository. At closure, verify no prompt branch or worktree remains, merge the feature/integration branch to its chosen base, and delete it unless repository policy explicitly requires retention.
1881
+
1871
1882
  ```mermaid
1872
1883
  flowchart TB
1873
1884
  W["wave N ready"] --> CP["orchestrator: context pack + knowledge snapshot into worktree"]
@@ -1876,7 +1887,7 @@ flowchart TB
1876
1887
  TV -->|fail| IM
1877
1888
  TV -->|pass| RV["reviewer agent: adversarial CR, fresh context"]
1878
1889
  RV -->|findings| IM
1879
- RV -->|pass| MG["CLI: merge to integration branch"]
1890
+ RV -->|pass| MG["CLI: merge to feature/integration or current branch"]
1880
1891
  MG --> UP["orchestrator: drain bus, update matrix, emit events"]
1881
1892
  UP --> W
1882
1893
  ```
@@ -2815,7 +2826,7 @@ One-line pointers to every machine-checkable rule, for implementers who should n
2815
2826
  | Implementer never reviews its own work | §11.5 |
2816
2827
  | CR blocking severities gate; escalation after `max_fix_loops` | §11.5 |
2817
2828
  | Logic review capped at `max_loops`; follow-up or waived risk | §11.6 |
2818
- | Merge to the integration branch only; default branch at G7, unless an XP-mainline steering rule permits direct mainline | §6 Phases 5, 7, §9.4 |
2829
+ | Merge to the chosen integration target only; default branch at G7, unless an XP-mainline steering rule permits direct mainline | §6 Phases 5, 7, §9.4 |
2819
2830
  | External sources are untrusted snapshots with provenance | §10 |
2820
2831
  | `doctor --ci` is offline; `--online` for network probes | §10.2 |
2821
2832
  | Audit is permanent; deletion is a human-approved event | §7.9 |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orchid-sdd",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "A memory-backed, specification-driven development (SDD) skill for coding agents.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -25,6 +25,7 @@
25
25
  },
26
26
  "scripts": {
27
27
  "test": "node --test tests/setup.test.mjs tests/memory.test.mjs tests/lifecycle.test.mjs tests/workspace.test.mjs tests/migration.test.mjs tests/plugin.test.mjs tests/personas.test.mjs tests/skill-install.test.mjs tests/profiles.test.mjs tests/steering.test.mjs tests/models.test.mjs tests/prompt-state.test.mjs",
28
+ "prepublishOnly": "npm test",
28
29
  "plugin:check": "node --test tests/plugin.test.mjs",
29
30
  "personas:check": "node --test tests/personas.test.mjs",
30
31
  "skill:check": "node --test tests/skill-install.test.mjs",
@@ -55,6 +56,7 @@
55
56
  "@commitlint/config-conventional": "^21.2.4",
56
57
  "@semantic-release/changelog": "^7.0.0",
57
58
  "@semantic-release/commit-analyzer": "^13.0.1",
59
+ "@semantic-release/exec": "^7.1.0",
58
60
  "@semantic-release/git": "^11.0.1",
59
61
  "@semantic-release/github": "^12.0.10",
60
62
  "@semantic-release/npm": "^13.2.0",