wdi-method 0.6.18 → 0.6.24

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 (34) hide show
  1. package/CHANGELOG.md +105 -0
  2. package/LICENSE +21 -21
  3. package/NOTICE +28 -0
  4. package/README.id.md +190 -0
  5. package/README.ja.md +188 -0
  6. package/README.md +190 -530
  7. package/README.zh.md +188 -0
  8. package/bin/wdi-method.js +2199 -2112
  9. package/kit/.constitution/method/README.md +1 -0
  10. package/kit/.constitution/method/branch-guide.md +87 -0
  11. package/kit/.constitution/method/ci-guide.md +169 -0
  12. package/kit/.constitution/method/constitution.md +1 -0
  13. package/kit/.constitution/method/scripts/lifecycle.py +416 -0
  14. package/kit/.constitution/method/scripts/validate.py +126 -9
  15. package/kit/skills/wdi-autopilot/SKILL.md +461 -384
  16. package/kit/skills/wdi-build/SKILL.md +404 -393
  17. package/kit/skills/wdi-daily-autopilot/SKILL.md +138 -0
  18. package/kit/skills/wdi-daily-what-to-build/SKILL.md +155 -0
  19. package/kit/skills/wdi-daily-what-to-test/SKILL.md +127 -0
  20. package/kit/skills/wdi-explain-to-me/SKILL.md +1 -1
  21. package/kit/skills/wdi-help/SKILL.md +21 -7
  22. package/kit/skills/wdi-init/SKILL.md +16 -0
  23. package/kit/skills/wdi-prune-or-archive/SKILL.md +76 -0
  24. package/kit/skills/wdi-review/SKILL.md +4 -1
  25. package/kit-overlay/AGENTS.md +37 -4
  26. package/kit-overlay/README.md +1 -0
  27. package/kit-overlay/constitution.md +1 -0
  28. package/lib/identity.mjs +246 -117
  29. package/package.json +8 -4
  30. package/scaffold/.control/custom-dispatch.yaml.example +65 -0
  31. package/scaffold/.control/registry/index.yaml +9 -0
  32. package/scaffold/.control/test-targets/desktop.md +15 -0
  33. package/scaffold/.control/test-targets/mobile.md +6 -0
  34. package/scaffold/.control/test-targets/web.md +6 -0
