chamba 0.6.1 → 0.7.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 (35) hide show
  1. package/README.md +13 -6
  2. package/dist/lib/agent-context.js +33 -7
  3. package/dist/lib/dockerfile-builder.js +2 -1
  4. package/dist/lib/safe-rm.js +13 -3
  5. package/package.json +3 -3
  6. package/templates/Dockerfile +20 -1
  7. package/templates/pane-apps/client/assets/specs-B1970L17.css +1 -0
  8. package/templates/pane-apps/client/assets/specs-cEee_SPn.js +23 -0
  9. package/templates/pane-apps/client/specs/index.html +13 -0
  10. package/templates/pane-apps/server/specs.mjs +1588 -0
  11. package/templates/skills/dx-spec/SKILL.md +365 -0
  12. package/templates/skills/dx-spec/references/imagination-guide.md +140 -0
  13. package/templates/skills/dx-spec/references/review-guide.md +173 -0
  14. package/templates/skills/dx-spec/references/spec-guide.md +125 -0
  15. package/templates/skills/dx-spec/references/stages.md +399 -0
  16. package/templates/skills/dx-spec-config/SKILL.md +313 -0
  17. package/templates/skills/dx-spec-config/references/principles-template.md +12 -0
  18. package/templates/skills/dx-spec-execute/SKILL.md +324 -0
  19. package/templates/specs.sh +106 -0
  20. package/templates/webterm/README.md +42 -6
  21. package/templates/webterm/config.js +43 -0
  22. package/templates/webterm/public/app/composer.js +4 -1
  23. package/templates/webterm/public/app/dom.js +13 -5
  24. package/templates/webterm/public/app/frames.js +7 -0
  25. package/templates/webterm/public/app/main.js +7 -1
  26. package/templates/webterm/public/app/pane-shell.js +315 -0
  27. package/templates/webterm/public/app/pane.js +58 -183
  28. package/templates/webterm/public/app/specs-host.js +222 -0
  29. package/templates/webterm/public/app/terminal.js +8 -0
  30. package/templates/webterm/public/index.html +51 -27
  31. package/templates/webterm/public/styles.css +144 -30
  32. package/templates/webterm/server.js +273 -0
  33. package/templates/webterm/specs.js +358 -0
  34. package/templates/webterm/tool-document.js +67 -0
  35. package/templates/webterm/typed-line.js +85 -0
