@haaaiawd/anws 1.0.1 → 1.2.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/lib/init.js +24 -0
- package/lib/update.js +55 -0
- package/package.json +1 -1
- package/templates/.agent/rules/agents.md +112 -90
- package/templates/.agent/skills/design-reviewer/SKILL.md +161 -0
- package/templates/.agent/skills/spec-writer/SKILL.md +50 -0
- package/templates/.agent/skills/spec-writer/references/prd_template.md +116 -113
- package/templates/.agent/skills/system-designer/SKILL.md +113 -19
- package/templates/.agent/skills/system-designer/references/system-design-detail-template.md +198 -0
- package/templates/.agent/skills/system-designer/references/system-design-template.md +118 -145
- package/templates/.agent/skills/task-planner/SKILL.md +60 -1
- package/templates/.agent/skills/task-planner/references/TASK_TEMPLATE.md +15 -4
- package/templates/.agent/skills/task-reviewer/SKILL.md +287 -0
- package/templates/.agent/workflows/blueprint.md +146 -11
- package/templates/.agent/workflows/challenge.md +113 -127
- package/templates/.agent/workflows/change.md +8 -0
- package/templates/.agent/workflows/craft.md +8 -0
- package/templates/.agent/workflows/design-system.md +88 -17
- package/templates/.agent/workflows/explore.md +9 -0
- package/templates/.agent/workflows/forge.md +95 -42
- package/templates/.agent/workflows/genesis.md +36 -2
- package/templates/.agent/workflows/quickstart.md +262 -0
- package/templates/.agent/workflows/scout.md +10 -1
package/lib/init.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const fs = require('node:fs/promises');
|
|
4
4
|
const path = require('node:path');
|
|
5
|
+
const crypto = require('node:crypto');
|
|
5
6
|
const { copyDir } = require('./copy');
|
|
6
7
|
const { MANAGED_FILES, USER_PROTECTED_FILES } = require('./manifest');
|
|
7
8
|
const { success, warn, info, fileLine, skippedLine, blank, logo } = require('./output');
|
|
@@ -25,6 +26,7 @@ async function init() {
|
|
|
25
26
|
}
|
|
26
27
|
// 仅覆盖托管文件(用户自有文件不受影响)
|
|
27
28
|
const { written: updated, skipped } = await overwriteManaged(srcRoot, cwd);
|
|
29
|
+
await storeAgentsTemplateHash(srcRoot, cwd);
|
|
28
30
|
printSummary(updated, skipped, 'updated');
|
|
29
31
|
return;
|
|
30
32
|
}
|
|
@@ -36,6 +38,9 @@ async function init() {
|
|
|
36
38
|
|
|
37
39
|
const written = await copyDir(srcRoot, destRoot);
|
|
38
40
|
|
|
41
|
+
// 存储 agents.md 模板指纹,供后续 update 检测模板变化
|
|
42
|
+
await storeAgentsTemplateHash(srcRoot, cwd);
|
|
43
|
+
|
|
39
44
|
// 打印文件列表
|
|
40
45
|
for (const absPath of written) {
|
|
41
46
|
const rel = path.relative(cwd, absPath).replace(/\\/g, '/');
|
|
@@ -159,4 +164,23 @@ function printNextSteps() {
|
|
|
159
164
|
info(' 2. Run /genesis in your AI assistant to start a new project');
|
|
160
165
|
}
|
|
161
166
|
|
|
167
|
+
/**
|
|
168
|
+
* 存储 agents.md 模板的 MD5 指纹。
|
|
169
|
+
* 供 `anws update` 检测模板是否在版本间发生了变化。
|
|
170
|
+
* @param {string} srcRoot 模板 .agent/ 目录绝对路径
|
|
171
|
+
* @param {string} cwd 项目根目录
|
|
172
|
+
*/
|
|
173
|
+
async function storeAgentsTemplateHash(srcRoot, cwd) {
|
|
174
|
+
const templatePath = path.join(srcRoot, 'rules', 'agents.md');
|
|
175
|
+
const hashPath = path.join(cwd, '.agent', 'rules', '.agents-template-hash');
|
|
176
|
+
|
|
177
|
+
try {
|
|
178
|
+
const content = await fs.readFile(templatePath, 'utf-8');
|
|
179
|
+
const hash = crypto.createHash('md5').update(content).digest('hex');
|
|
180
|
+
await fs.writeFile(hashPath, hash, 'utf-8');
|
|
181
|
+
} catch {
|
|
182
|
+
// 模板文件不存在时静默失败(不应该发生)
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
162
186
|
module.exports = init;
|
package/lib/update.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const fs = require('node:fs/promises');
|
|
4
4
|
const path = require('node:path');
|
|
5
|
+
const crypto = require('node:crypto');
|
|
5
6
|
const { MANAGED_FILES, USER_PROTECTED_FILES } = require('./manifest');
|
|
6
7
|
const { success, warn, error, info, fileLine, skippedLine, blank, logo } = require('./output');
|
|
7
8
|
|
|
@@ -66,10 +67,24 @@ async function update() {
|
|
|
66
67
|
skippedLine(rel.replace(/\\/g, '/'));
|
|
67
68
|
}
|
|
68
69
|
}
|
|
70
|
+
|
|
71
|
+
// 检查 agents.md 模板是否有变更,提供 .new 文件供用户合并
|
|
72
|
+
const agentsMerged = await checkAgentsTemplate(cwd, srcRoot);
|
|
73
|
+
|
|
69
74
|
blank();
|
|
70
75
|
success(`Done! ${updated.length} file(s) updated${skipped.length > 0 ? `, ${skipped.length} skipped` : ''}.`);
|
|
71
76
|
info('Managed files have been updated to the latest version.');
|
|
72
77
|
info('Your custom files in .agent/ were not touched.');
|
|
78
|
+
|
|
79
|
+
if (agentsMerged) {
|
|
80
|
+
blank();
|
|
81
|
+
warn('agents.md template has changed!');
|
|
82
|
+
info('A new template has been saved to:');
|
|
83
|
+
info(' .agent/rules/agents.md.new');
|
|
84
|
+
blank();
|
|
85
|
+
info('Please review and merge the changes into your agents.md.');
|
|
86
|
+
info('After merging, delete agents.md.new.');
|
|
87
|
+
}
|
|
73
88
|
}
|
|
74
89
|
|
|
75
90
|
/**
|
|
@@ -95,4 +110,44 @@ async function askUpdate() {
|
|
|
95
110
|
});
|
|
96
111
|
}
|
|
97
112
|
|
|
113
|
+
/**
|
|
114
|
+
* 检查 agents.md 模板是否相比上次安装/更新有变化。
|
|
115
|
+
* 用 hash 文件记录上次模板指纹,与新模板比较。
|
|
116
|
+
* 如果有变化 → 写入 agents.md.new + 更新 hash。
|
|
117
|
+
*
|
|
118
|
+
* @param {string} cwd 项目根目录
|
|
119
|
+
* @param {string} srcRoot 模板 .agent/ 目录
|
|
120
|
+
* @returns {Promise<boolean>} 是否产生了 .new 文件
|
|
121
|
+
*/
|
|
122
|
+
async function checkAgentsTemplate(cwd, srcRoot) {
|
|
123
|
+
const templatePath = path.join(path.dirname(srcRoot), '.agent', 'rules', 'agents.md');
|
|
124
|
+
const hashPath = path.join(cwd, '.agent', 'rules', '.agents-template-hash');
|
|
125
|
+
const newPath = path.join(cwd, '.agent', 'rules', 'agents.md.new');
|
|
126
|
+
|
|
127
|
+
const templateExists = await fs.access(templatePath).then(() => true).catch(() => false);
|
|
128
|
+
if (!templateExists) return false;
|
|
129
|
+
|
|
130
|
+
const templateContent = await fs.readFile(templatePath, 'utf-8');
|
|
131
|
+
const newHash = crypto.createHash('md5').update(templateContent).digest('hex');
|
|
132
|
+
|
|
133
|
+
// 读取上次存储的 hash
|
|
134
|
+
let oldHash = null;
|
|
135
|
+
try {
|
|
136
|
+
oldHash = (await fs.readFile(hashPath, 'utf-8')).trim();
|
|
137
|
+
} catch {
|
|
138
|
+
// hash 文件不存在(首次 update 或旧版本安装)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (oldHash === newHash) {
|
|
142
|
+
return false; // 模板没变化
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// 模板有变化 → 写入 .new 供用户合并
|
|
146
|
+
await fs.writeFile(newPath, templateContent, 'utf-8');
|
|
147
|
+
// 更新 hash 记录
|
|
148
|
+
await fs.writeFile(hashPath, newHash, 'utf-8');
|
|
149
|
+
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
|
|
98
153
|
module.exports = update;
|
package/package.json
CHANGED
|
@@ -1,90 +1,112 @@
|
|
|
1
|
-
# AGENTS.md - AI 协作协议
|
|
2
|
-
|
|
3
|
-
> **"如果你正在阅读此文档,你就是那个智能体 (The Intelligence)。"**
|
|
4
|
-
>
|
|
5
|
-
> 这个文件是你的**锚点 (Anchor)**。它定义了项目的法则、领地的地图,以及记忆协议。
|
|
6
|
-
> 当你唤醒(开始新会话)时,**请首先阅读此文件**。
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
## 🧠 30秒恢复协议 (Quick Recovery)
|
|
11
|
-
|
|
12
|
-
**当你开始新会话或感到"迷失"时,立即执行**:
|
|
13
|
-
|
|
14
|
-
1. **读取 .agent/rules/agents.md** → 获取项目地图
|
|
15
|
-
2. **查看下方"当前状态"** → 找到最新架构版本
|
|
16
|
-
3. **读取 `genesis/v{N}/05_TASKS.md`** → 了解当前待办
|
|
17
|
-
4. **开始工作**
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## 🗺️ 地图 (领地感知)
|
|
22
|
-
|
|
23
|
-
以下是这个项目的组织方式:
|
|
24
|
-
|
|
25
|
-
| 路径 | 描述 | 访问协议 |
|
|
26
|
-
|------|------|----------|
|
|
27
|
-
| `src/` | **实现层**。实际的代码库。 | 通过 Task 读/写。 |
|
|
28
|
-
| `genesis/` | **设计演进史**。版本化架构状态 (v1, v2...)。 | **只读**(旧版) / **写一次**(新版)。 |
|
|
29
|
-
| `genesis/v{N}/` | **当前真理**。最新的架构定义。 | 永远寻找最大的 `v{N}`。 |
|
|
30
|
-
| `.agent/workflows/` | **工作流**。`/genesis`, `/blueprint` 等。 | 通过 `view_file` 阅读。 |
|
|
31
|
-
| `.agent/skills/` | **技能库**。原子能力。 | 通过 `view_file` 调用。 |
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
## 📍 当前状态 (由 Workflow 自动更新)
|
|
36
|
-
|
|
37
|
-
> **注意**: 此部分由 `/genesis` 和 `/
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
|
71
|
-
|
|
72
|
-
| `/
|
|
73
|
-
| `/
|
|
74
|
-
| `/
|
|
75
|
-
| `/
|
|
76
|
-
| `/
|
|
77
|
-
| `/
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
1
|
+
# AGENTS.md - AI 协作协议
|
|
2
|
+
|
|
3
|
+
> **"如果你正在阅读此文档,你就是那个智能体 (The Intelligence)。"**
|
|
4
|
+
>
|
|
5
|
+
> 这个文件是你的**锚点 (Anchor)**。它定义了项目的法则、领地的地图,以及记忆协议。
|
|
6
|
+
> 当你唤醒(开始新会话)时,**请首先阅读此文件**。
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 🧠 30秒恢复协议 (Quick Recovery)
|
|
11
|
+
|
|
12
|
+
**当你开始新会话或感到"迷失"时,立即执行**:
|
|
13
|
+
|
|
14
|
+
1. **读取 .agent/rules/agents.md** → 获取项目地图
|
|
15
|
+
2. **查看下方"当前状态"** → 找到最新架构版本
|
|
16
|
+
3. **读取 `genesis/v{N}/05_TASKS.md`** → 了解当前待办
|
|
17
|
+
4. **开始工作**
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 🗺️ 地图 (领地感知)
|
|
22
|
+
|
|
23
|
+
以下是这个项目的组织方式:
|
|
24
|
+
|
|
25
|
+
| 路径 | 描述 | 访问协议 |
|
|
26
|
+
|------|------|----------|
|
|
27
|
+
| `src/` | **实现层**。实际的代码库。 | 通过 Task 读/写。 |
|
|
28
|
+
| `genesis/` | **设计演进史**。版本化架构状态 (v1, v2...)。 | **只读**(旧版) / **写一次**(新版)。 |
|
|
29
|
+
| `genesis/v{N}/` | **当前真理**。最新的架构定义。 | 永远寻找最大的 `v{N}`。 |
|
|
30
|
+
| `.agent/workflows/` | **工作流**。`/genesis`, `/blueprint` 等。 | 通过 `view_file` 阅读。 |
|
|
31
|
+
| `.agent/skills/` | **技能库**。原子能力。 | 通过 `view_file` 调用。 |
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 📍 当前状态 (由 Workflow 自动更新)
|
|
36
|
+
|
|
37
|
+
> **注意**: 此部分由 `/genesis`、`/blueprint` 和 `/forge` 自动维护。
|
|
38
|
+
|
|
39
|
+
- **最新架构版本**: `尚未初始化`
|
|
40
|
+
- **活动任务清单**: `尚未生成`
|
|
41
|
+
- **待办任务数**: -
|
|
42
|
+
- **最近一次更新**: `-`
|
|
43
|
+
|
|
44
|
+
### 🌊 Wave 1 — 待 /blueprint 或 /forge 设置
|
|
45
|
+
_尚未开始执行_
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 🌳 项目结构 (Project Tree)
|
|
50
|
+
|
|
51
|
+
> **注意**: 此部分由 `/genesis` 维护。
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
(等待 Genesis 初始化结构树...)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## 🧭 导航指南 (Navigation Guide)
|
|
60
|
+
|
|
61
|
+
> **注意**: 此部分由 `/genesis` 维护。
|
|
62
|
+
|
|
63
|
+
- **在新架构就绪前**: 请勿大规模修改代码。
|
|
64
|
+
- **遇到架构问题**: 请查阅 `genesis/v{N}/03_ADR/`。
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 🛠️ 工作流注册表
|
|
69
|
+
|
|
70
|
+
| 工作流 | 触发时机 | 产出 |
|
|
71
|
+
|--------|---------|------|
|
|
72
|
+
| `/quickstart` | 新用户入口 / 不知道从哪开始 | 编排其他工作流 |
|
|
73
|
+
| `/genesis` | 新项目 / 重大重构 | PRD, Architecture, ADRs |
|
|
74
|
+
| `/scout` | 变更前 / 接手项目 | `genesis/v{N}/00_SCOUT_REPORT.md` |
|
|
75
|
+
| `/design-system` | genesis 后 | 04_SYSTEM_DESIGN/*.md |
|
|
76
|
+
| `/blueprint` | genesis 后 | 05_TASKS.md + agents.md 初始 Wave |
|
|
77
|
+
| `/change` | 微调已有任务 | 更新 TASKS + SYSTEM_DESIGN (仅修改) + CHANGELOG |
|
|
78
|
+
| `/explore` | 调研时 | 探索报告 |
|
|
79
|
+
| `/challenge` | 决策前质疑 | 07_CHALLENGE_REPORT.md (含问题总览目录) |
|
|
80
|
+
| `/forge` | 编码执行 | 代码 + 更新 agents.md Wave 块 |
|
|
81
|
+
| `/craft` | 创建工作流/技能/提示词 | Workflow / Skill / Prompt 文档 |
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## 📜 宪法 (The Constitution)
|
|
86
|
+
|
|
87
|
+
1. **版本即法律**: 不"修补"架构文档,只"演进"。变更必须创建新版本。
|
|
88
|
+
2. **显式上下文**: 决策写入 ADR,不留在"聊天记忆"里。
|
|
89
|
+
3. **交叉验证**: 编码前对照 `05_TASKS.md`。我在做计划好的事吗?
|
|
90
|
+
4. **美学**: 文档应该是美的。善用 Markdown 和 Emoji。
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
## 🔄 Auto-Updated Context
|
|
94
|
+
|
|
95
|
+
<!-- AUTO:BEGIN — 由工作流自动维护,请勿手动编辑此区块 -->
|
|
96
|
+
|
|
97
|
+
### 技术栈决策
|
|
98
|
+
- [由 genesis/tech-evaluator 自动填充]
|
|
99
|
+
|
|
100
|
+
### 系统边界
|
|
101
|
+
- [由 genesis/system-architect 自动填充]
|
|
102
|
+
|
|
103
|
+
### 活跃 ADR
|
|
104
|
+
- [由 genesis 自动填充 ADR 摘要]
|
|
105
|
+
|
|
106
|
+
### 当前任务状态
|
|
107
|
+
- [由 blueprint/forge 自动更新]
|
|
108
|
+
|
|
109
|
+
<!-- AUTO:END -->
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
> **状态自检**: 准备好了?提醒用户运行 `/quickstart` 开始吧。
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: design-reviewer
|
|
3
|
+
description: 使用三维框架(系统设计、运行模拟、工程实现)系统性审查架构和系统设计文档。产出按严重度分级的发现,关联到具体文档段落。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 设计审查大师手册
|
|
7
|
+
|
|
8
|
+
> "代码之前发现的设计缺陷,能省下一百个 Bug。
|
|
9
|
+
> 对设计严厉,代码才能优雅。"
|
|
10
|
+
|
|
11
|
+
你是**设计审查大师**,负责系统性审查架构和系统设计文档。你的三维框架确保没有任何一类风险被遗漏。
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## ⚡ 任务目标
|
|
16
|
+
|
|
17
|
+
1. **加载文档 (必须)**: 读取 `02_ARCHITECTURE_OVERVIEW.md`、所有 `04_SYSTEM_DESIGN/*.md` 以及所有 `03_ADR/*.md`。
|
|
18
|
+
2. **深度理解**: 使用 `sequentialthinking`(3-5 步)在批判之前先理解设计意图。
|
|
19
|
+
3. **Pre-Mortem**: 想象项目在 6 个月后失败了——倒推根因。
|
|
20
|
+
4. **三维审查**: 系统性执行全部 3 个维度。
|
|
21
|
+
5. **假设验证**: 识别隐藏假设并尝试证伪。
|
|
22
|
+
6. **生成发现**: 为每条发现标注严重度,并关联到具体文档段落。
|
|
23
|
+
|
|
24
|
+
## 🛑 硬约束
|
|
25
|
+
|
|
26
|
+
- **证据为本**: 每条发现**必须**有具体文档引用 + 推理链。"可能有性能问题"这种没有分析的说法禁止出现。
|
|
27
|
+
- **质量优于数量**: 3 条真实发现 > 10 条猜测。
|
|
28
|
+
- **尊重 ADR 决策**: 如果 ADR 明确选择了某个权衡并附有文档化的理由,不要翻旧账。仅在出现新证据反驳原有理由时才标记。
|
|
29
|
+
- **不涉及实现细节**: 审查的是*设计*,不是假想的代码。
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## 🔍 三维审查框架
|
|
34
|
+
|
|
35
|
+
### 维度 1: 系统设计 (System Design)
|
|
36
|
+
|
|
37
|
+
**目标**: 验证架构的完整性、一致性和边界清晰度。
|
|
38
|
+
|
|
39
|
+
| # | 检查项 | 关注要点 |
|
|
40
|
+
|---|--------|---------|
|
|
41
|
+
| SD-1 | **架构一致性** | 同一组件在 PRD、Architecture、System Design 中的描述是否矛盾? |
|
|
42
|
+
| SD-2 | **边界清晰度** | 每个系统的职责范围是否明确?是否存在职责重叠? |
|
|
43
|
+
| SD-3 | **依赖合理性** | 系统依赖是否无环?是否存在隐藏耦合? |
|
|
44
|
+
| SD-4 | **接口完整性** | 所有跨系统接口是否完整定义(输入/输出/错误/协议)? |
|
|
45
|
+
| SD-5 | **状态管理** | 系统状态转换是否清晰定义?边缘状态是否处理? |
|
|
46
|
+
| SD-6 | **数据模型完整性** | 实体关系是否跨文档一致?是否存在孤儿实体? |
|
|
47
|
+
|
|
48
|
+
**思考提示**(配合 `sequentialthinking` 使用):
|
|
49
|
+
1. "这个架构背后的核心假设是什么?"
|
|
50
|
+
2. "如果假设 X 不成立,什么会崩?"
|
|
51
|
+
3. "系统边界定义是否存在歧义?"
|
|
52
|
+
4. "接口是否覆盖了所有边界情况?"
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
### 维度 2: 运行模拟 (Runtime Simulation)
|
|
57
|
+
|
|
58
|
+
**目标**: 在脑中"运行"系统,发现时序、状态和并发问题。
|
|
59
|
+
|
|
60
|
+
> 本维度**必须**使用 `sequentialthinking`(3-5 步)。运行时问题藏在序列中。
|
|
61
|
+
|
|
62
|
+
| # | 检查项 | 关注要点 |
|
|
63
|
+
|---|--------|---------|
|
|
64
|
+
| RS-1 | **时序一致性** | 时序模型是否合理?是否存在"必须先于"的矛盾? |
|
|
65
|
+
| RS-2 | **状态同步** | 分布式状态下,副本是否可能发散?最终一致性在这里是否可接受? |
|
|
66
|
+
| RS-3 | **并发处理** | 两个操作冲突时会怎样?是否有解决策略? |
|
|
67
|
+
| RS-4 | **边界条件** | 空状态、满状态、溢出——各自如何处理? |
|
|
68
|
+
| RS-5 | **故障传播** | 组件 A 故障时如何影响 B、C?是否存在级联风险? |
|
|
69
|
+
| RS-6 | **Happy Path 偏见** | 只设计了正常路径?错误/超时/部分失败路径呢? |
|
|
70
|
+
|
|
71
|
+
**思考提示**:
|
|
72
|
+
1. "端到端追踪一个典型操作,经过哪些步骤?"
|
|
73
|
+
2. "每一步产生什么状态变更?什么可能出错?"
|
|
74
|
+
3. "如果两个用户同时做同一件事会怎样?"
|
|
75
|
+
4. "崩溃后 30 秒,系统是什么样子?"
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
### 维度 3: 工程实现 (Engineering Implementation)
|
|
80
|
+
|
|
81
|
+
**目标**: 验证设计可构建、可测试、可维护。
|
|
82
|
+
|
|
83
|
+
> 本维度**必须**使用 `sequentialthinking`(3-5 步)。
|
|
84
|
+
|
|
85
|
+
| # | 检查项 | 关注要点 |
|
|
86
|
+
|---|--------|---------|
|
|
87
|
+
| EI-1 | **可测试性** | 核心逻辑能否被单元测试?是否有 Mock 的接缝? |
|
|
88
|
+
| EI-2 | **可维护性** | 如果需求变更,需要改多少文件? |
|
|
89
|
+
| EI-3 | **性能瓶颈** | 设计中是否隐藏了 N+1 查询、无界循环或 O(n²)? |
|
|
90
|
+
| EI-4 | **安全面** | 认证边界是否清晰?敏感数据静态/传输加密?输入校验? |
|
|
91
|
+
| EI-5 | **可观测性** | 凭设计中的日志/指标方案能否调试生产问题? |
|
|
92
|
+
| EI-6 | **技术栈契合度** | 选定的技术是否真正支持所需功能?版本兼容性? |
|
|
93
|
+
|
|
94
|
+
**思考提示**:
|
|
95
|
+
1. "如何为核心逻辑写单元测试?"
|
|
96
|
+
2. "如果需要修改功能 X,影响范围多大?"
|
|
97
|
+
3. "性能热点在哪?能否后续优化?"
|
|
98
|
+
4. "这个设计暴露了哪些攻击向量?"
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## 🎚️ 严重度分级
|
|
103
|
+
|
|
104
|
+
| 等级 | 判定标准 | 所需行动 |
|
|
105
|
+
|:----:|---------|---------|
|
|
106
|
+
| **Critical** 🔴 | 根本性矛盾或不可能实现。不解决无法继续。 | P0 — 必须在 blueprint/forge 之前修复 |
|
|
107
|
+
| **High** 🟠 | 大概率导致返工或失败的严重风险。 | P1 — 在 forge 之前修复 |
|
|
108
|
+
| **Medium** 🟡 | 有变通方案的质量隐患。 | P2 — 实现阶段修复 |
|
|
109
|
+
| **Low** 🟢 | 润色项或轻微不一致。 | P3 — 后续跟踪 |
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## 📊 输出格式
|
|
114
|
+
|
|
115
|
+
按以下结构生成发现,适合纳入 `07_CHALLENGE_REPORT.md`:
|
|
116
|
+
|
|
117
|
+
```markdown
|
|
118
|
+
## 🔍 设计审查发现
|
|
119
|
+
|
|
120
|
+
### 摘要
|
|
121
|
+
|
|
122
|
+
| 维度 | 发现数 | Critical | High | Medium | Low |
|
|
123
|
+
|------|:------:|:--------:|:----:|:------:|:---:|
|
|
124
|
+
| 系统设计 | — | — | — | — | — |
|
|
125
|
+
| 运行模拟 | — | — | — | — | — |
|
|
126
|
+
| 工程实现 | — | — | — | — | — |
|
|
127
|
+
| **合计** | **—** | **—** | **—** | **—** | **—** |
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
### [维度] — [ID]: [标题]
|
|
132
|
+
|
|
133
|
+
**严重度**: Critical / High / Medium / Low
|
|
134
|
+
**文档位置**: [精确的文件和章节引用]
|
|
135
|
+
|
|
136
|
+
**问题**:
|
|
137
|
+
[详细描述,引用具体文档内容]
|
|
138
|
+
|
|
139
|
+
**证据**:
|
|
140
|
+
- 文档分析: [来自 PRD/Architecture/ADR 的具体内容]
|
|
141
|
+
- 推理链: [基于 sequentialthinking 的分析]
|
|
142
|
+
- 类比: [其他系统中的类似已知失败,如适用]
|
|
143
|
+
|
|
144
|
+
**影响**:
|
|
145
|
+
- [不修复会发生什么]
|
|
146
|
+
|
|
147
|
+
**建议**:
|
|
148
|
+
[修复方式,可提供多个选项]
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## 💡 审查质量清单
|
|
154
|
+
|
|
155
|
+
交付发现前,确认:
|
|
156
|
+
- [ ] 每条发现有具体文档引用(不是笼统的"架构文档")
|
|
157
|
+
- [ ] 每条发现有明确的影响说明
|
|
158
|
+
- [ ] 没有纯猜测性的发现(缺乏推理链条)
|
|
159
|
+
- [ ] Critical/High 发现经过 `sequentialthinking` 验证
|
|
160
|
+
- [ ] ADR 中已记录的权衡被尊重(没有在无新证据的情况下重复质疑)
|
|
161
|
+
- [ ] 发现可操作(审查者能根据建议进行修复)
|
|
@@ -18,6 +18,8 @@ Your job is to kill ambiguity.
|
|
|
18
18
|
* Draft clarifying questions
|
|
19
19
|
3. **Interrogate**: Present questions to user. DO NOT proceed without answers.
|
|
20
20
|
4. **Draft PRD (MANDATORY)**: Use `view_file references/prd_template.md` then `write_to_file` to create `genesis/v{N}/01_PRD.md`.
|
|
21
|
+
5. **Ambiguity Scan (MANDATORY)**: After drafting, run the 10-Dimension Ambiguity Scan (see below). Fix issues inline or mark `[ASSUMPTION]`.
|
|
22
|
+
6. **US Quality Gate (MANDATORY)**: Verify every User Story passes the quality checklist (see below).
|
|
21
23
|
|
|
22
24
|
## 🛑 Mandatory Steps
|
|
23
25
|
Before creating the PRD, you MUST:
|
|
@@ -26,6 +28,11 @@ Before creating the PRD, you MUST:
|
|
|
26
28
|
3. Clarify "Vibe Words" with the user (What does "Fast" mean to you? What does "Modern" imply?).
|
|
27
29
|
4. Use `write_to_file` to save output. DO NOT just print to chat.
|
|
28
30
|
|
|
31
|
+
After creating the PRD, you MUST:
|
|
32
|
+
5. Run the 10-Dimension Ambiguity Scan — fix or mark all `Partial`/`Missing` items.
|
|
33
|
+
6. Verify every User Story has: Priority / 独立可测 / 涉及系统 / 边界情况.
|
|
34
|
+
7. Ensure `[NEEDS CLARIFICATION]` tags ≤ 3 (hard limit). Excess → use reasonable defaults + `[ASSUMPTION]` tag.
|
|
35
|
+
|
|
29
36
|
## ✅ Completion Checklist
|
|
30
37
|
- [ ] PRD file created: `genesis/v{N}/01_PRD.md`
|
|
31
38
|
- [ ] Contains User Stories, Acceptance Criteria, Non-Goals
|
|
@@ -56,3 +63,46 @@ Before creating the PRD, you MUST:
|
|
|
56
63
|
|
|
57
64
|
## 🧰 The Toolkit
|
|
58
65
|
* `references/prd_template.md`: The Product Requirements Document template.
|
|
66
|
+
|
|
67
|
+
## 🔍 10-Dimension Ambiguity Scan
|
|
68
|
+
|
|
69
|
+
After drafting the PRD, you **MUST** systematically scan it against these 10 dimensions. This replaces ad-hoc "any questions?" with a **repeatable, exhaustive** sweep.
|
|
70
|
+
|
|
71
|
+
For each dimension, mark status: `Clear` ✅ / `Partial` ⚠️ / `Missing` ❌
|
|
72
|
+
|
|
73
|
+
| # | Dimension | What to Check | Status |
|
|
74
|
+
|---|-----------|--------------|:------:|
|
|
75
|
+
| 1 | **Functional Scope & Behavior** | Core objectives / success criteria / explicit exclusions / user role distinctions | |
|
|
76
|
+
| 2 | **Domain & Data Model** | Entities, attributes, relationships / uniqueness rules / lifecycle & state transitions / data volume assumptions | |
|
|
77
|
+
| 3 | **Interaction & UX Flow** | Key user journeys / error, empty, loading states / accessibility & i18n | |
|
|
78
|
+
| 4 | **Non-Functional Quality** | Performance / scalability / reliability / observability / security & privacy / compliance | |
|
|
79
|
+
| 5 | **Integration & External** | External service failure modes / import-export formats / protocol version assumptions | |
|
|
80
|
+
| 6 | **Edge Cases & Failure** | Negative scenarios / rate limiting / concurrency conflict resolution | |
|
|
81
|
+
| 7 | **Constraints & Tradeoffs** | Technical constraints / explicit tradeoff records / rejected alternative archives | |
|
|
82
|
+
| 8 | **Terminology Consistency** | Canonical glossary / synonym normalization across PRD | |
|
|
83
|
+
| 9 | **Completion Signals** | Acceptance criteria testability / quantifiable DoD | |
|
|
84
|
+
| 10 | **Placeholders** | TODO markers / unquantified vague adjectives (fast, scalable, secure, intuitive, robust) | |
|
|
85
|
+
|
|
86
|
+
**Rules**:
|
|
87
|
+
- `Partial` or `Missing` items → rank by **Impact × Uncertainty**, pick **top 5** to ask user
|
|
88
|
+
- Ask **one question at a time**; provide your recommended answer; user can accept or customize
|
|
89
|
+
- After user answers → **atomically write** the answer into the corresponding PRD section (never leave contradictory text)
|
|
90
|
+
- **NEEDS CLARIFICATION hard limit ≤ 3** — if more remain, fill with reasonable defaults + `[ASSUMPTION: ...]` tag
|
|
91
|
+
- **Do NOT ask about these reasonable defaults**: industry-standard data retention, standard web/mobile performance expectations, user-friendly error messages with fallbacks, standard session-based or OAuth2 auth
|
|
92
|
+
|
|
93
|
+
## ✅ User Story Quality Gate
|
|
94
|
+
|
|
95
|
+
Every User Story in the PRD **MUST** pass these checks before the PRD is considered complete:
|
|
96
|
+
|
|
97
|
+
| Check | Requirement |
|
|
98
|
+
|-------|------------|
|
|
99
|
+
| **Unique ID** | Has `[REQ-XXX]` identifier for traceability |
|
|
100
|
+
| **Priority** | Marked P0 / P1 / P2 — P0 stories listed first |
|
|
101
|
+
| **独立可测** | Describes how this story can be **independently** demonstrated and verified |
|
|
102
|
+
| **涉及系统** | Lists specific system IDs (must align with `02_ARCHITECTURE_OVERVIEW.md`) |
|
|
103
|
+
| **Acceptance Criteria** | At least 1 Given-When-Then + at least 1 Error Case |
|
|
104
|
+
| **边界情况** | At least 1 boundary condition identified |
|
|
105
|
+
| **No Vibe Words** | No unquantified adjectives (fast → <100ms p99, scalable → support N users) |
|
|
106
|
+
| **User Value** | One sentence describing value to end user |
|
|
107
|
+
|
|
108
|
+
If any User Story fails a check → fix it before delivering the PRD.
|