@@ -0,0 +1,138 @@
1
+ ---
2
+ name: wdi-daily-autopilot
3
+ description: Compose and launch the autonomous daily loop routine (default 10m interval) with self code-review and peer-review runners resolved from local configuration. Invoke as `/wdi-daily-autopilot [in-session] [peer] [interval] [--skip-peer-review]`.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # WDI Daily Autopilot Launch
8
+
9
+ Composes the autonomous daily engineering routine, verifies or initiates the owner-accepted mandate
10
+ required by `wdi-autopilot`, resolves coordinator self code-review and independent peer-review dispatch
11
+ from local configuration or agent rules, and launches the execution via `/loop <interval>` (default
12
+ `10m`).
13
+
14
+ `/wdi-daily-autopilot [self-review] [peer] [interval] [--skip-peer-review|--no-review]`:
15
+ - `[self-review]` — coordinator self code-review pass model (`default` or explicit model slug; alias `[in-session]`).
16
+ `default` indicates the current coordinating session executes self code-review directly.
17
+ - `[peer]` — independent peer reviewer runner or model identifier.
18
+ - `[interval]` — optional loop interval matching `^\d+[smhd]$` (e.g., `5m`, `10m`, `15m`). Defaults
19
+ to `10m` when omitted.
20
+ - `--skip-peer-review` / `--no-review` — bypasses the secondary peer review pass. MUST NOT disable
21
+ coordinator self code-review, TDD cycles, or automated test suites.
22
+
23
+ ## 0. Precondition
24
+
25
+ Confirm `.control/registry/index.yaml` exists in the repo root. If it does not, this is not a WDI
26
+ Method product repo — report that and stop.
27
+
28
+ ## 1. Parse Arguments and Flags
29
+
30
+ Parse inputs unambiguously using these rules:
31
+ 1. Check for review bypass flags: `--skip-peer-review` or `--no-review`. If present, mark peer review
32
+ as bypassed.
33
+ 2. Check for an interval token matching `^\d+[smhd]$`. If found, assign it to `<interval>`; otherwise
34
+ default `<interval>` to `10m`.
35
+ 3. For remaining positional arguments:
36
+ - If 1 argument remains: assign to `<peer>`, and default `<self-review>` to `default`.
37
+ - If 2 arguments remain: assign first to `<self-review>` and second to `<peer>`.
38
+ - If 0 arguments remain: read defaults from `.control/custom-dispatch.yaml` if present, else default
39
+ both to `default`.
40
+
41
+ ## 2. Resolve Runner Configuration
42
+
43
+ Inspect the repository for `.control/custom-dispatch.yaml` (if not found in the current working directory and running inside a linked git worktree, resolve it from the main repository root via `(git rev-parse --git-common-dir)/..`):
44
+ - **If `.control/custom-dispatch.yaml` exists**:
45
+ Read `runners:`, `roles:`, and `review_policy:`.
46
+ - If `review_policy.peer_review` is explicitly `false`, or if `roles.reviewer` is set to `none`, mark peer review as bypassed.
47
+ - If `<peer>` was not explicitly specified on the command line, use `roles.reviewer`. If resolved `<peer>` is `none`,
48
+ mark peer review as bypassed (coordinator self-review only).
49
+ - If `roles.deep_analyst` is `none`, document review and architecture analysis are handled by the main reviewer or
50
+ coordinator directly, without dispatching a separate deep analyst process.
51
+ - `roles.builder` is fixed to `coordinator`: the coordinating session implements code directly inside the active run worktree (ensuring tight TDD cycles, direct verification, and eliminating delegation/handoff hallucinations). Coding delegation (whether `in-session` subagents or external builder runners) is prohibited in the daily routine.
52
+ Guardrail: coordinator direct implementation MUST NOT eliminate independent peer review for components whose `risk_accepted` is not `low`; `roles.reviewer` MUST NOT be set to `none` in such cases.
53
+ - Resolve runner dispatch by `type:` for reviewer and deep analyst:
54
+ - `auto`: Evaluates whether the runner's target model is reachable in-session from the active
55
+ session profile (per the caller's global agent collaboration rules). Dispatches in-session via `Agent`
56
+ if reachable; falls back to shell-out using `command` if unreachable in-session.
57
+ - `in-session`: Dispatches strictly via in-session `Agent` subagent.
58
+ - `shell-out`: Executes the external shell-out `command` (single-string command). If `command` is absent
59
+ or empty, stop and report immediately (fail-closed).
60
+ - **If `.control/custom-dispatch.yaml` does not exist**:
61
+ Resolve reviewer dispatch through the caller's active CLI environment.
62
+
63
+ ## 3. Mandate Verification & Preflight Requirement
64
+
65
+ Per `wdi-autopilot` § Preflight, unattended loop iterations **require an active accepted mandate** in
66
+ `.control/registry/decisions.yaml` whose expiry date has not lapsed. A loop MUST NOT self-authorize
67
+ its own mandate.
68
+
69
+ 1. Check if an active accepted mandate exists:
70
+ - An active mandate MUST have BOTH `type: mandate` and `status: accepted` with an unexpired `expires:` date
71
+ (`today <= expires`) and no `superseded_by:` or `status: superseded`.
72
+ - **Primary lookup ($O(1)$):** Read `.control/generated/status.yaml` and inspect `mandates:`:
73
+ - If `mandates.resolution: one`: the active mandate is `mandates.active_mandate.id` (with its verified `expires` and `status`). Proceed directly to step 3.
74
+ - If `mandates.resolution: ambiguous`: stop and report immediately to the maintainer naming all `mandates.active_ids` (fail-closed; MUST NOT guess or choose between them).
75
+ - If `mandates.resolution: none`: proceed to step 2 (Preflight).
76
+ - **Fallback lookup (when `status.yaml` does not exist or lacks `mandates:`):**
77
+ - MUST NOT run a broad search for `type:\s*mandate` across `decisions.yaml` (which matches dozens of historical
78
+ `applied` mandates and overflows the tool output limit with hundreds of lines).
79
+ - Query specifically for an active mandate entry using multiline search (e.g. `Grep` with
80
+ `pattern: "type:\s*mandate[\s\S]{1,100}?status:\s*accepted|status:\s*accepted[\s\S]{1,100}?type:\s*mandate", multiline: true`).
81
+ Once a candidate match is found, verify its individual decision block to confirm `expires:` is present,
82
+ valid, and unexpired.
83
+ - **Fail-closed on multiple active mandates:** If more than 1 active accepted mandate is found, stop and
84
+ report immediately to the maintainer (fail-closed; MUST NOT guess or choose between them).
85
+ - MUST NOT call `Read` on the entire 1000+ line `decisions.yaml` file. When reading the latest decision ID
86
+ to determine the next candidate `DEC-` ID, read only the tail (e.g. the last 50-80 lines) of `decisions.yaml`.
87
+ 2. **If no active accepted mandate exists:**
88
+ - Execute `wdi-autopilot` Door 1 (Preflight) in this interactive turn.
89
+ - When checking open work to include in the mandate, query `specs.yaml` selectively (e.g. `Grep` for
90
+ `status:\s*(open|ready-for-dev)`) instead of reading all historical closed specs into context.
91
+ Inspect the candidate spec's folder using the `spec_folder:` path from `specs.yaml` (MUST NOT run
92
+ broad recursive searches on all of `.scratch/`).
93
+ - Run validator preflight via `uv run .constitution/method/scripts/validate.py --check --baseline`
94
+ (or `--generate --baseline`). If `.github/validate-baseline.txt` exists in the repo, the `--baseline` flag
95
+ guarantees that accepted repository baseline findings are recognized as green.
96
+ - When verifying the preflight test suite from `codebase-stack-guide.md`, run tests with quiet output flags
97
+ if supported (e.g. `-- --quiet` or standard concise runner flags) to avoid flooding the context window
98
+ with hundreds of verbose pass lines.
99
+ - **Fail-closed on test failure:** If the test suite command exits non-zero, immediately surface the failure
100
+ summary (the failing test names and error excerpt) and abort preflight; a mandate MUST NOT be opened on a
101
+ failing test suite.
102
+ - Present the one-page preflight summary and wait for the owner's explicit confirmation.
103
+ - Once confirmed, write the accepted mandate row into `decisions.yaml` and initialize its ledger.
104
+ 3. **If an active accepted mandate already exists:** Proceed directly to compose and launch the loop.
105
+
106
+ ## 4. Compose the Routine Mandate
107
+
108
+ Fill the standing five-point routine template:
109
+
110
+ ```markdown
111
+ Execute all FR/Tickets/Specs to completion under the active mandate:
112
+ 1. Coding & Implementation: author code directly as coordinator in the active worktree. No coding delegation — coordinator alone implements application and test changes following TDD red-to-green cycles. Boundary: coordinator edits application and test files only during ticket coding, and defers commits to step 5. Builder MUST NOT commit, push, merge, alter git branches, or write to .control/registry/ or .control/memlog/.
113
+ 2. Code review: perform code review — self code-review by coordinator, and peer review: <resolved peer command | "none due to config">.
114
+ 3. Testing & Verification: coordinator alone runs the authoritative test suite (from codebase-stack-guide.md) directly on the active worktree after the coding pass and verifies red-to-green evidence before staging or committing.
115
+ 4. Reviews and peer analysis: delegate document and architecture review to <resolved peer command | "coordinator self-review (peer review: none due to config)"> — follow wdi-review criteria for any touched architecture or spec documents.
116
+ 5. Worktree isolation & Integration: coordinator alone isolates ticket implementation into the run worktree, writes ledger decisions in .control/memlog/, stages/commits, and merges per wdi-autopilot. Peer review: <"peer reviewer inspects worktree without interfering with active build processes" | "none due to config">.
117
+ ```
118
+
119
+ If peer review was bypassed (via `roles.reviewer: none`, `review_policy.peer_review: false`, or `--skip-peer-review`),
120
+ explicitly record `peer review: none due to config` in items 2, 4, and 5, instructing the coordinator to perform direct
121
+ self-review and self-verification without external peer dispatch.
122
+
123
+ ## 5. Launch
124
+
125
+ Invoke the `loop` skill with `<resolved interval> /wdi-autopilot <composed text from step 4>`. This
126
+ starts the loop execution.
127
+
128
+ ## 6. Verify Immediate Execution
129
+
130
+ Before finishing, verify that `/wdi-autopilot` was invoked in this same turn for the first iteration
131
+ rather than remaining idle until the first cron interval tick. If it did not run immediately, invoke
132
+ `/wdi-autopilot` now to start the first iteration.
133
+
134
+ ## 7. Report and Stop
135
+
136
+ Report the resolved configuration (in-session mechanism, peer review status, active mandate ID, and
137
+ loop interval), confirm that the loop is active, and stop. MUST NOT intervene in or micromanage
138
+ subsequent loop iterations.
@@ -0,0 +1,155 @@
1
+ ---
2
+ name: wdi-daily-what-to-build
3
+ description: Turn raw manual-test notes into a triaged, reviewed spec/ticket ready for wdi-autopilot to pick up in a separate session. Invoke as `/wdi-daily-what-to-build [reviewer] <your raw notes>`.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # WDI Daily What-to-Build Triage
8
+
9
+ Daily entry point for "I just tested something by hand, now what." Classifies the notes (new feature,
10
+ fix, removal, or green), authors the resulting spec or ticket through this repo's own `wdi-build` flow,
11
+ dispatches an independent second opinion grounded in the *original* notes, folds that feedback back in,
12
+ then stops — this run never continues into `wdi-autopilot`, a commit, or a push.
13
+
14
+ Spec lifecycle maintenance (archiving or pruning closed specs) belongs to `/wdi-prune-or-archive`;
15
+ this skill remains 100% focused on triaging incoming test notes into actionable specs without administrative
16
+ interruption.
17
+
18
+ `/wdi-daily-what-to-build [reviewer] <notes>` — if the first word matches a known runner or a reviewer
19
+ defined in `.control/custom-dispatch.yaml`, it picks the reviewer; otherwise all input is treated as
20
+ the notes verbatim. Multi-line notes are accepted unedited; none of it gets summarized before review
21
+ dispatch.
22
+
23
+ ## 0. Precondition
24
+
25
+ Confirm `.control/registry/index.yaml` exists in the repo root. If it does not, this is not a WDI
26
+ Method product repo and this skill has no corpus to write into — report that and stop.
27
+
28
+ ## 1. Keep the notes verbatim
29
+
30
+ Hold the raw notes as given. They are forwarded unedited to the reviewer in step 4 — a paraphrase
31
+ here would anchor the reviewer to your interpretation instead of the author's own words.
32
+
33
+ ## 2. Classify against the actual corpus, not the notes alone
34
+
35
+ Search `.what/`, `.how/`, and `.control/` for the FR, UC, ticket, or SPEC the notes actually touch
36
+ before deciding new vs. fix vs. removal vs. green. A classification made without checking what already
37
+ exists there is a guess.
38
+
39
+ - **Green** — behaviour already matches what is promised and built. Report that and stop; MUST NOT
40
+ open a spec or ticket for a non-finding.
41
+ - **New / fix / removal** — continue to step 3.
42
+
43
+ ## 3. Author through wdi-build, not by hand
44
+
45
+ This repo's Delivery Flow standing sequence (`AGENTS.md` § Delivery Flow) requires turning notes into
46
+ a spec or ticket through `wdi-build`'s engines (`to-spec` / `to-tickets`) — MUST NOT hand-write a
47
+ bespoke SPEC.md or ticket file instead.
48
+
49
+ Invoke `wdi-build` Phase 1 (open spec and author tickets via `to-spec` / `to-tickets`) directly on the
50
+ active development branch (`policy.development_branch`, default `main`), per the Delivery Flow standing
51
+ exception.
52
+
53
+ ### Ticket Dependency Contract (Upfront `parallel-tickets-blocked`)
54
+ Author `touches` and `blocked_by` together; do NOT defer dependency relationships until validation.
55
+ For every pair of tickets in the same spec whose `touches` lists intersect, there MUST be a directed
56
+ `blocked_by` path in one direction between them. The path MAY be transitive: a direct edge is not required
57
+ when an already-declared dependency chain orders the pair (e.g. `02` blocked by `01`, `03` blocked by `02`).
58
+ This is the contract enforced by `parallel-tickets-blocked`.
59
+
60
+ Before leaving Step 3, run validator preflight:
61
+ ```bash
62
+ uv run .constitution/method/scripts/validate.py --check --baseline
63
+ ```
64
+ If `parallel-tickets-blocked` reports unsequenced tickets, add the missing `blocked_by` edge to an upstream
65
+ ticket immediately. Findings already matching `.github/validate-baseline.txt` are pre-existing debt, not new
66
+ blockers; only new RED findings must be repaired before dispatching review.
67
+
68
+ **Stop at the boundary of Phase 1.** Once the spec and ticket files exist on disk, do NOT proceed into
69
+ Phase 2 (worktree isolation and ticket implementation) or Phase 3 (closing the spec) — each of those is
70
+ a separate, explicit ask, usually from a different chat session running `wdi-autopilot`.
71
+
72
+ ## 4. Package and dispatch an advisory second opinion
73
+
74
+ Write the review packet to a scratch file first — `.work/wdi-daily-what-to-build/<slug>-second-opinion.md` —
75
+ rather than inlining it into shell arguments:
76
+
77
+ 1. Path to the drafted spec or ticket from step 3.
78
+ 2. The original raw notes from step 1, unedited.
79
+ 3. Relevant component, subsystem, and ticket `touches` / `blocked_by` declarations, plus the preflight validator output.
80
+ 4. This standing mandate (strictly advisory / read-only):
81
+
82
+ > You are the independent advisory reviewer for this daily triage pass, not the implementer or author.
83
+ > Review the named draft against the verbatim notes and the cited corpus only. Return a structured written
84
+ > assessment in markdown:
85
+ > - **Verdict**: `accept` | `accept-with-changes` | `reject`
86
+ > - **Findings**: numbered; categorized as `blocking` vs `non-blocking`
87
+ > - **Notes vs Draft**: specific gaps, misinterpretations, or scope creep relative to raw notes
88
+ > - **Stamp Recommendation**: lenses to use (must include `edge-case-hunter`), readiness for trace stamping,
89
+ > and blockers that must be resolved first
90
+ >
91
+ > You MUST NOT edit, create, delete, rename, or mutate any repository file. You MUST NOT invoke `wdi-review`,
92
+ > MUST NOT write `spec_reviewed` in `specs.yaml`, and MUST NOT modify frontmatter. Stamping is the
93
+ > coordinator's sole responsibility upon folding your feedback; this dispatch is advisory feedback only.
94
+
95
+ Reviewer resolution:
96
+ - If `review_policy.peer_review` is explicitly `false`, or if `roles.reviewer` in `.control/custom-dispatch.yaml` is set
97
+ to `none`, or if the command is invoked with `--no-review`, skip Step 4 and state in the report that peer review was skipped.
98
+ - If `.control/custom-dispatch.yaml` exists in the repo root (or in the main repository root via `(git rev-parse --git-common-dir)/..` when running inside a linked git worktree): inspect `runners:` and `roles.reviewer`.
99
+ A runner definition specifies `type:` (`auto`, `in-session`, or `shell-out`):
100
+ - `auto` (recommended): Evaluates whether the runner's target model is reachable in-session from the active
101
+ session profile (per the caller's global agent collaboration rules). Dispatches in-session via the `Agent`
102
+ tool in read-only mode if reachable; falls back to shell-out using `command` if unreachable in-session.
103
+ - `in-session`: Dispatches strictly via the in-session `Agent` tool using a read-only subagent type.
104
+ - `shell-out`: Dispatches strictly via external shell `command` (single-string command, passing the review packet path).
105
+ A shell-out reviewer MUST be invoked with its read-only flag where supported (e.g. `--trust-tools=fs_read` for
106
+ `kiro-cli`, `--mode plan` for `cursor-agent`).
107
+ If the runner ID is missing from `runners:` or if `type: shell-out` lacks a nonempty `command` string,
108
+ stop and report immediately (fail-closed).
109
+ - Dispatch execution & process discipline:
110
+ - Cap shell-out dispatch at a hard wall-clock limit (default 600s, or `timeout_s` if defined in `custom-dispatch.yaml`).
111
+ - Run backgrounded with polling or synchronous wait. If the timeout expires, or the process exits non-zero,
112
+ or the output file cannot be read: terminate the entire process tree by its PID (MUST NOT use process name-based
113
+ killing). Record in the final report: `peer review: fell back to coordinator self-review after timeout/failure`.
114
+ MUST NOT fabricate or synthesize unread reviewer output as if it were faithfully received.
115
+ - In the absence of a custom runner file: follow the caller's configured agent collaboration setup
116
+ (e.g., in-session read-only subagent via the `Agent` tool if reachable, or the caller's configured CLI
117
+ environment).
118
+
119
+ When the dispatched reviewer has no native Skill tool, instruct it to read and follow the target
120
+ guide directly as plain markdown instructions.
121
+
122
+ ## 5. Coordinator fold-in, stamping, and validation
123
+
124
+ The coordinator is the sole writer in this flow. Read the advisory assessment, revise the draft where it is
125
+ correct, and report every material objection as `accepted`, `deferred` (with its recorded destination), or
126
+ `disagreed` (with the reason). MUST NOT silently drop a reviewer objection.
127
+
128
+ ### Coordinator Stamping (`spec_reviewed`)
129
+ Stamping is an official coordinator-owned event. Because the peer review was conducted live in this session
130
+ under the coordinator's orchestration, the coordinator writes the `spec_reviewed` block directly to
131
+ `.control/registry/specs.yaml` once the draft is accepted and amended:
132
+ ```yaml
133
+ spec_reviewed:
134
+ date: "<YYYY-MM-DD>"
135
+ sha: <git rev-parse HEAD>
136
+ lenses: [structure, prose, edge-case-hunter]
137
+ ```
138
+ The coordinator MUST NOT delegate registry stamping to external shell-out processes.
139
+
140
+ ### Validation
141
+ Run canonical validation using `uv`:
142
+ ```bash
143
+ uv run .constitution/method/scripts/validate.py --generate --baseline
144
+ ```
145
+ - Validation MUST be run via `uv run`, never bare `python` (which triggers Windows Python launcher shebang failures).
146
+ - `--baseline` acknowledges the repository's established baseline in `.github/validate-baseline.txt`. It exits
147
+ zero only if current findings match that baseline exactly.
148
+ - This skill MUST NOT expand or edit the baseline file. Any new RED finding outside the baseline represents an
149
+ unresolved issue and must be fixed before handoff.
150
+
151
+ ## 6. Stop and hand off
152
+
153
+ Report what now exists (or that the notes were green) and its file path. State explicitly whether `spec_reviewed`
154
+ was stamped or if peer review fell back to coordinator self-review. MUST NOT commit, push, or start `wdi-autopilot`
155
+ in this same run — state that as the next step and wait for the maintainer to request it.
@@ -0,0 +1,127 @@
1
+ ---
2
+ name: wdi-daily-what-to-test
3
+ description: Sync to development branch, prune merged worktrees/branches, configure target application smoke environment, and build a test checklist from closed tickets. Invoke as `/wdi-daily-what-to-test [web <target>|mobile <target>|desktop]`.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # WDI Daily What-to-Test
8
+
9
+ The post-merge daily verification step after a `wdi-autopilot` or ticket delivery run merges: lands
10
+ back on the active development branch, safely prunes stale merged worktrees and task branches while
11
+ strictly preserving protected branches, configures the application where it needs to be for platform
12
+ verification, cleans temporary smoke logs, and presents a checklist of what changed — grounded in
13
+ closed tickets and specs, never invented from memory.
14
+
15
+ - `/wdi-daily-what-to-test` — sync + prune + checklist only, nothing deployed or launched.
16
+ - `/wdi-daily-what-to-test web <target>` — sync + configure or deploy web target, then checklist.
17
+ - `/wdi-daily-what-to-test mobile <target>` — sync + launch or install onto device or emulator, then
18
+ checklist.
19
+ - `/wdi-daily-what-to-test desktop` — sync + launch application locally (current machine is target),
20
+ then checklist.
21
+
22
+ ## 0. Preconditions & Branch Policy Precheck
23
+
24
+ 1. Confirm `.control/registry/index.yaml` exists in the repo root. If it does not, this is not a WDI
25
+ Method product repo — report that and stop.
26
+ 2. Read branch policy from `.control/registry/index.yaml`:
27
+ - `primary_branch` (`policy.primary_branch`, default `main`).
28
+ - `development_branch` (`policy.development_branch`, default `main`).
29
+ 3. **Fail-Closed Branch Verification:** Verify that `development_branch` exists in local or remote
30
+ tracking references (`git rev-parse --verify refs/heads/<development_branch>` or
31
+ `git rev-parse --verify refs/remotes/origin/<development_branch>`). If neither resolves, stop
32
+ immediately and report to the maintainer; per `.constitution/method/branch-guide.md`, MUST NOT guess
33
+ or silently fall back to `main`.
34
+ 4. Verify the primary working tree is clean (`git status --porcelain`). If uncommitted changes exist,
35
+ stop and report without modifying git state.
36
+
37
+ ## 1. Sync (Fast-Forward Only)
38
+
39
+ 1. Save the pre-sync HEAD commit as `before_sync` (`git rev-parse HEAD`), or read the last sync cursor from `.work/smoke/last-sync` if present.
40
+ 2. Fetch remote updates and prune deleted tracking refs: `git fetch --prune origin`.
41
+ 3. Land on `development_branch` in the primary repository worktree using standard git operations
42
+ (`git checkout <development_branch>` or `git switch <development_branch>`).
43
+ 4. Pull remote updates strictly with fast-forward: `git pull --ff-only`.
44
+ If the branch has diverged or cannot be fast-forwarded, stop and report immediately; MUST NOT create
45
+ an automatic merge commit on `development_branch`.
46
+
47
+ ## 2. Prune Merged Task Branches & Worktrees (With Immunity Protections)
48
+
49
+ Apply strict immunity per `.constitution/method/branch-guide.md` § Absolute branch immunity:
50
+ - **Immune Branches:** `primary_branch` and `development_branch` **MUST NEVER be deleted**, locally or on any remote.
51
+ - **Immune Checkouts:** The currently checked-out branch and the primary worktree root **MUST NEVER be removed**.
52
+ - **Dirty Worktrees:** Any worktree with uncommitted changes (`git status --porcelain` non-empty) **MUST NOT be removed**.
53
+
54
+ Pruning procedure:
55
+ 1. Enumerate candidates merged into `development_branch`: `git branch --merged <development_branch>`.
56
+ 2. Filter the candidate list to explicitly **exclude**:
57
+ - `primary_branch`
58
+ - `development_branch`
59
+ - the currently active branch (`HEAD`)
60
+ 3. Enumerate active worktrees: `git worktree list --porcelain`.
61
+ 4. For each remaining merged local task branch:
62
+ - If a worktree is linked to that branch: check whether the worktree has uncommitted changes. If clean,
63
+ remove the worktree first (`git worktree remove <worktree-path>`).
64
+ - Delete the merged local branch: `git branch -d <branch-name>`.
65
+ 5. Remote branch hygiene (fail-closed):
66
+ - For method-owned task branches (e.g. `autopilot/<mandate-id>`) merged into `development_branch`:
67
+ verify PR merge status (e.g. confirming its tip is an ancestor of `origin/<development_branch>`, or via `gh pr view <branch> --json state,mergedAt`).
68
+ - If confirmed merged and non-immune, delete the remote branch: `git push origin --delete <branch>`.
69
+ - If status cannot be verified, or if the toolchain is unavailable: do NOT delete; report as residual remote branch.
70
+ 6. If any candidate branch or worktree is ambiguous or has unmerged/dirty state, leave it untouched
71
+ and list it in the report.
72
+
73
+ ## 3. Configure Target Testing Environment
74
+
75
+ When no platform argument is given, proceed directly to step 4 without launching any platform target.
76
+
77
+ - **`desktop`**: Current machine is the target.
78
+ 1. Inspect `.control/test-targets/desktop.md` (or `.constitution/project/codebase-stack-guide.md`) for build command, profile (default: `release` if verifying visual layout/performance, or `debug` for fast logic loops), target binary artifact path, and process executable name.
79
+ 2. **Desktop Process Gate (File-Locking Prevention):** Before compiling or launching:
80
+ - Check whether an existing process is executing the target artifact binary (inspecting processes matching the binary path or application executable name).
81
+ - If an active process is found: check whether it was launched by a previous smoke run (recorded in `.work/smoke/runtime-desktop.yaml`). If recorded, attempt graceful shutdown and wait for exit.
82
+ - If the process is not from WDI smoke or cannot exit gracefully: **MUST NOT** force-kill blindly (`Stop-Process -Force` is prohibited without confirmation); report the PID, binary path, and file-lock hazard to the maintainer, and stop before rebuilding.
83
+ 3. **Build Target:** Rebuild the binary if it is missing or older than the current `HEAD` commit, adhering to the project's build command and profile. If the binary already matches `HEAD`, skip rebuilding.
84
+ 4. **Launch Application:** Launch the application locally using the documented launch command.
85
+ 5. **Runtime Manifest:** Record `{ pid, started_at, artifact_path, profile, head }` to `.work/smoke/runtime-desktop.yaml` (ephemeral artifact under `.work/`, never committed).
86
+ - **`web <target>`**: Inspect `.control/test-targets/web.md` if present. Follow deployment or serving
87
+ procedures documented in project guides or the devops repository for `<target>`.
88
+ - **`mobile <target>`**: Inspect `.control/test-targets/mobile.md` if present. Use the `run` skill or
89
+ documented project mobile commands to target the named device or emulator `<target>`.
90
+
91
+ ## 4. Build Checklist from Closed Tickets (Delta-Scoped Retrieval)
92
+
93
+ MUST NOT perform a full-file read or broad regex scan of the historical `specs.yaml`.
94
+ Derive the verification checklist directly from the delivery delta:
95
+ 1. Define the delivery commit range: `before_sync..HEAD` (or fallback to `last-sync..HEAD`, or the recent merge commit on first-parent history if cursor is absent).
96
+ 2. Inspect paths touched within the delta:
97
+ - Identify closed specifications by matching `.scratch/*/SPEC.md` or `.control/memlog/autopilot-*.md` modified in the delta.
98
+ - Read the changed autopilot ledger (`.control/memlog/autopilot-<id>.md`) as an index of closed tickets and scope.
99
+ 3. For each candidate closed spec:
100
+ - Read candidate's `SPEC.md` and issues under `.scratch/<spec-folder>/` to extract acceptance criteria and hand-testable verification steps.
101
+ - Verify spec's `status: closed` selectively against `.control/registry/specs.yaml` (matching only that specific spec's block, never loading the entire file).
102
+ 4. Group hand-testable verification items by component or screen:
103
+
104
+ ```markdown
105
+ Component & Issue / Screen
106
+ 1. Feature Title
107
+ [ ] verification step 1
108
+ [ ] verification step 2
109
+ ```
110
+
111
+ When a target was specified (`desktop`, `web`, or `mobile`), append the relevant template checklist
112
+ items from `.control/test-targets/<target>.md`. If no closed spec is detected in the delta, report that
113
+ no new closed tickets were merged in this sync.
114
+
115
+ ## 5. Clean Ephemeral Smoke Artifacts
116
+
117
+ Clean up temporary smoke test logs and dumps under `.work/smoke/` created during the test run.
118
+ Record the current sync commit hash to `.work/smoke/last-sync` to serve as a local non-authoritative
119
+ cursor for subsequent runs. MUST NOT remove or modify permanent ledger files under `.control/memlog/`
120
+ (they are permanent audit records).
121
+
122
+ ## 6. Report and Stop
123
+
124
+ 1. Display the generated checklist, target runtime info (artifact path, build profile, PID, SHA), report which merged task worktrees/branches were pruned, and note any preserved immune branches.
125
+ 2. **Post-Verification Housekeeping Notice:** Provide a non-blocking informational note:
126
+ *"Closed specification directories in `.scratch/` can be archived or pruned via `/wdi-prune-or-archive --spec <id> --archive` once hand-testing is complete."*
127
+ 3. Stop. MUST NOT continue into further coding, commits, or another autopilot run in the same turn.
@@ -26,7 +26,7 @@ Four asks look alike from the outside and are four skills:
26
26
  | Source | What it answers |
