Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
02d56b9
feat(comet-classic): add current isolation mode
1919chichi Jul 13, 2026
eb164af
docs(comet): document current isolation flow
1919chichi Jul 13, 2026
bc55eab
chore: bump version to 0.4.0-beta.5
1919chichi Jul 13, 2026
735a868
chore(comet-classic): sync runtime bundle
1919chichi Jul 13, 2026
6dbfc1f
fix(comet-classic): repair current-branch isolation regressions
1919chichi Jul 13, 2026
83c651d
docs: mention isolation: current in README isolation field docs
1919chichi Jul 13, 2026
9ff7b93
test: drop useless escape in comet-scripts build script string
1919chichi Jul 16, 2026
c01f487
fix(comet-classic): allow worktree isolation for preset workflows
1919chichi Jul 16, 2026
bad8660
feat(comet-classic): add branch_action state field
1919chichi Jul 16, 2026
e1ef44b
docs(comet-verify): record branch_action during branch handling (zh)
1919chichi Jul 16, 2026
353a931
docs(comet-archive): drive archive push by branch_action (zh)
1919chichi Jul 16, 2026
ec03b9f
test: reconcile branch_action field and beta.6 version with existing …
1919chichi Jul 16, 2026
901c243
feat: add bound_branch field to classic state model
1919chichi Jul 16, 2026
8471bf0
feat: add shared branch-binding verdict module
1919chichi Jul 16, 2026
3018872
feat: bind current-isolation drift detection to bound_branch
1919chichi Jul 16, 2026
edad77f
fix(comet-classic): restore generic branch-switch check for non-curre…
1919chichi Jul 16, 2026
aa0598d
feat: capture bound_branch on set isolation current
1919chichi Jul 16, 2026
3042fe5
feat: enforce bound_branch drift in state check
1919chichi Jul 16, 2026
9ff5e46
feat: add state rebind subcommand with audit trail
1919chichi Jul 16, 2026
4100b6b
feat: mirror bound_branch drift check in phase guard
1919chichi Jul 16, 2026
7566093
test: reconcile existing fixtures with bound_branch drift checks
1919chichi Jul 16, 2026
b8e8d19
docs: add current-isolation drift decision point to Chinese skills
1919chichi Jul 16, 2026
7b52197
docs: record bound_branch drift detection in changelog
1919chichi Jul 16, 2026
f5a0f2b
Merge origin/master into codex/current-branch-isolation
1919chichi Jul 17, 2026
69001fb
docs: sync current-isolation drift decision point to English skills
1919chichi Jul 17, 2026
a13aa76
docs: restore preset worktree isolation docs
1919chichi Jul 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ skills-lock.json
.agents/

# Superpowers docs (local only)
#docs/superpowers/
docs/superpowers/

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Do not ignore persisted workflow artifacts.

Classic stores design documents and plans under docs/superpowers/. Ignoring the directory prevents newly generated artifacts from entering normal and archive commits, leaving committed state that references missing files.

Proposed fix
-docs/superpowers/
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
docs/superpowers/
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.gitignore at line 92, Remove the docs/superpowers/ entry from .gitignore so
persisted workflow artifacts are tracked and included in normal and archive
commits.


.codegraph/

Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

All notable changes to @rpamis/comet will be documented in this file.

## What's Changed [0.4.0-beta.6] - 2026-07-16

### Added

- **`comet state rebind`**: new command to explicitly re-bind an `isolation: current` change to the current branch after user confirmation, recording an audit event; refuses to run while HEAD is detached or before an initial binding exists.
- **Current-branch isolation drift detection**: `isolation: current` changes now persist their bound branch in the committed change state, so switching branches mid-change is reliably detected at every build/verify/archive entry check and by the write guard; establishing `isolation: current` on a detached HEAD is rejected.

### Changed

- **Preset isolation choice**: hotfix/tweak workflows now require an explicit `branch`, `worktree`, or `current` isolation choice before build instead of silently defaulting to `current`.
- **Archive branch handling records an action**: archive now records which branch handling method was used (`branch_action`: push / keep-local / merged-locally / pushed-pr) alongside `branch_status: handled`.

## What's Changed [0.4.0-beta.5] - 2026-07-14

