@rpamis/comet 0.3.4 → 0.3.6
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 +14 -2
- package/assets/skills/comet/SKILL.md +40 -22
- package/assets/skills/comet/scripts/comet-archive.sh +4 -2
- package/assets/skills/comet/scripts/comet-env.sh +57 -2
- package/assets/skills/comet/scripts/comet-guard.sh +14 -12
- package/assets/skills/comet/scripts/comet-handoff.sh +4 -2
- package/assets/skills/comet/scripts/comet-state.sh +185 -4
- package/assets/skills/comet/scripts/comet-yaml-validate.sh +3 -1
- package/assets/skills/comet-archive/SKILL.md +3 -3
- package/assets/skills/comet-build/SKILL.md +52 -19
- package/assets/skills/comet-design/SKILL.md +24 -12
- package/assets/skills/comet-hotfix/SKILL.md +9 -9
- package/assets/skills/comet-open/SKILL.md +29 -5
- package/assets/skills/comet-tweak/SKILL.md +9 -9
- package/assets/skills/comet-verify/SKILL.md +33 -19
- package/assets/skills-zh/comet/SKILL.md +40 -22
- package/assets/skills-zh/comet-archive/SKILL.md +3 -3
- package/assets/skills-zh/comet-build/SKILL.md +52 -19
- package/assets/skills-zh/comet-design/SKILL.md +24 -12
- package/assets/skills-zh/comet-hotfix/SKILL.md +9 -9
- package/assets/skills-zh/comet-open/SKILL.md +29 -5
- package/assets/skills-zh/comet-tweak/SKILL.md +9 -9
- package/assets/skills-zh/comet-verify/SKILL.md +33 -19
- package/bin/comet.js +3 -3
- package/package.json +1 -1
- package/scripts/postinstall.js +44 -44
|
@@ -21,6 +21,8 @@ After the skill loads, freely explore the problem space following its guidance.
|
|
|
21
21
|
|
|
22
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.
|
|
23
23
|
|
|
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.
|
|
25
|
+
|
|
24
26
|
Confirm the following artifacts have been created:
|
|
25
27
|
|
|
26
28
|
```
|
|
@@ -47,7 +49,7 @@ if [ -z "$COMET_STATE" ] || [ -z "$COMET_GUARD" ]; then
|
|
|
47
49
|
return 1
|
|
48
50
|
fi
|
|
49
51
|
|
|
50
|
-
|
|
52
|
+
"$COMET_BASH" "$COMET_STATE" init <name> full
|
|
51
53
|
```
|
|
52
54
|
|
|
53
55
|
### 3. Entry State Verification
|
|
@@ -55,11 +57,13 @@ bash "$COMET_STATE" init <name> full
|
|
|
55
57
|
Verify state machine has been correctly initialized:
|
|
56
58
|
|
|
57
59
|
```bash
|
|
58
|
-
|
|
60
|
+
"$COMET_BASH" "$COMET_STATE" check <name> open
|
|
59
61
|
```
|
|
60
62
|
|
|
61
63
|
Proceed to Step 4 after verification passes. The script outputs specific failure reasons when verification fails.
|
|
62
64
|
|
|
65
|
+
**Idempotency**: All open phase operations can be safely re-executed. If `.comet.yaml` is already at `phase: open` and all three artifact files exist, skip completed steps and continue from the first missing step.
|
|
66
|
+
|
|
63
67
|
### 4. Content Completeness Check
|
|
64
68
|
|
|
65
69
|
Confirm the three documents have complete content:
|
|
@@ -67,22 +71,42 @@ Confirm the three documents have complete content:
|
|
|
67
71
|
- **design.md**: high-level architecture decisions, approach selection, data flow
|
|
68
72
|
- **tasks.md**: task list, each task has a clear description
|
|
69
73
|
|
|
74
|
+
**File existence verification**: Confirm all three file paths exist and are non-empty. If any file is missing or empty, must not enter Step 5 or execute phase guard — return to creation step to fill the gap.
|
|
75
|
+
|
|
76
|
+
### 5. User Review and Confirmation (Blocking Point)
|
|
77
|
+
|
|
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.
|
|
79
|
+
|
|
80
|
+
AskUserQuestion must be presented as a single-select question with the following summary and options:
|
|
81
|
+
|
|
82
|
+
**Summary content**:
|
|
83
|
+
- **proposal.md**: problem background, goals, scope
|
|
84
|
+
- **design.md**: high-level architecture decisions, approach selection
|
|
85
|
+
- **tasks.md**: task count and key task descriptions
|
|
86
|
+
|
|
87
|
+
**Options**:
|
|
88
|
+
- "Confirm, proceed to next phase" — artifacts meet expectations, execute phase guard transition
|
|
89
|
+
- "Needs adjustment" — include adjustment notes, modify and re-request confirmation
|
|
90
|
+
|
|
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.
|
|
92
|
+
|
|
70
93
|
## Exit Conditions
|
|
71
94
|
|
|
72
95
|
- proposal.md, design.md, tasks.md all created with complete content
|
|
73
|
-
- **
|
|
96
|
+
- **User has confirmed** proposal, design, tasks content meets expectations
|
|
97
|
+
- **Phase guard**: Run `"$COMET_BASH" "$COMET_GUARD" <change-name> open --apply`; after all PASS, auto-transitions to next phase
|
|
74
98
|
|
|
75
99
|
Must use `--apply` before exit, otherwise `.comet.yaml` remains at `phase: open` and the next phase entry check will fail.
|
|
76
100
|
|
|
77
101
|
```bash
|
|
78
|
-
|
|
102
|
+
"$COMET_BASH" "$COMET_GUARD" <change-name> open --apply
|
|
79
103
|
```
|
|
80
104
|
|
|
81
105
|
Full workflow auto-transitions to `phase: design`; hotfix/tweak presets auto-transition to `phase: build`.
|
|
82
106
|
|
|
83
107
|
## Automatic Transition
|
|
84
108
|
|
|
85
|
-
After exit conditions are met,
|
|
109
|
+
After user confirmation and exit conditions are met, auto-transition to next phase:
|
|
86
110
|
|
|
87
111
|
> **REQUIRED NEXT SKILL (full workflow):** Invoke `comet-design` skill to enter the deep design phase.
|
|
88
112
|
>
|
|
@@ -49,24 +49,24 @@ After the skill loads, follow its guidance to create streamlined artifacts:
|
|
|
49
49
|
Initialize Comet state file:
|
|
50
50
|
|
|
51
51
|
```bash
|
|
52
|
-
|
|
52
|
+
"$COMET_BASH" "$COMET_STATE" init <name> tweak
|
|
53
53
|
```
|
|
54
54
|
|
|
55
55
|
Verify initialized state:
|
|
56
56
|
|
|
57
57
|
```bash
|
|
58
|
-
|
|
58
|
+
"$COMET_BASH" "$COMET_STATE" check <name> open
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
Run phase guard to transition open → build:
|
|
62
62
|
|
|
63
63
|
```bash
|
|
64
|
-
|
|
64
|
+
"$COMET_BASH" "$COMET_GUARD" <change-name> open --apply
|
|
65
65
|
```
|
|
66
66
|
|
|
67
67
|
### 2. Lightweight Build (preset build)
|
|
68
68
|
|
|
69
|
-
Use tweak defaults: `build_mode: direct`. Skip `
|
|
69
|
+
Use tweak defaults: `build_mode: direct`. Skip Superpowers `brainstorming` and `writing-plans`.
|
|
70
70
|
|
|
71
71
|
Before continuing or starting changes, handle uncommitted changes through `comet/reference/dirty-worktree.md`. If attribution shows scope exceeds tweak, handle it through this file's "Upgrade Conditions".
|
|
72
72
|
|
|
@@ -83,7 +83,7 @@ Before continuing or starting changes, handle uncommitted changes through `comet
|
|
|
83
83
|
4. Run phase guard to transition build → verify:
|
|
84
84
|
|
|
85
85
|
```bash
|
|
86
|
-
|
|
86
|
+
"$COMET_BASH" "$COMET_GUARD" <change-name> build --apply
|
|
87
87
|
```
|
|
88
88
|
|
|
89
89
|
State automatically updates to `phase: verify`, `verify_result: pending`, then enter verification.
|
|
@@ -111,7 +111,7 @@ Reuse `/comet-archive`. Must satisfy `verify_result: pass` in `.comet.yaml` befo
|
|
|
111
111
|
<IMPORTANT>
|
|
112
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:
|
|
113
113
|
|
|
114
|
-
1. Encountering upgrade conditions (see "Upgrade Conditions" section).
|
|
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
|
|
115
115
|
2. verify phase (comet-verify) verification-failure and branch-handling decisions
|
|
116
116
|
|
|
117
117
|
Execution order: quick open → lightweight build → lightweight verification → archive → complete
|
|
@@ -134,12 +134,12 @@ Upgrade to full `/comet` when **any** of the following conditions are met:
|
|
|
134
134
|
| New capability needed | Exceeds local optimization |
|
|
135
135
|
| Delta spec needed | Affects existing specs |
|
|
136
136
|
|
|
137
|
-
When upgrade conditions are met, must 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.
|
|
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.
|
|
138
138
|
|
|
139
139
|
After user confirms upgrade, **must first update the workflow field** before entering full flow:
|
|
140
140
|
|
|
141
141
|
```bash
|
|
142
|
-
|
|
142
|
+
"$COMET_BASH" "$COMET_STATE" set <name> workflow full
|
|
143
143
|
```
|
|
144
144
|
|
|
145
145
|
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.
|
|
@@ -151,4 +151,4 @@ Then on current change basis, supplement Design Doc: **Immediately use the Skill
|
|
|
151
151
|
- Small change completed, tests pass
|
|
152
152
|
- Change archived
|
|
153
153
|
- No new capability, architecture adjustments or interface changes
|
|
154
|
-
- **Phase guard**: Before build → verify run `
|
|
154
|
+
- **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`
|
|
@@ -23,17 +23,19 @@ if [ -z "$COMET_ENV" ]; then
|
|
|
23
23
|
return 1
|
|
24
24
|
fi
|
|
25
25
|
. "$COMET_ENV"
|
|
26
|
-
|
|
26
|
+
"$COMET_BASH" "$COMET_STATE" check <change-name> verify
|
|
27
27
|
```
|
|
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 verify phase checks can be safely re-executed. If `verify_result` is already `pass` and `branch_status` is `handled`, verification is complete — execute guard to transition. If `verify_result` is `pending`, start verification from the beginning.
|
|
32
|
+
|
|
31
33
|
### 1. Scale Assessment
|
|
32
34
|
|
|
33
35
|
Execute scale assessment:
|
|
34
36
|
|
|
35
37
|
```bash
|
|
36
|
-
|
|
38
|
+
"$COMET_BASH" "$COMET_STATE" scale <change-name>
|
|
37
39
|
```
|
|
38
40
|
|
|
39
41
|
The script automatically counts tasks, delta spec count, changed file count, determines light or full verification mode, and sets the verify_mode field.
|
|
@@ -48,13 +50,13 @@ Only after user chooses fix, allow rollback to build phase:
|
|
|
48
50
|
|
|
49
51
|
```bash
|
|
50
52
|
# Execute only after user confirms fix
|
|
51
|
-
|
|
53
|
+
"$COMET_BASH" "$COMET_STATE" transition <change-name> verify-fail
|
|
52
54
|
```
|
|
53
55
|
|
|
54
56
|
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:
|
|
55
57
|
|
|
56
58
|
```bash
|
|
57
|
-
PLAN=$(
|
|
59
|
+
PLAN=$("$COMET_BASH" "$COMET_STATE" get <change-name> plan)
|
|
58
60
|
BASE_REF=$(grep '^base-ref:' "$PLAN" 2>/dev/null | head -1 | sed 's/^base-ref: *//')
|
|
59
61
|
git diff --stat "$BASE_REF"...HEAD
|
|
60
62
|
```
|
|
@@ -62,20 +64,22 @@ git diff --stat "$BASE_REF"...HEAD
|
|
|
62
64
|
If commit range shows changes exceed lightweight threshold (> 4 files, cross-module coordination, or delta spec spans more than 1 capability), manually set to full verification:
|
|
63
65
|
|
|
64
66
|
```bash
|
|
65
|
-
|
|
67
|
+
"$COMET_BASH" "$COMET_STATE" set <change-name> verify_mode full
|
|
66
68
|
```
|
|
67
69
|
|
|
68
70
|
### 1b. Verification Failure Decision (Blocking Point)
|
|
69
71
|
|
|
70
|
-
When verification does not pass, must pause and wait for the user to decide fix or accept deviation
|
|
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.
|
|
71
73
|
|
|
72
74
|
When pausing, must list:
|
|
73
75
|
- Failed items
|
|
74
76
|
- Whether CRITICAL (build failure, test failure, security issues, core acceptance scenario failure)
|
|
75
77
|
- Recommended handling approach
|
|
76
78
|
|
|
79
|
+
**Uncertainty principle**: When severity is unclear, downgrade (SUGGESTION > WARNING > CRITICAL). Only use CRITICAL for build failures, test failures, and security issues; ambiguous or uncertain issues should be WARNING or SUGGESTION.
|
|
80
|
+
|
|
77
81
|
After user selection, continue as follows:
|
|
78
|
-
- **Fix all**: Run `
|
|
82
|
+
- **Fix all**: Run `"$COMET_BASH" "$COMET_STATE" transition <change-name> verify-fail`, then invoke `/comet-build` to fix
|
|
79
83
|
- **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
|
|
80
84
|
|
|
81
85
|
### 2a. Lightweight Verification (Small Changes)
|
|
@@ -94,7 +98,7 @@ When scale assessment result is "small", skip `openspec-verify-change` and direc
|
|
|
94
98
|
|
|
95
99
|
```bash
|
|
96
100
|
# Execute only after user confirms fix
|
|
97
|
-
|
|
101
|
+
"$COMET_BASH" "$COMET_STATE" transition <change-name> verify-fail
|
|
98
102
|
```
|
|
99
103
|
|
|
100
104
|
**Report format**: Brief table listing 5 check results + PASS/FAIL.
|
|
@@ -124,20 +128,20 @@ When verification does not pass: report missing items, enter Step 1b verificatio
|
|
|
124
128
|
|
|
125
129
|
```bash
|
|
126
130
|
# Execute only after user confirms fix
|
|
127
|
-
|
|
131
|
+
"$COMET_BASH" "$COMET_STATE" transition <change-name> verify-fail
|
|
128
132
|
```
|
|
129
133
|
|
|
130
134
|
**Spec Drift Handling** (user decision point):
|
|
131
|
-
- If check item 6 finds contradictions (delta spec has content but design doc does not reflect it), **must pause and wait for user to choose handling method**; must not select automatically. Options:
|
|
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:
|
|
132
136
|
- 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
|
|
133
|
-
- Option B: After user selects B, run `
|
|
137
|
+
- 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
|
|
134
138
|
- Option C: Confirm deviation is acceptable, continue verification (design doc will be marked as `superseded-by-main-spec` during archiving)
|
|
135
139
|
|
|
136
140
|
### 3. Finishing (Superpowers)
|
|
137
141
|
|
|
138
|
-
**Immediately execute:** Use the Skill tool to load the `
|
|
142
|
+
**Immediately execute:** Use the Skill tool to load the Superpowers `finishing-a-development-branch` skill. Skipping this step is prohibited.
|
|
139
143
|
|
|
140
|
-
If `
|
|
144
|
+
If the Superpowers `finishing-a-development-branch` skill is unavailable, stop the process and prompt to install or enable Superpowers skills. Do not substitute this step with normal conversation.
|
|
141
145
|
|
|
142
146
|
After the skill loads, follow its guidance to finish. Branch handling options:
|
|
143
147
|
1. Merge to main branch locally
|
|
@@ -145,7 +149,7 @@ After the skill loads, follow its guidance to finish. Branch handling options:
|
|
|
145
149
|
3. Keep branch (handle later)
|
|
146
150
|
4. Discard work
|
|
147
151
|
|
|
148
|
-
This is a user decision point. **Must pause and wait for user to choose branch handling method**. Must not select based on recommendations, defaults, or current branch status. Only after the user completes selection and the corresponding operation finishes, may `branch_status: handled` be written.
|
|
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.
|
|
149
153
|
|
|
150
154
|
**Confirmation items**:
|
|
151
155
|
- All tests pass
|
|
@@ -160,8 +164,8 @@ mkdir -p docs/superpowers/reports
|
|
|
160
164
|
# Write verification conclusions to report file, e.g.:
|
|
161
165
|
# docs/superpowers/reports/YYYY-MM-DD-<change-name>-verify.md
|
|
162
166
|
|
|
163
|
-
|
|
164
|
-
|
|
167
|
+
"$COMET_BASH" "$COMET_STATE" set <change-name> verification_report docs/superpowers/reports/YYYY-MM-DD-<change-name>-verify.md
|
|
168
|
+
"$COMET_BASH" "$COMET_STATE" set <change-name> branch_status handled
|
|
165
169
|
```
|
|
166
170
|
|
|
167
171
|
## Exit Conditions
|
|
@@ -170,18 +174,28 @@ bash "$COMET_STATE" set <change-name> branch_status handled
|
|
|
170
174
|
- Branch handled
|
|
171
175
|
- `verification_report` in `.comet.yaml` points to an existing verification report file
|
|
172
176
|
- `branch_status: handled` in `.comet.yaml`
|
|
173
|
-
- **Phase guard**: Run `
|
|
177
|
+
- **Phase guard**: Run `"$COMET_BASH" "$COMET_GUARD" <change-name> verify --apply`; after all PASS, auto-transitions to `phase: archive` through `comet-state transition verify-pass`
|
|
174
178
|
|
|
175
179
|
After both verification and branch handling are complete, run guard for auto-transition:
|
|
176
180
|
|
|
177
181
|
```bash
|
|
178
|
-
|
|
182
|
+
"$COMET_BASH" "$COMET_GUARD" <change-name> verify --apply
|
|
179
183
|
```
|
|
180
184
|
|
|
181
185
|
State file auto-updates to `phase: archive`, `verify_result: pass`, `verified_at: YYYY-MM-DD`.
|
|
182
186
|
|
|
183
187
|
## Automatic Transition
|
|
184
188
|
|
|
185
|
-
After exit conditions are met
|
|
189
|
+
After exit conditions are met (including user selecting branch handling method), auto-transition to next phase:
|
|
186
190
|
|
|
187
191
|
> **REQUIRED NEXT SKILL:** Invoke `comet-archive` skill to enter the archive phase.
|
|
192
|
+
|
|
193
|
+
## Context Compaction Recovery
|
|
194
|
+
|
|
195
|
+
The verify phase may trigger context compaction. To recover, first run:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
"$COMET_BASH" "$COMET_STATE" check <change-name> verify --recover
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
The script outputs structured recovery context (phase, verification status, branch status, recovery action). Follow the Recovery action to determine next step.
|
|
@@ -53,9 +53,13 @@ agent 做决策只需读本节,参考附录按需查阅。
|
|
|
53
53
|
**断点恢复规则**:
|
|
54
54
|
- 每次恢复上下文时,先重新执行 Step 0 和 Step 1,不依赖对话历史判断阶段
|
|
55
55
|
- 只要存在 active change 且工作区有未提交改动,必须按 `comet/reference/dirty-worktree.md` 协议处理。该协议定义了检查步骤、归因分类和禁令,本文件不重复
|
|
56
|
-
- 若 `phase: build`,先检查 `build_mode` 和 `isolation
|
|
57
|
-
- 若 `
|
|
58
|
-
- 若 `
|
|
56
|
+
- 若 `phase: build`,先检查 `build_pause`、`plan`、`build_mode` 和 `isolation`:
|
|
57
|
+
- 若 `build_pause: plan-ready` 且 plan 文件存在,回到 `/comet-build` 的 plan-ready 恢复点,提示用户继续选择隔离方式和执行方式,不重新生成 plan
|
|
58
|
+
- 若 `build_pause: plan-ready` 但 plan 文件缺失,回到 `/comet-build` 处理状态损坏或重新生成 plan
|
|
59
|
+
- 若 `build_mode` 或 `isolation` 未设置,回到 `/comet-build` 对应步骤补充后再执行
|
|
60
|
+
- 若均已设置,读取 tasks.md 的下一个未勾选任务继续
|
|
61
|
+
- 若 `phase: verify` 且 `verify_result: fail`,进入验证失败决策阻塞点:暂停并询问用户修复或接受偏差;用户选择修复后才运行 `"$COMET_BASH" "$COMET_STATE" transition <name> verify-fail` 并调用 `/comet-build`
|
|
62
|
+
- 若 `phase: open` 但 proposal/design/tasks 已完整,先运行 `"$COMET_BASH" "$COMET_GUARD" <change-name> open --apply` 修正状态,再继续判定
|
|
59
63
|
- 若 `phase: archive`,只允许调用 `/comet-archive`;归档成功后 change 会移动到 archive 目录,不再对原活跃目录运行 guard
|
|
60
64
|
|
|
61
65
|
**Step 2: 阶段判定**(按顺序,命中即停)
|
|
@@ -92,7 +96,7 @@ agent 做决策只需读本节,参考附录按需查阅。
|
|
|
92
96
|
|------|---------|
|
|
93
97
|
| `openspec list --json` 失败 | 检查 openspec 是否已安装,提示 `openspec init` |
|
|
94
98
|
| 子 skill 不可用 | 停止流程,提示安装或启用对应 skill |
|
|
95
|
-
| `.comet.yaml` 格式异常或缺失 | 以文件状态为准,用 `
|
|
99
|
+
| `.comet.yaml` 格式异常或缺失 | 以文件状态为准,用 `"$COMET_BASH" "$COMET_STATE" set` 修正后继续 |
|
|
96
100
|
| 构建/测试失败 | 返回 build 阶段修复,不进入 verify |
|
|
97
101
|
| change 目录结构不完整 | 按 `comet-open` 产物要求补齐 |
|
|
98
102
|
|
|
@@ -103,19 +107,30 @@ agent 做决策只需读本节,参考附录按需查阅。
|
|
|
103
107
|
|
|
104
108
|
流转链:open → design → build → verify → archive
|
|
105
109
|
|
|
106
|
-
**连续执行要求**:从检测到的阶段开始,agent
|
|
110
|
+
**连续执行要求**:从检测到的阶段开始,agent 自动推进后续阶段。但**自动推进仅适用于没有用户决策的衔接点**。遇到用户决策点时,**必须使用 AskUserQuestion 工具暂停并等待用户明确回复**,不得用推荐规则、默认值或历史偏好代替用户确认,也不得仅输出文字提示后继续执行。
|
|
107
111
|
|
|
108
|
-
**决策点是阻塞点**:只要到达下列任一节点,当前 `/comet`
|
|
112
|
+
**决策点是阻塞点**:只要到达下列任一节点,当前 `/comet` 调用必须停住,**使用 AskUserQuestion 工具等待用户选择**。用户明确选择后才能写入对应状态字段、执行对应操作,随后再继续自动流转。
|
|
109
113
|
|
|
110
114
|
需要用户参与的节点(仅在这些节点暂停):
|
|
111
|
-
1.
|
|
112
|
-
2.
|
|
113
|
-
3.
|
|
114
|
-
4.
|
|
115
|
-
5.
|
|
116
|
-
6.
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
1. open 阶段 proposal/design/tasks 审视确认
|
|
116
|
+
2. brainstorming 确认设计方案
|
|
117
|
+
3. build 阶段 plan-ready 暂停选择,以及随后选择工作方式(隔离方式 + 执行方式)
|
|
118
|
+
4. verify 不通过时决定修复或接受偏差(含 Spec 漂移处理方式选择)
|
|
119
|
+
5. finishing-branch 选择分支处理方式
|
|
120
|
+
6. 遇到升级条件(hotfix/tweak → 完整流程)
|
|
121
|
+
7. build 阶段范围扩张需重新设计或拆分新 change
|
|
122
|
+
|
|
123
|
+
agent 不应跳过这些决策点;其他明确无歧义的阶段衔接必须自动继续推进,不得中途退出。到达决策点时,**禁止以文字输出代替工具等待——必须通过 AskUserQuestion 明确获取用户选择后才能继续**。
|
|
124
|
+
|
|
125
|
+
**红旗清单** — 以下想法出现时立即停止并检查:
|
|
126
|
+
|
|
127
|
+
| Agent 心理 | 实际风险 |
|
|
128
|
+
|-----------|---------|
|
|
129
|
+
| "用户应该会同意这个方案" | 不能替用户决策,用 AskUserQuestion |
|
|
130
|
+
| "这只是个小改动,不需要确认" | 决策点无大小之分,阻塞点必须等待 |
|
|
131
|
+
| "用户之前选过 A,这次也选 A" | 历史偏好不能替代当前确认 |
|
|
132
|
+
| "我已经解释了方案,用户没反对" | 没反对 ≠ 同意,必须用工具获取明确选择 |
|
|
133
|
+
| "流程走到这里应该没问题了" | 验证不通过 ≠ 通过,检查 verify_result |
|
|
119
134
|
</IMPORTANT>
|
|
120
135
|
|
|
121
136
|
---
|
|
@@ -160,6 +175,7 @@ design_doc: docs/superpowers/specs/YYYY-MM-DD-topic-design.md
|
|
|
160
175
|
plan: docs/superpowers/plans/YYYY-MM-DD-feature.md
|
|
161
176
|
base_ref: a1b2c3d4e5f6...
|
|
162
177
|
build_mode: subagent-driven-development
|
|
178
|
+
build_pause: null
|
|
163
179
|
isolation: branch
|
|
164
180
|
verify_mode: light
|
|
165
181
|
verify_result: pending
|
|
@@ -178,6 +194,7 @@ archived: false
|
|
|
178
194
|
| `plan` | 关联的 Superpowers Plan 路径,可为空 |
|
|
179
195
|
| `base_ref` | init 时记录的 git commit SHA,用于 scale 评估。无 plan 时作为改动文件数统计基准 |
|
|
180
196
|
| `build_mode` | 已选择的执行方式,可为空 |
|
|
197
|
+
| `build_pause` | build 阶段内部暂停点。`null` 表示无暂停,`plan-ready` 表示 plan 已生成,用户选择切换模型后暂停 |
|
|
181
198
|
| `isolation` | `branch` 或 `worktree`,工作区隔离方式。full 初始化可为 `null`,但只允许持续到 `/comet-build` Step 3 前;hotfix/tweak 默认 `branch` |
|
|
182
199
|
| `verify_mode` | `light` 或 `full`,可为空 |
|
|
183
200
|
| `verify_result` | `pending`、`pass` 或 `fail` |
|
|
@@ -199,6 +216,7 @@ archived: false
|
|
|
199
216
|
- `build → verify` 前,`isolation` 必须是 `branch` 或 `worktree`
|
|
200
217
|
- `build → verify` 前,`build_mode` 必须已选择
|
|
201
218
|
- `build_mode: direct` 默认只允许 `hotfix` / `tweak`;full workflow 需要 `direct_override: true`
|
|
219
|
+
- `build_pause` 不是执行方式,不得写入 `build_mode`
|
|
202
220
|
- 这些约束同时存在于 `comet-guard.sh build --apply` 和 `comet-state.sh transition <name> build-complete`
|
|
203
221
|
|
|
204
222
|
### 脚本定位
|
|
@@ -224,24 +242,24 @@ fi
|
|
|
224
242
|
**自动状态更新**:guard 支持 `--apply` 参数,验证通过后自动更新 `.comet.yaml` 状态字段:
|
|
225
243
|
|
|
226
244
|
```bash
|
|
227
|
-
|
|
245
|
+
"$COMET_BASH" "$COMET_GUARD" <change-name> <phase> --apply
|
|
228
246
|
```
|
|
229
247
|
|
|
230
248
|
`--apply` 内部委托给 `comet-state transition`。需要直接表达状态事件时使用:
|
|
231
249
|
|
|
232
250
|
```bash
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
251
|
+
"$COMET_BASH" "$COMET_STATE" transition <change-name> open-complete
|
|
252
|
+
"$COMET_BASH" "$COMET_STATE" transition <change-name> design-complete
|
|
253
|
+
"$COMET_BASH" "$COMET_STATE" transition <change-name> build-complete
|
|
254
|
+
"$COMET_BASH" "$COMET_STATE" transition <change-name> verify-pass
|
|
255
|
+
"$COMET_BASH" "$COMET_STATE" transition <change-name> verify-fail
|
|
256
|
+
"$COMET_BASH" "$COMET_STATE" transition <archive-name> archived
|
|
239
257
|
```
|
|
240
258
|
|
|
241
259
|
**归档脚本**:一键完成归档全部步骤:
|
|
242
260
|
|
|
243
261
|
```bash
|
|
244
|
-
|
|
262
|
+
"$COMET_BASH" "$COMET_ARCHIVE" <change-name>
|
|
245
263
|
```
|
|
246
264
|
|
|
247
265
|
加载 comet 后,agent 应执行以上变量赋值一次,后续全程复用 `$COMET_GUARD`、`$COMET_STATE`、`$COMET_HANDOFF`、`$COMET_ARCHIVE`。
|
|
@@ -24,7 +24,7 @@ if [ -z "$COMET_ENV" ]; then
|
|
|
24
24
|
return 1
|
|
25
25
|
fi
|
|
26
26
|
. "$COMET_ENV"
|
|
27
|
-
|
|
27
|
+
"$COMET_BASH" "$COMET_STATE" check <name> archive
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
验证通过后继续 Step 1。验证失败时脚本会输出具体失败原因。
|
|
@@ -34,7 +34,7 @@ bash "$COMET_STATE" check <name> archive
|
|
|
34
34
|
运行归档脚本,自动完成以下全部步骤:
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
|
-
|
|
37
|
+
"$COMET_BASH" "$COMET_ARCHIVE" "<change-name>"
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
脚本自动执行:
|
|
@@ -66,7 +66,7 @@ brainstorming → delta spec → 实施 → 验证 → 主 spec 覆盖 → desig
|
|
|
66
66
|
- 归档目录 `openspec/changes/archive/YYYY-MM-DD-<change-name>/` 存在
|
|
67
67
|
- 归档后的 `.comet.yaml` 中 `archived: true`
|
|
68
68
|
|
|
69
|
-
归档脚本会把 `openspec/changes/<name>/` 移动到 `openspec/changes/archive/YYYY-MM-DD-<name>/`。归档成功后**不要再对原 change 名运行** `
|
|
69
|
+
归档脚本会把 `openspec/changes/<name>/` 移动到 `openspec/changes/archive/YYYY-MM-DD-<name>/`。归档成功后**不要再对原 change 名运行** `"$COMET_BASH" "$COMET_GUARD" <change-name> archive`,因为原活跃目录已经不存在。归档完整性以脚本退出码和归档目录状态为准。
|
|
70
70
|
|
|
71
71
|
## 完成
|
|
72
72
|
|
|
@@ -23,14 +23,16 @@ if [ -z "$COMET_ENV" ]; then
|
|
|
23
23
|
return 1
|
|
24
24
|
fi
|
|
25
25
|
. "$COMET_ENV"
|
|
26
|
-
|
|
26
|
+
"$COMET_BASH" "$COMET_STATE" check <name> build
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
验证通过后继续 Step 1。验证失败时脚本会输出具体失败原因。
|
|
30
30
|
|
|
31
|
+
**幂等性**:build 阶段所有操作可安全重复执行。读取 `.comet.yaml` 的 `phase` 字段确认仍在 build 阶段,读取 plan 文件头的 `base-ref`,再读取 tasks.md 找到第一个未勾选任务继续执行。已提交的任务不得重复提交。
|
|
32
|
+
|
|
31
33
|
### 1. 制定计划
|
|
32
34
|
|
|
33
|
-
**立即执行:** 使用 Skill 工具加载 `
|
|
35
|
+
**立即执行:** 使用 Skill 工具加载 Superpowers `writing-plans` 技能。禁止跳过此步骤。
|
|
34
36
|
|
|
35
37
|
技能加载后,按其指引制定计划。计划要求:
|
|
36
38
|
- 保存至 `docs/superpowers/plans/YYYY-MM-DD-<feature>.md`
|
|
@@ -51,18 +53,49 @@ base-ref: <git rev-parse HEAD before implementation>
|
|
|
51
53
|
git rev-parse HEAD
|
|
52
54
|
```
|
|
53
55
|
|
|
54
|
-
### 2.
|
|
56
|
+
### 2. 更新计划状态并提供 plan-ready 暂停点
|
|
55
57
|
|
|
56
58
|
先记录 plan 路径:
|
|
57
59
|
|
|
58
60
|
```bash
|
|
59
|
-
|
|
61
|
+
"$COMET_BASH" "$COMET_STATE" set <name> plan docs/superpowers/plans/YYYY-MM-DD-feature.md
|
|
60
62
|
```
|
|
61
63
|
|
|
62
64
|
无需手动更新 phase,guard 会在退出条件满足后自动流转。
|
|
63
65
|
|
|
66
|
+
计划写入后,立即提供一个新的用户决策点:
|
|
67
|
+
|
|
68
|
+
| 选项 | 行为 | 说明 |
|
|
69
|
+
|------|------|------|
|
|
70
|
+
| A | 继续执行 | 保持在当前模型中,进入 Step 3 选择工作区隔离和执行方式 |
|
|
71
|
+
| B | 暂停切换模型 | 记录 `build_pause: plan-ready`,本次 `/comet-build` 停止,用户稍后可从 `/comet` 或 `/comet-build` 恢复 |
|
|
72
|
+
|
|
73
|
+
这是用户决策点。**必须使用 AskUserQuestion 工具暂停并等待用户明确选择**,不得自动继续,也不得把暂停写入 `build_mode`。
|
|
74
|
+
|
|
75
|
+
用户选择继续时:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
"$COMET_BASH" "$COMET_STATE" set <name> build_pause null
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
用户选择暂停时:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
"$COMET_BASH" "$COMET_STATE" set <name> build_pause plan-ready
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
设置 `build_pause: plan-ready` 后,当前调用停止。不要选择 `isolation` 或 `build_mode`,不要加载执行技能。
|
|
88
|
+
|
|
64
89
|
### 3. 选择工作方式
|
|
65
90
|
|
|
91
|
+
如果恢复时检测到 `build_pause: plan-ready` 且 `plan` 文件存在,不要重新运行 `writing-plans`。先告知用户当前停在 plan-ready 暂停点;用户确认继续后,设置:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
"$COMET_BASH" "$COMET_STATE" set <name> build_pause null
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
然后继续本步骤选择工作区隔离和执行方式。
|
|
98
|
+
|
|
66
99
|
计划已写入当前分支。在开始执行前,**一次性询问用户**选择工作区隔离方式和执行方式:
|
|
67
100
|
|
|
68
101
|
**工作区隔离**:
|
|
@@ -80,21 +113,21 @@ bash "$COMET_STATE" set <name> plan docs/superpowers/plans/YYYY-MM-DD-feature.md
|
|
|
80
113
|
|
|
81
114
|
| 选项 | 技能 | 适用场景 |
|
|
82
115
|
|------|------|---------|
|
|
83
|
-
| A | `
|
|
84
|
-
| B | `
|
|
116
|
+
| A | Superpowers `subagent-driven-development` | 任务独立、复杂度高、需要双阶段审查 |
|
|
117
|
+
| B | Superpowers `executing-plans` | 任务简单、无子agent环境、轻量快速 |
|
|
85
118
|
|
|
86
119
|
**执行方式推荐规则**:
|
|
87
120
|
- 任务数 ≥ 3 → 推荐 A
|
|
88
121
|
- 任务数 ≤ 2 且无跨模块依赖 → 推荐 B
|
|
89
122
|
- 来自 hotfix 路径 → 推荐 B
|
|
90
123
|
|
|
91
|
-
|
|
124
|
+
这是用户决策点。**必须使用 AskUserQuestion 工具暂停并等待用户明确选择隔离方式和执行方式**,不得根据推荐规则自行选择 `branch` 或 `worktree`,也不得根据推荐规则自行选择执行方式。推荐规则只能用于说明建议,不能替代用户确认。禁止仅输出文字提示后继续执行。
|
|
92
125
|
|
|
93
126
|
用户选择后,更新 `isolation` 和 `build_mode` 字段:
|
|
94
127
|
|
|
95
128
|
```bash
|
|
96
|
-
|
|
97
|
-
|
|
129
|
+
"$COMET_BASH" "$COMET_STATE" set <name> isolation <branch|worktree>
|
|
130
|
+
"$COMET_BASH" "$COMET_STATE" set <name> build_mode <subagent-driven-development|executing-plans|direct>
|
|
98
131
|
```
|
|
99
132
|
|
|
100
133
|
`isolation` 是脚本级硬约束。full workflow 初始化时可以为 `null`,但只允许存在到本步骤之前。若保持 `null`,`build → verify` 的 guard 和 `comet-state transition build-complete` 都会失败。
|
|
@@ -102,8 +135,8 @@ bash "$COMET_STATE" set <name> build_mode <subagent-driven-development|executing
|
|
|
102
135
|
`build_mode` 默认仅 hotfix/tweak preset 使用 `direct`。full workflow 不得默认使用 `direct`。只有用户明确要求跳过计划执行技能,且你已记录显式 override 时,才允许:
|
|
103
136
|
|
|
104
137
|
```bash
|
|
105
|
-
|
|
106
|
-
|
|
138
|
+
"$COMET_BASH" "$COMET_STATE" set <name> direct_override true
|
|
139
|
+
"$COMET_BASH" "$COMET_STATE" set <name> build_mode direct
|
|
107
140
|
```
|
|
108
141
|
|
|
109
142
|
没有 `direct_override: true` 时,full workflow 的 `build_mode=direct` 会被 guard 和状态转换同时拦截。
|
|
@@ -111,7 +144,7 @@ bash "$COMET_STATE" set <name> build_mode direct
|
|
|
111
144
|
**执行隔离**:
|
|
112
145
|
|
|
113
146
|
- **branch**:执行 `git checkout -b <change-name>`,后续工作在新分支上进行
|
|
114
|
-
- **worktree**:必须使用 Skill 工具加载 `
|
|
147
|
+
- **worktree**:必须使用 Skill 工具加载 Superpowers `using-git-worktrees` 技能创建隔离工作区。禁止用普通 shell 命令或原生工具绕过该技能;如该技能不可用,停止流程并提示安装或启用 Superpowers 技能。
|
|
115
148
|
|
|
116
149
|
创建隔离后,确认计划文件可访问(分支方式天然可访问;worktree 方式需确认计划已提交)。
|
|
117
150
|
|
|
@@ -131,10 +164,10 @@ bash "$COMET_STATE" set <name> build_mode direct
|
|
|
131
164
|
| 规模 | 触发条件 | 做法 |
|
|
132
165
|
|------|---------|------|
|
|
133
166
|
| 小 | 遗漏验收场景、边界条件 | 直接编辑 delta spec + design.md,追加 tasks.md 任务 |
|
|
134
|
-
| 中 | 接口变更、新增组件、数据流变化 |
|
|
135
|
-
| 大 | 全新 capability 需求 |
|
|
167
|
+
| 中 | 接口变更、新增组件、数据流变化 | **使用 AskUserQuestion 工具暂停并等待用户确认后**,必须使用 Skill 工具加载 Superpowers `brainstorming` 更新 Design Doc + delta spec |
|
|
168
|
+
| 大 | 全新 capability 需求 | **必须使用 AskUserQuestion 工具暂停并等待用户确认拆分**;用户确认后,通过 `/comet-open` 创建独立 change |
|
|
136
169
|
|
|
137
|
-
**50% 阈值判定**:以 tasks.md
|
|
170
|
+
**50% 阈值判定**:以 tasks.md 初始任务总数为基准,若新增任务数超过该总数的一半,视为超出原计划范围,**必须使用 AskUserQuestion 工具暂停并等待用户决定是否拆分为新 change**。
|
|
138
171
|
|
|
139
172
|
创建独立 change 时必须调用 `/comet-open`,不得直接调用 `/opsx:new`。`/comet-open` 会同时创建 OpenSpec 产物和 `.comet.yaml`,避免新 change 脱离 Comet 状态机。
|
|
140
173
|
|
|
@@ -149,7 +182,7 @@ bash "$COMET_STATE" set <name> build_mode direct
|
|
|
149
182
|
Build 是最长阶段,可能跨越大量任务。为支持上下文压缩后断点恢复:
|
|
150
183
|
|
|
151
184
|
- **每完成一个 task**:立即勾选 tasks.md 并提交代码,确保 `.comet.yaml` 和文件状态持久化
|
|
152
|
-
-
|
|
185
|
+
- **上下文压缩后恢复**:先运行 `"$COMET_BASH" "$COMET_STATE" check <change-name> build --recover`,脚本输出结构化恢复上下文(isolation/build_mode 状态、plan 路径、任务完成进度、恢复动作)。根据 Recovery action 决定下一步。
|
|
153
186
|
- **用户手动修改恢复**:按 `comet/reference/dirty-worktree.md` 协议处理未提交改动。该协议定义了检查步骤、归因分类和禁令。build 阶段的特殊处理:
|
|
154
187
|
1. 归因后,若 diff 暗示计划或 spec 已变化,按 Step 4「Spec 增量更新」分级处理
|
|
155
188
|
- **长任务拆分**:单任务超过 200 行代码变更时,考虑拆分为多个子任务分别提交
|
|
@@ -161,7 +194,7 @@ Build 是最长阶段,可能跨越大量任务。为支持上下文压缩后
|
|
|
161
194
|
- 已显式运行项目对应的构建/测试命令并通过(不要只依赖 guard 自动猜测)
|
|
162
195
|
- `isolation` 已写为 `branch` 或 `worktree`
|
|
163
196
|
- `build_mode` 已写为 `subagent-driven-development`、`executing-plans` 或带显式 override 的 `direct`
|
|
164
|
-
- **阶段守卫**:运行 `
|
|
197
|
+
- **阶段守卫**:运行 `"$COMET_BASH" "$COMET_GUARD" <change-name> build --apply`,全部 PASS 后自动流转到 `phase: verify`
|
|
165
198
|
|
|
166
199
|
Guard 会优先读取项目配置中的命令:
|
|
167
200
|
|
|
@@ -176,13 +209,13 @@ verify_command: <verify command>
|
|
|
176
209
|
退出前运行 guard 自动流转:
|
|
177
210
|
|
|
178
211
|
```bash
|
|
179
|
-
|
|
212
|
+
"$COMET_BASH" "$COMET_GUARD" <change-name> build --apply
|
|
180
213
|
```
|
|
181
214
|
|
|
182
215
|
状态文件自动更新为 `phase: verify`、`verify_result: pending`。
|
|
183
216
|
|
|
184
217
|
## 自动流转
|
|
185
218
|
|
|
186
|
-
|
|
219
|
+
退出条件满足后(包括用户选择工作方式),自动流转到下一阶段:
|
|
187
220
|
|
|
188
221
|
> **REQUIRED NEXT SKILL:** 调用 `comet-verify` skill 进入验证与收尾阶段。
|