@rpamis/comet 0.3.6 → 0.3.8

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 (95) hide show
  1. package/README.md +575 -443
  2. package/assets/manifest.json +41 -24
  3. package/assets/skills/comet/SKILL.md +282 -301
  4. package/assets/skills/comet/reference/auto-transition.md +27 -0
  5. package/assets/skills/comet/reference/comet-yaml-fields.md +68 -0
  6. package/assets/skills/comet/reference/context-recovery.md +35 -0
  7. package/assets/skills/comet/reference/debug-gate.md +17 -0
  8. package/assets/skills/comet/reference/decision-point.md +20 -0
  9. package/assets/skills/comet/reference/dirty-worktree.md +1 -0
  10. package/assets/skills/comet/reference/file-structure.md +28 -0
  11. package/assets/skills/comet/reference/subagent-dispatch.md +113 -0
  12. package/assets/skills/comet/rules/comet-phase-guard.en.md +99 -0
  13. package/assets/skills/comet/rules/comet-phase-guard.md +99 -0
  14. package/assets/skills/comet/scripts/comet-archive.sh +71 -55
  15. package/assets/skills/comet/scripts/comet-guard.sh +174 -18
  16. package/assets/skills/comet/scripts/comet-handoff.sh +133 -6
  17. package/assets/skills/comet/scripts/comet-hook-guard.sh +260 -0
  18. package/assets/skills/comet/scripts/comet-state.sh +362 -25
  19. package/assets/skills/comet/scripts/comet-yaml-validate.sh +24 -1
  20. package/assets/skills/comet-archive/SKILL.md +100 -73
  21. package/assets/skills/comet-build/SKILL.md +304 -221
  22. package/assets/skills/comet-design/SKILL.md +263 -166
  23. package/assets/skills/comet-hotfix/SKILL.md +204 -169
  24. package/assets/skills/comet-open/SKILL.md +203 -113
  25. package/assets/skills/comet-tweak/SKILL.md +180 -154
  26. package/assets/skills/comet-verify/SKILL.md +234 -201
  27. package/assets/skills-zh/comet/SKILL.md +269 -301
  28. package/assets/skills-zh/comet/reference/auto-transition.md +27 -0
  29. package/assets/skills-zh/comet/reference/comet-yaml-fields.md +68 -0
  30. package/assets/skills-zh/comet/reference/context-recovery.md +35 -0
  31. package/assets/skills-zh/comet/reference/debug-gate.md +17 -0
  32. package/assets/skills-zh/comet/reference/decision-point.md +20 -0
  33. package/assets/skills-zh/comet/reference/dirty-worktree.md +2 -1
  34. package/assets/skills-zh/comet/reference/file-structure.md +28 -0
  35. package/assets/skills-zh/comet/reference/subagent-dispatch.md +113 -0
  36. package/assets/skills-zh/comet-archive/SKILL.md +100 -73
  37. package/assets/skills-zh/comet-build/SKILL.md +304 -221
  38. package/assets/skills-zh/comet-design/SKILL.md +264 -166
  39. package/assets/skills-zh/comet-hotfix/SKILL.md +200 -169
  40. package/assets/skills-zh/comet-open/SKILL.md +203 -113
  41. package/assets/skills-zh/comet-tweak/SKILL.md +176 -154
  42. package/assets/skills-zh/comet-verify/SKILL.md +232 -201
  43. package/dist/cli/index.js +19 -0
  44. package/dist/cli/index.js.map +1 -1
  45. package/dist/commands/doctor.d.ts.map +1 -1
  46. package/dist/commands/doctor.js +22 -0
  47. package/dist/commands/doctor.js.map +1 -1
  48. package/dist/commands/init.d.ts +5 -1
  49. package/dist/commands/init.d.ts.map +1 -1
  50. package/dist/commands/init.js +64 -9
  51. package/dist/commands/init.js.map +1 -1
  52. package/dist/commands/uninstall.d.ts +9 -0
  53. package/dist/commands/uninstall.d.ts.map +1 -0
  54. package/dist/commands/uninstall.js +113 -0
  55. package/dist/commands/uninstall.js.map +1 -0
  56. package/dist/commands/update.d.ts +1 -1
  57. package/dist/commands/update.d.ts.map +1 -1
  58. package/dist/commands/update.js +120 -32
  59. package/dist/commands/update.js.map +1 -1
  60. package/dist/core/codegraph.d.ts +4 -0
  61. package/dist/core/codegraph.d.ts.map +1 -0
  62. package/dist/core/codegraph.js +63 -0
  63. package/dist/core/codegraph.js.map +1 -0
  64. package/dist/core/detect.d.ts +8 -1
  65. package/dist/core/detect.d.ts.map +1 -1
  66. package/dist/core/detect.js +41 -2
  67. package/dist/core/detect.js.map +1 -1
  68. package/dist/core/openspec.d.ts +1 -1
  69. package/dist/core/openspec.d.ts.map +1 -1
  70. package/dist/core/openspec.js +40 -17
  71. package/dist/core/openspec.js.map +1 -1
  72. package/dist/core/platforms.d.ts +10 -0
  73. package/dist/core/platforms.d.ts.map +1 -1
  74. package/dist/core/platforms.js +177 -16
  75. package/dist/core/platforms.js.map +1 -1
  76. package/dist/core/skills.d.ts +36 -1
  77. package/dist/core/skills.d.ts.map +1 -1
  78. package/dist/core/skills.js +451 -15
  79. package/dist/core/skills.js.map +1 -1
  80. package/dist/core/superpowers.d.ts.map +1 -1
  81. package/dist/core/superpowers.js +1 -0
  82. package/dist/core/superpowers.js.map +1 -1
  83. package/dist/core/uninstall.d.ts +28 -0
  84. package/dist/core/uninstall.d.ts.map +1 -0
  85. package/dist/core/uninstall.js +421 -0
  86. package/dist/core/uninstall.js.map +1 -0
  87. package/dist/core/version.d.ts +31 -0
  88. package/dist/core/version.d.ts.map +1 -0
  89. package/dist/core/version.js +111 -0
  90. package/dist/core/version.js.map +1 -0
  91. package/dist/utils/file-system.d.ts +23 -0
  92. package/dist/utils/file-system.d.ts.map +1 -1
  93. package/dist/utils/file-system.js +100 -5
  94. package/dist/utils/file-system.js.map +1 -1
  95. package/package.json +69 -62
