@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.
Files changed (53) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +175 -63
  3. package/assets/manifest.json +11 -1
  4. package/assets/skills/comet/SKILL.md +44 -16
  5. package/assets/skills/comet/reference/dirty-worktree.md +1 -0
  6. package/assets/skills/comet/rules/comet-phase-guard.md +90 -0
  7. package/assets/skills/comet/scripts/comet-archive.sh +71 -55
  8. package/assets/skills/comet/scripts/comet-guard.sh +174 -18
  9. package/assets/skills/comet/scripts/comet-handoff.sh +133 -6
  10. package/assets/skills/comet/scripts/comet-hook-guard.sh +260 -0
  11. package/assets/skills/comet/scripts/comet-state.sh +300 -25
  12. package/assets/skills/comet/scripts/comet-yaml-validate.sh +24 -1
  13. package/assets/skills/comet-archive/SKILL.md +43 -10
  14. package/assets/skills/comet-build/SKILL.md +117 -22
  15. package/assets/skills/comet-design/SKILL.md +119 -13
  16. package/assets/skills/comet-hotfix/SKILL.md +51 -9
  17. package/assets/skills/comet-open/SKILL.md +86 -13
  18. package/assets/skills/comet-tweak/SKILL.md +33 -8
  19. package/assets/skills/comet-verify/SKILL.md +48 -9
  20. package/assets/skills-zh/comet/SKILL.md +47 -16
  21. package/assets/skills-zh/comet/reference/dirty-worktree.md +2 -1
  22. package/assets/skills-zh/comet-archive/SKILL.md +44 -11
  23. package/assets/skills-zh/comet-build/SKILL.md +120 -25
  24. package/assets/skills-zh/comet-design/SKILL.md +123 -16
  25. package/assets/skills-zh/comet-hotfix/SKILL.md +47 -9
  26. package/assets/skills-zh/comet-open/SKILL.md +87 -14
  27. package/assets/skills-zh/comet-tweak/SKILL.md +29 -8
  28. package/assets/skills-zh/comet-verify/SKILL.md +49 -12
  29. package/bin/comet.js +3 -3
  30. package/dist/commands/doctor.d.ts.map +1 -1
  31. package/dist/commands/doctor.js +22 -0
  32. package/dist/commands/doctor.js.map +1 -1
  33. package/dist/commands/init.d.ts +5 -1
  34. package/dist/commands/init.d.ts.map +1 -1
  35. package/dist/commands/init.js +64 -9
  36. package/dist/commands/init.js.map +1 -1
  37. package/dist/commands/update.d.ts.map +1 -1
  38. package/dist/commands/update.js +60 -1
  39. package/dist/commands/update.js.map +1 -1
  40. package/dist/core/codegraph.d.ts +9 -0
  41. package/dist/core/codegraph.d.ts.map +1 -0
  42. package/dist/core/codegraph.js +96 -0
  43. package/dist/core/codegraph.js.map +1 -0
  44. package/dist/core/platforms.d.ts +10 -0
  45. package/dist/core/platforms.d.ts.map +1 -1
  46. package/dist/core/platforms.js +163 -15
  47. package/dist/core/platforms.js.map +1 -1
  48. package/dist/core/skills.d.ts +34 -1
  49. package/dist/core/skills.d.ts.map +1 -1
  50. package/dist/core/skills.js +360 -1
  51. package/dist/core/skills.js.map +1 -1
  52. package/package.json +3 -1
  53. package/scripts/postinstall.js +44 -44
@@ -16,9 +16,13 @@ Quick bug fix workflow: open → build → verify → archive. Skip brainstormin
16
16
 
17
17
  ---
18
18
 
19
- ## Process (preset workflow, 5 steps)
19
+ ## Process (preset workflow, 6 steps)
20
20
 
21
- Execution chain: open → build → root cause check → verify → archive. Hotfix provides default decisions for each phase: streamlined open, direct build, root cause confirmation, scale-based verification, archive after verification passes.
21
+ ### 0. Output Language Constraint
22
+
23
+ Streamlined OpenSpec artifacts must use the language of the user request that triggered this workflow.
24
+
25
+ Execution chain: open → build → root cause check → verify → archive. Hotfix provides default decisions for each phase: streamlined open, direct build, root cause confirmation, scale-based verification, and final archive confirmation after verification passes.
22
26
 
23
27
  Locate Comet scripts before starting:
24
28
 
@@ -61,9 +65,18 @@ Run phase guard to transition open → build:
61
65
  "$COMET_BASH" "$COMET_GUARD" <change-name> open --apply
