Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@rpamis/comet

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rpamis/comet - npm Package Compare versions

Comparing version
0.3.6
to
0.3.7
+90
assets/skills/comet/rules/comet-phase-guard.md
# Comet 阶段感知(防漂移规则)
> 此规则每轮注入,防止长上下文时遗忘 Comet 流程状态。
> Hook 平台额外执行 `comet-hook-guard.sh` 进行硬性拦截;
> 此 Rule 是所有平台通用的软性防线。
## 全局规则
### 阶段感知(最高优先级)
有活跃 comet change 时(`openspec/changes/<name>/.comet.yaml` 存在),**每次开始执行操作前**必须读取 `phase` 字段确认当前阶段。
**阶段与允许操作:**
| 阶段 | 允许 | 禁止 |
|------|------|------|
| `open` | 创建 proposal/design/tasks, 运行 guard | 写源代码 |
| `design` | brainstorming, 创建 Design Doc, 运行 guard | 写源代码 |
| `build` | 写源代码、测试、执行计划 | 跳过用户确认点 |
| `verify` | 验证、branch handling | 跳过失败处理 |
| `archive` | 确认归档、运行归档脚本 | 写源代码 |
### Skill 调用(不可用普通对话替代)
以下操作必须通过 Skill 工具加载,Skill 不可用时应停止流程并提示安装:
- **brainstorming** — design 阶段、build 阶段中等规模 spec 变更
- **writing-plans** — build 阶段创建实现计划
- **executing-plans** / **subagent-driven-development** — build 阶段执行
- **test-driven-development** — build 阶段 `tdd_mode: tdd` 时,第一个 task 前
- **systematic-debugging** — 遇到崩溃/测试失败/构建失败时
- **verification-before-completion** — verify 阶段
- **using-git-worktrees** — build 阶段选择 worktree 隔离时
### 脚本执行(不可跳过)
- **阶段退出**: `comet-guard <name> <phase> --apply`(必须看到 ALL CHECKS PASSED)
- **压缩恢复**: `comet-state check <name> <phase> --recover`
- **状态更新**: 关键操作后通过 `comet-state set` 更新字段,禁止手工编辑 .comet.yaml
- **handoff 生成**: `comet-handoff <name> design --write`(禁止手写摘要)
### 用户确认(不可自动跳过)
以下决策点必须暂停等待用户明确选择,不得根据推荐规则自动填写:
- **open**: 需求澄清完成确认、artifact 评审确认
- **design**: brainstorming 方案确认(确认前不得创建 Design Doc)
- **build**: plan-ready 暂停、isolation/build_mode/tdd_mode 选择、spec 大规模变更确认
- **verify**: 验证失败处理策略、branch handling 选择
- **archive**: 归档前最终确认
## Design 阶段专项
1. 第一个脚本操作 = `comet-handoff <name> design --write`(未生成 handoff 禁止加载 brainstorming)
2. brainstorming in progress: incrementally update brainstorm-summary.md(每轮澄清或方案迭代后增量更新恢复检查点,未确认内容标注为待确认/候选)
3. brainstorming 完成后下一步 = brainstorm-summary.md 定稿 → Design Doc → guard
4. active compaction gate: brainstorm-summary.md 定稿后、创建 Design Doc 前,优先触发宿主平台原生上下文压缩;无法程序化触发时暂停提示用户手动压缩或确认继续
5. **绝对不能直接开始写实现代码** — 必须先创建 Design Doc 并通过 guard
## Build 阶段专项
1. plan 创建后必须询问用户选择继续或暂停(`build_pause` 机制)
2. 每个 task 完成后必须: tasks.md 打勾 → git commit(不得积攒)
3. 遇到失败必须加载 **systematic-debugging** skill,根因未定位前不得提出源码修复
4. spec 变更分级: 小改直接编辑 | 中改加载 brainstorming | 大改暂停等用户确认拆分
## Verify 阶段专项
1. 第一步运行 `comet-state scale <name>` 确定验证级别
2. 验证失败后列出失败项等用户选择,CRITICAL 必须修
3. 连续 3 次失败后必须让用户选择接受偏差或继续修
## 上下文压缩恢复
如果怀疑发生上下文压缩(之前对话被摘要、找不到之前讨论的内容),立即运行:
```bash
"$COMET_BASH" "$COMET_STATE" check <name> <phase> --recover
```
按脚本输出的 **Recovery action** 决定下一步。
## 阶段退出后自动过渡
guard `--apply` 成功后,必须调用下一阶段的 skill:
- open → `comet-design`(full)/ `comet-build`(hotfix/tweak)
- design → `comet-build`
- build → `comet-verify`
- verify → `comet-archive`
#!/bin/bash
# comet-hook-guard.sh — PreToolUse hook for Comet phase enforcement
#
# Blocks file writes (Write/Edit) when the active Comet change is in
# a phase that does not allow source code modifications (open/design/archive).
#
# Usage (called by harness, not directly):
# PreToolUse matcher "Write|Edit" → this script
# Stdin: JSON {"tool_name":"Write|Edit","tool_input":{"file_path":"..."}}
# Exit 0 = allow
# Exit 2 = blocked (stderr message shown to user)
#
# Cross-platform: macOS / Linux / Windows Git Bash
# shellcheck disable=SC2329
set -euo pipefail
# ── Extract target file path ──────────────────────────────────────
TARGET=""
# Method 1: FILE_PATH environment variable (set by some harnesses)
if [ -n "${FILE_PATH:-}" ]; then
TARGET="$FILE_PATH"
fi
# Method 2: Parse stdin JSON
if [ -z "$TARGET" ]; then
INPUT=""
if [ ! -t 0 ]; then
INPUT=$(cat 2>/dev/null || true)
fi
if [ -n "$INPUT" ]; then
# Extract file_path value — works for both Write and Edit tool inputs
TARGET=$(printf '%s' "$INPUT" \
| grep -oE '"file_path"[[:space:]]*:[[:space:]]*"[^"]*"' 2>/dev/null \
| head -1 \
| sed 's/^"file_path"[[:space:]]*:[[:space:]]*"//' \
| sed 's/"$//' \
|| true)
fi
fi
# No target found — allow (not a file-path-bearing operation)
if [ -z "$TARGET" ]; then
echo "[COMET-HOOK] allowed: no file path in tool input" >&2
exit 0
fi
# Normalize to forward slashes, collapse doubles from JSON escaping (\\ → //)
TARGET=$(printf '%s' "$TARGET" | sed 's|\\|/|g' | sed 's|///*|/|g')
# ── Find active Comet change ─────────────────────────────────────
YAML_FILE=""
if [ -d "openspec/changes" ]; then
for dir in openspec/changes/*/; do
[ -d "$dir" ] || continue
# Skip archived changes
case "$dir" in
*/archive/*) continue ;;
esac
if [ -f "${dir}.comet.yaml" ]; then
YAML_FILE="${dir}.comet.yaml"
break
fi
done
fi
# No active change — allow all writes
if [ -z "$YAML_FILE" ]; then
echo "[COMET-HOOK] allowed: no active comet change" >&2
exit 0
fi
# ── Read current phase ───────────────────────────────────────────
PHASE=$(grep "^phase:" "$YAML_FILE" 2>/dev/null \
| awk '{print $2}' \
| tr -d '[:space:][:cntrl:]' \
|| true)
if [ -z "$PHASE" ]; then
echo "[COMET-HOOK] allowed: no phase in .comet.yaml" >&2
exit 0
fi
# ── Resolve to project-relative path ─────────────────────────────
# Normalize helper: forward slashes only
norm() { printf '%s' "$1" | sed 's|\\|/|g'; }
RELPATH=$(norm "$TARGET")
# If already relative, use as-is
case "$RELPATH" in
/*|[A-Za-z]:/*)
# Absolute — try stripping CWD prefixes
CWD_UNIX=$(norm "$(pwd)")
CWD_PHYS=$(norm "$(pwd -P 2>/dev/null || pwd)")
# Try: TARGET as-is vs CWD logical
if [ "${RELPATH#"$CWD_UNIX"/}" != "$RELPATH" ]; then
RELPATH="${RELPATH#"$CWD_UNIX"/}"
# Try: TARGET as-is vs CWD physical (macOS /var → /private/var)
elif [ "${RELPATH#"$CWD_PHYS"/}" != "$RELPATH" ]; then
RELPATH="${RELPATH#"$CWD_PHYS"/}"
else
# Resolve TARGET's parent through filesystem (handles symlinked TARGET path)
_PDIR=$(cd "$(dirname "$TARGET")" 2>/dev/null && pwd -P 2>/dev/null || true)
if [ -n "$_PDIR" ]; then
_TRESOLVED=$(norm "${_PDIR}/$(basename "$TARGET")")
if [ "${_TRESOLVED#"$CWD_UNIX"/}" != "$_TRESOLVED" ]; then
RELPATH="${_TRESOLVED#"$CWD_UNIX"/}"
elif [ "${_TRESOLVED#"$CWD_PHYS"/}" != "$_TRESOLVED" ]; then
RELPATH="${_TRESOLVED#"$CWD_PHYS"/}"
fi
fi
fi
;;
esac
# ── Whitelist: phase-aware allowed paths ─────────────────────────
case "$RELPATH" in
openspec/*)
# OpenSpec artifacts — phase-aware sub-check
case "$PHASE" in
open)
# open: allow proposal, design, tasks, yaml, handoff, specs
case "$RELPATH" in
*/proposal.md|*/design.md|*/tasks.md|*/.openspec.yaml|*/.comet.yaml|*/.comet/*|*/specs/*)
echo "[COMET-HOOK] allowed: $RELPATH (phase: open, openspec artifacts)" >&2
exit 0
;;
esac
;;
design)
# design: allow handoff, delta spec (Spec Patch), proposal/design/tasks (minor refinements), .comet.yaml
case "$RELPATH" in
*/proposal.md|*/design.md|*/tasks.md|*/.comet/*|*/specs/*|*/.comet.yaml|*/.openspec.yaml)
echo "[COMET-HOOK] allowed: $RELPATH (phase: design, handoff/spec)" >&2
exit 0
;;
esac
;;
build)
# build: allow delta spec (incremental update), tasks, .comet.yaml
case "$RELPATH" in
*/specs/*|*/tasks.md|*/.comet.yaml|*/.openspec.yaml)
echo "[COMET-HOOK] allowed: $RELPATH (phase: build, spec/tasks)" >&2
exit 0
;;
esac
;;
verify)
# verify: allow tasks (post-check), .comet.yaml
case "$RELPATH" in
*/tasks.md|*/.comet.yaml|*/.openspec.yaml)
echo "[COMET-HOOK] allowed: $RELPATH (phase: verify, tasks/state)" >&2
exit 0
;;
esac
;;
archive)
# archive: allow .comet.yaml state updates only
case "$RELPATH" in
*/.comet.yaml|*/.openspec.yaml)
echo "[COMET-HOOK] allowed: $RELPATH (phase: archive, state)" >&2
exit 0
;;
esac
;;
esac
;;
docs/superpowers/*)
# Superpowers artifacts — phase-aware sub-check
case "$PHASE" in
design)
echo "[COMET-HOOK] allowed: $RELPATH (phase: design, superpowers)" >&2
exit 0
;;
build)
echo "[COMET-HOOK] allowed: $RELPATH (phase: build, superpowers)" >&2
exit 0
;;
verify)
echo "[COMET-HOOK] allowed: $RELPATH (phase: verify, superpowers)" >&2
exit 0
;;
esac
# open/archive: block docs/superpowers writes
;;
.comet/*|*/.comet/*)
# Comet config
echo "[COMET-HOOK] allowed: $RELPATH (whitelist: comet config)" >&2
exit 0
;;
.claude/*)
# Claude settings/rules
echo "[COMET-HOOK] allowed: $RELPATH (whitelist: claude config)" >&2
exit 0
;;
CLAUDE.md|CHANGELOG.md|README.md|*.md)
# Root-level markdown files
case "$RELPATH" in
*/*) ;; # subdirectory .md — NOT whitelisted, fall through
*)
echo "[COMET-HOOK] allowed: $RELPATH (whitelist: root markdown)" >&2
exit 0
;;
esac
;;
.comet.yaml|comet.yaml|.comet.yml|comet.yml)
# Project-level comet config
echo "[COMET-HOOK] allowed: $RELPATH (whitelist: comet config)" >&2
exit 0
;;
esac
# ── Phase-based enforcement ──────────────────────────────────────
case "$PHASE" in
build|verify)
# Code writes allowed in build and verify
echo "[COMET-HOOK] allowed: $RELPATH (phase: $PHASE)" >&2
exit 0
;;
open|design|archive)
echo "" >&2
echo "╔══════════════════════════════════════════╗" >&2
echo "║ COMET PHASE GUARD — WRITE BLOCKED ║" >&2
echo "╚══════════════════════════════════════════╝" >&2
echo "" >&2
echo " 当前阶段: $PHASE" >&2
echo " 目标文件: $RELPATH" >&2
echo "" >&2
case "$PHASE" in
open)
echo " ❌ open 阶段不允许写源代码" >&2
echo " ✅ 允许: 创建 proposal/design/tasks, 运行 guard" >&2
echo " 💡 完成需求澄清和 artifact 创建后运行 guard --apply" >&2
;;
design)
echo " ❌ design 阶段不允许写源代码" >&2
echo " ✅ 允许: brainstorming, 创建 Design Doc, 运行 guard" >&2
echo " 💡 完成 Design Doc 后运行 comet-guard design --apply 进入 build" >&2
;;
archive)
echo " ❌ archive 阶段不允许写源代码" >&2
echo " ✅ 允许: 确认归档, 运行归档脚本" >&2
;;
esac
echo "" >&2
exit 2
;;
esac
echo "[COMET-HOOK] allowed: $RELPATH (phase: $PHASE)" >&2
exit 0
import type { InstallScope } from './types.js';
declare const CODEGRAPH_SUPPORTED_TARGETS: Record<string, string>;
declare function filterSupportedPlatforms(platformIds: string[]): {
supported: string[];
unsupported: string[];
};
declare function installCodegraph(projectPath: string, platformIds: string[], scope: InstallScope): Promise<'installed' | 'failed' | 'skipped'>;
export { installCodegraph, filterSupportedPlatforms, CODEGRAPH_SUPPORTED_TARGETS };
//# sourceMappingURL=codegraph.d.ts.map
{"version":3,"file":"codegraph.d.ts","sourceRoot":"","sources":["../../src/core/codegraph.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,QAAA,MAAM,2BAA2B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAQvD,CAAC;AAEF,iBAAS,wBAAwB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG;IACxD,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAaA;AAuBD,iBAAe,gBAAgB,CAC7B,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EAAE,EACrB,KAAK,EAAE,YAAY,GAClB,OAAO,CAAC,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAC,CA+D7C;AAED,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,2BAA2B,EAAE,CAAC"}
import { execFileSync } from 'child_process';
import { isCommandAvailable, getNpmExecutable } from './openspec.js';
import { printCommandErrorDetails } from './command-error.js';
const CODEGRAPH_SUPPORTED_TARGETS = {
claude: 'claude',
cursor: 'cursor',
codex: 'codex',
opencode: 'opencode',
gemini: 'gemini',
kiro: 'kiro',
antigravity: 'antigravity',
};
function filterSupportedPlatforms(platformIds) {
const supported = [];
const unsupported = [];
for (const id of platformIds) {
if (CODEGRAPH_SUPPORTED_TARGETS[id]) {
supported.push(CODEGRAPH_SUPPORTED_TARGETS[id]);
}
else {
unsupported.push(id);
}
}
return { supported, unsupported };
}
async function ensureCodegraphCli(projectPath) {
if (isCommandAvailable('codegraph')) {
return true;
}
console.log(' Installing CodeGraph CLI...');
try {
execFileSync(getNpmExecutable(), ['install', '-g', '@colbymchenry/codegraph'], {
cwd: projectPath,
stdio: 'inherit',
timeout: 180_000,
shell: process.platform === 'win32',
});
return isCommandAvailable('codegraph');
}
catch (error) {
console.error(` Failed to install CodeGraph CLI: ${error.message}`);
printCommandErrorDetails(error);
return false;
}
}
async function installCodegraph(projectPath, platformIds, scope) {
const { supported, unsupported } = filterSupportedPlatforms(platformIds);
if (supported.length === 0) {
if (unsupported.length > 0) {
console.log(` CodeGraph: no supported platforms among selected (${unsupported.join(', ')}). Skipping.`);
}
return 'skipped';
}
if (unsupported.length > 0) {
console.log(` CodeGraph: skipping unsupported platforms: ${unsupported.join(', ')}`);
}
const cliReady = await ensureCodegraphCli(projectPath);
if (!cliReady) {
console.error(' CodeGraph CLI not available. Install manually: npm install -g @colbymchenry/codegraph');
return 'failed';
}
const location = scope === 'global' ? 'global' : 'local';
try {
console.log(` Running: codegraph install --target=${supported.join(',')} --location=${location} --yes`);
execFileSync('codegraph', ['install', `--target=${supported.join(',')}`, `--location=${location}`, '--yes'], {
cwd: projectPath,
stdio: 'inherit',
timeout: 120_000,
shell: process.platform === 'win32',
});
}
catch (error) {
console.error(` CodeGraph install failed: ${error.message}`);
printCommandErrorDetails(error);
return 'failed';
}
if (scope === 'project') {
try {
console.log(' Running: codegraph init -i');
execFileSync('codegraph', ['init', '-i'], {
cwd: projectPath,
stdio: 'inherit',
timeout: 300_000,
shell: process.platform === 'win32',
});
}
catch (error) {
console.error(` CodeGraph init failed: ${error.message}`);
printCommandErrorDetails(error);
return 'failed';
}
}
return 'installed';
}
export { installCodegraph, filterSupportedPlatforms, CODEGRAPH_SUPPORTED_TARGETS };
//# sourceMappingURL=codegraph.js.map
{"version":3,"file":"codegraph.js","sourceRoot":"","sources":["../../src/core/codegraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAI9D,MAAM,2BAA2B,GAA2B;IAC1D,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,aAAa;CAC3B,CAAC;AAEF,SAAS,wBAAwB,CAAC,WAAqB;IAIrD,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,MAAM,WAAW,GAAa,EAAE,CAAC;IAEjC,KAAK,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I,CAAC;YACH,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;YAC9C,YAAY,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE;gBACxC,GAAG,EAAE,WAAW;gBAChB,KAAK,EAAE,SAAS;gBAChB,OAAO,EAAE,OAAO;gBAChB,KAAK,EAAE,OAAO,CAAC,QAAQ,KAAK,OAAO;aACpC,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,8BAA+B,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;YACxE,wBAAwB,CAAC,KAAK,CAAC,CAAC;YAChC,OAAO,QAAQ,CAAC;QAClB,CAAC;IACH,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,2BAA2B,EAAE,CAAC"}
+11
-1
{
"version": "0.3.2",
"version": "0.3.3",
"skills": [

@@ -12,2 +12,3 @@ "comet/SKILL.md",

"comet/scripts/comet-yaml-validate.sh",
"comet/scripts/comet-hook-guard.sh",
"comet-open/SKILL.md",

@@ -21,2 +22,11 @@ "comet-design/SKILL.md",

],
"rules": [
"comet/rules/comet-phase-guard.md"
],
"hooks": {
"comet/scripts/comet-hook-guard.sh": {
"matcher": "Write|Edit",
"description": "Block code writes in wrong Comet phase (open/design/archive)"
}
},
"languages": [

@@ -23,0 +33,0 @@ { "id": "en", "name": "English", "skillsDir": "skills" },

+44
-11
---
name: comet-archive
description: "Comet 阶段 5:归档。用 /comet-archive 调用。同步 delta spec 到主 spec,归档 change。"
description: "Comet 阶段 5:归档。用 /comet-archive 调用。按 OpenSpec delta 语义合并主 spec,归档 change。"
---

@@ -16,4 +16,8 @@

### 0. 入口状态验证(Entry Check)
### 0. 输出语言约束
归档摘要和生命周期闭环说明必须使用触发本次工作流的用户请求语言。
### 0b. 入口状态验证(Entry Check)
执行入口验证:

@@ -33,4 +37,21 @@

### 1. 执行归档
### 1. 归档前最终确认(阻塞点)
入口验证通过后,**必须使用当前平台可用的用户输入/确认机制暂停并等待用户确认是否立即归档**。不得在用户确认前运行 `"$COMET_BASH" "$COMET_ARCHIVE" "<change-name>"`。若当前平台没有结构化提问工具,则在对话中提出同等单选问题并停止流程,等待用户回复后才能继续。
确认前必须向用户展示简短摘要:
- change 名称
- 验证报告路径和结论
- 分支处理状态
- 本次归档将执行的不可逆动作:按 OpenSpec delta 语义合并主 spec、标注 design doc / plan、移动 change 到 archive 目录
用户确认问题必须以单选题形式呈现,包含以下选项:
- 「确认归档」— 立即执行归档脚本,完成 spec 合并和 change 移动
- 「需要调整或重新验证」— 不执行归档;运行 `"$COMET_BASH" "$COMET_STATE" transition <change-name> archive-reopen` 回到 `phase: verify`,再调用 `/comet-verify`。若验证阶段确认需要修复,再按 `/comet-verify` 的验证失败决策回到 `/comet-build`
- 「暂不归档」— 不执行归档,保留当前 `phase: archive` 状态,等待用户稍后再次调用 `/comet-archive`
只有用户选择「确认归档」后,才允许继续 Step 2。用户选择「需要调整或重新验证」后,必须先执行 `archive-reopen` 状态回退,不得手动编辑 `.comet.yaml`。
### 2. 执行归档
运行归档脚本,自动完成以下全部步骤:

@@ -44,6 +65,6 @@

1. 入口状态验证(phase=archive, verify_result=pass, archived=false)
2. Delta spec 同步到主 spec
3. Design doc 前置元数据标注(archived-with, status)
4. Plan 前置元数据标注(archived-with)
5. 移动 change 到归档目录
2. Design doc 前置元数据标注(archived-with, status)
3. Plan 前置元数据标注(archived-with)
4. 调用 OpenSpec archive 按 delta 语义合并主 spec 并移动 change 到归档目录
5. 校验主 spec 未残留 delta-only section 标题
6. 通过 `comet-state transition <archive-name> archived` 更新 `archived: true`

@@ -55,11 +76,11 @@

当待同步的 delta spec 与已有主 spec 不一致时,脚本会在覆盖前打印 unified diff 预览,帮助确认归档同步内容。
脚本会调用 OpenSpec 归档能力按 `ADDED/MODIFIED/REMOVED/RENAMED` 语义合并主 spec,并在归档后校验主 spec 中没有残留 delta-only section 标题。
如需预览而不实际执行,使用 `--dry-run` 参数。
### 2. 生命周期闭环
### 3. 生命周期闭环
Spec 生命周期在此完成:
```
brainstorming → delta spec → 实施 → 验证 → 主 spec 覆盖 → design doc 标注 → 归档
brainstorming → delta spec → 实施 → 验证 → 主 spec 合并 → design doc 标注 → 归档
```

@@ -73,6 +94,18 @@

归档脚本会把 `openspec/changes/<name>/` 移动到 `openspec/changes/archive/YYYY-MM-DD-<name>/`。归档成功后**不要再对原 change 名运行** `"$COMET_BASH" "$COMET_GUARD" <change-name> archive`,因为原活跃目录已经不存在。归档完整性以脚本退出码和归档目录状态为准。
归档脚本会把 `openspec/changes/<name>/` 移动到 `openspec/changes/archive/YYYY-MM-DD-<name>/`。
> **WARNING**: 归档成功后**不要再对原 change 名运行** `"$COMET_BASH" "$COMET_GUARD" <change-name> archive`,因为原活跃目录已经不存在。误调会导致 guard 报错"change directory not found"。归档完整性以脚本退出码和归档目录状态为准。
## 完成
Comet 流程全部完成。如需开始新工作,调用 `/comet` 或 `/comet-open`。
## 上下文压缩恢复
归档阶段在执行过程中可能触发上下文压缩。恢复时先运行:
```bash
"$COMET_BASH" "$COMET_STATE" check <change-name> archive --recover
```
脚本输出结构化恢复上下文(归档状态、已完成步骤)。按 Recovery action 判断下一步。若 `archived: true` 且归档目录存在,归档已完成,无需再次执行归档操作。

@@ -31,9 +31,18 @@ ---

**幂等性**:build 阶段所有操作可安全重复执行。读取 `.comet.yaml` 的 `phase` 字段确认仍在 build 阶段,读取 plan 文件头的 `base-ref`,再读取 tasks.md 找到第一个未勾选任务继续执行。已提交的任务不得重复提交。
**幂等性**:build 阶段所有操作可安全重复执行。读取 `.comet.yaml` 的 `phase` 字段确认仍在 build 阶段,读取 plan 文件头的 `base-ref`,再用 `grep -n '\- \[ \]' tasks.md | head -1` 找到第一个未勾选任务继续执行。已提交的任务不得重复提交。
### 1. 制定计划
### 1. 制定计划(Subagent Offload)
**立即执行:** 使用 Skill 工具加载 Superpowers `writing-plans` 技能。禁止跳过此步骤。
通过 subagent 创建实施计划,避免 planning skill 占用主 session 上下文。计划文件和执行反馈必须使用触发本次工作流的用户请求语言。
技能加载后,按其指引制定计划。计划要求:
**Subagent 指令**:
你是实施计划专家。基于以下输入创建实施计划:
1. **立即执行:** 使用 Skill 工具加载 Superpowers `writing-plans` 技能。禁止跳过此步骤。技能加载后,ARGUMENTS 必须包含:`Language: 使用触发本次工作流的用户请求语言输出`
2. 读取 Design Doc(`docs/superpowers/specs/` 下的技术设计文档)
3. 读取 `openspec/changes/<name>/tasks.md`(任务边界)
4. 按技能指引创建计划
计划要求:
- 保存至 `docs/superpowers/plans/YYYY-MM-DD-<feature>.md`

@@ -57,2 +66,10 @@ - 引用设计文档,拆分为可执行任务

将计划写入文件后,返回文件路径。
**执行 subagent**:使用当前平台的 subagent 调度机制派发上述任务。
Subagent 完成后:
- 若返回有效文件路径且文件存在,记录为 plan
- 若 subagent 失败或返回路径无效,在主 session 内联加载 Superpowers `writing-plans` 技能创建计划(降级回退)
### 2. 更新计划状态并提供 plan-ready 暂停点

@@ -66,3 +83,3 @@

无需手动更新 phase,guard 会在退出条件满足后自动流转。
无需手动更新 phase,阶段守卫(guard `--apply`)会在退出条件满足后推进 `phase` 字段。

@@ -76,3 +93,3 @@ 计划写入后,立即提供一个新的用户决策点:

这是用户决策点。**必须使用 AskUserQuestion 工具暂停并等待用户明确选择**,不得自动继续,也不得把暂停写入 `build_mode`。
这是用户决策点。**必须使用当前平台可用的用户输入/确认机制暂停并等待用户明确选择**,不得自动继续,也不得把暂停写入 `build_mode`。若当前平台没有结构化提问工具,则在对话中提出同等选项并停止流程,等待用户回复后才能继续。

@@ -128,13 +145,29 @@ 用户选择继续时:

这是用户决策点。**必须使用 AskUserQuestion 工具暂停并等待用户明确选择隔离方式和执行方式**,不得根据推荐规则自行选择 `branch` 或 `worktree`,也不得根据推荐规则自行选择执行方式。推荐规则只能用于说明建议,不能替代用户确认。禁止仅输出文字提示后继续执行。
这是用户决策点。**必须使用当前平台可用的用户输入/确认机制暂停并等待用户明确选择隔离方式、执行方式和 TDD 模式**,不得根据推荐规则自行选择 `branch` 或 `worktree`,也不得根据推荐规则自行选择执行方式或 TDD 模式。推荐规则只能用于说明建议,不能替代用户确认。若当前平台没有结构化提问工具,则在对话中提出同等选项并停止流程,等待用户回复后才能继续。
用户选择后,更新 `isolation` 和 `build_mode` 字段:
用户选择后,更新 `isolation`、执行方式和 TDD 模式相关字段:
```bash
"$COMET_BASH" "$COMET_STATE" set <name> isolation <branch|worktree>
"$COMET_BASH" "$COMET_STATE" set <name> build_mode <subagent-driven-development|executing-plans|direct>
```
- 若用户选择 `executing-plans`:运行 `"$COMET_BASH" "$COMET_STATE" set <name> subagent_dispatch null`,再运行 `"$COMET_BASH" "$COMET_STATE" set <name> build_mode executing-plans`
- 若用户选择 `subagent-driven-development`:先确认当前平台存在可调用的真实后台 subagent / Task / multi-agent 调度能力;确认后先运行 `"$COMET_BASH" "$COMET_STATE" set <name> subagent_dispatch confirmed`,再运行 `"$COMET_BASH" "$COMET_STATE" set <name> build_mode subagent-driven-development`
- 若无法确认真实后台调度能力,不得写入 `build_mode: subagent-driven-development`;必须暂停等待用户改选 `executing-plans`
**TDD 模式**:
| 选项 | 含义 | 适用场景 |
|------|------|---------|
| `tdd` | 每个任务先写失败测试再写实现 | 推荐。变更涉及业务逻辑、新功能、API |
| `direct` | 直接实现,不强制 TDD 流程 | 变更不需要测试覆盖,或用户选择跳过测试直接写代码。hotfix/tweak preset 默认使用 `direct` |
运行 `"$COMET_BASH" "$COMET_STATE" set <name> tdd_mode <tdd|direct>`
`isolation` 是脚本级硬约束。full workflow 初始化时可以为 `null`,但只允许存在到本步骤之前。若保持 `null`,`build → verify` 的 guard 和 `comet-state transition build-complete` 都会失败。
`subagent_dispatch` 是脚本级硬约束。`build_mode: subagent-driven-development` 离开 build 阶段前必须同时满足 `subagent_dispatch: confirmed`,否则 `comet-guard.sh build --apply` 和 `comet-state transition build-complete` 都会失败。
`tdd_mode` 是脚本级硬约束。full workflow 离开 build 阶段前 `tdd_mode` 必须已选择为 `tdd` 或 `direct`,否则 `comet-guard.sh build --apply` 和 `comet-state transition build-complete` 都会失败。
`build_mode` 默认仅 hotfix/tweak preset 使用 `direct`。full workflow 不得默认使用 `direct`。只有用户明确要求跳过计划执行技能,且你已记录显式 override 时,才允许:

@@ -151,16 +184,63 @@

- **branch**:执行 `git checkout -b <change-name>`,后续工作在新分支上进行
- **branch**:根据 workflow 类型和当前日期推荐分支名,然后让用户确认或输入自定义名称。这是用户决策点——**必须使用当前平台可用的用户输入/确认机制暂停并等待用户明确确认或覆盖分支名**,不得跳过此步骤直接创建分支。
分支命名规范:
- 读取 `.comet.yaml` 的 `workflow` 字段确定前缀
- `workflow: full` → 推荐 `feature/YYYYMMDD/<change-name>`
- `workflow: hotfix` → 推荐 `hotfix/YYYYMMDD/<change-name>`
- `workflow: tweak` → 推荐 `tweak/YYYYMMDD/<change-name>`
- 日期取运行时 `date +%Y%m%d` 的结果
示例:如果 change 名称为 `fix-login-bug`,今天是 2026-06-09,则推荐 `feature/20260609/fix-login-bug`
用户确认或提供自定义分支名后,执行 `git checkout -b <branch-name>`,后续工作在新分支上进行。
- **worktree**:必须使用 Skill 工具加载 Superpowers `using-git-worktrees` 技能创建隔离工作区。禁止用普通 shell 命令或原生工具绕过该技能;如该技能不可用,停止流程并提示安装或启用 Superpowers 技能。
创建隔离后,确认计划文件可访问(分支方式天然可访问;worktree 方式需确认计划已提交)。
创建隔离后,确认计划文件可访问(分支方式天然可访问;worktree 方式需确认计划已提交)。若 worktree 模式下计划文件尚未提交,先提交计划文件再创建 worktree:
**加载执行技能**:使用 Skill 工具加载对应技能。禁止跳过此步骤。
```bash
git add docs/superpowers/plans/YYYY-MM-DD-feature.md
git commit -m "chore: add implementation plan"
```
如所选 Superpowers 技能不可用,停止流程并提示安装或启用对应技能,不要用普通对话替代该步骤。
**执行计划**:必须按 `build_mode` 的真实运行位置处理。
技能加载后,按其指引执行:
- `build_mode: executing-plans`:**立即执行:** 使用 Skill 工具加载 Superpowers `executing-plans` 技能。禁止跳过此步骤。若该技能不可用,停止流程并提示安装或启用对应技能,不要用普通对话替代该步骤。技能加载后,ARGUMENTS 必须包含与 Step 1 相同的 Language 约束:`Language: 使用触发本次工作流的用户请求语言输出`。按计划执行。
- `build_mode: subagent-driven-development`:主窗口只负责协调,不得把 `subagent-driven-development` 当作当前主窗口的执行技能直接运行;必须使用已确认的当前平台真实后台 subagent / Task / multi-agent 调度能力,把下一个未完成任务派发到后台 subagent。派发每个 subagent 时,必须在 prompt 中明确要求:技能加载后 ARGUMENTS 必须包含与 Step 1 相同的 Language 约束:`Language: 使用触发本次工作流的用户请求语言输出`;任务完成并通过验证后,立即勾选 `docs/superpowers/plans/<plan-file>.md` 中对应的计划任务;若该计划任务映射到 `openspec/changes/<name>/tasks.md` 中的任务,也同步将该 OpenSpec 任务从 `- [ ]` 改为 `- [x]`;若 plan 新增了 OpenSpec 中没有的一步,只勾选 plan 中对应任务即可。不得只更新内置 Todo 或对话内 checklist。后台 subagent 需要自行加载 Superpowers `subagent-driven-development` 相关执行流程,并按其指引完成实现、检查和提交。
- 如果当前平台没有真实后台 subagent / Task / multi-agent 调度能力,必须暂停并等待用户选择改用主窗口执行。用户选择改用主窗口执行后,必须先运行 `"$COMET_BASH" "$COMET_STATE" set <name> build_mode executing-plans`,再按 `build_mode: executing-plans` 分支加载 Superpowers `executing-plans` 技能。用户未明确选择前,不得继续执行任务。
执行开始后,按所选分支完成:
- 按计划执行任务
- 完成 tasks.md 勾选(`- [ ]` → `- [x]`)
- 完成 Superpowers plan 对应任务勾选;若任务映射到 OpenSpec tasks.md,也勾选对应 OpenSpec 任务(`- [ ]` → `- [x]`)
- 每个任务完成后提交代码
**TDD 模式执行约束**:
若 `tdd_mode: tdd`:
- `build_mode: executing-plans`:加载执行技能后、执行第一个任务前,**立即执行:** 使用 Skill 工具加载 Superpowers `test-driven-development` 技能一次。禁止跳过此步骤。技能加载后,从第一个未勾选任务开始,对每个任务遵循已加载的 TDD Red-Green-Refactor 循环执行。不得跳过失败测试验证阶段。后续任务不再重新加载该技能,直接遵循已加载流程。若上下文压缩后恢复,重新运行本步骤加载 TDD 技能一次,然后从第一个未勾选任务继续。
- `build_mode: subagent-driven-development`:派发每个 subagent 时,必须在 prompt 中注入 TDD 硬约束:**"You MUST follow TDD: for each task, write a failing test first, watch it fail, then write minimal code to pass. No production code without a failing test first."**。同一个 prompt 还必须包含上述 OpenSpec tasks.md 与 Superpowers plan 持久化勾选要求。不得依赖 implementer-prompt.md 的条件触发,必须在派发 prompt 中显式写出。
若 `tdd_mode: direct`:按正常流程执行,不强制 TDD。
**`executing-plans` review gate**:
当 `build_mode` 为 `executing-plans` 时,在所有计划任务完成后、运行 build → verify 阶段守卫前,必须使用 Skill 工具加载 Superpowers `requesting-code-review` 技能并至少请求一次代码审查。
要求:
- `requesting-code-review` 技能必须在 `"$COMET_BASH" "$COMET_GUARD" <change-name> build --apply` 之前加载
- 若 `requesting-code-review` 技能不可用,跳过 review gate 但必须在 tasks.md 中记录 `<!-- review skipped: skill unavailable -->`,并继续 guard 流转
- CRITICAL review 发现(安全漏洞、数据丢失风险、构建/测试失败)必须先修复,不得带入 verify
- 非 CRITICAL review 发现如选择接受,必须在 tasks.md、commit body、验证报告草稿或其他持久产物中记录接受原因和影响范围
### 3b. 执行中异常调试(Debug Gate)
执行任务期间,只要运行程序、测试、构建或手动验证时出现崩溃、异常行为、测试失败或构建失败,必须使用 Skill 工具加载 Superpowers `systematic-debugging` 技能。在完成根因调查前,不得提出或实施源码修复。
按 `systematic-debugging` 的四阶段流程处理:
- 先复现并定位根因,读取完整错误、检查近期变更、追踪数据流
- 若根因指向源码 bug,先补充能复现该崩溃/异常的最小失败测试,再修改源码
- 修复后运行该失败测试、相关测试和项目构建/验证命令,确认全部通过
- 将测试、源码修复和 tasks.md 勾选保留在当前 change 内;不得通过另起一个“写测试用例”的 change 来替代当前 change 的验证闭环
### 4. Spec 增量更新

@@ -173,9 +253,13 @@

| 小 | 遗漏验收场景、边界条件 | 直接编辑 delta spec + design.md,追加 tasks.md 任务 |
| 中 | 接口变更、新增组件、数据流变化 | **使用 AskUserQuestion 工具暂停并等待用户确认后**,必须使用 Skill 工具加载 Superpowers `brainstorming` 更新 Design Doc + delta spec |
| 大 | 全新 capability 需求 | **必须使用 AskUserQuestion 工具暂停并等待用户确认拆分**;用户确认后,通过 `/comet-open` 创建独立 change |
| 中 | 接口变更、新增组件、数据流变化 | **使用当前平台可用的用户输入/确认机制暂停并等待用户确认后**,必须使用 Skill 工具加载 Superpowers `brainstorming` 更新 Design Doc + delta spec |
| 大 | 全新 capability 需求 | **必须使用当前平台可用的用户输入/确认机制暂停并等待用户确认拆分**;用户确认后,通过 `/comet-open` 创建独立 change |
**50% 阈值判定**:以 tasks.md 初始任务总数为基准,若新增任务数超过该总数的一半,视为超出原计划范围,**必须使用 AskUserQuestion 工具暂停并等待用户决定是否拆分为新 change**。
**50% 阈值判定**:以 tasks.md 初始任务总数为基准,若新增任务数超过该总数的一半,视为超出原计划范围,**必须使用当前平台可用的用户输入/确认机制暂停并等待用户决定是否拆分为新 change**。若当前平台没有结构化提问工具,则在对话中提出拆分选项并停止流程,等待用户回复后才能继续。
创建独立 change 时必须调用 `/comet-open`,不得直接调用 `/opsx:new`。`/comet-open` 会同时创建 OpenSpec 产物和 `.comet.yaml`,避免新 change 脱离 Comet 状态机。
**用户选择必须包含**:
- 「拆分为新 change」— 通过 `/comet-open` 创建独立 change
- 「继续在当前 change 内完成」— 记录范围扩展决策,更新 tasks.md 和 delta spec 后继续
**原则**:

@@ -191,3 +275,3 @@ - delta spec 是活文档,本阶段期间随时可修改

- **每完成一个 task**:立即勾选 tasks.md 并提交代码,确保 `.comet.yaml` 和文件状态持久化
- **每完成一个 task**:立即勾选 Superpowers plan 中的对应任务;若任务映射到 OpenSpec tasks.md,也勾选对应 OpenSpec 任务;然后提交代码,确保 `.comet.yaml` 和文件状态持久化。用 `grep -c '\- \[ \]' tasks.md` 检查剩余未勾选数,无需重新读取整个文件
- **上下文压缩后恢复**:先运行 `"$COMET_BASH" "$COMET_STATE" check <change-name> build --recover`,脚本输出结构化恢复上下文(isolation/build_mode 状态、plan 路径、任务完成进度、恢复动作)。根据 Recovery action 决定下一步。

@@ -204,4 +288,6 @@ - **用户手动修改恢复**:按 `comet/reference/dirty-worktree.md` 协议处理未提交改动。该协议定义了检查步骤、归因分类和禁令。build 阶段的特殊处理:

- `isolation` 已写为 `branch` 或 `worktree`
- `build_mode` 已写为 `subagent-driven-development`、`executing-plans` 或带显式 override 的 `direct`
- **阶段守卫**:运行 `"$COMET_BASH" "$COMET_GUARD" <change-name> build --apply`,全部 PASS 后自动流转到 `phase: verify`
- `build_mode` 已写为 `subagent-driven-development`、`executing-plans` 或带显式 override 的 `direct`;若为 `subagent-driven-development`,`subagent_dispatch` 必须为 `confirmed`
- `tdd_mode` 已写为 `tdd` 或 `direct`
- 若 `build_mode` 为 `executing-plans`,已使用 Skill 工具加载 Superpowers `requesting-code-review` 技能并至少请求一次代码审查,且 CRITICAL review 发现已修复或非 CRITICAL review 发现已记录接受理由
- **阶段守卫**:运行 `"$COMET_BASH" "$COMET_GUARD" <change-name> build --apply`,全部 PASS 后由守卫推进到 `phase: verify`(此步骤更新 `phase` 字段,与 `auto_transition` 无关)

@@ -218,3 +304,3 @@ Guard 会优先读取项目配置中的命令:

退出前运行 guard 自动流转:
退出前运行阶段守卫推进 phase(此步骤与 `auto_transition` 无关):

@@ -227,6 +313,15 @@ ```bash

## 自动流转
## 自动衔接下一阶段
退出条件满足后(包括用户选择工作方式),自动流转到下一阶段:
> **术语区分**:上面的「阶段守卫推进」由 guard `--apply` 完成,更新 `.comet.yaml` 的 `phase` 字段——这一步**始终发生**,与 `auto_transition` 无关。本节的「自动衔接」只决定**是否自动调用下一个 skill**,由 `auto_transition` 控制。
> **REQUIRED NEXT SKILL:** 调用 `comet-verify` skill 进入验证与收尾阶段。
退出条件满足且阶段守卫推进 phase 后,运行:
```bash
"$COMET_BASH" "$COMET_STATE" next <change-name>
```
脚本根据 `phase`、`workflow`、`auto_transition` 输出确定性的下一步:
- `NEXT: auto` → 调用 `SKILL` 指向的 skill 进入下一阶段
- `NEXT: manual` → 不要调用下一 skill,按 `HINT` 提示用户手动运行 `/<SKILL>`
- `NEXT: done` → 流程已完成,无需继续

@@ -41,5 +41,7 @@ ---

脚本会生成并记录:
脚本会根据 change `.comet.yaml` 的 `context_compression` 快照生成并记录交接包。
```
默认 `context_compression: off` 时生成:
```text
openspec/changes/<name>/.comet/handoff/design-context.json

@@ -49,2 +51,9 @@ openspec/changes/<name>/.comet/handoff/design-context.md

启用 beta(项目 `.comet/config.yaml` 中 `context_compression: beta`,创建 change 时快照进入 `.comet.yaml`)时生成:
```text
openspec/changes/<name>/.comet/handoff/spec-context.json
openspec/changes/<name>/.comet/handoff/spec-context.md
```
并在 `.comet.yaml` 写入:

@@ -62,2 +71,7 @@

beta 交接包是 **结构化 spec projection**,用于减少 OpenSpec 原文 token 占用但避免实现漂移:
- `spec-context.json`:机器索引,包含 change、phase、mode=beta、source paths、context_hash、files 角色
- `spec-context.md`:供 Superpowers 阅读的紧凑上下文,verbatim 投影 delta spec 文件并按 hash 引用支撑产物
- OpenSpec delta spec 仍是 canonical spec;projection 缺失或过期时必须重新生成或读取源 spec,不得用 agent summary 替代
如确实需要全文上下文,可显式运行:

@@ -77,5 +91,13 @@

**立即执行:** 使用 Skill 工具加载 Superpowers `brainstorming` 技能,ARGUMENTS 包含:
**立即执行:** 使用 Skill 工具加载 Superpowers `brainstorming` 技能。禁止跳过此步骤。
技能加载时,ARGUMENTS 必须包含:
```text
Language: 使用触发本次工作流的用户请求语言输出
```
技能加载后,按其指引使用以下上下文:
```text
Change: <change-name>

@@ -85,5 +107,10 @@ OpenSpec Context Pack: openspec/changes/<name>/.comet/handoff/design-context.md

OpenSpec 产物是上游事实源,不要重新定义需求,不要重写 proposal/spec。
如 context_compression: beta,则使用:
OpenSpec Context Pack: openspec/changes/<name>/.comet/handoff/spec-context.md
Machine handoff: openspec/changes/<name>/.comet/handoff/spec-context.json
OpenSpec 产物是上游事实源,但不得用“跳过重复上下文探索”削弱 Superpowers `brainstorming` 的澄清流程。
你的任务是基于交接包做深度技术设计:实现方案、技术风险、测试策略、边界条件。
如发现 OpenSpec delta spec 缺少验收场景,只能提出 Spec Patch,并回写 OpenSpec delta spec;不要在 Design Doc 中创建第二份需求 spec。
如发现目标、范围、非目标、验收场景或关键约束仍不清楚,必须先继续提问并形成设计方案,不得只进行一轮问答就创建 Design Doc。
不要重写 proposal/spec;如发现 OpenSpec delta spec 缺少验收场景,只能提出 Spec Patch,并回写 OpenSpec delta spec;不要在 Design Doc 中创建第二份需求 spec。Spec Patch 仅限于补充验收场景、修正歧义描述或添加边界条件,不得大幅重写 delta spec 的结构或范围——如需大幅修改,应标记为设计发现并回到 brainstorming 确认。

@@ -97,6 +124,6 @@ Design Doc frontmatter 必须最小化,只包含:

跳过重复上下文探索,直接进入设计提问。
按 Superpowers `brainstorming` 技能原流程推进:澄清问题、2-3 个方案、分段确认设计。不得提前写入 Design Doc。
```
禁止跳过此步骤,禁止在未加载该技能的情况下继续。
禁止在未加载该技能的情况下继续。

@@ -108,2 +135,3 @@ 如 Superpowers `brainstorming` 技能不可用,停止流程并提示安装或启用 Superpowers 技能,不要用普通对话替代该步骤。

- 测试策略
- 需求/范围缺口与需回写的 Spec Patch
- 如需补充验收场景,标明将回写的 delta spec 变更

@@ -113,5 +141,7 @@

但为了上下文压缩恢复,brainstorming 过程中必须增量更新 `brainstorm-summary.md`。每轮澄清或方案迭代后,只要产生新的已确认事实、关键约束、候选方案、取舍/风险、测试策略或 Spec Patch 候选,就更新该文件;未确认内容必须标注为“待确认”或“候选”。该文件是恢复检查点,不是 Design Doc,也不得替代 Step 1c 的用户确认。
### 1c. 用户确认设计方案(阻塞点)
brainstorming 产出设计方案后,**必须使用 AskUserQuestion 工具暂停并等待用户明确确认设计方案**。不得在用户确认前创建最终 Design Doc、写入 `design_doc`、运行 design guard,或进入 `/comet-build`。也不得仅输出文字提示后继续执行。
brainstorming 产出设计方案后,**必须使用当前平台可用的用户输入/确认机制暂停并等待用户明确确认设计方案**。不得在用户确认前创建最终 Design Doc、写入 `design_doc`、运行 design guard,或进入 `/comet-build`。若当前平台没有结构化提问工具,则在对话中提出确认问题并停止流程,等待用户回复后才能继续。

@@ -126,7 +156,74 @@ 暂停时只展示必要摘要:

### 2. 更新 Comet 状态
先记录 design_doc 路径。如果 Step 1c 回写了 delta spec(新增或修改了 `specs/*/spec.md`),必须重新生成 handoff 以更新 hash:
### 1d. Brainstorming 检查点定稿
用户确认设计方案后,在创建 Design Doc 前,创建或更新已增量维护的检查点文件,将其定稿为确认后的设计方案摘要:
```bash
mkdir -p openspec/changes/<name>/.comet/handoff
```
`openspec/changes/<name>/.comet/handoff/brainstorm-summary.md` 结构:
```markdown
# Brainstorm Summary
- Change: <change-name>
- Date: <YYYY-MM-DD>
## 确认的技术方案
<用户确认的方案摘要>
## 关键取舍与风险
<主要取舍和风险>
## 测试策略
<测试方法概述>
## Spec Patch
<将回写的 delta spec 变更,无则写"无">
```
**上下文压缩说明**:每次增量更新 `brainstorm-summary.md` 后,都是相对安全的压缩恢复点。Brainstorming 完成后,如上下文窗口紧张,应优先在此处进行压缩。压缩后重新加载以下文件继续 Step 2:
- `openspec/changes/<name>/.comet/handoff/brainstorm-summary.md`
- `openspec/changes/<name>/.comet/handoff/design-context.md`(或 beta 模式的 `spec-context.md`)
- `openspec/changes/<name>/.comet/handoff/design-context.json`(或 beta 模式的 `spec-context.json`)
### 1e. 主动上下文压缩门
完成 Step 1d 并确认 `brainstorm-summary.md` 已写入后,进入 Design Doc 创建前的主动压缩门。此时 OpenSpec 交接包、brainstorming 决策和待确认项都已落盘,应主动释放前面读取 Spec 和 brainstorming 消耗的上下文,为 Step 2 及后续 Build 阶段保留窗口。
执行规则:
- 如果当前平台提供原生上下文压缩/清理机制(例如宿主 Agent 的 compact/compaction 命令、工具或 UI 操作),必须在这里触发一次主动压缩;不要尝试用 shell 脚本伪造压缩命令。
- 压缩恢复提示必须包含 change 名称、当前步骤(Design Step 2)、以及上方三类需重新加载的 handoff 文件。
- 如果当前平台无法由 agent 程序化触发压缩,必须暂停并提示用户在宿主平台执行手动压缩;用户确认无法压缩或要求继续时,才继续 Step 2。
### 2. 创建 Design Doc
基于 brainstorming 对话的完整上下文(仍在主 session 中),创建 Design Doc。
Design Doc frontmatter 必须最小化:
```yaml
---
comet_change: <change-name>
role: technical-design
canonical_spec: openspec
---
```
将 Design Doc 写入 `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md`。
如需回写 delta spec(Spec Patch),同时编辑对应的 `specs/*/spec.md`。
**上下文压缩恢复**:若上下文已被压缩,从 `brainstorm-summary.md` + handoff 上下文恢复。若用户尚未确认设计方案,回到 Step 1b/1c 继续 brainstorming;若用户已确认,继续创建 Design Doc。brainstorm-summary.md 是压缩恢复的落盘点,不是 Design Doc 的唯一输入——创建时应尽可能利用恢复后的完整上下文。
### 3. 更新 Comet 状态
先记录 design_doc 路径。如果 Spec Patch 回写了 delta spec(新增或修改了 `specs/*/spec.md`),必须重新生成 handoff 以更新 hash:
```bash
# 记录 design_doc 路径

@@ -138,3 +235,3 @@ "$COMET_BASH" "$COMET_STATE" set <name> design_doc docs/superpowers/specs/YYYY-MM-DD-topic-design.md

# 自动流转到下一阶段
# 阶段守卫推进 phase 到下一阶段
"$COMET_BASH" "$COMET_GUARD" <change-name> design --apply

@@ -151,6 +248,7 @@ ```

- `handoff_hash` 与当前 OpenSpec open 阶段产物一致(由 guard 强制校验)
- `design-context.md` 必须是脚本生成,且包含 source path、mode、sha256 等可追溯标记(由 guard 强制校验)
- `design-context.md` 或 beta `spec-context.md` 必须是脚本生成,且包含 source path、mode、sha256 等可追溯标记(由 guard 强制校验)
- beta 模式下,`spec-context.json` 必须结构合法且引用当前源文件(由 guard 强制校验)
- 如有新能力或补充验收场景,OpenSpec delta spec 已创建/更新
- `design_doc` 已写入 `.comet.yaml`
- **阶段守卫**:运行 `"$COMET_BASH" "$COMET_GUARD" <change-name> design --apply`,全部 PASS 后自动流转到 `phase: build`
- **阶段守卫**:运行 `"$COMET_BASH" "$COMET_GUARD" <change-name> design --apply`,全部 PASS 后由守卫推进到 `phase: build`(此步骤更新 `phase` 字段,与 `auto_transition` 无关)

@@ -173,6 +271,15 @@ 退出前必须使用 `--apply`:

## 自动流转
## 自动衔接下一阶段
退出条件满足后(包括用户确认设计方案),自动流转到下一阶段:
> **术语区分**:上面的「阶段守卫推进」由 guard `--apply` 完成,更新 `.comet.yaml` 的 `phase` 字段——这一步**始终发生**,与 `auto_transition` 无关。本节的「自动衔接」只决定**是否自动调用下一个 skill**,由 `auto_transition` 控制。
> **REQUIRED NEXT SKILL:** 调用 `comet-build` skill 进入计划与构建阶段。
阶段守卫推进 phase 后,运行:
```bash
"$COMET_BASH" "$COMET_STATE" next <change-name>
```
脚本根据 `phase`、`workflow`、`auto_transition` 输出确定性的下一步:
- `NEXT: auto` → 调用 `SKILL` 指向的 skill 进入下一阶段
- `NEXT: manual` → 不要调用下一 skill,按 `HINT` 提示用户手动运行 `/<SKILL>`
- `NEXT: done` → 流程已完成,无需继续

@@ -19,6 +19,10 @@ ---

## 流程(preset workflow,5 阶段)
## 流程(preset workflow,6 步)
执行链路:open → build → verify → archive。Hotfix 为每个阶段提供默认决策:精简开启、直接构建、按规模验证、验证通过后归档。
### 0. 输出语言约束
精简版 OpenSpec 产物必须使用触发本次工作流的用户请求语言。
执行链路:open → build → verify → archive。Hotfix 为每个阶段提供默认决策:精简开启、直接构建、按规模验证、验证通过后进入归档前最终确认。
开始前先定位 Comet 脚本:

@@ -65,5 +69,14 @@

检查 `auto_transition` 决定是否继续:
```bash
"$COMET_BASH" "$COMET_STATE" next <name>
```
- `NEXT: auto` → 继续 Step 2
- `NEXT: manual` → 暂停,按 `HINT` 提示用户手动运行 `/<SKILL>`
### 2. 直接构建(preset build)
使用 hotfix 默认值:`build_mode: direct`。跳过 Superpowers `brainstorming` 和 `writing-plans`(除非任务 > 3 个;若超过 3 个任务,转入 `/comet-build` 的计划与执行方式选择)。
使用 hotfix 默认值:`build_mode: direct`。跳过 Superpowers `brainstorming` 和 `writing-plans`(除非任务 > 3 个;若超过 3 个任务,转入 `/comet-build` 的计划与执行方式选择——注意这不触发 full workflow 升级,仅切换执行方式)。

@@ -83,2 +96,10 @@ 继续或开始修改前,按 `comet/reference/dirty-worktree.md` 协议处理未提交改动。若归因后发现修复范围超出 hotfix,按本文件“升级条件”处理。

执行 hotfix 期间,只要运行程序、测试、构建或手动验证时出现崩溃、异常行为、测试失败或构建失败,必须使用 Skill 工具加载 Superpowers `systematic-debugging` 技能。在完成根因调查前,不得提出或实施源码修复。
按 `systematic-debugging` 的四阶段流程处理:
- 先复现并定位根因,读取完整错误、检查近期变更、追踪数据流
- 若根因指向源码 bug,先补充能复现该崩溃/异常的最小失败测试,再修改源码
- 修复后运行该失败测试、相关测试和项目构建/验证命令,确认全部通过
- 将测试、源码修复和 tasks.md 勾选保留在当前 change 内;不得通过另起一个“写测试用例”的 change 来替代当前 change 的验证闭环
**如修复影响已有 spec 验收场景**:

@@ -116,7 +137,7 @@ - 在 `openspec/changes/<name>/specs/<capability>/spec.md` 创建 delta spec

验证通过后,按 `/comet-verify` 的规则将 `.comet.yaml` 的 `verify_result` 记录为 `pass`,归档前不得跳过该状态。
验证通过后,按 `/comet-verify` 的规则将 `.comet.yaml` 的 `verify_result` 记录为 `pass`,归档前不得跳过该状态。验证通过后仍必须进入 `/comet-archive` 的归档前最终确认,不得自动运行归档脚本。
### 5. 归档(preset archive)
复用 `/comet-archive`。归档前必须满足 `.comet.yaml` 中 `verify_result: pass`。
复用 `/comet-archive`。归档前必须满足 `.comet.yaml` 中 `verify_result: pass`,并等待 `/comet-archive` 的归档前最终确认。

@@ -131,7 +152,8 @@ **立即执行:** 使用 Skill 工具加载 `comet-archive` 技能进行归档。禁止跳过此步骤。

<IMPORTANT>
Hotfix 流程为 **一次性连续执行**。调用 `/comet-hotfix` 后,agent 在 hotfix 自有步骤间自动推进,不主动停顿。但以下情况必须暂停等待用户确认:
Hotfix 流程默认 **一次性连续执行**。调用 `/comet-hotfix` 后,agent 在 hotfix 自有步骤间自动推进,不主动停顿。**例外**:若 `auto_transition: false`,则在每个 phase 边界(build/verify/archive 之间)停下,由用户手动运行下一阶段命令——此时连续执行降级为逐阶段手动推进,详见下方「自动衔接下一阶段」。但无论 `auto_transition` 取何值,以下情况都必须暂停等待用户确认:
1. 遇到升级条件(见"升级条件"章节),**必须使用 AskUserQuestion 工具暂停并等待用户明确确认**升级为完整流程
1. 遇到升级条件(见"升级条件"章节),**必须使用当前平台可用的用户输入/确认机制暂停并等待用户明确确认**升级为完整流程
2. 任务超过 3 个转入 `/comet-build` 时的工作区隔离和执行方式选择
3. 验证阶段(comet-verify)的验证失败决策和分支处理决策
4. 归档前最终确认(comet-archive 执行归档脚本前)

@@ -157,8 +179,9 @@ 执行顺序:快速开启 → 直接构建 → 根因消除检查 → 验证 → 归档 → 完成

满足升级条件时**必须使用 AskUserQuestion 工具暂停并等待用户明确确认**升级为完整 `/comet` 流程。不得直接进入 `/comet-design`,不得自动补充 Design Doc。不得仅输出文字提示后继续执行。
满足升级条件时**必须使用当前平台可用的用户输入/确认机制暂停并等待用户明确确认**升级为完整 `/comet` 流程。不得直接进入 `/comet-design`,不得自动补充 Design Doc。若当前平台没有结构化提问工具,则在对话中提出升级确认问题并停止流程,等待用户回复后才能继续。
用户确认升级后,**必须先更新 workflow 字段**再进入完整流程:
用户确认升级后,**必须先更新 workflow 和 phase 字段**再进入完整流程:
```bash
"$COMET_BASH" "$COMET_STATE" set <name> workflow full
"$COMET_BASH" "$COMET_STATE" set <name> phase design
```

@@ -176,1 +199,16 @@

- **阶段守卫**:build → verify 前运行 `"$COMET_BASH" "$COMET_GUARD" <change-name> build --apply`,verify → archive 前按 `/comet-verify` 规则运行 `"$COMET_BASH" "$COMET_GUARD" <change-name> verify --apply`
## 自动衔接下一阶段
> **术语区分**:阶段守卫 `--apply` 推进 `.comet.yaml` 的 `phase` 字段——这一步**始终发生**,与 `auto_transition` 无关。本节的「自动衔接」只决定**是否自动调用下一个 skill**。
每次阶段守卫或状态转换推进 phase 后,运行:
```bash
"$COMET_BASH" "$COMET_STATE" next <name>
```
脚本根据 `phase`、`workflow`、`auto_transition` 输出确定性的下一步:
- `NEXT: auto` → 调用 `SKILL` 指向的 skill 继续 hotfix 流程(`phase: build` 返回 `comet-hotfix`,`verify` 返回 `comet-verify`,`archive` 返回 `comet-archive`)
- `NEXT: manual` → 不要调用下一 skill,按 `HINT` 提示用户手动运行 `/<SKILL>`
- `NEXT: done` → 流程已完成,无需继续
---
name: comet-open
description: "Comet 阶段 1:开启。用 /comet-open 调用。通过 OpenSpec 探索想法、创建 change 结构(proposal + design + tasks)。"
description: "Comet 阶段 1:开启。用 /comet-open 调用。通过 OpenSpec 探索想法、确认需求澄清,再创建 change 结构(proposal + design + tasks)。"
---

@@ -14,14 +14,78 @@

### 1. 探索想法
### 0. 输出语言约束
传递给 OpenSpec 的所有提问和产物要求都必须包含输出语言约束:使用触发本次工作流的用户请求语言。恢复已有 change 且产物已有明确主语言时,除非用户明确要求切换,否则保持该语言。
### 1. 探索想法与需求澄清
**立即执行:** 使用 Skill 工具加载 `openspec-explore` 技能。禁止跳过此步骤。
技能加载后,按其指引自由探索问题空间。
技能加载后,按其指引探索问题空间,但不得把一次问答视为足够澄清。必须围绕下列内容继续提问、对齐并形成澄清摘要:
- 目标:用户真正要解决的问题和期望结果
- 非目标:本次明确不做的内容
- 范围边界:涉及/不涉及的模块、用户、平台或数据
- 关键未知项:仍不确定的假设、风险或依赖
- 验收场景草案:至少覆盖核心成功场景和关键边界场景
澄清摘要必须包含:目标、非目标、范围边界、关键未知项、验收场景草案。
### 1a. PRD 拆分预检(阻塞点)
当用户输入是大型 PRD、路线图、完整产品方案,或澄清摘要显示包含多个独立能力、模块、用户路径或里程碑时,必须在创建 OpenSpec artifacts 前评估是否需要拆分为多个 change。
拆分预检必须基于已澄清的信息,输出候选拆分清单。每个候选拆分项必须包含:
- 建议 change 名称
- 目标与范围边界
- 明确非目标
- 依赖关系或推荐执行顺序
- 对应的核心验收场景
满足任一条件时,应推荐拆分:
- PRD 包含多个可独立设计、构建、验证、归档的 capability
- 涉及多个模块或用户路径,且其中一部分可独立交付
- 存在明显分阶段里程碑
- 预计会产生多个 delta spec 或超过 3 个大任务
- 任一部分失败或延期不应阻塞其他部分进入后续阶段
如推荐拆分,必须使用当前平台可用的用户输入/确认机制暂停并等待用户选择。若当前平台没有结构化提问工具,则在对话中提出同等单选问题并停止流程,等待用户回复后才能继续。
用户选择必须包含:
- 「创建多个 OpenSpec changes」— 按候选拆分逐个创建独立 change
- 「保持为一个 change」— 继续单 change 流程,并在 proposal/design/tasks 中记录不拆分原因
- 「调整拆分方案后继续」— 用户说明调整方向后,重新输出候选拆分清单并再次确认
每个被接受的拆分项都必须通过 `/comet-open` 创建独立 change,不得直接调用 `/opsx:new`。`/comet-open` 负责同时创建 OpenSpec artifacts 和 `.comet.yaml`,确保每个 change 都进入 Comet 状态机。
不得在用户完成 PRD 拆分选择前创建 proposal.md、design.md 或 tasks.md。若用户选择创建多个 change,当前 `/comet-open` 调用只负责完成拆分确认与调度,随后按用户确认的顺序分别进入每个拆分项的 `/comet-open`。
批量拆分模式下,进入每个拆分项的 `/comet-open` 时必须明确标注「已确认拆分项」并携带该拆分项的目标、范围、非目标和验收场景。已确认拆分项默认跳过 PRD 拆分预检,除非该拆分项本身仍明显包含多个独立 capability。
批量拆分模式下,单个拆分项完成 open 阶段后不得自动流转到 `/comet-design`。拆分完毕后必须暂停询问用户开始哪一个 change;用户选择后,只推进该 change 进入 `/comet-design`,其他 change 保持 active,稍后通过 `/comet` 恢复。
最小断点恢复规则:不新增专用批量状态文件。若批量拆分过程中断,恢复时先检查已创建的 active changes;已存在且包含 `.comet.yaml` 的拆分项不得重复创建,未创建的拆分项按用户已确认的拆分清单继续通过 `/comet-open` 创建。若对话中已确认的拆分清单不可恢复,必须重新向用户确认拆分清单后再继续。
### 1b. 需求澄清完成确认(阻塞点)
创建 OpenSpec artifacts 前,必须使用当前平台可用的用户输入/确认机制暂停并等待用户确认需求澄清完成。若当前平台没有结构化提问工具,则在对话中展示澄清摘要并提出确认问题,停止流程,等待用户回复后才能继续。
暂停时必须展示澄清摘要:目标、非目标、范围边界、关键未知项、验收场景草案。
不得在用户确认需求澄清完成前创建 proposal.md、design.md 或 tasks.md,也不得使用 Skill 工具加载 `openspec-propose` 技能一次性生成全部 artifacts。
### 2. 创建 Change 结构 + 初始化状态
**立即执行:** 使用 Skill 工具加载 `openspec-new-change` 技能。若用户意图未明确、需要先形成建议,改为加载 `openspec-propose`。禁止跳过此步骤。
**立即执行:** 使用 Skill 工具加载 `openspec-new-change` 技能。禁止跳过此步骤。
**命名与范围守卫**:change name 必须使用用户指定或通过 AskUserQuestion 确认的名称,不得自动生成或推断。变更范围必须与用户描述一致,不得自行扩大或缩小。
完整 `/comet` 流程默认不得使用 Skill 工具加载 `openspec-propose` 技能;只有用户明确要求一次性生成提案和 artifacts 时才允许加载。
技能加载后,按其指引创建 change 骨架,但当 Step 1b 的已确认澄清摘要已存在于对话上下文时,覆盖其"STOP and wait for user direction"行为。具体如下:
1. 按技能指引执行 `openspec new change`、`openspec status`、`openspec instructions`
2. 如果用户已确认澄清摘要(Step 1b),直接使用该摘要起草 proposal.md —— 不得再要求用户重新描述变更内容
3. 如果不存在澄清摘要(边缘情况),回退到技能的默认行为,询问用户
然后逐个补齐 design.md、tasks.md;每个文档都必须基于已确认的澄清摘要。
**命名与范围守卫**:change name 必须使用用户指定或通过当前平台可用的用户输入/确认机制确认的名称,不得自动生成或推断。变更范围必须与用户描述一致,不得自行扩大或缩小。
确认以下产物已创建:

@@ -79,5 +143,5 @@

三个文档创建完成且内容完整性检查通过后,**必须使用 AskUserQuestion 工具暂停并等待用户确认**。不得在用户确认前执行阶段守卫或自动流转。
三个文档创建完成且内容完整性检查通过后,**必须使用当前平台可用的用户输入/确认机制暂停并等待用户确认**。不得在用户确认前执行阶段守卫或自动流转。若当前平台没有结构化提问工具,则在对话中提出同等单选问题并停止流程,等待用户回复后才能继续。
AskUserQuestion 必须以单选题形式呈现,包含以下摘要和选项:
用户确认问题必须以单选题形式呈现,包含以下摘要和选项:

@@ -93,3 +157,3 @@ **摘要内容**:

用户选择「确认」后继续执行退出条件。用户选择「需要调整」时,按其说明修改对应文件,然后重新使用 AskUserQuestion 请求确认。
用户选择「确认」后继续执行退出条件。用户选择「需要调整」时,按其说明修改对应文件,然后重新请求确认。

@@ -100,3 +164,3 @@ ## 退出条件

- **用户已确认** proposal、design、tasks 内容符合预期
- **阶段守卫**:运行 `"$COMET_BASH" "$COMET_GUARD" <change-name> open --apply`,全部 PASS 后自动流转到下一阶段
- **阶段守卫**:运行 `"$COMET_BASH" "$COMET_GUARD" <change-name> open --apply`,全部 PASS 后由守卫推进到下一阶段(此步骤更新 `phase` 字段,与 `auto_transition` 无关)

@@ -111,8 +175,17 @@ 退出前必须使用 `--apply`,否则 `.comet.yaml` 仍停留在 `phase: open`,下一阶段入口检查会失败。

## 自动流转
## 自动衔接下一阶段
用户确认后,退出条件满足,自动流转到下一阶段:
> **术语区分**:上面的「阶段守卫推进」由 guard `--apply` 完成,更新 `.comet.yaml` 的 `phase` 字段——这一步**始终发生**,与 `auto_transition` 无关。本节的「自动衔接」只决定**是否自动调用下一个 skill**,由 `auto_transition` 控制。
> **REQUIRED NEXT SKILL(完整流程):** 调用 `comet-design` skill 进入深度设计阶段。
>
> hotfix/tweak preset 由对应 preset skill 控制后续流转(phase 直接进入 build),不经过本节。
用户确认且阶段守卫推进 phase 后,运行:
```bash
"$COMET_BASH" "$COMET_STATE" next <change-name>
```
脚本根据 `phase`、`workflow`、`auto_transition` 输出确定性的下一步:
- `NEXT: auto` → 调用 `SKILL` 指向的 skill 进入下一阶段
- `NEXT: manual` → 不要调用下一 skill,按 `HINT` 提示用户手动运行 `/<SKILL>`
- `NEXT: done` → 流程已完成,无需继续
hotfix/tweak preset 由对应 preset skill 控制后续流转(phase 直接进入 build),其 `next` 会返回对应 preset skill。

@@ -16,3 +16,3 @@ ---

3. 不涉及接口变化
4. 通常不超过 3 个 tasks、4 个文件
4. 通常不超过 3 个 tasks(文件数约束见下方升级条件)

@@ -25,4 +25,8 @@ **不适用**:如变更过程中发现需要 capability、架构或接口调整,应升级为完整 `/comet` 流程。

执行链路:open → lightweight build → light verify → archive。Tweak 为每个阶段提供默认决策:精简开启、轻量构建、轻量验证、验证通过后归档。
### 0. 输出语言约束
精简版 OpenSpec 产物必须使用触发本次工作流的用户请求语言。
执行链路:open → lightweight build → light verify → archive。Tweak 为每个阶段提供默认决策:精简开启、轻量构建、轻量验证、验证通过后进入归档前最终确认。
开始前先定位 Comet 脚本:

@@ -101,7 +105,7 @@

验证通过后,按 `/comet-verify` 的规则将 `.comet.yaml` 的 `verify_result` 记录为 `pass`,归档前不得跳过该状态。
验证通过后,按 `/comet-verify` 的规则将 `.comet.yaml` 的 `verify_result` 记录为 `pass`,归档前不得跳过该状态。验证通过后仍必须进入 `/comet-archive` 的归档前最终确认,不得自动运行归档脚本。
### 4. 归档(preset archive)
复用 `/comet-archive`。归档前必须满足 `.comet.yaml` 中 `verify_result: pass`。
复用 `/comet-archive`。归档前必须满足 `.comet.yaml` 中 `verify_result: pass`,并等待 `/comet-archive` 的归档前最终确认。

@@ -115,6 +119,7 @@ **立即执行:** 使用 Skill 工具加载 `comet-archive` 技能进行归档。禁止跳过此步骤。

<IMPORTANT>
Tweak 流程为 **一次性连续执行**。调用 `/comet-tweak` 后,agent 在 tweak 自有步骤间自动推进,不主动停顿。但以下情况必须暂停等待用户确认:
Tweak 流程默认 **一次性连续执行**。调用 `/comet-tweak` 后,agent 在 tweak 自有步骤间自动推进,不主动停顿。**例外**:若 `auto_transition: false`,则在每个 phase 边界(build/verify/archive 之间)停下,由用户手动运行下一阶段命令——此时连续执行降级为逐阶段手动推进,详见下方「自动衔接下一阶段」。但无论 `auto_transition` 取何值,以下情况都必须暂停等待用户确认:
1. 遇到升级条件(见"升级条件"章节),**必须使用 AskUserQuestion 工具暂停并等待用户明确确认**升级为完整流程
1. 遇到升级条件(见"升级条件"章节),**必须使用当前平台可用的用户输入/确认机制暂停并等待用户明确确认**升级为完整流程
2. 验证阶段(comet-verify)的验证失败决策和分支处理决策
3. 归档前最终确认(comet-archive 执行归档脚本前)

@@ -141,8 +146,9 @@ 执行顺序:快速开启 → 轻量构建 → 轻量验证 → 归档 → 完成

满足升级条件时**必须使用 AskUserQuestion 工具暂停并等待用户明确确认**升级为完整 `/comet` 流程。不得直接进入 `/comet-design`,不得自动补充 Design Doc。不得仅输出文字提示后继续执行。
满足升级条件时**必须使用当前平台可用的用户输入/确认机制暂停并等待用户明确确认**升级为完整 `/comet` 流程。不得直接进入 `/comet-design`,不得自动补充 Design Doc。若当前平台没有结构化提问工具,则在对话中提出升级确认问题并停止流程,等待用户回复后才能继续。
用户确认升级后,**必须先更新 workflow 字段**再进入完整流程:
用户确认升级后,**必须先更新 workflow 和 phase 字段**再进入完整流程:
```bash
"$COMET_BASH" "$COMET_STATE" set <name> workflow full
"$COMET_BASH" "$COMET_STATE" set <name> phase design
```

@@ -160,1 +166,16 @@

- **阶段守卫**:build → verify 前运行 `"$COMET_BASH" "$COMET_GUARD" <change-name> build --apply`,verify → archive 前按 `/comet-verify` 规则运行 `"$COMET_BASH" "$COMET_GUARD" <change-name> verify --apply`
## 自动衔接下一阶段
> **术语区分**:阶段守卫 `--apply` 推进 `.comet.yaml` 的 `phase` 字段——这一步**始终发生**,与 `auto_transition` 无关。本节的「自动衔接」只决定**是否自动调用下一个 skill**。
每次阶段守卫或状态转换推进 phase 后,运行:
```bash
"$COMET_BASH" "$COMET_STATE" next <name>
```
脚本根据 `phase`、`workflow`、`auto_transition` 输出确定性的下一步:
- `NEXT: auto` → 调用 `SKILL` 指向的 skill 继续 tweak 流程(`phase: build` 返回 `comet-tweak`,`verify` 返回 `comet-verify`,`archive` 返回 `comet-archive`)
- `NEXT: manual` → 不要调用下一 skill,按 `HINT` 提示用户手动运行 `/<SKILL>`
- `NEXT: done` → 流程已完成,无需继续

@@ -15,4 +15,8 @@ ---

### 0. 入口状态验证(Entry Check)
### 0a. 输出语言约束
验证报告和分支处理说明必须使用触发本次工作流的用户请求语言。
### 0b. 入口状态验证(Entry Check)
执行入口验证:

@@ -42,3 +46,3 @@

脚本自动统计任务数、增量规格数、变更文件数,判断使用 light 或 full 验证模式,并设置 verify_mode 字段。
脚本自动统计任务数、增量规格数、变更文件数,判断使用 light 或 full 验证模式,并设置 verify_mode 字段。判定规则(满足任一即 full):任务数 > 3、delta spec 能力数 > 1、变更文件数 > 4。

@@ -58,2 +62,4 @@ 验证开始前,按 `comet/reference/dirty-worktree.md` 协议检查并处理未提交改动。verify 阶段的特殊处理:

注意:verify-fail 回退到 build 时 `branch_status` 不会被重置。如果首次 verify 已完成分支处理,修复后再次进入 verify 时跳过已完成的分支处理步骤,直接使用 `"$COMET_BASH" "$COMET_STATE" set <change-name> branch_status handled` 保留原有分支处理结果。
注意:如果 build 阶段每个任务都已提交,脚本基于工作区 diff 的文件数可能低估改动规模。此时必须读取 plan 文件头的 `base-ref` 并用提交区间复核:

@@ -73,5 +79,7 @@

**覆盖机制**:如 agent 或用户认为自动评估结果不合适,可随时通过 `"$COMET_BASH" "$COMET_STATE" set <change-name> verify_mode <light|full>` 手动覆盖。
### 1b. 验证失败决策(阻塞点)
验证不通过时**必须使用 AskUserQuestion 工具暂停并等待用户决定修复或接受偏差**。不得自动运行 `"$COMET_BASH" "$COMET_STATE" transition <change-name> verify-fail`,也不得自动调用 `/comet-build`。禁止仅输出文字提示后继续执行。
验证不通过时**必须使用当前平台可用的用户输入/确认机制暂停并等待用户决定修复或接受偏差**。不得自动运行 `"$COMET_BASH" "$COMET_STATE" transition <change-name> verify-fail`,也不得自动调用 `/comet-build`。若当前平台没有结构化提问工具,则在对话中提出修复/接受偏差选项并停止流程,等待用户回复后才能继续。

@@ -89,5 +97,23 @@ 暂停时必须列出:

### 2. 产物上下文加载(Hash 按需读)
验证需要读取 OpenSpec 产物时,先检查产物是否自 design 阶段以来发生变化:
```bash
RECORDED_HASH=$("$COMET_BASH" "$COMET_STATE" get <change-name> handoff_hash)
CURRENT_HASH=$("$COMET_BASH" "$COMET_HANDOFF" <change-name> --hash-only 2>/dev/null || echo "")
```
- 若 `RECORDED_HASH` = `CURRENT_HASH` 且均非空且均非 `null`:OpenSpec 产物未变化,**tasks.md 无需重新读取全文**(用 `grep -c '\- \[ \]' tasks.md` 确认完成数即可)。proposal.md、design.md、delta spec 仍需读取用于对照检查。
- 若 `RECORDED_HASH` 为空、为 `null`、或与 `CURRENT_HASH` 不一致:产物已变化或 hash 未记录,正常读取所有所需文件全文。
此优化仅跳过 tasks.md 的重复全文读取。proposal.md 和 design.md 包含验证检查项所需的完整上下文,不得因 hash 匹配而跳过。
**立即执行:** 使用 Skill 工具加载 Superpowers `verification-before-completion` 技能。禁止跳过此步骤。
技能加载后,按 verify_mode 分支执行:
### 2a. 轻量验证(小改动)
当规模评估结果为"小"时,跳过 `openspec-verify-change`,直接执行以下检查:
按以下 5 项进行检查:

@@ -140,3 +166,3 @@ 1. tasks.md 全部任务已完成 `[x]`

**Spec 漂移处理**(用户决策点):
- 若检查项 6 发现矛盾(delta spec 有内容但 design doc 未体现),**必须使用 AskUserQuestion 工具以单选题形式暂停并等待用户选择处理方式**,不得自动选择。选项:
- 若检查项 6 发现矛盾(delta spec 有内容但 design doc 未体现),**必须使用当前平台可用的用户输入/确认机制以单选题形式暂停并等待用户选择处理方式**,不得自动选择。选项:
- 选项 A:在 design doc 追加 "Implementation Divergence" 节记录偏差原因。选项 A 属于 verify 阶段允许产物;写入后不得因该 design doc 变更再次触发 Step 1b dirty-worktree 决策

@@ -158,3 +184,3 @@ - 选项 B:用户选择 B 后,运行 `"$COMET_BASH" "$COMET_STATE" transition <change-name> verify-fail`,然后调用 `/comet-build`;由 `/comet-build` 的 Spec 增量更新规则加载 Superpowers `brainstorming` 更新 Design Doc + delta spec

这是用户决策点。**必须使用 AskUserQuestion 工具暂停并等待用户选择分支处理方式**,不得根据推荐、默认值或当前分支状态自行选择。禁止仅输出文字提示后继续执行。只有在用户完成选择且对应操作完成后,才允许写入 `branch_status: handled`。
这是用户决策点。**必须使用当前平台可用的用户输入/确认机制暂停并等待用户选择分支处理方式**,不得根据推荐、默认值或当前分支状态自行选择。若当前平台没有结构化提问工具,则在对话中提出分支处理选项并停止流程,等待用户回复后才能继续。只有在用户完成选择且对应操作完成后,才允许写入 `branch_status: handled`。

@@ -167,3 +193,3 @@ **确认项**:

验证报告必须落盘,并在 `.comet.yaml` 中记录;分支处理完成后也必须写入状态字段。不要手动设置 `verify_result: pass`,通过 guard 自动流转。
验证报告必须落盘,并在 `.comet.yaml` 中记录;分支处理完成后也必须写入状态字段。不要手动设置 `verify_result: pass`,由阶段守卫 `--apply` 推进。

@@ -185,5 +211,5 @@ ```bash

- `.comet.yaml` 中 `branch_status: handled`
- **阶段守卫**:运行 `"$COMET_BASH" "$COMET_GUARD" <change-name> verify --apply`,全部 PASS 后通过 `comet-state transition verify-pass` 自动流转到 `phase: archive`
- **阶段守卫**:运行 `"$COMET_BASH" "$COMET_GUARD" <change-name> verify --apply`,全部 PASS 后由守卫通过 `comet-state transition verify-pass` 推进到 `phase: archive`(此步骤更新 `phase` 字段,与 `auto_transition` 无关)
验证和分支处理均完成后,运行 guard 自动流转:
验证和分支处理均完成后,运行阶段守卫推进 phase(此步骤与 `auto_transition` 无关):

@@ -206,6 +232,17 @@ ```bash

## 自动流转
## 自动衔接下一阶段
退出条件满足后(包括用户选择分支处理方式),自动流转到下一阶段:
> **术语区分**:上面的「阶段守卫推进」由 guard `--apply` 完成,更新 `.comet.yaml` 的 `phase` 字段——这一步**始终发生**,与 `auto_transition` 无关。本节的「自动衔接」只决定**是否自动调用下一个 skill**,由 `auto_transition` 控制。
> **REQUIRED NEXT SKILL:** 调用 `comet-archive` skill 进入归档阶段。
验证、分支处理完成且阶段守卫推进 phase 后,运行:
```bash
"$COMET_BASH" "$COMET_STATE" next <change-name>
```
脚本根据 `phase`、`workflow`、`auto_transition` 输出确定性的下一步:
- `NEXT: auto` → 调用 `SKILL` 指向的 skill 进入下一阶段
- `NEXT: manual` → 不要调用下一 skill,按 `HINT` 提示用户手动运行 `/<SKILL>`
- `NEXT: done` → 流程已完成,无需继续
注意:无论 `NEXT` 为 `auto` 还是 `manual`,`comet-archive` 进入后必须先执行归档前最终确认阻塞点,等待用户明确选择「确认归档」后才允许运行归档脚本。不得因为验证已通过就自动归档。

@@ -5,3 +5,3 @@ # Dirty Worktree 协议

本协议由所有涉及代码修改的 comet 子 skill 共享。当 agent 恢复上下文或继续执行时,必须按本协议处理未提交的工作区改动。
本协议由所有涉及代码修改的 comet 子 skill 共享。当 agent 恢复上下文或继续执行时,必须按本协议处理未提交的工作区改动。各子 skill 可在本协议基础上定义阶段特例(如 verify 阶段对实现改动的特殊处理),详见对应子 skill 文件。本文件不重复阶段特例。

@@ -24,2 +24,3 @@ ## 1. 检查步骤

- 用户可能不会说明自己改了哪里。只要存在 dirty worktree(包括 Git 状态里显示为 `??` 的新建文件),就先假设改动可能来自用户或混合来源
- **构建产物排除**:`??` 文件若匹配 `.gitignore` 中的模式(如 `node_modules/`、`dist/`、`__pycache__/`、`*.o`、`target/`、`build/` 等),自动跳过归因,不视为用户改动
- dirty worktree 只代表代码事实,不会自动推进 `.comet.yaml` 的 `phase` 或勾选 `tasks.md`;只有完成归因、验证、同步必要文档,并通过对应阶段 guard 后,才允许推进 Comet 状态

@@ -26,0 +27,0 @@

@@ -23,2 +23,6 @@ ---

### 输出语言规则
以触发本次工作流的用户请求语言作为默认输出语言。恢复已有 change 时,如果现有产物有明确主语言,除非用户明确要求切换,否则保持该语言。
### 阶段自动检测

@@ -57,10 +61,13 @@

- 只要存在 active change 且工作区有未提交改动,必须按 `comet/reference/dirty-worktree.md` 协议处理。该协议定义了检查步骤、归因分类和禁令,本文件不重复
- 若 `phase: build`,先检查 `build_pause`、`plan`、`build_mode` 和 `isolation`:
- 若 `build_pause: plan-ready` 且 plan 文件存在,回到 `/comet-build` 的 plan-ready 恢复点,提示用户继续选择隔离方式和执行方式,不重新生成 plan
- 若 `phase: build`,先检查 `build_pause`、`plan`、`build_mode` 和 `isolation`(详见下方):
- 若 `build_pause: plan-ready` 但 `isolation` 和 `build_mode` 已经设置,则视为 stale pause:先输出 `[COMET] 检测到 stale pause(build_pause=plan-ready 但 isolation/build_mode 已设置),自动清除并继续`,再运行 `"$COMET_BASH" "$COMET_STATE" set <name> build_pause null`,然后读取 tasks.md 的下一个未勾选任务并按 `build_mode` 恢复执行
- 若 `build_pause: plan-ready` 且 plan 文件存在,但 `isolation` 或 `build_mode` 尚未设置,回到 `/comet-build` 的 plan-ready 恢复点,提示用户继续选择隔离方式和执行方式,不重新生成 plan
- 若 `build_pause: plan-ready` 但 plan 文件缺失,回到 `/comet-build` 处理状态损坏或重新生成 plan
- 若 `build_mode` 或 `isolation` 未设置,回到 `/comet-build` 对应步骤补充后再执行
- 若均已设置,读取 tasks.md 的下一个未勾选任务继续
- 若 `build_mode`、`isolation` 或 `tdd_mode` 未设置,回到 `/comet-build` 对应步骤补充后再执行
- 若均已设置,读取 tasks.md 的下一个未勾选任务,并按 `build_mode` 恢复执行:
- 若 `build_mode: subagent-driven-development`,不得在主窗口直接执行任务;必须回到 `/comet-build` 的后台 subagent 调度规则,由主窗口只做协调
- 其他执行方式按 `/comet-build` 的对应规则继续
- 若 `phase: verify` 且 `verify_result: fail`,进入验证失败决策阻塞点:暂停并询问用户修复或接受偏差;用户选择修复后才运行 `"$COMET_BASH" "$COMET_STATE" transition <name> verify-fail` 并调用 `/comet-build`
- 若 `phase: open` 但 proposal/design/tasks 已完整,先运行 `"$COMET_BASH" "$COMET_GUARD" <change-name> open --apply` 修正状态,再继续判定
- 若 `phase: archive`,只允许调用 `/comet-archive`;归档成功后 change 会移动到 archive 目录,不再对原活跃目录运行 guard
- 若 `phase: archive`,只允许调用 `/comet-archive`;`/comet-archive` 必须先等待归档前最终确认,归档成功后 change 会移动到 archive 目录,不再对原活跃目录运行 guard

@@ -70,3 +77,3 @@ **Step 2: 阶段判定**(按顺序,命中即停)

1. `archived: true` 或 change 已移入 archive → 流程已完成
2. `verify_result: pass` 且 `archived` 不是 `true` → `/comet-archive`
2. `verify_result: pass` 且 `archived` 不是 `true` → `/comet-archive`(先进行归档前最终确认)
3. `verify_result: fail` → 进入验证失败决策阻塞点(暂停询问修复或接受偏差;用户选择修复后才 `verify-fail` 并 `/comet-build`)

@@ -95,2 +102,4 @@ 4. `phase: verify` 或 tasks.md 全部勾选 → `/comet-verify`

- 涉及配置项的新增或删除(非值修改)
- 需要新增 capability
- 需要 delta spec(影响了已有规格)

@@ -114,6 +123,8 @@ ### 错误处理速查

**连续执行要求**:从检测到的阶段开始,agent 自动推进后续阶段。但**自动推进仅适用于没有用户决策的衔接点**。遇到用户决策点时,**必须使用 AskUserQuestion 工具暂停并等待用户明确回复**,不得用推荐规则、默认值或历史偏好代替用户确认,也不得仅输出文字提示后继续执行。
**连续执行要求**:从检测到的阶段开始,agent 自动推进后续阶段。但**自动推进仅适用于没有用户决策的衔接点**。遇到用户决策点时,**必须使用当前平台可用的用户输入/确认机制暂停并等待用户明确回复**,不得用推荐规则、默认值或历史偏好代替用户确认,也不得仅输出文字提示后继续执行。
**决策点是阻塞点**:只要到达下列任一节点,当前 `/comet` 调用必须停住,**使用 AskUserQuestion 工具等待用户选择**。用户明确选择后才能写入对应状态字段、执行对应操作,随后再继续自动流转。
**阶段推进与自动衔接的区分**:每个子 skill 退出前都会运行阶段守卫 `--apply` 推进 `.comet.yaml` 的 `phase` 字段——这一步**始终发生**,与 `auto_transition` 无关。之后子 skill 运行 `"$COMET_BASH" "$COMET_STATE" next <name>` 解析下一步:`auto_transition` 不为 `false` 时输出 `NEXT: auto`(自动调用下一 skill),为 `false` 时输出 `NEXT: manual`(不调用下一 skill,提示用户手动运行)。因此 `auto_transition` **只控制是否自动调用下一个 skill,不影响 phase 推进**。无论 `auto_transition` 取何值,下方的用户决策点都必须阻塞等待。
**决策点是阻塞点**:只要到达下列任一节点,当前 `/comet` 调用必须停住,**使用当前平台可用的用户输入/确认机制等待用户选择**。若当前平台没有结构化提问工具,则必须在对话中提出明确选项并停止流程,等待用户回复后才能继续。用户明确选择后才能写入对应状态字段、执行对应操作,随后再继续自动流转。
需要用户参与的节点(仅在这些节点暂停):

@@ -125,6 +136,8 @@ 1. open 阶段 proposal/design/tasks 审视确认

5. finishing-branch 选择分支处理方式
6. 遇到升级条件(hotfix/tweak → 完整流程)
7. build 阶段范围扩张需重新设计或拆分新 change
6. archive 阶段执行归档脚本前的最终确认
7. 遇到升级条件(hotfix/tweak → 完整流程)
8. build 阶段范围扩张需重新设计或拆分新 change
9. open 阶段大型 PRD 需确认拆分为多个 change
agent 不应跳过这些决策点;其他明确无歧义的阶段衔接必须自动继续推进,不得中途退出。到达决策点时,**禁止以文字输出代替工具等待——必须通过 AskUserQuestion 明确获取用户选择后才能继续**。
agent 不应跳过这些决策点;其他明确无歧义的阶段衔接必须自动继续推进,不得中途退出。到达决策点时,**禁止跳过用户确认或自动选择——必须通过当前平台可用的用户输入/确认机制明确获取用户选择后才能继续**。

@@ -135,3 +148,3 @@ **红旗清单** — 以下想法出现时立即停止并检查:

|-----------|---------|
| "用户应该会同意这个方案" | 不能替用户决策,用 AskUserQuestion |
| "用户应该会同意这个方案" | 不能替用户决策,必须等待用户明确选择 |
| "这只是个小改动,不需要确认" | 决策点无大小之分,阻塞点必须等待 |

@@ -186,2 +199,4 @@ | "用户之前选过 A,这次也选 A" | 历史偏好不能替代当前确认 |

build_pause: null
subagent_dispatch: confirmed
tdd_mode: tdd
isolation: branch

@@ -206,4 +221,7 @@ verify_mode: light

| `build_pause` | build 阶段内部暂停点。`null` 表示无暂停,`plan-ready` 表示 plan 已生成,用户选择切换模型后暂停 |
| `subagent_dispatch` | `null` 或 `confirmed`。仅当已确认当前平台存在真实后台 subagent / Task / multi-agent 调度能力时,`build_mode: subagent-driven-development` 才能写入并用于离开 build 阶段 |
| `tdd_mode` | `tdd` 或 `direct`。full workflow 离开 build 阶段前必须已选择。`tdd` 强制每个任务先写失败测试再实现;`direct` 不强制 TDD。hotfix/tweak 默认 `direct` |
| `isolation` | `branch` 或 `worktree`,工作区隔离方式。full 初始化可为 `null`,但只允许持续到 `/comet-build` Step 3 前;hotfix/tweak 默认 `branch` |
| `verify_mode` | `light` 或 `full`,可为空 |
| `auto_transition` | `true` 或 `false`。只控制阶段守卫推进 phase 后是否自动调用下一个 skill;`false` 时由 `comet-state next` 输出 `manual`,暂停下一 skill 调用,但不阻止 phase 字段更新 |
| `verify_result` | `pending`、`pass` 或 `fail` |

@@ -227,2 +245,4 @@ | `verification_report` | 验证报告文件路径,verify 通过前必须指向已存在文件 |

- `build → verify` 前,`build_mode` 必须已选择
- `build_mode: subagent-driven-development` 必须同时有 `subagent_dispatch: confirmed`
- full workflow 离开 build 阶段前 `tdd_mode` 必须已选择为 `tdd` 或 `direct`
- `build_mode: direct` 默认只允许 `hotfix` / `tweak`;full workflow 需要 `direct_override: true`

@@ -234,3 +254,3 @@ - `build_pause` 不是执行方式,不得写入 `build_mode`

Comet 脚本随 skill 包分发在 `comet/scripts/` 下。**不硬编码路径** — 定位一次,缓存到环境变量:
Comet 脚本随 skill 包分发在 `comet/scripts/` 下。**不硬编码路径** — 定位一次,缓存到环境变量。此块为标准样板,在每个子 skill 中独立重复以确保可独立加载;修改时必须保持所有文件同步(样板版本: `v2`,变更时更新此版本号便于定位需要同步的文件):

@@ -270,2 +290,10 @@ ```bash

**解析下一步**:阶段守卫推进 phase 后,用 `next` 子命令解析是否自动调用下一个 skill:
```bash
"$COMET_BASH" "$COMET_STATE" next <change-name>
```
输出 `NEXT: auto|manual|done` + `SKILL: <skill-name>`(`done` 时省略)+ `HINT`(仅 `manual` 时)。`auto_transition: false` 时输出 `manual`,只暂停下一 skill 调用,不影响已发生的 phase 推进。
**归档脚本**:一键完成归档全部步骤:

@@ -294,3 +322,3 @@

│ └── archive/YYYY-MM-DD-<name>/ # 已归档
└── specs/<capability>/spec.md # 主 specs(归档时从 delta 覆盖)
└── specs/<capability>/spec.md # 主 specs(归档时按 OpenSpec delta 语义合并)

@@ -300,2 +328,5 @@ docs/superpowers/ # Superpowers — HOW

└── plans/YYYY-MM-DD-<feature>.md # 实施计划(文件头含 change 关联元数据)
.comet/
└── config.yaml # Comet 项目配置(context_compression 默认 off,可设 beta)
```

@@ -307,6 +338,6 @@

2. **delta spec 是活文档** — 阶段 3 期间可自由修改,归档时同步
3. **交接包由脚本生成** — OpenSpec → Superpowers 的上下文必须通过 `comet-handoff.sh` 生成 compact 可追溯摘录(必要时 `--full`),并由 guard 校验 source/hash/mode
3. **交接包由脚本生成** — OpenSpec → Superpowers 的上下文必须通过 `comet-handoff.sh` 生成 compact 可追溯摘录(需要全文时用 `--full`),并由 guard 校验 source/hash/mode
4. **保持 tasks.md 同步** — 完成一个勾一个
5. **频繁提交** — 每个任务一次提交,message 体现设计意图
6. **先验证再归档** — `/comet-verify` 通过后才执行 `/comet-archive`
6. **先验证再确认归档** — `/comet-verify` 通过后进入 `/comet-archive`,但运行归档脚本前必须等待用户最终确认
7. **增量更新分级** — 小编辑、中重 brainstorming、大新 change

@@ -313,0 +344,0 @@ 8. **Plan 必须关联 change** — 文件头包含 `change:` 和 `design-doc:` 元数据

---
name: comet-archive
description: "Comet Phase 5: Archive. Invoke with /comet-archive. Sync delta spec to main spec, archive change."
description: "Comet Phase 5: Archive. Invoke with /comet-archive. Merge delta specs into main specs with OpenSpec semantics, archive change."
---

@@ -16,2 +16,6 @@

### 0. Output Language Constraint
Archive summaries and lifecycle closure notes must use the language of the user request that triggered this workflow.
### 0. Entry State Verification (Entry Check)

@@ -33,4 +37,21 @@

### 1. Execute Archive
### 1. Final Archive Confirmation (Blocking Point)
After entry verification passes, **must use the current platform's available user input/confirmation mechanism to pause and wait for the user to confirm whether to archive immediately**. Must not run `"$COMET_BASH" "$COMET_ARCHIVE" "<change-name>"` before user confirmation. If the current platform has no structured question tool, ask an equivalent single-select question in the conversation, stop the workflow, and wait for the user's reply before continuing.
Before confirmation, show the user a brief summary:
- Change name
- Verification report path and result
- Branch handling status
- Irreversible actions this archive will perform: merge main specs with OpenSpec delta semantics, annotate design doc / plan, and move the change to the archive directory
The user confirmation question must be presented as a single-select question with these options:
- "Confirm archive" — immediately run the archive script to complete spec merge and change movement
- "Needs adjustment or re-verification" — do not archive; run `"$COMET_BASH" "$COMET_STATE" transition <change-name> archive-reopen` to return to `phase: verify`, then invoke `/comet-verify`. If verification confirms fixes are needed, follow `/comet-verify`'s verification-failure decision flow back to `/comet-build`
- "Do not archive yet" — do not archive; keep the current `phase: archive` state and wait for the user to invoke `/comet-archive` again later
Only after the user selects "Confirm archive" may Step 2 continue. After the user selects "Needs adjustment or re-verification", must first run the `archive-reopen` state transition; do not edit `.comet.yaml` manually.
### 2. Execute Archive
Run the archive script to automatically complete all steps:

@@ -44,6 +65,6 @@

1. Entry state validation (phase=archive, verify_result=pass, archived=false)
2. Delta spec sync to main spec (overwrite)
3. Design doc frontmatter annotation (archived-with, status)
4. Plan frontmatter annotation (archived-with)
5. Move change to archive directory
2. Design doc frontmatter annotation (archived-with, status)
3. Plan frontmatter annotation (archived-with)
4. OpenSpec archive for delta-merge semantics and moving the change to the archive directory
5. Main spec guard against leaked delta-only section headings
6. Update `archived: true` through `comet-state transition <archive-name> archived`

@@ -55,11 +76,11 @@

When a delta spec differs from an existing main spec, the script prints a unified diff preview before overwrite to help confirm archive sync content.
The script calls OpenSpec archive to merge `ADDED/MODIFIED/REMOVED/RENAMED` delta semantics into main specs, then verifies main specs do not contain delta-only section headings.
Use `--dry-run` flag to preview without executing.
### 2. Lifecycle Closed Loop
### 3. Lifecycle Closed Loop
Spec lifecycle completes here:
```
brainstorming → delta spec → implementation → verification → main spec overwrite → design doc annotation → archive
brainstorming → delta spec → implementation → verification → main spec merge → design doc annotation → archive
```

@@ -73,6 +94,18 @@

The archive script moves `openspec/changes/<name>/` to `openspec/changes/archive/YYYY-MM-DD-<name>/`. After successful archive, **do not run** `"$COMET_BASH" "$COMET_GUARD" <change-name> archive` against the old active change name; the active directory no longer exists. Archive completeness is determined by script exit code and archived directory state.
The archive script moves `openspec/changes/<name>/` to `openspec/changes/archive/YYYY-MM-DD-<name>/`.
> **WARNING**: After successful archive, **do not run** `"$COMET_BASH" "$COMET_GUARD" <change-name> archive` against the old active change name; the active directory no longer exists. Doing so will cause the guard to error with "change directory not found". Archive completeness is determined by script exit code and archived directory state.
## Complete
Comet workflow complete. To start new work, invoke `/comet` or `/comet-open`.
## Context Compaction Recovery
The archive phase may trigger context compaction during execution. On resume, first run:
```bash
"$COMET_BASH" "$COMET_STATE" check <change-name> archive --recover
```
The script outputs structured recovery context (archive status, completed steps). Follow the Recovery action to determine next steps. If `archived: true` and the archive directory exists, archiving is already complete — no need to run the archive operation again.

@@ -31,9 +31,18 @@ ---

**Idempotency**: All build phase operations can be safely re-executed. Read `.comet.yaml` `phase` field to confirm still in build, read plan header `base-ref`, then read tasks.md to find the first unchecked task. Already-committed tasks must not be re-committed.
**Idempotency**: All build phase operations can be safely re-executed. Read `.comet.yaml` `phase` field to confirm still in build, read plan header `base-ref`, then use `grep -n '\- \[ \]' tasks.md | head -1` to find the first unchecked task. Already-committed tasks must not be re-committed.
### 1. Create Plan
### 1. Create Plan (Subagent Offload)
**Immediately execute:** Use the Skill tool to load the Superpowers `writing-plans` skill. Skipping this step is prohibited.
Create the implementation plan through a subagent, avoiding planning skill occupying main session context. Plan files and execution feedback must use the language of the user request that triggered this workflow.
After the skill loads, follow its guidance to create a plan. Plan requirements:
**Subagent instructions**:
You are an implementation planning expert. Create an implementation plan based on the following inputs:
1. **Immediately execute:** Use the Skill tool to load the Superpowers `writing-plans` skill. Skipping this step is prohibited. After the skill loads, ARGUMENTS must include: `Language: Use the language of the user request that triggered this workflow`
2. Read the Design Doc (technical design document under `docs/superpowers/specs/`)
3. Read `openspec/changes/<name>/tasks.md` (task boundaries)
4. Follow the skill's guidance to create the plan
Plan requirements:
- Save to `docs/superpowers/plans/YYYY-MM-DD-<feature>.md`

@@ -57,2 +66,10 @@ - Reference design document, break down into executable tasks

Write the plan to file, then return the file path.
**Execute subagent**: Use the current platform's subagent dispatch mechanism to send the above task.
After the subagent completes:
- If a valid file path is returned and the file exists, record it as the plan
- If the subagent fails or returns an invalid path, fall back to loading the Superpowers `writing-plans` skill inline in the main session (degraded fallback)
### 2. Update Plan Status and Provide Plan-Ready Pause Point

@@ -75,3 +92,3 @@

This is a user decision point. **Must use the AskUserQuestion tool to pause and wait for the user to explicitly choose**. Must not auto-continue and must not write the pause into `build_mode`.
This is a user decision point. **Must use the current platform's available user input/confirmation mechanism to pause and wait for the user to explicitly choose**. Must not auto-continue and must not write the pause into `build_mode`. If the current platform has no structured question tool, ask equivalent options in the conversation, stop the workflow, and wait for the user's reply before continuing.

@@ -127,13 +144,29 @@ When the user chooses to continue:

This is a user decision point. **Must use the AskUserQuestion tool to pause and wait for the user to explicitly choose both isolation method and execution method**. Must not choose `branch` or `worktree` based on recommendation rules, and must not choose the execution method based on recommendation rules. Recommendation rules are for suggestion only, not a substitute for user confirmation. Must not just output a text prompt and then continue executing.
This is a user decision point. **Must use the current platform's available user input/confirmation mechanism to pause and wait for the user to explicitly choose isolation method, execution method, and TDD mode**. Must not choose `branch` or `worktree` based on recommendation rules, and must not choose the execution method or TDD mode based on recommendation rules. Recommendation rules are for suggestion only, not a substitute for user confirmation. If the current platform has no structured question tool, ask equivalent options in the conversation, stop the workflow, and wait for the user's reply before continuing.
After user selection, update `isolation` and `build_mode` fields:
After user selection, update `isolation`, execution method, and TDD mode fields:
```bash
"$COMET_BASH" "$COMET_STATE" set <name> isolation <branch|worktree>
"$COMET_BASH" "$COMET_STATE" set <name> build_mode <subagent-driven-development|executing-plans|direct>
```
- If the user chooses `executing-plans`: run `"$COMET_BASH" "$COMET_STATE" set <name> subagent_dispatch null`, then run `"$COMET_BASH" "$COMET_STATE" set <name> build_mode executing-plans`
- If the user chooses `subagent-driven-development`: first confirm the current platform has real background subagent / Task / multi-agent dispatch capability; after confirming, run `"$COMET_BASH" "$COMET_STATE" set <name> subagent_dispatch confirmed`, then run `"$COMET_BASH" "$COMET_STATE" set <name> build_mode subagent-driven-development`
- If real background dispatch capability cannot be confirmed, must not write `build_mode: subagent-driven-development`; must pause and wait for the user to choose `executing-plans` instead
**TDD Mode**:
| Option | Meaning | Applicable Scenario |
|--------|---------|---------------------|
| `tdd` | Write a failing test first for each task, then implement | Recommended. Changes involving business logic, new features, APIs |
| `direct` | Implement directly, no enforced TDD flow | Changes that don't need test coverage, or user chooses to skip tests and write code directly. hotfix/tweak presets default to `direct` |
Run `"$COMET_BASH" "$COMET_STATE" set <name> tdd_mode <tdd|direct>`
`isolation` is a script-enforced hard constraint. Full workflow init may temporarily leave it as `null`, but only before this step. If it remains `null`, both the `build → verify` guard and `comet-state transition build-complete` will fail.
`subagent_dispatch` is a script-enforced hard constraint. `build_mode: subagent-driven-development` requires `subagent_dispatch: confirmed` before leaving the build phase, otherwise both `comet-guard.sh build --apply` and `comet-state transition build-complete` will fail.
`tdd_mode` is a script-enforced hard constraint. Full workflow must have `tdd_mode` selected as `tdd` or `direct` before leaving the build phase, otherwise both `comet-guard.sh build --apply` and `comet-state transition build-complete` will fail.
`build_mode` defaults to `direct` only for hotfix/tweak presets. Full workflow must not default to `direct`. Use it only when the user explicitly asks to bypass the plan execution skills and you record an explicit override:

@@ -150,16 +183,63 @@

- **branch**: Run `git checkout -b <change-name>`, subsequent work on the new branch
- **branch**: Recommend a branch name based on the workflow type and current date, then let the user confirm or input a custom name. This is a user decision point — **must use the current platform's available user input/confirmation mechanism to pause and wait for the user to explicitly confirm or override the branch name**. Must not skip this step and create the branch directly.
Branch naming convention:
- Read the `workflow` field from `.comet.yaml` to determine the prefix
- `workflow: full` → recommend `feature/YYYYMMDD/<change-name>`
- `workflow: hotfix` → recommend `hotfix/YYYYMMDD/<change-name>`
- `workflow: tweak` → recommend `tweak/YYYYMMDD/<change-name>`
- Date is derived from `date +%Y%m%d` at runtime
Example: if change name is `fix-login-bug` and today is 2026-06-09, recommend `feature/20260609/fix-login-bug`
After the user confirms or provides a custom branch name, run `git checkout -b <branch-name>`, subsequent work on the new branch.
- **worktree**: Must use the Skill tool to load the Superpowers `using-git-worktrees` skill to create isolated workspace. Do not bypass this skill with plain shell commands or native tools; if the skill is unavailable, stop the process and prompt to install or enable Superpowers skills.
After creating isolation, confirm plan file is accessible (naturally accessible with branch method; for worktree method, confirm plan has been committed).
After creating isolation, confirm plan file is accessible (naturally accessible with branch method; for worktree method, confirm plan has been committed). If the plan file has not been committed under worktree mode, commit it first before creating the worktree:
**Load execution skill**: Use the Skill tool to load the corresponding skill. Skipping this step is prohibited.
```bash
git add docs/superpowers/plans/YYYY-MM-DD-feature.md
git commit -m "chore: add implementation plan"
```
If the selected Superpowers skill is unavailable, stop the process and prompt to install or enable the corresponding skill. Do not substitute this step with normal conversation.
**Execute plan**: Must handle execution according to the actual runtime of `build_mode`.
After the skill loads, follow its guidance to execute:
- `build_mode: executing-plans`: **Immediately execute:** Use the Skill tool to load the Superpowers `executing-plans` skill. Skipping this step is prohibited. If the skill is unavailable, stop the process and prompt to install or enable the corresponding skill; do not substitute with normal conversation. After the skill loads, ARGUMENTS must include the same Language constraint as Step 1: `Language: Use the language of the user request that triggered this workflow`. Execute according to plan.
- `build_mode: subagent-driven-development`: The main window only coordinates; must not run `subagent-driven-development` as the main window execution skill directly. Must use the confirmed real background subagent / Task / multi-agent dispatch capability to dispatch the next unchecked task to a background subagent. When dispatching each subagent, the prompt must explicitly require: after the skill loads, ARGUMENTS must include the same Language constraint as Step 1: `Language: Use the language of the user request that triggered this workflow`; after the task is complete and validated, immediately check off the corresponding plan task in `docs/superpowers/plans/<plan-file>.md`; if that plan task maps to an item in `openspec/changes/<name>/tasks.md`, also change that OpenSpec task from `- [ ]` to `- [x]`; if the plan added a step that does not exist in OpenSpec, only the corresponding plan task needs to be checked off. Do not only update the built-in Todo or an in-chat checklist. The background subagent loads the Superpowers `subagent-driven-development` execution flow on its own and follows its guidance for implementation, review, and commit.
- If the current platform has no real background subagent / Task / multi-agent dispatch capability, must pause and wait for the user to choose main window execution instead. After the user chooses, must run `"$COMET_BASH" "$COMET_STATE" set <name> build_mode executing-plans`, then follow the `build_mode: executing-plans` branch to load the Superpowers `executing-plans` skill. Must not continue executing tasks before the user explicitly chooses.
After execution begins, follow the chosen branch to completion:
- Execute tasks according to plan
- Complete tasks.md check (`- [ ]` → `- [x]`)
- Check off the corresponding Superpowers plan task; if the task maps to OpenSpec tasks.md, also check off the corresponding OpenSpec task (`- [ ]` → `- [x]`)
- Commit code after each task completion
**TDD Mode Execution Constraints**:
If `tdd_mode: tdd`:
- `build_mode: executing-plans`: After loading the execution skill and before executing the first task, **Immediately execute:** Use the Skill tool to load the Superpowers `test-driven-development` skill once. Skipping this step is prohibited. After the skill loads, start from the first unchecked task and follow the loaded TDD Red-Green-Refactor cycle for each task. Must not skip the failing test verification phase. Do not reload this skill for subsequent tasks; follow the already-loaded flow. If resuming after context compaction, re-run this step to load the TDD skill once, then continue from the first unchecked task.
- `build_mode: subagent-driven-development`: When dispatching each subagent, must inject the TDD hard constraint into the prompt: **"You MUST follow TDD: for each task, write a failing test first, watch it fail, then write minimal code to pass. No production code without a failing test first."**. The same prompt must also include the OpenSpec tasks.md and Superpowers plan persistent check-off requirement above. Must not rely on implementer-prompt.md's conditional trigger; must explicitly write it in the dispatch prompt.
If `tdd_mode: direct`: Follow normal flow, no enforced TDD.
**`executing-plans` review gate**:
When `build_mode` is `executing-plans`, after all planned tasks are complete and before running the build → verify phase guard, must use the Skill tool to load the Superpowers `requesting-code-review` skill and request code review at least once.
Requirements:
- the `requesting-code-review` skill must be loaded before `"$COMET_BASH" "$COMET_GUARD" <change-name> build --apply`
- if `requesting-code-review` skill is unavailable, skip the review gate but must record `<!-- review skipped: skill unavailable -->` in tasks.md, then continue guard transition
- CRITICAL review findings (security vulnerabilities, data loss risk, build/test failures) must be fixed first and must not be carried into verify
- if non-CRITICAL review findings are accepted, record the acceptance reason and impact scope in tasks.md, the commit body, a verification report draft, or another durable artifact
### 3b. In-Execution Debugging (Debug Gate)
During task execution, whenever a crash, unexpected behavior, test failure, or build failure appears while running the program, tests, build, or manual verification, must use the Skill tool to load the Superpowers `systematic-debugging` skill. Before root-cause investigation is complete, must not propose or implement source-code fixes.
Handle it using the four-phase `systematic-debugging` flow:
- First reproduce and locate the root cause, read full errors, check recent changes, and trace data flow
- 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
- After the fix, run that failing test, related tests, and project build/verification commands to confirm all pass
- 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
### 4. Spec Incremental Updates

@@ -172,9 +252,13 @@

| Small | Missing acceptance scenarios, edge cases | Directly edit delta spec + design.md, append tasks.md tasks |
| Medium | Interface changes, new components, data flow changes | **Must use the AskUserQuestion tool to pause and wait for the user to explicitly confirm**, then must use Skill tool to load the Superpowers `brainstorming` skill to update Design Doc + delta spec |
| Large | Brand-new capability requirements | **Must use the AskUserQuestion tool to pause and wait for the user to explicitly confirm the split**; after user confirms, create independent change through `/comet-open` |
| Medium | Interface changes, new components, data flow changes | **Must use the current platform's available user input/confirmation mechanism to pause and wait for the user to explicitly confirm**, then must use Skill tool to load the Superpowers `brainstorming` skill to update Design Doc + delta spec |
| Large | Brand-new capability requirements | **Must use the current platform's available user input/confirmation mechanism to pause and wait for the user to explicitly confirm the split**; after user confirms, create independent change through `/comet-open` |
**50% Threshold Determination**: Using initial task count in tasks.md as baseline, if new tasks exceed half of that total, it's considered outside original plan scope, **must use the AskUserQuestion tool to pause and wait for the user to decide whether to split into a new change**. Must not just output a text prompt and then continue executing.
**50% Threshold Determination**: Using initial task count in tasks.md as baseline, if new tasks exceed half of that total, it's considered outside original plan scope, **must use the current platform's available user input/confirmation mechanism to pause and wait for the user to decide whether to split into a new change**. If the current platform has no structured question tool, ask split options in the conversation, stop the workflow, and wait for the user's reply before continuing.
When creating an independent change, must invoke `/comet-open`, not `/opsx:new` directly. `/comet-open` creates both OpenSpec artifacts and `.comet.yaml`, preventing the new change from leaving the Comet state machine.
**User choices must include**:
- "Split into new change" — create independent change via `/comet-open`
- "Continue in current change" — record scope-expansion decision, update tasks.md and delta spec, then continue
**Principles**:

@@ -190,3 +274,3 @@ - Delta spec is a living document, can be modified at any time during this phase

- **After each task**: immediately check off tasks.md and commit code so `.comet.yaml` and file state are durable
- **After each task**: immediately check off the corresponding task in the Superpowers plan; if the task maps to OpenSpec tasks.md, also check off the corresponding OpenSpec task; then commit code so `.comet.yaml` and file state are durable. Use `grep -c '\- \[ \]' tasks.md` to check remaining unchecked count; no need to re-read the entire file
- **After context compaction**: first run `"$COMET_BASH" "$COMET_STATE" check <change-name> build --recover` — the script outputs structured recovery context (isolation/build_mode status, plan path, task progress, recovery action). Follow the Recovery action to determine next step.

@@ -203,3 +287,5 @@ - **User manual-change resume**: handle uncommitted changes through `comet/reference/dirty-worktree.md`. That protocol defines checks, attribution, and prohibitions. Build-specific handling:

- `isolation` has been written as `branch` or `worktree`
- `build_mode` has been written as `subagent-driven-development`, `executing-plans`, or `direct` with explicit override
- `build_mode` has been written as `subagent-driven-development`, `executing-plans`, or `direct` with explicit override; if `subagent-driven-development`, `subagent_dispatch` must be `confirmed`
- `tdd_mode` has been written as `tdd` or `direct`
- If `build_mode` is `executing-plans`, the Skill tool has been used to load the Superpowers `requesting-code-review` skill and request code review at least once, and CRITICAL review findings have been fixed or acceptance rationale for non-CRITICAL review findings has been recorded
- **Phase guard**: Run `"$COMET_BASH" "$COMET_GUARD" <change-name> build --apply`; after all PASS, state advances to `phase: verify`

@@ -225,6 +311,15 @@

## Automatic Transition
## Automatic Handoff to Next Phase
After exit conditions are met (including user selecting workflow configuration), auto-transition to next phase:
> **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.
> **REQUIRED NEXT SKILL:** Invoke `comet-verify` skill to enter the verification and completion phase.
After exit conditions are met and guard-based phase advancement has completed, run:
```bash
"$COMET_BASH" "$COMET_STATE" next <change-name>
```
The script determines the next action from `phase`, `workflow`, and `auto_transition`:
- `NEXT: auto` -> invoke the `SKILL` target to continue to the next phase
- `NEXT: manual` -> do not invoke the next skill; follow `HINT` and ask the user to run `/<SKILL>` manually
- `NEXT: done` -> workflow is complete; no further action needed

@@ -41,4 +41,6 @@ ---

The script generates and records:
The script reads the change `.comet.yaml` `context_compression` snapshot, then generates and records the matching handoff package.
Default `context_compression: off` generates:
```

@@ -49,2 +51,9 @@ openspec/changes/<name>/.comet/handoff/design-context.json

Beta mode (`context_compression: beta` in project `.comet/config.yaml`, snapshotted into `.comet.yaml` when the change is created) generates:
```
openspec/changes/<name>/.comet/handoff/spec-context.json
openspec/changes/<name>/.comet/handoff/spec-context.md
```
And writes to `.comet.yaml`:

@@ -62,2 +71,7 @@

The beta handoff package is a **structured spec projection** that reduces OpenSpec token load without replacing the canonical spec:
- `spec-context.json`: machine index containing change, phase, canonical spec, source paths, hash, and file roles
- `spec-context.md`: context for Superpowers to read, verbatim-projecting delta spec files and referencing supporting artifacts by hash
- OpenSpec delta specs remain canonical; if the projection is missing, stale, or unclear, regenerate the handoff or read the source spec directly instead of writing an agent summary
If full context is genuinely needed, explicitly run:

@@ -77,5 +91,13 @@

**Immediately execute:** Use the Skill tool to load the Superpowers `brainstorming` skill, ARGUMENTS containing:
**Immediately execute:** Use the Skill tool to load the Superpowers `brainstorming` skill. Skipping this step is prohibited.
When loading the skill, ARGUMENTS must include:
```text
Language: Use the language of the user request that triggered this workflow
```
After the skill loads, follow its guidance and use the following context:
```
Change: <change-name>

@@ -85,5 +107,10 @@ OpenSpec Context Pack: openspec/changes/<name>/.comet/handoff/design-context.md

OpenSpec artifacts are the upstream source of truth. Do not redefine requirements, do not rewrite proposal/spec.
If context_compression is beta, use:
OpenSpec Context Pack: openspec/changes/<name>/.comet/handoff/spec-context.md
Machine handoff: openspec/changes/<name>/.comet/handoff/spec-context.json
OpenSpec artifacts are the upstream source of truth, but you must not weaken the Superpowers `brainstorming` clarification flow by "skipping redundant context exploration".
Your task is to perform deep technical design based on the handoff package: implementation approach, technical risks, testing strategy, boundary conditions.
If you find OpenSpec delta spec missing acceptance scenarios, you may only propose Spec Patches and write them back to OpenSpec delta spec; do not create a second requirements spec in the Design Doc.
If goals, scope, non-goals, acceptance scenarios, or key constraints remain unclear, you must continue asking questions and form the design proposal first; must not create the Design Doc after only one Q&A turn.
Do not rewrite proposal/spec; if you find OpenSpec delta spec missing acceptance scenarios, you may only propose Spec Patches and write them back to OpenSpec delta spec; do not create a second requirements spec in the Design Doc. Spec Patches are limited to supplementing acceptance scenarios, correcting ambiguous descriptions, or adding boundary conditions — they must not substantially rewrite the delta spec's structure or scope. If major changes are needed, flag them as design findings and return to brainstorming for confirmation.

@@ -97,6 +124,6 @@ Design Doc frontmatter must be minimal, containing only:

Skip redundant context exploration, proceed directly to design questions.
Proceed through the original `brainstorming` skill flow: clarifying questions, 2-3 approaches, and step-by-step design confirmation. Do not write the Design Doc early.
```
Skipping this step is prohibited. Proceeding without loading this skill is prohibited.
Proceeding without loading this skill is prohibited.

@@ -108,2 +135,3 @@ If the Superpowers `brainstorming` skill is unavailable, stop the process and prompt to install or enable Superpowers skills. Do not substitute this step with normal conversation.

- Testing strategy
- Requirement/scope gaps and Spec Patches to be written back
- If acceptance scenarios need supplementing, indicate delta spec changes to be written back

@@ -113,5 +141,7 @@

For context compaction recovery, the agent must incrementally update `brainstorm-summary.md` during brainstorming. After each clarification round or proposal iteration, update the file whenever new confirmed facts, key constraints, candidate approaches, trade-offs/risks, testing strategy, or Spec Patch candidates emerge; mark unconfirmed items as "pending" or "candidate". This file is a recovery checkpoint, not the Design Doc, and must not replace the Step 1c user confirmation.
### 1c. User Confirms Design Proposal (Blocking Point)
After brainstorming produces a design proposal, **must use the AskUserQuestion tool to pause and wait for the user to explicitly confirm the design proposal**. Must not create the final Design Doc, write `design_doc`, run design guard, or enter `/comet-build` before user confirmation. Must not just output a text prompt and then continue executing.
After brainstorming produces a design proposal, **must use the current platform's available user input/confirmation mechanism to pause and wait for the user to explicitly confirm the design proposal**. Must not create the final Design Doc, write `design_doc`, run design guard, or enter `/comet-build` before user confirmation. If the current platform has no structured question tool, ask a confirmation question in the conversation, stop the workflow, and wait for the user's reply before continuing.

@@ -126,7 +156,73 @@ When pausing, only present essential summary:

### 2. Update Comet State
### 1d. Brainstorming Checkpoint Finalization
First record the design_doc path. If Step 1c wrote back delta spec (added or modified `specs/*/spec.md`), must regenerate handoff to update hash:
After the user confirms the design proposal, before creating the Design Doc, create or update the incrementally maintained checkpoint file and finalize it as the confirmed design summary:
```bash
mkdir -p openspec/changes/<name>/.comet/handoff
```
`openspec/changes/<name>/.comet/handoff/brainstorm-summary.md` structure:
```markdown
# Brainstorm Summary
- Change: <change-name>
- Date: <YYYY-MM-DD>
## Confirmed Technical Approach
<summary of the user-confirmed approach>
## Key Trade-offs and Risks
<major trade-offs and risks>
## Testing Strategy
<testing method overview>
## Spec Patches
<delta spec changes to write back, or "None" if none>
```
**Context compaction note**: Each incremental update to `brainstorm-summary.md` is a relatively safe recovery point. After brainstorming completes, if the context window is tight, prefer compacting here. After compaction, reload the following files to continue Step 2:
- `openspec/changes/<name>/.comet/handoff/brainstorm-summary.md`
- `openspec/changes/<name>/.comet/handoff/design-context.md` (or `spec-context.md` in beta mode)
- `openspec/changes/<name>/.comet/handoff/design-context.json` (or `spec-context.json` in beta mode)
### 1e. Active Context Compaction Gate
After Step 1d completes and `brainstorm-summary.md` is written, enter the active compaction gate before creating the Design Doc. At this point the OpenSpec handoff, brainstorming decisions, and pending items are durable, so the agent should proactively release the earlier Spec and brainstorming context to preserve window space for Step 2 and the later Build phase.
Rules:
- If the current platform provides a native context compaction/cleanup mechanism (for example, the host agent's compact/compaction command, tool, or UI action), trigger active compaction here once; do not try to fake compaction through a shell script.
- The compaction resume prompt must include the change name, current step (Design Step 2), and the three handoff file categories listed above.
- If the current platform cannot be compacted programmatically by the agent, pause and tell the user to run the host platform's manual compaction action; continue to Step 2 only after the user confirms compaction is unavailable or asks to continue.
### 2. Create Design Doc
Create the Design Doc based on the full brainstorming conversation context (still in the main session).
Design Doc frontmatter must be minimal:
```yaml
---
comet_change: <change-name>
role: technical-design
canonical_spec: openspec
---
```
Write the Design Doc to `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md`.
If Spec Patches need to be written back, also edit the corresponding `specs/*/spec.md`.
**Context compaction recovery**: If context has been compacted, resume from `brainstorm-summary.md` + handoff context. If the user has not confirmed the design proposal yet, return to Step 1b/1c and continue brainstorming; if the user has confirmed it, continue creating the Design Doc. brainstorm-summary.md is the compaction checkpoint, not the sole input for the Design Doc — when creating, leverage the full recovered context as much as possible.
### 3. Update Comet State
First record the design_doc path. If Spec Patches wrote back delta spec (added or modified `specs/*/spec.md`), must regenerate handoff to update hash:
```bash
# Record design_doc path

@@ -150,3 +246,4 @@ "$COMET_BASH" "$COMET_STATE" set <name> design_doc docs/superpowers/specs/YYYY-MM-DD-topic-design.md

- `handoff_hash` matches current OpenSpec open phase artifacts (enforced by guard)
- `design-context.md` must be script-generated and contain source path, mode, sha256 traceability markers (enforced by guard)
- `design-context.md` or beta `spec-context.md` must be script-generated and contain source path, mode, sha256 traceability markers (enforced by guard)
- In beta mode, `spec-context.json` must be structurally valid and reference the current source files (enforced by guard)
- If new capabilities or supplementary acceptance scenarios exist, OpenSpec delta spec has been created/updated

@@ -172,6 +269,15 @@ - `design_doc` written to `.comet.yaml`

## Automatic Transition
## Automatic Handoff to Next Phase
After exit conditions are met (including user confirming the design proposal), auto-transition to next phase:
> **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.
> **REQUIRED NEXT SKILL:** Invoke `comet-build` skill to enter the plan and build phase.
After guard-based phase advancement, run:
```bash
"$COMET_BASH" "$COMET_STATE" next <change-name>
```
The script determines the next action from `phase`, `workflow`, and `auto_transition`:
- `NEXT: auto` -> invoke the `SKILL` target to continue to the next phase
- `NEXT: manual` -> do not invoke the next skill; follow `HINT` and ask the user to run `/<SKILL>` manually
- `NEXT: done` -> workflow is complete; no further action needed

@@ -19,6 +19,10 @@ ---

## Process (preset workflow, 5 steps)
## Process (preset workflow, 6 steps)
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.
### 0. Output Language Constraint
Streamlined OpenSpec artifacts must use the language of the user request that triggered this workflow.
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.
Locate Comet scripts before starting:

@@ -65,5 +69,14 @@

Check `auto_transition` to decide whether to continue:
```bash
"$COMET_BASH" "$COMET_STATE" next <name>
```
- `NEXT: auto` → continue to Step 2
- `NEXT: manual` → pause, follow `HINT` to prompt user to run `/<SKILL>` manually
### 2. Direct Build (preset build)
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).
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).

@@ -87,2 +100,10 @@ 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".

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.
Handle it using the four-phase `systematic-debugging` flow:
- First reproduce and locate the root cause, read full errors, check recent changes, and trace data flow
- 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
- After the fix, run that failing test, related tests, and project build/verification commands to confirm all pass
- 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
### 3. Root Cause Elimination Check

@@ -116,7 +137,7 @@

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, 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.
### 5. Archive (preset archive)
Reuse `/comet-archive`. Must satisfy `verify_result: pass` in `.comet.yaml` before archiving.
Reuse `/comet-archive`. Must satisfy `verify_result: pass` in `.comet.yaml` before archiving, and wait for `/comet-archive`'s final archive confirmation.

@@ -131,7 +152,12 @@ **Immediately execute:** Use the Skill tool to load the `comet-archive` skill to archive. Skipping this step is prohibited.

<IMPORTANT>
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:
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.
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
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.
The following situations must also pause and wait for user confirmation:
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
2. workspace isolation and execution-method selection when tasks exceed 3 and transfer to `/comet-build`
3. verify phase (comet-verify) verification-failure and branch-handling decisions
4. Final archive confirmation (before comet-archive runs the archive script)

@@ -157,8 +183,9 @@ Execution order: quick open → direct build → root cause check → verification → archive → complete

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.
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.
After user confirms upgrade, **must first update the workflow field** before entering full flow:
After user confirms upgrade, **must first update the workflow and phase fields** before entering full flow:
```bash
"$COMET_BASH" "$COMET_STATE" set <name> workflow full
"$COMET_BASH" "$COMET_STATE" set <name> phase design
```

@@ -176,1 +203,16 @@

- **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`
## Automatic Handoff to Next Phase
> **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.
After each phase guard or state transition advances phase, run:
```bash
"$COMET_BASH" "$COMET_STATE" next <name>
```
The script determines the next action from `phase`, `workflow`, and `auto_transition`:
- `NEXT: auto` -> invoke the `SKILL` target to continue the hotfix flow (`phase: build` returns `comet-hotfix`, `verify` returns `comet-verify`, `archive` returns `comet-archive`)
- `NEXT: manual` -> do not invoke the next skill; follow `HINT` and ask the user to run `/<SKILL>` manually
- `NEXT: done` -> workflow is complete; no further action needed
---
name: comet-open
description: "Comet Phase 1: Open. Invoke with /comet-open. Explore ideas through OpenSpec, create change structure (proposal + design + tasks)."
description: "Comet Phase 1: Open. Invoke with /comet-open. Explore ideas through OpenSpec, confirm requirements clarification, then create change structure (proposal + design + tasks)."
---

@@ -14,14 +14,78 @@

### 1. Explore Ideas
### 0. Output Language Constraint
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.
### 1. Explore Ideas and Clarify Requirements
**Immediately execute:** Use the Skill tool to load the `openspec-explore` skill. Skipping this step is prohibited.
After the skill loads, freely explore the problem space following its guidance.
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:
- Goals: the problem the user truly wants to solve and the expected outcome
- Non-goals: what is explicitly out of scope for this change
- Scope boundaries: included/excluded modules, users, platforms, or data
- Key unknowns: unresolved assumptions, risks, or dependencies
- Draft acceptance scenarios: at least the core success scenario and important boundary scenarios
The clarification summary must include: goals, non-goals, scope boundaries, key unknowns, and draft acceptance scenarios.
### 1a. PRD Split Preflight (Blocking Point)
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.
The split preflight must be based on clarified information and output a proposed split list. Each proposed split item must include:
- Suggested change name
- Goals and scope boundaries
- Explicit non-goals
- Dependencies or recommended execution order
- Core acceptance scenarios
Recommend splitting when any condition applies:
- The PRD contains multiple capabilities that can be independently designed, built, verified, and archived
- Multiple modules or user journeys are involved, and part of them can be delivered independently
- Clear phased milestones exist
- The work is expected to produce multiple delta specs or more than 3 large tasks
- Failure or delay in one part should not block other parts from entering later phases
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.
The user choices must include:
- "Create multiple OpenSpec changes" — create independent changes from the proposed split
- "Keep everything as one change" — continue the single-change flow and record the reason for not splitting in proposal/design/tasks
- "Adjust the split plan before continuing" — after the user describes the adjustment, output the revised proposed split list and ask for confirmation again
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.
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.
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.
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`.
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.
### 1b. Requirements Clarification Completion Confirmation (Blocking Point)
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.
When pausing, present the clarification summary: goals, non-goals, scope boundaries, key unknowns, and draft acceptance scenarios.
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.
### 2. Create Change Structure + Initialize State
**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.
**Immediately execute:** Use the Skill tool to load the `openspec-new-change` skill. Skipping this step is prohibited.
**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.
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.
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:
1. Run `openspec new change`, `openspec status`, and `openspec instructions` as the skill directs
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
3. If no clarification summary exists (edge case), fall back to the skill's default behavior of asking the user
Then fill in design.md and tasks.md one by one; every document must be based on the confirmed clarification summary.
**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.
Confirm the following artifacts have been created:

@@ -79,5 +143,5 @@

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.
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.
AskUserQuestion must be presented as a single-select question with the following summary and options:
The user confirmation question must be presented as a single-select question with the following summary and options:

@@ -93,3 +157,3 @@ **Summary content**:

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.
After user selects "Confirm", proceed to exit conditions. When user selects "Needs adjustment", modify the corresponding files per their notes, then request confirmation again.

@@ -110,8 +174,17 @@ ## Exit Conditions

## Automatic Transition
## Automatic Handoff to Next Phase
After user confirmation and exit conditions are met, auto-transition to next phase:
> **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.
> **REQUIRED NEXT SKILL (full workflow):** Invoke `comet-design` skill to enter the deep design phase.
>
> 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.
After user confirmation and guard-based phase advancement, run:
```bash
"$COMET_BASH" "$COMET_STATE" next <change-name>
```
The script determines the next action from `phase`, `workflow`, and `auto_transition`:
- `NEXT: auto` -> invoke the `SKILL` target to continue to the next phase
- `NEXT: manual` -> do not invoke the next skill; follow `HINT` and ask the user to run `/<SKILL>` manually
- `NEXT: done` -> workflow is complete; no further action needed
Hotfix/tweak presets are controlled by their preset skills (phase goes directly to build), and their `next` output points to the preset path.

@@ -16,3 +16,3 @@ ---

3. No interface changes
4. Typically no more than 3 tasks, 4 files
4. Typically no more than 3 tasks (file count constraint see upgrade conditions below)

@@ -25,4 +25,8 @@ **Not applicable**: If change process discovers need for capability, architecture or interface adjustments, should upgrade to full `/comet` workflow.

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.
### 0. Output Language Constraint
Streamlined OpenSpec artifacts must use the language of the user request that triggered this workflow.
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.
Locate Comet scripts before starting:

@@ -101,7 +105,7 @@

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, 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.
### 4. Archive (preset archive)
Reuse `/comet-archive`. Must satisfy `verify_result: pass` in `.comet.yaml` before archiving.
Reuse `/comet-archive`. Must satisfy `verify_result: pass` in `.comet.yaml` before archiving, and wait for `/comet-archive`'s final archive confirmation.

@@ -115,6 +119,11 @@ **Immediately execute:** Use the Skill tool to load the `comet-archive` skill to archive. Skipping this step is prohibited.

<IMPORTANT>
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:
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.
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
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.
The following situations must pause and wait for user confirmation:
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
2. verify phase (comet-verify) verification-failure and branch-handling decisions
3. Final archive confirmation (before comet-archive runs the archive script)

@@ -141,8 +150,9 @@ Execution order: quick open → lightweight build → lightweight verification → archive → complete

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.
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.
After user confirms upgrade, **must first update the workflow field** before entering full flow:
After user confirms upgrade, **must first update the workflow and phase fields** before entering full flow:
```bash
"$COMET_BASH" "$COMET_STATE" set <name> workflow full
"$COMET_BASH" "$COMET_STATE" set <name> phase design
```

@@ -160,1 +170,16 @@

- **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`
## Automatic Handoff to Next Phase
> **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.
After each phase guard or state transition advances phase, run:
```bash
"$COMET_BASH" "$COMET_STATE" next <name>
```
The script determines the next action from `phase`, `workflow`, and `auto_transition`:
- `NEXT: auto` -> invoke the `SKILL` target to continue the tweak flow (`phase: build` returns `comet-tweak`, `verify` returns `comet-verify`, `archive` returns `comet-archive`)
- `NEXT: manual` -> do not invoke the next skill; follow `HINT` and ask the user to run `/<SKILL>` manually
- `NEXT: done` -> workflow is complete; no further action needed

@@ -15,4 +15,8 @@ ---

### 0. Entry State Verification (Entry Check)
### 0a. Output Language Constraint
Verification reports and branch-handling notes must use the language of the user request that triggered this workflow.
### 0b. Entry State Verification (Entry Check)
Execute entry verification:

@@ -42,3 +46,3 @@

The script automatically counts tasks, delta spec count, changed file count, determines light or full verification mode, and sets the verify_mode field.
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.

@@ -58,2 +62,4 @@ Before verification begins, handle uncommitted changes through `comet/reference/dirty-worktree.md` protocol. Verify phase special handling:

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`.
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:

@@ -73,5 +79,7 @@

**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>`.
### 1b. Verification Failure Decision (Blocking Point)
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.
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.

@@ -89,5 +97,25 @@ When pausing, must list:

**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.
### 2. Artifact Context Loading (Hash On-Demand Read)
When verification needs to read OpenSpec artifacts, first check whether they have changed since the design phase:
```bash
RECORDED_HASH=$("$COMET_BASH" "$COMET_STATE" get <change-name> handoff_hash)
CURRENT_HASH=$("$COMET_BASH" "$COMET_HANDOFF" <change-name> --hash-only 2>/dev/null || echo "")
```
- 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.
- 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.
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.
**Immediately execute:** Use the Skill tool to load the Superpowers `verification-before-completion` skill. Skipping this step is prohibited.
After the skill loads, follow the `verify_mode` branch:
### 2a. Lightweight Verification (Small Changes)
When scale assessment result is "small", skip `openspec-verify-change` and directly execute these checks:
Run these 5 checks:

@@ -140,3 +168,3 @@ 1. All tasks.md tasks completed `[x]`

**Spec Drift Handling** (user decision point):
- 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:
- 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:
- 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

@@ -158,3 +186,3 @@ - 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

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.
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.

@@ -194,8 +222,19 @@ **Confirmation items**:

## Automatic Transition
## Automatic Handoff to Next Phase
After exit conditions are met (including user selecting branch handling method), auto-transition to next phase:
> **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.
> **REQUIRED NEXT SKILL:** Invoke `comet-archive` skill to enter the archive phase.
After verification and branch handling are complete, and guard-based phase advancement has completed, run:
```bash
"$COMET_BASH" "$COMET_STATE" next <change-name>
```
The script determines the next action from `phase`, `workflow`, and `auto_transition`:
- `NEXT: auto` -> invoke the `SKILL` target to continue to the next phase
- `NEXT: manual` -> do not invoke the next skill; follow `HINT` and ask the user to run `/<SKILL>` manually
- `NEXT: done` -> workflow is complete; no further action needed
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.
## Context Compaction Recovery

@@ -202,0 +241,0 @@

@@ -23,2 +23,3 @@ # Dirty Worktree Protocol

- The user may not say which files they changed. If the worktree is dirty, including new files shown as `??` in Git status, assume changes may come from the user or mixed sources.
- **Build artifact exclusion**: `??` files matching `.gitignore` patterns (e.g., `node_modules/`, `dist/`, `__pycache__/`, `*.o`, `target/`, `build/`) are automatically skipped during attribution and not treated as user changes.
- A dirty worktree is code evidence only. It does not automatically advance `.comet.yaml` `phase` or check off `tasks.md`; Comet state may advance only after attribution, verification, required document synchronization, and the relevant phase guard.

@@ -25,0 +26,0 @@

@@ -9,2 +9,3 @@ #!/bin/bash

COMET_BASH="${COMET_BASH:-${BASH:-bash}}"
COMET_OPENSPEC="${COMET_OPENSPEC:-openspec}"

@@ -43,5 +44,5 @@ red() { echo -e "\033[31m$1\033[0m" >&2; }

YAML="$CHANGE_DIR/.comet.yaml"
SCRIPT_DIR="$(cd "$(dirname "$(readlink -f "$0" 2>/dev/null || echo "$0")" 2>/dev/null || dirname "$0")" && pwd)"
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd -P)"
STATE_SH="$SCRIPT_DIR/comet-state.sh"
TODAY=$(date +%Y-%m-%d)
TODAY=$(date -u +%Y-%m-%d)
ARCHIVE_NAME="${TODAY}-${CHANGE}"

@@ -163,42 +164,4 @@ ARCHIVE_DIR="openspec/changes/archive/${ARCHIVE_NAME}"

# --- Step 4: Sync delta specs → main specs ---
# --- Step 4: Prepare document frontmatter annotation ---
sync_delta_specs() {
local delta_root="$CHANGE_DIR/specs"
if [ ! -d "$delta_root" ]; then
return 0
fi
for delta_spec_dir in "$delta_root"/*/; do
[ -d "$delta_spec_dir" ] || continue
local capability
capability=$(basename "$delta_spec_dir")
local delta_spec="$delta_spec_dir/spec.md"
local main_spec="openspec/specs/$capability/spec.md"
if [ ! -f "$delta_spec" ]; then
continue
fi
if [ "$DRY_RUN" -eq 1 ]; then
step_dry_run "Would sync: $capability → $main_spec"
continue
fi
if [ ! -f "$main_spec" ]; then
mkdir -p "openspec/specs/$capability"
elif ! cmp -s "$main_spec" "$delta_spec"; then
yellow " [DIFF] Delta spec differs from main spec before sync: $capability"
diff -u "$main_spec" "$delta_spec" >&2 || true
fi
cp "$delta_spec" "$main_spec"
step_ok "Delta spec synced: $capability → openspec/specs/$capability/spec.md"
done
}
sync_delta_specs
# --- Step 5: Annotate design doc frontmatter ---
annotate_frontmatter() {

@@ -220,2 +183,3 @@ local file="$1"

tmp_file=$(mktemp)
chmod 600 "$tmp_file"
awk -v archive="$ARCHIVE_NAME" -v extra="$extra_fields" '

@@ -235,2 +199,3 @@ /^archived-with:/ { next }

tmp_file=$(mktemp)
chmod 600 "$tmp_file"
{

@@ -252,2 +217,65 @@ echo "---"

# --- Step 5: Run OpenSpec archive for delta merge and move ---
verify_main_specs_clean() {
if [ ! -d "openspec/specs" ]; then
return 0
fi
local found=0
local matches
for spec_file in openspec/specs/*/spec.md; do
[ -f "$spec_file" ] || continue
matches=$(grep -nE '^## (ADDED|MODIFIED|REMOVED|RENAMED) Requirements$' "$spec_file" 2>/dev/null || true)
if [ -n "$matches" ]; then
red "FATAL: delta-only section heading leaked into main spec: $spec_file"
printf '%s\n' "$matches" >&2
found=1
fi
done
if [ "$found" -ne 0 ]; then
return 1
fi
return 0
}
resolve_archive_dir() {
if [ -d "$ARCHIVE_DIR" ]; then
return 0
fi
# Fallback: search for any directory matching *-$CHANGE in archive
local found
found=$(find "openspec/changes/archive" -maxdepth 1 -mindepth 1 -type d -name "*-$CHANGE" 2>/dev/null | head -1 || true)
if [ -n "$found" ]; then
ARCHIVE_DIR="$found"
ARCHIVE_NAME=$(basename "$found")
return 0
fi
return 1
}
if [ "$DRY_RUN" -eq 1 ]; then
step_dry_run "Would run OpenSpec archive: $CHANGE"
else
if ! command -v "$COMET_OPENSPEC" >/dev/null 2>&1; then
red "FATAL: OpenSpec CLI not found: $COMET_OPENSPEC"
red "Install OpenSpec or set COMET_OPENSPEC to the openspec executable."
exit 1
fi
"$COMET_OPENSPEC" archive "$CHANGE" --yes >&2
if ! resolve_archive_dir; then
step_fail "OpenSpec archive output not found"
exit 1
else
step_ok "OpenSpec archive completed: $ARCHIVE_DIR"
fi
verify_main_specs_clean
step_ok "Main specs verified clean"
fi
# --- Step 6: Annotate design doc and plan frontmatter ---
if [ -n "$DESIGN_DOC" ] && [ "$DESIGN_DOC" != "null" ]; then

@@ -257,4 +285,2 @@ annotate_frontmatter "$DESIGN_DOC" "status: final"

# --- Step 6: Annotate plan frontmatter ---
if [ -n "$PLAN_PATH" ] && [ "$PLAN_PATH" != "null" ]; then

@@ -264,14 +290,4 @@ annotate_frontmatter "$PLAN_PATH" ""

# --- Step 7: Move change to archive ---
# --- Step 7: Mark archived via comet-state transition ---
if [ "$DRY_RUN" -eq 1 ]; then
step_dry_run "Would move: $CHANGE_DIR → $ARCHIVE_DIR"
else
mkdir -p "openspec/changes/archive"
mv "$CHANGE_DIR" "$ARCHIVE_DIR"
step_ok "Moved to: $ARCHIVE_DIR"
fi
# --- Step 8: Mark archived via comet-state transition ---
ARCHIVE_YAML="$ARCHIVE_DIR/.comet.yaml"

@@ -290,3 +306,3 @@

# --- Step 9: Print summary ---
# --- Step 8: Print summary ---

@@ -293,0 +309,0 @@ echo "" >&2

@@ -37,15 +37,23 @@ #!/bin/bash

validate_change_name "$1"
if [ "${COMET_GUARD_SOURCE_ONLY:-0}" = "1" ]; then
CHANGE="${CHANGE:-}"
PHASE="${PHASE:-}"
APPLY="${APPLY:-0}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd -P)"
CHANGE_DIR="${CHANGE_DIR:-}"
else
validate_change_name "$1"
CHANGE="$1"
PHASE="$2"
APPLY=0
SCRIPT_DIR="$(dirname "$(readlink -f "$0" 2>/dev/null || echo "$0")" 2>/dev/null || dirname "$0")"
if [[ "${3:-}" == "--apply" ]]; then
APPLY=1
CHANGE="$1"
PHASE="$2"
APPLY=0
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd -P)"
if [[ "${3:-}" == "--apply" ]]; then
APPLY=1
fi
CHANGE_DIR="openspec/changes/$CHANGE"
if [ "$PHASE" = "archive" ] && [ ! -d "$CHANGE_DIR" ] && [ -d "openspec/changes/archive/$CHANGE" ]; then
CHANGE_DIR="openspec/changes/archive/$CHANGE"
fi
fi
CHANGE_DIR="openspec/changes/$CHANGE"
if [ "$PHASE" = "archive" ] && [ ! -d "$CHANGE_DIR" ] && [ -d "openspec/changes/archive/$CHANGE" ]; then
CHANGE_DIR="openspec/changes/archive/$CHANGE"
fi

@@ -98,2 +106,23 @@ BLOCK=0

plan_tasks_all_done() {
local plan
plan=$(yaml_field_value "plan" 2>/dev/null || true)
if [ -z "$plan" ] || [ "$plan" = "null" ]; then
return 0
fi
if [ ! -f "$plan" ]; then
echo "plan file is missing at $plan" >&2
echo "Next: restore the Superpowers plan file or update .comet.yaml plan before leaving build." >&2
return 1
fi
if grep -q '^[[:space:]]*- \[ \]' "$plan"; then
echo "Unfinished Superpowers plan tasks:" >&2
grep -n '^[[:space:]]*- \[ \]' "$plan" >&2 || true
echo "Next: check off corresponding completed plan tasks, then commit the plan update." >&2
return 1
fi
return 0
}
yaml_field_value() {

@@ -187,2 +216,13 @@ local field="$1"

local command="$1"
if [ -z "$command" ]; then
red "ERROR: build/verify command is empty" >&2
return 1
fi
# Basic command injection guard: reject dangerous shell metacharacters
# Quotes are allowed to support paths with spaces (e.g. Windows)
if [[ "$command" =~ [\;\|\&\$\`] ]]; then
red "ERROR: build/verify command contains shell metacharacters: $command" >&2
red "Allowed: alphanumeric, spaces, hyphens, underscores, dots, colons, forward slashes, quotes" >&2
return 1
fi
echo "+ $command" >&2

@@ -225,3 +265,4 @@ "$COMET_BASH" -lc "$command"

compute_handoff_hash() {
handoff_source_files | while IFS= read -r file; do
local hash_input
hash_input=$(handoff_source_files | while IFS= read -r file; do
if [ -f "$file" ]; then

@@ -231,3 +272,4 @@ printf 'path:%s\n' "$file"

fi
done | hash_stream
done)
printf '%s' "$hash_input" | hash_stream
}

@@ -352,2 +394,43 @@

subagent_dispatch_confirmed() {
local build_mode subagent_dispatch
build_mode=$(yaml_field_value "build_mode" 2>/dev/null || true)
subagent_dispatch=$(yaml_field_value "subagent_dispatch" 2>/dev/null || true)
if [ "$build_mode" != "subagent-driven-development" ]; then
return 0
fi
if [ "$subagent_dispatch" = "confirmed" ]; then
return 0
fi
echo "subagent_dispatch must be confirmed before using build_mode=subagent-driven-development" >&2
echo "Next: confirm the current platform has a real background subagent/Task/multi-agent dispatcher, then run:" >&2
echo " \"\$COMET_BASH\" \"\$COMET_STATE\" set $CHANGE subagent_dispatch confirmed" >&2
echo "Or ask the user to switch to executing-plans and run:" >&2
echo " \"\$COMET_BASH\" \"\$COMET_STATE\" set $CHANGE build_mode executing-plans" >&2
return 1
}
tdd_mode_selected() {
local workflow tdd_mode
workflow=$(yaml_field_value "workflow" 2>/dev/null || true)
tdd_mode=$(yaml_field_value "tdd_mode" 2>/dev/null || true)
case "$workflow" in
hotfix|tweak) return 0 ;;
esac
case "$tdd_mode" in
tdd|direct) return 0 ;;
*)
echo "tdd_mode must be tdd or direct for full workflow, got '${tdd_mode:-null}'" >&2
echo "Next: ask the user to choose TDD enforcement level, then run:" >&2
echo " \"\$COMET_BASH\" \"\$COMET_STATE\" set $CHANGE tdd_mode <tdd|direct>" >&2
return 1
;;
esac
}
verify_result_is_pass() {

@@ -425,3 +508,3 @@ local result

}
grep -Eq '^- Mode: (compact|full)$' "$markdown" || {
grep -Eq '^- Mode: (compact|full|beta)$' "$markdown" || {
echo "handoff markdown is missing Mode marker" >&2

@@ -445,2 +528,43 @@ missing=1

context_compression_mode() {
local mode
mode=$(yaml_field_value "context_compression" 2>/dev/null || true)
printf '%s\n' "${mode:-off}"
}
beta_spec_json_structurally_valid() {
local context missing=0
if [ "$(context_compression_mode)" != "beta" ]; then
return 0
fi
context=$(yaml_field_value "handoff_context" 2>/dev/null || true)
if [ -z "$context" ] || [ "$context" = "null" ]; then
echo "handoff_context is missing from .comet.yaml" >&2
return 1
fi
if [ ! -s "$context" ]; then
echo "spec-context.json is missing or empty: $context" >&2
return 1
fi
# Validate required JSON fields
grep -q '"change"' "$context" || { echo "spec-context.json missing 'change' field" >&2; return 1; }
grep -q '"phase"' "$context" || { echo "spec-context.json missing 'phase' field" >&2; return 1; }
grep -q '"mode": "beta"' "$context" || { echo "spec-context.json mode is not beta" >&2; return 1; }
grep -q '"files"' "$context" || { echo "spec-context.json missing 'files' field" >&2; return 1; }
grep -q '"context_hash"' "$context" || { echo "spec-context.json missing 'context_hash' field" >&2; return 1; }
# Verify all source files are referenced in the JSON
handoff_source_files | while IFS= read -r file; do
[ -f "$file" ] || continue
if ! grep -qF "$file" "$context"; then
echo "spec-context.json missing source file reference: $file" >&2
exit 2
fi
done || missing=1
[ "$missing" -eq 0 ]
}
design_doc_frontmatter_has() {

@@ -505,4 +629,5 @@ local design_doc="$1"

local design_doc
local design_doc workflow
design_doc=$(yaml_field_value "design_doc" 2>/dev/null || true)
workflow=$(yaml_field_value "workflow" 2>/dev/null || true)

@@ -514,3 +639,11 @@ check "proposal.md exists" file_nonempty "$CHANGE_DIR/proposal.md"

check "design handoff markdown is traceable" design_handoff_markdown_traceable
if [ "$(context_compression_mode)" = "beta" ]; then
check "beta spec-context.json is structurally valid" beta_spec_json_structurally_valid
fi
if [ "$workflow" = "full" ]; then
# Full workflow: design_doc is REQUIRED
check "design_doc is recorded for full workflow" design_doc_recorded
fi
if [ -n "$design_doc" ] && [ "$design_doc" != "null" ]; then

@@ -521,7 +654,18 @@ check "Design Doc ($design_doc) exists" file_nonempty "$design_doc"

check "Design Doc declares OpenSpec as canonical spec" design_doc_declares_canonical_spec
else
warn " [WARN] No design_doc recorded in .comet.yaml"
elif [ "$workflow" != "full" ]; then
warn " [WARN] No design_doc recorded in .comet.yaml (optional for hotfix/tweak)"
fi
}
design_doc_recorded() {
local design_doc
design_doc=$(yaml_field_value "design_doc" 2>/dev/null || true)
if [ -n "$design_doc" ] && [ "$design_doc" != "null" ] && [ -f "$design_doc" ]; then
return 0
fi
echo "design_doc must point to an existing Superpowers Design Doc for full workflow before leaving design." >&2
echo "Next: create the Design Doc and run: \"\$COMET_BASH\" \"\$COMET_STATE\" set $CHANGE design_doc <path>" >&2
return 1
}
guard_build() {

@@ -533,3 +677,6 @@ echo "=== Guard: build → verify ===" >&2

check "build_mode allowed for workflow" build_mode_allowed_for_workflow
check "subagent dispatch confirmed" subagent_dispatch_confirmed
check "tdd_mode selected" tdd_mode_selected
check "tasks.md all tasks checked" tasks_all_done
check "Superpowers plan all tasks checked" plan_tasks_all_done
check "proposal.md exists" file_nonempty "$CHANGE_DIR/proposal.md"

@@ -553,2 +700,3 @@ check "Build passes" build_passes

check "proposal.md exists" file_nonempty "$CHANGE_DIR/proposal.md"
check "design.md exists" file_nonempty "$CHANGE_DIR/design.md"
check "tasks.md all tasks checked" tasks_all_done

@@ -576,2 +724,10 @@ }

if [ "${COMET_GUARD_SOURCE_ONLY:-0}" = "1" ]; then
return 0 2>/dev/null
# shellcheck disable=SC2317 # unreachable if sourced; fallback for direct execution
red "ERROR: COMET_GUARD_SOURCE_ONLY=1 is only for sourcing, not direct execution" >&2
# shellcheck disable=SC2317
exit 1
fi
case "$PHASE" in

@@ -578,0 +734,0 @@ open) preflight ; guard_open ;;

#!/bin/bash
# Comet Handoff — creates machine-owned context packages between phases
# Usage: comet-handoff.sh <change-name> design --write [--full]
# comet-handoff.sh <change-name> --hash-only

@@ -11,2 +12,3 @@ set -euo pipefail

green() { echo -e "\033[32m$1\033[0m" >&2; }
warn() { echo -e "\033[33m$1\033[0m" >&2; }

@@ -107,3 +109,4 @@ validate_change_name() {

compute_context_hash() {
source_files | while IFS= read -r file; do
local hash_input
hash_input=$(source_files | while IFS= read -r file; do
if [ -f "$file" ]; then

@@ -113,3 +116,4 @@ printf 'path:%s\n' "$file"

fi
done | hash_stream
done)
printf '%s' "$hash_input" | hash_stream
}

@@ -202,2 +206,82 @@

write_spec_projection_for_file() {
local file="$1"
echo "## $file"
echo ""
echo "- Source: $file"
echo "- Lines: 1-$(file_line_count "$file")"
echo "- SHA256: $(hash_file "$file")"
echo ""
echo '```md'
cat "$file"
echo '```'
echo ""
}
write_spec_markdown_context() {
local output="$1"
{
echo "# Comet Spec Context"
echo ""
echo "- Change: $CHANGE"
echo "- Phase: design"
echo "- Mode: beta"
echo "- Context hash: $CONTEXT_HASH"
echo ""
echo "Generated-by: comet-handoff.sh"
echo ""
echo "OpenSpec remains the canonical capability spec. This beta context pack verbatim-projects spec files and references supporting artifacts by hash, not an agent-authored summary."
echo ""
echo "## Source References"
echo ""
source_files | while IFS= read -r file; do
[ -f "$file" ] || continue
echo "- Source: $file"
echo "- SHA256: $(hash_file "$file")"
done
echo ""
echo "## Acceptance Projection"
echo ""
if [ -d "$CHANGE_DIR/specs" ]; then
find "$CHANGE_DIR/specs" -path '*/spec.md' -type f 2>/dev/null | sort | while IFS= read -r file; do
write_spec_projection_for_file "$file"
done
else
echo "No delta spec files found."
echo ""
fi
echo "Full source files remain canonical. If a required heading or scenario is missing here, regenerate the handoff or read the source spec directly. Supporting files (proposal, design, tasks) are referenced by hash only."
} > "$output"
}
write_spec_json_context() {
local output="$1"
{
echo "{"
echo " \"change\": \"$(json_escape "$CHANGE")\","
echo " \"phase\": \"design\","
echo " \"mode\": \"beta\","
echo " \"canonical_spec\": \"openspec\","
echo " \"generated_by\": \"comet-handoff.sh\","
echo " \"context_hash\": \"$CONTEXT_HASH\","
echo " \"files\": ["
local first_file=1
while IFS= read -r file; do
[ -f "$file" ] || continue
local role="supporting"
case "$file" in
*/specs/*/spec.md) role="spec" ;;
esac
if [ "$first_file" -eq 0 ]; then
echo ","
fi
first_file=0
printf ' { "path": "%s", "sha256": "%s", "role": "%s" }' "$(json_escape "$file")" "$(hash_file "$file")" "$role"
done < <(source_files)
echo ""
echo " ]"
echo "}"
} > "$output"
}
CHANGE="${1:-}"

@@ -210,2 +294,21 @@ PHASE="${2:-}"

# --hash-only: compute and output context hash without generating handoff files
if [ "${PHASE:-}" = "--hash-only" ]; then
CHANGE_DIR="openspec/changes/$CHANGE"
if [ ! -d "$CHANGE_DIR" ]; then
red "ERROR: change directory not found: $CHANGE_DIR"
exit 1
fi
for required in proposal.md design.md tasks.md; do
if [ ! -s "$CHANGE_DIR/$required" ]; then
red "ERROR: required file missing or empty: $CHANGE_DIR/$required"
exit 1
fi
done
CONTEXT_HASH="$(compute_context_hash)"
printf '%s
' "$CONTEXT_HASH"
exit 0
fi
if [ "$PHASE" != "design" ] || [ "$MODE" != "--write" ]; then

@@ -250,9 +353,33 @@ red "Usage: comet-handoff.sh <change-name> design --write [--full]"

HANDOFF_DIR="$CHANGE_DIR/.comet/handoff"
CONTEXT_JSON="$HANDOFF_DIR/design-context.json"
CONTEXT_MD="$HANDOFF_DIR/design-context.md"
CONTEXT_COMPRESSION="$(yaml_field_value context_compression 2>/dev/null || true)"
CONTEXT_COMPRESSION="${CONTEXT_COMPRESSION:-off}"
case "$CONTEXT_COMPRESSION" in
off)
CONTEXT_JSON="$HANDOFF_DIR/design-context.json"
CONTEXT_MD="$HANDOFF_DIR/design-context.md"
;;
beta)
if [ "$HANDOFF_MODE" = "full" ]; then
warn "[HANDOFF] --full is ignored in beta mode; spec files are projected verbatim"
fi
HANDOFF_MODE="beta"
CONTEXT_JSON="$HANDOFF_DIR/spec-context.json"
CONTEXT_MD="$HANDOFF_DIR/spec-context.md"
;;
*)
red "ERROR: invalid context_compression: $CONTEXT_COMPRESSION"
red "Valid values: off, beta"
exit 1
;;
esac
mkdir -p "$HANDOFF_DIR"
CONTEXT_HASH="$(compute_context_hash)"
write_markdown_context "$CONTEXT_MD"
write_json_context "$CONTEXT_JSON"
if [ "$CONTEXT_COMPRESSION" = "beta" ]; then
write_spec_markdown_context "$CONTEXT_MD"
write_spec_json_context "$CONTEXT_JSON"
else
write_markdown_context "$CONTEXT_MD"
write_json_context "$CONTEXT_JSON"
fi

@@ -259,0 +386,0 @@ if [ -x "$STATE_SH" ] || [ -f "$STATE_SH" ]; then

@@ -68,2 +68,22 @@ #!/bin/bash

validate_path_field() {
local value="$1"
local field="$2"
# null and empty are acceptable (means "not set")
if [ -z "$value" ] || [ "$value" = "null" ]; then
return 0
fi
# Reject absolute paths and home-directory references
case "$value" in
/*|~*|[A-Za-z]:*|\\*)
red "ERROR: $field must be a relative path within the repo: '$value'" >&2
exit 1
;;
esac
if [[ "$value" =~ \.\. ]]; then
red "ERROR: $field cannot contain '..' (path traversal not allowed): '$value'" >&2
exit 1
fi
}
# --- Helper functions ---

@@ -130,5 +150,13 @@

tmp_file=$(mktemp)
chmod 600 "$tmp_file"
# Replace the target field, then deduplicate all fields keeping only the
# last occurrence of each key. Prevents stale earlier values from
# persisting when a field is set multiple times.
awk -v field="$field" -v value="$value" '
index($0, field ":") == 1 { print field ": " value; next }
{ print }
index($0, field ":") == 1 { $0 = field ": " value }
{ buf[NR] = $0; keys[NR] = $0; sub(/:.*$/, "", keys[NR]); n = NR }
END {
for (i = 1; i <= n; i++) last[keys[i]] = i
for (i = 1; i <= n; i++) if (last[keys[i]] == i) print buf[i]
}
' "$yaml_file" > "$tmp_file"

@@ -160,2 +188,53 @@ mv "$tmp_file" "$yaml_file"

project_context_compression() {
local value="off"
local source="default"
if [ -n "${COMET_CONTEXT_COMPRESSION:-}" ]; then
value="$COMET_CONTEXT_COMPRESSION"
source="COMET_CONTEXT_COMPRESSION"
elif [ -f ".comet/config.yaml" ]; then
value=$(yaml_field "context_compression" ".comet/config.yaml")
value="${value:-off}"
source=".comet/config.yaml"
fi
case "$value" in
off|beta)
printf '%s\n' "$value"
;;
*)
red "ERROR: Invalid context_compression from ${source}: '$value'" >&2
red "Valid values: off, beta" >&2
exit 1
;;
esac
}
project_auto_transition_default() {
local value="true"
local source="default"
if [ -n "${COMET_AUTO_TRANSITION:-}" ]; then
value="$COMET_AUTO_TRANSITION"
source="COMET_AUTO_TRANSITION"
elif [ -f ".comet/config.yaml" ]; then
local raw
raw=$(yaml_field "auto_transition" ".comet/config.yaml" 2>/dev/null || true)
if [ -n "$raw" ]; then
value="$raw"
source=".comet/config.yaml"
fi
fi
case "$value" in
true|false)
printf '%s\n' "$value"
;;
*)
red "ERROR: Invalid auto_transition from ${source}: '$value'" >&2
red "Valid values: true, false" >&2
exit 1
;;
esac
}
# --- Subcommands ---

@@ -184,4 +263,6 @@

# Set workflow-appropriate defaults
local phase build_mode isolation verify_mode
local phase build_mode isolation verify_mode context_compression auto_transition
phase="open"
context_compression=$(project_context_compression)
auto_transition="$(project_auto_transition_default)"

@@ -191,2 +272,3 @@ case "$workflow" in

build_mode="null"
tdd_mode="null"
isolation="null"

@@ -197,2 +279,3 @@ verify_mode="null"

build_mode="direct"
tdd_mode="direct"
isolation="branch"

@@ -213,6 +296,10 @@ verify_mode="light"

phase: $phase
context_compression: $context_compression
build_mode: $build_mode
build_pause: null
subagent_dispatch: null
tdd_mode: $tdd_mode
isolation: $isolation
verify_mode: $verify_mode
auto_transition: $auto_transition
base_ref: $base_ref

@@ -224,3 +311,3 @@ design_doc: null

branch_status: pending
created_at: $(date +%Y-%m-%d)
created_at: $(date -u +%Y-%m-%d)
verified_at: null

@@ -251,2 +338,5 @@ archived: false

value=$(yaml_field "$field" "$yaml_file")
if [ "$field" = "auto_transition" ] && { [ -z "$value" ] || [ "$value" = "null" ]; }; then
value="$(project_auto_transition_default)"
fi
echo "${value:-}"

@@ -277,3 +367,3 @@ }

;;
workflow|build_mode|build_pause|isolation|verify_mode|verify_result|verification_report|branch_status|archived|design_doc|plan|verified_at|created_at|direct_override|build_command|verify_command|handoff_context|handoff_hash|base_ref)
workflow|context_compression|build_mode|build_pause|subagent_dispatch|tdd_mode|isolation|verify_mode|auto_transition|verify_result|verification_report|branch_status|archived|design_doc|plan|verified_at|created_at|direct_override|build_command|verify_command|handoff_context|handoff_hash|base_ref)
# Valid field

@@ -284,4 +374,4 @@ ;;

red "Valid fields:" >&2
red " workflow, phase, design_doc, plan, build_mode, build_pause, isolation," >&2
red " verify_mode, verify_result, verification_report, branch_status," >&2
red " workflow, phase, context_compression, design_doc, plan, build_mode, build_pause, subagent_dispatch, tdd_mode, isolation," >&2
red " verify_mode, auto_transition, verify_result, verification_report, branch_status," >&2
red " verified_at, created_at, archived, base_ref, direct_override," >&2

@@ -298,2 +388,5 @@ red " build_command, verify_command, handoff_context, handoff_hash" >&2

;;
context_compression)
validate_enum "$value" "off" "beta"
;;
phase)

@@ -308,2 +401,8 @@ validate_enum "$value" "open" "design" "build" "verify" "archive"

;;
subagent_dispatch)
validate_enum "$value" "null" "confirmed"
;;
tdd_mode)
validate_enum "$value" "tdd" "direct"
;;
isolation)

@@ -315,2 +414,5 @@ validate_enum "$value" "branch" "worktree"

;;
auto_transition)
validate_enum "$value" "true" "false"
;;
verify_result)

@@ -328,5 +430,8 @@ validate_enum "$value" "pending" "pass" "fail"

;;
design_doc|plan|verification_report|verified_at|created_at|build_command|verify_command|handoff_context|handoff_hash)
# No validation for path fields, date fields, or project command strings
design_doc|plan|verification_report|handoff_context|handoff_hash)
validate_path_field "$value" "$field"
;;
verified_at|created_at|build_command|verify_command)
# No validation for date fields or project command strings
;;
esac

@@ -375,3 +480,3 @@

local change_name="$1"
local workflow build_mode isolation direct_override
local workflow build_mode isolation direct_override subagent_dispatch tdd_mode
workflow=$(cmd_get "$change_name" "workflow")

@@ -381,2 +486,4 @@ build_mode=$(cmd_get "$change_name" "build_mode")

direct_override=$(cmd_get "$change_name" "direct_override" 2>/dev/null || true)
subagent_dispatch=$(cmd_get "$change_name" "subagent_dispatch" 2>/dev/null || true)
tdd_mode=$(cmd_get "$change_name" "tdd_mode" 2>/dev/null || true)

@@ -403,2 +510,12 @@ case "$isolation" in

fi
if [ "$build_mode" = "subagent-driven-development" ] && [ "$subagent_dispatch" != "confirmed" ]; then
red "ERROR: Cannot transition '$change_name': subagent_dispatch must be confirmed before using build_mode=subagent-driven-development" >&2
exit 1
fi
if [ "$workflow" = "full" ] && { [ "$tdd_mode" = "null" ] || [ -z "$tdd_mode" ]; }; then
red "ERROR: Cannot transition '$change_name': tdd_mode must be selected before leaving build (full workflow)" >&2
exit 1
fi
}

@@ -411,3 +528,3 @@

validate_change_name "$change_name"
validate_enum "$event" "open-complete" "design-complete" "build-complete" "verify-pass" "verify-fail" "archived"
validate_enum "$event" "open-complete" "design-complete" "build-complete" "verify-pass" "verify-fail" "archive-reopen" "archived"

@@ -432,6 +549,12 @@ case "$event" in

require_build_decisions "$change_name"
local current_verify_result
current_verify_result=$(cmd_get "$change_name" "verify_result")
cmd_set "$change_name" phase verify
cmd_set "$change_name" verify_result pending
cmd_set "$change_name" verification_report null
cmd_set "$change_name" branch_status pending
# Preserve verification evidence on re-verify (verify-fail → build → build-complete)
# so the fix can reference the original failure report
if [ "$current_verify_result" != "fail" ]; then
cmd_set "$change_name" verification_report null
cmd_set "$change_name" branch_status pending
fi
;;

@@ -443,3 +566,3 @@ verify-pass)

cmd_set "$change_name" phase archive
cmd_set "$change_name" verified_at "$(date +%Y-%m-%d)"
cmd_set "$change_name" verified_at "$(date -u +%Y-%m-%d)"
;;

@@ -450,4 +573,16 @@ verify-fail)

cmd_set "$change_name" phase build
cmd_set "$change_name" branch_status pending
# Preserve branch_status so re-verify doesn't require re-handling branches
;;
archive-reopen)
require_phase "$change_name" "archive"
local archived
archived=$(cmd_get "$change_name" "archived")
if [ "$archived" = "true" ]; then
red "ERROR: Cannot transition '$change_name': already archived" >&2
exit 1
fi
cmd_set "$change_name" verify_result pending
cmd_set "$change_name" phase verify
cmd_set "$change_name" verified_at null
;;
archived)

@@ -661,3 +796,3 @@ require_phase "$change_name" "archive"

local design_doc plan verify_result verify_mode verification_report
local branch_status handoff_context handoff_hash isolation build_mode build_pause direct_override
local branch_status handoff_context handoff_hash isolation build_mode build_pause subagent_dispatch tdd_mode direct_override
design_doc=$(cmd_get "$change_name" "design_doc")

@@ -674,2 +809,4 @@ plan=$(cmd_get "$change_name" "plan")

build_pause=$(cmd_get "$change_name" "build_pause" 2>/dev/null || true)
subagent_dispatch=$(cmd_get "$change_name" "subagent_dispatch" 2>/dev/null || true)
tdd_mode=$(cmd_get "$change_name" "tdd_mode" 2>/dev/null || true)
direct_override=$(cmd_get "$change_name" "direct_override" 2>/dev/null || true)

@@ -683,5 +820,7 @@

echo " Artifacts:"
local artifacts_done=0
for f in proposal.md design.md tasks.md; do
if file_nonempty "$change_dir/$f"; then
echo " - ${f}: DONE"
artifacts_done=$((artifacts_done + 1))
else

@@ -692,3 +831,9 @@ echo " - ${f}: PENDING"

echo ""
echo "Recovery action: Create or complete missing artifacts, then use AskUserQuestion for user confirmation."
if [ "$artifacts_done" -eq 3 ]; then
echo "Recovery action: All artifacts complete. Run /comet-open user confirmation, then guard to transition."
elif [ "$artifacts_done" -eq 0 ]; then
echo "Recovery action: No artifacts created yet. Start from /comet-open Step 1 (explore and clarify)."
else
echo "Recovery action: Some artifacts incomplete. Resume /comet-open from the first missing artifact."
fi
;;

@@ -723,2 +868,6 @@ design)

field_status "build_pause" "$build_pause"
field_status "tdd_mode" "$tdd_mode"
if [ "$build_mode" = "subagent-driven-development" ] || { [ -n "$subagent_dispatch" ] && [ "$subagent_dispatch" != "null" ]; }; then
field_status "subagent_dispatch" "$subagent_dispatch"
fi
if [ "$build_mode" = "direct" ] && [ "$workflow" != "hotfix" ] && [ "$workflow" != "tweak" ]; then

@@ -734,5 +883,8 @@ field_status "direct_override" "$direct_override"

local total=0 done=0 pending=0
local plan_total=0 plan_done=0 plan_pending=0
if [ -f "$tasks_file" ]; then
total=$(grep -c '^\- \[' "$tasks_file" 2>/dev/null || echo "0")
done=$(grep -c '^\- \[x\]' "$tasks_file" 2>/dev/null || echo "0")
total=$(grep -c '^[[:space:]]*- \[' "$tasks_file" 2>/dev/null || true)
done=$(grep -c '^[[:space:]]*- \[x\]' "$tasks_file" 2>/dev/null || true)
total="${total:-0}"
done="${done:-0}"
pending=$((total - done))

@@ -743,2 +895,12 @@ echo " Tasks: ${done}/${total} done, ${pending} pending"

fi
if [ -n "$plan" ] && [ "$plan" != "null" ] && [ -f "$plan" ]; then
plan_total=$(grep -c '^[[:space:]]*- \[' "$plan" 2>/dev/null || true)
plan_done=$(grep -c '^[[:space:]]*- \[x\]' "$plan" 2>/dev/null || true)
plan_total="${plan_total:-0}"
plan_done="${plan_done:-0}"
plan_pending=$((plan_total - plan_done))
if [ "$plan_total" -gt 0 ]; then
echo " Plan tasks: ${plan_done}/${plan_total} done, ${plan_pending} pending"
fi
fi
echo ""

@@ -750,11 +912,41 @@ if [ "$build_pause" = "plan-ready" ] && [ -n "$plan" ] && [ "$plan" != "null" ] && [ -f "$plan" ] && { [ "$isolation" = "null" ] || [ -z "$isolation" ] || [ "$build_mode" = "null" ] || [ -z "$build_mode" ]; }; then

elif [ "$build_pause" = "plan-ready" ]; then
echo "Recovery action: Plan-ready pause is stale because build decisions are already selected. Clear build_pause to null, then continue from the first unchecked task."
if [ "$build_mode" = "subagent-driven-development" ] && { [ "$pending" -gt 0 ] || [ "$plan_pending" -gt 0 ]; }; then
if [ "$subagent_dispatch" = "confirmed" ]; then
echo "Recovery action: Plan-ready pause is stale because build decisions are already selected. Clear build_pause to null, then inspect the first unchecked task (OpenSpec or plan additions) against recent git history/diff. If implemented, check it off; otherwise dispatch a real background subagent. Do not execute the pending task directly in the main window."
else
echo "Recovery action: Plan-ready pause is stale and subagent dispatch is not confirmed. Confirm a real background subagent/Task/multi-agent dispatcher and set subagent_dispatch to confirmed, or set build_mode to executing-plans before continuing."
fi
elif [ "$pending" -gt 0 ] || [ "$plan_pending" -gt 0 ]; then
echo "Recovery action: Plan-ready pause is stale because build decisions are already selected. Clear build_pause to null, then continue from the first unchecked task."
else
echo "Recovery action: Plan-ready pause is stale and all tasks are done. Clear build_pause to null, then run guard to transition to verify."
fi
elif [ "$isolation" = "null" ] || [ -z "$isolation" ]; then
echo "Recovery action: Isolation not selected. Use AskUserQuestion to ask user for branch/worktree choice."
echo "Recovery action: Isolation not selected. Use the current platform's user confirmation mechanism to ask user for branch/worktree choice."
elif [ "$build_mode" = "null" ] || [ -z "$build_mode" ]; then
echo "Recovery action: Build mode not selected. Use AskUserQuestion to ask user for execution method."
echo "Recovery action: Build mode not selected. Use the current platform's user confirmation mechanism to ask user for execution method."
elif [ -z "$tdd_mode" ] || [ "$tdd_mode" = "null" ]; then
echo "Recovery action: TDD mode not selected. Use the current platform's user confirmation mechanism to ask user for tdd or direct."
elif [ ! -f "$tasks_file" ]; then
echo "Recovery action: tasks.md missing. Verify change directory integrity."
elif [ "$pending" -gt 0 ]; then
echo "Recovery action: Read tasks.md and continue from first unchecked task."
if [ "$build_mode" = "subagent-driven-development" ]; then
if [ "$subagent_dispatch" = "confirmed" ]; then
echo "Recovery action: Read tasks.md and the Superpowers plan (which may include additions beyond OpenSpec), then inspect the first unchecked task against recent git history/diff. If implemented, check it off; otherwise dispatch a real background subagent. Do not execute the pending task directly in the main window."
else
echo "Recovery action: Subagent dispatch is not confirmed. Confirm a real background subagent/Task/multi-agent dispatcher and set subagent_dispatch to confirmed, or set build_mode to executing-plans before continuing."
fi
else
echo "Recovery action: Read tasks.md and continue from first unchecked task."
fi
elif [ "$plan_pending" -gt 0 ]; then
if [ "$build_mode" = "subagent-driven-development" ]; then
if [ "$subagent_dispatch" = "confirmed" ]; then
echo "Recovery action: Read the Superpowers plan, then inspect the first unchecked Superpowers plan task against recent git history/diff. If implemented, check it off; otherwise dispatch a real background subagent. Do not execute the pending task directly in the main window."
else
echo "Recovery action: Subagent dispatch is not confirmed. Confirm a real background subagent/Task/multi-agent dispatcher and set subagent_dispatch to confirmed, or set build_mode to executing-plans before continuing."
fi
else
echo "Recovery action: Read the Superpowers plan and continue from the first unchecked plan task."
fi
else

@@ -832,3 +1024,3 @@ echo "Recovery action: All tasks done. Run guard to transition to verify."

if [ -n "$plan_file" ] && [ "$plan_file" != "null" ] && [ -f "$plan_file" ]; then
base_ref=$(grep '^base-ref:' "$plan_file" 2>/dev/null | head -1 | sed 's/^base-ref: *//')
base_ref=$(grep '^base-ref:' "$plan_file" 2>/dev/null | head -1 | sed 's/^base-ref: *//' || true)
fi

@@ -866,2 +1058,77 @@ # Fallback to base_ref stored in .comet.yaml (set during init)

# Resolve the next workflow step after a guard --apply phase advance.
# Reads the (already advanced) phase, workflow, and auto_transition, then emits
# a deterministic next-step contract so skills don't hardcode the next skill name.
#
# Output contract (stdout):
# NEXT: auto|manual|done
# SKILL: <skill-name> (omitted when NEXT=done)
# HINT: <message> (only when NEXT=manual)
cmd_next() {
local change_name="$1"
validate_change_name "$change_name"
local change_dir="openspec/changes/$change_name"
local yaml_file="$change_dir/.comet.yaml"
if [ ! -f "$yaml_file" ]; then
red "ERROR: .comet.yaml not found at $yaml_file" >&2
exit 1
fi
local phase workflow auto_transition archived
phase=$(cmd_get "$change_name" "phase" 2>/dev/null || true)
workflow=$(cmd_get "$change_name" "workflow" 2>/dev/null || true)
auto_transition=$(cmd_get "$change_name" "auto_transition" 2>/dev/null || true)
archived=$(cmd_get "$change_name" "archived" 2>/dev/null || true)
# Change-level auto_transition overrides project-level; fall back to project default
if [ -z "$auto_transition" ] || [ "$auto_transition" = "null" ]; then
auto_transition="$(project_auto_transition_default)"
fi
# Terminal state: archived change has no next step.
if [ "$archived" = "true" ]; then
echo "NEXT: done"
return 0
fi
# Map the current (post-advance) phase to the skill that owns it.
local skill=""
case "$phase" in
open)
skill="comet-open"
;;
design)
skill="comet-design"
;;
build)
case "$workflow" in
hotfix) skill="comet-hotfix" ;;
tweak) skill="comet-tweak" ;;
*) skill="comet-build" ;;
esac
;;
verify)
skill="comet-verify"
;;
archive)
skill="comet-archive"
;;
*)
red "ERROR: Cannot resolve next step for '$change_name': unknown phase '${phase:-null}'" >&2
exit 1
;;
esac
# auto_transition=false pauses the next skill invocation only; phase is already advanced.
if [ "$auto_transition" = "false" ]; then
echo "NEXT: manual"
echo "SKILL: $skill"
echo "HINT: phase is '$phase'; run /$skill manually to continue"
else
echo "NEXT: auto"
echo "SKILL: $skill"
fi
}
# --- Main ---

