From a4874dcce3c36d1c13c349b5db62acea3554ce5f Mon Sep 17 00:00:00 2001 From: qxbyte Date: Sun, 5 Jul 2026 16:43:59 +0800 Subject: [PATCH 1/8] feat(specode): add intake skill (project analysis + clarify + write requirements) New standalone skill (skills/intake/, peer to specode/ and distill/), user-invocable:false, invoked by the orchestration SKILL via the Skill tool during the requirements phase. Owns the four intake sub-steps (project_root confirm / agent-docs scan / experience retrieval / draft), preserves the requirements.md frontmatter contract (spec_id / created_at / project_root via write-project-root single writer), and is the primary node for ragkit/experience retrieval. Quality lives in Step 2 (read real code) + Step 3 (analysis-driven clarification), not a thin questionnaire. Co-Authored-By: Claude Fable 5 Co-Authored-By: Qiang Xue --- plugins/specode/skills/intake/SKILL.md | 103 +++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 plugins/specode/skills/intake/SKILL.md diff --git a/plugins/specode/skills/intake/SKILL.md b/plugins/specode/skills/intake/SKILL.md new file mode 100644 index 0000000..87a1bff --- /dev/null +++ b/plugins/specode/skills/intake/SKILL.md @@ -0,0 +1,103 @@ +--- +name: intake +user-invocable: false +description: specode 的需求 intake 引擎——项目分析 + 定位 + 澄清 + 写 requirements.md。在 spec 起始阶段(requirements phase)由 specode 编排 SKILL 通过 Skill 工具按名调用(specode:intake),取代旧的「brainstorming 兼职写需求 / 或薄弱 native 问卷」。产出 //requirements.md(含 project_root frontmatter 契约)+ 交给 design 阶段的定位指针。不是用户直接触发的命令。 +--- + +# intake — specode 需求 intake 引擎 + +## §0 你是谁 / 何时被调用 + +- specode 编排壳在 **requirements phase** 通过 `Skill` 工具按名调用你(`specode:intake`);此时 `` 已解析、`//` 目录已建、slug 已定。 +- 你是 requirements 的**唯一生产者**——specode 不再分「superpowers 在/不在」两条 requirements 路径。superpowers 的 `brainstorming` 从此**只做 design**(产 design.md),不再兼职写需求。 +- 你相对旧「native 2-4 问问卷」的价值全在 **§3 项目分析** + **§4 基于分析的澄清**:先读真实项目建立事实基线,再问有依据的问题——这才是 specode 版的"驱动生成能力",不是空泛问卷。 +- 你的产物: + 1. `//requirements.md`(散文需求 + 硬 frontmatter 契约,见 §1); + 2. 一段交给 design 阶段的「**参考定位(非事实来源)**」定位指针(§5,临时上下文,不持久化为事实)。 + +## §1 硬约束 🔒(绝不可动) + +1. **frontmatter 契约(最高优先级,用户明确要求保留)**:`requirements.md` 顶部 YAML **必须**含三个字段——`spec_id` / `created_at` / `project_root`。其中 **`project_root` 是下游 distill / task-swarm / retrieval 的单一事实源**,**只能**经 `resolve_root.py write-project-root` 单一验证写入口落盘(它校验绝对路径 / 目录存在 / `/Volumes` 挂载),**绝不手写该字段**。你换的是"谁生成 requirements 的正文内容",**绝不破坏这套契约元素**。 +2. **散文需求**:`requirements.md` 是自然语言 spec(背景 / 范围 in-out / `- [ ] AC-N` / 开放问题),**无形式化子句、无 checkbox**——计划在 tasks.md、设计在 design.md,别越界。Bug 修复用 Current / Expected 散文写在这里,不单独建 `bugfix.md`。 +3. **用户可见输出中文**;技术名 / 路径 / 代码标识符 / frontmatter 键名保持英文原样。 +4. **不回贴全文**(见 §6 报告纪律)。 + +## §2 run.sh resolver 前缀(每次 CLI 调用) + +所有 `resolve_root.py` 调用**必须**走 `run.sh` 包装器 + 绝对 plugin-root。skill 驱动的 Bash 里 `$CLAUDE_PLUGIN_ROOT` 不一定有值,必须 `find` 兜底。shell 状态不跨 Bash 调用保留,所以**每次**都带这段自包含 resolver 前缀: + +```bash +R="${CLAUDE_PLUGIN_ROOT:-$CODEBUDDY_PLUGIN_ROOT}"; [ -f "$R/scripts/run.sh" ] || R="$(find "$HOME/.claude/plugins/cache" "$HOME/.codebuddy/plugins/cache" -path '*/specode/*/scripts/run.sh' 2>/dev/null | sort -V | tail -1)"; R="${R%/scripts/run.sh}" +sh "$R/scripts/run.sh" "$R/scripts/resolve_root.py" +``` + +## §3 autonomous-mode 感知(每个 AskUserQuestion 站点适用) + +本 skill 有两处会 `AskUserQuestion`(§Step1 project_root 确认、§Step3 澄清)。每处**先**按 specode 的 autonomous-mode 规则判定是否跳过:用 `resolve_root.py read-defaults --key interactive --json` 取 `interactive`,用 `read-defaults --key --json` 取该 gate 的 effective value + source;当 `interactive == false` 且该 key `source ∈ {env, file}`(有效值非 schema default)时,**跳过提问直接用 default**(autonomous / CI 路径);否则原样 `AskUserQuestion`。Mapping:project_root 确认 → `project_root_default`;澄清 → 无独立 key,仅受 `interactive` 主开关约束(非交互则基于已有信息尽力起草、把不确定项写进「开放问题」而非阻塞)。 + +## §4 流程(5 步,质量在 Step 2–3) + +### Step 1 — project_root 确认(必做,autonomous-aware) + +1. 取默认:`resolve_root.py resolve-project-root`(返回 cwd 的 `git rev-parse --show-toplevel`,无 git 则 cwd)。 +2. 按 §3 决定:`AskUserQuestion` 一次(默认值预选,让用户确认或覆盖)/ 或 autonomous 直接用 default。 +3. **持有确认的绝对路径**——Step 2(约束扫描 + 检索)用它、Step 4 经 `write-project-root` 落盘。此刻 requirements.md frontmatter 尚未写,直接用持有的绝对路径,**不要** `read-project-root`。 + +### Step 2 — 项目分析(intake 高于问卷的关键,先读真实项目再问) + +不是"问用户要什么"就完事——**先读真实项目建立事实基线**: + +- **a. 项目级约束扫描**(filesystem-only):扫下列存在的文件并以 **path-only**(不拷内容)注入 requirements 草稿的 `## 项目级约束(CLAUDE.md / AGENT.md)` 段。扫描序(去重、仅存在的):(1) `/CLAUDE.md|AGENTS.md|AGENT.md|CODEBUDDY.md`;(2) `` 直接父目录下同 4 文件(覆盖 monorepo workspace 根);(3) 用户描述中点名的子目录。段模板: + + ```markdown + ## 项目级约束(CLAUDE.md / AGENT.md) + + > 主 agent 的 system prompt 已自动加载下列文件;这里列出来是为了 design / 执行阶段 / 下游 task-swarm subagent 都能看见这条约束链路。**优先级高于本 spec 的其他描述**:冲突时以下列文件为准。 + + - `` + - `` + ``` + + 为何 path-only:主 agent 上下文已有完整内容,复制一遍只是冗余 + 陈旧风险;task-swarm 渲染 task.md 时按同样规则把路径塞进 subagent prompt。一个文件都没扫到(典型 fresh 项目)→ **整段省略**(不写「无」之类占位)。 + +- **b. 经验检索定位**(`/knowledge-base/MEMORY.md` 存在时)——**这是 ragkit / 经验检索的主节点**。按 `skills/specode/references/retrieval.md` 跑:先试 Tier-0 Gate(`ragkit:query` 可用且 `knowledge-base/.ragkit/chunks.json` 存在时多路召回),否则两级 gated(Tier-1 读 MEMORY 小索引比对当前需求页面/字段/域,命中才 Tier-2 读 ≤5 点全文)。产出「**参考定位(非事实来源)**」指针(文件路径 + 调用链)。`MEMORY.md` 不存在 → **静默跳过**(不报错、不写空段)。**顶层不变量**:指针只定位真实代码,**真实代码是唯一事实**;不把 KB 内容当当前代码的真相。 + +- **c. 读真实代码**:对 b 定位到的关键文件**实际打开读**(不只拿路径)——理解现有结构 / 命名 / 模式,作为需求分析与范围界定的事实基线。 + +- **d. fresh 项目**(无 knowledge-base、无 agent docs)→ b/c 静默跳过,靠 Step 3 澄清 + 用户描述建立理解。 + +### Step 3 — 澄清(brainstorming 级,非固定问卷) + +在 Step 2 的项目分析之上做**逐条澄清**(一次一个问题、优先多选),围绕 **purpose / scope(in / out)/ constraints / success criteria**。关键:**由 Step 2 的分析驱动**——问的是「基于现有的 `X` 代码/模式,这个需求该怎样接入 / 边界在哪」这类**有依据的问题**,不是空泛问卷。 + +- autonomous-aware(§3):非交互则基于已有信息尽力起草,把不确定项写进「开放问题」,不阻塞。 +- **何时停**:intent / scope / AC 足够清晰、开放问题已列出即可——不要过度追问(YAGNI)。 + +### Step 4 — 写 requirements.md + +按 `assets/templates/requirements.md` 结构写正文:`## 背景 / 为什么` · `## 范围`(包含 / 不包含)· `## 验收标准`(`- [ ] AC-N`,可观察可验证)· `## 开放问题`(+ Step 2a 的 `## 项目级约束` 段,若有)。落 `//requirements.md`。 + +然后落 **frontmatter(§1 硬约束)**: + +1. 写 `spec_id: ` / `created_at: YYYY-MM-DD`(可随正文一起写进顶部 YAML)。 +2. **`project_root` 只经单一写入口落盘**: + ```bash + sh "$R/scripts/run.sh" "$R/scripts/resolve_root.py" write-project-root --spec / --root + ``` + 它校验并把 `project_root` 写进 requirements.md frontmatter。**绝不手写该字段。** + +### Step 5 — 交接给 design + +把 Step 2b 的「参考定位(非事实来源)」指针作为**临时上下文**交回 specode 编排(供 design 阶段用:specode 调 `brainstorming` 时把这段作为 context 传入,或 native design 直接沿用)。**不持久化为 requirements.md 的事实结论**(retrieval.md 顶层不变量)。design 默认继承这些指针、仅在开辟 intake 未覆盖的新领域时才补查(design 的检索是**条件性 top-up**,非强制)。 + +交接后**结束本 skill**,把控制权还给 specode 编排(它接着进入 design phase)。 + +## §5 报告纪律 + +不回贴 requirements.md 全文。报告只含:文件路径(一行)+ 3-8 条要点/关键澄清 + 开放问题(若有)+ 下一步(进入 design)。唯一例外是用户明确要求看全文。 + +## §6 References + +- `skills/specode/references/retrieval.md` — 经验检索规格(Step 2b 的引擎;intake 是其**主节点**)。 +- `assets/templates/requirements.md` — 需求模板(Step 4 结构 + frontmatter 契约)。 +- `skills/specode/SKILL.md` §Autonomous-mode defaults rule — §3 判定的完整规则来源。 From 7c42284e2f87e6931576985774bf88133d993a42 Mon Sep 17 00:00:00 2001 From: qxbyte Date: Sun, 5 Jul 2026 16:46:52 +0800 Subject: [PATCH 2/8] feat(specode): SKILL delegates requirements to specode:intake; design single-artifact MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Flow step 2 (requirements) now invokes the specode:intake skill (always, no superpowers fork); the four intake sub-steps + frontmatter contract live in skills/intake/SKILL.md. - Flow step 3 (design): brainstorming produces design.md only (single artifact), pre-instructed that requirements are already settled; note that brainstorming's auto-handoff to writing-plans now aligns with the design→tasks order. Relocation check = one file. - Flow step 4 (tasks): writing-plans' execution-handoff question is ignored (not "suppressed") — specode's selector supersedes it. - Fallback matrix, quick map, orchestration+relocation, iron rule 1, and continuation row all updated; requirements retrieval is the primary node, design is a conditional top-up. Co-Authored-By: Claude Fable 5 Co-Authored-By: Qiang Xue --- plugins/specode/skills/specode/SKILL.md | 55 +++++++++---------------- 1 file changed, 20 insertions(+), 35 deletions(-) diff --git a/plugins/specode/skills/specode/SKILL.md b/plugins/specode/skills/specode/SKILL.md index 9b49f2f..199c89d 100644 --- a/plugins/specode/skills/specode/SKILL.md +++ b/plugins/specode/skills/specode/SKILL.md @@ -91,36 +91,19 @@ fi Each phase is annotated "if superpowers is installed, call it / otherwise go native". To decide "installed or not": **first try to call the matching superpowers skill via the `Skill` tool; if it is unavailable (skill missing / call fails), take the native branch.** 1. **specsRoot**: `get-root` (first-time setup if missing) → obtain `` → `mkdir -p //` (the host agent derives the kebab-case slug from the request). -2. **requirements (clarify + requirements)** — four sub-steps, always in this order: - 1. **`project_root` confirmation (required)**: get the default via `resolve_root.py resolve-project-root` (it returns `git rev-parse --show-toplevel` of cwd, falling back to cwd) and call `AskUserQuestion` **once** with that default pre-selected to let the user confirm or override. Hold the confirmed absolute path; it's needed by sub-steps 2–3 (docs scan + 经验检索) and gets persisted to frontmatter at sub-step 4 **via `resolve_root.py write-project-root`** (the single writer — do not hand-write the frontmatter field). - 2. **Project-level agent docs scan (filesystem-only, no memory recall)**: scan the filesystem for project-level agent-instruction docs and inject them as a `## 项目级约束(CLAUDE.md / AGENT.md)` section into the requirements draft. Scan order (deduped, only existing files): (1) `/CLAUDE.md|AGENTS.md|AGENT.md|CODEBUDDY.md`; (2) `` 直接父目录下同 4 个文件(覆盖 monorepo workspace 根,如 `wework-ops-assistant/CLAUDE.md` 而下挂子 git repo 自身没有);(3) 任何已经在用户描述中点名的子目录(如「ops-web 模块」)。Template — **paths only, do not copy content**: +2. **requirements (clarify + requirements)** — **invoke the `specode:intake` skill via the `Skill` tool** and let it own this whole phase. intake is a **standalone specode skill** (`skills/intake/`, peer to `distill`, `user-invocable: false`) — it is the **sole producer of `requirements.md`**; there is **no** "superpowers vs native" fork here anymore (`brainstorming` is used only for design, see step 3). intake internally runs, in order: (1) `project_root` confirmation (`resolve-project-root` default → `AskUserQuestion` once, autonomous-aware) — it holds the confirmed absolute path; (2) **project analysis**: agent-docs scan (`## 项目级约束` path-only section) + **experience retrieval — this is the primary retrieval node** (per `references/retrieval.md`: Tier-0 RagKit / two-tier gated) + actually reading the located real code; (3) analysis-driven clarification (brainstorming-caliber, one question at a time, not a fixed wizard); (4) write `requirements.md` per the template **and persist the frontmatter contract** — `spec_id` / `created_at` + `project_root` **via `resolve_root.py write-project-root`** (single validated writer; never hand-write it); (5) hand the located 「参考定位(非事实来源)」 pointers back as ephemeral context for design. Full behavior lives in `skills/intake/SKILL.md` — do not re-derive it here. - ```markdown - ## 项目级约束(CLAUDE.md / AGENT.md) - - > 主 agent 的 system prompt 已自动加载下列文件;这里列出来是为了 design / 执行阶段 / 下游 task-swarm subagent 都能看见这条约束链路。**优先级高于本 spec 的其他描述**:发生冲突时以下列文件为准。 - - - `` - - `` - ``` - - 为何 path-only 而非内容拷贝:主 agent 的上下文里已经有完整内容,requirements.md 复制一遍只是冗余 + 内容陈旧风险。task-swarm 0.7.3+ 渲染 task.md 时会按同样的扫描规则把这些路径塞进 coder/reviewer/validator prompt(subagent 进程不自动加载这些文件,必须用路径告知),所以 specode + task-swarm 联合保证从 requirements → design → 执行 → subagent 整条链路都看得见项目级约束。若一个文件都没扫到(典型的 fresh 项目),**整段省略**(不要写「无」之类占位)。 - - > **v4.0.0 BREAKING + 新检索(philosophy 不同,勿混为一谈)**: 旧的 P3-1 codemap recall(确定性脚本把历史**内容**当事实自动注入、不省 token)已于 4.0.0 **完全移除**——不再自动从 `.ai-memory/knowledge/` 召回任何东西。**现引入一套全新的、定位优先的经验检索**(下面的 sub-step 3,规格见 `references/retrieval.md`):注入的是**指针非事实**、由**模型判断**而非脚本召回、默认只读小索引、读 `/knowledge-base/`(**非**旧 `.ai-memory/knowledge/`)。要手动把经验沉淀进 `knowledge-base/`,用 `/specode:distill `(见 §Acceptance 末尾的沉淀提示 + `skills/distill/SKILL.md`)。 - 3. **经验检索(若 `/knowledge-base/MEMORY.md` 存在)**: 用 sub-step 1 已确认的 `project_root`(此时 requirements.md frontmatter 尚未写,直接用持有的绝对路径,不要 `read-project-root`),按 `references/retrieval.md` 跑**两级 gated** —— Tier-1 读 `knowledge-base/MEMORY.md` 小索引、比对当前需求的页面/字段/域;命中才 Tier-2 读 ≤5 个点全文、用其前后端文件 + 调用链**定位真实代码**。命中结果贴成「**参考定位(非事实来源)**」段,仅作需求分析 / 范围界定的输入:**定位用、非事实**——指针只指向真实代码,**真实代码才是唯一事实**;**不写进 `requirements.md` 的事实结论**。`knowledge-base/MEMORY.md` 不存在(fresh 项目 / 未 distill 过)→ **静默跳过**,不报错、不写空段。引擎细节(两级触发条件 / 注入格式 / schema 契约)见 `references/retrieval.md`,此处不重述。 - 4. **draft requirements (+ design, dual-artifact)**: - - superpowers installed → call `superpowers:brainstorming` **once, spanning the requirements AND design phases** (it internally does clarification + requirements exploration + design presentation + the user-approval gate). Pre-instruct it with **two** target paths: 澄清结论 → `//requirements.md`, 设计展示 → `//design.md` (per the `assets/templates/design.md` sections). - - not installed → **specode-native**: the host agent clarifies with an `AskUserQuestion` wizard (2-4 blocking sub-questions), then writes per the `assets/templates/requirements.md` template. - - Relocate the artifact(s) to `//requirements.md`(superpowers 路径还要检查 `design.md`,见 §superpowers orchestration + relocation). - - Write the YAML frontmatter: set `spec_id: ` / `created_at: YYYY-MM-DD`, then persist `project_root` **via `resolve_root.py write-project-root --spec / --root `** (single validated writer; never hand-write this field). + > **frontmatter 契约 🔒**: `requirements.md` 的 `spec_id` / `created_at` / `project_root` 是下游 distill / task-swarm / retrieval 的单一事实源;`project_root` 只经 `write-project-root` 单一写入口落盘。intake 负责保证这套契约,specode 编排不重复写、不手改。 3. **design (传统设计文档)**: - - superpowers installed → `design.md` was already produced by the step-2 brainstorming call (dual-artifact); verify it landed at `//design.md` and covers the template sections, backfilling gaps if needed. - - not installed → **specode-native**: the host agent authors `design.md` per the `assets/templates/design.md` template(背景与目标 / 架构概览 / 模块划分与职责 / 接口设计 / 数据流 / 错误处理 / 测试策略——散文,无 checkbox). - - **经验检索(同 requirements,定位用)**: design 同样按 `references/retrieval.md` 跑**两级 gated** —— 此 phase frontmatter 已写,用 §specsRoot resolver `resolve_root.py read-project-root --spec /` 取 `project_root`;命中点的前后端文件 + 调用链用于把**模块边界 / 接口设计 ground 到真实代码**(design 的判断仍基于真实代码,检索只缩短定位延迟)。`/knowledge-base/MEMORY.md` 不存在 → 静默跳过。 + - superpowers installed → call `superpowers:brainstorming` for **design only** (single artifact → `design.md`). Pre-instruct it: **requirements are already settled in `requirements.md` (read it as input) — go straight to design presentation, produce only `design.md`** per the `assets/templates/design.md` sections (背景与目标 / 架构概览 / 模块划分与职责 / 接口设计 / 数据流 / 错误处理 / 测试策略——散文,无 checkbox); also pass intake's 「参考定位(非事实来源)」 pointers as ephemeral grounding context. Relocate the artifact to `//design.md` (post-relocation check = **one** file). + + > brainstorming 的终态硬编码为「invoke writing-plans」——这正好对齐 specode 的 design → tasks 顺序,**顺其自然即可**:让它(或你)产完 design.md 后进入 tasks phase(step 4),不要在 design 里另起炉灶。 + - not installed → **specode-native**: the host agent authors `design.md` per the `assets/templates/design.md` template(同上七节,散文无 checkbox). + - **经验检索(条件性 top-up,非强制)**: design 默认**继承 intake(step 2)已定位的指针**,不重复全量检索。仅当 design 开辟了 intake 未覆盖的新领域时,才按 `references/retrieval.md` 补查一次(此 phase frontmatter 已写,用 `resolve_root.py read-project-root --spec /` 取 `project_root`);命中点的前后端文件 + 调用链用于把**模块边界 / 接口设计 ground 到真实代码**(design 的判断仍基于真实代码)。`/knowledge-base/MEMORY.md` 不存在 → 静默跳过。 - > **v4.0.0 BREAKING**: 旧的 P3-2 rule-acknowledgement post-check 段(grep `[[rule-*]]` 是否被 design.md 引用并 AskUser 处理偏离)**仍保持移除**——design 阶段不做任何与 `.ai-memory/knowledge/rules/` 关联的 rule 检查。上面的 design 检索是**定位用**(把设计 ground 到真实代码),**不引入任何「规则确认 / 偏离 gate」**——它只产出指针,不产出 must / 规则。 + > **v4.0.0 BREAKING**: 旧的 P3-2 rule-acknowledgement post-check 段(grep `[[rule-*]]` 是否被 design.md 引用并 AskUser 处理偏离)**仍保持移除**——design 阶段不做任何与 `.ai-memory/knowledge/rules/` 关联的 rule 检查。design 检索是**定位用**(把设计 ground 到真实代码),**不引入任何「规则确认 / 偏离 gate」**——它只产出指针,不产出 must / 规则。 4. **tasks (executable plan)**: - - superpowers installed → call `superpowers:writing-plans`. Pre-instruct the target path `//tasks.md` **and instruct it to skip its own execution-handoff question** (specode's 执行方式 selector supersedes it). + - superpowers installed → call `superpowers:writing-plans`. Pre-instruct the target path `//tasks.md`. **writing-plans 结尾会硬编码问一句「Subagent-Driven vs Inline Execution」——它无参数可关;忽略那个提问、不据此进入执行**,继续走 specode 自己的 §执行方式 selector(step 5)。specode 只能"消化"这个提问,不是真的能抑制它。 - not installed → **specode-native**: break down into `## Task N` + `**Files:**` + `**Interfaces:**` + `验证: AC-N` + `- [ ]` TDD steps per the `assets/templates/tasks.md` template. - Relocate the artifact to `//tasks.md`. - tasks 阶段**不做单独检索**——直接继承 design.md 已定位好的文件路径(`**Files:**` 从 design 的模块/接口落点导出)。 @@ -139,14 +122,14 @@ Each phase is annotated "if superpowers is installed, call it / otherwise go nat > **v4.0.0 → 重新挂回**: 4.0.0 曾把 acceptance 后的自动 distill sub-step 整体移除;现按 `auto_distill` default **把入口提示重新挂回**(见上一条 bullet,遵循既有 autonomous-mode 规则——interactive 时询问、非 interactive 有 effective default 时静默,**非无条件自动执行**)。沉淀目标是项目 `knowledge-base/`(供下次 requirements/design 检索定位),md-only 行为见 `skills/distill/SKILL.md`。 -phase ↔ skill quick map: `requirements + design` → brainstorming (one call, dual artifacts); `tasks` → writing-plans; execution → subagent-driven-development / executing-plans (the task-swarm path does not use superpowers); acceptance → verification-before-completion / requesting-code-review. +phase ↔ skill quick map: `requirements` → **`specode:intake`** (specode's own standalone skill, always — no superpowers fork); `design` → brainstorming (design only, single artifact) or native; `tasks` → writing-plans; execution → subagent-driven-development / executing-plans (the task-swarm path does not use superpowers); acceptance → verification-before-completion / requesting-code-review. ## superpowers orchestration + relocation (belt and suspenders) -superpowers' brainstorming / writing-plans have their own default output paths + filenames (e.g. `docs/superpowers/specs/YYYY-MM-DD-*.md`), so when delegating, specode must actively relocate to guarantee the core invariant holds: +superpowers' brainstorming / writing-plans have their own default output paths + filenames (e.g. `docs/superpowers/specs/YYYY-MM-DD-*.md`), so when delegating, specode must actively relocate to guarantee the core invariant holds. (Note: `requirements.md` is **not** produced by superpowers anymore — it is produced by the `specode:intake` skill, which writes directly to the fixed path, so no relocation is needed for it.) -1. **Pre-instruction**: before calling the skill, explicitly tell it the target **absolute path(s) + fixed filename(s)** (superpowers' spec/plan locations support user-preference overrides) — brainstorming → **two** targets: 澄清结论 `//requirements.md` + 设计展示 `//design.md`; writing-plans' plan output → `//tasks.md` (the tasks format *is* the writing-plans format, so it slots in seamlessly; also instruct writing-plans to skip its own execution-handoff question — specode's selector supersedes it). -2. **Post-relocation (backstop)**: after the skill returns, verify **every** expected `//` is in place (brainstorming: check both files); if not, `mv` / rename the file(s) the skill actually produced to the fixed location. The invariant holds whether or not the skill honored the pre-instruction. +1. **Pre-instruction**: before calling the skill, explicitly tell it the target **absolute path + fixed filename** (superpowers' spec/plan locations support user-preference overrides) — brainstorming → **one** target: `//design.md` (design only; requirements are already in `requirements.md`); writing-plans' plan output → `//tasks.md` (the tasks format *is* the writing-plans format, so it slots in seamlessly). writing-plans will still end by asking its own execution-handoff question — **ignore it, don't act on it**; specode's 执行方式 selector supersedes it. +2. **Post-relocation (backstop)**: after the skill returns, verify the expected `//` is in place (brainstorming: `design.md`; writing-plans: `tasks.md`); if not, `mv` / rename the file the skill actually produced to the fixed location. The invariant holds whether or not the skill honored the pre-instruction. Which superpowers skill to call when, and how to do pre/post, is detailed in `references/superpowers-wiring.md`. @@ -156,12 +139,13 @@ specode treats both superpowers and task-swarm as **soft dependencies** (purely | phase | matching plugin | absent → specode-native fallback | |---|---|---| -| clarify + requirements + design | `superpowers:brainstorming` (one call, dual artifacts) | host agent clarifies via `AskUserQuestion` wizard (2-4 questions) + writes per the `requirements.md` template + authors `design.md` per the design template (传统设计文档) | +| clarify + requirements | **`specode:intake`** (specode's own skill — always used, no superpowers here) | intake itself degrades gracefully: if `brainstorming`-caliber clarification isn't needed it still runs project analysis + one-question-at-a-time clarification + writes `requirements.md` with the frontmatter contract. There is no separate superpowers path to fall back from. | +| design (传统设计文档) | `superpowers:brainstorming` (design only, single artifact) | host agent authors `design.md` per the design template (背景与目标 / 架构概览 / 模块划分 / 接口设计 / 数据流 / 错误处理 / 测试策略, 散文无 checkbox) | | executable plan (tasks) | `superpowers:writing-plans` | host agent breaks down Tasks per the `tasks.md` template (Goal/Arch/Stack + `## Task N` + `**Interfaces:**` + `验证: AC-N` + `- [ ]` TDD steps) | | execution | task-swarm (concurrent) / `superpowers:executing-plans` | host agent runs TDD in `tasks.md` Task order (red → green), appending `implementation-log.md` | | acceptance | `superpowers:verification-before-completion` | host agent verifies item by item against `AC-N` / `design.md` 测试策略 / `tasks.md` checkboxes + writes acceptance summary | -**How to decide**: the host agent first tries calling the matching superpowers skill via `Skill`; if unavailable, take the native branch. Do not stall or tell the user to install something just because superpowers is absent — pick up natively right away. +**How to decide**: requirements always goes through `specode:intake` (no superpowers here). For design / tasks / execution / acceptance, the host agent first tries calling the matching superpowers skill via `Skill`; if unavailable, take the native branch. Do not stall or tell the user to install something just because superpowers is absent — pick up natively right away. ## 执行方式 selector (the single fixed per-spec selector, after tasks.md completes) @@ -185,7 +169,7 @@ When presenting, pass question / header / options **verbatim** per the `referenc | Directory state | Inferred phase | Resume action (after user go-ahead) | |---|---|---| | no `requirements.md` | intake | rerun requirements (brainstorming / native clarification) | -| has `requirements.md`, no `design.md` | design | run design (brainstorming dual-artifact / native authoring) | +| has `requirements.md`, no `design.md` | design | run design (brainstorming design-only / native authoring) | | has `design.md`, no `tasks.md`, and `design.md` contains `## Task` + `- [ ]` | **legacy spec (5.x)** | treat `design.md` as the plan per pre-6.0.0 semantics — resume execution / acceptance directly | | has `design.md` (new-style, prose), no `tasks.md` | tasks | run tasks breakdown (writing-plans / native per tasks template) | | `tasks.md` with unchecked `- [ ]` | executing | resume execution (task-swarm checks run state / superpowers resumes executing-plans / native resumes sequentially) | @@ -216,7 +200,7 @@ When writing / updating spec documents, **never** reprint the full text in chat. ## Iron rules -1. **Fixed-artifact invariant**: always produce only the 4 documents `requirements.md` / `design.md` / `tasks.md` / `implementation-log.md`, with fixed filenames, filed in `//`, independent of the execution engine; after delegating to superpowers you must run the post-relocation check (brainstorming: both requirements.md and design.md). +1. **Fixed-artifact invariant**: always produce only the 4 documents `requirements.md` / `design.md` / `tasks.md` / `implementation-log.md`, with fixed filenames, filed in `//`, independent of the execution engine. `requirements.md` is written directly by the `specode:intake` skill (no relocation); after delegating design/tasks to superpowers you must run the post-relocation check (brainstorming → `design.md`; writing-plans → `tasks.md`). 2. **specsRoot: read config first, then ask**: call `get-root` on every start; only when missing, `AskUserQuestion` once and `set-root` to write it back, then use it silently thereafter; use the user's directory verbatim as the root, appending nothing. 3. **CLIs must go through run.sh + absolute path**: all specode CLIs go through the `run.sh` wrapper + an absolute plugin-root path resolved by the §specsRoot resolver (env var `$CLAUDE_PLUGIN_ROOT` / `$CODEBUDDY_PLUGIN_ROOT`, falling back to a cache glob — the env var is **not** reliably set in skill-driven Bash calls); never a bare `python3