@skitterbyte/skitterspec-github 0.0.0-stage → 1.0.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.
Files changed (112) hide show
  1. package/MIGRATION.md +1126 -0
  2. package/README.md +53 -2
  3. package/assets/claude-md-section.md +85 -0
  4. package/assets/commands/allow-main.md +33 -0
  5. package/assets/commands/spec-connect.md +13 -0
  6. package/assets/commands/spec-live.md +14 -0
  7. package/assets/commands/spec-remote-review.md +37 -0
  8. package/assets/commands/spec-skip.md +24 -0
  9. package/assets/core/SETUP.md +112 -0
  10. package/assets/core/env.config.json.example +56 -0
  11. package/assets/core/env.config.md +557 -0
  12. package/assets/core/gating.config.json.example +4 -0
  13. package/assets/core/gating.config.md +81 -0
  14. package/assets/core/github.config.json.example +18 -0
  15. package/assets/core/github.config.md +66 -0
  16. package/assets/hooks/main-guard.cjs +162 -0
  17. package/assets/hooks/review-gate.cjs +146 -0
  18. package/assets/review/page.html +3384 -0
  19. package/assets/rules/commit-trailers.md +103 -0
  20. package/assets/rules/negative-checks.md +69 -0
  21. package/assets/rules/offered-unblocks.md +100 -0
  22. package/assets/rules/spec-planning.md +692 -0
  23. package/assets/rules/spec-reports.md +557 -0
  24. package/assets/skills/no-spec/SKILL.md +246 -0
  25. package/assets/skills/spec/SKILL.md +718 -0
  26. package/assets/skills/spec-bug/SKILL.md +646 -0
  27. package/assets/skills/spec-cancel/SKILL.md +263 -0
  28. package/assets/skills/spec-claim/SKILL.md +122 -0
  29. package/assets/skills/spec-complete/SKILL.md +450 -0
  30. package/assets/skills/spec-diff/SKILL.md +870 -0
  31. package/assets/skills/spec-github-setup/SKILL.md +236 -0
  32. package/assets/skills/spec-hotfix/SKILL.md +668 -0
  33. package/assets/skills/spec-init/SKILL.md +178 -0
  34. package/assets/skills/spec-list/SKILL.md +172 -0
  35. package/assets/skills/spec-next/SKILL.md +685 -0
  36. package/assets/skills/spec-push/SKILL.md +307 -0
  37. package/assets/skills/spec-review/SKILL.md +258 -0
  38. package/assets/skills/spec-reviewed/SKILL.md +284 -0
  39. package/assets/skills/spec-start/SKILL.md +554 -0
  40. package/assets/skills/spec-status/SKILL.md +112 -0
  41. package/assets/skills/spec-sync/SKILL.md +226 -0
  42. package/assets/skills/spec-to-main/SKILL.md +139 -0
  43. package/bin/skitterspec-github.js +61 -0
  44. package/package.json +41 -4
  45. package/src/cli.js +5907 -0
  46. package/src/deprecate.js +138 -0
  47. package/src/env/bootstrap.js +188 -0
  48. package/src/env/building.js +143 -0
  49. package/src/env/classify.js +176 -0
  50. package/src/env/commitcmd.js +108 -0
  51. package/src/env/config.js +753 -0
  52. package/src/env/dev.js +63 -0
  53. package/src/env/hooks.js +226 -0
  54. package/src/env/hotfix.js +411 -0
  55. package/src/env/hotfixland.js +302 -0
  56. package/src/env/integrate.js +126 -0
  57. package/src/env/live.js +504 -0
  58. package/src/env/mainguard.js +299 -0
  59. package/src/env/provision.js +466 -0
  60. package/src/env/proxy.js +225 -0
  61. package/src/env/prune.js +119 -0
  62. package/src/env/registry.js +159 -0
  63. package/src/env/render.js +17 -0
  64. package/src/env/resolve.js +716 -0
  65. package/src/env/review.js +2577 -0
  66. package/src/env/reviewers/coderabbit.js +228 -0
  67. package/src/env/reviewers.js +517 -0
  68. package/src/env/serve.js +1044 -0
  69. package/src/env/supervise.js +157 -0
  70. package/src/env/teardown.js +248 -0
  71. package/src/env/trust.js +87 -0
  72. package/src/gating.js +155 -0
  73. package/src/init.js +1150 -0
  74. package/src/lines-diff.js +114 -0
  75. package/src/prompts.js +129 -0
  76. package/src/vendor/github/api.js +800 -0
  77. package/src/vendor/github/cli-sync.js +1530 -0
  78. package/src/vendor/github/commands.js +44 -0
  79. package/src/vendor/github/config.js +414 -0
  80. package/src/vendor/github/credentials.js +109 -0
  81. package/src/vendor/github/dialect.js +62 -0
  82. package/src/vendor/github/identity.js +38 -0
  83. package/src/vendor/github/mcp.js +85 -0
  84. package/src/vendor/provider-kit/index.js +41 -0
  85. package/src/vendor/provider-kit/src/adapter.js +23 -0
  86. package/src/vendor/provider-kit/src/apply.js +207 -0
  87. package/src/vendor/provider-kit/src/args.js +68 -0
  88. package/src/vendor/provider-kit/src/assignment.js +277 -0
  89. package/src/vendor/provider-kit/src/config.js +198 -0
  90. package/src/vendor/provider-kit/src/credentials.js +404 -0
  91. package/src/vendor/provider-kit/src/doctor.js +35 -0
  92. package/src/vendor/provider-kit/src/http.js +63 -0
  93. package/src/vendor/provider-kit/src/identity.js +93 -0
  94. package/src/vendor/provider-kit/src/md-compare.js +39 -0
  95. package/src/vendor/provider-kit/src/md-tables.js +94 -0
  96. package/src/vendor/provider-kit/src/prompt.js +50 -0
  97. package/src/vendor/provider-kit/src/released.js +269 -0
  98. package/src/vendor/provider-kit/src/releases.js +380 -0
  99. package/src/vendor/provider-kit/src/specs.js +166 -0
  100. package/src/vendor/provider-kit/src/transport.js +22 -0
  101. package/src/vendor/sync-core/index.js +93 -0
  102. package/src/vendor/sync-core/src/base.js +81 -0
  103. package/src/vendor/sync-core/src/compare.js +338 -0
  104. package/src/vendor/sync-core/src/dialect.js +51 -0
  105. package/src/vendor/sync-core/src/fields.js +36 -0
  106. package/src/vendor/sync-core/src/legacy.js +100 -0
  107. package/src/vendor/sync-core/src/normalize.js +998 -0
  108. package/src/vendor/sync-core/src/push.js +85 -0
  109. package/src/vendor/sync-core/src/retarget.js +278 -0
  110. package/src/vendor/sync-core/src/task-block.js +308 -0
  111. package/src/vendor/sync-core/src/verify.js +67 -0
  112. package/src/vendor/sync-core/src/write.js +191 -0