@@ -898,3 +1165,3 @@

red "Usage: comet-state.sh transition <change-name> <event>" >&2
red "Events: open-complete, design-complete, build-complete, verify-pass, verify-fail, archived" >&2
red "Events: open-complete, design-complete, build-complete, verify-pass, verify-fail, archive-reopen, archived" >&2
exit 1

@@ -924,2 +1191,9 @@ fi

;;
next)
if [ $# -lt 1 ]; then
red "Usage: comet-state.sh next <change-name>" >&2
exit 1
fi
cmd_next "$@"
;;
*)

@@ -937,2 +1211,3 @@ red "Unknown subcommand: $SUBCOMMAND" >&2

echo " scale <change-name> — Assess and set verification mode based on metrics" >&2
echo " next <change-name> — Resolve the next workflow step (auto/manual/done)" >&2
echo "" >&2

@@ -939,0 +1214,0 @@ echo "Workflows: full, hotfix, tweak" >&2

@@ -126,8 +126,25 @@ #!/bin/bash

validate_required_enum() {
local field="$1" value="$2"
shift 2
local valid_values="$*"
if [ -z "$value" ] || [ "$value" = "null" ]; then
fail "$field='${value:-}' is not valid. Expected: $valid_values"
return 0
fi
validate_enum "$field" "$value" "$@"
}
workflow=$(field_value "workflow")
phase=$(field_value "phase")
context_compression=$(field_value "context_compression")
build_mode=$(field_value "build_mode")
build_pause=$(field_value "build_pause")
subagent_dispatch=$(field_value "subagent_dispatch")
tdd_mode=$(field_value "tdd_mode")
isolation=$(field_value "isolation")
verify_mode=$(field_value "verify_mode")
auto_transition=$(field_value "auto_transition")
verify_result=$(field_value "verify_result")