@@ -0,0 +1,313 @@
1
+ ---
2
+ name: dx-spec-config
3
+ description: View and change the settings and principles the dx-spec skills honor - commit style, saved planning answers, and the engineering principles - and define the one-time setup the other dx-spec skills offer at start. User-invoked only.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # dx-spec config - the user's preferences
8
+
9
+ This skill runs when the user types `/dx-spec-config`. It never starts on its own.
10
+
11
+ The skill owns one file: the principles file beside the specs.
12
+ It writes that file the first time, it runs a wizard to change it, and it runs a doctor that checks it against the shape below.
13
+ `/dx-spec` and `/dx-spec-execute` only read it.
14
+ The init flow is the one flow this skill offers the other two.
15
+
16
+ ## The web session
17
+
18
+ Every skill in this family runs inside a chamba web session.
19
+ Check for one before anything else:
20
+
21
+ ```
22
+ specs stages
23
+ ```
24
+
25
+ The answer holds `root` - the directory the Specs tab serves - and the stage catalog.
26
+ A refusal means there is no pane.
27
+ Say this and stop:
28
+
29
+ > This works in the chamba web session, where the Specs tab holds your work. Open the browser window this container printed at start, or run `webterm` in the terminal to get the address again. Then run `/dx-spec-config` there.
30
+
31
+ Start no flow, and offer no substitute.
32
+
33
+ ## Asking questions
34
+
35
+ The questions in this skill belong to no piece of work, so they do not go on the Specs tab.
36
+ The tab's forms belong to one spec, and settings belong to none.
37
+ Ask them with `AskUserQuestion`.
38
+ When that tool is absent, or refuses a call, ask the question as a normal message and end your turn.
39
+ Then wait. Do not do the thing the question was there to confirm.
40
+
41
+ Write a question whose options do not depend on the work as a fenced block tagged `question`, and ask it exactly as written.
42
+
43
+ ````markdown
44
+ ```question
45
+ Question: <the question text, verbatim>
46
+ Header: <the short chip label, verbatim>
47
+ - <option label>
48
+ <option description>
49
+ - <option label>
50
+ <option description>
51
+ ```
52
+ ````
53
+
54
+ How to read a block:
55
+
56
+ - Copy the question text, the header, the labels, the descriptions and their order exactly.
57
+ - Angle brackets mark the parts you fill in.
58
+ - A line marked `only when ...` is conditional. Every other line is always there.
59
+ - Never reword a block to fit the moment. Never add an option.
60
+ - `AskUserQuestion` adds its own free-text choice, so no block carries an option that only means "something else".
61
+
62
+ Every question shows 2 options at least and 4 options at most.
63
+ Put the recommended option first, and end its label with `(Recommended)`.
64
+ Keep labels short, and put the reasoning in the descriptions.
65
+ Write for someone who has never used these skills.
66
+
67
+ ## The specs root
68
+
69
+ `specs stages` answers with `root`.
70
+ That is the directory the Specs tab serves, and every path in this family resolves against it.
71
+ The principles file is `<root>/principles.md`.
72
+
73
+ ## The principles file
74
+
75
+ `<root>/principles.md` is plain markdown.
76
+ It holds a settings section and a principles section, and nothing else.
77
+
78
+ The settings sit under a `## Settings` heading, one `- <key>: <value>` bullet each, under one note line that points at `/dx-spec-config`.
79
+ The principles sit under a `## Principles` heading, one `- <principle>` bullet each.
80
+ The file carries no explanation of a setting, no guidance on writing a principle, and no examples.
81
+ Every run of every skill in this family reads this file, so it holds only what an agent must honor.
82
+ The meaning of each setting lives here, in the skill that writes the file.
83
+
84
+ What each setting holds:
85
+
86
+ - `commit_style` - the shape of every commit message this family makes. `default` names the default style below. Any other value is a plain description of the project's own shape, with an example message in it.
87
+ - `commit_mode` - a saved answer to "should the run commit as it goes?". `prompt` keeps the question, `current-branch` commits on the current branch, `new-branch` commits on a new branch, and `no-commits` leaves the changes in the working tree.
88
+ - `commit_grouping` - a saved answer to "how are those commits grouped?". `prompt` keeps the question, `per phase` commits each phase, and `single` commits once at the end. This setting counts only when the run commits at all.
89
+ - `branch_naming` - the branch name pattern for `commit_mode: new-branch`. `<slug>` in the pattern becomes the spec's own slug.
90
+
91
+ The principles section holds plain engineering principles that every run honors best-effort.
92
+ A principle states its reason when the reason is not obvious.
93
+ A principle states its own scope when it does not apply everywhere.
94
+ When the project's own documents already carry a rule, the principle points at that rule and declares it binding.
95
+ It does not restate the rule.
96
+ The section ships empty, so an empty section means no principles.
97
+ Use this form:
98
+
99
+ ```markdown
100
+ - Always recommend two code reviewers at least in an execution plan, because one reviewer shares too many blind spots with the author.
101
+ - Never add a dependency without asking first: a dependency is a cost the project carries for years.
102
+ ```
103
+
104
+ A saved answer skips its question, and says nothing.
105
+ The execution-plan stage still records the resolved `Commits:` and `Branch:` lines in `PLAN.md`, whatever their source.
106
+ The plan gate still shows the whole setup, so the user can make an exception for one spec there.
107
+ That exception changes that plan alone, and never this file.
108
+
109
+ The shipped template is `references/principles-template.md`, beside this file.
110
+ A fresh file starts as a copy of it.
111
+
112
+ ## The default commit style
113
+
114
+ The default style is the spec name, then a colon, then what the commit did:
115
+
116
+ ```
117
+ user-preferences: spec ready
118
+ user-preferences: phase 02 - the consuming skills
119
+ user-preferences: review fixes
120
+ ```
121
+
122
+ This skill and its template are the only places that spell the pattern out.
123
+ Every other mention of it says "the default style".
124
+
125
+ The commits this skill makes use `dx-spec` in place of the spec name: `dx-spec: set up config` and `dx-spec: update config`.
126
+ A `commit_style` that is not `default` restyles these the same as any other message.
127
+
128
+ When `commit_style` describes a type-prefixed convention, two families apply:
129
+
130
+ - A spec-level commit touches only spec files, so its type is fixed - `docs`, for example.
131
+ - A work-level commit carries code, so its type comes from what the phase did.
132
+
133
+ ## The bootstrap
134
+
135
+ Before its first step, `/dx-spec` and `/dx-spec-execute` do this:
136
+
137
+ 1. Read `root` from `specs stages`.
138
+ 2. Read `<root>/principles.md` when it is there, and take what parses: the settings it knows, and the principles bullets.
139
+ 3. When a setting is missing, unreadable, or holds a value this file does not list, use its default. Say so once, in one line, and name `/dx-spec-config` as where it gets sorted out. Repair nothing here: a run the user is waiting on is not the place to fix a settings file.
140
+ 4. With no file there at all, ask the question below. On "set it up now", run the init flow before the run continues.
141
+ 5. Apply the settings and the principles for the rest of the run.
142
+
143
+ ```question
144
+ Question: You have no settings file for this yet. Should I set one up now?
145
+ Header: Setup
146
+ - Set it up now (Recommended)
147
+ A few questions about how you like to work - how commits are written, and what I may do without asking - and I write the file before we carry on. You answer them once.
148
+ - Carry on without it
149
+ I use the built-in defaults for this run and ask again next time. You can also set it up whenever you like, with /dx-spec-config.
150
+ ```
151
+
152
+ A file that reads cleanly produces no message at all.
153
+ The init flow is the only flow a bootstrap runs.
154
+ Checking the file, repairing it and changing it all belong to a direct run of this skill.
155
+
156
+ ## Init flow
157
+
158
+ This flow runs when a direct `/dx-spec-config` run finds no principles file, and when a bootstrap offers it and the user agrees.
159
+
160
+ 1. Send one short intro message: this family keeps a small settings and principles file beside the specs, this is its one-time setup, and anything chosen here changes later through `/dx-spec-config` or by editing the file.
161
+ 2. Work out the project's commit style. Read the project's own commit rules and its recent commit subjects. A clear shape - a type prefix, a ticket key, any consistent pattern - becomes the first option below, written in plain words with an example message from this project. Drop that option when the project shows no consistent shape. A commit this family made in the default style is not a project convention.
162
+ 3. Ask the three questions below in one `AskUserQuestion` call.
163
+
164
+ ```question
165
+ Question: How should the commits I make be written?
166
+ Header: Commit style
167
+ - <the project's own style, in a few words> (Recommended) (only when the project's commits or rules show a clear shape)
168
+ <the shape found, in plain words, with an example message from this project>.
169
+ - The default style
170
+ The spec name, a colon, then what the commit did.
171
+ - Conventional prefixes (only when the first option is not itself a type-prefix shape)
172
+ A type prefix, then what the commit did: "feat: ...", "fix: ...", "docs: ...", and so on.
173
+ ```
174
+
175
+ When the first option is absent, the default style comes first and carries the marker.
176
+ Save the answer as `commit_style`: `default` for the default style, and otherwise a plain description of the shape with an example message in it.
177
+
178
+ ```question
179
+ Question: Should runs save their work with git commits as they go?
180
+ Header: Commits
181
+ - Decide per piece of work (Recommended)
182
+ Each execution plan asks this when it is written.
183
+ - Yes, on the current branch
184
+ Every run commits as it goes, on whatever branch is checked out.
185
+ - Yes, on a new branch
186
+ Every run commits on a branch of its own, named by a pattern you can change later.
187
+ - No commits
188
+ Runs leave their changes in your working folder for you to handle.
189
+ ```
190
+
191
+ ```question
192
+ Question: And when a run commits, how should the commits be grouped?
193
+ Header: Grouping
194
+ - Decide per piece of work (Recommended)
195
+ Each execution plan asks this when it is written.
196
+ - One commit per phase
197
+ Each finished phase is committed on its own.
198
+ - A single commit
199
+ All the work lands in one commit at the end.
200
+ ```
201
+
202
+ 4. Ask the question below in a second `AskUserQuestion` call, right after those three. It gets its own call, because the answer starts a task and leads to another question.
203
+
204
+ ```question
205
+ Question: Should I read your project now and draft the principles I should follow?
206
+ Header: Principles
207
+ - Draft them from the project (Recommended)
208
+ I read your rule documents, the README, the lint and CI setup, and recent commits, and propose a short list for you to look over.
209
+ - Start with none
210
+ The file is written with an empty principles section. You can add principles any time through /dx-spec-config, which offers the same draft from your project.
211
+ ```
212
+
213
+ On "draft them from the project": read `CLAUDE.md` and `AGENTS.md`, the README, the lint and CI configs, and recent commits.
214
+ Draft the principles from what they show.
215
+ Point at a rule the project already documents, and declare it binding, rather than restating it.
216
+ Write down the undocumented conventions alone.
217
+ Keep the draft to five or six principles, because every run reads this file.
218
+ Write nothing to disk in this step. Step 5 writes it.
219
+
220
+ On "start with none": keep the template's empty principles section for step 5.
221
+
222
+ 5. Write `<root>/principles.md` once: the template, with each setting's value replaced by the answer, and the principles section either drafted or empty.
223
+ 6. Only when you drafted principles, ask the user to read them:
224
+
225
+ ```question
226
+ Question: I wrote the principles into <root>/principles.md - please read them there. Keep them as they are?
227
+ Header: Principles
228
+ - Keep them (Recommended)
229
+ The file stays as it is.
230
+ - Change them
231
+ Tell me what to add, reword or drop. I rewrite the principles section and ask again.
232
+ ```
233
+
234
+ On "change them": rewrite the section from what the user typed, then ask this question again. Loop until they keep it.
235
+
236
+ 7. Offer the commit gate below, with the message `dx-spec: set up config` in the confirmed style.
237
+ 8. Carry on with whatever the skill was invoked to do.
238
+
239
+ ```question
240
+ Question: Should I commit your principles file to git?
241
+ Header: Commit file
242
+ - Commit it (Recommended)
243
+ I commit only <root>/principles.md, with the message "<the composed message>". I never push.
244
+ (only when the working tree holds unrelated changes) Everything else you have changed is left exactly as it is.
245
+ - Don't commit
246
+ The file stays in your working folder for you to handle.
247
+ ```
248
+
249
+ On "commit": stage the principles file by path, and commit it. Commit only. Never push.
250
+
251
+ ## The doctor
252
+
253
+ The doctor is the check a direct `/dx-spec-config` run makes on an existing file.
254
+ It is the one place file trouble is dealt with.
255
+ No other skill runs it, and it never runs during someone else's work.
256
+
257
+ Compare the user's file against the shape above, by meaning rather than by bytes:
258
+
259
+ - A setting the shape has and the file lacks: propose adding it with its default, and say what it does.
260
+ - A setting whose value is not one this file lists: say what the setting does, name the values that exist, and ask which one is meant.
261
+ - A setting the file holds that this shape no longer has: propose dropping it, because nothing reads it.
262
+ - Text this shape does not have - an opening note, an explanation under a setting, example principles: propose dropping it, because every run reads this file and that material belongs in this skill. Never touch a line under `## Principles` this way. A principle belongs to the user, however it is worded.
263
+ - A whole section the file lacks: treat it as something the user removed. Name what is on offer, and put back only what they ask for.
264
+ - A file that does not read as markdown at all: say so plainly, and offer to write a fresh one, keeping every setting and principle the current file still lets you read.
265
+
266
+ Nothing here is an error, and nothing is applied without asking.
267
+ Say what you found in one short message, then ask:
268
+
269
+ ```question
270
+ Question: I compared your settings file with the shape this version expects: <what differs, in a line each>. Bring it up to date?
271
+ Header: Settings file
272
+ - Apply these (Recommended)
273
+ I make those changes. Every setting you chose and every principle you wrote stays exactly as it is.
274
+ - Leave it as it is
275
+ Nothing is changed, and everything keeps working on what your file already says.
276
+ ```
277
+
278
+ A partial answer - one change and not another - comes through free text.
279
+ Write into the file whatever the user accepts.
280
+ The commit gate at the end of the run covers it.
281
+
282
+ ## Running directly - the wizard
283
+
284
+ When the user types `/dx-spec-config`, read `root` and look at `principles.md`:
285
+
286
+ - No file: run the init flow, minus its last step, and stop there. A file just written needs no doctor.
287
+ - A file there: run the doctor, then the wizard below.
288
+
289
+ Show one short message: the commit style, the saved planning answers, and a short summary of the principles.
290
+ When the section is empty, say plainly that no principles are written yet.
291
+ Then ask:
292
+
293
+ ```question
294
+ Question: Anything you want to change?
295
+ Header: Settings
296
+ - Nothing - keep it as it is (Recommended)
297
+ The wizard ends here.
298
+ - The commit style
299
+ How the commits I make are written. I can also work out a fresh proposal from your project's commits.
300
+ - The planning answers
301
+ Whether runs commit as they go, how commits are grouped, and the branch name pattern.
302
+ - The principles
303
+ The principles every run reads at start and honors. I show you the ones you have, and you add, reword or drop them by typing what you want.
304
+ ```
305
+
306
+ A setting change reuses the init-flow question for that setting.
307
+ The commit style change offers the same fresh derivation the init flow makes.
308
+ The principles area offers the same derivation too.
309
+ Change the principles and the branch pattern through free text: the user types, you restate, they confirm.
310
+ After each change, ask this question again, so several things change in one run.
311
+
312
+ When the doctor or the wizard changed anything, write the file, then end with the commit gate from the init flow and the message `dx-spec: update config`.
313
+ When nothing changed, end without touching the file.
@@ -0,0 +1,12 @@
1
+ # Principles
2
+
3
+ ## Settings
4
+
5
+ Run `/dx-spec-config` to change these.
6
+
7
+ - commit_style: default
8
+ - commit_mode: prompt
9
+ - commit_grouping: prompt
10
+ - branch_naming: spec/<slug>
11
+
12
+ ## Principles
@@ -0,0 +1,324 @@
1
+ ---
2
+ name: dx-spec-execute
3
+ description: Run the execution plan of a spec the Specs tab holds, phase by phase, with the run's progress on that tab as it goes. User-invoked only.
4
+ disable-model-invocation: true
5
+ argument-hint: "[the name of the piece of work to run]"
6
+ ---
7
+
8
+ # dx-spec execute - build the work from its plan
9
+
10
+ This skill runs when the user types `/dx-spec-execute`. It never starts on its own.
11
+
12
+ Your job is to move through the phases of one spec's plan, and to keep every bit of progress on disk, so a later session restarts from this point.
13
+
14
+ Write, build, verify, record and commit each phase yourself.
15
+ The only subagents are reviewers, and they exist so somebody who did not do the work judges it.
16
+
17
+ ## The web session
18
+
19
+ This family runs inside a chamba web session, where the Specs tab holds the work.
20
+ Check for one before anything else:
21
+
22
+ ```
23
+ specs stages
24
+ ```
25
+
26
+ The answer holds `root` - the directory the tab serves - and the stage catalog.
27
+ A refusal means there is no pane.
28
+ Say this and stop:
29
+
30
+ > This works in the chamba web session, where the Specs tab holds your work. Open the browser window this container printed at start, or run `webterm` in the terminal to get the address again. Then run `/dx-spec-execute` there.
31
+
32
+ Start no flow, and offer no substitute.
33
+
34
+ ## Asking and telling
35
+
36
+ **Everything you ask the user goes on the Specs tab**, through `specs await`.
37
+ A pause, a blocked run, a choice of spec: each one is a gate or a round on the tab.
38
+ Declaring one ends your turn.
39
+ The pane types one line into this terminal when the user answers, and that line starts you again.
40
+
41
+ `/dx-spec` carries the payload shapes, under **The verbs**.
42
+ Read that section for the exact JSON.
43
+
44
+ **Everything you tell the user while building is normal message text.**
45
+ A progress report is not a question.
46
+
47
+ **Post the run as it moves**, so the board shows it live:
48
+
49
+ ```
50
+ echo '{"kind":"status","status":"executing"}' | specs post <spec>
51
+ echo '{"kind":"phase","phase":"phase-02-the-consuming-skills","title":"The consuming skills","status":"running"}' | specs post <spec>
52
+ echo '{"kind":"activity","said":"Running the verify steps"}' | specs post <spec>
53
+ echo '{"kind":"phase","phase":"phase-02-the-consuming-skills","title":"The consuming skills","status":"done"}' | specs post <spec>
54
+ echo '{"round":1,"verdict":"holds, one for you","findings":6,"judgments":1}' | specs review <spec>
55
+ ```
56
+
57
+ A phase's id is its file's name without the extension, which is what you already write and tick.
58
+
59
+ ## The tool owns the state
60
+
61
+ The Specs tool writes `state.json` and each spec's `README.md`.
62
+ **Never edit either one.**
63
+ The status, the phase list, the review rounds and the dated log are the tool's, and the verbs above are how they move.
64
+
65
+ `plan/PLAN.md` and the phase files are yours, and you write them by hand as always.
66
+
67
+ ## A page you make during the run
68
+
69
+ A page that explains this piece of work belongs to the work, so save it into the spec directory under a lowercase name.
70
+ The tab lists it beside the other artifacts and renders it.
71
+ A page about anything else goes to the Pages tab with `webpane`.
72
+ Either way, keep it standalone: no external stylesheet, no script that fetches anything, and images as data URLs.
73
+
74
+ ## The plan is the user's instruction
75
+
76
+ The user chose everything in the plan at spec time: the commits and the branch, the pauses, the review checkpoints, the verify steps, and the principles check with its recorded deviations.
77
+ All of it binds this run.
78
+
79
+ A recorded deviation is an approved exception.
80
+ Build the work to match it, and never return it quietly to the principle it excepts.
81
+ A principle the plan does not except stays binding.
82
+
83
+ Your own limits do not justify a change to the plan.
84
+ When you cannot do what the plan asks, that is a stop condition, and the **Stop and ask** section says how to raise it.
85
+ Never replace the plan's instruction with a weaker one and carry on.
86
+
87
+ Two things fall outside this rule.
88
+ A choice of your own that changes nothing - which of two equal ways to read a file - is yours.
89
+ An instruction from the user in this conversation overrides the plan.
90
+ The plan loses to the user, and never to you.
91
+
92
+ ## 0. Bootstrap
93
+
94
+ Run the bootstrap in `../dx-spec-config/SKILL.md` first.
95
+ It resolves the root, reads the principles file, offers the one-time setup when there is none, and gives you the settings for the rest of the run.
96
+
97
+ ## 1. Choose the spec
98
+
99
+ A candidate is a piece of work under the root, outside `archive/`, whose plan still holds an unticked phase.
100
+
101
+ The user may name one.
102
+ A name that matches one spec exactly is an instruction, not a guess.
103
+ Start on it, and ask nothing.
104
+
105
+ In three cases the spec is a guess of yours:
106
+
107
+ - A name that matches no spec exactly.
108
+ - A spec you infer from the conversation.
109
+ - The one candidate, when there is only one.
110
+
111
+ Confirm a guess in a round before you do any work, even when one candidate exists.
112
+ Give the round one option per candidate, carrying how many phases are done and what comes next, and one option that means none of these.
113
+ Declare the round on the likeliest candidate, because every asking verb names a spec and it has to be one that is there.
114
+ Change nothing until the user answers.
115
+
116
+ With no candidate at all, ask nothing.
117
+ Say there is no open work, name `/dx-spec` as where a spec gets written, and stop.
118
+
119
+ Then read, in this order: `specs state <spec>`, `spec/SPEC.md`, and `plan/PLAN.md`.
120
+ Do not read a phase file yet. Read or write one when its phase starts.
121
+
122
+ Handle these two states before anything else:
123
+
124
+ - No `plan/` directory: say this spec has no execution plan, say `/dx-spec` adds one, and stop.
125
+ - Every phase ticked: say so, and stop.
126
+
127
+ ## 2. Work out where things stand
128
+
129
+ Work it out from disk alone.
130
+ Say it in a message before you do anything, together with what the plan asks for: its `Pauses:` line and its `Review checkpoints:` line.
131
+ The user then knows from the start where this run stops and where it gets reviewed.
132
+
133
+ **The phases.**
134
+
135
+ - A phase ticked in `PLAN.md` is done.
136
+ - The first unticked phase is next.
137
+ - A phase file that exists carries a `Status:` line: `in progress` or `done`.
138
+ - A file at `in progress` under an unticked phase means an earlier session stopped mid-phase. Treat it as suspect: check `git status` for half-done work, re-run the verify steps of the ticked tasks, and carry on from where the evidence points.
139
+ - The state file carries a dated line for each completed review checkpoint. A checkpoint whose phases are all done with no such line has not run. Run it before you move on.
140
+
141
+ **The commits.**
142
+ Read the `Commits:` line: `per phase`, `single` or `none`.
143
+ It says how much of the record the repository itself shows:
144
+
145
+ - `per phase`: a completed phase is a committed phase, and uncommitted changes belong to the phase that was interrupted.
146
+ - `single` or `none`: nothing is committed before the run ends, if at all. The phase status lines and the ticked boxes are the only record.
147
+
148
+ Read the `Branch:` line with it.
149
+ `current` means the commits land on the current branch.
150
+ Any other value names a branch for this run.
151
+
152
+ **A state that does not match.**
153
+ When the disk does not hold what this skill expects, settle it with judgment and say what you chose in the report.
154
+ Do not stop, and do not follow a fixed rule.
155
+
156
+ ## 3. The loop
157
+
158
+ Every phase goes through the same steps, and you carry out every one yourself.
159
+
160
+ 1. **The phase file.**
161
+
162
+ Check for a phase file an interrupted run left, and never rewrite one.
163
+ Check it against the actual code before you change anything.
164
+ Keep its ticked tasks: they show what got done.
165
+ Adapt a small change and note it. Treat a design change as a stop condition.
166
+
167
+ With no such file, write `plan/phase-NN-<slug>.md` right before you build the phase, against the code as it stands after the earlier phases.
168
+ Take the goal and the definition of done from `PLAN.md`:
169
+
170
+ ```markdown
171
+ # Phase 02 - <name>
172
+
173
+ Status: in progress
174
+
175
+ ## Tasks
176
+
177
+ - [ ] <task>
178
+ - [ ] <task>
179
+
180
+ ## Verify
181
+
182
+ - <command or check that proves the definition of done>
183
+ ```
184
+
185
+ Do not give much weight to development cost when you write it.
186
+ Prefer quality, simplicity, robustness, scalability and long-term maintainability.
187
+ When something grows too large, restructure it by judgment: refactor, split, or extract.
188
+ Never restructure by a number set in advance.
189
+
190
+ Post the phase as `running`.
191
+
192
+ 2. **Build.** Keep the changes scoped to this phase, and tick each task as it completes.
193
+
194
+ 3. **Verify.** Run the Verify section, and make it pass.
195
+
196
+ 4. **Record.** Set the phase's `Status:` to `done`, tick its box in `PLAN.md`, and post the phase as `done`.
197
+
198
+ With `Commits: per phase`: commit the phase's changes with a one-line message in the commit style from the principles file, using "phase NN - <name>" as its descriptive part. Commit only. Never push.
199
+
200
+ With `single` or `none`: commit nothing here.
201
+
202
+ Finish the whole record before the next phase starts, so an interrupted session loses nothing.
203
+
204
+ Then, in this order:
205
+
206
+ - The review checkpoint after this phase, when the plan puts one there.
207
+ - The pause after this phase, when the plan puts one there.
208
+
209
+ A pause therefore always reports a result that is already reviewed and fixed.
210
+
211
+ **On the first phase of a run**, post the status as `executing`.
212
+
213
+ **Before that first phase, when `Branch:` names a branch**, put the run on it:
214
+
215
+ - Already on it: carry on.
216
+ - It exists but is not checked out: switch to it.
217
+ - It does not exist: create it from the current `HEAD`.
218
+
219
+ When the working tree holds changes that do not belong to this work, gate it on the tab before you switch or create: move to the branch and bring those changes along, or stay where you are and commit on the current branch.
220
+ When the user stays, say in the report that this run's commits did not go to the planned branch.
221
+
222
+ Never merge, and never push. Merging the work back is the user's job.
223
+
224
+ **The final commit with `Commits: single`.**
225
+ Once the last phase passes its verify steps and finishes its record step, commit everything this work produced, in one commit.
226
+ Compose the message from the commit style, with the `PLAN.md` title as its descriptive part.
227
+ That commit also covers earlier runs of the same work, which committed nothing.
228
+ Make it before the final review checkpoint: a final checkpoint must never read an uncommitted tree when commits are on.
229
+
230
+ With `Commits: none`, commit nothing at any point.
231
+
232
+ **Keep the spec true.**
233
+ When what gets built differs from `spec/SPEC.md` or the plan, update those files as part of the phase.
234
+ The spec is the documentation of what was actually built.
235
+ When the solution departs noticeably from an approved solution sketch, that is a stop condition: the sketch does not bind you, but the user approved it and has to stay informed.
236
+
237
+ ### Review checkpoints
238
+
239
+ The `Review checkpoints:` line says where fresh reviewers judge the work.
240
+ Each sub-bullet names one checkpoint: where it sits, how many reviewers, a focus each, and why it is there.
241
+ `Review checkpoints: none` means no review runs, and the report says the plan chose none.
242
+
243
+ Run a checkpoint once you record the phase it sits after, and once any commit the plan asks for has landed.
244
+ Run the `final` checkpoint once the last phase is recorded, any required commit has landed, and before the end-of-run report.
245
+
246
+ **Start one reviewer subagent per focus the checkpoint names.**
247
+ The reviewers share no context: each gets its own prompt, none sees this conversation, none learns what the others found, and you are never one of them.
248
+ A reviewer's whole value comes from judging work it did not do.
249
+ Treat an inability to start reviewers as a stop condition, and never review the work yourself instead.
250
+
251
+ Tell each reviewer:
252
+
253
+ - Its focus, and to check the work against what was asked.
254
+ - Which files to read: `spec/SPEC.md`, `plan/PLAN.md`, the phase files written so far, and the principles file.
255
+ - That the plan's principles check records deviations as approved exceptions, not as findings.
256
+ - How to see the changes: name the commit the work started from, so it can diff against that, and point at the working tree when nothing is committed.
257
+
258
+ Each reviewer returns a verdict with concrete findings, each pointing at a file and a line.
259
+
260
+ Then, yourself:
261
+
262
+ - Merge the findings, and remove the duplicates.
263
+ - Dismiss what you judge wrong, and say why in the report.
264
+ - Fix the rest yourself.
265
+ - Re-run the Verify steps of every phase the fixes touch.
266
+ - Have each reviewer who rejected a fix re-check it once.
267
+ - When a reviewer still objects after that re-check, you settle it: fix it once more when the objection names something real, and otherwise record the finding as knowingly accepted and move on.
268
+ - When commits are on, land the fixes in one follow-up commit, with "review fixes" as the descriptive part.
269
+
270
+ Post the round with `specs review`, so the board carries its verdict.
271
+ Bring a finding that is the user's to judge to the tab as a decision card, rather than settling it yourself.
272
+
273
+ ### Pauses
274
+
275
+ The `Pauses:` line says when the run stops for the user: `none`, a list of phases, or `every phase`.
276
+
277
+ At a pause, once the phase is built, reviewed where a checkpoint sits there, recorded and committed, report what the phase produced in a message.
278
+ Then declare a gate: carry on, or stop here.
279
+ Point the gate at the artifact the phase produced, where one exists, so the user reads it and answers in the same place.
280
+
281
+ On "carry on": start the next phase in this session.
282
+ On "stop": end the run with the report below.
283
+ A later run finds from disk where this one stopped, resumes at the next unfinished phase, and pauses only at the pauses ahead of it.
284
+
285
+ A pause after the last phase has nothing to carry on to.
286
+ Run the final checkpoint, and give the end-of-run report instead of asking.
287
+
288
+ ## 4. Stop and ask
289
+
290
+ Stop and ask when one of these three holds. Otherwise keep going on your own.
291
+
292
+ 1. **The work deviates significantly from the spec.**
293
+ - What you build contradicts `spec/SPEC.md`.
294
+ - A fact you found makes the approved shape no longer fit.
295
+ - The solution departs noticeably from an approved solution sketch.
296
+
297
+ 2. **A blocker only the user can resolve.**
298
+ - A scope or design decision with no single right answer.
299
+ - An action that is destructive or hard to reverse: a data migration, a deletion, a call to an external service.
300
+ - Missing access only the user can grant.
301
+
302
+ 3. **The run cannot carry on for technical reasons.**
303
+ - A verify step that still fails after a real attempt to fix it.
304
+ - A tool the plan needs, and your environment refuses to give.
305
+
306
+ For the third one, declare a gate saying what the plan asks for and why you cannot do it here.
307
+ Offer stopping and carrying on without it, and say plainly that the report will name what never happened.
308
+
309
+ **Everything else is yours to settle**: a review finding, a wording call, an unclear task, which of two fixes reads better.
310
+ Settle it, keep the run moving, and say in the report what you settled.
311
+ A run that stops to ask about something it could have settled has failed.
312
+ Quality is yours to hold, and the user is waiting for the finished work.
313
+
314
+ ## 5. Report
315
+
316
+ At the end of the run, or at a pause, report in a normal message:
317
+
318
+ - The phases finished this run, and the overall progress, such as "5/7 phases done".
319
+ - What the verification showed, and the outcome of every checkpoint this run ran: what the reviewers found, what was fixed, what was dismissed and why. When the plan asked for no review, say so.
320
+ - What you settled on your own, where it matters to the user.
321
+ - The branch, when the run committed to one of its own, that it is unmerged, and that merging it back is the user's job.
322
+ - Why the run stopped, when it stopped at a pause or a stop condition, and what you need from the user.
323
+
324
+ When every phase is done, post the status as `complete`.