27
27
  |---|---|
28
28
  | The topic argument | An id (`OQ-12`, `DEC-007`, a defect row, a validator name), a file path, or a sentence |
29
- | `.control/registry/*.yaml` · `.control/generated/status` | What the registry says holds today, and which validators are red |
29
+ | `.control/registry/*.yaml` · `.control/generated/status.md` | What the registry says holds today, and which validators are red (also available as `status.yaml`) |
30
30
  | `.control/questions/` · `.control/decisions/` | Whether this was asked or decided before, and what is already settled |
31
31
  | The working documents in `.what/` and `.how/` | The promise and the mechanism the topic touches |
32
32
  | `validate.py` output · tests · git history · the code | What actually holds, as opposed to what a document claims |
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: wdi-help
3
- description: Use when you need to know where the project stands in the delivery flow and which skill comes next. Answers from this project's five gates, not from BMad's phase column.
3
+ description: Check project delivery status, open or pending specs and tickets, current gate progress, and determine what to build or which skill to invoke next. Answers from this project's status registry and five gates.
4
4
  ---
5
5
 
6
6
  # WDI Help
@@ -18,15 +18,16 @@ about BMad itself.
18
18
 
19
19
  | Source | What it answers |
20
20
  |---|---|
21
- | `.control/generated/status` | Which spec is open, how many of its tickets are done, which validators are red |
21
+ | `.control/generated/status.yaml` | Primary machine-readable status: which spec is open, tickets progress, red validators (or `status.md`) |
22
22
  | `.control/registry/index.yaml` | The global `mode`, and the gate map |