62
66
  ```
63
67
 
68
+ Check `auto_transition` to decide whether to continue:
69
+
70
+ ```bash
71
+ "$COMET_BASH" "$COMET_STATE" next <name>
72
+ ```
73
+
74
+ - `NEXT: auto` → continue to Step 2
75
+ - `NEXT: manual` → pause, follow `HINT` to prompt user to run `/<SKILL>` manually
76
+
64
77
  ### 2. Direct Build (preset build)
65
78
 
66
- Use hotfix defaults: `build_mode: direct`. Skip Superpowers `brainstorming` and `writing-plans` (unless tasks > 3; if exceeds 3 tasks, transfer to `/comet-build`'s plan and execution method selection).
79
+ Use hotfix defaults: `build_mode: direct`. Skip Superpowers `brainstorming` and `writing-plans` (unless tasks > 3; if exceeds 3 tasks, transfer to `/comet-build`'s plan and execution method selection — note this does NOT trigger full workflow upgrade, only switches execution method).
67
80
 
68
81
  Before continuing or starting changes, handle uncommitted changes through `comet/reference/dirty-worktree.md`. If attribution shows the fix scope exceeds hotfix, handle it through this file's "Upgrade Conditions".
69
82
 
@@ -82,6 +95,14 @@ Before continuing or starting changes, handle uncommitted changes through `comet
82
95
  - Create delta spec in `openspec/changes/<name>/specs/<capability>/spec.md`
83
96
  - Only include `## MODIFIED Requirements` section
84
97
 
98
+ During hotfix 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.
99
+
100
+ Handle it using the four-phase `systematic-debugging` flow:
101
+ - First reproduce and locate the root cause, read full errors, check recent changes, and trace data flow
102
+ - 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
103
+ - After the fix, run that failing test, related tests, and project build/verification commands to confirm all pass
104
+ - 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
105
+
85
106
  ### 3. Root Cause Elimination Check
86
107
 
87
108
  **Execute before running build guard**, ensuring the fix actually eliminates the root cause:
@@ -110,11 +131,11 @@ Reuse `/comet-verify`, with comet-verify's scale assessment deciding lightweight
110
131
 
111
132
  Small-scale hotfixes without delta spec usually meet lightweight verification conditions (≤ 3 tasks, ≤ 2 files), comet-verify's scale assessment will select lightweight verification path (5 quick checks). If hotfix created delta spec, enter full verification path according to comet-verify's scale assessment rules.
112
133
 
113
- After verification passes, record `.comet.yaml` `verify_result` as `pass` according to `/comet-verify` rules, must not skip this status before archiving.
134
+ After verification passes, record `.comet.yaml` `verify_result` as `pass` according to `/comet-verify` rules, must not skip this status before archiving. After verification passes, still enter `/comet-archive`'s final archive confirmation; do not automatically run the archive script.
114
135
 
115
136
  ### 5. Archive (preset archive)
116
137
 
117
- Reuse `/comet-archive`. Must satisfy `verify_result: pass` in `.comet.yaml` before archiving.
138
+ Reuse `/comet-archive`. Must satisfy `verify_result: pass` in `.comet.yaml` before archiving, and wait for `/comet-archive`'s final archive confirmation.
118
139
 
119
140
  **Immediately execute:** Use the Skill tool to load the `comet-archive` skill to archive. Skipping this step is prohibited.
120
141
  If there is delta spec, sync to main spec according to comet-archive rules, and handle associated Design Doc and Plan archiving annotations.
@@ -124,11 +145,16 @@ If there is delta spec, sync to main spec according to comet-archive rules, and
124
145
  ## Continuous Execution Mode
125
146
 
126
147
  <IMPORTANT>
127
- Hotfix workflow is **one-time continuous execution**. After invoking `/comet-hotfix`, agent must automatically advance through hotfix steps, without pausing to wait for user input mid-way. But the following situations must pause and wait for user confirmation:
148
+ Hotfix workflow is **one-time continuous execution**. After invoking `/comet-hotfix`, agent must automatically advance through hotfix steps, without pausing to wait for user input mid-way.
128
149
 
129
- 1. Encountering upgrade conditions (see "Upgrade Conditions" section). **Must use the AskUserQuestion tool to pause and wait for the user to explicitly confirm** upgrading to full workflow
150
+ Exception: when `.comet.yaml` has `auto_transition: false`, after each phase guard advances `phase`, do not auto-invoke the next skill. In this case, use `"$COMET_BASH" "$COMET_STATE" next <name>` output and pause for manual continuation as instructed.
151
+
152
+ The following situations must also pause and wait for user confirmation:
153
+
154
+ 1. Encountering upgrade conditions (see "Upgrade Conditions" section). **Must use the current platform's available user input/confirmation mechanism to pause and wait for the user to explicitly confirm** upgrading to full workflow
130
155
  2. workspace isolation and execution-method selection when tasks exceed 3 and transfer to `/comet-build`
131
156
  3. verify phase (comet-verify) verification-failure and branch-handling decisions
157
+ 4. Final archive confirmation (before comet-archive runs the archive script)
132
158
 
133
159
  Execution order: quick open → direct build → root cause check → verification → archive → complete
134
160
 
@@ -149,12 +175,13 @@ Upgrade to full `/comet` when **any** of the following conditions are met:
149
175
  | Introduces new public API | Fix creates new external interface |