@@ -144,6 +161,12 @@ branch_status=$(field_value "branch_status")

validate_enum "phase" "$phase" "open design build verify archive"
validate_enum "context_compression" "$context_compression" "off beta"
validate_enum "build_mode" "$build_mode" "subagent-driven-development executing-plans direct"
validate_enum "build_pause" "$build_pause" "null plan-ready"
validate_enum "subagent_dispatch" "$subagent_dispatch" "null confirmed"
validate_enum "tdd_mode" "$tdd_mode" "tdd direct null"
validate_enum "isolation" "$isolation" "branch worktree"
validate_enum "verify_mode" "$verify_mode" "light full"
if grep -q "^auto_transition:" "$YAML" 2>/dev/null; then
validate_required_enum "auto_transition" "$auto_transition" "true false"
fi
validate_enum "verify_result" "$verify_result" "pending pass fail"

@@ -181,3 +204,3 @@ validate_enum "branch_status" "$branch_status" "pending handled"

# --- Unknown keys check ---
KNOWN_KEYS="workflow phase design_doc plan build_mode build_pause isolation verify_mode verify_result verification_report branch_status verified_at created_at archived direct_override build_command verify_command handoff_context handoff_hash base_ref"
KNOWN_KEYS="workflow phase context_compression design_doc plan build_mode build_pause subagent_dispatch tdd_mode isolation verify_mode auto_transition verify_result verification_report branch_status verified_at created_at archived direct_override build_command verify_command handoff_context handoff_hash base_ref"
while IFS=: read -r key _; do