23
23
  | `.control/registry/components.yaml` | Per-component `mode`, `risk_accepted`, and `g4_passed` |
24
- | `.control/registry/specs.yaml` | Spec → release, size, `depends_on`, and its ticket index |
24
+ | `.control/registry/specs.yaml` | Fallback only when status is absent/stale: spec → release, size, and ticket index (MUST query selectively) |
25
25
  | `.constitution/method/document/delivery-flow-guide.md` | The five gates and their checklists |
26
26
  | `.constitution/method/why/README.md` | The whole shape, when the caller has never seen the method |
27
27
 
28
- You MUST read `.control/generated/status` rather than counting files yourself. It is generated from the
29
- registry; hand-counting produces a second answer that will disagree.
28
+ You MUST read `.control/generated/status.yaml` (or `status.md`) rather than counting files yourself. You
29
+ MUST NOT open or inspect `.control/registry/specs.yaml` if the status file is present and answers which
30
+ spec is open.
30
31
 
31
32
  ## What to answer
32
33
 
@@ -74,6 +75,11 @@ mis-route in this flow, because every other gate is the same for every component
74
75
  | An accepted `DEC-` has not reached its documents | `wdi-decision` intent `apply` |
75
76
  | A bug, a failing test, unexpected behaviour | `wdi-systematic-debugging`, before any fix is proposed |