150
176
  | Fix scope exceeds single function/module | Requires coordinated changes |
151
177
 
152
- When upgrade conditions are met, **must use the AskUserQuestion tool to pause and wait for the user to explicitly confirm** upgrading to the full `/comet` workflow. Do not directly enter `/comet-design`, and do not automatically supplement Design Doc. Must not just output a text prompt and then continue executing.
178
+ When upgrade conditions are met, **must use the current platform's available user input/confirmation mechanism to pause and wait for the user to explicitly confirm** upgrading to the full `/comet` workflow. Do not directly enter `/comet-design`, and do not automatically supplement Design Doc. If the current platform has no structured question tool, ask an upgrade confirmation question in the conversation, stop the workflow, and wait for the user's reply before continuing.
153
179
 
154
- After user confirms upgrade, **must first update the workflow field** before entering full flow:
180
+ After user confirms upgrade, **must first update the workflow and phase fields** before entering full flow:
155
181
 
156
182
  ```bash
157
183
  "$COMET_BASH" "$COMET_STATE" set <name> workflow full
184
+ "$COMET_BASH" "$COMET_STATE" set <name> phase design
158
185
  ```
159
186
 
160
187
  Then on current change basis, supplement Design Doc: **Immediately use the Skill tool to load the `comet-design` skill**, proceed normally with full workflow. If user does not confirm upgrade, stop hotfix and report that current change has exceeded hotfix scope.
@@ -167,3 +194,18 @@ Then on current change basis, supplement Design Doc: **Immediately use the Skill
167
194
  - Change archived
168
195
  - If spec changes, synced to main spec
169
196
  - **Phase guard**: Before build → verify run `"$COMET_BASH" "$COMET_GUARD" <change-name> build --apply`; before verify → archive follow `/comet-verify` and run `"$COMET_BASH" "$COMET_GUARD" <change-name> verify --apply`
197
+
198
+ ## Automatic Handoff to Next Phase
199
+
200
+ > **Terminology distinction**: phase guard `--apply` advances 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.
201
+
202
+ After each phase guard or state transition advances phase, run:
203
+
204
+ ```bash
205
+ "$COMET_BASH" "$COMET_STATE" next <name>
206
+ ```
207
+
208
+ The script determines the next action from `phase`, `workflow`, and `auto_transition`:
209
+ - `NEXT: auto` -> invoke the `SKILL` target to continue the hotfix flow (`phase: build` returns `comet-hotfix`, `verify` returns `comet-verify`, `archive` returns `comet-archive`)
210
+ - `NEXT: manual` -> do not invoke the next skill; follow `HINT` and ask the user to run `/<SKILL>` manually
211
+ - `NEXT: done` -> workflow is complete; no further action needed
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: comet-open
3
- description: "Comet Phase 1: Open. Invoke with /comet-open. Explore ideas through OpenSpec, create change structure (proposal + design + tasks)."
3
+ description: "Comet Phase 1: Open. Invoke with /comet-open. Explore ideas through OpenSpec, confirm requirements clarification, then create change structure (proposal + design + tasks)."
4
4
  ---
5
5
 
6
6
  # Comet Phase 1: Open
@@ -11,17 +11,81 @@ description: "Comet Phase 1: Open. Invoke with /comet-open. Explore ideas throug
11
11
 
12
12
  ## Steps
13
13
 
14
- ### 1. Explore Ideas
14
+ ### 0. Output Language Constraint
15
+
16
+ Every prompt and artifact request passed to OpenSpec must include the output-language constraint: use the language of the user request that triggered this workflow. When resuming an existing change with a clear dominant artifact language, preserve that language unless the user explicitly asks to switch.
17
+
18
+ ### 1. Explore Ideas and Clarify Requirements
15
19
 
16
20
  **Immediately execute:** Use the Skill tool to load the `openspec-explore` skill. Skipping this step is prohibited.
17
21
 
