@abelxiaoxing/cadence 1.0.14 → 1.1.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/README.md +29 -13
- package/agents/contract-reviewer.md +2 -2
- package/agents/design-explorer.md +1 -1
- package/agents/diagnosis-worker.md +6 -3
- package/agents/implementation-worker.md +14 -9
- package/config/.env.example +5 -17
- package/config/routes.example.json +42 -0
- package/package.json +3 -3
- package/prompts/abel-design.md +150 -228
- package/prompts/abel-diagnose.md +37 -18
- package/prompts/abel-implement.md +111 -178
- package/prompts/abel-init.md +36 -33
- package/skills/abel-workflow/SKILL.md +156 -168
- package/src/apply-transaction.ts +1427 -0
- package/src/artifact-store.ts +204 -0
- package/src/child-session.ts +136 -17
- package/src/contracts.ts +105 -696
- package/src/control-contracts.ts +259 -0
- package/src/delivery-compiler.ts +1088 -0
- package/src/file-snapshot.ts +5 -0
- package/src/implement-graph.ts +11 -4
- package/src/index.ts +1465 -133
- package/src/isolation-backend.ts +269 -0
- package/src/packet-runtime.ts +533 -0
- package/src/parent-provider.ts +23 -4
- package/src/route-policy.ts +483 -0
- package/src/run-state.ts +393 -0
- package/src/run-store.ts +918 -0
- package/src/safe-path.ts +11 -0
- package/src/scoped-tools.ts +36 -0
- package/src/state-root.ts +215 -0
- package/src/subagent-activity.ts +526 -27
- package/src/submit-tool.ts +274 -0
- package/src/task-ledger.ts +1380 -0
- package/src/verification-capability.ts +529 -42
- package/src/worker-broker.ts +703 -0
- package/src/workflow-engine.ts +7391 -0
- package/src/workspace-store.ts +544 -0
- package/src/candidate-preflight.ts +0 -1618
- package/src/drain.ts +0 -20
- package/src/patch.ts +0 -505
- package/src/result-store.ts +0 -312
- package/src/runtime.ts +0 -2436
- package/src/scheduler.ts +0 -384
- package/src/subagent-endpoint.ts +0 -158
- package/src/worker.ts +0 -204
package/prompts/abel-design.md
CHANGED
|
@@ -1,243 +1,165 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: abel-design
|
|
3
|
-
description:
|
|
3
|
+
description: Produce a validated, approved, directly executable OpenSpec delivery without implementing product code
|
|
4
4
|
category: abel
|
|
5
|
-
tags: [abel, design, openspec, PBT,
|
|
5
|
+
tags: [abel, design, openspec, PBT, evidence]
|
|
6
6
|
argument-hint: "<requirement> | --change <change_name>"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
+
Load the bundled `abel-workflow` Skill and read the complete value inside `<abel-request>` without tokenizing it a second time.
|
|
10
|
+
|
|
9
11
|
<abel-request>
|
|
10
12
|
$ARGUMENTS
|
|
11
13
|
</abel-request>
|
|
12
14
|
|
|
13
15
|
<!-- ABEL:PROMPT:abel-design -->
|
|
14
16
|
<!-- ABEL:START -->
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
-
|
|
30
|
-
`
|
|
31
|
-
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"action": "run",
|
|
65
|
-
"request": {
|
|
66
|
-
"stage": "abel-design",
|
|
67
|
-
"role": "design-explorer",
|
|
68
|
-
"id": "unique-packet-id",
|
|
69
|
-
"phase": "evidence",
|
|
70
|
-
"objective": "bounded evidence objective for this packet",
|
|
71
|
-
"roots": ["."],
|
|
72
|
-
"context": {
|
|
73
|
-
"agents": "applicable AGENTS.md instructions",
|
|
74
|
-
"contract": "exact scope, retrieval, read-only, output, and budget contract"
|
|
75
|
-
},
|
|
76
|
-
"declared": {
|
|
77
|
-
"read": ["exact/relative/path"],
|
|
78
|
-
"write": [],
|
|
79
|
-
"conflicts": [],
|
|
80
|
-
"resources": []
|
|
81
|
-
},
|
|
82
|
-
"output": "evidence"
|
|
83
|
-
}
|
|
17
|
+
|
|
18
|
+
# Design outcome
|
|
19
|
+
|
|
20
|
+
Design resolves product and technical decisions, collects cited evidence, and compiles one trusted delivery.
|
|
21
|
+
It never launches an implementation Worker, creates a product-code candidate, applies a product diff, runs Red/Green/Refactor, or mutates the main workspace.
|
|
22
|
+
|
|
23
|
+
If the requirement/change is missing, absent, ambiguous, or not unique, stop before exploration and ask one focused question.
|
|
24
|
+
An explicit `--change <name>` resumes only that existing change; never reinterpret a misspelling as a new requirement.
|
|
25
|
+
|
|
26
|
+
## Write boundary
|
|
27
|
+
|
|
28
|
+
- Before explicit Gate A approval, all repository work is read-only.
|
|
29
|
+
A provisional Design run may exist only in the repository-external private run store.
|
|
30
|
+
- After Gate A, write only inside the canonical `openspec/changes/<change>/` root and only the next schema-ready artifact or a mechanically invalidated receipt.
|
|
31
|
+
- Every repository `AGENTS.md` remains read-only throughout Design.
|
|
32
|
+
Audit it and seal any needed `none | update-existing | create-index | remove-index` operation into the implementation plan; never edit the index here.
|
|
33
|
+
- Never edit OpenSpec schemas, `openspec/config.yaml`, generated OpenSpec skills/commands, product code, tests, package manifests, or repository state outside the change root.
|
|
34
|
+
|
|
35
|
+
## Durable Design identity
|
|
36
|
+
|
|
37
|
+
Use `start` once to create or recover the Design run identity and `status` to inspect it.
|
|
38
|
+
A new requirement may begin with a code-generated SHA-256 `provisionalKey`; after Gate A fixes the change name, a named `start` binds the same provisional run.
|
|
39
|
+
These commands record lifecycle only and do not execute implementation work.
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{"version":2,"command":"start","stage":"abel-design","provisionalKey":"<sha256>","operationId":"<unique-operation>"}
|
|
43
|
+
{"version":2,"command":"start","stage":"abel-design","change":"<change>","provisionalKey":"<same-sha256>","operationId":"<unique-operation>"}
|
|
44
|
+
{"version":2,"command":"status","stage":"abel-design","change":"<change>"}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Read-only evidence packets
|
|
48
|
+
|
|
49
|
+
Use `abel_dispatch` with `action: "run"` only for bounded Design evidence.
|
|
50
|
+
Each packet is one tool call, has `stage: "abel-design"`, role `design-explorer`, phase `evidence`, an exact read scope, an empty write set, and output `evidence`.
|
|
51
|
+
Never send an implementation phase to a Design packet.
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"action":"run",
|
|
56
|
+
"request":{
|
|
57
|
+
"stage":"abel-design",
|
|
58
|
+
"role":"design-explorer",
|
|
59
|
+
"id":"<unique-packet-id>",
|
|
60
|
+
"phase":"evidence",
|
|
61
|
+
"objective":"<bounded evidence question>",
|
|
62
|
+
"roots":["."],
|
|
63
|
+
"context":{"agents":"<applicable index context>","contract":"<exact read-only contract>"},
|
|
64
|
+
"declared":{"read":["<safe relative path>"],"write":[],"conflicts":[],"resources":[]},
|
|
65
|
+
"output":"evidence"
|
|
84
66
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
-
|
|
122
|
-
-
|
|
123
|
-
|
|
124
|
-
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
- Receipt 写入仅免除不存在的 `instructions <artifact-id>`,其余边界、一致性与逐文件写入规则不变;生成前必须重算覆盖文件的 hash。
|
|
131
|
-
任何 receipt 覆盖文件发生变化都立即使该 receipt 失效:回到最早受影响 Gate,实质变化须重新批准,机械一致性修复也须重算 receipt;`ready.yaml` 必须最后生成。
|
|
132
|
-
|
|
133
|
-
## 阶段 3 —— 技术推导
|
|
134
|
-
|
|
135
|
-
- 从 Gate A 契约、既有代码模式与官方 API 契约推导技术设计;机械决策直接记录进设计,实质性权衡进入阶段 4。
|
|
136
|
-
|
|
137
|
-
## 阶段 4 —— 技术决策与验证循环
|
|
138
|
-
|
|
139
|
-
- 覆盖 HOW:接口、数据流、实现错误机制、依赖/算法与关键参数(如 JWT vs session、经批准的 bcrypt cost factor)。
|
|
140
|
-
- PBT 适用性规则(六类筛查:交换/结合、幂等、往返、不变量保持、单调、边界):具备不变量/往返/幂等/顺序/边界/状态转换的行为必须提取性质与证伪策略;不适合的记录原因并采用示例/E2E/静态验证,不强行套类。
|
|
141
|
-
- 每个场景获得稳定引用 `<spec-path>#<requirement-heading>/<scenario-heading>`,标题在 spec 内唯一;全程维护 Requirement → Scenario → Verification → Task。
|
|
142
|
-
- 先构建实施任务 DAG:所有任务引用存在且无环;依赖边标记 `artifact | contract | conflict-order`、原因与所需输出。
|
|
143
|
-
由 DAG、写集和资源锁派生建议执行波次;波次只用于审阅,Implement 必须从可信契约重新计算。
|
|
144
|
-
- 每个任务恰好一个 schema 复选框,验证契约使用普通缩进符号列表(绝不嵌套 `- [ ]`/`- [x]`):
|
|
145
|
-
- 任务 ID;Requirement + 稳定 Scenario 引用
|
|
146
|
-
- 直接前置任务(无则 `[]`)、依赖类型、所需输出与原因
|
|
147
|
-
- 非任务前置条件及其可执行或静态检查
|
|
148
|
-
- 派发上下文:完成任务所需的最小 spec、AGENTS、代码路径与符号
|
|
149
|
-
- 建议执行波次;并行资格 `eligible | serial` 及原因
|
|
150
|
-
- 计划写集:修改/新建/删除的精确路径或最窄可判定 glob;预期交付文件/符号
|
|
151
|
-
- 冲突集:任务 ID + 原因;共享状态、生成物、清单、数据库、端口、fixture 或验证资源及所需资源锁
|
|
152
|
-
- 验证类型:`property | example | E2E | static`
|
|
153
|
-
- 每个 phase 的 Runtime verification contract:只使用 `kind: "vitest"`、`kind: "package-script"`、`kind: "static-check"` 或 `kind: "steps"`;Red 命令 + 预期失败原因;Green 预期行为
|
|
154
|
-
- `vitest` 明确 runner、安全相对 `testFiles`、`args`、`minTests`;`package-script` 明确 `bun | npm | pnpm | yarn`、真实 script、Gate B 固定的完整 script command 与 `args`;`static-check` 明确本地 executable、`npx` + `noInstall: true` 或安全相对 Node script
|
|
155
|
-
- 复合验证建模为有序 `steps`:前置检查为 `expected-green`,最后一步匹配 phase classification;不得使用 `&&` 或其他 shell operator
|
|
156
|
-
- 每个 phase 的 `verificationInputs`:每个直接输入恰好绑定为 Gate B 时已存在的 `workspace` 安全普通文件,或唯一 `outputId`
|
|
157
|
-
- 受影响套件命令;目标范围;验证命令的并行资格及资源锁
|
|
158
|
-
- 影响闭包(impact closure):`changedSurfaces`、检索命令/命中证据、全部相关既有测试及其 `current-task | regression-task | unaffected` 归类、affected suite 中的既有测试证据
|
|
159
|
-
- 已批准依赖变化清单(无则 `[]`)
|
|
160
|
-
- AGENTS 影响:`none | update-existing | create-index | remove-index`
|
|
161
|
-
- AGENTS 目标索引(`none` 时省略)+ 基于证据的原因;`agentsManagedOnly: true`;AGENTS 验证命令(可执行或静态)
|
|
162
|
-
- 将全部任务汇总成唯一、机器可读的 `ImplementGraphBoundary`:graph 持有 `changeId`、完整 tasks 与 outputs;每个 task 显式包含 `dependsOn` 和固定的 objective/context、逐 phase 精确 read/write、verification/verificationInputs、scheduling、impact closure 与 AGENTS 合同。
|
|
163
|
-
每个 output 显式声明 `id`、安全相对 `path`、producer `taskId/phase` 与 `regular-file` postcondition;同一路径只能有一个 producer,且路径必须在 producer phase write set 中。
|
|
164
|
-
write set 只授予写权限,不证明 artifact 已产生,provenance 不得从 write set 推断。
|
|
165
|
-
Runtime 首先接收一次 `admit-graph`;后续每个阶段只接收 `task-attempt`,包含 change/task/request/phase identity 和新的动态 snapshot,不得重述或改变 graph/task 稳定事实。
|
|
166
|
-
- **影响闭包审计**:任务修改路由授权、页面状态、API 响应或公共 HTML 结构时,必须用 URL、路由名、handler/template 符号检索所有现有入口和测试。
|
|
167
|
-
相关 E2E、theme/layout、authorization、HTML/template 与 API contract 测试必须纳入当前写集、绑定明确后续回归任务,或以引用证据证明不受影响。
|
|
168
|
-
`affected suite` 不得只包含新增测试;例如 `/videos`、`/api/videos` 变化必须覆盖上述全部测试面。
|
|
169
|
-
此审计只校验契约与检索证据,不引入业务扫描器。
|
|
170
|
-
- Gate B 前审计调度契约:前置条件可判定,波次满足拓扑顺序;同波次任务的写集、共享资源和验证锁均不冲突;每个冲突均有 `conflict-order` 串行边;每个任务可由最小派发上下文独立执行。
|
|
171
|
-
- 写集未知、过宽或可能重叠的任务不得标为并行;先重塑任务,或用 `conflict-order` 串行化。
|
|
172
|
-
- 非行为变更任务的 Red 是变更前即可执行的静态验证。
|
|
173
|
-
仅人工验证的任务不具备实施就绪性,绝不通过 Gate B 或退出;重塑任务直至具备可执行验证。
|
|
174
|
-
- Gate B 呈现前,使用 Cadence 与 Implement Runtime 共用的 `src/implement-graph.ts::assessImplementGraphReadiness` 在 consumer root 校验完整 canonical graph;初始 facts 为 completed/blocked tasks 与 applied phases 均为空,且无 candidate overlay。
|
|
175
|
-
Gate B 要求静态 `closure` 为 `{ executable: true, diagnostics: [] }`;尚待前置任务完成是动态 readiness,不使合法 closure 失败。
|
|
176
|
-
调用方不得自行构造 missing-input 集合或在 graph 外另算可执行性。
|
|
177
|
-
`workspace` binding 在 Gate B 时必须已经是安全普通文件。
|
|
178
|
-
缺失输入必须绑定唯一 output;跨任务 consumer 必须在 producer 的传递 DAG 后继中;suggested wave、conflict、resource 与 verification lock 均不能代替 `dependsOn`。
|
|
179
|
-
同一 phase candidate 可以创建并使用自己的 output,更早 phase output 必须先成功应用;Red 不得依赖仅由 Green/Refactor 生产的 output。
|
|
180
|
-
仅允许内容与合同完全一致的 package script、可用的显式 package manager、本地 `node_modules` executable,以及 `npx` 的 `noInstall: true`/`--no-install` 语义;绝不允许隐式联网下载、任意 shell 或 shell operator。
|
|
181
|
-
绝对路径、非规范路径、`..`、NUL、root escape、任一已存在组件 symlink、非目录父项及非普通最终输入/output 均关闭失败。
|
|
182
|
-
不支持的合同以 `design-readiness/verification-contract-unsupported` 诊断关闭;脚本缺失以 `verification-adapter/script-missing` 关闭。
|
|
183
|
-
任何 closure 诊断存在时不得呈现 Gate B 为可批准,也不得写 ready receipt。
|
|
184
|
-
- `vitest` 才允许 Runtime 注入 JSON reporter、要求 `minTests` 并用 assertion identity 判定 Red;`package-script` 与 `static-check` 只按退出码及批准的稳定输出 identity 判定,绝不附加 Vitest 参数。
|
|
185
|
-
`bun run check`、`bun run test:target`、precheck 与 affected suite 都不得由 Runtime 隐式补充;需要时必须成为 Gate B 明确批准的 contract/step。
|
|
186
|
-
Design 只生成上述结构化 contract;argv-only shape 无效。
|
|
187
|
-
- 范围内每个索引过期发现分配给一个任务,或报告为无关的既有过期问题。
|
|
188
|
-
- 循环至未决技术决策为零;在内存中备好剩余产物内容/统一 diff。
|
|
189
|
-
|
|
190
|
-
## ⛔ Gate B —— 批准实施契约
|
|
191
|
-
|
|
192
|
-
- 核实阶段 3/4 忠实展开 Gate A 契约,未引入未批准的新决策。
|
|
193
|
-
- 对将写入 receipt 的同一个 `ImplementGraphBoundary` 重新运行 `assessImplementGraphReadiness`;只有静态 closure 为 `{ executable: true, diagnostics: [] }` 才可请求 Gate B 批准。
|
|
194
|
-
否则以精确 readiness/adapter 诊断返回阶段 3/4 修正,不把缺失 consumer capability 延迟到 Implement Red。
|
|
195
|
-
- 呈现实质技术决策、任务 DAG/建议波次、前置条件、计划写集/冲突/资源锁、验证映射、AGENTS 影响矩阵与产物物化预览;用户显式批准。
|
|
196
|
-
- 按写入协议逐个写入剩余就绪产物。
|
|
197
|
-
- 最后写 `changeRoot/ready.yaml`:记录当前 receipt 版本、change/schema、Gate B 批准原文的忠实摘要(含任务 DAG、建议波次、前置条件、计划写集、冲突与资源锁)、唯一 `implementGraph`、`hashImplementGraphBoundary(implementGraph)` 产生的 `implementGraphHash`、`verificationClosure: { executable: true, diagnostics: [] }`、任务验证与 AGENTS 影响摘要、`gate-a.yaml` 的 SHA-256,以及全部规划产物的规范化相对路径与 SHA-256;排除 `ready.yaml` 自身。
|
|
198
|
-
receipt 不保存另一份 task readiness 摘要、Runtime task/session 状态或 retry budget。
|
|
199
|
-
任务跟踪文件计算 hash 前只将任务完成标记 `- [x]`/`- [X]` 规范化为 `- [ ]`,其余字节不得忽略。
|
|
200
|
-
|
|
201
|
-
## 回环规则
|
|
202
|
-
|
|
203
|
-
- 答案扩大边界 → 阶段 1;技术分析推翻行为契约 → 阶段 2(只重批受影响决策并同步所有受影响产物);Gate B 发现物化不忠实 → 阶段 3/4(Gate A 未受影响的决策保持批准);严格校验/验证契约/可追溯性失败 → 引入不一致的最早阶段。
|
|
204
|
-
绝不隐瞒迟发现的阻塞问题。
|
|
205
|
-
|
|
206
|
-
## 恢复规则
|
|
207
|
-
|
|
208
|
-
- 仅当相应 receipt、artifact hash、追溯链与 strict validation 全部通过时,才将设计阶段已完成的 Gate 视为可信交付;仅切换上下文不触发重复批准。
|
|
209
|
-
- 恢复以当前 schema/status 的 `changeRoot` 与 artifactPaths 为准;receipt 使用上述固定根文件名,但文件存在本身不证明批准。
|
|
210
|
-
- 算法:
|
|
211
|
-
1. `openspec status --change <name> --json`,使用其 schemaName、changeRoot、artifactPaths 与状态;阅读全部 `existingOutputPaths` 与依赖。
|
|
212
|
-
2. 校验 `gate-a.yaml`/`ready.yaml` 的格式、change/schema 绑定、规范化相对路径、hash 与覆盖范围;拒绝绝对路径、`..`、越界及符号链接逃逸。
|
|
213
|
-
3. 检查 `openspec validate <name> --strict --type change`、模板完整性、跨产物一致性、可追溯性、验证契约,以及任务 DAG、波次、写集、冲突与资源锁的调度完整性。
|
|
214
|
-
4. 重建产物计划,从最早未完成或不一致的阶段继续,不重新请求仍有有效 receipt 的 Gate。
|
|
215
|
-
5. 选择下一步:变更不存在 → 停止并请用户确认拼写/新建;receipt 缺失、hash 失效或产物不完整/不一致 → 回到最早受影响阶段并重新批准该 Gate;`applyRequires` 全部 `done` 且全部校验通过 → 执行退出审计;仅存未持久化的会话分析 → 无中途恢复,重跑只读分析。
|
|
216
|
-
|
|
217
|
-
## 退出条件
|
|
218
|
-
|
|
219
|
-
- [ ] `openspec validate <name> --strict --type change` 问题为零
|
|
220
|
-
- [ ] `applyRequires` 中每个产物 id 状态均为 `done`
|
|
221
|
-
- [ ] `apply.tracks` 解析到 `changeRoot` 内生成的任务产物
|
|
222
|
-
- [ ] 产物一致且可追溯;canonical graph/hash 一致,静态 verification closure 无诊断;任务 DAG 无环、前置条件可判定、波次及冲突排序有效、计划写集与资源锁完整;每个任务验证契约完整且可执行,无仅人工任务
|
|
223
|
-
- [ ] 每个任务的结构化 AGENTS 影响、批准依赖与影响闭包契约完整;仓库索引在 Design 阶段未被修改
|
|
224
|
-
- [ ] BLOCKING_DECISIONS = 0
|
|
225
|
-
- [ ] `gate-a.yaml` 与 `ready.yaml` 格式、覆盖范围及全部 hash 校验通过
|
|
226
|
-
- [ ] Gate A 与 Gate B 已在可信实施交付前于设计阶段完成
|
|
227
|
-
- [ ] 状态:READY_TO_IMPLEMENT
|
|
228
|
-
|
|
229
|
-
## 参考命令
|
|
230
|
-
|
|
231
|
-
- `openspec context --json` / `openspec schemas --json`
|
|
232
|
-
- `openspec view` / `openspec list --changes --json` / `openspec list --specs`
|
|
233
|
-
- `openspec status --change <name> --json` / `openspec instructions <artifact-id> --change <name> --json`
|
|
234
|
-
- `openspec new change <name>`(仅 Gate A)
|
|
235
|
-
- 校验失败时 `openspec show <name> --json --deltas-only`
|
|
236
|
-
- 定义新约束前 `rg -n "Constraint:|MUST|MUST NOT|INVARIANT:|PROPERTY:" openspec/`
|
|
237
|
-
<!-- ABEL:END -->
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
When two or more independent packets are needed, issue all sibling calls in the same assistant turn.
|
|
71
|
+
Do not wrap them in a `requests` array.
|
|
72
|
+
Validate packet id, scope, citations, and structure before synthesis; uncited, conflicting, or out-of-scope claims require a bounded follow-up or a minimal parent check.
|
|
73
|
+
|
|
74
|
+
Evidence packets may read code and tests but may not execute validation.
|
|
75
|
+
Design may inspect manifests and verification capability statically; it must not run product tests as a substitute for Implement evidence.
|
|
76
|
+
|
|
77
|
+
## Decision ledger and Gate A
|
|
78
|
+
|
|
79
|
+
Maintain a decision ledger with id, `behavior | technical`, question, cited evidence, alternatives, recommendation, user decision, status, and affected artifacts.
|
|
80
|
+
|
|
81
|
+
Ask the user only for substantive choices: observable behavior, scope/non-goals, data/security/privacy/compatibility/migration policy, new dependencies, architecture/policy, irreversible changes, and technical choices with real trade-offs.
|
|
82
|
+
Resolve reversible details mechanically from one established repository convention and do not ask them repeatedly.
|
|
83
|
+
|
|
84
|
+
Gate A approves the complete WHAT: goal, observable scenarios, failures, scope/non-goals, compatibility/migration/security policy, and success criteria.
|
|
85
|
+
Before approval, present the unresolved behavior decisions together.
|
|
86
|
+
After explicit approval:
|
|
87
|
+
|
|
88
|
+
1. resolve the final kebab-case change name and schema;
|
|
89
|
+
2. create the change only if it does not already exist;
|
|
90
|
+
3. materialize schema-ready behavior artifacts one at a time;
|
|
91
|
+
4. compile `gate-a.yaml` with code-owned canonical serialization and raw SHA-256 bindings.
|
|
92
|
+
|
|
93
|
+
Gate A is not tool permission and carries no session/model/timestamp identity.
|
|
94
|
+
|
|
95
|
+
## Technical contract and ImplementPlan
|
|
96
|
+
|
|
97
|
+
Derive HOW from Gate A plus repository evidence.
|
|
98
|
+
Ask only unresolved substantive technical decisions, then build a complete task DAG with stable Requirement → Scenario → Verification → Task references.
|
|
99
|
+
|
|
100
|
+
Each task must seal:
|
|
101
|
+
|
|
102
|
+
- stable id, objective, exact dependencies and edge reasons;
|
|
103
|
+
- exact phase-local read/write/delete paths and output producers;
|
|
104
|
+
- Red, Green, optional Refactor structured verification and exact verification inputs;
|
|
105
|
+
- task-affected and repair verification contracts;
|
|
106
|
+
- conflicts, resources, verification locks, dependency changes, impact closure, and existing-test evidence;
|
|
107
|
+
- AGENTS impact/target and managed-only ownership;
|
|
108
|
+
- precise context sufficient for a fresh Worker without a conversation transcript.
|
|
109
|
+
|
|
110
|
+
Impact closure must name affected existing tests and fixtures; a suite made only from newly added tests is insufficient.
|
|
111
|
+
For public UI or API work, seal the relevant route authorization, page state, API response and contract, public HTML/template/theme behavior, and an approved browser E2E check when those surfaces are affected.
|
|
238
112
|
|
|
239
|
-
|
|
113
|
+
The plan admits only shell-free `vitest`, `package-script`, `static-check`, or ordered `steps` contracts.
|
|
114
|
+
Pin local runners, package scripts, arguments, `minTests`, classifications, and `noInstall` behavior.
|
|
115
|
+
Reject shell operators, implicit downloads, absolute/escaping paths, missing local capability, and unsupported verification shapes during Design readiness.
|
|
240
116
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
117
|
+
Compile one canonical `ImplementPlan` with `compileImplementPlan`.
|
|
118
|
+
It contains:
|
|
119
|
+
|
|
120
|
+
- tasks and regular-file outputs;
|
|
121
|
+
- target/affected/full-suite baselines and normalized failure identity policy;
|
|
122
|
+
- change-level affected, full-suite, and post-apply verification;
|
|
123
|
+
- an explicit `artifactCorrection.maxAttempts` of 2-3 total candidate launches per task phase and operation, including the initial launch;
|
|
124
|
+
- bounded in-boundary repair policy and attribution classes `pre-existing | introduced | unresolved | environment`;
|
|
125
|
+
- parent-owned `tasks.md` tracking;
|
|
126
|
+
- when required, one sealed managed-block AGENTS operation per approved target, including impact, owning task ids, complete marker-bounded content, and verification.
|
|
127
|
+
|
|
128
|
+
Use the shared readiness proof to require an executable static closure with no diagnostics.
|
|
129
|
+
A write set grants authority but never proves that an output exists.
|
|
130
|
+
Every absent future input must be a unique declared output from a transitive dependency.
|
|
131
|
+
|
|
132
|
+
## Gate B and trusted delivery
|
|
133
|
+
|
|
134
|
+
Gate B approves the complete HOW: substantive technical choices, task DAG, exact boundaries, verification/repair contracts, output postconditions, dependency changes, scheduling declarations, tracking, and AGENTS operations.
|
|
135
|
+
Do not request approval while any capability, closure, traceability, or blocking decision is unresolved.
|
|
136
|
+
|
|
137
|
+
After explicit approval, write remaining schema artifacts one at a time, run OpenSpec strict validation, then generate in this order:
|
|
138
|
+
|
|
139
|
+
1. canonical `implement-plan.json`;
|
|
140
|
+
2. canonical Gate A/plan/artifact/traceability bindings;
|
|
141
|
+
3. `ready.yaml` last, using `compileReadyReceipt`.
|
|
142
|
+
|
|
143
|
+
`ready.yaml` references the plan path, schema version, raw-byte hash, canonical plan hash, executable verification closure, Gate A hash, artifact hashes, and traceability hash.
|
|
144
|
+
It does not embed caller-owned runtime task state, completed/blocked arrays, snapshots, launch identities, or retry budgets.
|
|
145
|
+
|
|
146
|
+
Only the sealed task checkboxes may be normalized from `[x]`/`[X]` to `[ ]` when validating the tracked `tasks.md` hash.
|
|
147
|
+
Every other byte remains bound.
|
|
148
|
+
|
|
149
|
+
## Recovery without approval loops
|
|
150
|
+
|
|
151
|
+
On resume, validate current artifacts and receipts first.
|
|
152
|
+
Preserve decisions whose bound content did not change.
|
|
153
|
+
A mechanical hash, formatting, checkbox, stale path, or traceability repair regenerates only invalidated artifacts and does not reopen a Gate.
|
|
154
|
+
Reopen Gate A only for changed behavior authority; reopen Gate B only for changed technical authority.
|
|
155
|
+
Report the exact invalidated decision/artifact instead of restarting the whole Design process.
|
|
156
|
+
|
|
157
|
+
Endpoint/transport failure in an evidence packet pauses that packet and retains other evidence.
|
|
158
|
+
Missing package scripts/runners or a non-executable verification contract must be corrected before Gate B; they must not be deferred as an Implement surprise.
|
|
159
|
+
|
|
160
|
+
Report `READY_TO_IMPLEMENT` only when strict validation passes, both Gates have zero unresolved decisions, all artifacts/hashes/traceability resolve, and the canonical plan is executable.
|
|
161
|
+
Otherwise report the current Design state, retained evidence, and the one unresolved decision or artifact that prevents readiness.
|
|
162
|
+
|
|
163
|
+
Do not implement product code and do not archive, publish, release, stage, or commit implicitly.
|
|
164
|
+
|
|
165
|
+
<!-- ABEL:END -->
|
package/prompts/abel-diagnose.md
CHANGED
|
@@ -3,33 +3,52 @@ description: Diagnose and minimally repair one or more existing bugs
|
|
|
3
3
|
argument-hint: "<problem-description>"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
Load the bundled `abel-workflow` Skill before
|
|
7
|
-
Read the complete value inside `<abel-request>` without a second whitespace-tokenization pass.
|
|
6
|
+
Load the bundled `abel-workflow` Skill before work and read the complete value inside `<abel-request>` without tokenizing it a second time.
|
|
8
7
|
|
|
9
8
|
<abel-request>
|
|
10
9
|
$ARGUMENTS
|
|
11
10
|
</abel-request>
|
|
12
11
|
|
|
13
12
|
<!-- ABEL:PROMPT:abel-diagnose -->
|
|
14
|
-
The request must uniquely identify one or more existing bugs.
|
|
15
|
-
If required input is missing or ambiguous, stop and ask for the missing or disambiguating information instead of guessing.
|
|
16
13
|
|
|
17
|
-
|
|
14
|
+
The request must uniquely identify one or more existing defects.
|
|
15
|
+
If required input is missing or ambiguous, stop before work and ask one focused question.
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
Collect evidence for each report, reproduce it, propose candidate root causes, and actively falsify each candidate before accepting a root cause.
|
|
21
|
-
If the defect cannot be reproduced or the root cause remains unverified, mark it blocked and do not generate a repair.
|
|
17
|
+
## Independent Diagnose contract
|
|
22
18
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
At a stable checkpoint, classify AGENTS impact, apply only verified managed-index changes, and validate routes.
|
|
26
|
-
Finish only when regression and affected verification pass and the full suite has no new failure relative to baseline.
|
|
19
|
+
Diagnose is not an Implement recovery route and does not inherit Implement task states, retry budgets, approval codes, delivery revisions, or Gate routing.
|
|
20
|
+
A transport, environment, artifact, or verification failure in Diagnose remains a typed Diagnose pause with retained evidence; it never becomes an instruction to change workflow stage.
|
|
27
21
|
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
Use bounded `abel_dispatch` packets with `action: "run"`, `stage: "abel-diagnose"`, and role `diagnosis-worker` only when evidence collection benefits from isolation.
|
|
23
|
+
Each packet covers one defect or one falsification question.
|
|
24
|
+
Do not send an Implement control command from Diagnose.
|
|
30
25
|
|
|
31
|
-
|
|
26
|
+
The parent runs reproduction and verification commands and applies accepted diffs.
|
|
27
|
+
A diagnosis Worker is read-only: it proposes cited evidence or one complete candidate diff and never claims that it executed a command or observed a passing result.
|
|
32
28
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
## Evidence-first algorithm
|
|
30
|
+
|
|
31
|
+
For each defect, keep this order:
|
|
32
|
+
|
|
33
|
+
1. Record target, affected-suite, and full-suite baselines.
|
|
34
|
+
Keep unrelated and pre-existing failures separate.
|
|
35
|
+
2. Reproduce the reported symptom with exact inputs and an observable failure identity.
|
|
36
|
+
3. List plausible root causes and actively falsify each one.
|
|
37
|
+
Accept a root cause only when evidence rules out material alternatives.
|
|
38
|
+
4. Add the smallest executable regression verification and run it.
|
|
39
|
+
It must fail for the reproduced defect, not for syntax, setup, environment, or another reason.
|
|
40
|
+
5. Apply the minimum repair within the existing behavior and architecture contract.
|
|
41
|
+
Run the regression after every edit and the affected suite after refactoring.
|
|
42
|
+
6. Compare the full suite with baseline and require no introduced failure.
|
|
43
|
+
Classify any AGENTS impact and apply only a verified managed-region update at a stable parent checkpoint.
|
|
44
|
+
|
|
45
|
+
If reproduction is unavailable, root-cause evidence is insufficient, the regression cannot witness the defect, or an external capability is unavailable, return `paused` with the exact safe evidence and a concrete resume condition.
|
|
46
|
+
Do not invent a repair.
|
|
47
|
+
|
|
48
|
+
If the requested result actually requires new observable behavior, a new dependency, wider paths, substantive architecture/policy, or another product decision, return `scope-decision-required` with the evidence and decision that the user must make.
|
|
49
|
+
Do not silently widen Diagnose and do not transform an ordinary repair failure into that result.
|
|
50
|
+
|
|
51
|
+
When an approved browser E2E check requires `dev-browser` and it is unavailable, pause only that check and provide executable remediation; continue independent non-browser evidence when safe.
|
|
52
|
+
|
|
53
|
+
Finish only when reproduction, falsification, failing regression, minimum repair, affected verification, and baseline comparison are all evidenced.
|
|
54
|
+
Never archive, publish, or commit implicitly.
|