76
77
  | Numbers are wanted before the work is committed | `wdi-report` intent `estimate` |
78
+ | Closed specs remain in `.scratch/`, or need archival/pruning | `wdi-prune-or-archive` — archives closed spec to `.archive/specs/` or prunes from disk |
79
+ | Raw manual-test notes needing triage, review, and spec drafting | `wdi-daily-what-to-build` — classifies notes, drafts spec/tickets via `wdi-build`, gets second opinion |
80
+ | Autonomous delivery loop with local runner and peer review | `wdi-daily-autopilot` — composes routine, resolves local runners, launches `/loop` unattended |
81
+ | Merged autopilot run needing branch cleanup and physical test checklist | `wdi-daily-what-to-test` — syncs branch, prunes merged worktrees/branches, configures smoke target, provides delta-scoped checklist |
82
+ | Cleaning up generated rendered duplicate files from git | Untrack via `git rm -r --cached .what-rendered/ .how-rendered/`, add to `.gitignore`, regenerate via `validate.py --generate` |
77
83
 
78
84
  A brief that exists but is thin is still a brief. You MUST NOT route back to `wdi-problem` because a
79
85
  section reads weakly — route there only when the brief is absent, when a change signal invalidates what
@@ -90,8 +96,16 @@ it claims, or when one of its eight required sections is missing outright.
90
96
  `wdi-blueprint`, `wdi-build`, `wdi-decision`, `wdi-review`, `wdi-ux`.