18
- After the skill loads, freely explore the problem space following its guidance.
22
+ After the skill loads, explore the problem space following its guidance, but do not treat one Q&A turn as sufficient clarification. You must continue asking, align with the user, and form a clarification summary covering:
23
+ - Goals: the problem the user truly wants to solve and the expected outcome
24
+ - Non-goals: what is explicitly out of scope for this change
25
+ - Scope boundaries: included/excluded modules, users, platforms, or data
26
+ - Key unknowns: unresolved assumptions, risks, or dependencies
27
+ - Draft acceptance scenarios: at least the core success scenario and important boundary scenarios
28
+
29
+ The clarification summary must include: goals, non-goals, scope boundaries, key unknowns, and draft acceptance scenarios.
30
+
31
+ ### 1a. PRD Split Preflight (Blocking Point)
32
+
33
+ When the user input is a large PRD, roadmap, complete product plan, or the clarification summary shows multiple independent capabilities, modules, user journeys, or milestones, must evaluate whether it should be split into multiple changes before creating OpenSpec artifacts.
34
+
35
+ The split preflight must be based on clarified information and output a proposed split list. Each proposed split item must include:
36
+ - Suggested change name
37
+ - Goals and scope boundaries
38
+ - Explicit non-goals
39
+ - Dependencies or recommended execution order
40
+ - Core acceptance scenarios
41
+
42
+ Recommend splitting when any condition applies:
43
+ - The PRD contains multiple capabilities that can be independently designed, built, verified, and archived
44
+ - Multiple modules or user journeys are involved, and part of them can be delivered independently
45
+ - Clear phased milestones exist
46
+ - The work is expected to produce multiple delta specs or more than 3 large tasks
47
+ - Failure or delay in one part should not block other parts from entering later phases
48
+
49
+ When splitting is recommended, must use the current platform's available user input/confirmation mechanism to pause and wait for the user's choice. 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.
50
+
51
+ The user choices must include:
52
+ - "Create multiple OpenSpec changes" — create independent changes from the proposed split
53
+ - "Keep everything as one change" — continue the single-change flow and record the reason for not splitting in proposal/design/tasks
54
+ - "Adjust the split plan before continuing" — after the user describes the adjustment, output the revised proposed split list and ask for confirmation again
55
+
56
+ Every accepted split item must be created as an independent change through `/comet-open`, not by calling `/opsx:new` directly. `/comet-open` creates both OpenSpec artifacts and `.comet.yaml`, ensuring each change enters the Comet state machine.
57
+
58
+ Must not create proposal.md, design.md, or tasks.md before the user completes the PRD split choice. If the user chooses to create multiple changes, the current `/comet-open` invocation only completes split confirmation and coordination, then enters `/comet-open` for each split item in the user-confirmed order.
59
+
60
+ In batch split mode, entering `/comet-open` for each split item must explicitly mark it as a "confirmed split item" and carry that split item's goals, scope, non-goals, and acceptance scenarios. Confirmed split items skip the PRD split preflight by default, unless the split item itself still clearly contains multiple independent capabilities.
61
+
62
+ In batch split mode, a single split item must not auto-advance to `/comet-design` after completing the open phase. After splitting is complete, must pause and ask the user which change to start; after the user chooses, advance only that change into `/comet-design`, while other changes remain active and can be resumed later through `/comet`.
63
+
64
+ Minimal resume rule: do not add a dedicated batch state file. On resume, first check already-created active changes; split items that already exist and contain `.comet.yaml` must not be created again, while uncreated split items continue through `/comet-open` according to the user-confirmed split list. If the confirmed split list cannot be recovered from the conversation, must ask the user to confirm the split list again before continuing.
65
+
66
+ ### 1b. Requirements Clarification Completion Confirmation (Blocking Point)
67
+
68
+ Before creating OpenSpec artifacts, must use the current platform's available user input/confirmation mechanism to pause and wait for the user to confirm requirements clarification is complete. If the current platform has no structured question tool, present the clarification summary in the conversation, ask a confirmation question, stop the workflow, and wait for the user's reply before continuing.
69
+
70
+ When pausing, present the clarification summary: goals, non-goals, scope boundaries, key unknowns, and draft acceptance scenarios.
71
+
72
+ Must not create proposal.md, design.md, or tasks.md before the user confirms requirements clarification is complete, and must not use the Skill tool to load the `openspec-propose` skill to generate all artifacts in one pass.
19
73
 
20
74
  ### 2. Create Change Structure + Initialize State
21
75
 
22
- **Immediately execute:** Use the Skill tool to load the `openspec-new-change` skill. If the user's intent is unclear and needs proposal formation first, load `openspec-propose` instead. Skipping this step is prohibited.
76
+ **Immediately execute:** Use the Skill tool to load the `openspec-new-change` skill. Skipping this step is prohibited.
77
+
78
+ Full `/comet` workflow must not use the Skill tool to load the `openspec-propose` skill by default; only load it when the user explicitly requests generating the proposal and artifacts in one pass.
79
+
80
+ After the skill loads, follow its guidance to create the change skeleton, but override its "STOP and wait for user direction" behavior when a confirmed clarification summary from Step 1b is already available in the conversation context. Specifically:
81
+
82
+ 1. Run `openspec new change`, `openspec status`, and `openspec instructions` as the skill directs
83
+ 2. If the user has already confirmed a clarification summary (Step 1b), use that summary directly to draft proposal.md — do NOT ask the user to describe the change again
84
+ 3. If no clarification summary exists (edge case), fall back to the skill's default behavior of asking the user
23
85
 
24
- **Naming and scope guard**: Change name must use a user-specified or AskUserQuestion-confirmed name — must not auto-generate or infer. Change scope must match the user's description — must not expand or narrow it independently.
86
+ Then fill in design.md and tasks.md one by one; every document must be based on the confirmed clarification summary.
87
+
88
+ **Naming and scope guard**: Change name must use a user-specified name or a name confirmed through the current platform's available user input/confirmation mechanism — must not auto-generate or infer. Change scope must match the user's description — must not expand or narrow it independently.
25
89
 