@@ -184,0 +207,0 @@ key="${key// /}"

@@ -23,2 +23,6 @@ ---

### Output Language Rule
Use the language of the user request that triggered this workflow as the default output language. When resuming an existing change with a clear dominant artifact language, preserve that language unless the user explicitly asks to switch.
### Automatic Phase Detection

@@ -57,10 +61,13 @@

- If there is an active change and the worktree has uncommitted changes, handle them through `comet/reference/dirty-worktree.md`. That protocol defines checks, attribution, and prohibitions; this file does not repeat them
- If `phase: build`, first check `build_pause`, `plan`, `build_mode`, and `isolation`:
- If `build_pause: plan-ready` and the plan file exists, return to the `/comet-build` plan-ready resume point, prompt the user to continue choosing isolation and execution method, and do not regenerate the plan
- If `phase: build`, first check `build_pause`, `plan`, `build_mode`, and `isolation` (see details below):
- If `build_pause: plan-ready` but `isolation` and `build_mode` are already set, treat as stale pause: first output `[COMET] Detected stale pause (build_pause=plan-ready but isolation/build_mode already set), auto-clearing and continuing`, then run `"$COMET_BASH" "$COMET_STATE" set <name> build_pause null`, then read the next unchecked task from tasks.md and resume execution per `build_mode`
- If `build_pause: plan-ready` and the plan file exists, but `isolation` or `build_mode` is not yet set, return to the `/comet-build` plan-ready resume point, prompt the user to choose isolation and execution method, and do not regenerate the plan
- If `build_pause: plan-ready` but the plan file is missing, return to `/comet-build` to handle corrupted state or regenerate the plan
- If `build_mode` or `isolation` is unset, return to the corresponding `/comet-build` step to supplement before executing
- If both are set, read the next unchecked task from tasks.md and continue
- If `build_mode`, `isolation`, or `tdd_mode` is unset, return to the corresponding `/comet-build` step to supplement before executing
- If all are set, read the next unchecked task from tasks.md and continue:
- If `build_mode: subagent-driven-development`, do not execute tasks directly in the main window; return to `/comet-build`'s background subagent dispatch rules, main window only coordinates
- Other execution modes follow `/comet-build`'s corresponding rules
- If `phase: verify` and `verify_result: fail`, enter the verification failure decision blocking point: pause and ask the user to fix or accept deviation; only after the user chooses fix, run `"$COMET_BASH" "$COMET_STATE" transition <name> verify-fail` and invoke `/comet-build`
- If `phase: open` but proposal/design/tasks are complete, first run `"$COMET_BASH" "$COMET_GUARD" <change-name> open --apply` to repair state, then continue detection
- If `phase: archive`, only invoke `/comet-archive`; after archive succeeds, the change moves to the archive directory, so do not run guard against the old active directory
- If `phase: archive`, only invoke `/comet-archive`; `/comet-archive` must first wait for final archive confirmation. After archive succeeds, the change moves to the archive directory, so do not run guard against the old active directory