91
97
  - Only `.control/questions/blocking.md` holds a gate. `external.md` holds go-live and MUST NOT be reported
92
98
  as blocking a design gate; `assumptions.md` holds nothing.
93
- - You MUST NOT invent progress. If `.control/generated/status` is missing or stale, say so and name
94
- `validate.py --generate`.
99
+ - You MUST NOT invent progress. If `.control/generated/status.yaml` (or `status.md`) is missing or stale,
100
+ say so, query `specs.yaml` selectively, and name `validate.py --generate`.
101
+ - You MUST NOT call Read on the entire 1000+ line `.control/registry/specs.yaml` file into context. When
102
+ discovering active or open work as a fallback, query `specs.yaml` selectively (e.g. `Grep` for `status:\s*(open|ready-for-dev)`).
103
+ - You MUST NOT run broad or recursive searches across `.scratch/` (e.g. searching `*` or `**/*`). When
104
+ inspecting candidate open specs or tickets, inspect only the candidate spec's folder using the `spec_folder:`
105
+ path resolved from `specs.yaml`.
106
+ - You MUST treat `wdi-help` as a fast status and routing skill: if filesystem drift, orphaned folders, or
107
+ discrepancies between registry and disk are suspected, route to `wdi-reconcile` rather than conducting
108
+ a filesystem audit in this skill.
95
109
  - You MUST NOT route anyone to `/setup-matt-pocock-skills` to *finish an install*. The installer seeds