26
90
  Confirm the following artifacts have been created:
27
91
 
@@ -75,9 +139,9 @@ Confirm the three documents have complete content:
75
139
 
76
140
  ### 5. User Review and Confirmation (Blocking Point)
77
141
 
78
- After the three documents are created and content completeness check passes, **must use the AskUserQuestion tool to pause and wait for user confirmation**. Must not execute phase guard or auto-transition before user confirmation.
142
+ After the three documents are created and content completeness check passes, **must use the current platform's available user input/confirmation mechanism to pause and wait for user confirmation**. Must not execute phase guard or auto-transition 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.
79
143
 
80
- AskUserQuestion must be presented as a single-select question with the following summary and options:
144
+ The user confirmation question must be presented as a single-select question with the following summary and options:
81
145
 
82
146
  **Summary content**:
83
147
  - **proposal.md**: problem background, goals, scope
@@ -88,7 +152,7 @@ AskUserQuestion must be presented as a single-select question with the following
88
152
  - "Confirm, proceed to next phase" — artifacts meet expectations, execute phase guard transition
89
153
  - "Needs adjustment" — include adjustment notes, modify and re-request confirmation
90
154
 
91
- After user selects "Confirm", proceed to exit conditions. When user selects "Needs adjustment", modify the corresponding files per their notes, then re-use AskUserQuestion to request confirmation.
155
+ After user selects "Confirm", proceed to exit conditions. When user selects "Needs adjustment", modify the corresponding files per their notes, then request confirmation again.
92
156
 
93
157
  ## Exit Conditions
94
158
 
@@ -104,10 +168,19 @@ Must use `--apply` before exit, otherwise `.comet.yaml` remains at `phase: open`
104
168
 
105
169
  Full workflow auto-transitions to `phase: design`; hotfix/tweak presets auto-transition to `phase: build`.
106
170
 
107
- ## Automatic Transition
171
+ ## Automatic Handoff to Next Phase
172
+
173
+ > **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.
174
+
175
+ After user confirmation and guard-based phase advancement, run:
176
+
177
+ ```bash
178
+ "$COMET_BASH" "$COMET_STATE" next <change-name>
179
+ ```
108
180
 
109
- After user confirmation and exit conditions are met, auto-transition to next phase:
181
+ The script determines the next action from `phase`, `workflow`, and `auto_transition`:
182
+ - `NEXT: auto` -> invoke the `SKILL` target to continue to the next phase
183
+ - `NEXT: manual` -> do not invoke the next skill; follow `HINT` and ask the user to run `/<SKILL>` manually
184
+ - `NEXT: done` -> workflow is complete; no further action needed
110
185
 
111
- > **REQUIRED NEXT SKILL (full workflow):** Invoke `comet-design` skill to enter the deep design phase.
112
- >
113
- > Hotfix/tweak presets are controlled by their corresponding preset skill for subsequent transitions (phase goes directly to build), and do not go through this section.
186
+ Hotfix/tweak presets are controlled by their preset skills (phase goes directly to build), and their `next` output points to the preset path.
@@ -13,7 +13,7 @@ Applicable for non-bug small scope changes, such as copy adjustment, configurati
13
13
  1. No new capability
14
14
  2. No architecture changes
15
15
  3. No interface changes
16
- 4. Typically no more than 3 tasks, 4 files
16
+ 4. Typically no more than 3 tasks (file count constraint see upgrade conditions below)
17
17
 
18
18
  **Not applicable**: If change process discovers need for capability, architecture or interface adjustments, should upgrade to full `/comet` workflow.
19
19
 
@@ -21,7 +21,11 @@ Applicable for non-bug small scope changes, such as copy adjustment, configurati
21
21
 
22
22
  ## Process (preset workflow, 4 phases)
23
23
 
24
- Execution chain: open → lightweight build → light verify → archive. Tweak provides default decisions for each phase: streamlined open, lightweight build, lightweight verification, archive after verification passes.
24
+ ### 0. Output Language Constraint
25
+
26
+ Streamlined OpenSpec artifacts must use the language of the user request that triggered this workflow.
27
+
28
+ Execution chain: open → lightweight build → light verify → archive. Tweak provides default decisions for each phase: streamlined open, lightweight build, lightweight verification, and final archive confirmation after verification passes.
25
29
 
26
30
  Locate Comet scripts before starting:
27
31
 
@@ -96,11 +100,11 @@ Reuse `/comet-verify`. Tweak must maintain lightweight verification conditions:
96
100
 
97
101
  If scale assessment enters full verification path, stop tweak, handle per upgrade conditions blocking confirmation.
98
102
 