@@ -0,0 +1,307 @@
1
+ ---
2
+ name: spec-push
3
+ description: Push a spec up to its linked GitHub issue (repo → GitHub, one-way). The repo is the source of truth and GitHub a generated mirror, so content is never read back or merged. A spec is an issue and each phase a sub-issue. Opt-in — needs specs/.core/github.config.json. Use when the user says "/spec-push", "push to GitHub", "update the GitHub issue from this spec".
4
+ ---
5
+
6
+ # /spec-push — send a spec up to GitHub (one-way)
7
+
8
+ > Stay silent while this runs — speak only to ask something you cannot answer
9
+ > yourself, or to report a failure at the moment it happens. Read
10
+ > `.claude/rules/spec-reports.md` before reporting; it defines the block this
11
+ > skill ends with.
12
+
13
+ Repo → GitHub. The repo is the **source of truth**; GitHub is a
14
+ **generated mirror**. A spec is a GitHub **issue**; each phase is a **sub-issue**,
15
+ and the phase file is mirrored into that sub-issue's description as written — its
16
+ prose, its sections, and its tasks as a read-only checklist, never as issues of
17
+ their own. Only the phase's h1 and `> **Status:**` line are left out, because
18
+ both are pushed as fields of their own (the sub-issue's title and board Status). This
19
+ skill computes what changed since the last push and applies it — it never reads
20
+ GitHub content back or merges. A person editing the mirror in GitHub will see it
21
+ overwritten on the next push.
22
+
23
+ **Opt-in**: only runs when `specs/.core/github.config.json` exists. If absent,
24
+ tell the user how to enable GitHub sync and stop.
25
+
26
+ ## 1. Identify the target spec
27
+
28
+ Use the argument, else the spec in context; ask if unclear.
29
+
30
+ ## 2. Pick the transport, and get the board's Status options
31
+
32
+ **Ask the engine first — it decides, not you:**
33
+
34
+ ```
35
+ skitterspec spec-sync states --json
36
+ ```
37
+
38
+ With a GitHub token set (`GITHUB_TOKEN`, `GH_TOKEN`, or whatever
39
+ `auth.tokenEnv` names, or the stored one) the engine talks to GitHub directly.
40
+ That is the **fast path**, and it is the default whenever a token resolves:
41
+ descriptions never pass through you, in either direction. Without them it falls
42
+ back to MCP and everything below works as it always has.
43
+
44
+ - **`transport = api`** → the command prints the board's Status options as a
45
+ JSON array. Write it to a file and carry on to step 3.
46
+ **Skip the MCP tool discovery entirely** — you make no GitHub calls here.
47
+ - **`transport = mcp`** → do the MCP work: discover the issue
48
+ **read + write** tools at runtime on GitHub's official MCP server
49
+ (`https://api.githubcopilot.com/mcp/`) — `issue_read`, `issue_write`,
50
+ `sub_issue_write`, plus `projects_get` / `projects_write` for the board. If
51
+ GitHub isn't connected or a needed tool is missing, relay the fix and stop,
52
+ **writing nothing**. Then read the board's `github.statusField` options
53
+ yourself and write their **names** to a file as a JSON array
54
+ (e.g. `["Backlog","In Progress","Done","Cancelled"]`).
55
+
56
+ Either way you end up with a states file. Step 3 requires it:
57
+ `push` **refuses to run** without one, because a spec's state is a **board
58
+ Status option** — the engine sets it by name, and an option the board lacks is
59
+ refused at the field write, after the body already landed. So it is checked
60
+ before anything is written. If the check reports a name that isn't on the board,
61
+ stop and fix `specs/.core/github.config.json`.
62
+
63
+ **If the check refuses, offer to fix it.** The refusal lists every configured
64
+ name the board lacks, the board's real Status options, and — where the bucket
65
+ makes it unambiguous — which one to use instead. Relay that, then offer to
66
+ apply it to `specs/.core/github.config.json` → `states`, and do so on the user's
67
+ confirmation. Never edit their config without asking, and never guess a bucket
68
+ the refusal made no suggestion for — ask which status they want.
69
+
70
+ `--skip-state-check` exists for the deliberate exception; do not reach for it to
71
+ get past a failing check.
72
+
73
+ ## 3. Get the plan from the engine
74
+
75
+ ```
76
+ skitterspec spec-sync plan <spec> --workspace-states <file> --json
77
+ ```
78
+
79
+ The engine prints a JSON **plan** (no network, no remote read):
80
+
81
+ ```json
82
+ {
83
+ "issue": { "description": "…", "state": "in-progress" },
84
+ "subIssues": {
85
+ "create": [{ "ref": "01-outbox", "name": "Outbox", "goal": "…", "state": "backlog" }],
86
+ "update": [{ "id": "#2", "name": "…", "goal": "…", "state": "in-progress" }]
87
+ }
88
+ }
89
+ ```
90
+
91
+ An empty plan (no `issue`, no sub-issue create/update) means the mirror is up to
92
+ date — say so and stop. The plan's `subIssues` key is where the sub-issues live.
93
+ `state` values are local buckets
94
+ (`backlog`/`in-progress`/`complete`/`cancelled`); map each to the GitHub STATUS
95
+ name via `config.states` at apply time.
96
+
97
+ A **`phasesDeferred`** field means `mapping.phases` is `"deferred"` and this spec
98
+ has not started, so its phases are deliberately absent from the plan — the issue
99
+ pushes alone and the sub-issues are minted by the push that follows `/spec-start`.
100
+ Relay the count; it is not a sign the phase files failed to parse. Nothing else
101
+ about applying the plan changes.
102
+
103
+ The plan always carries a **`phaseMode`** field — `subissue`, `deferred` or
104
+ `inline` — the mode that resolved for THIS spec's lifecycle bucket.
105
+ `mapping.phases` may be a per-bucket map, so the config alone no longer tells you
106
+ which mode a given spec got. Relay it whenever it is not `subissue`:
107
+
108
+ - **`inline`** — no sub-issues are created at all. Each unlinked phase is a
109
+ section of the spec issue's own description, and the `## Phases` index stays as
110
+ its table of contents. A plan with no sub-issue creates is the expected shape,
111
+ not a parse failure. A phase that already carries an id keeps its sub-issue and
112
+ still appears under `subIssues` — apply those normally.
113
+ - **`deferred`** — as above; the `phasesDeferred` count says how many are waiting.
114
+
115
+ Nothing about how you apply the plan changes in either mode: apply exactly the
116
+ `issue` and `subIssues` the plan lists.
117
+
118
+ ## 4. Apply the plan
119
+
120
+ **On `transport = api`, this is one command:**
121
+
122
+ ```
123
+ skitterspec spec-sync apply <spec> --plan plan.json
124
+ ```
125
+
126
+ It creates and updates the issue and its sub-issues, reads each description back
127
+ and runs the same check as step 4b, stamps every returned number into the spec, and
128
+ records the snapshot. **Steps 4a–5 below are then already done** — skip to step 6
129
+ and report what it printed, including the transport.
130
+
131
+ Two things it guarantees, so you don't have to manage them:
132
+
133
+ - **It writes nothing until everything checkable has been checked** — a missing
134
+ key or a `config.states` name the board lacks fails before the first write.
135
+ - **It stamps each number the moment its object exists.** If a run is interrupted,
136
+ re-run the same command: the objects it already created are linked, so the new
137
+ plan sees them as updates and no duplicate is minted. Never "start again" by
138
+ hand.
139
+
140
+ If it prints **`transport = mcp`** it has written nothing and is telling you to
141
+ apply the plan yourself — do steps 4a, 4b and 5 below. Pass `--via mcp` to force
142
+ that deliberately.
143
+
144
+ There is no project to pick, on either path: a minted issue lands in the
145
+ configured repo, on the configured board.
146
+
147
+ ## 4a. Apply it yourself — the MCP path (order matters)
148
+
149
+ **First, check whether you are about to overwrite someone.** On the API path
150
+ `apply` does this for itself, off the read-back it already makes — for the spec
151
+ issue and for every phase sub-issue it is about to update, so a box ticked on a
152
+ phase issue prints `!! #N's body was edited on GitHub`. On the MCP
153
+ path nothing has read the issue yet, so ask before you write:
154
+
155
+ ```
156
+ skitterspec spec-sync status <spec> --remote <issuefile>
157
+ ```
158
+
159
+ using the same issue JSON step 2 fetched — it must carry the `description`. A
160
+ `drift: … description was edited on GitHub since the last push` line means a
161
+ person wrote something there that step 1 below replaces.
162
+
163
+ **It is a warning and never a gate.** The repo is the source of truth and the
164
+ push still goes ahead; relay the line, name the issue, and carry on. What is
165
+ forbidden is doing it *silently* — someone's paragraph disappearing with nothing
166
+ said about it is the failure this exists to end. Nothing printed means nothing to
167
+ say, which includes every case the engine could not tell.
168
+
169
+ 1. **Spec issue** → if the overview has no `github_identifier`, this push
170
+ **mints** it: create it with `issue_write` (title from the spec title; body
171
+ from `plan.issue.description`; label `github.labels.spec`), then with
172
+ `projects_write` add it to the board and set its Status to the option
173
+ `config.states` maps `plan.issue.state` to. Keep the returned number and url
174
+ for step 5 — don't hand-edit frontmatter. If it already exists and
175
+ `plan.issue` is present, **update it by number** with `issue_write`, and set
176
+ the Status only when it actually differs.
177
+ 2. **Sub-issues create** → for each, `issue_write` (`name` → title, `goal` →
178
+ body, label `github.labels.phase`), then `sub_issue_write` to link it under
179
+ the spec issue, then add it to the board with its mapped Status. Keep each
180
+ returned number against its `ref` (the phase-file basename).
181
+ 3. **Sub-issues update** → `issue_write` by number (title/body), plus
182
+ `projects_write` where the Status changed.
183
+ 4. **Close or reopen to match.** A spec or phase in `complete` closes with
184
+ reason `completed`; in `cancelled`, `not_planned`; anywhere else it is open.
185
+ `issue_write` sets `state` and `state_reason`.
186
+
187
+ Milestones, other labels and comments are GitHub-native triage — do **not**
188
+ push them; they're the PM's.
189
+
190
+ ## 4b. Verify what GitHub actually stored — the MCP path
191
+
192
+ *(On the API path `apply` already did this. Skip.)*
193
+
194
+ GitHub stores an issue body as the markdown it was sent, so a clean push reads
195
+ back identical; what `verify` catches is a body someone has since edited, or a
196
+ write that did not land. Check before you record the push as good.
197
+
198
+ For each issue you created or updated in step 4a, read its `description` back
199
+ (`issue_read`) and write what you got to a JSON file:
200
+
201
+ ```json
202
+ { "issue": "<stored description>", "subIssues": { "01-outbox": "<stored>" } }
203
+ ```
204
+
205
+ Then:
206
+
207
+ ```
208
+ skitterspec spec-sync verify <spec> --stored <file>
209
+ ```
210
+
211
+ It compares against what the engine sent, ignoring bullet markers and
212
+ whitespace and reporting only lost or altered **word characters**. Relay any divergence — it prints both sides around
213
+ the first difference. It exits 0 either way: the repo is unaffected and still
214
+ correct, so this is a warning, not a failure.
215
+
216
+ This is **not a pull**. Nothing read here is merged, stamped, or written
217
+ anywhere; the repo remains the only source of truth. Do it before step 5 so a
218
+ corrupted push is visible before the snapshot records it as good.
219
+
220
+ ## 5. Stamp the numbers, then record the snapshot — the MCP path
221
+
222
+ *(On the API path `apply` already did both. Skip.)*
223
+
224
+ Write every number you collected back into the spec in **one** call — the engine
225
+ does the file edits, so there is no hand-editing of frontmatter:
226
+
227
+ ```
228
+ skitterspec spec-sync stamp <spec> \
229
+ --issue #11 --url https://github.com/<owner>/<repo>/issues/11 \
230
+ --sub 01-outbox=#12 --sub 02-api=#13
231
+ ```
232
+
233
+ Pass `--issue`/`--url` only on the push that minted the spec issue; pass one
234
+ `--sub <ref>=<#n>` for every sub-issue **created** in step 4a.2 (updates already
235
+ have their number). It validates every ref and number **before** writing anything and
236
+ exits non-zero having changed nothing if any is wrong — so a typo can't leave the
237
+ spec half-stamped, pointing at an issue that isn't there. Fix what it reports and
238
+ re-run; it is safe to repeat.
239
+
240
+ Then record what was pushed:
241
+
242
+ ```
243
+ skitterspec spec-sync record <spec>
244
+ ```
245
+
246
+ This writes the last-pushed snapshot from the now-stamped files, so the next
247
+ `/spec-push` produces an empty plan. Commit the stamped spec + snapshot into the
248
+ branch so the mirror-link rides in the PR.
249
+
250
+ ## 5b. A refused mint, and the way back
251
+
252
+ Two refusals reach you from `apply`, and neither is a failure to retry.
253
+
254
+ **`N already exists and no spec claims it`** — the push was about to mint, and
255
+ an issue with **exactly** this title is sitting there unheld. That is almost
256
+ always the spec's own issue, whose link was lost: a bad merge, a hand edit, a
257
+ stray `sed` over the frontmatter. Adopt it rather than creating a twin. The
258
+ Linear provider ships `reattach` for this; the GitHub provider does not yet, so
259
+ the fix is the manual escape hatch — read the issue number back to the user,
260
+ confirm it is the spec's own issue, then:
261
+
262
+ ```
263
+ skitterspec spec-sync stamp <spec> --issue <#N>
264
+ ```
265
+
266
+ **`N exists in GitHub but could not be recorded`** — the create landed and the
267
+ stamp did not, so GitHub holds an issue the repo does not point at.
268
+ **Do not re-run**:
269
+ the plan still reads the spec as unlinked, so a re-run mints a second.
270
+ `stamp` with the number the refusal named is the fix here too.
271
+
272
+ Everything else — a rate limit, a refusal that says waiting will not help — is
273
+ reported with GitHub's own explanation and whether retrying can help. Relay it;
274
+ do not paraphrase.
275
+
276
+ ## 6. Report
277
+
278
+ End with the block defined in `.claude/rules/spec-reports.md`. That file carries
279
+ the shape; this section carries only what is specific here.
280
+
281
+ **Verdicts**
282
+
283
+ - `✅` — the mirror matches the repo and the snapshot is recorded.
284
+ - `⚠️` — pushed, with something worth knowing: GitHub stored different words, or
285
+ `phasesDeferred` phases not yet minted.
286
+ - `❌` — it wrote some objects and failed on another. Name what exists in GitHub
287
+ now; `apply` stamps each number as it goes, so the re-run is an update, never a
288
+ duplicate.
289
+ - `⏸` — no config, no `github_identifier`, or an unvalidated status list. Nothing
290
+ was written.
291
+
292
+ **Fields:** `Tracker` · `Follow-ups` · `Next`
293
+
294
+ `Tracker` carries what was created and updated — the spec issue and its
295
+ sub-issues — **the transport that did it**, and that the snapshot was recorded.
296
+
297
+ **Say the transport, every time.** On the API path you never saw the
298
+ descriptions, so "pushed 12 sub-issues" is the engine's report rather than your
299
+ observation, and that distinction is the difference between a fact and a
300
+ paraphrase. If it warned that GitHub stored different words, relay it: the repo
301
+ is still correct and a re-push overwrites the mirror.
302
+
303
+ There is no pull — GitHub is a generated mirror.
304
+
305
+ GitHub has no project picker: a minted issue lands in the configured
306
+ `github.owner`/`github.repo`, on the one board `github.project` names — both
307
+ decided once in `specs/.core/github.config.json`. There is nothing to ask.
@@ -0,0 +1,258 @@
1
+ ---
2
+ name: spec-review
3
+ description: Re-validate an existing spec against the current codebase — detect drift (renamed/removed files, changed APIs, tasks already done in code, stale decisions), grill where a decision is needed, and update the spec so it's relevant again. Targets a spec by name (arg) or the spec in context. Use when the user says "/spec-review", "is this spec still accurate", "this spec has gone stale", or before picking up an old backlog spec.
4
+ ---
5
+
6
+ # /spec-review — bring a spec back in sync with the codebase
7
+
8
+ > Stay silent while this runs — speak only to ask something you cannot answer
9
+ > yourself, or to report a failure at the moment it happens. Read
10
+ > `.claude/rules/spec-reports.md` before reporting; it defines the block this
11
+ > skill ends with.
12
+
13
+ Specs rot: the code moves on while a spec sits in the backlog or pauses
14
+ mid-build. This skill re-validates a spec against the **current** code and
15
+ rewrites the stale parts so it's safe to act on. It plans only — it does not
16
+ implement anything (that's `/spec-next`).
17
+
18
+ ## 1. Identify the target spec
19
+
20
+ - Use the name/path argument if given, else the spec **in context**. If unclear,
21
+ ask which spec.
22
+ - Locate the spec folder under `specs/` (any bucket). Entry point is its
23
+ `00-overview.md`; read it **and every phase file** (`01-<slug>.md`, `02-…`)
24
+ listed in its phase index (legacy specs may be a bare `<name>.md`).
25
+
26
+ ## 2. Validate against the codebase — evidence first
27
+
28
+ Read the spec, then check every claim it makes against the real code. Don't
29
+ trust the spec's own wording — verify:
30
+
31
+ - **Referenced things still exist.** Grep/read for each `file:line`, module,
32
+ function, route, model, type, or symbol the spec names. Flag anything renamed,
33
+ moved, or deleted.
34
+ - **Impact map matches reality.** Walk every row of the `## Impact` table and
35
+ verify against the code: does the named surface (endpoint, schema/model, DB
36
+ table/migration, domain object, route, business rule) exist, and does its
37
+ stated `Change` (add/update/remove) still hold? A stale Impact map is the
38
+ highest-signal drift — each row is a named, checkable surface, so a wrong row
39
+ is exactly the "obvious mistake" the map exists to surface. Flag/refresh stale
40
+ rows (and add rows for surfaces the spec now touches but omits).
41
+ - **Tasks already done.** For each `- [ ]`, check whether the code already
42
+ implements it (it may have landed via other work). Tick `- [x]` what's done.
43
+ - **Decisions still valid.** Re-check each `## Decisions` entry against the
44
+ current architecture and `.claude/rules/*.md`. Flag any that now conflict with
45
+ how the codebase actually works (a changed convention, a superseded approach).
46
+ - **New constraints.** Note rules/patterns introduced since the spec was written
47
+ that it must now honour (e.g. a new required field, a new error type, a new
48
+ pattern the rest of the code now follows).
49
+ - **Backward compatibility.** Re-confirm the planned API/schema changes are still
50
+ additive/safe given the current code (see the project's compatibility rules).
51
+
52
+ ### Release gating (only when configured)
53
+
54
+ **Only when `specs/.core/gating.config.json` exists.** Run
55
+ `skitterspec gating check <spec>`. A spec it names has no recorded gating
56
+ decision — or a bare `none` that records nothing — and that is
57
+ **drift like any other**: the question was never asked, or its answer was lost. Grill for it in
58
+ step 3 and write the header in step 4, exactly as you would a stale file path.
59
+
60
+ **This check is advisory.** It reports; it never refuses, and nothing below is
61
+ conditional on it. A spec written before the project adopted gating has no header
62
+ and is not broken — turning this into a gate would accuse the very specs the
63
+ feature was designed not to disturb.
64
+
65
+ ## 3. Grill only where a decision is needed
66
+
67
+ Where the drift forces a choice (the old approach no longer fits, a referenced
68
+ thing is gone, scope is now ambiguous), grill the user like `/spec` Phase A —
69
+ **batching independent questions, each with a recommended answer** — but scoped
70
+ tightly to the drift. Don't re-litigate decisions that still hold. If you can
71
+ resolve it by reading the code, do that instead of asking.
72
+
73
+ ## 4. Update the spec
74
+
75
+ - Rewrite stale **Decisions** / **Solution overview** and refresh the
76
+ **Impact map** in `00-overview.md`, and stale **tasks** in the phase files,
77
+ so they match the current code and the resolved questions. Add/remove tasks
78
+ within a phase file; add a new phase by creating a `0N-<slug>.md` file
79
+ **and** a matching overview index row, or drop a dead phase by removing both.
80
+ Keep the index and files in sync; **preserve completed `[x]` history**.
81
+ - **A phase's status is the `⬜`/`🔄`/`✅` on its H1** — `# Phase 2 — <goal> 🔄`.
82
+ It is mirrored in that file's `> **Status:**` line and in the matching
83
+ `00-overview.md` phase-index row, but the **heading is the authoritative one**:
84
+ tooling reads it, and a heading carrying no emoji reads as *not started*. So a
85
+ finished phase marked only by a `**Status:** done` line is silently wrong
86
+ everywhere except the file itself. Set all three together.
87
+ - **Especially when you create phase files.** Migrating a legacy spec (a bare
88
+ `<name>.md`, or a `00-overview.md` with inline phases) into the folder +
89
+ phase-file form means authoring `0N-<slug>.md` headings from scratch — carry
90
+ each phase's real status onto its H1 as you split it out, rather than
91
+ defaulting every new file to `⬜`. A ticketing provider projects that emoji as
92
+ the phase's state in the tracker, so getting it wrong mirrors a
93
+ complete phase as not-started.
94
+ - Tick tasks already satisfied by the code; re-open `## Open questions` for
95
+ anything still undecided.
96
+ - Add a dated **Changelog** entry summarising the review (e.g. `- <date> —
97
+ Reviewed vs codebase: retargeted Phase 2 onto X, dropped Y (removed), ticked Z
98
+ (already done)`).
99
+ - **Status:** if drift is minor, leave status as-is. If a `Ready` spec needs real
100
+ re-grooming, knock it back to `Draft` (set `> **Status:** Draft` and append a
101
+ **State log** row).
102
+
103
+ **Only when `specs/.core/github.config.json` exists** and the spec's overview
104
+ carries a `github_identifier`. Either missing → **skip**, in one line
105
+ (`not linked to GitHub — /spec-push to mirror it`), and carry on. Nothing else in
106
+ this step changes.
107
+
108
+ **Refresh the mirror now, without asking.** Run `/spec-push`. The repo has just
109
+ become the truth about this spec's state, and the tracker is a generated mirror
110
+ of it — leaving them to diverge until someone remembers to push by hand is the
111
+ gap this exists to close. It costs one engine call and no model tokens when a
112
+ GitHub token is set (see `apply.transport` in `github.config.md`).
113
+
114
+ - **Never mint.** An unlinked spec is skipped, not created. An issue born closed
115
+ is tracker noise, and a spec kept deliberately local should stay
116
+ that way — `/spec-push` is how someone opts in.
117
+ - **Never fatal.** If the push fails — offline, no token, a GitHub error — say so
118
+ and **finish the operation anyway**. The spec is complete/cancelled/reviewed in
119
+ the repo regardless; the mirror is disposable and the next push repairs it.
120
+ Do not roll anything back, and do not stop to ask.
121
+ - **Say what happened** in the skill's report: mirror updated, skipped as
122
+ unlinked, or failed with the reason.
123
+ - **There is no unassign step, and that is not an omission.** Where the repo owns
124
+ `assignee`, the projection derives it from the spec's lifecycle
125
+ bucket — so moving the folder to `complete`/`cancelled` is *itself* what
126
+ releases the issue, and the push above carries it like any other field. The
127
+ `github_assignee_id` stamp and the `> **Developer:**` header both stay put:
128
+ they record who actioned the work, which outlives who is holding it.
129
+
130
+ ### Why it sits here
131
+
132
+ In `/spec-complete` and `/spec-cancel` this step is deliberately pinned
133
+ **after the `git mv` and before the commit**, and both halves matter:
134
+
135
+ - **After the move**, because the projection reads a spec's workflow state from
136
+ its folder bucket. Push while the folder is still in `in-progress/` and the
137
+ issue is set to the state the spec is *leaving*.
138
+ - **Before the commit**, because the push stamps ids into the spec and writes a
139
+ snapshot under `specs/.core/`. Push after the commit instead and both are left
140
+ uncommitted, which makes `spec-env integrate` refuse to land the branch.
141
+
142
+ The snapshot is reached **by name**, not by breadth. It is a declared
143
+ `spec.companionPaths` entry (`specs/.core/github-base/{identifier}.base.json`),
144
+ so `spec-env stage` returns it among this spec's owned paths and the commit below
145
+ names it. This is why the commit no longer stages `specs/` wholesale: the one
146
+ file outside the spec's folder that had to be swept up is addressable, so the
147
+ breadth bought nothing and cost another session's work.
148
+
149
+ ## 4b. Hand the refresh back on a page, then wait
150
+
151
+ **Only when the project has per-spec isolation** (`specs/.core/env.config.json`
152
+ present) **and this review actually changed something.** Either missing → skip
153
+ the whole step in silence.
154
+
155
+ A refreshed spec is a rewrite of a document someone is about to work from, so it
156
+ gets read before it is committed — the same ending `/spec` now has:
157
+
158
+ ```
159
+ skitterspec spec-env review <spec> --docs --buttons refresh
160
+ ```
161
+
162
+ `--docs` reads the spec's own documents from the tree you are standing in, so it
163
+ wants no worktree and works for a spec in any bucket. These documents are
164
+ **tracked**, so the diff against `HEAD` is a patch rather than a set of new
165
+ files — which is exactly what the reader wants here: what drifted, and what you
166
+ rewrote.
167
+
168
+ **Render nothing when nothing changed.** `/spec-review` frequently concludes a
169
+ spec is still accurate, and that is a success rather than a gap. A page showing
170
+ an empty diff under a commit button asks for a verdict on nothing, and the
171
+ engine refuses it for the same reason — `nothing to review`. Take that refusal
172
+ as the answer and report the `⏸`/`✅` you already had.
173
+
174
+ **Arm nothing.** No `review arm` here: the gate asserts that a phase which ended
175
+ owes an answer, and a re-validated spec has ended no phase. Walking away leaves
176
+ an uncommitted spec, which is the state this skill has always finished in.
177
+
178
+ ### The three endings
179
+
180
+ `--buttons refresh` offers `Commit`, `Request changes` and `Discuss`.
181
+
182
+ **No start verdict, deliberately.** The spec this skill refreshed may already be
183
+ in progress — that is half of what it is used for — so `Commit & Start` would
184
+ offer to provision a worktree for a spec that already has one.
185
+
186
+ - **`commit`** — hand off to `review.commitWith` (`/commit` by default) with the
187
+ pathspec the render reported on `docs.paths`, then finish. The spec keeps
188
+ whatever status step 4 left it in.
189
+ - **`changes`** — work the notes into the spec, record a resolution for each so
190
+ the next render strikes it through with what changed, re-render, and wait
191
+ again.
192
+ - **`discuss`** — report and talk. Claim nothing, change nothing.
193
+
194
+ ### Then wait for it
195
+
196
+ **The wait is a command. Do not write one.** Note the moment you start waiting
197
+ as an ISO timestamp, run the engine's wait in the background, and end your turn:
198
+
199
+ ```
200
+ skitterspec spec-env review wait <spec> --since <the timestamp>
201
+ ```
202
+
203
+ Pass no timeout. On waking, let the engine pick the pass —
204
+ `skitterspec spec-env review <spec> --docs --claim-since <the timestamp> --json`
205
+ — and route on the verdict above.
206
+
207
+ **Where the page is `file://`** the pass is copied and pasted, so the wait is the
208
+ turn ending and the banner says so. Do not start a watch that cannot fire.
209
+
210
+ ## 5. Report
211
+
212
+ Do **not** `git commit` unless the user asks.
213
+
214
+ End with the block defined in `.claude/rules/spec-reports.md`. That file carries
215
+ the shape; this section carries only what is specific here.
216
+
217
+ **Verdicts**
218
+
219
+ - `✅` — checked against the code and brought up to date; safe to `/spec-start`.
220
+ - `⚠️` — updated, but dropped back to `Draft`: questions are open that only the
221
+ operator can answer. Name them.
222
+ - `⏸` — no such spec, or nothing to review. Nothing changed.
223
+
224
+ **Fields:** `Tracker` · `Spec` · `Built` · `Follow-ups` · `Next`
225
+
226
+ `Built` is the drift found and what you changed about it — a renamed file, an
227
+ API that moved, a task the code already does. `Spec` carries the status the
228
+ review leaves it in, which is the answer to "can I start this?".
229
+
230
+ **Where step 4b rendered a page the run is waiting**, so the block omits the
231
+ `Review` row and ends on the banner from `.claude/rules/spec-reports.md` — the
232
+ tier stack copied from the engine's own lines, never one link chosen for the
233
+ reader:
234
+
235
+ ---
236
+
237
+ ## ⏸ Review ready — &lt;N&gt; files, +&lt;a&gt; −&lt;d&gt;
238
+
239
+ - **local** — &lt;the `local:` URL&gt;
240
+ - **network** — &lt;the `network:` URL, or off with the command that turns it on&gt;
241
+ - **remote** — &lt;the `remote:` URL, or off with the command that turns it on&gt;
242
+
243
+ I'm holding here until you send a verdict — the wait covers local and network.
244
+
245
+ `Commit` commits the refresh · `Request changes` works them now
246
+
247
+ ---
248
+
249
+ `Next` then names the page rather than a command, because the button is what
250
+ carries the work on.
251
+
252
+ Where nothing was rendered — no isolation, or no drift to show — `Next` is
253
+ `/commit, then /spec-start <name>`, since this skill does not commit and
254
+ `/spec-start` refuses a tree holding anything that is not the spec's.
255
+
256
+ **Drift found and not fixed is a `Follow-up`, not a silence.** A spec this skill
257
+ declared reviewed is one nobody will re-read; something it noticed and left
258
+ undone has to leave the session in writing or it did not happen.