96
110
  `docs/agents/` pre-answered, and that interview's own defaults send every engineering skill looking for a
97
111
  root `CONTEXT.md` and `docs/adr/` — which Article 3 forbids and `wdi-reconcile` reports. It is for
@@ -196,6 +196,22 @@ it to make the output quiet.
196
196
  The rows themselves are **not** yours to land. This intent produces the reader; `wdi-blueprint` intent
197
197
  `platform` owns the three inventories, and a plan-versus-code gap is its finding to route.
198
198
 
199
+ ## Rendered Files Hygiene & Gitignore (Optional)
200
+
201
+ The `.what-rendered/` and `.how-rendered/` directories contain generated human-facing presentations
202
+ derived from canonical files in `.what/` and `.how/`. The method validator deliberately excludes them
203
+ from `COMMITTED_DIRS`, allowing products to choose whether to commit them.
204
+
205
+ If the maintainer prefers to keep the git tree clean of generated presentation files:
206
+ 1. Untrack them from git: `git rm -r --cached .what-rendered/ .how-rendered/`
207
+ 2. Add both folders to `.gitignore`:
208
+ ```gitignore
209
+ .what-rendered/
210
+ .how-rendered/
211
+ ```
212
+ 3. Whenever a human-readable rendered view is needed, regenerate on demand:
213
+ `uv run .constitution/method/scripts/validate.py --generate`
214
+
199
215
  ## Rules
200
216
 
201
217
  - You MUST NOT write `.what/` or `.how/` content beyond a skeleton and its frontmatter. Behaviour is