@@ -70,3 +77,3 @@ **Step 2: Phase Determination** (check in order, first match wins)

1. `archived: true` or change moved to archive → Workflow complete
2. `verify_result: pass` and `archived` is not `true` → Invoke `/comet-archive`
2. `verify_result: pass` and `archived` is not `true` → Invoke `/comet-archive` (first perform final archive confirmation)
3. `verify_result: fail` → Enter verification failure decision blocking point (pause and ask fix or accept deviation; only after user chooses fix, run `verify-fail` then `/comet-build`)

@@ -95,2 +102,4 @@ 4. `phase: verify` or tasks.md all checked → Invoke `/comet-verify`

- Config item additions or deletions (not value changes)
- New capability needed
- Delta spec needed (existing spec affected)

@@ -114,16 +123,20 @@ ### Error Handling Quick Reference

**Continuous execution requirement**: starting from the detected phase, the agent automatically continues through all later phases. But **auto-advancing only applies at transition points without user decisions**. When encountering user decision points, **must use the AskUserQuestion tool to pause and wait for the user's explicit response**. Must not use recommendation rules, defaults, or historical preferences to substitute for user confirmation, and must not just output a text prompt and then continue executing.
**Continuous execution requirement**: starting from the detected phase, the agent automatically continues through all later phases. But **auto-advancing only applies at transition points without user decisions**. When encountering user decision points, **must use the current platform's available user input/confirmation mechanism to pause and wait for the user's explicit response**. Must not use recommendation rules, defaults, or historical preferences to substitute for user confirmation, and must not just output a text prompt and then continue executing.
**Decision points are blocking points**: whenever reaching any of the following nodes, the current `/comet` invocation must stop, **using the AskUserQuestion tool to wait for the user's choice**. Only after the user explicitly chooses can the corresponding state fields be written and operations executed, then auto-advance resumes.
**Distinguish phase advancement vs automatic handoff**: each sub-skill runs phase guard `--apply` before exit to advance the `.comet.yaml` `phase` field. This step **always happens** and is not controlled by `auto_transition`. After that, the sub-skill runs `"$COMET_BASH" "$COMET_STATE" next <name>` to resolve the next action: when `auto_transition` is not `false`, output is `NEXT: auto` (auto-invoke next skill); when `auto_transition` is `false`, output is `NEXT: manual` (do not invoke next skill, show a manual run hint). Therefore `auto_transition` **only controls next skill invocation, not phase advancement**. Regardless of `auto_transition`, user decision points below remain blocking.
**Decision points are blocking points**: whenever reaching any of the following nodes, the current `/comet` invocation must stop, **using the current platform's available user input/confirmation mechanism to wait for the user's choice**. If the current platform has no structured question tool, ask clear options in the conversation and stop the workflow, waiting for the user's reply before continuing. Only after the user explicitly chooses can the corresponding state fields be written and operations executed, then auto-advance resumes.
Nodes requiring user participation (pause only at these nodes):
1. Open phase proposal/design/tasks review and confirmation
2. Confirm design approach during brainstorming
3. Plan-ready pause choice during build phase, followed by workflow configuration selection (isolation + execution method)
3. Plan-ready pause choice during build phase, followed by workflow configuration selection (isolation + execution method + TDD mode)
4. Decide to fix or accept deviation when verify fails (including Spec drift handling)
5. Choose branch handling method for finishing-branch
6. Encounter upgrade conditions (hotfix/tweak → full workflow)
7. Build phase scope expansion requiring redesign or new change split
6. Archive phase final confirmation before running the archive script
7. Encounter upgrade conditions (hotfix/tweak → full workflow)
8. Build phase scope expansion requiring redesign or new change split
9. Open phase large PRD requiring confirmation to split into multiple changes
Agents should not skip these decision points; other unambiguous phase transitions must proceed automatically, must not exit midway. At decision points, **text output must NOT substitute for tool-based waiting — must explicitly obtain the user's choice via AskUserQuestion before continuing**.
Agents should not skip these decision points; other unambiguous phase transitions must proceed automatically, must not exit midway. At decision points, **must not skip user confirmation or choose automatically — must explicitly obtain the user's choice through the current platform's available user input/confirmation mechanism before continuing**.

