@stdd/plugin 0.9.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 (80) hide show
  1. package/.claude-plugin/plugin.json +9 -0
  2. package/.codex-plugin/plugin.json +21 -0
  3. package/LICENSE +21 -0
  4. package/README.md +47 -0
  5. package/extensions/stdd.mjs +77 -0
  6. package/hooks/claude-hooks.json +28 -0
  7. package/hooks/codex-hooks.json +28 -0
  8. package/package.json +38 -0
  9. package/runtime/adapters/README.md +158 -0
  10. package/runtime/cli/check.mjs +555 -0
  11. package/runtime/cli/ci.mjs +190 -0
  12. package/runtime/cli/claude-hooks.mjs +689 -0
  13. package/runtime/cli/config.mjs +27 -0
  14. package/runtime/cli/evidence.mjs +249 -0
  15. package/runtime/cli/generated-files.mjs +1693 -0
  16. package/runtime/cli/held-fs.mjs +415 -0
  17. package/runtime/cli/init.mjs +883 -0
  18. package/runtime/cli/ledger.mjs +1470 -0
  19. package/runtime/cli/lib.mjs +909 -0
  20. package/runtime/cli/path-bytes.mjs +83 -0
  21. package/runtime/cli/policy.mjs +112 -0
  22. package/runtime/cli/recorders.mjs +188 -0
  23. package/runtime/cli/review-fs.mjs +825 -0
  24. package/runtime/cli/review.mjs +1065 -0
  25. package/runtime/cli/runtime.mjs +32 -0
  26. package/runtime/cli/scope.mjs +185 -0
  27. package/runtime/cli/snapshot.mjs +897 -0
  28. package/runtime/cli/state-validation.mjs +168 -0
  29. package/runtime/cli/status.mjs +580 -0
  30. package/runtime/cli/stdd.mjs +536 -0
  31. package/runtime/cli/worker-fs.mjs +971 -0
  32. package/runtime/cli/worker-metadata.mjs +139 -0
  33. package/runtime/cli/worker.mjs +779 -0
  34. package/runtime/method/README.md +634 -0
  35. package/runtime/method/reference-commands.md +147 -0
  36. package/runtime/method/reference-generated-state.md +151 -0
  37. package/runtime/method/reference-integration.md +233 -0
  38. package/runtime/package.json +65 -0
  39. package/runtime/playbooks/brainstorming.md +46 -0
  40. package/runtime/playbooks/debugging.md +36 -0
  41. package/runtime/playbooks/delegate-slice.md +129 -0
  42. package/runtime/playbooks/finish-change.md +46 -0
  43. package/runtime/playbooks/implement.md +26 -0
  44. package/runtime/playbooks/investigation.md +33 -0
  45. package/runtime/playbooks/managed-playbooks.json +14 -0
  46. package/runtime/playbooks/planning.md +177 -0
  47. package/runtime/playbooks/pr-green.md +50 -0
  48. package/runtime/playbooks/start-change.md +37 -0
  49. package/runtime/playbooks/worktrees.md +45 -0
  50. package/runtime/prebuilds/stdd-fs/darwin-arm64/stdd-fs +0 -0
  51. package/runtime/prebuilds/stdd-fs/darwin-x64/stdd-fs +0 -0
  52. package/runtime/prebuilds/stdd-fs/linux-arm64/stdd-fs +0 -0
  53. package/runtime/prebuilds/stdd-fs/linux-x64/stdd-fs +0 -0
  54. package/runtime/prebuilds/stdd-fs/manifest.json +47 -0
  55. package/runtime/prebuilds/stdd-fs/win32-arm64/stdd-fs.exe +0 -0
  56. package/runtime/prebuilds/stdd-fs/win32-x64/stdd-fs.exe +0 -0
  57. package/runtime/sdk/adapters.mjs +279 -0
  58. package/runtime/sdk/file-observation.mjs +12 -0
  59. package/runtime/sdk/index.d.ts +140 -0
  60. package/runtime/sdk/index.mjs +31 -0
  61. package/runtime/sdk/native-fs.mjs +1235 -0
  62. package/runtime/sdk/path.mjs +71 -0
  63. package/runtime/sdk/text.mjs +42 -0
  64. package/runtime/sdk/workflow.mjs +294 -0
  65. package/runtime/templates/deferred-design.md +47 -0
  66. package/runtime/templates/github-stdd.yml +42 -0
  67. package/runtime/templates/gitlab-stdd.yml +72 -0
  68. package/runtime/templates/pr-description.md +35 -0
  69. package/scripts/adopting-root.mjs +42 -0
  70. package/scripts/stdd-hook.mjs +72 -0
  71. package/skills/stdd-brainstorming/SKILL.md +48 -0
  72. package/skills/stdd-debugging/SKILL.md +38 -0
  73. package/skills/stdd-delegate-slice/SKILL.md +118 -0
  74. package/skills/stdd-finish-change/SKILL.md +40 -0
  75. package/skills/stdd-implement/SKILL.md +28 -0
  76. package/skills/stdd-investigation/SKILL.md +35 -0
  77. package/skills/stdd-planning/SKILL.md +165 -0
  78. package/skills/stdd-pr-green/SKILL.md +52 -0
  79. package/skills/stdd-start-change/SKILL.md +39 -0
  80. package/skills/stdd-worktrees/SKILL.md +46 -0
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: stdd-debugging
3
+ description: Find and fix the root cause of a defect, not its symptom
4
+ when: A bug, crash, failing test, or unexplained behavior is reported.
5
+ ---
6
+
7
+ # Debugging
8
+
9
+ The discipline: no edit before a reproduction, no fix before a diagnosis.
10
+
11
+ ## Process
12
+
13
+ 1. **Reproduce first.** Turn the report into a deterministic reproduction —
14
+ ideally a failing test. If you cannot reproduce it, you are not debugging
15
+ yet; you are gathering facts.
16
+ 2. **Read the actual error.** The full message, the stack, the logs around
17
+ it. Do not pattern-match a familiar-looking symptom to a known failure —
18
+ verify the evidence supports *this* cause.
19
+ 3. **Form one hypothesis and test it cheaply.** Predict what you will observe
20
+ if the hypothesis is true, then look. One hypothesis at a time; a change
21
+ made under two hypotheses proves neither.
22
+ 4. **Fix the root cause minimally.** The smallest change that removes the
23
+ cause. Resist drive-by cleanup — it obscures the fix in review.
24
+ 5. **Keep the reproduction as a regression test.** Red before the fix, green
25
+ after, committed with it.
26
+ 6. **Verify the fix in the original context**, not only in the reduced
27
+ reproduction.
28
+
29
+ ## Stop rules
30
+
31
+ - Two failed fix attempts mean the diagnosis is wrong. Stop editing, go back
32
+ to step 2, and widen what you consider suspect — including your own
33
+ earlier changes and the test itself.
34
+ - If the evidence contradicts the reported story, surface the contradiction
35
+ instead of forcing a fix that matches the story.
36
+ - A fix you cannot explain is not a fix. Do not ship it.
@@ -0,0 +1,129 @@
1
+ ---
2
+ name: stdd-delegate-slice
3
+ description: Hand a slice of work to a worker session with a declared scope, a ledger handoff, and a reviewed result
4
+ when: Before implementing a multi-step change whose steps are independent — hand slices to worker sessions (subagent, second CLI, teammate) instead of implementing everything inline; also whenever a worker's result comes back for review.
5
+ ---
6
+
7
+ # Delegate a Slice
8
+
9
+ Roles are fixed. The orchestrator owns the docs edit, the commits, and the
10
+ PR. The worker owns red-green inside a declared scope. The handoff artifact
11
+ is the ledger, not prose — a worker's chat summary does not survive
12
+ compaction, its recorded events do.
13
+
14
+ ## Before the worker starts (orchestrator)
15
+
16
+ 1. Make the docs decision yourself and record it:
17
+ `stdd docs <decision> [paths…] [--reason <why>]`.
18
+ 2. Choose the worker boundary and declare the scope. Prefer a managed gitless
19
+ sandbox when the worker does not need Git authority:
20
+
21
+ ```bash
22
+ stdd worker create ../stdd-worker-billing \
23
+ --frozen "docs/**,migrations/**" \
24
+ --allowed "src/billing/**,test/billing/**"
25
+ ```
26
+
27
+ Use `stdd slice new --frozen ... --allowed ...` only when the worker must
28
+ operate in an existing isolated checkout. `--frozen` names globs the worker
29
+ must not touch. `--allowed` names the only paths it may change. At least one
30
+ is required. A managed sandbox contains no `.git`, ignored dependencies,
31
+ credentials, or build output; run the repository's readiness setup there.
32
+ 3. Write the brief **to a file** (session scratchpad, never the repo) and
33
+ point the worker at it — pasted context stays resident in your window
34
+ for the rest of the session; a file does not. Template:
35
+
36
+ > **Task**: <one sentence>
37
+ > **Spec**: read <canonical doc paths> — the docs edit is already made.
38
+ > **Scope**: declared by `stdd worker create` or `stdd slice new`; check
39
+ > yours with `stdd scope`.
40
+ > **Loop**: failing test first — record it with `stdd red -- <cmd>`;
41
+ > verify with `stdd verify -- <narrowest command>`.
42
+ > **Do not**: commit, push, or edit docs — the orchestrator owns those.
43
+ > **Policy**: copy the `stdd policy show` notes that govern this area —
44
+ > a worker reads the brief, not the repository's standing decisions.
45
+ > **Questions**: ask them now, before starting — not mid-slice.
46
+ > **Report**: write it to <file>; end with exactly one status:
47
+ > `DONE | DONE_WITH_CONCERNS | BLOCKED | NEEDS_CONTEXT`.
48
+
49
+ 4. Name the worker's model explicitly in the dispatch — an omitted model
50
+ silently inherits the orchestrator's tier. Mechanical transcription
51
+ tolerates a cheap tier; judgment does not.
52
+
53
+ <!-- cap:crossCli -->
54
+ 5. The worker may be the other CLI: dispatch it headless with the brief
55
+ file (`codex exec` from Claude Code, `claude -p` from Codex) when the
56
+ slice benefits from a second perspective or a different toolchain.
57
+ <!-- /cap -->
58
+
59
+
60
+ <!-- cap:worktrees -->
61
+ ## Parallel slices
62
+
63
+ Serial dispatch is the default; parallelism is safe only when every
64
+ precondition holds:
65
+
66
+ - **Independence** — no consumes/produces edge between the steps: neither
67
+ slice uses a name the other produces.
68
+ - **Isolation** — each worker runs in its own managed gitless sandbox or
69
+ worktree (see the worktrees playbook); two workers in one directory race on
70
+ files and test state.
71
+ - **Disjoint scopes** — the slices' `--allowed` globs must not overlap;
72
+ an overlap forces serialization, it is never "probably fine".
73
+
74
+ Dispatch the workers concurrently, then review results as they land —
75
+ never hold finished work hostage to the slowest slice. Integration stays
76
+ serial: merge one slice at a time into the orchestrator's checkout and
77
+ re-run its verification after each merge, so a conflict names the slice
78
+ that caused it.
79
+
80
+ While workers run, the orchestrator works too: review a landed slice,
81
+ prepare the next brief, draft the PR body from the ledger. Waiting idle
82
+ on a single dispatched worker is the delegation anti-pattern — if there
83
+ is truly nothing to do until the worker returns, the slice was too big.
84
+ <!-- /cap -->
85
+
86
+ ## While the worker runs (worker)
87
+
88
+ - Ask blocking questions before the first edit, then run without
89
+ "should I continue?" pauses.
90
+ - Record the red before implementing: `stdd red -- <cmd>` (a genuine test
91
+ failure, not an environment error — the recorder tells you which).
92
+ - Record every meaningful verification: `stdd verify -- <cmd>`.
93
+ - Leave handoff context in the file, not the chat: `stdd note <text>`.
94
+ - End with one status. `BLOCKED` and `NEEDS_CONTEXT` are good outcomes:
95
+ bad work is worse than no work — escalating is never penalized.
96
+
97
+ ## After the worker finishes (orchestrator)
98
+
99
+ 1. Run `stdd scope` in the worker environment. For a managed sandbox, then run
100
+ `stdd worker collect <directory>` from the source checkout. Collection
101
+ fails before import on scope, identity, source-drift, or path conflicts and
102
+ never stages or commits. It imports worker red/verify/note evidence, but the
103
+ orchestrator still verifies the collected source checkout freshly.
104
+ 2. `stdd status` — confirm the loop is complete (docs, genuine red, passing
105
+ verify).
106
+ 3. **Review the diff, never the report alone.** The report is a claim, and
107
+ a stated rationale never downgrades a finding. Two verdicts, in order:
108
+ - *Spec compliance*: anything **missing** from the brief, anything
109
+ **extra** beyond it (unrequested work is a finding, not a bonus),
110
+ anything **misunderstood**.
111
+ - *Code quality* on what was built.
112
+
113
+ <!-- cap:subagents -->
114
+ With subagents available, dispatch a fresh reviewer that sees the brief,
115
+ the diff, and the report — never your session history — and reviews
116
+ read-only.
117
+ <!-- /cap -->
118
+
119
+ <!-- cap:subagents|crossCli -->
120
+ Route the verdict through `stdd review` so it lands in the ledger
121
+ instead of evaporating with the chat.
122
+ <!-- /cap -->
123
+
124
+ 4. A `BLOCKED` or `NEEDS_CONTEXT` slice is not retried unchanged: add
125
+ context, split the slice, or take it inline.
126
+ 5. Assemble the PR body from the ledger, not from the worker's summary:
127
+ `stdd evidence` drafts the docs line from the recorded decision and the
128
+ diff. STDD never removes a managed sandbox automatically; delete it
129
+ explicitly only after reviewing the collected result.
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: stdd-finish-change
3
+ description: Close an implemented change with independent review, PR evidence, terminal CI, and runtime verification when required
4
+ when: Implementation is locally verified and the change is ready for review, delivery, or handoff.
5
+ ---
6
+
7
+ # Finish change
8
+
9
+ Close the current checkout in this order:
10
+
11
+ 1. Run the complete affected local verification.
12
+ 2. Finish every plan item and run the independent closing review when the
13
+ capability profile supports it.
14
+ <!-- cap:crossCli -->
15
+ `stdd review --via {{STDD_CROSS_CLI_REVIEW_VIA}}` dispatches the other CLI
16
+ read-only and records the verdict in the ledger.
17
+ <!-- /cap -->
18
+ <!-- cap:subagents -->
19
+ `stdd review --via subagent` prints the brief path for a fresh read-only
20
+ subagent; feed its JSON back with `stdd review --result <file>`.
21
+ <!-- /cap -->
22
+ 3. Generate the PR evidence with `stdd evidence`; never hand-author a claim
23
+ contradicted by the diff.
24
+ 4. Open or update the PR/MR and wait for terminal checks. On GitHub use
25
+ `stdd ci --watch`; on another forge use its adapter's equivalent.
26
+ 5. If the change includes a deploy, migration, package publish, or other
27
+ runtime effect, verify that surface separately. Green CI is not runtime
28
+ proof.
29
+ 6. Run `stdd task finish` only after the requested delivery boundary is
30
+ actually complete.
31
+
32
+ <!-- cap:subagents|crossCli -->
33
+ An `approved` verdict freezes the checkout. Anything you notice afterwards —
34
+ a stale comment, a better name, one more edge case — is deferred with
35
+ `stdd defer`, not edited in. Editing discards the approval rather than
36
+ improving on it, and buys a round that found nothing. Past the review
37
+ budget, `--force` needs `--reason <text>`: write what the extra round is
38
+ expected to settle, not that the reviewer asked again.
39
+ <!-- /cap -->
40
+
41
+ Do not merge, deploy, publish, or mutate an external system unless the user
42
+ has authorized that action. A permission that `stdd policy show` reports is
43
+ that authorization, but only once this session has verified the entry's
44
+ condition and said what it verified; an unverifiable condition leaves the rule
45
+ exactly as it stands. An entry the command lists as ignored grants nothing.
46
+
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: stdd-implement
3
+ description: Execute one agreed behavior slice through docs, genuine red, implementation, and fresh verification
4
+ when: The behavior contract is agreed and production changes are ready to begin.
5
+ ---
6
+
7
+ # Implement
8
+
9
+ Run one narrow vertical slice at a time:
10
+
11
+ 1. Record the docs decision with `stdd docs`. For changed behavior, edit the
12
+ canonical docs first and record `updated-first`.
13
+ 2. Add the smallest test that proves the agreed behavior. Run it through
14
+ `stdd red -- <command>` and confirm the failure is genuine.
15
+ 3. Implement only enough production code to satisfy that contract.
16
+ 4. Run the focused and affected verification through
17
+ `stdd verify -- <command>`.
18
+ 5. Check `stdd status --local`; a later checkout change makes verification
19
+ stale and requires another verify.
20
+
21
+ Frontend visual composition follows the method's design-first exception.
22
+ Behavior embedded in the UI still follows the loop.
23
+
24
+ Do not batch unrelated rules behind one red. If the plan has multiple items,
25
+ update its checkboxes only after their named evidence exists.
26
+
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: stdd-investigation
3
+ description: Read-only diagnosis — evidence-backed findings, no changes
4
+ when: Asked to diagnose, triage, or explain behavior WITHOUT changing anything.
5
+ ---
6
+
7
+ # Investigation
8
+
9
+ The discipline: the deliverable is an evidence-backed diagnosis and an
10
+ explicit list of blockers — never an edit. For the fix that may follow,
11
+ switch to the debugging playbook; this one deliberately does not restate
12
+ it.
13
+
14
+ ## Contract
15
+
16
+ - No file edits, no state-changing side effects — reads only.
17
+ - Every claim in the report is backed by evidence you actually observed,
18
+ or labeled as unverified with the blocker named.
19
+
20
+ ## Process
21
+
22
+ 1. **Inventory the evidence channels first.** Before forming any theory,
23
+ check what you can actually observe: forge CLI auth, container / DB /
24
+ log access, environment-key **presence** (never values). Report dead
25
+ channels as blockers immediately — do not silently work around a
26
+ channel you could not reach.
27
+ 2. **A hypothesis is not a diagnosis.** Test it against runtime signals —
28
+ logs, states, reproductions — before reporting it as a finding. What
29
+ you could not test, report as an explicitly unverified hypothesis with
30
+ the blocker that prevented the test.
31
+ 3. **Deliver the report**: the diagnosis (or ranked hypotheses) with its
32
+ evidence, the blockers, and the narrowest next step a fixing session
33
+ should take.
@@ -0,0 +1,14 @@
1
+ {
2
+ "managed": [
3
+ "brainstorming.md",
4
+ "debugging.md",
5
+ "delegate-slice.md",
6
+ "finish-change.md",
7
+ "implement.md",
8
+ "investigation.md",
9
+ "planning.md",
10
+ "pr-green.md",
11
+ "start-change.md",
12
+ "worktrees.md"
13
+ ]
14
+ }
@@ -0,0 +1,177 @@
1
+ ---
2
+ name: stdd-planning
3
+ description: Turn an agreed behavior contract into an executable, verifiable sequence of work
4
+ when: The behavior contract is agreed (docs edit drafted or committed) and the change is large enough to need ordered steps — before the first implementation edit, to fix the execution mode and delivery boundary.
5
+ ---
6
+
7
+ # Planning
8
+
9
+ A plan is a disposable working artifact: it guides one execution and is thrown
10
+ away. It is never committed as a file — its home is the PR description (for
11
+ the durable summary) and `.stdd/plan.md` (for the working copy: per checkout,
12
+ gitignored, read by `stdd status`, survives compaction).
13
+
14
+ Write the plan for an executor with zero context and questionable taste:
15
+ exact file paths, exact names, exact commands. The planning session's
16
+ memory does not survive delegation or compaction — whatever the plan does
17
+ not say, the executor does not know.
18
+
19
+ ## Structure
20
+
21
+ A good plan has, in order:
22
+
23
+ 1. **Intent** — one paragraph: the problem and the agreed direction.
24
+ 2. **Docs delta** — which permanent docs change and how (added / modified /
25
+ removed rules, named per target file). This is the spec surface of the
26
+ plan; keep it exact so the docs edit is mechanical.
27
+ 3. **Global constraints** — the agreement's project-wide requirements
28
+ (version floors, naming and copy rules, platform limits), one line
29
+ each, exact values verbatim. Every step implicitly includes this
30
+ section; a delegated worker gets it copied into the brief.
31
+ 4. **Steps** — each step small enough to verify independently, written as
32
+ checkboxes (`- [ ]`) so `stdd status` can report progress and the next
33
+ open item. Per step:
34
+ - what changes (files, functions);
35
+ - the failing test that gates it (or the visual check, for frontend
36
+ visual work — see the design-first exception in the method);
37
+ - the verification command;
38
+ - for a step that may be delegated: its interfaces — **consumes**
39
+ (exact signatures it uses from earlier steps) and **produces**
40
+ (exact names and types later steps rely on). A worker sees only its
41
+ own slice; this block is how a neighbor's names reach it.
42
+
43
+ Tag a step whose gate is a failing test with `[red: <substring of the
44
+ test command>]` — it then closes only when a matching genuine red is
45
+ recorded via `stdd red`, not when the box is ticked.
46
+
47
+ <!-- cap:subagents|crossCli -->
48
+ The last step of a multi-step plan is always the independent review
49
+ (see "The closing review"). Write it into the plan at planning time —
50
+ the plan must carry the trigger, not the session's memory.
51
+ Tag it `[review:]`: like `[red:]`, the tag closes only through the
52
+ ledger (an approved verdict recorded by `stdd review`), never by
53
+ ticking the box.
54
+ <!-- /cap -->
55
+ 5. **Out of scope** — what this change deliberately does not do.
56
+ 6. **Risks** — what could invalidate the plan and how you would notice.
57
+
58
+ ## Plan failures
59
+
60
+ These patterns void a step — rewrite it before presenting the plan:
61
+
62
+ - "TBD", "TODO", "fill in later", "details during implementation".
63
+ - "Add appropriate error handling" / "handle edge cases" — name the cases.
64
+ - "Write tests for the above" without naming the test and its assertion.
65
+ - "Similar to step N" — repeat the exact names; steps are read in
66
+ isolation.
67
+ - A check that names no runnable command — the visual-check exception
68
+ still names the command that brings the surface up.
69
+ - A reference to a type, function, or file that neither the repository
70
+ nor any step defines.
71
+
72
+ ## Self-review before presenting
73
+
74
+ Re-read the docs delta with fresh eyes and check the plan against it:
75
+
76
+ 1. **Coverage** — every agreed rule maps to a step; list any gap.
77
+ 2. **Plan-failure scan** — search the plan for the patterns above.
78
+ 3. **Name consistency** — signatures and names used by later steps match
79
+ where earlier steps define them.
80
+
81
+ Fix findings inline and present once — a plan that survives this check
82
+ gets approved in one round instead of three.
83
+
84
+ ## Rules
85
+
86
+ - Order steps so the system stays green between them.
87
+ - Write verification per step, not one "run all tests" at the end.
88
+ - A step that cannot fail its check is not a step — merge it into another.
89
+ - When execution contradicts the plan, update the plan, do not force the
90
+ plan onto reality. If the *intent* changed, stop and re-enter
91
+ brainstorming.
92
+ - Keep the durable parts flowing to their homes as you go: rules → docs
93
+ edit, rationale → PR description. The plan itself must stay deletable at
94
+ any moment without information loss.
95
+ - Surface plan-invalidating discoveries as one batched question, not one
96
+ interrupt per finding.
97
+ - Cut scope explicitly: `stdd defer <text>` appends the cut to the plan's
98
+ `## Deferred` section. Deferred work is carried into the PR
99
+ description's out-of-scope, never silently dropped.
100
+
101
+ ## Executing
102
+
103
+ Close planning with an explicit execution choice. When `stdd policy show`
104
+ reports an execution-mode default, adopt it and state the choice instead of
105
+ asking — the question exists to settle the mode, not to be asked twice.
106
+ Otherwise ask it as a closed question to the user, your recommendation
107
+ first. Template (recommend **inline** for
108
+ tightly coupled steps, **delegated** for independent ones; lead with
109
+ whichever you recommend):
110
+
111
+ > Plan ready (N steps). How should it run?
112
+ > 1. **Inline (recommended)** — this session implements the steps itself.
113
+ > 2. **Delegated** — independent steps go to workers via delegate-slice;
114
+ > this session orchestrates and reviews.
115
+
116
+ The modes differ only in who types: the loop and its recording stay
117
+ identical. Delegation is a context optimization, never a requirement —
118
+ it preserves the orchestrating session's window for coordination instead
119
+ of burning it on implementation detail.
120
+ <!-- cap:worktrees -->
121
+ Steps with no consumes/produces edge between them are candidates for
122
+ parallel delegation — see "Parallel slices" in delegate-slice for the
123
+ preconditions.
124
+ <!-- /cap -->
125
+
126
+ Record the answer as a `Mode: inline|delegated` line at the top of the
127
+ plan working copy — the plan carries the mode, not the session's memory,
128
+ so the choice survives compaction.
129
+
130
+ <!-- cap:subagents|crossCli -->
131
+ ## The closing review
132
+
133
+ Every multi-step plan ends the same way, inline or delegated: an
134
+ independent review of the cumulative diff, before the evidence line and
135
+ the PR. Independence means a fresh context — the reviewer sees the
136
+ plan's intent, the docs delta, and the diff, never the implementing
137
+ session's history. A self-review by the session that wrote the code is
138
+ not independent: rationales in its own summary are the implementer
139
+ grading their own work. Two verdicts, in order: spec compliance against
140
+ the plan (missing / extra / misunderstood), then code quality on what
141
+ was built.
142
+ Use one of the route-specific commands below. Each invocation builds the brief
143
+ (plan + diff + governing docs + the method's quality rubric + output
144
+ contract), records the request, derives the verdict from the findings, and
145
+ closes the `[review:]` item on approval. After `changes-requested`, fix the
146
+ findings and repeat the same route-specific command; the newest verdict
147
+ controls the item.
148
+ <!-- /cap -->
149
+ <!-- cap:crossCli -->
150
+ `stdd review --via {{STDD_CROSS_CLI_REVIEW_VIA}}` dispatches the other CLI itself, sandboxed
151
+ read-only — a reviewer with a genuinely different perspective.
152
+ <!-- /cap -->
153
+ <!-- cap:subagents -->
154
+ `stdd review --via subagent` prints the brief path: hand it to a fresh
155
+ read-only subagent, then feed its JSON back through
156
+ `stdd review --result <file>`.
157
+ <!-- /cap -->
158
+
159
+ ## The final report
160
+
161
+ When the plan is exhausted, report to the user —
162
+ in their language, for a human deciding what happens next, not as a
163
+ second copy of the ledger:
164
+
165
+ 1. **Outcome first** — one or two sentences: what shipped and what
166
+ proves it (tests and gate).
167
+ <!-- cap:subagents|crossCli -->
168
+ Include the independent review verdict in that proof.
169
+ <!-- /cap -->
170
+ 2. **Deviations from the plan** — deferred cuts, extra work, decisions
171
+ changed mid-flight. If there are none, say so in one line.
172
+ 3. **The technical trail last** — commands, file:line references,
173
+ round counts, for the reader who wants them.
174
+
175
+ The machine record (findings JSON, ledger events, evidence line) already
176
+ exists; the report earns its place only by being readable — plain
177
+ sentences over verdict tables, terms spelled out over shorthand.
@@ -0,0 +1,50 @@
1
+ ---
2
+ name: stdd-pr-green
3
+ description: A PR is done only when its required checks settle terminal-green on the current head
4
+ when: A PR/MR exists, or is about to be opened, for the current branch.
5
+ ---
6
+
7
+ # PR Green
8
+
9
+ The discipline: local verification governs the inner loop; the PR's required
10
+ checks govern the definition of done. "CI started" and "pushed" are never
11
+ done.
12
+
13
+ ## The one command
14
+
15
+ Do not hand-roll pollers, sleeps, or `gh pr checks` loops:
16
+
17
+ ```bash
18
+ stdd ci --watch # current branch's PR; stdd ci <n> --watch for another
19
+ ```
20
+
21
+ It resolves the PR, pins the watch to the PR's **current head**, refuses to
22
+ settle until the check set is stable and fully terminal, restarts itself
23
+ when the head moves (amend, force-push, new commit), and exits 0 only on
24
+ terminal green — nonzero the moment a check fails terminally. On GitLab,
25
+ `glab ci status --live` is the nearest equivalent; the recognition table
26
+ below still applies.
27
+
28
+ ## Recognition table
29
+
30
+ | You see | It means | Do |
31
+ | --- | --- | --- |
32
+ | Green summary seconds after a push, suspiciously few checks | The full check set has not registered yet | Trust only `stdd ci --watch` — it never settles on the first sighting of a set |
33
+ | A failure attached to an older SHA | Stale result, not a red | Nothing — the watch is pinned to the current head |
34
+ | `cancelled` on a superseded run | A concurrency twin, not a failure | Nothing to debug — `stdd ci` collapses same-named entries to the freshest run; re-run only if a ruleset still waits on that check |
35
+ | A required check failed on the current head | A real red — it outranks everything else | Pull the failed job's log (the error, not the job name), reproduce locally with the narrowest matching command, fix the root cause, push, re-watch |
36
+ | Checks green, but the change needs a deploy or migration to be observable | Green CI ≠ working | Verify the runtime surface the change touches before reporting done |
37
+ | The watch times out with checks still pending | Runner starvation or a hung job | Read the run page; re-run or escalate — never report green |
38
+
39
+ ## After a real red
40
+
41
+ A fix-commit without a re-watch repeats the original mistake: every push
42
+ starts a new settlement, and only `stdd ci --watch` reaching terminal
43
+ green closes it.
44
+
45
+ ## Before opening
46
+
47
+ Run the local lanes that cover the surfaces the diff touches — not only the
48
+ narrowest lane that proved the last edit. CI settlement stays the
49
+ authoritative backstop; pre-running the entire CI matrix locally is not the
50
+ goal.
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: stdd-start-change
3
+ description: Classify a request, open durable task state only for changes, and route to the smallest applicable workflow
4
+ when: A new implementation, fix, refactor, investigation, or repository change is beginning.
5
+ ---
6
+
7
+ # Start change
8
+
9
+ Classify the request before writing task state:
10
+
11
+ - read-only question or diagnosis → invoke `stdd-investigation`; do not start a
12
+ task or write the ledger;
13
+ - uncertain behavior or scope → invoke `stdd-brainstorming`;
14
+ - agreed multi-step behavior → invoke `stdd-planning`;
15
+ - known defect without a diagnosis → invoke `stdd-debugging`;
16
+ - small agreed change → invoke `stdd-implement` directly.
17
+
18
+ Run `stdd policy show` before asking anything: it may already answer which
19
+ agent owns this area, which standing permission covers the work, and what this
20
+ repository treats as routine rather than a decision. Read it through the
21
+ command, never as raw markdown — the command is where the rules are applied.
22
+
23
+ For every route that may change the repository, open one task boundary before
24
+ carrying state across prompts:
25
+
26
+ ```bash
27
+ stdd task start "<short change name>"
28
+ stdd status --local
29
+ ```
30
+
31
+ If another task is active, do not reset it silently. Finish it, continue it,
32
+ or ask the user which task owns the checkout.
33
+
34
+ For a change, read `.stdd/method.md` and the canonical docs governing the
35
+ touched behavior. The classification is a routing decision, not ceremony:
36
+ skip workflows that do not apply, but never skip a mechanical contract that
37
+ does.
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: stdd-worktrees
3
+ description: Work in an isolated workspace without fighting the platform's native isolation
4
+ when: Starting implementation work that should not disturb the user's current checkout.
5
+ requires: worktrees
6
+ ---
7
+
8
+ # Isolated Workspaces
9
+
10
+ ## Order of preference
11
+
12
+ 1. **Detect existing isolation.** If you are already in a linked worktree or
13
+ a platform-managed sandbox, use it. Never nest worktrees. (Check:
14
+ `git rev-parse --git-dir` differs from `--git-common-dir`, and you are not
15
+ in a submodule.)
16
+ 2. **Use the platform's native worktree tool** if one exists. Manual
17
+ `git worktree add` alongside a native tool creates state the platform
18
+ cannot see or clean up.
19
+ 3. **Fall back to `git worktree add`** only when neither applies:
20
+ - Put worktrees in a dedicated ignored directory (`.worktrees/` at the
21
+ repo root by default).
22
+ - Verify the directory is git-ignored **before** creating the worktree;
23
+ add it to `.gitignore` first if not.
24
+ - Branch from the repository's integration branch unless told otherwise.
25
+
26
+ ## After creating
27
+
28
+ - Run the project's dependency setup (install, build) so the workspace is
29
+ self-sufficient.
30
+ - Run `stdd doctor --readiness` before trusting any verification output in
31
+ a fresh worktree — a missing install or unbuilt package produces phantom
32
+ failures that look like your change broke something.
33
+ - Untracked and gitignored files (env files, credentials, build output)
34
+ exist per checkout — a fresh worktree never has them.
35
+ - Run the narrowest baseline verification before changing anything. If the
36
+ baseline is already red, report it and ask before proceeding — otherwise
37
+ you cannot tell your breakage from pre-existing breakage.
38
+
39
+ ## Shared state warnings
40
+
41
+ - The git stash stack is shared across all worktrees of one repository.
42
+ Prefer a temporary WIP commit over stashing; if you must stash, tag the
43
+ entry and apply (not pop) by its SHA.
44
+ - Never `cd` out of your assigned worktree into the main checkout to "fix
45
+ something quickly" — open work there belongs to someone else.
@@ -0,0 +1,47 @@
1
+ {
2
+ "schema": 1,
3
+ "artifacts": [
4
+ {
5
+ "target": "darwin-arm64",
6
+ "protocol": 1,
7
+ "path": "darwin-arm64/stdd-fs",
8
+ "size": 452616,
9
+ "sha256": "sha256:c81ecb7dfd6972bc53ecdc2eb217f8a0b66c5ffe53704d0c364371010fa0dafd"
10
+ },
11
+ {
12
+ "target": "darwin-x64",
13
+ "protocol": 1,
14
+ "path": "darwin-x64/stdd-fs",
15
+ "size": 477848,
16
+ "sha256": "sha256:34cbde9222fb67e76c60f7003df8a64be6d1d57e42c1637aab06945ef86dbf2e"
17
+ },
18
+ {
19
+ "target": "linux-arm64",
20
+ "protocol": 1,
21
+ "path": "linux-arm64/stdd-fs",
22
+ "size": 463536,
23
+ "sha256": "sha256:f9a5ce8e474fa4af455c4a3bde467933dd511c912e620a47dcb12642d3490d30"
24
+ },
25
+ {
26
+ "target": "linux-x64",
27
+ "protocol": 1,
28
+ "path": "linux-x64/stdd-fs",
29
+ "size": 515080,
30
+ "sha256": "sha256:76d123953c86be9bbcef27834f60def214b1399e837727bedca077ea00afb23e"
31
+ },
32
+ {
33
+ "target": "win32-arm64",
34
+ "protocol": 1,
35
+ "path": "win32-arm64/stdd-fs.exe",
36
+ "size": 297472,
37
+ "sha256": "sha256:213d239380d13eab98931f226d0e7c039aea4418b2a5926c5ed25b1792d61b40"
38
+ },
39
+ {
40
+ "target": "win32-x64",
41
+ "protocol": 1,
42
+ "path": "win32-x64/stdd-fs.exe",
43
+ "size": 338432,
44
+ "sha256": "sha256:055a467fe2dee407bf06735d7ed1ff6c5b1a238439751122e1ff92a1d2b75d9d"
45
+ }
46
+ ]
47
+ }