@@ -0,0 +1,76 @@
1
+ ---
2
+ name: wdi-prune-or-archive
3
+ description: Clean up completed closed specs by archiving to `.archive/specs/` or pruning from disk, wrapping lifecycle.py with fail-closed safety. Invoke as `/wdi-prune-or-archive [--spec <id>|--all-closed] [--archive|--prune] [--dry-run]` or bare `/wdi-prune-or-archive` for interactive selection.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # WDI Prune or Archive
8
+
9
+ Standalone housekeeping skill for closed specifications. Moves completed spec directories to
10
+ `.archive/specs/<spec-folder>/` or prunes completed tickets from disk using `lifecycle.py`, while
11
+ strictly preserving requirement traceability and RTM metadata in `.control/registry/specs.yaml`.
12
+
13
+ - `/wdi-prune-or-archive` — interactive mode: discovers closed specs in `.scratch/`, presents options,
14
+ and confirms before execution.
15
+ - `/wdi-prune-or-archive --spec <id> --archive` — archives `<id>` to `.archive/specs/<spec-folder>/`.
16
+ - `/wdi-prune-or-archive --spec <id> --prune` — removes completed `<id>` folder from disk and git.
17
+ - `/wdi-prune-or-archive --all-closed --archive` — archives all closed specs in `.scratch/`.
18
+ - `/wdi-prune-or-archive --all-closed --prune` — prunes all closed specs in `.scratch/`.
19
+ - Add `--dry-run` to any command to simulate without modifying files or git index.
20
+
21
+ ## 0. Preconditions
22
+
23
+ 1. Confirm `.control/registry/index.yaml` exists in the repo root. If it does not, this is not a WDI
24
+ Method product repo — report that and stop.
25
+ 2. Verify git working tree is clean (`git status --porcelain`). If uncommitted changes exist, stop and
26
+ instruct the maintainer to commit or stash changes before running real archive/prune operations.
27
+ (Exception: `--dry-run` permits an uncommitted tree with an advisory note).
28
+
29
+ ## 1. Discovery & Mode Selection
30
+
31
+ ### A. Interactive Mode (invoked bare: `/wdi-prune-or-archive`)
32
+
33
+ 1. Find closed candidate specs: inspect `.scratch/` directly or run `python .constitution/method/scripts/lifecycle.py --dry-run`
34
+ (or grep `specs.yaml` for `status:\s*closed` — MUST NOT dump the entire historical `specs.yaml` into context).
35
+ 2. Find all specs with `status: closed` whose directory currently resides under `.scratch/`:
36
+ - If no closed specs reside in `.scratch/`: report that `.scratch/` is already clean of closed specs
37
+ and stop.
38
+ - If closed specs are found: list each candidate with its ID, title/release, and folder path.
39
+ 3. Present the three housekeeping choices to the maintainer:
40
+ - **Archive:** Moves the directory to `.archive/specs/<spec-folder>/` via `git mv` and updates
41
+ `spec_folder` in `specs.yaml`. Preserves full historical audit provenance.
42
+ - **Prune:** Removes the directory via `git rm -r` while keeping the spec row and ticket index
43
+ intact in `specs.yaml`. Recommended when git commit history is sufficient.
44
+ - **Defer:** Leave the directories untouched and exit.
45
+ 4. Ask whether to apply the action to all eligible specs (`--all-closed`) or a specific `--spec <id>`.
46
+ 5. Display the exact command that will be executed and request confirmation.
47
+
48
+ ### B. Direct Flag Mode
49
+
50
+ Parse arguments and map them directly to `lifecycle.py` flags:
51
+ - If a positional spec ID is supplied (e.g. `/wdi-prune-or-archive SPEC-1 --archive`), map it to `--spec SPEC-1`.
52
+ - Ensure exactly one action is specified: `--archive` OR `--prune`.
53
+ - Ensure exactly one scope is specified: `--spec <id>` OR `--all-closed`.
54
+ - Pass `--dry-run` if specified.
55
+
56
+ ## 2. Execution via Lifecycle Script
57
+
58
+ All physical git and filesystem operations **MUST** be executed through `lifecycle.py` to guarantee
59
+ atomicity, validation, and rollback:
60
+
61
+ ```powershell
62
+ uv run .constitution/method/scripts/lifecycle.py [arguments]
63
+ ```
64
+
65
+ `lifecycle.py` enforces authoritative preflights:
66
+ - Rejects open or active specs (`status: closed` required).
67
+ - Rejects paths outside authorized spec roots.
68
+ - Rejects folders currently checked out by active git worktrees.
69
+ - Rejects folders cited by active or permanent `.control/memlog/` artifact records.
70
+ - Runs post-operation validation (`validate.py --check`) and automatically rolls back all staged and
71
+ worktree changes if validation fails.
72
+
73
+ ## 3. Report and Stop
74
+
75
+ Display the result of the lifecycle operation verbatim, report updated `spec_folder` paths or pruned
76
+ directories, and stop. MUST NOT proceed into further coding, commits, or other skill invocations.
@@ -188,7 +188,10 @@ reviewed:
188
188
  `EXPERIENCE.md`, and research MAY be reviewed on request; the finding report is the whole output,
189
189
  and no `reviewed:` block is written.
190
190
  - You MUST NOT stamp on behalf of a review someone else ran earlier. Re-run it; the run is cheap and
191
- the claim is not.
191
+ the claim is not. A live peer or second-opinion review dispatched and evaluated within the same coordinating
192
+ session (as in `wdi-daily-what-to-build`) satisfies this requirement; the coordinator, as sole writer, writes
193
+ the trace based on that live session evaluation without needing to independently re-derive the findings from
194
+ scratch. Stale reviews from prior sessions or unverified third-party claims remain strictly prohibited.
192
195
  - When the artifact changed **materially** after the review, the trace is stale and you MUST re-run
193
196
  rather than bump the date. A wording-only change is the one exception, and §*When a review has to run
194
197
  again* owns it.