@@ -134,3 +147,3 @@ **Red Flags** — when these thoughts appear, STOP and check:

|--------------|-------------|
| "The user would probably agree with this approach" | Cannot decide for the user — use AskUserQuestion |
| "The user would probably agree with this approach" | Cannot decide for the user — use the current platform's user input/confirmation mechanism |
| "This is a small change, confirmation isn't needed" | Decision points have no size exception — blocking points must wait |

@@ -185,2 +198,4 @@ | "The user chose A last time, so A again" | Historical preference cannot substitute for current confirmation |

build_pause: null
subagent_dispatch: confirmed
tdd_mode: tdd
isolation: branch

@@ -205,4 +220,7 @@ verify_mode: light

| `build_pause` | Internal build-phase pause point. `null` means no pause; `plan-ready` means the plan has been generated and the user chose to pause for switching models |
| `subagent_dispatch` | `null` or `confirmed`. Only when the current platform has confirmed real background subagent / Task / multi-agent dispatch capability can `build_mode: subagent-driven-development` be written and used to leave the build phase |
| `tdd_mode` | `tdd` or `direct`. Must be selected before full workflow leaves build phase. `tdd` enforces writing a failing test first for each task; `direct` does not enforce TDD. hotfix/tweak default to `direct` |
| `isolation` | `branch` or `worktree`, workspace isolation method. Full workflow init may leave this as `null`, but only until `/comet-build` Step 3; hotfix/tweak default to `branch` |
| `verify_mode` | `light` or `full`, can be empty |
| `auto_transition` | `true` or `false`. `false` pauses only the next skill invocation; it does not block phase updates |
| `verify_result` | `pending`, `pass`, or `fail` |

@@ -226,2 +244,4 @@ | `verification_report` | Verification report file path; must point to an existing file before verify can pass |

- Before `build → verify`, `build_mode` must be selected
- `build_mode: subagent-driven-development` must also have `subagent_dispatch: confirmed`
- Before full workflow leaves build phase, `tdd_mode` must be selected as `tdd` or `direct`
- `build_mode: direct` is allowed by default only for `hotfix` / `tweak`; full workflow requires `direct_override: true`

@@ -233,3 +253,3 @@ - `build_pause` is not an execution method and must not be written to `build_mode`

Comet scripts are distributed in `comet/scripts/`. **Do not hardcode paths** — locate once, cache in env vars:
Comet scripts are distributed in `comet/scripts/`. **Do not hardcode paths** — locate once, cache in env vars. This block is a standard boilerplate repeated in every sub-skill for independent loadability; changes must be kept in sync across all files (boilerplate version: `v2`, update this version when changing to help locate files needing sync):