99
- After verification passes, record `.comet.yaml` `verify_result` as `pass` according to `/comet-verify` rules, must not skip this status before archiving.
103
+ After verification passes, record `.comet.yaml` `verify_result` as `pass` according to `/comet-verify` rules, must not skip this status before archiving. After verification passes, still enter `/comet-archive`'s final archive confirmation; do not automatically run the archive script.
100
104
 
101
105
  ### 4. Archive (preset archive)
102
106
 
103
- Reuse `/comet-archive`. Must satisfy `verify_result: pass` in `.comet.yaml` before archiving.
107
+ Reuse `/comet-archive`. Must satisfy `verify_result: pass` in `.comet.yaml` before archiving, and wait for `/comet-archive`'s final archive confirmation.
104
108
 
105
109
  **Immediately execute:** Use the Skill tool to load the `comet-archive` skill to archive. Skipping this step is prohibited.
106
110
 
@@ -109,10 +113,15 @@ Reuse `/comet-archive`. Must satisfy `verify_result: pass` in `.comet.yaml` befo
109
113
  ## Continuous Execution Mode
110
114
 
111
115
  <IMPORTANT>
112
- Tweak workflow is **one-time continuous execution**. After invoking `/comet-tweak`, agent must automatically advance through tweak steps, without pausing to wait for user input mid-way. But the following situations must pause and wait for user confirmation:
116
+ Tweak workflow is **one-time continuous execution**. After invoking `/comet-tweak`, agent must automatically advance through tweak steps, without pausing to wait for user input mid-way.
117
+
118
+ Exception: when `.comet.yaml` has `auto_transition: false`, after each phase guard advances `phase`, do not auto-invoke the next skill. In this case, use `"$COMET_BASH" "$COMET_STATE" next <name>` output and pause for manual continuation as instructed.
113
119
 
114
- 1. Encountering upgrade conditions (see "Upgrade Conditions" section). **Must use the AskUserQuestion tool to pause and wait for the user to explicitly confirm** upgrading to full workflow
120
+ The following situations must pause and wait for user confirmation:
121
+
122
+ 1. Encountering upgrade conditions (see "Upgrade Conditions" section). **Must use the current platform's available user input/confirmation mechanism to pause and wait for the user to explicitly confirm** upgrading to full workflow
115
123
  2. verify phase (comet-verify) verification-failure and branch-handling decisions
124
+ 3. Final archive confirmation (before comet-archive runs the archive script)
116
125
 
117
126
  Execution order: quick open → lightweight build → lightweight verification → archive → complete
118
127
 
@@ -134,12 +143,13 @@ Upgrade to full `/comet` when **any** of the following conditions are met:
134
143
  | New capability needed | Exceeds local optimization |
135
144
  | Delta spec needed | Affects existing specs |
136
145
 
137
- When upgrade conditions are met, **must use the AskUserQuestion tool to pause and wait for the user to explicitly confirm** upgrading to the full `/comet` workflow. Do not directly enter `/comet-design`, and do not automatically supplement Design Doc. Must not just output a text prompt and then continue executing.
146
+ When upgrade conditions are met, **must use the current platform's available user input/confirmation mechanism to pause and wait for the user to explicitly confirm** upgrading to the full `/comet` workflow. Do not directly enter `/comet-design`, and do not automatically supplement Design Doc. If the current platform has no structured question tool, ask an upgrade confirmation question in the conversation, stop the workflow, and wait for the user's reply before continuing.
138
147
 
139
- After user confirms upgrade, **must first update the workflow field** before entering full flow:
148
+ After user confirms upgrade, **must first update the workflow and phase fields** before entering full flow:
140
149
 
141
150
  ```bash
142
151
  "$COMET_BASH" "$COMET_STATE" set <name> workflow full
152
+ "$COMET_BASH" "$COMET_STATE" set <name> phase design
143
153
  ```
144
154
 
145
155
  Then on current change basis, supplement Design Doc: **Immediately use the Skill tool to load the `comet-design` skill**, proceed normally with full workflow. If user does not confirm upgrade, stop tweak and report that current change has exceeded tweak scope.
@@ -152,3 +162,18 @@ Then on current change basis, supplement Design Doc: **Immediately use the Skill
152
162
  - Change archived
153
163
  - No new capability, architecture adjustments or interface changes
154
164
  - **Phase guard**: Before build → verify run `"$COMET_BASH" "$COMET_GUARD" <change-name> build --apply`; before verify → archive follow `/comet-verify` and run `"$COMET_BASH" "$COMET_GUARD" <change-name> verify --apply`