@@ -1,166 +1,263 @@
1
- ---
2
- name: comet-design
3
- description: "Comet Phase 2: Deep Design. Invoke with /comet-design. Produce Design Doc and delta spec through brainstorming."
4
- ---
5
-
6
- # Comet Phase 2: Deep Design (Design)
7
-
8
- ## Prerequisites
9
-
10
- - Active change exists (proposal.md, design.md, tasks.md)
11
- - No Design Doc (no corresponding file under `docs/superpowers/specs/`)
12
-
13
- ## Steps
14
-
15
- ### 0. Entry State Verification (Entry Check)
16
-
17
- Execute entry verification:
18
-
19
- ```bash
20
- COMET_ENV="${COMET_ENV:-$(find . "$HOME"/.*/skills "$HOME/.config" "$HOME/.gemini" -path '*/comet/scripts/comet-env.sh' -type f -print -quit 2>/dev/null)}"
21
- if [ -z "$COMET_ENV" ]; then
22
- echo "ERROR: comet-env.sh not found. Ensure the comet skill is installed." >&2
23
- return 1
24
- fi
25
- . "$COMET_ENV"
26
- "$COMET_BASH" "$COMET_STATE" check <name> design
27
- ```
28
-
29
- Proceed to Step 1 after verification passes. The script outputs specific failure reasons when verification fails.
30
-
31
- **Idempotency**: All design phase operations can be safely re-executed. If `handoff_context` and `handoff_hash` already exist, confirm they match current artifacts before deciding whether to regenerate.
32
-
33
- ### 1a. Generate OpenSpec → Superpowers Handoff Package
34
-
35
- **Must be generated by script. Agent writing summaries on the fly is not allowed.**
36
-
37
- ```bash
38
- "$COMET_BASH" "$COMET_HANDOFF" <change-name> design --write
39
- ```
40
-
41
- The script generates and records:
42
-
43
- ```
44
- openspec/changes/<name>/.comet/handoff/design-context.json
45
- openspec/changes/<name>/.comet/handoff/design-context.md
46
- ```
47
-
48
- And writes to `.comet.yaml`:
49
-
50
- ```yaml
51
- handoff_context: openspec/changes/<name>/.comet/handoff/design-context.json
52
- handoff_hash: <sha256>
53
- ```
54
-
55
- The default handoff package is a **compact traceable excerpt**, not an agent summary:
56
- - `design-context.json`: machine index containing change, phase, canonical spec, source paths, hash
57
- - `design-context.md`: context for Superpowers to read, containing script markers, source path, line range, sha256, deterministic excerpts
58
- - When exceeding excerpt budget, marks `[TRUNCATED]` and retains Full source path
59
-
60
- If full context is genuinely needed, explicitly run:
61
-
62
- ```bash
63
- "$COMET_BASH" "$COMET_HANDOFF" <change-name> design --write --full
64
- ```
65
-
66
- Handoff package sources come from OpenSpec open phase artifacts:
67
- - `proposal.md`: goals, motivation, scope, non-goals
68
- - `design.md`: high-level architecture decisions, approach constraints
69
- - `tasks.md`: initial task boundaries
70
- - `specs/*/spec.md`: delta capability specs
71
-
72
- ### 1b. Execute Brainstorming (with Context)
73
-
74
- **Immediately execute:** Use the Skill tool to load the Superpowers `brainstorming` skill, ARGUMENTS containing:
75
-
76
- ```
77
- Change: <change-name>
78
- OpenSpec Context Pack: openspec/changes/<name>/.comet/handoff/design-context.md
79
- Machine handoff: openspec/changes/<name>/.comet/handoff/design-context.json
80
-
81
- OpenSpec artifacts are the upstream source of truth. Do not redefine requirements, do not rewrite proposal/spec.
82
- Your task is to perform deep technical design based on the handoff package: implementation approach, technical risks, testing strategy, boundary conditions.
83
- 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.
84
-
85
- Design Doc frontmatter must be minimal, containing only:
86
- ---
87
- comet_change: <change-name>
88
- role: technical-design
89
- canonical_spec: openspec
90
- ---
91
-
92
- Skip redundant context exploration, proceed directly to design questions.
93
- ```
94
-
95
- Skipping this step is prohibited. Proceeding without loading this skill is prohibited.
96
-
97
- 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
-
99
- After the skill loads, follow its guidance to produce design proposals (presented as conversation):
100
- - Technical approach: architecture, data flow, key technology choices and risks
101
- - Testing strategy
102
- - If acceptance scenarios need supplementing, indicate delta spec changes to be written back
103
-
104
- 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
-
106
- ### 1c. User Confirms Design Proposal (Blocking Point)
107
-
108
- After brainstorming produces a design proposal, **must use the AskUserQuestion tool 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. Must not just output a text prompt and then continue executing.
109
-
110
- When pausing, only present essential summary:
111
- - Technical approach adopted
112
- - Key trade-offs and risks
113
- - Testing strategy
114
- - If there are Spec Patches, list the delta spec changes to be written back
115
-
116
- Only after the user explicitly confirms, proceed to Step 2. If the user requests adjustments, continue brainstorming iteration until the user confirms.
117
-
118
- ### 2. Update Comet State
119
-
120
- First record the design_doc path. If Step 1c wrote back delta spec (added or modified `specs/*/spec.md`), must regenerate handoff to update hash:
121
-
122
- ```bash
123
- # Record design_doc path
124
- "$COMET_BASH" "$COMET_STATE" set <name> design_doc docs/superpowers/specs/YYYY-MM-DD-topic-design.md
125
-
126
- # If delta spec changes exist, regenerate handoff (update hash)
127
- "$COMET_BASH" "$COMET_HANDOFF" <change-name> design --write
128
-
129
- # Auto-transition to next phase
130
- "$COMET_BASH" "$COMET_GUARD" <change-name> design --apply
131
- ```
132
-
133
- If there are no delta spec changes, skip the handoff regeneration step. The state file updates automatically; no manual editing of other fields needed.
134
-
135
- ## Exit Conditions
136
-
137
- - Design Doc created and saved
138
- - Design Doc frontmatter contains `comet_change`, `role: technical-design`, `canonical_spec: openspec`
139
- - `handoff_context` and `handoff_hash` written to `.comet.yaml` (enforced by guard)
140
- - `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)
142
- - If new capabilities or supplementary acceptance scenarios exist, OpenSpec delta spec has been created/updated
143
- - `design_doc` written to `.comet.yaml`
144
- - **Phase guard**: Run `"$COMET_BASH" "$COMET_GUARD" <change-name> design --apply`; after all PASS, auto-transitions to `phase: build`
145
-
146
- Must use `--apply` before exit:
147
-
148
- ```bash
149
- "$COMET_BASH" "$COMET_GUARD" <change-name> design --apply
150
- ```
151
-
152
- ## Context Compaction Recovery
153
-
154
- The design phase may trigger context compaction during brainstorming. To recover, first run:
155
-
156
- ```bash
157
- "$COMET_BASH" "$COMET_STATE" check <change-name> design --recover
158
- ```
159
-
160
- The script outputs structured recovery context (phase, completed fields, pending fields, recovery action). Follow the Recovery action to determine next step.
161
-
162
- ## Automatic Transition
163
-
164
- After exit conditions are met (including user confirming the design proposal), auto-transition to next phase:
165
-
166
- > **REQUIRED NEXT SKILL:** Invoke `comet-build` skill to enter the plan and build phase.
1
+ ---
2
+ name: comet-design
3
+ description: "Comet Phase 2: Deep Design. Invoke with /comet-design. Produce Design Doc and delta spec through brainstorming."
4
+ ---
5
+
6
+ # Comet Phase 2: Deep Design (Design)
7
+
8
+ ## Prerequisites
9
+
10
+ - Active change exists (proposal.md, design.md, tasks.md)
11
+ - No Design Doc (no corresponding file under `docs/superpowers/specs/`)
12
+
13
+ ## Steps
14
+
15
+ ### 0. Entry State Verification (Entry Check)
16
+
17
+ Execute entry verification:
18
+
19
+ ```bash
20
+ COMET_ENV="${COMET_ENV:-$(find . "$HOME"/.*/skills "$HOME/.config" "$HOME/.gemini" -path '*/comet/scripts/comet-env.sh' -type f -print -quit 2>/dev/null)}"
21
+ if [ -z "$COMET_ENV" ]; then
22
+ echo "ERROR: comet-env.sh not found. Ensure the comet skill is installed." >&2
23
+ return 1
24
+ fi
25
+ . "$COMET_ENV"
26
+ "$COMET_BASH" "$COMET_STATE" check <name> design
27
+ ```
28
+
29
+ Proceed to Step 1 after verification passes. The script outputs specific failure reasons when verification fails.
30
+
31
+ **Idempotency**: All design phase operations can be safely re-executed. If `handoff_context` and `handoff_hash` already exist, confirm they match current artifacts before deciding whether to regenerate.
32
+
33
+ ### 1a. Generate OpenSpec → Superpowers Handoff Package
34
+
35
+ **Must be generated by script. Agent writing summaries on the fly is not allowed.**
36
+
37
+ ```bash
38
+ "$COMET_BASH" "$COMET_HANDOFF" <change-name> design --write
39
+ ```
40
+
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:
44
+
45
+ ```
46
+ openspec/changes/<name>/.comet/handoff/design-context.json
47
+ openspec/changes/<name>/.comet/handoff/design-context.md
48
+ ```
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
+
57
+ And writes to `.comet.yaml`:
58
+
59
+ ```yaml
60
+ handoff_context: openspec/changes/<name>/.comet/handoff/design-context.json
61
+ handoff_hash: <sha256>
62
+ ```
63
+
64
+ The default handoff package is a **compact traceable excerpt**, not an agent summary:
65
+ - `design-context.json`: machine index containing change, phase, canonical spec, source paths, hash
66
+ - `design-context.md`: context for Superpowers to read, containing script markers, source path, line range, sha256, deterministic excerpts
67
+ - When exceeding excerpt budget, marks `[TRUNCATED]` and retains Full source path
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
+
74
+ If full context is genuinely needed, explicitly run:
75
+
76
+ ```bash
77
+ "$COMET_BASH" "$COMET_HANDOFF" <change-name> design --write --full
78
+ ```
79
+
80
+ Handoff package sources come from OpenSpec open phase artifacts:
81
+ - `proposal.md`: goals, motivation, scope, non-goals
82
+ - `design.md`: high-level architecture decisions, approach constraints
83
+ - `tasks.md`: initial task boundaries
84
+ - `specs/*/spec.md`: delta capability specs
85
+
86
+ ### 1b. Execute Brainstorming (with Context)
87
+
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:
97
+
98
+ ```
99
+ Change: <change-name>
100
+ OpenSpec Context Pack: openspec/changes/<name>/.comet/handoff/design-context.md
101
+ Machine handoff: openspec/changes/<name>/.comet/handoff/design-context.json
102
+
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".
108
+ Your task is to perform deep technical design based on the handoff package: implementation approach, technical risks, testing strategy, boundary conditions.
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.
111
+
112
+ Design Doc frontmatter must be minimal, containing only:
113
+ ---
114
+ comet_change: <change-name>
115
+ role: technical-design
116
+ canonical_spec: openspec
117
+ ---
118
+
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.
120
+ ```
121
+
122
+ Proceeding without loading this skill is prohibited.
123
+
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.
125
+
126
+ After the skill loads, follow its guidance to produce design proposals (presented as conversation):
127
+ - Technical approach: architecture, data flow, key technology choices and risks
128
+ - Testing strategy
129
+ - Requirement/scope gaps and Spec Patches to be written back
130
+ - If acceptance scenarios need supplementing, indicate delta spec changes to be written back
131
+
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.
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
+
136
+ ### 1c. User Confirms Design Proposal (Blocking Point)
137
+
138
+ After brainstorming produces a design proposal, **must follow the `comet/reference/decision-point.md` protocol 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.
139
+
140
+ When pausing, only present essential summary:
141
+ - Technical approach adopted
142
+ - Key trade-offs and risks
143
+ - Testing strategy
144
+ - If there are Spec Patches, list the delta spec changes to be written back
145
+
146
+ Only after the user explicitly confirms, proceed to Step 2. If the user requests adjustments, continue brainstorming iteration until the user confirms.
147
+
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>
175
+
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:
217
+
218
+ ```bash
219
+ # Record design_doc path
220
+ "$COMET_BASH" "$COMET_STATE" set <name> design_doc docs/superpowers/specs/YYYY-MM-DD-topic-design.md
221
+
222
+ # If delta spec changes exist, regenerate handoff (update hash)
223
+ "$COMET_BASH" "$COMET_HANDOFF" <change-name> design --write
224
+
225
+ # Auto-transition to next phase
226
+ "$COMET_BASH" "$COMET_GUARD" <change-name> design --apply
227
+ ```
228
+
229
+ If there are no delta spec changes, skip the handoff regeneration step. The state file updates automatically; no manual editing of other fields needed.
230
+
231
+ ## Exit Conditions
232
+
233
+ - Design Doc created and saved
234
+ - Design Doc frontmatter contains `comet_change`, `role: technical-design`, `canonical_spec: openspec`
235
+ - `handoff_context` and `handoff_hash` written to `.comet.yaml` (enforced by guard)
236
+ - `handoff_hash` matches current OpenSpec open phase artifacts (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)
239
+ - If new capabilities or supplementary acceptance scenarios exist, OpenSpec delta spec has been created/updated
240
+ - `design_doc` written to `.comet.yaml`
241
+ - **Phase guard**: Run `"$COMET_BASH" "$COMET_GUARD" <change-name> design --apply`; after all PASS, auto-transitions to `phase: build`
242
+
243
+ Must use `--apply` before exit:
244
+
245
+ ```bash
246
+ "$COMET_BASH" "$COMET_GUARD" <change-name> design --apply
247
+ ```
248
+
249
+ ## Context Compression Recovery
250
+
251
+ Follow `comet/reference/context-recovery.md` with phase set to `design`.
252
+
253
+ ## Automatic Handoff to Next Phase
254
+
255
+ Follow `comet/reference/auto-transition.md`. Key command:
256
+
257
+ ```bash
258
+ "$COMET_BASH" "$COMET_STATE" next <change-name>
259
+ ```
260
+
261
+ - `NEXT: auto` → invoke the skill pointed to by `SKILL` to enter the next phase
262
+ - `NEXT: manual` → do not invoke the next skill; prompt user to run `/<SKILL>` manually
263
+ - `NEXT: done` → workflow is complete, no further action needed