### Changed
Expand Down
6 changes: 3 additions & 3 deletions README-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ build_mode: subagent-driven-development # 构建方式:subage
build_pause: null # `build_pause` 记录 build 阶段内部暂停点:null 无暂停,`plan-ready` 表示 plan 已生成
subagent_dispatch: null # subagent 分派确认;进入 verify 前需 confirmed
tdd_mode: null # full workflow 的 build 选择:tdd | direct
isolation: branch # 隔离方式:branch | worktree
isolation: branch # 隔离方式:branch | worktree | current
verify_mode: null # 验证模式:light | full
design_doc: docs/superpowers/specs/<design-doc>.md # 设计文档路径
plan: docs/superpowers/plans/YYYY-MM-DD-feature.md # 实现计划路径
Expand Down Expand Up @@ -541,7 +541,7 @@ Comet 通过自动化状态转换确保 agent 执行可靠性:
- 检测未知/拼写错误字段

4. **Build 决策强制** — Guard 和状态转换同时拦截跳过关键选择
- `isolation` 必须是 `branch` 或 `worktree`
- `isolation` 必须是 `branch`、`worktree` 或 `current`
Comment thread
benym marked this conversation as resolved.
- `build_mode` 必须已选择
- `build_pause: plan-ready` 是 plan 生成后的可恢复暂停点,不是 `build_mode`
- full workflow 的 `build_mode: direct` 必须有 `direct_override: true`
Expand Down Expand Up @@ -675,7 +675,7 @@ Benchmark 核心结论:
<b>抖音群(推荐)</b>
</td>
<td align="center" width="180">
<img src="https://github.com/rpamis/comet/blob/master/img/wechat.png" width="120" height="120"><br>
<img src="https://github.com/rpamis/comet/blob/master/img/wechat.jpg" width="120" height="120"><br>
<b>微信群</b>
</td>
<td align="center" width="180">
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ build_mode: subagent-driven-development # Build mode: subagent-
build_pause: null # `build_pause` records an internal build-phase pause point: null none, `plan-ready` means the plan has been generated
subagent_dispatch: null # Dispatch confirmation; confirm before verify
tdd_mode: null # Full-workflow build choice: tdd | direct
isolation: branch # Isolation mode: branch | worktree
isolation: branch # Isolation mode: branch | worktree | current
verify_mode: null # Verification mode: light | full
design_doc: docs/superpowers/specs/<design-doc>.md # Design doc path
plan: docs/superpowers/plans/YYYY-MM-DD-feature.md # Implementation plan path
Expand Down Expand Up @@ -581,7 +581,7 @@ Comet ensures agent execution reliability through automated state transitions:
- Detects unknown/typos fields