165
+
166
+ ## Automatic Handoff to Next Phase
167
+
168
+ > **Terminology distinction**: phase guard `--apply` advances 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.
169
+
170
+ After each phase guard or state transition advances phase, run:
171
+
172
+ ```bash
173
+ "$COMET_BASH" "$COMET_STATE" next <name>
174
+ ```
175
+
176
+ The script determines the next action from `phase`, `workflow`, and `auto_transition`:
177
+ - `NEXT: auto` -> invoke the `SKILL` target to continue the tweak flow (`phase: build` returns `comet-tweak`, `verify` returns `comet-verify`, `archive` returns `comet-archive`)
178
+ - `NEXT: manual` -> do not invoke the next skill; follow `HINT` and ask the user to run `/<SKILL>` manually
179
+ - `NEXT: done` -> workflow is complete; no further action needed
@@ -12,7 +12,11 @@ description: "Comet Phase 4: Verify and Close. Invoke with /comet-verify. Verify
12
12
 
13
13
  ## Steps
14
14
 
15
- ### 0. Entry State Verification (Entry Check)
15
+ ### 0a. Output Language Constraint
16
+
17
+ Verification reports and branch-handling notes must use the language of the user request that triggered this workflow.
18
+
19
+ ### 0b. Entry State Verification (Entry Check)
16
20
 
17
21
  Execute entry verification:
18
22
 
@@ -38,7 +42,7 @@ Execute scale assessment:
38
42
  "$COMET_BASH" "$COMET_STATE" scale <change-name>
39
43
  ```
40
44
 
41
- The script automatically counts tasks, delta spec count, changed file count, determines light or full verification mode, and sets the verify_mode field.
45
+ The script automatically counts tasks, delta spec count, changed file count, determines light or full verification mode, and sets the verify_mode field. Decision rule (any condition triggers full): tasks > 3, delta spec capabilities > 1, changed files > 4.
42
46
 
43
47
  Before verification begins, handle uncommitted changes through `comet/reference/dirty-worktree.md` protocol. Verify phase special handling:
44
48
 
@@ -53,6 +57,8 @@ Only after user chooses fix, allow rollback to build phase:
53
57
  "$COMET_BASH" "$COMET_STATE" transition <change-name> verify-fail
54
58
  ```
55
59
 
60
+ Note: When verify-fail rolls back to build, `branch_status` is not reset. If branch handling was already completed during the first verify attempt, skip the branch handling step on re-verify and keep the existing `branch_status: handled`.
61
+
56
62
  Note: If every task in build phase was committed, the script's file count based on working tree diff may underestimate change scale. In this case, must read plan file header `base-ref` and verify with commit range:
57
63
 
58
64
  ```bash
@@ -67,9 +73,11 @@ If commit range shows changes exceed lightweight threshold (> 4 files, cross-mod
67
73
  "$COMET_BASH" "$COMET_STATE" set <change-name> verify_mode full
68
74
  ```
69
75
 
76
+ **Override mechanism**: If the agent or user believes the automated assessment is inappropriate, override at any time with `"$COMET_BASH" "$COMET_STATE" set <change-name> verify_mode <light|full>`.
77
+
70
78
  ### 1b. Verification Failure Decision (Blocking Point)
71
79
 
72
- When verification does not pass, **must use the AskUserQuestion tool to pause and wait for the user to decide fix or accept deviation**. Must not automatically run `"$COMET_BASH" "$COMET_STATE" transition <change-name> verify-fail`, nor automatically invoke `/comet-build`. Must not just output a text prompt and then continue executing.
80
+ When verification does not pass, **must use the current platform's available user input/confirmation mechanism to pause and wait for the user to decide whether to fix or accept the deviation**. Must not automatically run `"$COMET_BASH" "$COMET_STATE" transition <change-name> verify-fail`, nor automatically invoke `/comet-build`. If the current platform has no structured question tool, ask fix/accept-deviation options in the conversation, stop the workflow, and wait for the user's reply before continuing.
73
81
 
74
82
  When pausing, must list:
75
83
  - Failed items
@@ -82,9 +90,29 @@ After user selection, continue as follows:
82
90
  - **Fix all**: Run `"$COMET_BASH" "$COMET_STATE" transition <change-name> verify-fail`, then invoke `/comet-build` to fix
83
91
  - **Handle item by item**: CRITICAL failures must be fixed; non-CRITICAL failures may choose to accept deviation, but must record acceptance reason and impact scope in verification report. If any CRITICAL failure exists, skipping fix to accept all is not allowed
84
92
 