@@ -269,2 +289,10 @@ ```bash

**Resolve next action**: after guard-based phase advancement, use the `next` subcommand to determine whether to auto-invoke the next skill:
```bash
"$COMET_BASH" "$COMET_STATE" next <change-name>
```
Output format: `NEXT: auto|manual|done` + `SKILL: <skill-name>` (omitted for `done`) + `HINT` (for `manual` only). With `auto_transition: false`, output is `manual`, which pauses only the next skill invocation and does not affect the already-applied phase advancement.
**Archive script**: Complete all archive steps in one command:

@@ -293,3 +321,3 @@

│ └── archive/YYYY-MM-DD-<name>/ # Archived
└── specs/<capability>/spec.md # Main specs (overwritten from delta at archive)
└── specs/<capability>/spec.md # Main specs (merged from delta semantics at archive)

@@ -308,3 +336,3 @@ docs/superpowers/ # Superpowers — HOW

5. **Commit frequently** — One commit per task, message reflects design intent
6. **Verify before archive** — Execute `/comet-archive` only after `/comet-verify` passes
6. **Verify before archive confirmation** — Enter `/comet-archive` only after `/comet-verify` passes, but wait for final user confirmation before running the archive script
7. **Classify incremental updates** — Small edits, medium brainstorming, large new changes

@@ -311,0 +339,0 @@ 8. **Plan must associate with change** — File header contains `change:` and `design-doc:` metadata

@@ -1,1 +0,1 @@

{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAQrD,KAAK,WAAW,GAAG,YAAY,GAAG,MAAM,CAAC;AA2NzC,UAAU,aAAa;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED,wBAAsB,aAAa,CACjC,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAiBf"}
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAQrD,KAAK,WAAW,GAAG,YAAY,GAAG,MAAM,CAAC;AAqPzC,UAAU,aAAa;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED,wBAAsB,aAAa,CACjC,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAiBf"}

@@ -176,2 +176,23 @@ import path from 'path';

}
async function checkCodegraph(projectPath, scope) {
if (!isCommandAvailable('codegraph')) {
return {
check: 'CodeGraph CLI',
status: 'warn',
message: 'not installed — install with: npm install -g @colbymchenry/codegraph',
};
}
if (scope === 'global') {
return { check: 'CodeGraph CLI', status: 'pass', message: 'installed' };
}
const codegraphDir = path.join(projectPath, '.codegraph');
if (!(await fileExists(codegraphDir))) {
return {
check: 'CodeGraph',
status: 'warn',
message: 'CLI installed but project not initialized — run: codegraph init -i',
};
}
return { check: 'CodeGraph', status: 'pass', message: 'initialized (.codegraph/ present)' };
}
async function collectResults(projectPath, scope) {

@@ -185,2 +206,3 @@ const results = [];

results.push(await checkScriptsPresent());
results.push(await checkCodegraph(projectPath, scope));
results.push(...(await checkCometYamlValidity(projectPath)));

@@ -187,0 +209,0 @@ return results;

@@ -1,1 +0,1 @@

{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,EAAE,UAAU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,KAAK,CAAC,CAAC;IAEhD,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO,CAAC,GAAG,EAAE,CAAC;AAChB,CAAC"}

@@ -16,5 +16,9 @@ import { type InstallScope } from '../core/detect.js';

};
declare function applyBulkOverwriteChoice<T extends ComponentPlan>(plan: T, choice: Exclude<BulkOverwriteChoice, 'choose'>): T;
declare function applyBulkOverwriteChoice<T extends ComponentPlan>(plan: T, choice: Exclude<BulkOverwriteChoice, 'choose'>, hasExisting?: {
os?: boolean;
sp?: boolean;
cm?: boolean;
}): T;
export declare function initCommand(targetPath: string, options?: InitOptions): Promise<void>;
export { applyBulkOverwriteChoice };
//# sourceMappingURL=init.d.ts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAIA,OAAO,EAA0C,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAS9F,KAAK,WAAW,GAAG;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB,CAAC;AAGF,KAAK,eAAe,GAAG,WAAW,GAAG,MAAM,GAAG,SAAS,CAAC;AACxD,KAAK,mBAAmB,GAAG,eAAe,GAAG,UAAU,GAAG,QAAQ,CAAC;AASnE,KAAK,aAAa,GAAG;IACnB,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;CAC3B,CAAC;AAmFF,iBAAS,wBAA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AG,OAAO,CAAC,IAAI,CAAC,CA8N9F;AAED,OAAO,EAAE,wBAAwB,EAAE,CAAC"}

@@ -6,5 +6,6 @@ import path from 'path';

import { detectPlatforms, hasSkills, getBaseDir } from '../core/detect.js';
import { copyCometSkillsForPlatform, createWorkingDirs, } from '../core/skills.js';
import { copyCometSkillsForPlatform, copyCometRulesForPlatform, installCometHooksForPlatform, createWorkingDirs, } from '../core/skills.js';
import { installOpenSpec } from '../core/openspec.js';
import { installSuperpowersForPlatforms } from '../core/superpowers.js';
import { installCodegraph, filterSupportedPlatforms } from '../core/codegraph.js';
const LANGUAGES = [

@@ -76,9 +77,10 @@ { id: 'en', name: 'English', skillsDir: 'skills' },

}
function applyBulkOverwriteChoice(plan, choice) {
function applyBulkOverwriteChoice(plan, choice, hasExisting) {
const action = choice === 'overwrite-all' ? 'overwrite' : 'skip';
const shouldApply = (actionState, exists) => actionState === 'install' && (hasExisting === undefined || exists === true);
return {
...plan,
osAction: plan.osAction === 'install' ? action : plan.osAction,
spAction: plan.spAction === 'install' ? action : plan.spAction,
cmAction: plan.cmAction === 'install' ? action : plan.cmAction,
osAction: shouldApply(plan.osAction, hasExisting?.os) ? action : plan.osAction,
spAction: shouldApply(plan.spAction, hasExisting?.sp) ? action : plan.spAction,
cmAction: shouldApply(plan.cmAction, hasExisting?.cm) ? action : plan.cmAction,
};

@@ -100,5 +102,14 @@ }

console.log(`\n Comet setup complete! (scope: ${scopeLabel})\n`);
const installed = results.filter((r) => r.openspec === 'installed' || r.superpowers === 'installed' || r.comet === 'installed');
const skipped = results.filter((r) => r.openspec === 'skipped' && r.superpowers === 'skipped' && r.comet === 'skipped');
const failed = results.filter((r) => r.openspec === 'failed' || r.superpowers === 'failed' || r.comet === 'failed');
const installed = results.filter((r) => r.openspec === 'installed' ||
r.superpowers === 'installed' ||
r.comet === 'installed' ||
r.codegraph === 'installed');
const skipped = results.filter((r) => r.openspec === 'skipped' &&
r.superpowers === 'skipped' &&
r.comet === 'skipped' &&
r.codegraph === 'skipped');
const failed = results.filter((r) => r.openspec === 'failed' ||
r.superpowers === 'failed' ||
r.comet === 'failed' ||
r.codegraph === 'failed');
if (installed.length > 0) {

@@ -167,3 +178,3 @@ console.log(` Installed:`);

if (bulkChoice !== 'choose') {
({ osAction, spAction, cmAction } = applyBulkOverwriteChoice({ osAction, spAction, cmAction }, bulkChoice));
({ osAction, spAction, cmAction } = applyBulkOverwriteChoice({ osAction, spAction, cmAction }, bulkChoice, { os: hasOS, sp: hasSP, cm: hasCM }));
}

@@ -219,2 +230,19 @@ }

}
// Distribute anti-drift rules to platforms that support them
if (cmAction !== 'skip') {
const { copied: ruleCopied } = await copyCometRulesForPlatform(baseDir, platform, cmAction === 'overwrite', scope);
if (ruleCopied > 0) {
log(` Comet rules -> ${platform.name}: ${ruleCopied} rule(s) installed`);
}
}
// Install hooks for platforms that support them
if (cmAction !== 'skip' && platform.supportsHooks) {
const { installed, reason } = await installCometHooksForPlatform(baseDir, platform, scope);
if (installed) {
log(` Comet hooks -> ${platform.name}: phase guard hook installed`);
}
else if (reason) {
log(` Comet hooks -> ${platform.name}: skipped (${reason})`);
}
}
results.push({

@@ -225,4 +253,30 @@ platform,

comet: cmStatus,
codegraph: 'skipped',
});
}
let cgGlobalStatus;
const { supported: cgSupported } = filterSupportedPlatforms(selectedPlatformIds);
const shouldInstallCodegraph = cgSupported.length > 0 &&
!options.json &&
(options.yes ||
(await select({
message: 'Install CodeGraph for semantic code intelligence?',
choices: [
{ name: 'Yes (recommended — saves ~16% cost · cuts ~58% tool calls)', value: true },
{ name: 'No', value: false },
],
})));
if (shouldInstallCodegraph) {
log('\n Installing CodeGraph...');
cgGlobalStatus = await installCodegraph(projectPath, selectedPlatformIds, scope);
log(` CodeGraph: ${cgGlobalStatus}`);
for (const r of results) {
if (filterSupportedPlatforms([r.platform.id]).supported.length > 0) {
r.codegraph = cgGlobalStatus;
}
}
}
else {
log('\n CodeGraph: skipped');
}
if (scope === 'project') {

@@ -243,2 +297,3 @@ await createWorkingDirs(projectPath);

comet: result.comet,
codegraph: result.codegraph,
})),

@@ -245,0 +300,0 @@ workingDirsCreated: scope === 'project',

@@ -1,1 +0,1 @@

{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAiB,MAAM,sBAAsB,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,UAAU,EAAqB,MAAM,mBAAmB,CAAC;AAC9F,OAAO,EACL,0BAA0B,EAC1B,iBAAiB,GAElB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AA2BxE,MAAM,SAAS,GAAqB;IAClC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE;IAClD,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE;CACjD,CAAC;AAEF,MAAM,YAAY,GAAG;IACnB,iDAAiD;IACjD,iDAAiD;IACjD,iDAAiD;IACjD,iDAAiD;IACjD,iDAAiD;IACjD,iDAAiD;IACjD,oDAAoD;CACrD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,KAAK,UAAU,WAAW,CAAC,OAAoB;IAC7C,IAAI,OAAO,CAAC,KAAK;QAAE,OAAO,OAAO,CAAC,KAAK,CAAC;IACxC,IAAI,OAAO,CAAC,GAAG;QAAE,OAAO,SAAS,CAAC;IAElC,OAAO,MAAM,CAAC;QACZ,OAAO,EAAE,gBAAgB;QACzB,OAAO,EAAE;YACP,E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AC;IACnB,QAAQ,EAAE,aAAa,CAAC;CACzB;AAED,UAAU,oBAAoB;IAC5B,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AA0BD,iBAAe,4BAA4B,CACzC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,YAAY,GAClB,OAAO,CAAC,aAAa,CAAC,CAmBxB;AAED,iBAAe,2BAA2B,CACxC,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAmBjC;AAOD,iBAAe,uBAAuB,CACpC,WAAW,EAAE,MAAM,EACnB,WAAW,SAAyE,GACnF,OAAO,CAAC,YAAY,CAAC,CAsBvB;AAED,iBAAS,kBAAkB,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,EAAE,CAIzD;AAED,iBAAS,sBAAsB,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAE3D;AAED,iBAAS,wBAAwB,CAC/B,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,QAAQ,EAClB,iBAAiB,EAAE,MAAM,GACxB,MAAM,CAGR;AAiBD,wBAAsB,aAAa,CACjC,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAuLf;AAED,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,4BAA4B,EAC5B,2BAA2B,EAC3B,sBAAsB,EACtB,wBAAwB,GACzB,CAAC;AACF,YAAY,EAAE,oBAAoB,EAAE,aAAa,EAAE,CAAC"}

@@ -7,6 +7,8 @@ import path from 'path';

import { spawn } from 'child_process';
import { select } from '@inquirer/prompts';
import { fileExists, readDir, readJson } from '../utils/file-system.js';
import { getBaseDir } from '../core/detect.js';
import { copyCometSkillsForPlatform, getManifestSkills } from '../core/skills.js';
import { copyCometSkillsForPlatform, copyCometRulesForPlatform, installCometHooksForPlatform, getManifestSkills, } from '../core/skills.js';
import { PLATFORMS, getPlatformSkillsDir } from '../core/platforms.js';
import { installCodegraph, filterSupportedPlatforms } from '../core/codegraph.js';
const require = createRequire(import.meta.url);

@@ -139,2 +141,4 @@ const { version } = require('../../package.json');

skills: { totalCopied: 0, targets: [] },
rules: { totalCopied: 0 },
hooks: { totalInstalled: 0 },
}, null, 2));

@@ -157,2 +161,4 @@ return;

let totalCopied = 0;
let totalRulesCopied = 0;
let totalHooksInstalled = 0;
const targetResults = [];

@@ -175,3 +181,52 @@ for (const target of targets) {

log(` ${target.platform.name} (${target.scope}, ${languageSkillsDir}): ${copied} copied, ${skipped} skipped`);
// Distribute anti-drift rules to platforms that support them
try {
const { copied: ruleCopied } = await copyCometRulesForPlatform(baseDir, target.platform, true, target.scope);
totalRulesCopied += ruleCopied;
if (ruleCopied > 0) {
log(` Comet rules -> ${target.platform.name}: ${ruleCopied} rule(s) updated`);
}
}
catch (err) {
log(` Comet rules -> ${target.platform.name}: failed (${err.message})`);
}
// Install hooks for platforms that support them
if (target.platform.supportsHooks) {
try {
const { installed, reason } = await installCometHooksForPlatform(baseDir, target.platform, target.scope);
if (installed) {
totalHooksInstalled++;
log(` Comet hooks -> ${target.platform.name}: phase guard hook updated`);
}
else if (reason) {
log(` Comet hooks -> ${target.platform.name}: skipped (${reason})`);
}
}
catch (err) {
log(` Comet hooks -> ${target.platform.name}: failed (${err.message})`);
}
}
}
// CodeGraph optional step
let codegraphStatus = 'skipped';
const detectedPlatformIds = [...new Set(targets.map((t) => t.platform.id))];
const { supported: cgSupported } = filterSupportedPlatforms(detectedPlatformIds);
const primaryScope = targets[0]?.scope ?? 'project';
if (cgSupported.length > 0 && !options.json) {
const shouldInstallCodegraph = await select({
message: 'Install/update CodeGraph for semantic code intelligence?',
choices: [
{ name: 'Yes (recommended — saves ~16% cost · cuts ~58% tool calls)', value: true },
{ name: 'No', value: false },
],
});
if (shouldInstallCodegraph) {
log('\n Installing CodeGraph...');
codegraphStatus = await installCodegraph(projectPath, detectedPlatformIds, primaryScope);
log(` CodeGraph: ${codegraphStatus}`);
}
else {
log('\n CodeGraph: skipped');
}
}
if (options.json) {

@@ -188,2 +243,5 @@ console.log(JSON.stringify({

},
rules: { totalCopied: totalRulesCopied },
hooks: { totalInstalled: totalHooksInstalled },
codegraph: codegraphStatus,
}, null, 2));

@@ -197,2 +255,3 @@ return;

log(` skills: ${targets.length} target(s), ${totalCopied} files updated`);
log(` codegraph: ${codegraphStatus}`);
log(` scope: ${scopes}`);

@@ -199,0 +258,0 @@ log(` language: ${languages}`);

@@ -1,1 +0,1 @@

{"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAClF,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAiB,MAAM,sBAAsB,CAAC;AAGtF,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAClD,MAAM,YAAY,GAAG,eAAe,CAAC;AAsBrC,SAAS,mBAAmB,CAAC,QAA4B,EAAE,QAAuB;IAChF,OAAO,CA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AED,MAAM,SAAS,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1F,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpF,GAAG,CAAC,cAAc,CAAC,CAAC;IACpB,GAAG,CAAC,YAAY,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,YAAY,GAAG,EAAE,CAAC,CAAC;IAC3E,GAAG,CAAC,eAAe,OAAO,CAAC,MAAM,eAAe,WAAW,gBAAgB,CAAC,CAAC;IAC7E,GAAG,CAAC,kBAAkB,eAAe,EAAE,CAAC,CAAC;IACzC,GAAG,CAAC,cAAc,MAAM,EAAE,CAAC,CAAC;IAC5B,GAAG,CAAC,iBAAiB,SAAS,EAAE,CAAC,CAAC;IAClC,GAAG,CAAC,wBAAwB,CAAC,CAAC;AAChC,CAAC;AAED,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,4BAA4B,EAC5B,2BAA2B,EAC3B,sBAAsB,EACtB,wBAAwB,GACzB,CAAC"}

@@ -15,2 +15,12 @@ /**

openspecToolId: string;
/** Platform's rules/instructions subdirectory relative to rulesBaseDir (defaults to baseDir). Omit if unsupported. */
rulesDir?: string;
/** Override base directory for rules. When set, rules go to rulesBaseDir/rulesDir instead of skillsDir/rulesDir. Useful when rules live outside the skills config dir (e.g., Cline's .clinerules/ is at project root, not inside .cline/). */
rulesBaseDir?: string;
/** Rule file format: 'md' = plain markdown, 'mdc' = Cursor MDC with frontmatter, 'copilot' = GitHub Copilot instructions format. */
rulesFormat?: 'md' | 'mdc' | 'copilot';
/** Whether this platform supports PreToolUse hooks. */
supportsHooks?: boolean;
/** Hook configuration format. Determines how installCometHooksForPlatform writes the hook config. */
hookFormat?: 'claude-code' | 'gemini' | 'windsurf' | 'copilot' | 'qwen' | 'kiro' | 'qoder';
}

@@ -17,0 +27,0 @@ export declare function getPlatformSkillsDir(platform: Platform, scope: InstallScope): string;

@@ -1,1 +0,1 @@

{"version":3,"file":"platforms.d.ts","sourceRoot":"","sources":["../../src/core/platforms.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,GAAG,MAAM,CAKpF;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,GAAG,MAAM,EAAE,CAEvF;AAED,eAAO,MAAM,SAAS,EAAE,QAAQ,EA0D/B,CAAC"}
{"version":3,"file":"platforms.d.ts","sourceRoot":"","sources":["../../src/core/platforms.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,sHAAsH;IACtH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8OAA8O;IAC9O,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oIAAoI;IACpI,WAAW,CAAC,EAAE,IAAI,GAAG,KAAK,GAAG,SAAS,CAAC;IACvC,uDAAuD;IACvD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,qGAAqG;IACrG,UAAU,CAAC,EAAE,aAAa,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;CAC5F;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,GAAG,MAAM,CAKpF;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,GAAG,MAAM,EAAE,CAEvF;AAED,eAAO,MAAM,SAAS,EAAE,QAAQ,EA8M/B,CAAC"}

@@ -17,6 +17,34 @@ /**

export const PLATFORMS = [
{ id: 'claude', name: 'Claude Code', skillsDir: '.claude', openspecToolId: 'claude' },
{ id: 'cursor', name: 'Cursor', skillsDir: '.cursor', openspecToolId: 'cursor' },
{ id: 'codex', name: 'Codex', skillsDir: '.codex', openspecToolId: 'codex' },
{
id: 'claude',
name: 'Claude Code',
skillsDir: '.claude',
globalSkillsDir: '.claude',
openspecToolId: 'claude',
rulesDir: 'rules',
rulesFormat: 'md',
supportsHooks: true,
hookFormat: 'claude-code',
},
{
id: 'cursor',
name: 'Cursor',
skillsDir: '.cursor',
globalSkillsDir: '.cursor',
openspecToolId: 'cursor',
rulesDir: 'rules',
rulesFormat: 'mdc',
},
{
id: 'codex',
name: 'Codex',
skillsDir: '.codex',
globalSkillsDir: '.codex',
openspecToolId: 'codex',
rulesDir: 'rules',
rulesFormat: 'md',
supportsHooks: true,
hookFormat: 'claude-code',
},
{
id: 'opencode',

@@ -27,11 +55,50 @@ name: 'OpenCode',

openspecToolId: 'opencode',
rulesDir: 'rules',
rulesFormat: 'md',
},
{ id: 'windsurf', name: 'Windsurf', skillsDir: '.windsurf', openspecToolId: 'windsurf' },
{ id: 'cline', name: 'Cline', skillsDir: '.cline', openspecToolId: 'cline' },
{ id: 'roocode', name: 'RooCode', skillsDir: '.roo', openspecToolId: 'roocode' },
{ id: 'continue', name: 'Continue', skillsDir: '.continue', openspecToolId: 'continue' },
{
id: 'windsurf',
name: 'Windsurf',
skillsDir: '.windsurf',
globalSkillsDir: '.windsurf',
openspecToolId: 'windsurf',
rulesDir: 'rules',
rulesFormat: 'md',
supportsHooks: true,
hookFormat: 'windsurf',
},
{
id: 'cline',
name: 'Cline',
skillsDir: '.cline',
globalSkillsDir: '.cline',
openspecToolId: 'cline',
// Cline rules go to .clinerules/ at project root, NOT inside .cline/
rulesBaseDir: '',
rulesDir: '.clinerules',
rulesFormat: 'md',
},
{
id: 'roocode',
name: 'RooCode',
skillsDir: '.roo',
globalSkillsDir: '.roo',
openspecToolId: 'roocode',
rulesDir: 'rules',
rulesFormat: 'md',
},
{
id: 'continue',
name: 'Continue',
skillsDir: '.continue',
globalSkillsDir: '.continue',
openspecToolId: 'continue',
rulesDir: 'rules',
rulesFormat: 'md',
},
{
id: 'github-copilot',
name: 'GitHub Copilot',
skillsDir: '.github',
globalSkillsDir: '.github',
detectionPaths: [

@@ -44,10 +111,71 @@ '.github/copilot-instructions.md',

openspecToolId: 'github-copilot',
// Copilot uses .github/instructions/*.instructions.md format
rulesDir: 'instructions',
rulesFormat: 'copilot',
supportsHooks: true,
hookFormat: 'copilot',
},
{ id: 'gemini', name: 'Gemini CLI', skillsDir: '.gemini', openspecToolId: 'gemini' },
{ id: 'amazon-q', name: 'Amazon Q Developer', skillsDir: '.amazonq', openspecToolId: 'amazon-q' },
{ id: 'qwen', name: 'Qwen Code', skillsDir: '.qwen', openspecToolId: 'qwen' },
{ id: 'kilocode', name: 'Kilo Code', skillsDir: '.kilocode', openspecToolId: 'kilocode' },
{ id: 'auggie', name: 'Auggie (Augment CLI)', skillsDir: '.augment', openspecToolId: 'auggie' },
{ id: 'kiro', name: 'Kiro', skillsDir: '.kiro', openspecToolId: 'kiro' },
{
id: 'gemini',
name: 'Gemini CLI',
skillsDir: '.gemini',
globalSkillsDir: '.gemini',
openspecToolId: 'gemini',
// Gemini uses GEMINI.md files, not a rules directory — no rulesDir
supportsHooks: true,
hookFormat: 'gemini',
},
{
id: 'amazon-q',
name: 'Amazon Q Developer',
skillsDir: '.amazonq',
globalSkillsDir: '.amazonq',
openspecToolId: 'amazon-q',
rulesDir: 'rules',
rulesFormat: 'md',
supportsHooks: true,
hookFormat: 'claude-code',
},
{
id: 'qwen',
name: 'Qwen Code',
skillsDir: '.qwen',
globalSkillsDir: '.qwen',
openspecToolId: 'qwen',
rulesDir: 'rules',
rulesFormat: 'md',
supportsHooks: true,
hookFormat: 'qwen',
},
{
id: 'kilocode',
name: 'Kilo Code',
skillsDir: '.kilocode',
globalSkillsDir: '.kilocode',
openspecToolId: 'kilocode',
rulesDir: 'rules',
rulesFormat: 'md',
},
{
id: 'auggie',
name: 'Auggie (Augment CLI)',
skillsDir: '.augment',
globalSkillsDir: '.augment',
openspecToolId: 'auggie',
rulesDir: 'rules',
rulesFormat: 'md',
},
{
id: 'kiro',
name: 'Kiro',
skillsDir: '.kiro',
globalSkillsDir: '.kiro',
openspecToolId: 'kiro',
// Kiro uses .kiro/steering/ not .kiro/rules/
rulesDir: 'steering',
rulesFormat: 'md',
supportsHooks: true,
hookFormat: 'kiro',
},
{
id: 'lingma',

@@ -58,2 +186,4 @@ name: 'Lingma',

openspecToolId: 'lingma',
rulesDir: 'rules',
rulesFormat: 'md',
},

@@ -67,4 +197,14 @@ { id: 'junie', name: 'Junie', skillsDir: '.junie', openspecToolId: 'junie' },

{ id: 'pi', name: 'Pi', skillsDir: '.pi', openspecToolId: 'pi' },
{ id: 'qoder', name: 'Qoder', skillsDir: '.qoder', openspecToolId: 'qoder' },
{
id: 'qoder',
name: 'Qoder',
skillsDir: '.qoder',
globalSkillsDir: '.qoder',
openspecToolId: 'qoder',
rulesDir: 'rules',
rulesFormat: 'md',
supportsHooks: true,
hookFormat: 'qoder',
},
{
id: 'antigravity',

@@ -78,4 +218,12 @@ name: 'Antigravity',

{ id: 'forgecode', name: 'ForgeCode', skillsDir: '.forge', openspecToolId: 'forgecode' },
{ id: 'trae', name: 'Trae', skillsDir: '.trae', openspecToolId: 'trae' },
{
id: 'trae',
name: 'Trae',
skillsDir: '.trae',
globalSkillsDir: '.trae',
openspecToolId: 'trae',
rulesDir: 'rules',
rulesFormat: 'md',
},
];
//# sourceMappingURL=platforms.js.map

@@ -1,1 +0,1 @@

{"version":3,"file":"platforms.js","sourceRoot":"","sources":["../../src/core/platforms.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAaH,MAAM,UAAU,oBAAoB,CAAC,QAAkB,EAAE,KAAmB;IAC1E,IAAI,KAAK,KAAK,QAAQ,IAAI,QAAQ,CAAC,eAAe,EAAE,CAAC;QACnD,OAAO,QAAQ,CAAC,eAAe,CAAC;IAClC,CAAC;IACD,OAAO,QAAQ,CAAC,SAAS,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,QAAkB,EAAE,KAAmB;IAC3E,OAAO,CAAC,oBAAoB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAe;IACnC,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,QAAQ,EAAE;IACrF,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,QAAQ,EAAE;IAChF,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE;IAC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O,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE;IAC5E,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE;IAChE;QACE,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,OAAO;QACb,SAAS,EAAE,QAAQ;QACnB,eAAe,EAAE,QAAQ;QACzB,cAAc,EAAE,OAAO;QACvB,QAAQ,EAAE,OAAO;QACjB,WAAW,EAAE,IAAI;QACjB,aAAa,EAAE,IAAI;QACnB,UAAU,EAAE,OAAO;KACpB;IACD;QACE,EAAE,EAAE,aAAa;QACjB,IAAI,EAAE,aAAa;QACnB,SAAS,EAAE,SAAS;QACpB,eAAe,EAAE,qBAAqB;QACtC,cAAc,EAAE,aAAa;KAC9B;IACD,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE;IAC1E,EAAE,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,WAAW,EAAE;IACxF;QACE,EAAE,EAAE,MAAM;QACV,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,OAAO;QAClB,eAAe,EAAE,OAAO;QACxB,cAAc,EAAE,MAAM;QACtB,QAAQ,EAAE,OAAO;QACjB,WAAW,EAAE,IAAI;KAClB;CACF,CAAC"}

@@ -8,5 +8,11 @@ import { type Platform } from './platforms.js';

};
type HookConfig = {
matcher: string;
description: string;
};
type Manifest = {
version: string;
skills: string[];
rules?: string[];
hooks?: Record<string, HookConfig>;
languages?: LanguageConfig[];

@@ -21,5 +27,32 @@ };

declare function getManifestSkills(): Promise<string[]>;
/**
* Copy Comet rule files to a platform's rules directory.
* Formats:
* 'md' = plain markdown copy
* 'mdc' = Cursor MDC with frontmatter
* 'copilot' = GitHub Copilot .instructions.md with applyTo frontmatter
* Skips platforms without rulesDir.
*/
declare function copyCometRulesForPlatform(baseDir: string, platform: Platform, overwrite: boolean, scope?: InstallScope): Promise<{
copied: number;
skipped: number;
}>;
/**
* Install Comet hooks for platforms that support them.
* Supports multiple hook formats:
* 'claude-code' — settings.local.json with PreToolUse array (Claude Code, Codex, Amazon Q)
* 'qwen' — settings.json with PreToolUse/hooks array (Qwen Code)
* 'qoder' — settings.json with PreToolUse/hooks array (Qoder)
* 'gemini' — settings.json with hooks.BeforeTool array (Gemini CLI)
* 'windsurf' — hooks.json with pre_write_code array
* 'copilot' — hooks/*.json with preToolUse
* 'kiro' — hooks/*.kiro.hook JSON files
*/
declare function installCometHooksForPlatform(baseDir: string, platform: Platform, scope?: InstallScope): Promise<{
installed: boolean;
reason?: string;
}>;
declare function createWorkingDirs(projectPath: string): Promise<void>;
export { copyCometSkillsForPlatform, readManifest, getManifestSkills, createWorkingDirs, getAssetsDir, };
export { copyCometSkillsForPlatform, copyCometRulesForPlatform, installCometHooksForPlatform, readManifest, getManifestSkills, createWorkingDirs, getAssetsDir, };
export type { Manifest, LanguageConfig };
//# sourceMappingURL=skills.d.ts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../src/core/skills.ts"],"names":[],"mappings":"AAKA,OAAO,EAAwB,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAK/C,KAAK,cAAc,GAAG;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,KAAK,QAAQ,GAAG;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,CAAC,EAAE,cAAc,EAAE,CAAC;CAC9B,CAAC;AAOF,iBAAS,YAAY,IAAI,MAAM,CAE9B;AA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B,CAAC;AAOF,iBAAS,YAAY,IAAI,MAAM,CAE9B;AAED,iBAAe,0BAA0B,CACvC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,OAAO,EAClB,iBAAiB,GAAE,MAAiB,EACpC,KAAK,GAAE,YAAwB,GAC9B,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAiD9C;AAgED,iBAAe,YAAY,IAAI,OAAO,CAAC,QAAQ,CAAC,CAI/C;AAED,iBAAe,iBAAiB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAGpD;AAED;;;;;;;GAOG;AACH,iBAAe,yBAAyB,CACtC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,OAAO,EAClB,KAAK,GAAE,YAAwB,GAC9B,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAmD9C;AAwCD;;;;;;;;;;GAUG;AACH,iBAAe,4BAA4B,CACzC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,QAAQ,EAClB,KAAK,GAAE,YAAwB,GAC9B,OAAO,CAAC;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAoClD;AAyTD,iBAAe,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAenE;AAED,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,EACzB,4BAA4B,EAC5B,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,GACb,CAAC;AACF,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC"}

@@ -108,2 +108,356 @@ import path from 'path';

}
/**
* Copy Comet rule files to a platform's rules directory.
* Formats:
* 'md' = plain markdown copy
* 'mdc' = Cursor MDC with frontmatter
* 'copilot' = GitHub Copilot .instructions.md with applyTo frontmatter
* Skips platforms without rulesDir.
*/
async function copyCometRulesForPlatform(baseDir, platform, overwrite, scope = 'project') {
if (!platform.rulesDir || !platform.rulesFormat) {
return { copied: 0, skipped: 0 };
}
const manifest = await readManifest();
const rulePaths = manifest.rules;
if (!rulePaths || rulePaths.length === 0) {
return { copied: 0, skipped: 0 };
}
const assetsDir = getAssetsDir();
// Support platforms whose rules live outside the skills config dir
// (e.g., Cline: rules go to .clinerules/ at project root, not .cline/rules/)
const rulesBase = platform.rulesBaseDir !== undefined
? platform.rulesBaseDir === ''
? baseDir
: path.join(baseDir, platform.rulesBaseDir)
: path.join(baseDir, getPlatformSkillsDir(platform, scope));
let copied = 0;
let skippedCount = 0;
for (const ruleRelPath of rulePaths) {
const src = path.join(assetsDir, 'skills', ruleRelPath);
if (!(await fileExists(src))) {
console.error(` Rule source not found: ${ruleRelPath}`);
continue;
}
const ruleFileName = path.basename(ruleRelPath);
const rulesDestDir = path.join(rulesBase, platform.rulesDir);
const dest = computeRuleDestPath(rulesDestDir, ruleFileName, platform.rulesFormat);
if (!overwrite && (await fileExists(dest))) {
skippedCount++;
continue;
}
try {
const content = await readFile(src, 'utf-8');
await ensureDir(path.dirname(dest));
const formatted = formatRuleContent(content, ruleFileName, platform.rulesFormat);
await writeFile(dest, formatted, 'utf-8');
copied++;
}
catch (err) {
console.error(` Failed to copy rule ${ruleRelPath}: ${err.message}`);
}
}
return { copied, skipped: skippedCount };
}
function computeRuleDestPath(rulesDestDir, ruleFileName, rulesFormat) {
if (rulesFormat === 'mdc') {
return path.join(rulesDestDir, ruleFileName.replace(/\.md$/, '.mdc'));
}
if (rulesFormat === 'copilot') {
// GitHub Copilot: comet-phase-guard.md → comet-phase-guard.instructions.md
return path.join(rulesDestDir, ruleFileName.replace(/\.md$/, '.instructions.md'));
}
return path.join(rulesDestDir, ruleFileName);
}
function formatRuleContent(content, ruleFileName, rulesFormat) {
if (rulesFormat === 'mdc') {
// Cursor MDC: wrap in YAML frontmatter
return `---
description: ${ruleFileName.replace(/\.md$/, '').replace(/-/g, ' ')}
globs:
alwaysApply: true
---
${content}`;
}
if (rulesFormat === 'copilot') {
// GitHub Copilot: wrap in applyTo frontmatter (apply to all files)
return `---
applyTo: "**"
---
${content}`;
}
// Plain markdown — no transformation
return content;
}
/**
* Install Comet hooks for platforms that support them.
* Supports multiple hook formats:
* 'claude-code' — settings.local.json with PreToolUse array (Claude Code, Codex, Amazon Q)
* 'qwen' — settings.json with PreToolUse/hooks array (Qwen Code)
* 'qoder' — settings.json with PreToolUse/hooks array (Qoder)
* 'gemini' — settings.json with hooks.BeforeTool array (Gemini CLI)
* 'windsurf' — hooks.json with pre_write_code array
* 'copilot' — hooks/*.json with preToolUse
* 'kiro' — hooks/*.kiro.hook JSON files
*/
async function installCometHooksForPlatform(baseDir, platform, scope = 'project') {
if (!platform.supportsHooks || !platform.hookFormat) {
return { installed: false, reason: 'platform does not support hooks' };
}
const manifest = await readManifest();
const hooksConfig = manifest.hooks;
if (!hooksConfig || Object.keys(hooksConfig).length === 0) {
return { installed: false, reason: 'no hooks defined in manifest' };
}
const hookFormat = platform.hookFormat;
const skillsDir = getPlatformSkillsDir(platform, scope);
const platformBase = path.join(baseDir, skillsDir);
try {
switch (hookFormat) {
case 'claude-code':
return installClaudeCodeHooks(platformBase, skillsDir, hooksConfig);
case 'qwen':
case 'qoder':
return installQwenStyleHooks(platformBase, skillsDir, hooksConfig, hookFormat);
case 'gemini':
return installGeminiHooks(platformBase, skillsDir, hooksConfig);
case 'windsurf':
return installWindsurfHooks(platformBase, skillsDir, hooksConfig);
case 'copilot':
return installCopilotHooks(platformBase, skillsDir, hooksConfig);
case 'kiro':
return installKiroHooks(platformBase, skillsDir, hooksConfig);
default:
return { installed: false, reason: `unsupported hook format: ${hookFormat}` };
}
}
catch (err) {
return { installed: false, reason: err.message };
}
}
/** Build the command path for a hook script given its manifest rel path and skillsDir */
function buildHookCommand(skillsDir, scriptRelPath) {
return `bash ${skillsDir}/skills/${scriptRelPath}`;
}
/**
* Claude Code, Codex, Amazon Q format:
* Writes to settings.local.json with { hooks: { PreToolUse: [...] } }
*/
async function installClaudeCodeHooks(platformBase, skillsDir, hooksConfig) {
const settingsPath = path.join(platformBase, 'settings.local.json');
// Group by matcher so hooks sharing the same matcher are merged
const matcherGroups = {};
for (const [scriptRelPath, config] of Object.entries(hooksConfig)) {
const command = buildHookCommand(skillsDir, scriptRelPath);
if (!matcherGroups[config.matcher]) {
matcherGroups[config.matcher] = [];
}
matcherGroups[config.matcher].push({ type: 'command', command });
}
const newEntries = Object.entries(matcherGroups).map(([matcher, hooks]) => ({ matcher, hooks }));
let settings = {};
if (await fileExists(settingsPath)) {
try {
settings = JSON.parse(await readFile(settingsPath, 'utf-8'));
}
catch {
settings = {};
}
}
const existingHooks = settings.hooks ?? {};
const existingPreToolUse = existingHooks.PreToolUse ?? [];
// Deduplicate by matcher — replace existing entries with the same matcher
const matchersSeen = new Set();
const merged = [];
for (const entry of [...newEntries, ...existingPreToolUse]) {
if (!matchersSeen.has(entry.matcher)) {
matchersSeen.add(entry.matcher);
merged.push(entry);
}
}
settings.hooks = { ...existingHooks, PreToolUse: merged };
await ensureDir(path.dirname(settingsPath));
await writeFile(settingsPath, JSON.stringify(settings, null, 2) + '\n', 'utf-8');
return { installed: true };
}
/**
* Qwen Code / Qoder format:
* Writes to settings.json with { hooks: { PreToolUse: [{ matcher, hooks: [{ type, command }] }] } }
*/
async function installQwenStyleHooks(platformBase, skillsDir, hooksConfig, _hookFormat) {
const settingsPath = path.join(platformBase, 'settings.json');
// Group by matcher
const matcherGroups = {};
for (const [scriptRelPath, config] of Object.entries(hooksConfig)) {
if (!matcherGroups[config.matcher]) {
matcherGroups[config.matcher] = [];
}
matcherGroups[config.matcher].push({
type: 'command',
command: buildHookCommand(skillsDir, scriptRelPath),
description: config.description,
});
}
const preToolUseEntries = Object.entries(matcherGroups).map(([matcher, hooks]) => ({
matcher,
hooks,
}));
let settings = {};
if (await fileExists(settingsPath)) {
try {
settings = JSON.parse(await readFile(settingsPath, 'utf-8'));
}
catch {
settings = {};
}
}
const existingHooks = settings.hooks ?? {};
const existingPreToolUse = existingHooks.PreToolUse ?? [];
// Add entries that don't already exist (match by description in nested hooks)
const existingDescs = new Set(existingPreToolUse.flatMap((g) => g.hooks?.map((h) => h.description) ?? []));
for (const entry of preToolUseEntries) {
const hasNew = entry.hooks.some((h) => !existingDescs.has(h.description));
if (hasNew) {
existingPreToolUse.push(entry);
}
}
settings.hooks = { ...existingHooks, PreToolUse: existingPreToolUse };
await ensureDir(path.dirname(settingsPath));
await writeFile(settingsPath, JSON.stringify(settings, null, 2) + '\n', 'utf-8');
return { installed: true };
}
/**
* Gemini CLI format:
* Writes to .gemini/settings.json with { hooks: { BeforeTool: [{ matcher, hooks: [{ type, command }] }] } }
*/
async function installGeminiHooks(platformBase, skillsDir, hooksConfig) {
const settingsPath = path.join(platformBase, 'settings.json');
const entries = [];
for (const [scriptRelPath, config] of Object.entries(hooksConfig)) {
entries.push({
matcher: config.matcher === 'Write|Edit' ? 'write_file|edit_file' : config.matcher,
hooks: [
{
type: 'command',
command: buildHookCommand(skillsDir, scriptRelPath),
name: config.description,
},
],
});
}
let settings = {};
if (await fileExists(settingsPath)) {
try {
settings = JSON.parse(await readFile(settingsPath, 'utf-8'));
}
catch {
settings = {};
}
}
const existingHooks = settings.hooks ?? {};
const existingBeforeTool = existingHooks.BeforeTool ?? [];
const existingNames = new Set(existingBeforeTool.flatMap((g) => g.hooks?.map((h) => h.name) ?? []));
for (const entry of entries) {
const hasNew = entry.hooks.some((h) => !existingNames.has(h.name));
if (hasNew) {
existingBeforeTool.push(entry);
}
}
settings.hooks = { ...existingHooks, BeforeTool: existingBeforeTool };
await ensureDir(path.dirname(settingsPath));
await writeFile(settingsPath, JSON.stringify(settings, null, 2) + '\n', 'utf-8');
return { installed: true };
}
/**
* Windsurf format:
* Writes to .windsurf/hooks.json with { hooks: { pre_write_code: [{ command }] } }
*/
async function installWindsurfHooks(platformBase, skillsDir, hooksConfig) {
const hooksPath = path.join(platformBase, 'hooks.json');
const entries = [];
for (const [scriptRelPath, config] of Object.entries(hooksConfig)) {
entries.push({
command: buildHookCommand(skillsDir, scriptRelPath),
show_output: true,
});
}
let hooksFile = {};
if (await fileExists(hooksPath)) {
try {
hooksFile = JSON.parse(await readFile(hooksPath, 'utf-8'));
}
catch {
hooksFile = {};
}
}
const existingHooks = hooksFile.hooks ?? {};
const existingPreWrite = existingHooks.pre_write_code ?? [];
// Add entries that don't already exist (match by command substring)
const existingCmds = new Set(existingPreWrite.map((e) => e.command ?? ''));
for (const entry of entries) {
if (!existingCmds.has(entry.command)) {
existingPreWrite.push(entry);
}
}
hooksFile.hooks = { ...existingHooks, pre_write_code: existingPreWrite };
await ensureDir(path.dirname(hooksPath));
await writeFile(hooksPath, JSON.stringify(hooksFile, null, 2) + '\n', 'utf-8');
return { installed: true };
}
/**
* GitHub Copilot format:
* Writes to .github/hooks/comet-guard.json with preToolUse hooks config.
*/
async function installCopilotHooks(platformBase, skillsDir, hooksConfig) {
const hooksDir = path.join(platformBase, 'hooks');
const hookFilePath = path.join(hooksDir, 'comet-guard.json');
const scriptEntries = [];
for (const [scriptRelPath] of Object.entries(hooksConfig)) {
const cmd = buildHookCommand(skillsDir, scriptRelPath);
// Script requires bash; PowerShell field wraps bash invocation for Windows
scriptEntries.push({ bash: cmd, powershell: `bash -c '${cmd}'` });
}
const hookConfig = {
version: 1,
hooks: {
preToolUse: scriptEntries,
},
};
await ensureDir(hooksDir);
await writeFile(hookFilePath, JSON.stringify(hookConfig, null, 2) + '\n', 'utf-8');
return { installed: true };
}
/**
* Kiro format:
* Writes to .kiro/hooks/comet-phase-guard.kiro.hook as a JSON file.
*/
async function installKiroHooks(platformBase, skillsDir, hooksConfig) {
const hooksDir = path.join(platformBase, 'hooks');
for (const [scriptRelPath, config] of Object.entries(hooksConfig)) {
const hookFileName = path.basename(scriptRelPath).replace(/\.sh$/, '.kiro.hook');
const hookFilePath = path.join(hooksDir, hookFileName);
// Map Write|Edit matcher to Kiro's write tool category
const kiroEvent = config.matcher === 'Write|Edit' ? 'Pre Tool Use' : 'Pre Tool Use';
const toolName = config.matcher === 'Write|Edit' ? 'write' : '*';
const hookConfig = {
enabled: true,
name: config.description,
description: config.description,
version: '1',
when: {
type: 'preToolUse',
toolName,
},
then: {
type: 'runCommand',
command: buildHookCommand(skillsDir, scriptRelPath),
},
};
await ensureDir(hooksDir);
await writeFile(hookFilePath, JSON.stringify(hookConfig, null, 2) + '\n', 'utf-8');
}
return { installed: true };
}
async function createWorkingDirs(projectPath) {

@@ -113,2 +467,3 @@ const dirs = [

path.join(projectPath, 'docs', 'superpowers', 'plans'),
path.join(projectPath, '.comet'),
];

@@ -118,4 +473,8 @@ for (const dir of dirs) {

}
const configPath = path.join(projectPath, '.comet', 'config.yaml');
if (!(await fileExists(configPath))) {
await writeFile(configPath, 'context_compression: off\nauto_transition: true\n', 'utf-8');
}
}
export { copyCometSkillsForPlatform, readManifest, getManifestSkills, createWorkingDirs, getAssetsDir, };
export { copyCometSkillsForPlatform, copyCometRulesForPlatform, installCometHooksForPlatform, readManifest, getManifestSkills, createWorkingDirs, getAssetsDir, };
//# sourceMappingURL=skills.js.map

@@ -1,1 +0,1 @@

{"version":3,"file":"skills.js","sourceRoot":"","sources":["../../src/core/skills.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAiB,MAAM,gBAAgB,CAAC;AAGrE,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG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,CAAC;AAED,KAAK,UAAU,iBAAiB,CAAC,WAAmB;IAClD,MAAM,IAAI,GAAG;QACX,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,CAAC;QACtD,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,CAAC;QACtD,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC;KACjC,CAAC;IAEF,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,SAAS,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC;IACnE,IAAI,CAAC,CAAC,MAAM,UAAU,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;QACpC,MAAM,SAAS,CAAC,UAAU,EAAE,mDAAmD,EAAE,OAAO,CAAC,CAAC;IAC5F,CAAC;AACH,CAAC;AAED,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,EACzB,4BAA4B,EAC5B,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,GACb,CAAC"}
{
"name": "@rpamis/comet",
"version": "0.3.6",
"version": "0.3.7",
"description": "OpenSpec + Superpowers dual-star development workflow",

@@ -40,2 +40,4 @@ "keywords": [

"test:shell": "node scripts/run-bats.js test/shell/*.bats",
"benchmark:context": "node scripts/context-compression-benchmark.mjs",
"benchmark:execution": "node scripts/context-execution-benchmark.mjs",
"prepare": "pnpm run build",

@@ -42,0 +44,0 @@ "prepublishOnly": "node scripts/prepublish-check.js && pnpm run build",

+175
-63

@@ -32,2 +32,3 @@ <p align="center">

> [Bilibili video](https://www.bilibili.com/video/BV1y4Gi6CEo1/?spm_id_from=333.1387.homepage.video_card.click&vd_source=d22726fe6b108647dbebf1c5d8817377)
> [DouYin](https://www.douyin.com/search/comet?aid=cd8fcc82-498b-4d59-8860-617deb719412&modal_id=7646429015808936293&type=general)

@@ -42,33 +43,71 @@ **OpenSpec + Superpowers dual-star development workflow** — one command from idea to archive.

> [!IMPORTANT]
> **0.3.7 Highlights** — One-step [CodeGraph](https://github.com/colbymchenry/codegraph) semantic code indexing (official: cost **↓16%**, tool calls **↓58%**);
>
> New **Beta context compression** cutting Build-phase input tokens by **25–30%**;
> New active context compression mechanism to release context consumed by reading specs and brainstorming, preserving window space for the subsequent Build phase.
> 6 default-on workflow token optimizations; New `auto_transition` config for automatic or manual phase handoff;
> Hook+Rule anti-drift phase guard; Optional TDD mode and subagent dispatch confirmation;
> Large PRD split into multiple changes; Pre-archive confirmation with reopen, verify retry limit, systematic debugging interception, and verification completion check.
>
> See [NEWS.md](NEWS.md) for details.
## Why Comet
OpenSpec excels at managing requirements, creating proposals, managing Spec lifecycles, and archiving, but its proposals and tasks lack the detail of Superpowers brainstorming.
OpenSpec excels at managing requirements, creating proposals, managing Spec lifecycles, and archiving, but its proposals
and tasks lack the detail of Superpowers brainstorming.
Superpowers generates Spec documents after brainstorming, but these documents typically lack stateful design — after completing requirements, Specs only have tasks checked off in the document, and Agents even forget to check them off. This causes the Agent to re-examine documents and project code to verify on resumption, wasting many tokens.
Superpowers generates Spec documents after brainstorming, but these documents typically lack stateful design — after
completing requirements, Specs only have tasks checked off in the document, and Agents even forget to check them off.
This causes the Agent to re-examine documents and project code to verify on resumption, wasting many tokens.
**Comet combines the strengths of both**, integrating the core workflow into 5 phases
The main entry `/comet` supports current Spec state detection, suitable for long tasks — after closing your AI coding session midway, just `/comet` and Comet will automatically read the active Spec (lists multiple for selection), dynamically identify which phase is currently executing, and continue.
The main entry `/comet` supports current Spec state detection, suitable for long tasks — after closing your AI coding
session midway, just `/comet` and Comet will automatically read the active Spec (lists multiple for selection),
dynamically identify which phase is currently executing, and continue.
At the same time, Comet provides full Spec lifecycle management. During execution, it links OpenSpec change/spec artifacts with Superpowers design and planning documents, then automates handoff, state updates, validation, and archive sync so users do not have to repeatedly remind the Agent to keep documents synchronized and connected.
At the same time, Comet provides full Spec lifecycle management. During execution, it links OpenSpec change/spec
artifacts with Superpowers design and planning documents, then automates handoff, state updates, validation, and archive
sync so users do not have to repeatedly remind the Agent to keep documents synchronized and connected.
## What You'll Learn
Many excellent Skill projects exist in the current Skill market, but they generally have preference issues — users may only like some features. For example, when using both OpenSpec and Superpowers, one might only use OpenSpec's Spec management capabilities, but prefer Superpowers' TDD-driven approach for coding.
Many excellent Skill projects exist in the current Skill market, but they generally have preference issues — users may
only like some features. For example, when using both OpenSpec and Superpowers, one might only use OpenSpec's Spec
management capabilities, but prefer Superpowers' TDD-driven approach for coding.
Long-term Skill users know these capabilities can be freely combined, but exactly how to do so still requires real practice. The Comet project can serve as a reference:
Long-term Skill users know these capabilities can be freely combined, but exactly how to do so still requires real
practice. The Comet project can serve as a reference:
- **How to reliably trigger nested Skills** — Not letting the Agent rely on document descriptions to perform "look-alike Skill trigger" operations (like writing files based on Skill descriptions), but truly triggering Skills (key feature: Skill trigger prints on CC). Comet triggers many capabilities from OpenSpec and Superpowers. How is this Prompt written?
- **How to reliably trigger nested Skills** — Not letting the Agent rely on document descriptions to perform "look-alike
Skill trigger" operations (like writing files based on Skill descriptions), but truly triggering Skills (key feature:
Skill trigger prints on CC). Comet triggers many capabilities from OpenSpec and Superpowers. How is this Prompt
written?
- **How to make combined Skills flow automatically across phases** — Not relying on manual intervention. Comet's 5-phase flow can automatically trigger Skills for the core process except for necessary user choices, while the state machine also protects state transition reliability.
- **How to make combined Skills flow automatically across phases** — Not relying on manual intervention. Comet's 5-phase
flow can automatically trigger Skills for the core process except for necessary user choices, while the state machine
also protects state transition reliability.
- **How to turn the Spec lifecycle into a resumable workflow** — Comet links OpenSpec change/spec artifacts with Superpowers design and planning documents, then records phase, execution mode, verification results, and archive status in `.comet.yaml`, so the Agent can resume after interruption instead of rereading documents and guessing progress.
- **How to turn the Spec lifecycle into a resumable workflow** — Comet links OpenSpec change/spec artifacts with
Superpowers design and planning documents, then records phase, execution mode, verification results, and archive
status in `.comet.yaml`, so the Agent can resume after interruption instead of rereading documents and guessing
progress.
- **How to turn document synchronization from "user reminders" into automation** — Comet puts handoff, state updates, validation, and archive sync into scripted flows, reducing repeated prompts like "remember to update the design doc", "remember to sync the spec", and "remember to archive the change".
- **How to turn document synchronization from "user reminders" into automation** — Comet puts handoff, state updates,
validation, and archive sync into scripted flows, reducing repeated prompts like "remember to update the design
doc", "remember to sync the spec", and "remember to archive the change".
- **How to design guard conditions that Agents can execute** — Comet does not simply trust the Agent saying "done" at phase exits. Scripts such as `comet-guard.sh`, `comet-yaml-validate.sh`, and `comet-state.sh` check tasks, state fields, verification evidence, and archive conditions before allowing the workflow to advance.
- **How to design guard conditions that Agents can execute** — Comet does not simply trust the Agent saying "done" at
phase exits. Scripts such as `comet-guard.sh`, `comet-yaml-validate.sh`, and `comet-state.sh` check tasks, state
fields, verification evidence, and archive conditions before allowing the workflow to advance.
- **How to distribute and install Skills across platforms** — Comet supports multiple AI coding platforms, project/global installation, Chinese/English Skill choices, and platform-specific directory differences such as Antigravity using different project-level and global paths. It can be a reference for CLI installers and Skill package structure.
- **How to distribute and install Skills across platforms** — Comet supports multiple AI coding platforms,
project/global installation, Chinese/English Skill choices, and platform-specific directory differences such as
Antigravity using different project-level and global paths. It can be a reference for CLI installers and Skill package
structure.
- **How to turn shell scripts into Agent workflow infrastructure** — Comet's scripts need to work across macOS, Linux, and Windows Git Bash while handling hashes, YAML fields, state machines, and archive flows. It shows how to move fragile workflow control out of scattered Prompt text and into testable, reusable tools.
- **How to turn shell scripts into Agent workflow infrastructure** — Comet's scripts need to work across macOS, Linux,
and Windows Git Bash while handling hashes, YAML fields, state machines, and archive flows. It shows how to move
fragile workflow control out of scattered Prompt text and into testable, reusable tools.

@@ -135,3 +174,3 @@ ## Install

| Option | Description |
| ----------------- | ------------------------------------------------------------------------------ |
|-------------------|--------------------------------------------------------------------------------|
| `--yes` | Non-interactive mode, auto-select detected platforms (or all if none detected) |

@@ -143,3 +182,4 @@ | `--scope <scope>` | Install scope: `project` or `global` |

When multiple existing components are found on the same platform, interactive init offers one bulk choice: overwrite all, skip all, or choose per component.
When multiple existing components are found on the same platform, interactive init offers one bulk choice: overwrite
all, skip all, or choose per component.

@@ -154,3 +194,3 @@ </details>

| Option | Description |
| -------- | ---------------------------------------- |
|----------|------------------------------------------|
| `--json` | Output active changes with `nextCommand` |

@@ -166,3 +206,3 @@

| Option | Description |
| ----------------- | --------------------------------------------------------------- |
|-------------------|-----------------------------------------------------------------|
| `--json` | Output structured diagnostic results |

@@ -179,3 +219,3 @@ | `--scope <scope>` | Diagnose `auto`, `project`, or `global` scope (default: `auto`) |

| Option | Description |
| ------------------- | --------------------------------------------- |
|---------------------|-----------------------------------------------|
| `--json` | Output npm and skill update results as JSON |

@@ -188,3 +228,3 @@ | `--language <lang>` | Override detected skill language (`en`, `zh`) |

| Command | Description |
| ----------------- | ------------ |
|-------------------|--------------|
| `comet --help` | Show help |

@@ -201,3 +241,3 @@ | `comet --version` | Show version |

| Platform | Skills Dir | Platform | Skills Dir |
| ------------------ | ------------ | ---------- | ------------- |
|--------------------|--------------|------------|---------------|
| Claude Code | `.claude/` | Cursor | `.cursor/` |

@@ -220,3 +260,4 @@ | Codex | `.codex/` | OpenCode | `.opencode/` |

Some platforms use different project and global directories. For example, OpenCode global installs use `.config/opencode`, Lingma global installs use `.lingma`, and Antigravity global installs use `.gemini/antigravity`.
Some platforms use different project and global directories. For example, OpenCode global installs use
`.config/opencode`, Lingma global installs use `.lingma`, and Antigravity global installs use `.gemini/antigravity`.

@@ -233,3 +274,3 @@ ## Skills

| Skill | Description |
| ---------------- | -------------------------------------------------------------- |
|------------------|----------------------------------------------------------------|
| `/comet` | Main entry — auto-detects phase and dispatches to sub-commands |

@@ -251,10 +292,11 @@ | `/comet-open` | Phase 1: Open a change (proposal, design, task breakdown) |

| Script | Purpose |
| ------------------------ | ----------------------------------------------------------------------------------------------------- |
| Script | Purpose |
|--------------------------|-----------------------------------------------------------------------------------------------------------------------------------|
| `comet-env.sh` | Script discovery helper — exports bundled script paths such as `COMET_GUARD`, `COMET_STATE`, `COMET_HANDOFF`, and `COMET_ARCHIVE` |
| `comet-guard.sh` | Phase transition guard — validates exit conditions, `--apply` auto-updates `.comet.yaml` |
| `comet-handoff.sh` | Design handoff — generates deterministic context packages from OpenSpec artifacts with SHA256 tracing |
| `comet-archive.sh` | One-command archive — validates state, syncs specs, moves to archive, updates status |
| `comet-yaml-validate.sh` | Schema validator — validates `.comet.yaml` structure and field values |
| `comet-state.sh` | Unified state management — init/set/get/check/scale, agents' exclusive YAML interface |
| `comet-guard.sh` | Phase transition guard — validates exit conditions, `--apply` auto-updates `.comet.yaml` |
| `comet-handoff.sh` | Design handoff — generates deterministic context packages from OpenSpec artifacts with SHA256 tracing |
| `comet-archive.sh` | One-command archive — validates state, syncs specs, moves to archive, updates status |
| `comet-yaml-validate.sh` | Schema validator — validates `.comet.yaml` structure and field values |
| `comet-hook-guard.sh` | Phase write guard — PreToolUse hook, blocks file writes during open/design/archive phases |
| `comet-state.sh` | Unified state management — init/set/get/check/scale, agents' exclusive YAML interface |

@@ -289,3 +331,3 @@ </details>

| Phase | Command | Owner | Artifacts |
| ------------------ | ---------------- | ----------- | ------------------------------------ |
|--------------------|------------------|-------------|--------------------------------------|
| 1. Open | `/comet-open` | OpenSpec | proposal.md, design.md, tasks.md |

@@ -310,7 +352,10 @@ | 2. Deep Design | `/comet-design` | Superpowers | Design Doc, delta spec |

| File | Owner | Purpose |
| ---------------- | -------- | --------------------------------------------------- |
|------------------|----------|-----------------------------------------------------|
| `.openspec.yaml` | OpenSpec | Spec lifecycle, change metadata |
| `.comet.yaml` | Comet | Workflow phase, execution mode, verification status |
All states and execution phases are updated via scripts, and each phase verifies that tasks are truly complete before advancing. Compared to storing complex state rules only in Skill text, this script-backed state machine gives Comet more reliable phase transitions, correct YAML, and easier breakpoint recovery; agents can read the current Spec situation through Comet's built-in commands.
All states and execution phases are updated via scripts, and each phase verifies that tasks are truly complete before
advancing. Compared to storing complex state rules only in Skill text, this script-backed state machine gives Comet more
reliable phase transitions, correct YAML, and easier breakpoint recovery; agents can read the current Spec situation
through Comet's built-in commands.

@@ -324,2 +369,3 @@ <details>

workflow: full
auto_transition: true
phase: build

@@ -330,2 +376,4 @@ build_mode: subagent-driven-development

verify_mode: null
tdd_mode: null
subagent_dispatch: null
design_doc: docs/superpowers/specs/YYYY-MM-DD-topic-design.md

@@ -345,3 +393,12 @@ plan: docs/superpowers/plans/YYYY-MM-DD-feature.md

In full workflow, `build_mode`, `build_pause`, `isolation`, and `verify_mode` may temporarily be `null`; `build_mode` and `isolation` must be resolved before `build → verify`. `build_pause` records an internal build-phase pause point: `null` means no pause, while `plan-ready` means the plan has been generated and the user paused before choosing isolation and execution mode. It is not an execution mode and must not be written into `build_mode`. `verification_report` stays `null` until verification writes a report, and `verify-pass` requires that report to exist plus `branch_status: handled`. Fields after `archived` in the example are optional or script-derived: `direct_override` is only needed for full-workflow direct builds, project commands may be absent unless configured, and `handoff_context` / `handoff_hash` are recorded by `comet-handoff.sh` before leaving design. Projects can configure `build_command` / `verify_command` in the change or repo root, and guard will run those commands first and print failure output.
In full workflow, `build_mode`, `build_pause`, `isolation`, `verify_mode`, `tdd_mode`, and `subagent_dispatch` may
temporarily be `null`; `build_mode` and `isolation` must be resolved before `build → verify`. `auto_transition` controls automatic vs manual skill invocation after phase completion — see [AUTO-TRANSITION.md](docs/AUTO-TRANSITION.md). `build_pause` records an internal build-phase pause point:
`null` means no pause, while `plan-ready` means the plan has been generated and the user paused before choosing
isolation and execution mode. It is not an execution mode and must not be written into `build_mode`.
`verification_report` stays `null` until verification writes a report, and `verify-pass` requires that report to exist
plus `branch_status: handled`. Fields after `archived` in the example are optional or script-derived: `direct_override`
is only needed for full-workflow direct builds, project commands may be absent unless configured, and
`handoff_context` / `handoff_hash` are recorded by `comet-handoff.sh` before leaving design. Projects can configure
`build_command` / `verify_command` in the change or repo root, and guard will run those commands first and print failure
output.

@@ -358,34 +415,34 @@ </details>

1. **Entry Verification** — Each phase validates preconditions before execution
- Checks file existence, state consistency, and phase transitions
- Outputs `[HARD STOP]` with actionable suggestions if validation fails
- Checks file existence, state consistency, and phase transitions
- Outputs `[HARD STOP]` with actionable suggestions if validation fails
2. **Automated State Transitions** — `comet-guard.sh --apply` updates `.comet.yaml` automatically
- All phase transitions (open → design/build → verify → archive) use `guard --apply`
- No manual state editing required — eliminates write-verification errors
- `comet-state.sh` is the agents' exclusive interface for state operations
- Guard and archive scripts use `comet-state.sh` internally for state management
- All phase transitions (open → design/build → verify → archive) use `guard --apply`
- No manual state editing required — eliminates write-verification errors
- `comet-state.sh` is the agents' exclusive interface for state operations
- Guard and archive scripts use `comet-state.sh` internally for state management
3. **Schema Validation** — `comet-yaml-validate.sh` ensures data integrity
- Validates required and optional fields
- Validates enum values, including `direct_override`
- Validates `design_doc`, `plan`, and `handoff_context` paths exist, plus `handoff_hash` format
- Detects unknown/typos fields
- Validates required and optional fields
- Validates enum values, including `direct_override`
- Validates `design_doc`, `plan`, and `handoff_context` paths exist, plus `handoff_hash` format
- Detects unknown/typos fields
4. **Build Decision Enforcement** — Guard and state transitions both block skipped build choices
- `isolation` must be `branch` or `worktree`
- `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`
- `isolation` must be `branch` or `worktree`
- `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`
5. **Verification Evidence** — Guard enforces proof before phase advance
- `verify-pass` transition requires `verification_report` pointing to an existing report file
- `branch_status` must be `handled` before verify can pass
- Guard checks `verification_report exists` and `branch_status=handled` as hard prerequisites
- Prevents false phase advances when verification or branch handling was skipped
- `verify-pass` transition requires `verification_report` pointing to an existing report file
- `branch_status` must be `handled` before verify can pass
- Guard checks `verification_report exists` and `branch_status=handled` as hard prerequisites
- Prevents false phase advances when verification or branch handling was skipped
6. **Archive Automation** — `comet-archive.sh` handles the full archive flow in one command
- Validates entry state, syncs delta specs to main specs
- Annotates design doc and plan frontmatter
- Moves change to archive directory and updates `archived: true`
- Supports `--dry-run` for preview
- Validates entry state, merges delta specs into main specs through OpenSpec
- Annotates design doc and plan frontmatter
- Moves change to archive directory and updates `archived: true`
- Supports `--dry-run` for preview

@@ -398,2 +455,4 @@ </details>

your-project/
├── .comet/
│ └── config.yaml # Project-level global config (context_compression, auto_transition, etc.)
├── .claude/skills/ # Platform skills dir (Comet + OpenSpec + Superpowers)

@@ -407,2 +466,3 @@ │ ├── comet/SKILL.md

│ │ ├── comet-yaml-validate.sh # Schema validator
│ │ ├── comet-hook-guard.sh # Phase write guard (PreToolUse hook)
│ │ └── comet-state.sh # Unified state management (init/set/get/check/scale)

@@ -427,5 +487,48 @@ │ ├── comet-*/SKILL.md

<details>
<summary>Context Compression (Beta)</summary>
Comet supports context compression at the Design → Build handoff. When enabled, `comet-handoff.sh` generates a compact
context package that reduces Build-phase input tokens by **25–30%** without affecting implementation correctness.
| Mode | Behavior | Token Savings |
|--------|------------------------------------------|---------------|
| `off` | Full Spec excerpts in handoff context | Baseline |
| `beta` | Design Doc + SHA256 hash references only | ~25–30% |
Key findings from benchmark testing:
- **Test pass rate**: 100% across all tiers (compression does not affect correctness)
- **Spec coverage**: 100% (off) vs 95% (beta) — minor edge-case detail loss
- **Scaling**: Larger tasks yield higher absolute savings (up to 15,000 tokens for large-tier tasks)
Enable in `.comet/config.yaml`: `context_compression: beta`
See [CONTEXT-COMPRESSION.md](docs/CONTEXT-COMPRESSION.md) for the full benchmark report, compression principles, and
reproduction steps.
</details>
<details>
<summary>Auto Transition</summary>
`auto_transition` controls whether Comet automatically invokes the next skill after a phase completes, or pauses for
manual handoff. Phase advancement itself always happens — this setting only affects skill invocation.
| Value | Behavior |
|--------|----------|
| `true` | Auto-invoke the next skill after each phase (default) |
| `false` | Pause after each phase; user manually triggers the next skill |
Three-layer configuration with precedence: `COMET_AUTO_TRANSITION` env var > `.comet/config.yaml` (project) > `.comet.yaml` (change).
See [AUTO-TRANSITION.md](docs/AUTO-TRANSITION.md) for configuration details, workflow mapping, and FAQ.
</details>
## Development
See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, commit conventions, PR process, and guidance for adding platforms or skills.
See [CONTRIBUTING.md](CONTRIBUTING.md) | [中文版](CONTRIBUTING-zh.md) for development setup, commit
conventions, PR process, branch workflow, and guidance for adding platforms,
skills, scripts, or changelog entries.

@@ -454,12 +557,21 @@ See [CHANGELOG.md](CHANGELOG.md) for version history and updates.

<p align="center">
<img src="https://github.com/rpamis/comet/blob/master/img/wechat.jpg" alt="WeChat Group" width="200" />
&nbsp;&nbsp;&nbsp;&nbsp;
<img src="https://github.com/rpamis/comet/blob/master/img/qq.jpg" alt="QQ Group" width="200" />
</p>
<table align="center">
<tr>
<td align="center" width="180">
<img src="https://github.com/rpamis/comet/blob/master/img/douyin.png" width="120" height="120"><br>
<b>DouYin (Recommended)</b>
</td>
<td align="center" width="180">
<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">
<img src="https://github.com/rpamis/comet/blob/master/img/qq.jpg" width="120" height="120"><br>
<b>QQ</b>
</td>
</tr>
</table>
<p align="center">WeChat Group &nbsp;&nbsp;|&nbsp;&nbsp; QQ Group</p>
## Reference
[LINUX DO - 新的理想型社区](https://linux.do/)