4. **Build Decision Enforcement** — Guard and state transitions both block skipped build choices
- `isolation` must be `branch` or `worktree`
- `isolation` must be `branch`, `worktree`, or `current`
- `build_mode` must be selected before leaving build
- `build_pause: plan-ready` is a recoverable pause after plan generation, not a `build_mode`
- Full workflow `build_mode: direct` requires `direct_override: true`
Expand Down Expand Up @@ -721,7 +721,7 @@ Track our development progress and upcoming features on the [Comet Roadmap](http
<b>DouYin (Recommended)</b>
</td>
<td align="center" width="180">
<img src="https://github.com/rpamis/comet/blob/master/img/wechat.png" width="120" height="120"><br>
<img src="https://github.com/rpamis/comet/blob/master/img/wechat.jpg" width="120" height="120"><br>
<b>WeChat</b>
</td>
<td align="center" width="180">
Expand Down
2 changes: 1 addition & 1 deletion assets/manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.4.0-beta.5",
"version": "0.4.0-beta.6",
"skills": [
"comet/SKILL.md",
"comet/reference/auto-transition.md",
Expand Down
20 changes: 14 additions & 6 deletions assets/skills-zh/comet-archive/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ comet state select <change-name>
comet state check <name> archive
```

若入口 `comet state check` 因分支绑定不一致返回 `BLOCKED`(`isolation: current` 的 change 绑定分支与当前分支不同,或当前处于 detached HEAD),这是用户决策点。**必须按 `comet/reference/decision-point.md` 的协议暂停并等待用户明确选择**:切回绑定分支后重试,或在用户明确确认换绑后运行 `comet state rebind <change-name>` 再重试。不得自行切换分支,也不得自行换绑。

验证通过后继续 Step 1。验证失败时脚本会输出具体失败原因。

### 1. 归档前最终确认(阻塞点)
Expand Down Expand Up @@ -104,17 +106,23 @@ git commit -m "chore: archive <change-name>"

### 5. 归档提交后的分支处理

归档提交成功后,**立即执行:** 使用 Skill 工具加载 Superpowers `finishing-a-development-branch` 技能。该步骤必须位于归档与归档提交之后,确保最终分支/PR 包含 spec 合并和归档元数据。
归档提交成功后,读取 `isolation` 字段:

- 若 `isolation: branch` 或 `worktree`:**立即执行:** 使用 Skill 工具加载 Superpowers `finishing-a-development-branch` 技能。该步骤必须位于归档与归档提交之后,确保最终分支/PR 包含 spec 合并和归档元数据。如该技能不可用,停止流程并提示安装或启用;不得把 `branch_status` 标记为完成。技能加载后,按 `comet/reference/decision-point.md` 暂停让用户选择,并写入对应 `branch_action`:
1. 本地合并到主分支 → `branch_action: merged-locally`
2. 推送并创建 PR → `branch_action: pushed-pr`
3. 保持当前分支稍后处理 → `branch_action: keep-local`

如该技能不可用,停止流程并提示安装或启用;不得把 `branch_status` 标记为完成。技能加载后,按 `comet/reference/decision-point.md` 暂停让用户选择:
归档已经完成,因此这里不提供“丢弃工作”选项。

1. 本地合并到主分支
2. 推送并创建 PR
3. 保持当前分支稍后处理
- 若 `isolation: current`:没有独立开发分支要收尾。这是用户决策点,**必须按 `comet/reference/decision-point.md` 的协议暂停并等待用户明确选择**,并写入对应 `branch_action`:
1. 立即 push 当前分支 → `branch_action: push`
2. 暂不 push,保留本地分支状态 → `branch_action: keep-local`

归档已经完成,因此这里不提供“丢弃工作”选项。只有用户选择的操作成功完成(或明确选择保持分支)后,才运行:
只有用户选择的操作成功完成(或明确选择保持分支)后,才运行:

```bash
comet state set <change-name> branch_action <value>
comet state set <change-name> branch_status handled
comet guard <change-name> archive
comet state clear-selection
Expand Down
20 changes: 16 additions & 4 deletions assets/skills-zh/comet-build/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ comet state select <change-name>
comet state check <name> build
```

若入口 `comet state check` 因分支绑定不一致返回 `BLOCKED`(`isolation: current` 的 change 绑定分支与当前分支不同,或当前处于 detached HEAD),这是用户决策点。**必须按 `comet/reference/decision-point.md` 的协议暂停并等待用户明确选择**:切回绑定分支后重试,或在用户明确确认换绑后运行 `comet state rebind <change-name>` 再重试。不得自行切换分支,也不得自行换绑。

验证通过后继续 Step 1。验证失败时脚本会输出具体失败原因。

**幂等性**:build 阶段所有操作可安全重复执行。读取 `.comet.yaml` 的 `phase` 字段确认仍在 build 阶段,读取 plan 文件头的 `base-ref`,再按文档顺序解析 tasks.md 的复选框,从第一个未勾选任务继续执行。已提交的任务不得重复提交。
Expand Down Expand Up @@ -118,10 +120,12 @@ comet state set <name> build_pause null
|------|------|------|
| A | 创建分支 | 在当前仓库创建新分支,简单快速 |
| B | 创建 Worktree | 隔离工作区,完全独立,适合并行开发 |
| C | 使用当前分支 | 不创建新分支或 worktree,直接在当前分支继续 |

**推荐规则**:
- 变更涉及 ≤ 3 个文件 → 推荐 A
- 需要并行开发、当前分支有未提交工作 → 推荐 B
- 当前分支本身就是长期集成分支、子模块工作分支,或用户明确要求不新建分支/worktree → 推荐 C

**执行方式**:

Expand All @@ -135,12 +139,12 @@ comet state set <name> build_pause null
- 任务数 ≤ 2 且无跨模块依赖 → 推荐 B
- 来自 hotfix 路径 → 推荐 B

这些表格是 Step 2 联合决策的一部分,不再单独暂停。先移除能力预检判定为不可执行的选项;在剩余多个合法选项时,不得根据推荐规则自行选择 `branch` 或 `worktree`,也不得自行选择执行方式、TDD 模式或代码审查模式。推荐规则只能用于说明建议,不能替代用户确认。
这些表格是 Step 2 联合决策的一部分,不再单独暂停。先移除能力预检判定为不可执行的选项;在剩余多个合法选项时,不得根据推荐规则自行选择 `branch`、`worktree` 或 `current`,也不得根据推荐规则自行选择执行方式、TDD 模式或代码审查模式。推荐规则只能用于说明建议,不能替代用户确认。

用户选择后,更新 `isolation`、执行方式、TDD 模式和代码审查模式相关字段:

```bash
comet state set <name> isolation <branch|worktree>
comet state set <name> isolation <branch|worktree|current>
```

- 若用户选择 `executing-plans`:运行 `comet state set <name> subagent_dispatch null`,再运行 `comet state set <name> build_mode executing-plans`
Expand Down Expand Up @@ -200,6 +204,14 @@ comet state set <name> build_mode direct

- **worktree**:必须使用 Skill 工具加载 Superpowers `using-git-worktrees` 技能创建隔离工作区。禁止用普通 shell 命令或原生工具绕过该技能;如该技能不可用,停止流程并提示安装或启用 Superpowers 技能。

- **current**:不创建新分支,也不创建 worktree。立即运行:

```bash
comet state set <name> isolation current
```

随后继续在当前分支执行,不要因为没有 branch/worktree 切换而额外重新选择 current change。只有当后续实际发生 branch 切换时,才按 stale selection 处理并重新绑定。

创建隔离后,确认计划文件可访问(分支方式天然可访问;worktree 方式需确认计划已提交)。若 worktree 模式下计划文件尚未提交,先提交计划文件再创建 worktree:

```bash
Expand All @@ -213,7 +225,7 @@ git commit -m "chore: add implementation plan"
comet state select <change-name>
```

重新绑定成功后才能开始源码写入。
`current` 模式不发生工作区切换时,不需要为了这一步重复绑定;保留当前工作区的既有选择即可。重新绑定成功后才能开始源码写入。

**执行计划**:必须按 `build_mode` 的真实运行位置处理。

Expand Down Expand Up @@ -288,7 +300,7 @@ Build 是最长阶段,可能跨越大量任务。为支持上下文压缩后
- tasks.md 全部勾选
- 代码已提交
- 已显式运行项目对应的构建/测试命令并通过(不要只依赖 guard 自动猜测)
- `isolation` 已写为 `branch` 或 `worktree`
- `isolation` 已写为 `branch`、`worktree` 或 `current`
- `build_mode` 已写为 `subagent-driven-development`、`executing-plans` 或带显式 override 的 `direct`;若为 `subagent-driven-development`,`subagent_dispatch` 必须为 `confirmed`
- `tdd_mode` 已写为 `tdd` 或 `direct`
- `review_mode` 已写为 `off`、`standard` 或 `thorough`
Expand Down
25 changes: 21 additions & 4 deletions assets/skills-zh/comet-hotfix/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ description: "仅在用户明确调用 /comet-hotfix,或由 Comet 根 Skill/ru

恢复已有 hotfix change 时,第一项状态操作必须是 `comet state select <change-name>`;创建新 change 时,在 `.comet.yaml` 初始化成功后立即运行该命令,再进入源码写入步骤。

若入口 `comet state check` 因分支绑定不一致返回 `BLOCKED`(`isolation: current` 的 change 绑定分支与当前分支不同,或当前处于 detached HEAD),这是用户决策点。**必须按 `comet/reference/decision-point.md` 的协议暂停并等待用户明确选择**:切回绑定分支后重试,或在用户明确确认换绑后运行 `comet state rebind <change-name>` 再重试。不得自行切换分支,也不得自行换绑。

### 1. 快速开启(预设 open)

复用 Comet open 能力创建 change,但使用 hotfix 默认值:不执行 `openspec-explore` 长探索,直接进入精简 change 创建。
Expand All @@ -42,7 +44,7 @@ comet state select <name>
comet state check <name> open
```

hotfix 默认 `isolation: current`,表示在当前工作区执行;只有用户实际创建/选择了分支或 worktree 后,才能把它改为 `branch` 或 `worktree`。随后按指引创建精简版产物:
hotfix 初始保持 `isolation: null`。在 Step 2 明确选择隔离方式前,不要假定工作区。随后按指引创建精简版产物:
- `proposal.md` — 问题描述 + 根因分析 + 修复目标(无需方案对比)
- `design.md` — 修复方案(1 个即可,无需多方案对比)
- `tasks.md` — 修复任务清单
Expand All @@ -65,7 +67,21 @@ comet state next <name>

### 2. 直接构建(预设 build)

使用 hotfix 默认值:`build_mode: direct`、`tdd_mode: direct`、`review_mode: off`、`isolation: current`。`direct` 表示不进入完整规划/TDD 编排,不表示可以跳过复现、回归测试或验证。跳过 Superpowers `brainstorming` 和 `writing-plans`;**任务数量本身不触发 `/comet-build`**,任务较多时仍在当前 hotfix 的 tasks.md 中按顺序执行,只有命中后文质变信号或范围 tripwire 才交给用户决定是否升级 full。
开始执行前,必须先让用户显式选择隔离方式。这是用户决策点,必须按 `comet/reference/decision-point.md` 暂停并等待用户明确选择:

- A. 创建分支(推荐默认)
- B. 使用 worktree
- C. 使用当前分支

用户选择后立即写入:

```bash
comet state set <name> isolation <branch|worktree|current>
```

若选择 `branch`,按 `/comet-build` 中的 branch 规则确认分支名并创建分支,然后重新执行 `comet state select <change-name>` 绑定当前 change。若选择 `worktree`,按 `/comet-build` 中的 worktree 规则创建隔离工作区,并在 worktree 内重新执行 `comet state select <change-name>`。若选择 `current`,不创建新分支或 worktree,也不要因为没有切换工作区而额外重新选择。

使用 hotfix 默认值:`build_mode: direct`、`tdd_mode: direct`、`review_mode: off`。`direct` 表示不进入完整规划/TDD 编排,不表示可以跳过复现、回归测试或验证。跳过 Superpowers `brainstorming` 和 `writing-plans`;**任务数量本身不触发 `/comet-build`**,任务较多时仍在当前 hotfix 的 tasks.md 中按顺序执行,只有命中后文质变信号或范围 tripwire 才交给用户决定是否升级 full。

继续或开始修改前,按 `comet/reference/dirty-worktree.md` 协议处理未提交改动。若归因后发现修复命中质变信号或文件数 tripwire,按本文件「升级判定」处理。

Expand Down Expand Up @@ -139,8 +155,9 @@ comet guard <change-name> build --apply
Hotfix 流程默认 **一次性连续执行**。调用 `/comet-hotfix` 后,agent 在 hotfix 自有步骤间自动推进,不主动停顿。**例外**:若 `auto_transition: false`,则在每个 phase 边界(build/verify/archive 之间)结束当前调用并按 `HINT` 交还控制权,由用户稍后手动运行下一阶段命令;这是手动衔接,不是新的确认点。无论 `auto_transition` 取何值,以下真正的用户决策仍需暂停:

1. 遇到升级判定信号(见「升级判定」章节),**必须使用当前平台可用的用户输入/确认机制暂停并等待用户明确选择**:继续 hotfix 流程,还是升级为完整 `/comet` 流程
2. 验证阶段(comet-verify)接受 WARNING/SUGGESTION 偏差、处理 Spec 漂移或超过自动修复上限后的策略决策;前 3 次明确可修复失败自动闭环
3. 归档前最终确认,以及归档提交后的分支处理决策
2. 初始隔离选择(`branch` / `worktree` / `current`)
3. 验证阶段(comet-verify)接受 WARNING/SUGGESTION 偏差、处理 Spec 漂移或超过自动修复上限后的策略决策;前 3 次明确可修复失败自动闭环
4. 归档前最终确认,以及归档提交后的分支处理决策

执行顺序:快速开启 → 直接构建 → 根因消除检查 → 验证 → 归档 → 完成

Expand Down
Loading
Loading