@abelxiaoxing/cadence 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Abel Xiaoxing
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # @abelxiaoxing/cadence
2
+
3
+ Prompts, skills, and a private orchestration extension exposing the Abel four-stage workflow:
4
+
5
+ - `/abel-init [project-path]` — initialize OpenSpec and repair AGENTS indexes.
6
+ - `/abel-design <requirement> | --change <change_name>` — parallelize read-only exploration and design a dependency/conflict-aware task DAG through Gate A and Gate B.
7
+ - `/abel-implement <change_name>` — orchestrate task-local professional Agents over the approved DAG with delegated Red-Green-Refactor and parent-owned verification.
8
+ - `/abel-diagnose <problem-description>` — verify a root cause before a minimal repair.
9
+
10
+ The package is standalone: one repository, one manifest, one lockfile, no workspace, no reference-monorepo checkout, and no dependency on an external Subagent package.
11
+ Loading the package registers a private extension and four package-owned professional Agents; the `abel_dispatch` tool is registered but inactive unless a verified Design, Implement, or Diagnose stage activates it.
12
+
13
+ The shared workflow rules live once in the bundled `abel-workflow` skill.
14
+
15
+ ## Install
16
+
17
+ ```sh
18
+ npm install -g @abelxiaoxing/cadence
19
+ # or with bun: bun add -g @abelxiaoxing/cadence
20
+ ```
21
+
22
+ Loading paths, all verified:
23
+
24
+ - **npm package** — install `@abelxiaoxing/cadence` from the npm registry at user or project scope; Pi discovers the four prompts, four skills, the private extension, and the package-owned Agents.
25
+ - **Local package directory** — point Pi at this repository's absolute or relative path (for example `./pi-abelpackages`).
26
+ Pi discovers the same resources.
27
+ - **Installed tarball directory** — run `bun pm pack --destination <tmp>` to produce a real tarball, install or unpack it into an isolated directory, and point Pi at that directory.
28
+ The tarball file itself is never passed to Pi as a local package.
29
+
30
+ The package never inspects or classifies the Pi host version, never claims a version range, and never installs from the relocated reference repository source.
31
+
32
+ ## Development
33
+
34
+ ```sh
35
+ bun install
36
+ bun run check # syntax + type checks
37
+ bun run lint # biome + rumdl
38
+ bun run test # complete suite
39
+ bun run test:target <files> # targeted tests
40
+ bun run check:agents # AGENTS index validation
41
+ ```
@@ -0,0 +1,12 @@
1
+ # Third-Party Notices
2
+
3
+ This package adapts narrow lifecycle evidence from the reviewed reference repository `gotgenes/pi-packages` (MIT), commit `a1ee2255b81cb540f88d233112e868ca91fe7846`, package `packages/pi-subagents`.
4
+ Only FIFO settlement, cancellation cleanup, legal state transitions, and born-complete session disposal invariants informed this implementation.
5
+ The adapted invariants are re-expressed in this package's own code and tests; no reference code is shipped verbatim.
6
+
7
+ The complete MIT license text of the referenced package is bundled at `licenses/pi-subagents-MIT.txt`.
8
+
9
+ | Adapted concept | Reference source | Reference path |
10
+ | ----------------------------------------------- | ------------------------------- | --------------------------------------------- |
11
+ | FIFO settlement of queued work | gotgenes/pi-packages @ a1ee2255 | packages/pi-subagents (state/queue semantics) |
12
+ | Cancellation cleanup and born-complete disposal | gotgenes/pi-packages @ a1ee2255 | packages/pi-subagents (session lifecycle) |
@@ -0,0 +1,11 @@
1
+ # Role: contract-reviewer
2
+
3
+ You are a package-owned read-only professional Agent for terminal and checkpoint review of approved design delivery.
4
+
5
+ You inspect the approved contracts, receipts, hashes, traceability, and task DAG ONLY through the scoped `read`, `grep`, `find`, and `ls` tools.
6
+ You never write, mutate, or run validation.
7
+
8
+ Your output is a compact structured evidence object returned through `abel_submit_result`, containing the review identity, the exact artifact hashes you verified, suite-evidence status, and a list of unresolved issues (empty when the delivery is sound).
9
+
10
+ You never patch product code, AGENTS files, or task state.
11
+ Review evidence is read-only; the parent resolves mechanical evidence gaps or returns substantive defects to Design.
@@ -0,0 +1,18 @@
1
+ # Role: design-explorer
2
+
3
+ You are a package-owned read-only professional Agent for the `abel-design` stage.
4
+
5
+ You explore the repository ONLY through the scoped `read`, `grep`, `find`, and `ls` tools.
6
+ You have no shell, edit, Git, network, or validation capability, and you never create or modify files.
7
+
8
+ Your output is a compact structured evidence object returned through `abel_submit_result`, containing:
9
+
10
+ - the matching request id and your role name;
11
+ - your bounded path scope and the exact files and directories you inspected;
12
+ - concise conclusions with exact file-and-line citations;
13
+ - constraints, dependencies, risks, and blocking questions;
14
+ - write-set, verification-command, and AGENTS-impact hints for later tasks.
15
+
16
+ You never return raw transcripts, hidden reasoning, or tool-call history.
17
+ A packet is complete only when every claim is cited and every blocking question is explicit.
18
+ If a scope escape, mutation, or undeclared capability is attempted, you fail closed and report the violation.
@@ -0,0 +1,12 @@
1
+ # Role: diagnosis-worker
2
+
3
+ You are a package-owned read-only professional Agent for `abel-diagnose`.
4
+
5
+ You collect evidence and falsify candidate root causes ONLY through the scoped `read`, `grep`, `find`, and `ls` tools.
6
+ You never write, execute commands, or run validation.
7
+
8
+ Phase 1 output: a compact structured evidence object through `abel_submit_result` with reproduced symptoms, candidate causes, confirming or refuting citations, and a verified root-cause conclusion or an explicit blocked report.
9
+
10
+ Phase 2 output: first a complete failing-regression unified diff, then a minimum-repair unified diff, each returned through `abel_submit_result` with task identity, the complete untruncated diff, expected verification, risks, and a recommended next step.
11
+
12
+ You never invent a fix for an unverified root cause, and you never change behavior contracts; scope-expanding repairs are returned to Design.
@@ -0,0 +1,18 @@
1
+ # Role: implementation-worker
2
+
3
+ You are a package-owned read-only professional Agent for `abel-implement` task phases (Red, Green, and optional Refactor).
4
+
5
+ You explore the workspace ONLY through the scoped `read`, `grep`, `find`, and `ls` tools.
6
+ You never write the workspace, run validation, or execute commands.
7
+
8
+ Your output is a complete unified diff returned through `abel_submit_result` with:
9
+
10
+ - the task id, phase, and your role name;
11
+ - a concise summary and contract-compliance statement;
12
+ - the complete, untruncated unified diff covering exactly the declared write
13
+ set (never reconstructed from a summary);
14
+ - the expected verification command and result;
15
+ - risks or blockers and a recommended next step.
16
+
17
+ A result that cannot fit the configured complete-result limit is reported as a split condition, never a truncated diff.
18
+ The parent alone reviews, applies, and validates your diff.
@@ -0,0 +1,14 @@
1
+ # Copy to <project>/.pi/pi-abel-workflow/.env or ~/.pi/agent/pi-abel-workflow/.env.
2
+ # The project file wins as a whole file; values are not merged or interpolated.
3
+
4
+ CONTEXT7_API_URL=https://context7.com/api/v2
5
+ CONTEXT7_API_KEY=
6
+
7
+ GROK_API_URL=https://api.x.ai/v1
8
+ GROK_API_KEY=
9
+ GROK_MODEL=grok-4.20-non-reasoning
10
+
11
+ # Tavily is enabled by default when TAVILY_API_KEY is set; set to false to opt out.
12
+ TAVILY_ENABLED=true
13
+ TAVILY_API_URL=https://api.tavily.com
14
+ TAVILY_API_KEY=
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 tintinweb
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@abelxiaoxing/cadence",
3
+ "version": "1.0.0",
4
+ "description": "Prompts, skills, and a private orchestration extension exposing the Abel four-stage workflow (/abel-init, /abel-design, /abel-implement, /abel-diagnose) with package-owned professional Agents.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "engines": {
8
+ "node": ">=22"
9
+ },
10
+ "keywords": [
11
+ "pi-package",
12
+ "abel",
13
+ "workflow",
14
+ "cadence",
15
+ "openspec"
16
+ ],
17
+ "files": [
18
+ "prompts",
19
+ "skills",
20
+ "config",
21
+ "src",
22
+ "agents",
23
+ "README.md",
24
+ "LICENSE",
25
+ "THIRD_PARTY_NOTICES.md",
26
+ "licenses"
27
+ ],
28
+ "pi": {
29
+ "extensions": [
30
+ "./src/index.ts"
31
+ ],
32
+ "prompts": [
33
+ "./prompts/*.md"
34
+ ],
35
+ "skills": [
36
+ "./skills"
37
+ ]
38
+ },
39
+ "scripts": {
40
+ "pack:check": "node scripts/pack-check.mjs",
41
+ "traceability:check": "node scripts/traceability-check.mjs",
42
+ "verify": "bun run check && bun run lint && bun run test && bun run pack:check",
43
+ "check": "find skills test scripts -name '*.mjs' -type f -print0 | xargs -0 -r -n1 node --check && tsc --noEmit",
44
+ "lint": "biome check . && rumdl check .",
45
+ "test": "vitest run",
46
+ "test:target": "vitest run",
47
+ "check:agents": "node scripts/check-agents.mjs"
48
+ },
49
+ "peerDependencies": {
50
+ "@earendil-works/pi-coding-agent": "*",
51
+ "typebox": "*"
52
+ },
53
+ "devDependencies": {
54
+ "@biomejs/biome": "^2.4.16",
55
+ "@earendil-works/pi-coding-agent": "0.84.1",
56
+ "@types/node": "^22.15.3",
57
+ "rumdl": "^0.2.10",
58
+ "typescript": "^6.0.3",
59
+ "vitest": "^4.1.8"
60
+ },
61
+ "repository": {
62
+ "type": "git",
63
+ "url": "git+https://github.com/abelxiaoxing/cadence.git"
64
+ },
65
+ "homepage": "https://github.com/abelxiaoxing/cadence",
66
+ "bugs": {
67
+ "url": "https://github.com/abelxiaoxing/cadence/issues"
68
+ }
69
+ }
@@ -0,0 +1,181 @@
1
+ ---
2
+ name: abel-design
3
+ description: 在不写产品代码的前提下,产出经双闸门批准、可直接实施且完全可追溯的 OpenSpec 变更。
4
+ category: abel
5
+ tags: [abel, design, openspec, PBT, subagents, agents]
6
+ argument-hint: "<requirement> | --change <change_name>"
7
+ ---
8
+
9
+ <abel-request>
10
+ $ARGUMENTS
11
+ </abel-request>
12
+
13
+ <!-- ABEL:START -->
14
+ # 不可协商规则(最高优先级)
15
+
16
+ 1. 仅设计:绝不生成或修改产品代码。
17
+ 2. 写入范围:Gate A 之前严格只读,不持久化任何内容;Gate A 之后仅在已解析的 `changeRoot` 内写入,每次只创建一个就绪产物;仅当获批准的回环/一致性修复明确指向某个已完成产物时才可编辑它。
18
+ 3. 绝不假设或猜测:每个阻塞性决策都必须提交用户(见决策模型)。
19
+ 4. 仓库 `AGENTS.md` 保持只读:审计其过期声明并规划影响,本阶段绝不编辑;绝不触碰 OpenSpec 管理的 `openspec/` 生成物(schemas、`config.yaml`、skills 与 slash commands)。
20
+ 5. 最终产出:严格校验通过、完全可追溯、阻塞决策为零、双闸门均在设计阶段完成批准的 OpenSpec 变更(READY_TO_IMPLEMENT)。
21
+
22
+ 技能集成:见全局 AGENTS《阶段技能矩阵》Design 列。
23
+
24
+ ## 决策模型
25
+
26
+ - 在会话内维护决策台账:id、类别(`behavior | technical`)、问题、证据、选项、建议、结论、状态、受影响产物。
27
+ `BLOCKING_DECISIONS` 为其中未决的非机械决策数。
28
+ - 行为决策回答 WHAT:可观察结果、范围/非目标、场景、失败行为、数据/安全/隐私/兼容策略、成功标准。
29
+ - 技术决策回答 HOW:接口、数据流、依赖、存储/算法、实现错误机制、关键技术参数。
30
+ - 必须由用户批准:目标、范围/非目标与可观察成功行为;数据/安全/隐私/兼容/迁移规则;新依赖、跨模块架构、不可逆变更;任何有实质性权衡的技术选择(含关键参数)。
31
+ - 可由 agent 机械决定:仓库惯例唯一确定的命名/位置/局部结构;易逆且无外部行为变化的细节;由已批准设计直接推出的测试放置与执行顺序。
32
+ - 机械决策记录后不再重问;存在两个以上有实质差异的可行选项 → 升级为阻塞决策。
33
+ - 绝不创建运行时用户/会话状态文件。
34
+ 跨上下文只允许在 `changeRoot` 内生成 `gate-a.yaml` 与 `ready.yaml` 作为可复算的审计凭据;它们不是身份签名或工具权限,不得写入 AGENTS 索引。
35
+
36
+ ## 阶段 0 —— 进入、模式与就绪(只读)
37
+
38
+ - 从 `<abel-request>` 读取完整需求或 `--change <name>`;不得用 frontmatter hint 或正文示例替代实际参数。
39
+ 参数为空或歧义阻塞时提问。
40
+ - 要求 OpenSpec 根已初始化且 CLI 能力齐全:`new change`、`list --json`、`schemas --json`、`schema which --json`、`schema validate --json`、`templates --json`、`status --json`、`instructions --json`、`validate --strict`。
41
+ 缺失则停止并给出 `/abel-init` 补救,本命令不执行初始化。
42
+ - 要求根 `AGENTS.md` 存在且托管区块结构有效;阅读相关嵌套索引;逐条对照代码、清单和可执行配置核实目标范围内声明。
43
+ 缺失/结构无效则停止并给出 `/abel-init`;过期声明记录进任务影响,本阶段不编辑。
44
+ - 模式解析:显式 `--change` → 恢复,不存在则停止并请用户纠正名称或选择新建;精确匹配已有变更 → 恢复;否则新建。
45
+ 绝不把疑似笔误静默当作新需求。
46
+ - schema 解析优先级:显式选择 > 已有变更 metadata > 项目配置 > `spec-driven`,且须出现在 `openspec schemas --json` 中。
47
+ 创建前运行 `schema which --json`、`schema validate --json` 并检查模板,做行为/技术/混合依赖预检;实施兼容性要求具体非空的 `apply.tracks` 与恰好一个产物的 `generates` 匹配,不兼容则在创建前关闭。
48
+ - 新建模式在探索前的最低输入:问题/目标陈述 + 范围锚点(涉及哪个模块/目录);缺失则先简要提问。
49
+ - 生成暂定 kebab-case 变更名并用 `openspec list --changes --json` 查重;Gate A 定稿范围后重算并确认。
50
+ 此前不持久化任何内容。
51
+
52
+ ## 阶段 1 —— 证据探索(只读)
53
+
54
+ - 主 agent 只负责核实相关 AGENTS、拆分探索包、派发、校验证据、综合、澄清与 Gate 呈现;广泛代码库探索必须委派。
55
+ 主 agent 仅可为范围划分、引用抽查和冲突裁决做最小定向读取。
56
+ - 默认并行派发多个只读探索子代理:优先按独立上下文边界拆分;只有一个边界时,按互不重叠的路径或符号证据面拆分。
57
+ 平台不支持并行或范围客观不可拆分时,记录原因并降级为一个只读子代理,不得静默改由主 agent 广泛探索。
58
+ - 每个探索包包含唯一 `packet_id`、精确路径/符号/问题边界、相关 AGENTS 内容、强制检索策略、禁止写入约束与输出预算;包集合覆盖目标范围,重叠仅用于核对跨边界依赖。
59
+ - 子代理强制返回 JSON:`packet_id`、`module_name`、`scope`、`files_read`、`evidence`(每项含 claim、path、line_start、line_end)、`existing_structures`、`existing_conventions`、`constraints_discovered`、`open_questions`、`dependencies`、`write_set_hints`、`validation_hints`、`agents_impact_hints`、`risks`、`success_criteria_hints`。
60
+ - 聚合前逐包校验 JSON、范围和引用;无引用、越界或互相冲突的结论必须定向重派或最小抽查。
61
+ 把约束、依赖、风险、潜在写集冲突与开放问题并入决策台账。
62
+ - 父代理负责验证与综合;子代理绝不批准 Gate、绝不写入。
63
+ - 按需 `/context7-auto-research` 核对候选库/API 的官方契约;按需 `/grok-search` 做架构模式调研。
64
+ - PBT 边界筛查:空输入、幂等性、顺序、大小/取值边界、状态转换合法性 → 形成阶段 2 的问题清单。
65
+
66
+ ## 阶段 2 —— 行为澄清循环(允许多轮)
67
+
68
+ - 只覆盖 WHAT;库、协议、算法、存储、拓扑、实现参数一律路由到阶段 4。
69
+ - 每轮只提当前影响最大的阻塞问题,简明分组,各附证据、影响与建议默认值。
70
+ - 反模式(标记并拒绝):可观察行为推迟到实现期决定;技术机制伪装成产品需求。
71
+ - 答案扩大模块/场景/数据边界 → 仅增量地回到阶段 1。
72
+ - 循环至未决行为决策为零。
73
+
74
+ ## ⛔ Gate A —— 批准行为契约
75
+
76
+ - 呈现行为契约与相关台账条目;用户显式批准目标、范围/非目标、场景/成功标准与各项策略。
77
+ - 按批准的范围重算变更名并重新查重。
78
+ - 新建模式:仅此一时点运行 `openspec new change <name>`(仅显式非默认选择时加 `--schema`)。
79
+ - 构建产物计划,然后只物化安全且就绪的行为类产物。
80
+ - 最后写 `changeRoot/gate-a.yaml`:记录 receipt 版本、change/schema、行为契约摘要、批准原文的忠实摘要,以及全部 Gate A 产物的规范化相对路径与原始字节 SHA-256。
81
+ 禁止身份、时间戳、会话 id、模型 id 与工具授权字段。
82
+
83
+ ## 产物计划与写入协议
84
+
85
+ - 创建前依据 schema 定义/模板做兼容性预判;创建后或恢复时依据 `status --json` 与 `instructions --json` 构建产物 DAG:id、输出路径、依赖/状态、决策类别(`behavior | technical | mixed`)、写入闸门、受影响决策;记录 `apply.tracks`。
86
+ 仅携带机械信息不使产物变为 mixed。
87
+ `gate-a.yaml`/`ready.yaml` 是工作流审计凭据,不冒充 schema artifact,也不改变 DAG/status。
88
+ - 按产物承载的决策分类,绝不按硬编码产物名:behavior → Gate A;technical/mixed → Gate B;依赖 Gate B 产物的行为类 → 等 Gate B 后沿 DAG 推进。
89
+ - schema 若要求 Gate A 前写入、写入 `changeRoot` 之外、或以未批准的技术决策解锁行为 → 创建前停止,请用户选择兼容的 schema/映射。
90
+ schema 顺序绝不凌驾于批准之上。
91
+ - 每次写入的强制循环:
92
+ 1. 重跑 `openspec status --change <name> --json`,核实 schemaName、changeRoot、artifactPaths、状态/依赖与 applyRequires;`existingOutputPaths` 是上下文,不是新文件目标。
93
+ 2. 运行 `openspec instructions <artifact-id> --change <name> --json` 并遵循其模板/规则/依赖。
94
+ 3. 阅读依赖与已有输出,做双向一致性检查。
95
+ 4. 在内存备好内容,于对应闸门前展示决策摘要或统一 diff;物化暴露新的实质决策 → 回到相应循环重新批准。
96
+ 5. 批准后只写一个就绪产物(或编辑一个被明确指向的已完成产物);重跑 status,拓扑推进新解锁的产物。
97
+ - Receipt 写入仅免除不存在的 `instructions <artifact-id>`,其余边界、一致性与逐文件写入规则不变;生成前必须重算覆盖文件的 hash。
98
+ 任何 receipt 覆盖文件发生变化都立即使该 receipt 失效:回到最早受影响 Gate,实质变化须重新批准,机械一致性修复也须重算 receipt;`ready.yaml` 必须最后生成。
99
+
100
+ ## 阶段 3 —— 技术推导
101
+
102
+ - 从 Gate A 契约、既有代码模式与官方 API 契约推导技术设计;机械决策直接记录进设计,实质性权衡进入阶段 4。
103
+
104
+ ## 阶段 4 —— 技术决策与验证循环
105
+
106
+ - 覆盖 HOW:接口、数据流、实现错误机制、依赖/算法与关键参数(如 JWT vs session、经批准的 bcrypt cost factor)。
107
+ - PBT 适用性规则(六类筛查:交换/结合、幂等、往返、不变量保持、单调、边界):具备不变量/往返/幂等/顺序/边界/状态转换的行为必须提取性质与证伪策略;不适合的记录原因并采用示例/E2E/静态验证,不强行套类。
108
+ - 每个场景获得稳定引用 `<spec-path>#<requirement-heading>/<scenario-heading>`,标题在 spec 内唯一;全程维护 Requirement → Scenario → Verification → Task。
109
+ - 先构建实施任务 DAG:所有任务引用存在且无环;依赖边标记 `artifact | contract | conflict-order`、原因与所需输出。
110
+ 由 DAG、写集和资源锁派生建议执行波次;波次只用于审阅,Implement 必须从可信契约重新计算。
111
+ - 每个任务恰好一个 schema 复选框,验证契约使用普通缩进符号列表(绝不嵌套 `- [ ]`/`- [x]`):
112
+ - 任务 ID;Requirement + 稳定 Scenario 引用
113
+ - 直接前置任务(无则 `[]`)、依赖类型、所需输出与原因
114
+ - 非任务前置条件及其可执行或静态检查
115
+ - 派发上下文:完成任务所需的最小 spec、AGENTS、代码路径与符号
116
+ - 建议执行波次;并行资格 `eligible | serial` 及原因
117
+ - 计划写集:修改/新建/删除的精确路径或最窄可判定 glob;预期交付文件/符号
118
+ - 冲突集:任务 ID + 原因;共享状态、生成物、清单、数据库、端口、fixture 或验证资源及所需资源锁
119
+ - 验证类型:`property | example | E2E | static`
120
+ - Red 命令 + 预期失败原因;Green 预期行为
121
+ - 受影响套件命令;目标范围;验证命令的并行资格及资源锁
122
+ - AGENTS 影响:`none | update-existing | create-index | remove-index`
123
+ - AGENTS 目标索引 + 基于证据的原因;AGENTS 验证命令(可执行或静态)
124
+ - Gate B 前审计调度契约:前置条件可判定,波次满足拓扑顺序;同波次任务的写集、共享资源和验证锁均不冲突;每个冲突均有 `conflict-order` 串行边;每个任务可由最小派发上下文独立执行。
125
+ - 写集未知、过宽或可能重叠的任务不得标为并行;先重塑任务,或用 `conflict-order` 串行化。
126
+ - 非行为变更任务的 Red 是变更前即可执行的静态验证。
127
+ 仅人工验证的任务不具备实施就绪性,绝不通过 Gate B 或退出;重塑任务直至具备可执行验证。
128
+ - 范围内每个索引过期发现分配给一个任务,或报告为无关的既有过期问题。
129
+ - 循环至未决技术决策为零;在内存中备好剩余产物内容/统一 diff。
130
+
131
+ ## ⛔ Gate B —— 批准实施契约
132
+
133
+ - 核实阶段 3/4 忠实展开 Gate A 契约,未引入未批准的新决策。
134
+ - 呈现实质技术决策、任务 DAG/建议波次、前置条件、计划写集/冲突/资源锁、验证映射、AGENTS 影响矩阵与产物物化预览;用户显式批准。
135
+ - 按写入协议逐个写入剩余就绪产物。
136
+ - 最后写 `changeRoot/ready.yaml`:记录 receipt 版本、change/schema、Gate B 批准原文的忠实摘要(含任务 DAG、建议波次、前置条件、计划写集、冲突与资源锁)、任务验证与 AGENTS 影响摘要、`gate-a.yaml` 的 SHA-256,以及全部规划产物的规范化相对路径与 SHA-256;排除 `ready.yaml` 自身。
137
+ 任务跟踪文件计算 hash 前只将任务完成标记 `- [x]`/`- [X]` 规范化为 `- [ ]`,其余字节不得忽略。
138
+
139
+ ## 回环规则
140
+
141
+ - 答案扩大边界 → 阶段 1;技术分析推翻行为契约 → 阶段 2(只重批受影响决策并同步所有受影响产物);Gate B 发现物化不忠实 → 阶段 3/4(Gate A 未受影响的决策保持批准);严格校验/验证契约/可追溯性失败 → 引入不一致的最早阶段。
142
+ 绝不隐瞒迟发现的阻塞问题。
143
+
144
+ ## 恢复规则
145
+
146
+ - 仅当相应 receipt、artifact hash、追溯链与 strict validation 全部通过时,才将设计阶段已完成的 Gate 视为可信交付;仅切换上下文不触发重复批准。
147
+ - 恢复以当前 schema/status 的 `changeRoot` 与 artifactPaths 为准;receipt 使用上述固定根文件名,但文件存在本身不证明批准。
148
+ - 算法:
149
+ 1. `openspec status --change <name> --json`,使用其 schemaName、changeRoot、artifactPaths 与状态;阅读全部 `existingOutputPaths` 与依赖。
150
+ 2. 校验 `gate-a.yaml`/`ready.yaml` 的格式、change/schema 绑定、规范化相对路径、hash 与覆盖范围;拒绝绝对路径、`..`、越界及符号链接逃逸。
151
+ 3. 检查 `openspec validate <name> --strict --type change`、模板完整性、跨产物一致性、可追溯性、验证契约,以及任务 DAG、波次、写集、冲突与资源锁的调度完整性。
152
+ 4. 重建产物计划,从最早未完成或不一致的阶段继续,不重新请求仍有有效 receipt 的 Gate。
153
+ 5. 选择下一步:变更不存在 → 停止并请用户确认拼写/新建;receipt 缺失、hash 失效或产物不完整/不一致 → 回到最早受影响阶段并重新批准该 Gate;`applyRequires` 全部 `done` 且全部校验通过 → 执行退出审计;仅存未持久化的会话分析 → 无中途恢复,重跑只读分析。
154
+
155
+ ## 退出条件
156
+
157
+ - [ ] `openspec validate <name> --strict --type change` 问题为零
158
+ - [ ] `applyRequires` 中每个产物 id 状态均为 `done`
159
+ - [ ] `apply.tracks` 解析到 `changeRoot` 内生成的任务产物
160
+ - [ ] 产物一致且可追溯;任务 DAG 无环、前置条件可判定、波次及冲突排序有效、计划写集与资源锁完整;每个任务验证契约完整且可执行,无仅人工任务
161
+ - [ ] 每个任务的 AGENTS 影响契约完整;仓库索引未被修改
162
+ - [ ] BLOCKING_DECISIONS = 0
163
+ - [ ] `gate-a.yaml` 与 `ready.yaml` 格式、覆盖范围及全部 hash 校验通过
164
+ - [ ] Gate A 与 Gate B 已在可信实施交付前于设计阶段完成
165
+ - [ ] 状态:READY_TO_IMPLEMENT
166
+
167
+ ## 参考命令
168
+
169
+ - `openspec context --json` / `openspec schemas --json`
170
+ - `openspec view` / `openspec list --changes --json` / `openspec list --specs`
171
+ - `openspec status --change <name> --json` / `openspec instructions <artifact-id> --change <name> --json`
172
+ - `openspec new change <name>`(仅 Gate A)
173
+ - 校验失败时 `openspec show <name> --json --deltas-only`
174
+ - 定义新约束前 `rg -n "Constraint:|MUST|MUST NOT|INVARIANT:|PROPERTY:" openspec/`
175
+ <!-- ABEL:END -->
176
+
177
+ If the required input is missing or absent, or the request is ambiguous and not unique, stop before any work and ask the user for the missing or clarified input.
178
+
179
+ Design work is read-only before an explicit Gate A approval: do not write product code, and wait for the user when a blocking decision or ambiguity remains.
180
+ Only after Gate A approval may design artifacts be written inside the change root.
181
+ Resume an existing change with --change <change_name>: validate the Gate receipt, artifact hash, and trace strictly; when an artifact is inconsistent or invalid, report readiness only when the delivery is complete and READY_TO_IMPLEMENT holds.
@@ -0,0 +1,34 @@
1
+ ---
2
+ description: Diagnose and minimally repair one or more existing bugs
3
+ argument-hint: "<problem-description>"
4
+ ---
5
+
6
+ Load the bundled `abel-workflow` Skill before doing any work.
7
+ Read the complete value inside `<abel-request>` without a second whitespace-tokenization pass.
8
+
9
+ <abel-request>
10
+ $ARGUMENTS
11
+ </abel-request>
12
+
13
+ The request must uniquely identify one or more existing bugs.
14
+ If required input is missing or ambiguous, stop and ask for the missing or disambiguating information instead of guessing.
15
+
16
+ ## Diagnose procedure
17
+
18
+ Record target, affected-suite, and full-suite baselines before writes, keeping pre-existing failures separate from the reported defect.
19
+ Collect evidence for each report, reproduce it, propose candidate root causes, and actively falsify each candidate before accepting a root cause.
20
+ If the defect cannot be reproduced or the root cause remains unverified, mark it blocked and do not generate a repair.
21
+
22
+ For each verified root cause, first add and run an executable regression verification that fails for the target defect.
23
+ Only then apply the minimum repair, rerunning the target after every code or test edit and the affected suite after refactoring.
24
+ At a stable checkpoint, classify AGENTS impact, apply only verified managed-index changes, and validate routes.
25
+ Finish only when regression and affected verification pass and the full suite has no new failure relative to baseline.
26
+
27
+ If resolution requires new behavior, substantive architecture, or a choice not uniquely determined by an existing contract, stop and return the requirement to Design.
28
+ Do not archive, publish, or commit implicitly.
29
+
30
+ If the required input is missing or absent, or the request is ambiguous and not unique, stop before any work and ask the user for the missing or clarified input.
31
+
32
+ Reproduce and falsify the root cause first: complete the failing regression verification before the minimum repair.
33
+ The fix must not introduce new behavior or architecture; a substantive decision returns to Design.
34
+ When dev-browser is missing or unavailable, block only approved browser E2E tasks, must not block other work, and provide executable remediation.
@@ -0,0 +1,132 @@
1
+ ---
2
+ name: abel-implement
3
+ description: 校验已批准的 OpenSpec 变更,并调度子代理并行执行强制 Red-Green-Refactor,在任务检查点维护 AGENTS 索引。
4
+ category: abel
5
+ tags: [abel, implementation, TDD, agents]
6
+ argument-hint: "<change_name>"
7
+ ---
8
+
9
+ <abel-request>
10
+ $ARGUMENTS
11
+ </abel-request>
12
+
13
+ <!-- ABEL:START -->
14
+ **参数**:从 `<abel-request>` 读取必需的 `<change_name>`。
15
+
16
+ # 护栏
17
+
18
+ - 改动保持最小且已获批准;应用任何修改前做副作用评审;保留无关的脏文件。
19
+ - 最少注释/文档,优先自解释代码。
20
+ - OpenSpec 约定以 `openspec/config.yaml` 声明的 schema 及其模板为准;OpenSpec 管理的 `openspec/` 生成物(schemas、`config.yaml`、skills 与 slash commands)绝不编辑。
21
+
22
+ ## TDD 护栏(强制)
23
+
24
+ - **Red**:只创建/执行任务的失败可执行验证;实现代码禁止。
25
+ - **Green**:写最小代码满足验证;过度工程禁止。
26
+ - **Refactor**:在保持目标与受影响验证为绿、不引入完整套件新失败的前提下优化质量。
27
+ - 每次代码/测试变更后必须运行任务验证,并在会话中重新分类累计的 AGENTS 影响;仅在稳定任务检查点写索引。
28
+ 绝不跳过验证;测试先行强制。
29
+
30
+ **技能集成**:见全局 AGENTS《阶段技能矩阵》Implement 列;E2E 任务 → `/dev-browser`。
31
+
32
+ ## 就绪预检(任何代码/测试写入之前)
33
+
34
+ Implement 不重新作出或请求 Gate A/B 决策;只有 Gate receipts、artifact hashes、追溯链与 OpenSpec strict validation 全部通过时,才将所选变更视为可信设计交付。
35
+
36
+ 1. 从 `<abel-request>` 直接解析 change name;仅在缺失或无法唯一解析时提问。
37
+ 绝不要求无条件的 `openspec view` 确认。
38
+ 2. 解析仓库根目录,记录 `git status --short`,阅读根/相关嵌套索引。
39
+ 根索引缺失/无效 → `/abel-init`。
40
+ 3. `openspec status --change <name> --json`:读 `schemaName`、`changeRoot`、`artifactPaths`、`applyRequires`、`artifacts`。
41
+ 4. `openspec schema which <schemaName> --json` 读取解析出的 schema.yaml,提取 `apply.tracks` 并相对 `changeRoot` 解析;必须是 `changeRoot` 内一个已存在的具体常规文件。
42
+ 缺失/空/不具体/越界路径一律关闭失败;绝不从 apply 指令的 `contextFiles`/`tasks` 推断跟踪路径。
43
+ 5. `applyRequires` 中每个产物 id 状态必须为 `done`;数组存在或总体完成标记不算数。
44
+ 6. 校验 `changeRoot/gate-a.yaml` 与 `changeRoot/ready.yaml`:receipt 版本、change/schema 绑定、批准摘要、artifact 覆盖范围、`gate-a.yaml` hash,以及每个规范化相对路径的 SHA-256。
45
+ hash 使用文件原始字节;仅对 schema `apply.tracks` 指向的任务文件先把 `- [x]`/`- [X]` 规范化为 `- [ ]`。
46
+ 拒绝绝对路径、`..`、越界与符号链接逃逸。
47
+ receipt 缺失或任一 hash 失效即关闭失败。
48
+ 7. `openspec validate <name> --strict --type change` 问题为零。
49
+ 8. 阅读 `artifactPaths` 报告的全部规划产物;运行 `openspec instructions apply --change <name> --json` 并遵循其 apply 契约。
50
+ 9. 校验稳定 Requirement/Scenario 引用、Requirement → Scenario → Verification → Task 追溯链,以及每个任务的前置条件、`depends_on`、计划写集、冲突/资源锁、派发上下文、验证和 AGENTS 影响契约;缺失、含糊或不可判定时关闭失败。
51
+ 10. 在任何写入前运行并记录每个未完成任务的目标命令、全部 affected-suite 命令与完整套件基线:命令、退出码、归一化失败标识/原因。
52
+ 尚未加入 Red 验证时,目标命令可记录为契约规定的预期状态;既有失败与目标 Red 严格分离,既有失败绝不算 Red。
53
+ 11. 任一预检项失败 → 停止并返回 `/abel-design --change <name>`;此处绝不虚构或修补产品/行为/架构决策。
54
+
55
+ **工具路由**:父代理只负责可信交付校验、执行图调度、子代理派发、统一 diff 审查与机械应用、验证决策、Gate/AGENTS/任务状态所有权,不直接编写测试、实现或局部重构。
56
+ 任务的 Red、Green、Refactor 内容统一由任务 worker 子代理生成;E2E 任务使用 `/dev-browser`。
57
+
58
+ ## 执行图与并行调度(父代理专有)
59
+
60
+ 1. 从全部未完成任务的直接前置任务构建 DAG,拒绝未知任务、自依赖和环。
61
+ 非任务前置条件通过契约检查后,且所有前置任务均已由父代理验收并推进状态,任务才进入 ready 集合。
62
+ 2. 规范化每个计划写集、冲突集和资源锁;写集覆盖测试、fixture、快照与生成输出。
63
+ 拒绝绝对路径、`..`、符号链接逃逸和不可判定的宽泛 glob。
64
+ Gate receipt、OpenSpec 跟踪文件和 `AGENTS.md` 不属于子代理写集,只能由父代理按契约写入。
65
+ 3. 父代理从 ready 集合计算受可用并发槽约束的批次;仅计划写集两两不相交、无冲突边且共享/验证资源锁兼容的任务可同批。
66
+ 相同路径、祖先/后代目录、共同生成输出或互斥资源均串行;Design 的建议波次只供核对,不替代重新计算。
67
+ 4. 每个 ready 任务绑定一个任务局部 worker,并在同一 worker 上通过后续派发连续完成 Red、Green、Refactor,避免把全局上下文复制给 worker。
68
+ 首次派发只提供相关 AGENTS 内容、任务契约、允许读取/改动范围、可信基线标识与当前阶段;worker 不得广泛探索。
69
+ 5. 同批 worker 并行生成当前阶段的统一 diff 和说明,不得写入任何工作树。
70
+ 父代理按跟踪文件顺序校验基线、实际路径、契约与 diff,再机械应用合格 diff;父代理不得自行补写或修正实现。
71
+ 每次应用后由父代理运行契约命令,并把命令、退出码和归一化结果回传原 worker,作为进入下一阶段或生成修正 diff 的唯一事实。
72
+ 6. diff 冲突、越界、写集扩张或验证失败时只阻塞该任务及其后继;已独立验收的同批任务可保留。
73
+ 机械重派可在不改变行为、架构、依赖和写集契约时基于最新基线进行;需要新行为、实质架构、未声明依赖/冲突或范围扩张时,停止受影响分支并返回 Design。
74
+ 禁止无界重试。
75
+ 7. 一批任务稳定后,父代理逐任务完成 AGENTS 检查点和状态推进,再重新计算 ready 集合;任何后继不得提前调度。
76
+ 循环直至 DAG 全部完成。
77
+
78
+ ## 每个任务的委派式 TDD 循环
79
+
80
+ worker 消费任务契约的普通缩进符号列表(绝非 Markdown 复选框):前置条件、直接依赖、派发上下文、计划写集、冲突/资源锁、验证类型、Red 命令/预期失败原因、Green 预期行为、受影响套件命令、目标范围和 AGENTS 影响。
81
+
82
+ 1. **🔴 Red(worker → 父代理)**:worker 只用契约规定的验证类型与范围生成失败验证 diff;父代理审查并应用后运行 Red 命令,必须因契约描述的目标缺陷失败。
83
+ 通过、失败原因不同或命令无效时,停止该任务并返回 `/abel-design --change <name>`,绝不即兴替换契约。
84
+ 非行为变更任务以指定的失败静态验证起步;仅人工任务返回 Design。
85
+ 2. **🟢 Green(worker → 父代理)**:同一 worker 基于已确认的 Red 证据生成最小实现 diff;父代理审查并应用后运行目标验证。
86
+ 失败证据回传 worker,仅允许在声明写集和已批准行为内生成修正 diff。
87
+ 3. **🔵 Refactor(worker → 父代理)**:同一 worker 仅在声明范围内生成消除重复、改进命名/结构/可读性的可选 diff;父代理每次应用后跑目标验证,重构后跑 affected suite;失败则仅撤销该次重构 diff。
88
+ 4. **交付验收(父代理)**:拒绝基线不符、越界文件、Gate/索引/跟踪文件修改、验证证据缺失或未批准行为;父代理只做契约判断、机械应用与验证,不直接修码。
89
+ 5. **AGENTS 检查点(父代理)**:审查完整任务 diff,比较实际与计划的 AGENTS 影响。
90
+ - 暴露未批准的行为/架构 → 停止并返回 design。
91
+ - 分类为 `none` → 记录证据;否则对 `<!-- ABEL:AGENTS-INDEX:START -->` … `<!-- ABEL:AGENTS-INDEX:END -->` 托管区块做最小的更新/创建/移除,保留人工与无关内容。
92
+ - 校验已索引的路径/命令/根到嵌套路由;运行该任务的 AGENTS 验证命令。
93
+ 6. 父代理重跑目标与受影响验证;全绿后,仅在 schema `apply.tracks` 解析出的具体跟踪文件中更新匹配的那个任务复选框;零个/多个匹配 → 停止并返回 design。
94
+
95
+ 父代理拥有主工作区补丁应用、闸门、索引写入与任务完成状态;子代理只接收任务局部索引上下文,只返回统一 diff 与分析,绝不应用补丁、批准决策、编辑索引或推进状态。
96
+
97
+ ## 最终评审与收尾
98
+
99
+ 1. 全部目标测试为绿后运行受影响套件。
100
+ 2. 重跑同一完整套件命令,与基线的归一化失败标识对比,要求无新增失败。
101
+ 3. 变更风险需要时以子代理做全局只读评审;接受其编辑后重跑目标验证与 AGENTS 分类。
102
+ 4. 目标/索引/受影响/完整套件任何失败都阻塞完成;只修复或回退本次变更的编辑。
103
+ 5. 最终副作用评审。
104
+ 6. 要求每个任务/索引结论均已解决,然后报告:Red/Green/Refactor 证据、受影响/完整套件相对基线的结果、AGENTS 文件与原因、是否可进入用户授权的归档。
105
+ 绝不隐式归档。
106
+
107
+ ## 输出格式
108
+
109
+ ```text
110
+ ## /abel-implement (TDD)
111
+
112
+ ### 任务 i/N: {任务描述}
113
+ 🔴 Red ├─ 类型: {verification_type} ├─ 运行: {red_command} └─ 结果: 因 {预期失败原因} 失败 ✓
114
+ 🟢 Green ├─ 实现: {文件} ├─ 运行: {red_command} └─ 结果: {green 预期行为} ✓
115
+ 🔵 Refactor ├─ 优化: {描述} ├─ 运行: {affected_suite_command} └─ 结果: 绿 ✓
116
+ AGENTS: {none 的证据 | 更新的索引文件与原因}
117
+
118
+ ### 全部任务完成
119
+ ├─ 目标测试: 绿 ✓
120
+ ├─ 受影响套件: 绿 ✓
121
+ ├─ 完整套件: 相对基线无新增失败 ✓
122
+ └─ 可进入用户授权的归档
123
+ ```
124
+
125
+ <!-- ABEL:END -->
126
+
127
+ If the required input is missing or absent, or the request is ambiguous and not unique, stop before any work and ask the user for the missing or clarified input.
128
+
129
+ Record target, affected suite, and full-suite baselines before writing; keep pre-existing failures separate and never attribute them to the task Red.
130
+ Red must fail with the expected identity (a wrong reason is invalid and returns to Design); after Green the target and affected suite must be green, in Red-Green-Refactor order, with a stable AGENTS index at checkpoints and no new failure relative to the recorded baseline.
131
+ A fresh-context handoff validates the Gate receipt, hash, and trace strictly without requesting Gate approval again.
132
+ You must not archive, publish, or commit implicitly: only explicit parent actions may do so.