93
+ **Retry limit**: After 3 consecutive verify-fail cycles, on the 4th failure the agent must not automatically choose to continue fixing; **must use the current platform's available user input/confirmation mechanism to pause** with only two options: "Accept all deviations and record" or "Continue fixing", for the user to explicitly decide.
94
+
95
+ ### 2. Artifact Context Loading (Hash On-Demand Read)
96
+
97
+ When verification needs to read OpenSpec artifacts, first check whether they have changed since the design phase:
98
+
99
+ ```bash
100
+ RECORDED_HASH=$("$COMET_BASH" "$COMET_STATE" get <change-name> handoff_hash)
101
+ CURRENT_HASH=$("$COMET_BASH" "$COMET_HANDOFF" <change-name> --hash-only 2>/dev/null || echo "")
102
+ ```
103
+
104
+ - If `RECORDED_HASH` = `CURRENT_HASH` and both are non-empty and neither is `null`: OpenSpec artifacts are unchanged. **tasks.md does not need to be re-read in full** (use `grep -c '\- \[ \]' tasks.md` to confirm completion count). proposal.md, design.md, and delta specs must still be read for comparison checks.
105
+ - If `RECORDED_HASH` is empty, is `null`, or differs from `CURRENT_HASH`: artifacts have changed or hash was never recorded. Read all required files in full normally.
106
+
107
+ This optimization only skips re-reading tasks.md in full. proposal.md and design.md contain the full context needed for verification checks and must not be skipped due to hash match.
108
+
109
+ **Immediately execute:** Use the Skill tool to load the Superpowers `verification-before-completion` skill. Skipping this step is prohibited.
110
+
111
+ After the skill loads, follow the `verify_mode` branch:
112
+
85
113
  ### 2a. Lightweight Verification (Small Changes)
86
114
 
87
- When scale assessment result is "small", skip `openspec-verify-change` and directly execute these checks:
115
+ Run these 5 checks:
88
116
 
89
117
  1. All tasks.md tasks completed `[x]`
90
118
  2. Changed files match tasks.md descriptions (`git diff --stat` / `git diff --cached --stat` / `git diff --stat <base-ref>...HEAD` compared against tasks content)
@@ -132,7 +160,7 @@ When verification does not pass: report missing items, enter Step 1b verificatio
132
160
  ```
133
161
 
134
162
  **Spec Drift Handling** (user decision point):
135
- - If check item 6 finds contradictions (delta spec has content but design doc does not reflect it), **must use the AskUserQuestion tool as a single-select question to pause and wait for user to choose handling method**; must not select automatically. Options:
163
+ - If check item 6 finds contradictions (delta spec has content but design doc does not reflect it), **must use the current platform's available user input/confirmation mechanism as a single-select question to pause and wait for the user to choose the handling method**; must not select automatically. Options:
136
164
  - Option A: Append "Implementation Divergence" section to design doc recording deviation reason. Option A is a verify phase allowed artifact; after writing, must not re-trigger Step 1b dirty-worktree decision due to that design doc change
137
165
  - Option B: After user selects B, run `"$COMET_BASH" "$COMET_STATE" transition <change-name> verify-fail`, then invoke `/comet-build`; `/comet-build`'s Spec Incremental Update rules will load the Superpowers `brainstorming` skill to update Design Doc + delta spec
138
166
  - Option C: Confirm deviation is acceptable, continue verification (design doc will be marked as `superseded-by-main-spec` during archiving)
@@ -149,7 +177,7 @@ After the skill loads, follow its guidance to finish. Branch handling options:
149
177
  3. Keep branch (handle later)
150
178
  4. Discard work
151
179
 
152
- This is a user decision point. **Must use the AskUserQuestion tool to pause and wait for user to choose branch handling method**. Must not select based on recommendations, defaults, or current branch status. Must not just output a text prompt and then continue executing. Only after the user completes selection and the corresponding operation finishes, may `branch_status: handled` be written.
180
+ 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 choose branch handling method**. Must not select based on recommendations, defaults, or current branch status. If the current platform has no structured question tool, ask branch-handling options in the conversation, stop the workflow, and wait for the user's reply before continuing. Only after the user completes selection and the corresponding operation finishes, may `branch_status: handled` be written.
153
181
 
154
182
  **Confirmation items**:
155
183
  - All tests pass
@@ -184,11 +212,22 @@ After both verification and branch handling are complete, run guard for auto-tra
184
212
 
185
213
  State file auto-updates to `phase: archive`, `verify_result: pass`, `verified_at: YYYY-MM-DD`.
186
214
 
187
- ## Automatic Transition
215
+ ## Automatic Handoff to Next Phase
216
+
217
+ > **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.
218
+
219
+ After verification and branch handling are complete, and guard-based phase advancement has completed, run:
220
+
221
+ ```bash
222
+ "$COMET_BASH" "$COMET_STATE" next <change-name>
223
+ ```
188
224
 
189
- After exit conditions are met (including user selecting branch handling method), auto-transition to next phase:
225
+ The script determines the next action from `phase`, `workflow`, and `auto_transition`:
226
+ - `NEXT: auto` -> invoke the `SKILL` target to continue to the next phase
227
+ - `NEXT: manual` -> do not invoke the next skill; follow `HINT` and ask the user to run `/<SKILL>` manually
228
+ - `NEXT: done` -> workflow is complete; no further action needed
190
229
 
191
- > **REQUIRED NEXT SKILL:** Invoke `comet-archive` skill to enter the archive phase.
230
+ Note: after `comet-archive` starts, it must first execute the final archive confirmation blocking point and wait for the user to explicitly choose "Confirm archive" before running the archive script. Must not automatically archive just because verification passed.
192
231
 
193
232
  ## Context Compaction Recovery
194
233