@rpamis/comet 0.3.6 → 0.3.7
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.
- package/LICENSE +21 -21
- package/README.md +175 -63
- package/assets/manifest.json +11 -1
- package/assets/skills/comet/SKILL.md +44 -16
- package/assets/skills/comet/reference/dirty-worktree.md +1 -0
- package/assets/skills/comet/rules/comet-phase-guard.md +90 -0
- package/assets/skills/comet/scripts/comet-archive.sh +71 -55
- package/assets/skills/comet/scripts/comet-guard.sh +174 -18
- package/assets/skills/comet/scripts/comet-handoff.sh +133 -6
- package/assets/skills/comet/scripts/comet-hook-guard.sh +260 -0
- package/assets/skills/comet/scripts/comet-state.sh +300 -25
- package/assets/skills/comet/scripts/comet-yaml-validate.sh +24 -1
- package/assets/skills/comet-archive/SKILL.md +43 -10
- package/assets/skills/comet-build/SKILL.md +117 -22
- package/assets/skills/comet-design/SKILL.md +119 -13
- package/assets/skills/comet-hotfix/SKILL.md +51 -9
- package/assets/skills/comet-open/SKILL.md +86 -13
- package/assets/skills/comet-tweak/SKILL.md +33 -8
- package/assets/skills/comet-verify/SKILL.md +48 -9
- package/assets/skills-zh/comet/SKILL.md +47 -16
- package/assets/skills-zh/comet/reference/dirty-worktree.md +2 -1
- package/assets/skills-zh/comet-archive/SKILL.md +44 -11
- package/assets/skills-zh/comet-build/SKILL.md +120 -25
- package/assets/skills-zh/comet-design/SKILL.md +123 -16
- package/assets/skills-zh/comet-hotfix/SKILL.md +47 -9
- package/assets/skills-zh/comet-open/SKILL.md +87 -14
- package/assets/skills-zh/comet-tweak/SKILL.md +29 -8
- package/assets/skills-zh/comet-verify/SKILL.md +49 -12
- package/bin/comet.js +3 -3
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +22 -0
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/init.d.ts +5 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +64 -9
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +60 -1
- package/dist/commands/update.js.map +1 -1
- package/dist/core/codegraph.d.ts +9 -0
- package/dist/core/codegraph.d.ts.map +1 -0
- package/dist/core/codegraph.js +96 -0
- package/dist/core/codegraph.js.map +1 -0
- package/dist/core/platforms.d.ts +10 -0
- package/dist/core/platforms.d.ts.map +1 -1
- package/dist/core/platforms.js +163 -15
- package/dist/core/platforms.js.map +1 -1
- package/dist/core/skills.d.ts +34 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +360 -1
- package/dist/core/skills.js.map +1 -1
- package/package.json +3 -1
- package/scripts/postinstall.js +44 -44
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: comet-archive
|
|
3
|
-
description: "Comet Phase 5: Archive. Invoke with /comet-archive.
|
|
3
|
+
description: "Comet Phase 5: Archive. Invoke with /comet-archive. Merge delta specs into main specs with OpenSpec semantics, archive change."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Comet Phase 5: Archive (Archive)
|
|
@@ -13,6 +13,10 @@ description: "Comet Phase 5: Archive. Invoke with /comet-archive. Sync delta spe
|
|
|
13
13
|
|
|
14
14
|
## Steps
|
|
15
15
|
|
|
16
|
+
### 0. Output Language Constraint
|
|
17
|
+
|
|
18
|
+
Archive summaries and lifecycle closure notes must use the language of the user request that triggered this workflow.
|
|
19
|
+
|
|
16
20
|
### 0. Entry State Verification (Entry Check)
|
|
17
21
|
|
|
18
22
|
Execute entry verification:
|
|
@@ -29,7 +33,24 @@ fi
|
|
|
29
33
|
|
|
30
34
|
Proceed to Step 1 after verification passes. The script outputs specific failure reasons when verification fails.
|
|
31
35
|
|
|
32
|
-
### 1.
|
|
36
|
+
### 1. Final Archive Confirmation (Blocking Point)
|
|
37
|
+
|
|
38
|
+
After entry verification passes, **must use the current platform's available user input/confirmation mechanism to pause and wait for the user to confirm whether to archive immediately**. Must not run `"$COMET_BASH" "$COMET_ARCHIVE" "<change-name>"` before user confirmation. If the current platform has no structured question tool, ask an equivalent single-select question in the conversation, stop the workflow, and wait for the user's reply before continuing.
|
|
39
|
+
|
|
40
|
+
Before confirmation, show the user a brief summary:
|
|
41
|
+
- Change name
|
|
42
|
+
- Verification report path and result
|
|
43
|
+
- Branch handling status
|
|
44
|
+
- Irreversible actions this archive will perform: merge main specs with OpenSpec delta semantics, annotate design doc / plan, and move the change to the archive directory
|
|
45
|
+
|
|
46
|
+
The user confirmation question must be presented as a single-select question with these options:
|
|
47
|
+
- "Confirm archive" — immediately run the archive script to complete spec merge and change movement
|
|
48
|
+
- "Needs adjustment or re-verification" — do not archive; run `"$COMET_BASH" "$COMET_STATE" transition <change-name> archive-reopen` to return to `phase: verify`, then invoke `/comet-verify`. If verification confirms fixes are needed, follow `/comet-verify`'s verification-failure decision flow back to `/comet-build`
|
|
49
|
+
- "Do not archive yet" — do not archive; keep the current `phase: archive` state and wait for the user to invoke `/comet-archive` again later
|
|
50
|
+
|
|
51
|
+
Only after the user selects "Confirm archive" may Step 2 continue. After the user selects "Needs adjustment or re-verification", must first run the `archive-reopen` state transition; do not edit `.comet.yaml` manually.
|
|
52
|
+
|
|
53
|
+
### 2. Execute Archive
|
|
33
54
|
|
|
34
55
|
Run the archive script to automatically complete all steps:
|
|
35
56
|
|
|
@@ -39,25 +60,25 @@ Run the archive script to automatically complete all steps:
|
|
|
39
60
|
|
|
40
61
|
The script automatically executes:
|
|
41
62
|
1. Entry state validation (phase=archive, verify_result=pass, archived=false)
|
|
42
|
-
2.
|
|
43
|
-
3.
|
|
44
|
-
4.
|
|
45
|
-
5.
|
|
63
|
+
2. Design doc frontmatter annotation (archived-with, status)
|
|
64
|
+
3. Plan frontmatter annotation (archived-with)
|
|
65
|
+
4. OpenSpec archive for delta-merge semantics and moving the change to the archive directory
|
|
66
|
+
5. Main spec guard against leaked delta-only section headings
|
|
46
67
|
6. Update `archived: true` through `comet-state transition <archive-name> archived`
|
|
47
68
|
|
|
48
69
|
If script returns non-zero exit code, report error and stop.
|
|
49
70
|
If script returns zero exit code, archive is complete.
|
|
50
71
|
The summary `X/Y steps succeeded` counts real executed steps and does not double-count delta spec sync or document annotation.
|
|
51
72
|
|
|
52
|
-
|
|
73
|
+
The script calls OpenSpec archive to merge `ADDED/MODIFIED/REMOVED/RENAMED` delta semantics into main specs, then verifies main specs do not contain delta-only section headings.
|
|
53
74
|
|
|
54
75
|
Use `--dry-run` flag to preview without executing.
|
|
55
76
|
|
|
56
|
-
###
|
|
77
|
+
### 3. Lifecycle Closed Loop
|
|
57
78
|
|
|
58
79
|
Spec lifecycle completes here:
|
|
59
80
|
```
|
|
60
|
-
brainstorming → delta spec → implementation → verification → main spec
|
|
81
|
+
brainstorming → delta spec → implementation → verification → main spec merge → design doc annotation → archive
|
|
61
82
|
```
|
|
62
83
|
|
|
63
84
|
## Exit Conditions
|
|
@@ -66,8 +87,20 @@ brainstorming → delta spec → implementation → verification → main spec o
|
|
|
66
87
|
- Archive directory `openspec/changes/archive/YYYY-MM-DD-<change-name>/` exists
|
|
67
88
|
- Archived `.comet.yaml` contains `archived: true`
|
|
68
89
|
|
|
69
|
-
The archive script moves `openspec/changes/<name>/` to `openspec/changes/archive/YYYY-MM-DD-<name>/`.
|
|
90
|
+
The archive script moves `openspec/changes/<name>/` to `openspec/changes/archive/YYYY-MM-DD-<name>/`.
|
|
91
|
+
|
|
92
|
+
> **WARNING**: After successful archive, **do not run** `"$COMET_BASH" "$COMET_GUARD" <change-name> archive` against the old active change name; the active directory no longer exists. Doing so will cause the guard to error with "change directory not found". Archive completeness is determined by script exit code and archived directory state.
|
|
70
93
|
|
|
71
94
|
## Complete
|
|
72
95
|
|
|
73
96
|
Comet workflow complete. To start new work, invoke `/comet` or `/comet-open`.
|
|
97
|
+
|
|
98
|
+
## Context Compaction Recovery
|
|
99
|
+
|
|
100
|
+
The archive phase may trigger context compaction during execution. On resume, first run:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
"$COMET_BASH" "$COMET_STATE" check <change-name> archive --recover
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
The script outputs structured recovery context (archive status, completed steps). Follow the Recovery action to determine next steps. If `archived: true` and the archive directory exists, archiving is already complete — no need to run the archive operation again.
|
|
@@ -28,13 +28,22 @@ fi
|
|
|
28
28
|
|
|
29
29
|
Proceed to Step 1 after verification passes. The script outputs specific failure reasons when verification fails.
|
|
30
30
|
|
|
31
|
-
**Idempotency**: All build phase operations can be safely re-executed. Read `.comet.yaml` `phase` field to confirm still in build, read plan header `base-ref`, then
|
|
31
|
+
**Idempotency**: All build phase operations can be safely re-executed. Read `.comet.yaml` `phase` field to confirm still in build, read plan header `base-ref`, then use `grep -n '\- \[ \]' tasks.md | head -1` to find the first unchecked task. Already-committed tasks must not be re-committed.
|
|
32
32
|
|
|
33
|
-
### 1. Create Plan
|
|
33
|
+
### 1. Create Plan (Subagent Offload)
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
Create the implementation plan through a subagent, avoiding planning skill occupying main session context. Plan files and execution feedback must use the language of the user request that triggered this workflow.
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
**Subagent instructions**:
|
|
38
|
+
|
|
39
|
+
You are an implementation planning expert. Create an implementation plan based on the following inputs:
|
|
40
|
+
|
|
41
|
+
1. **Immediately execute:** Use the Skill tool to load the Superpowers `writing-plans` skill. Skipping this step is prohibited. After the skill loads, ARGUMENTS must include: `Language: Use the language of the user request that triggered this workflow`
|
|
42
|
+
2. Read the Design Doc (technical design document under `docs/superpowers/specs/`)
|
|
43
|
+
3. Read `openspec/changes/<name>/tasks.md` (task boundaries)
|
|
44
|
+
4. Follow the skill's guidance to create the plan
|
|
45
|
+
|
|
46
|
+
Plan requirements:
|
|
38
47
|
- Save to `docs/superpowers/plans/YYYY-MM-DD-<feature>.md`
|
|
39
48
|
- Reference design document, break down into executable tasks
|
|
40
49
|
- **Plan file header must contain associated metadata**:
|
|
@@ -53,6 +62,14 @@ base-ref: <git rev-parse HEAD before implementation>
|
|
|
53
62
|
git rev-parse HEAD
|
|
54
63
|
```
|
|
55
64
|
|
|
65
|
+
Write the plan to file, then return the file path.
|
|
66
|
+
|
|
67
|
+
**Execute subagent**: Use the current platform's subagent dispatch mechanism to send the above task.
|
|
68
|
+
|
|
69
|
+
After the subagent completes:
|
|
70
|
+
- If a valid file path is returned and the file exists, record it as the plan
|
|
71
|
+
- If the subagent fails or returns an invalid path, fall back to loading the Superpowers `writing-plans` skill inline in the main session (degraded fallback)
|
|
72
|
+
|
|
56
73
|
### 2. Update Plan Status and Provide Plan-Ready Pause Point
|
|
57
74
|
|
|
58
75
|
Record plan path:
|
|
@@ -70,7 +87,7 @@ After the plan is recorded, immediately provide a new user decision point:
|
|
|
70
87
|
| A | Continue execution | Stay in the current model and proceed to Step 3 to choose workspace isolation and execution method |
|
|
71
88
|
| B | Pause to switch model | Record `build_pause: plan-ready`, stop this `/comet-build` invocation, and allow the user to resume later from `/comet` or `/comet-build` |
|
|
72
89
|
|
|
73
|
-
This is a user decision point. **Must use the
|
|
90
|
+
This is a user decision point. **Must use the current platform's available user input/confirmation mechanism to pause and wait for the user to explicitly choose**. Must not auto-continue and must not write the pause into `build_mode`. If the current platform has no structured question tool, ask equivalent options in the conversation, stop the workflow, and wait for the user's reply before continuing.
|
|
74
91
|
|
|
75
92
|
When the user chooses to continue:
|
|
76
93
|
|
|
@@ -121,17 +138,33 @@ Plan has been written to the current branch. Before starting execution, **ask th
|
|
|
121
138
|
- Task count ≤ 2 and no cross-module dependencies → Recommend B
|
|
122
139
|
- From hotfix path → Recommend B
|
|
123
140
|
|
|
124
|
-
This is a user decision point. **Must use the
|
|
141
|
+
This is a user decision point. **Must use the current platform's available user input/confirmation mechanism to pause and wait for the user to explicitly choose isolation method, execution method, and TDD mode**. Must not choose `branch` or `worktree` based on recommendation rules, and must not choose the execution method or TDD mode based on recommendation rules. Recommendation rules are for suggestion only, not a substitute for user confirmation. If the current platform has no structured question tool, ask equivalent options in the conversation, stop the workflow, and wait for the user's reply before continuing.
|
|
125
142
|
|
|
126
|
-
After user selection, update `isolation
|
|
143
|
+
After user selection, update `isolation`, execution method, and TDD mode fields:
|
|
127
144
|
|
|
128
145
|
```bash
|
|
129
146
|
"$COMET_BASH" "$COMET_STATE" set <name> isolation <branch|worktree>
|
|
130
|
-
"$COMET_BASH" "$COMET_STATE" set <name> build_mode <subagent-driven-development|executing-plans|direct>
|
|
131
147
|
```
|
|
132
148
|
|
|
149
|
+
- If the user chooses `executing-plans`: run `"$COMET_BASH" "$COMET_STATE" set <name> subagent_dispatch null`, then run `"$COMET_BASH" "$COMET_STATE" set <name> build_mode executing-plans`
|
|
150
|
+
- If the user chooses `subagent-driven-development`: first confirm the current platform has real background subagent / Task / multi-agent dispatch capability; after confirming, run `"$COMET_BASH" "$COMET_STATE" set <name> subagent_dispatch confirmed`, then run `"$COMET_BASH" "$COMET_STATE" set <name> build_mode subagent-driven-development`
|
|
151
|
+
- If real background dispatch capability cannot be confirmed, must not write `build_mode: subagent-driven-development`; must pause and wait for the user to choose `executing-plans` instead
|
|
152
|
+
|
|
153
|
+
**TDD Mode**:
|
|
154
|
+
|
|
155
|
+
| Option | Meaning | Applicable Scenario |
|
|
156
|
+
|--------|---------|---------------------|
|
|
157
|
+
| `tdd` | Write a failing test first for each task, then implement | Recommended. Changes involving business logic, new features, APIs |
|
|
158
|
+
| `direct` | Implement directly, no enforced TDD flow | Changes that don't need test coverage, or user chooses to skip tests and write code directly. hotfix/tweak presets default to `direct` |
|
|
159
|
+
|
|
160
|
+
Run `"$COMET_BASH" "$COMET_STATE" set <name> tdd_mode <tdd|direct>`
|
|
161
|
+
|
|
133
162
|
`isolation` is a script-enforced hard constraint. Full workflow init may temporarily leave it as `null`, but only before this step. If it remains `null`, both the `build → verify` guard and `comet-state transition build-complete` will fail.
|
|
134
163
|
|
|
164
|
+
`subagent_dispatch` is a script-enforced hard constraint. `build_mode: subagent-driven-development` requires `subagent_dispatch: confirmed` before leaving the build phase, otherwise both `comet-guard.sh build --apply` and `comet-state transition build-complete` will fail.
|
|
165
|
+
|
|
166
|
+
`tdd_mode` is a script-enforced hard constraint. Full workflow must have `tdd_mode` selected as `tdd` or `direct` before leaving the build phase, otherwise both `comet-guard.sh build --apply` and `comet-state transition build-complete` will fail.
|
|
167
|
+
|
|
135
168
|
`build_mode` defaults to `direct` only for hotfix/tweak presets. Full workflow must not default to `direct`. Use it only when the user explicitly asks to bypass the plan execution skills and you record an explicit override:
|
|
136
169
|
|
|
137
170
|
```bash
|
|
@@ -143,20 +176,67 @@ Without `direct_override: true`, `build_mode=direct` in full workflow is blocked
|
|
|
143
176
|
|
|
144
177
|
**Execute isolation**:
|
|
145
178
|
|
|
146
|
-
- **branch**:
|
|
179
|
+
- **branch**: Recommend a branch name based on the workflow type and current date, then let the user confirm or input a custom name. This is a user decision point — **must use the current platform's available user input/confirmation mechanism to pause and wait for the user to explicitly confirm or override the branch name**. Must not skip this step and create the branch directly.
|
|
180
|
+
|
|
181
|
+
Branch naming convention:
|
|
182
|
+
- Read the `workflow` field from `.comet.yaml` to determine the prefix
|
|
183
|
+
- `workflow: full` → recommend `feature/YYYYMMDD/<change-name>`
|
|
184
|
+
- `workflow: hotfix` → recommend `hotfix/YYYYMMDD/<change-name>`
|
|
185
|
+
- `workflow: tweak` → recommend `tweak/YYYYMMDD/<change-name>`
|
|
186
|
+
- Date is derived from `date +%Y%m%d` at runtime
|
|
187
|
+
|
|
188
|
+
Example: if change name is `fix-login-bug` and today is 2026-06-09, recommend `feature/20260609/fix-login-bug`
|
|
189
|
+
|
|
190
|
+
After the user confirms or provides a custom branch name, run `git checkout -b <branch-name>`, subsequent work on the new branch.
|
|
191
|
+
|
|
147
192
|
- **worktree**: Must use the Skill tool to load the Superpowers `using-git-worktrees` skill to create isolated workspace. Do not bypass this skill with plain shell commands or native tools; if the skill is unavailable, stop the process and prompt to install or enable Superpowers skills.
|
|
148
193
|
|
|
149
|
-
After creating isolation, confirm plan file is accessible (naturally accessible with branch method; for worktree method, confirm plan has been committed).
|
|
194
|
+
After creating isolation, confirm plan file is accessible (naturally accessible with branch method; for worktree method, confirm plan has been committed). If the plan file has not been committed under worktree mode, commit it first before creating the worktree:
|
|
150
195
|
|
|
151
|
-
|
|
196
|
+
```bash
|
|
197
|
+
git add docs/superpowers/plans/YYYY-MM-DD-feature.md
|
|
198
|
+
git commit -m "chore: add implementation plan"
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
**Execute plan**: Must handle execution according to the actual runtime of `build_mode`.
|
|
152
202
|
|
|
153
|
-
|
|
203
|
+
- `build_mode: executing-plans`: **Immediately execute:** Use the Skill tool to load the Superpowers `executing-plans` skill. Skipping this step is prohibited. If the skill is unavailable, stop the process and prompt to install or enable the corresponding skill; do not substitute with normal conversation. After the skill loads, ARGUMENTS must include the same Language constraint as Step 1: `Language: Use the language of the user request that triggered this workflow`. Execute according to plan.
|
|
204
|
+
- `build_mode: subagent-driven-development`: The main window only coordinates; must not run `subagent-driven-development` as the main window execution skill directly. Must use the confirmed real background subagent / Task / multi-agent dispatch capability to dispatch the next unchecked task to a background subagent. When dispatching each subagent, the prompt must explicitly require: after the skill loads, ARGUMENTS must include the same Language constraint as Step 1: `Language: Use the language of the user request that triggered this workflow`; after the task is complete and validated, immediately check off the corresponding plan task in `docs/superpowers/plans/<plan-file>.md`; if that plan task maps to an item in `openspec/changes/<name>/tasks.md`, also change that OpenSpec task from `- [ ]` to `- [x]`; if the plan added a step that does not exist in OpenSpec, only the corresponding plan task needs to be checked off. Do not only update the built-in Todo or an in-chat checklist. The background subagent loads the Superpowers `subagent-driven-development` execution flow on its own and follows its guidance for implementation, review, and commit.
|
|
205
|
+
- If the current platform has no real background subagent / Task / multi-agent dispatch capability, must pause and wait for the user to choose main window execution instead. After the user chooses, must run `"$COMET_BASH" "$COMET_STATE" set <name> build_mode executing-plans`, then follow the `build_mode: executing-plans` branch to load the Superpowers `executing-plans` skill. Must not continue executing tasks before the user explicitly chooses.
|
|
154
206
|
|
|
155
|
-
After
|
|
207
|
+
After execution begins, follow the chosen branch to completion:
|
|
156
208
|
- Execute tasks according to plan
|
|
157
|
-
-
|
|
209
|
+
- Check off the corresponding Superpowers plan task; if the task maps to OpenSpec tasks.md, also check off the corresponding OpenSpec task (`- [ ]` → `- [x]`)
|
|
158
210
|
- Commit code after each task completion
|
|
159
211
|
|
|
212
|
+
**TDD Mode Execution Constraints**:
|
|
213
|
+
|
|
214
|
+
If `tdd_mode: tdd`:
|
|
215
|
+
- `build_mode: executing-plans`: After loading the execution skill and before executing the first task, **Immediately execute:** Use the Skill tool to load the Superpowers `test-driven-development` skill once. Skipping this step is prohibited. After the skill loads, start from the first unchecked task and follow the loaded TDD Red-Green-Refactor cycle for each task. Must not skip the failing test verification phase. Do not reload this skill for subsequent tasks; follow the already-loaded flow. If resuming after context compaction, re-run this step to load the TDD skill once, then continue from the first unchecked task.
|
|
216
|
+
- `build_mode: subagent-driven-development`: When dispatching each subagent, must inject the TDD hard constraint into the prompt: **"You MUST follow TDD: for each task, write a failing test first, watch it fail, then write minimal code to pass. No production code without a failing test first."**. The same prompt must also include the OpenSpec tasks.md and Superpowers plan persistent check-off requirement above. Must not rely on implementer-prompt.md's conditional trigger; must explicitly write it in the dispatch prompt.
|
|
217
|
+
|
|
218
|
+
If `tdd_mode: direct`: Follow normal flow, no enforced TDD.
|
|
219
|
+
|
|
220
|
+
**`executing-plans` review gate**:
|
|
221
|
+
|
|
222
|
+
When `build_mode` is `executing-plans`, after all planned tasks are complete and before running the build → verify phase guard, must use the Skill tool to load the Superpowers `requesting-code-review` skill and request code review at least once.
|
|
223
|
+
|
|
224
|
+
Requirements:
|
|
225
|
+
- the `requesting-code-review` skill must be loaded before `"$COMET_BASH" "$COMET_GUARD" <change-name> build --apply`
|
|
226
|
+
- if `requesting-code-review` skill is unavailable, skip the review gate but must record `<!-- review skipped: skill unavailable -->` in tasks.md, then continue guard transition
|
|
227
|
+
- CRITICAL review findings (security vulnerabilities, data loss risk, build/test failures) must be fixed first and must not be carried into verify
|
|
228
|
+
- if non-CRITICAL review findings are accepted, record the acceptance reason and impact scope in tasks.md, the commit body, a verification report draft, or another durable artifact
|
|
229
|
+
|
|
230
|
+
### 3b. In-Execution Debugging (Debug Gate)
|
|
231
|
+
|
|
232
|
+
During task execution, whenever a crash, unexpected behavior, test failure, or build failure appears while running the program, tests, build, or manual verification, must use the Skill tool to load the Superpowers `systematic-debugging` skill. Before root-cause investigation is complete, must not propose or implement source-code fixes.
|
|
233
|
+
|
|
234
|
+
Handle it using the four-phase `systematic-debugging` flow:
|
|
235
|
+
- First reproduce and locate the root cause, read full errors, check recent changes, and trace data flow
|
|
236
|
+
- If root cause points to a source bug, first add a minimal failing test that reproduces the crash or unexpected behavior, then modify source code
|
|
237
|
+
- After the fix, run that failing test, related tests, and project build/verification commands to confirm all pass
|
|
238
|
+
- Keep the test, source fix, and tasks.md checkoff inside the current change; Must not replace the current change verification loop by starting a separate "write test cases" change
|
|
239
|
+
|
|
160
240
|
### 4. Spec Incremental Updates
|
|
161
241
|
|
|
162
242
|
When the initial spec is found incomplete during implementation, handle by scale:
|
|
@@ -164,13 +244,17 @@ When the initial spec is found incomplete during implementation, handle by scale
|
|
|
164
244
|
| Scale | Trigger Conditions | Approach |
|
|
165
245
|
|------|-------------------|----------|
|
|
166
246
|
| Small | Missing acceptance scenarios, edge cases | Directly edit delta spec + design.md, append tasks.md tasks |
|
|
167
|
-
| Medium | Interface changes, new components, data flow changes | **Must use the
|
|
168
|
-
| Large | Brand-new capability requirements | **Must use the
|
|
247
|
+
| Medium | Interface changes, new components, data flow changes | **Must use the current platform's available user input/confirmation mechanism to pause and wait for the user to explicitly confirm**, then must use Skill tool to load the Superpowers `brainstorming` skill to update Design Doc + delta spec |
|
|
248
|
+
| Large | Brand-new capability requirements | **Must use the current platform's available user input/confirmation mechanism to pause and wait for the user to explicitly confirm the split**; after user confirms, create independent change through `/comet-open` |
|
|
169
249
|
|
|
170
|
-
**50% Threshold Determination**: Using initial task count in tasks.md as baseline, if new tasks exceed half of that total, it's considered outside original plan scope, **must use the
|
|
250
|
+
**50% Threshold Determination**: Using initial task count in tasks.md as baseline, if new tasks exceed half of that total, it's considered outside original plan scope, **must use the current platform's available user input/confirmation mechanism to pause and wait for the user to decide whether to split into a new change**. If the current platform has no structured question tool, ask split options in the conversation, stop the workflow, and wait for the user's reply before continuing.
|
|
171
251
|
|
|
172
252
|
When creating an independent change, must invoke `/comet-open`, not `/opsx:new` directly. `/comet-open` creates both OpenSpec artifacts and `.comet.yaml`, preventing the new change from leaving the Comet state machine.
|
|
173
253
|
|
|
254
|
+
**User choices must include**:
|
|
255
|
+
- "Split into new change" — create independent change via `/comet-open`
|
|
256
|
+
- "Continue in current change" — record scope-expansion decision, update tasks.md and delta spec, then continue
|
|
257
|
+
|
|
174
258
|
**Principles**:
|
|
175
259
|
- Delta spec is a living document, can be modified at any time during this phase
|
|
176
260
|
- Each update should be committed with commit message explaining the change reason
|
|
@@ -181,7 +265,7 @@ When creating an independent change, must invoke `/comet-open`, not `/opsx:new`
|
|
|
181
265
|
|
|
182
266
|
Build is the longest phase and may span many tasks. To support resume after context compaction:
|
|
183
267
|
|
|
184
|
-
- **After each task**: immediately check off tasks.md
|
|
268
|
+
- **After each task**: immediately check off the corresponding task in the Superpowers plan; if the task maps to OpenSpec tasks.md, also check off the corresponding OpenSpec task; then commit code so `.comet.yaml` and file state are durable. Use `grep -c '\- \[ \]' tasks.md` to check remaining unchecked count; no need to re-read the entire file
|
|
185
269
|
- **After context compaction**: first run `"$COMET_BASH" "$COMET_STATE" check <change-name> build --recover` — the script outputs structured recovery context (isolation/build_mode status, plan path, task progress, recovery action). Follow the Recovery action to determine next step.
|
|
186
270
|
- **User manual-change resume**: handle uncommitted changes through `comet/reference/dirty-worktree.md`. That protocol defines checks, attribution, and prohibitions. Build-specific handling:
|
|
187
271
|
1. After attribution, if the diff implies plan or spec changes, handle it through Step 4 "Spec Incremental Updates"
|
|
@@ -193,7 +277,9 @@ Build is the longest phase and may span many tasks. To support resume after cont
|
|
|
193
277
|
- Code committed
|
|
194
278
|
- Project-specific build/tests explicitly run and pass; do not rely only on guard auto-detection
|
|
195
279
|
- `isolation` has been written as `branch` or `worktree`
|
|
196
|
-
- `build_mode` has been written as `subagent-driven-development`, `executing-plans`, or `direct` with explicit override
|
|
280
|
+
- `build_mode` has been written as `subagent-driven-development`, `executing-plans`, or `direct` with explicit override; if `subagent-driven-development`, `subagent_dispatch` must be `confirmed`
|
|
281
|
+
- `tdd_mode` has been written as `tdd` or `direct`
|
|
282
|
+
- If `build_mode` is `executing-plans`, the Skill tool has been used to load the Superpowers `requesting-code-review` skill and request code review at least once, and CRITICAL review findings have been fixed or acceptance rationale for non-CRITICAL review findings has been recorded
|
|
197
283
|
- **Phase guard**: Run `"$COMET_BASH" "$COMET_GUARD" <change-name> build --apply`; after all PASS, state advances to `phase: verify`
|
|
198
284
|
|
|
199
285
|
Guard reads project command configuration first:
|
|
@@ -214,8 +300,17 @@ Before exit, run guard to auto-transition:
|
|
|
214
300
|
|
|
215
301
|
State file is automatically updated to `phase: verify`, `verify_result: pending`.
|
|
216
302
|
|
|
217
|
-
## Automatic
|
|
303
|
+
## Automatic Handoff to Next Phase
|
|
218
304
|
|
|
219
|
-
|
|
305
|
+
> **Terminology distinction**: the "phase advancement" above is performed by guard `--apply`, which updates the `.comet.yaml` `phase` field. This step **always happens** and is not controlled by `auto_transition`. This section's "automatic handoff" only controls whether to automatically invoke the next skill.
|
|
306
|
+
|
|
307
|
+
After exit conditions are met and guard-based phase advancement has completed, run:
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
"$COMET_BASH" "$COMET_STATE" next <change-name>
|
|
311
|
+
```
|
|
220
312
|
|
|
221
|
-
|
|
313
|
+
The script determines the next action from `phase`, `workflow`, and `auto_transition`:
|
|
314
|
+
- `NEXT: auto` -> invoke the `SKILL` target to continue to the next phase
|
|
315
|
+
- `NEXT: manual` -> do not invoke the next skill; follow `HINT` and ask the user to run `/<SKILL>` manually
|
|
316
|
+
- `NEXT: done` -> workflow is complete; no further action needed
|
|
@@ -38,13 +38,22 @@ Proceed to Step 1 after verification passes. The script outputs specific failure
|
|
|
38
38
|
"$COMET_BASH" "$COMET_HANDOFF" <change-name> design --write
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
The script generates and records
|
|
41
|
+
The script reads the change `.comet.yaml` `context_compression` snapshot, then generates and records the matching handoff package.
|
|
42
|
+
|
|
43
|
+
Default `context_compression: off` generates:
|
|
42
44
|
|
|
43
45
|
```
|
|
44
46
|
openspec/changes/<name>/.comet/handoff/design-context.json
|
|
45
47
|
openspec/changes/<name>/.comet/handoff/design-context.md
|
|
46
48
|
```
|
|
47
49
|
|
|
50
|
+
Beta mode (`context_compression: beta` in project `.comet/config.yaml`, snapshotted into `.comet.yaml` when the change is created) generates:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
openspec/changes/<name>/.comet/handoff/spec-context.json
|
|
54
|
+
openspec/changes/<name>/.comet/handoff/spec-context.md
|
|
55
|
+
```
|
|
56
|
+
|
|
48
57
|
And writes to `.comet.yaml`:
|
|
49
58
|
|
|
50
59
|
```yaml
|
|
@@ -57,6 +66,11 @@ The default handoff package is a **compact traceable excerpt**, not an agent sum
|
|
|
57
66
|
- `design-context.md`: context for Superpowers to read, containing script markers, source path, line range, sha256, deterministic excerpts
|
|
58
67
|
- When exceeding excerpt budget, marks `[TRUNCATED]` and retains Full source path
|
|
59
68
|
|
|
69
|
+
The beta handoff package is a **structured spec projection** that reduces OpenSpec token load without replacing the canonical spec:
|
|
70
|
+
- `spec-context.json`: machine index containing change, phase, canonical spec, source paths, hash, and file roles
|
|
71
|
+
- `spec-context.md`: context for Superpowers to read, verbatim-projecting delta spec files and referencing supporting artifacts by hash
|
|
72
|
+
- OpenSpec delta specs remain canonical; if the projection is missing, stale, or unclear, regenerate the handoff or read the source spec directly instead of writing an agent summary
|
|
73
|
+
|
|
60
74
|
If full context is genuinely needed, explicitly run:
|
|
61
75
|
|
|
62
76
|
```bash
|
|
@@ -71,16 +85,29 @@ Handoff package sources come from OpenSpec open phase artifacts:
|
|
|
71
85
|
|
|
72
86
|
### 1b. Execute Brainstorming (with Context)
|
|
73
87
|
|
|
74
|
-
**Immediately execute:** Use the Skill tool to load the Superpowers `brainstorming` skill
|
|
88
|
+
**Immediately execute:** Use the Skill tool to load the Superpowers `brainstorming` skill. Skipping this step is prohibited.
|
|
89
|
+
|
|
90
|
+
When loading the skill, ARGUMENTS must include:
|
|
91
|
+
|
|
92
|
+
```text
|
|
93
|
+
Language: Use the language of the user request that triggered this workflow
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
After the skill loads, follow its guidance and use the following context:
|
|
75
97
|
|
|
76
98
|
```
|
|
77
99
|
Change: <change-name>
|
|
78
100
|
OpenSpec Context Pack: openspec/changes/<name>/.comet/handoff/design-context.md
|
|
79
101
|
Machine handoff: openspec/changes/<name>/.comet/handoff/design-context.json
|
|
80
102
|
|
|
81
|
-
|
|
103
|
+
If context_compression is beta, use:
|
|
104
|
+
OpenSpec Context Pack: openspec/changes/<name>/.comet/handoff/spec-context.md
|
|
105
|
+
Machine handoff: openspec/changes/<name>/.comet/handoff/spec-context.json
|
|
106
|
+
|
|
107
|
+
OpenSpec artifacts are the upstream source of truth, but you must not weaken the Superpowers `brainstorming` clarification flow by "skipping redundant context exploration".
|
|
82
108
|
Your task is to perform deep technical design based on the handoff package: implementation approach, technical risks, testing strategy, boundary conditions.
|
|
83
|
-
If
|
|
109
|
+
If goals, scope, non-goals, acceptance scenarios, or key constraints remain unclear, you must continue asking questions and form the design proposal first; must not create the Design Doc after only one Q&A turn.
|
|
110
|
+
Do not rewrite proposal/spec; if you find OpenSpec delta spec missing acceptance scenarios, you may only propose Spec Patches and write them back to OpenSpec delta spec; do not create a second requirements spec in the Design Doc. Spec Patches are limited to supplementing acceptance scenarios, correcting ambiguous descriptions, or adding boundary conditions — they must not substantially rewrite the delta spec's structure or scope. If major changes are needed, flag them as design findings and return to brainstorming for confirmation.
|
|
84
111
|
|
|
85
112
|
Design Doc frontmatter must be minimal, containing only:
|
|
86
113
|
---
|
|
@@ -89,23 +116,26 @@ role: technical-design
|
|
|
89
116
|
canonical_spec: openspec
|
|
90
117
|
---
|
|
91
118
|
|
|
92
|
-
|
|
119
|
+
Proceed through the original `brainstorming` skill flow: clarifying questions, 2-3 approaches, and step-by-step design confirmation. Do not write the Design Doc early.
|
|
93
120
|
```
|
|
94
121
|
|
|
95
|
-
|
|
122
|
+
Proceeding without loading this skill is prohibited.
|
|
96
123
|
|
|
97
124
|
If the Superpowers `brainstorming` skill is unavailable, stop the process and prompt to install or enable Superpowers skills. Do not substitute this step with normal conversation.
|
|
98
125
|
|
|
99
126
|
After the skill loads, follow its guidance to produce design proposals (presented as conversation):
|
|
100
127
|
- Technical approach: architecture, data flow, key technology choices and risks
|
|
101
128
|
- Testing strategy
|
|
129
|
+
- Requirement/scope gaps and Spec Patches to be written back
|
|
102
130
|
- If acceptance scenarios need supplementing, indicate delta spec changes to be written back
|
|
103
131
|
|
|
104
132
|
The brainstorming phase does not write to the Design Doc file; it only produces design proposals for Step 1c user confirmation. Only after confirmation should `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md` be created and delta spec written back.
|
|
105
133
|
|
|
134
|
+
For context compaction recovery, the agent must incrementally update `brainstorm-summary.md` during brainstorming. After each clarification round or proposal iteration, update the file whenever new confirmed facts, key constraints, candidate approaches, trade-offs/risks, testing strategy, or Spec Patch candidates emerge; mark unconfirmed items as "pending" or "candidate". This file is a recovery checkpoint, not the Design Doc, and must not replace the Step 1c user confirmation.
|
|
135
|
+
|
|
106
136
|
### 1c. User Confirms Design Proposal (Blocking Point)
|
|
107
137
|
|
|
108
|
-
After brainstorming produces a design proposal, **must use the
|
|
138
|
+
After brainstorming produces a design proposal, **must use the current platform's available user input/confirmation mechanism to pause and wait for the user to explicitly confirm the design proposal**. Must not create the final Design Doc, write `design_doc`, run design guard, or enter `/comet-build` before user confirmation. If the current platform has no structured question tool, ask a confirmation question in the conversation, stop the workflow, and wait for the user's reply before continuing.
|
|
109
139
|
|
|
110
140
|
When pausing, only present essential summary:
|
|
111
141
|
- Technical approach adopted
|
|
@@ -115,9 +145,75 @@ When pausing, only present essential summary:
|
|
|
115
145
|
|
|
116
146
|
Only after the user explicitly confirms, proceed to Step 2. If the user requests adjustments, continue brainstorming iteration until the user confirms.
|
|
117
147
|
|
|
118
|
-
###
|
|
148
|
+
### 1d. Brainstorming Checkpoint Finalization
|
|
149
|
+
|
|
150
|
+
After the user confirms the design proposal, before creating the Design Doc, create or update the incrementally maintained checkpoint file and finalize it as the confirmed design summary:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
mkdir -p openspec/changes/<name>/.comet/handoff
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
`openspec/changes/<name>/.comet/handoff/brainstorm-summary.md` structure:
|
|
157
|
+
|
|
158
|
+
```markdown
|
|
159
|
+
# Brainstorm Summary
|
|
160
|
+
|
|
161
|
+
- Change: <change-name>
|
|
162
|
+
- Date: <YYYY-MM-DD>
|
|
163
|
+
|
|
164
|
+
## Confirmed Technical Approach
|
|
165
|
+
|
|
166
|
+
<summary of the user-confirmed approach>
|
|
167
|
+
|
|
168
|
+
## Key Trade-offs and Risks
|
|
169
|
+
|
|
170
|
+
<major trade-offs and risks>
|
|
171
|
+
|
|
172
|
+
## Testing Strategy
|
|
173
|
+
|
|
174
|
+
<testing method overview>
|
|
119
175
|
|
|
120
|
-
|
|
176
|
+
## Spec Patches
|
|
177
|
+
|
|
178
|
+
<delta spec changes to write back, or "None" if none>
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**Context compaction note**: Each incremental update to `brainstorm-summary.md` is a relatively safe recovery point. After brainstorming completes, if the context window is tight, prefer compacting here. After compaction, reload the following files to continue Step 2:
|
|
182
|
+
- `openspec/changes/<name>/.comet/handoff/brainstorm-summary.md`
|
|
183
|
+
- `openspec/changes/<name>/.comet/handoff/design-context.md` (or `spec-context.md` in beta mode)
|
|
184
|
+
- `openspec/changes/<name>/.comet/handoff/design-context.json` (or `spec-context.json` in beta mode)
|
|
185
|
+
|
|
186
|
+
### 1e. Active Context Compaction Gate
|
|
187
|
+
|
|
188
|
+
After Step 1d completes and `brainstorm-summary.md` is written, enter the active compaction gate before creating the Design Doc. At this point the OpenSpec handoff, brainstorming decisions, and pending items are durable, so the agent should proactively release the earlier Spec and brainstorming context to preserve window space for Step 2 and the later Build phase.
|
|
189
|
+
|
|
190
|
+
Rules:
|
|
191
|
+
- If the current platform provides a native context compaction/cleanup mechanism (for example, the host agent's compact/compaction command, tool, or UI action), trigger active compaction here once; do not try to fake compaction through a shell script.
|
|
192
|
+
- The compaction resume prompt must include the change name, current step (Design Step 2), and the three handoff file categories listed above.
|
|
193
|
+
- If the current platform cannot be compacted programmatically by the agent, pause and tell the user to run the host platform's manual compaction action; continue to Step 2 only after the user confirms compaction is unavailable or asks to continue.
|
|
194
|
+
|
|
195
|
+
### 2. Create Design Doc
|
|
196
|
+
|
|
197
|
+
Create the Design Doc based on the full brainstorming conversation context (still in the main session).
|
|
198
|
+
|
|
199
|
+
Design Doc frontmatter must be minimal:
|
|
200
|
+
|
|
201
|
+
```yaml
|
|
202
|
+
---
|
|
203
|
+
comet_change: <change-name>
|
|
204
|
+
role: technical-design
|
|
205
|
+
canonical_spec: openspec
|
|
206
|
+
---
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Write the Design Doc to `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md`.
|
|
210
|
+
If Spec Patches need to be written back, also edit the corresponding `specs/*/spec.md`.
|
|
211
|
+
|
|
212
|
+
**Context compaction recovery**: If context has been compacted, resume from `brainstorm-summary.md` + handoff context. If the user has not confirmed the design proposal yet, return to Step 1b/1c and continue brainstorming; if the user has confirmed it, continue creating the Design Doc. brainstorm-summary.md is the compaction checkpoint, not the sole input for the Design Doc — when creating, leverage the full recovered context as much as possible.
|
|
213
|
+
|
|
214
|
+
### 3. Update Comet State
|
|
215
|
+
|
|
216
|
+
First record the design_doc path. If Spec Patches wrote back delta spec (added or modified `specs/*/spec.md`), must regenerate handoff to update hash:
|
|
121
217
|
|
|
122
218
|
```bash
|
|
123
219
|
# Record design_doc path
|
|
@@ -138,7 +234,8 @@ If there are no delta spec changes, skip the handoff regeneration step. The stat
|
|
|
138
234
|
- Design Doc frontmatter contains `comet_change`, `role: technical-design`, `canonical_spec: openspec`
|
|
139
235
|
- `handoff_context` and `handoff_hash` written to `.comet.yaml` (enforced by guard)
|
|
140
236
|
- `handoff_hash` matches current OpenSpec open phase artifacts (enforced by guard)
|
|
141
|
-
- `design-context.md` must be script-generated and contain source path, mode, sha256 traceability markers (enforced by guard)
|
|
237
|
+
- `design-context.md` or beta `spec-context.md` must be script-generated and contain source path, mode, sha256 traceability markers (enforced by guard)
|
|
238
|
+
- In beta mode, `spec-context.json` must be structurally valid and reference the current source files (enforced by guard)
|
|
142
239
|
- If new capabilities or supplementary acceptance scenarios exist, OpenSpec delta spec has been created/updated
|
|
143
240
|
- `design_doc` written to `.comet.yaml`
|
|
144
241
|
- **Phase guard**: Run `"$COMET_BASH" "$COMET_GUARD" <change-name> design --apply`; after all PASS, auto-transitions to `phase: build`
|
|
@@ -159,8 +256,17 @@ The design phase may trigger context compaction during brainstorming. To recover
|
|
|
159
256
|
|
|
160
257
|
The script outputs structured recovery context (phase, completed fields, pending fields, recovery action). Follow the Recovery action to determine next step.
|
|
161
258
|
|
|
162
|
-
## Automatic
|
|
259
|
+
## Automatic Handoff to Next Phase
|
|
260
|
+
|
|
261
|
+
> **Terminology distinction**: the "phase advancement" above is performed by guard `--apply`, which updates the `.comet.yaml` `phase` field. This step **always happens** and is not controlled by `auto_transition`. This section's "automatic handoff" only controls whether to automatically invoke the next skill.
|
|
163
262
|
|
|
164
|
-
After
|
|
263
|
+
After guard-based phase advancement, run:
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
"$COMET_BASH" "$COMET_STATE" next <change-name>
|
|
267
|
+
```
|
|
165
268
|
|
|
166
|
-
|
|
269
|
+
The script determines the next action from `phase`, `workflow`, and `auto_transition`:
|
|
270
|
+
- `NEXT: auto` -> invoke the `SKILL` target to continue to the next phase
|
|
271
|
+
- `NEXT: manual` -> do not invoke the next skill; follow `HINT` and ask the user to run `/<SKILL>` manually
|
|
272
|
+
- `NEXT: done` -> workflow is complete; no further action needed
|