@haaaiawd/anws 2.0.0 → 2.0.2

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 CHANGED
@@ -3,8 +3,8 @@
3
3
  <img src="assets/logo-cli.png" width="260" alt="Anws">
4
4
 
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
6
- [![Version](https://img.shields.io/badge/version-v2.0.0-7FB5B6)](https://github.com/Haaaiawd/Anws/releases)
7
- [![Targets](https://img.shields.io/badge/Targets-Windsurf%20%7C%20Claude%20Code%20%7C%20Copilot%20%7C%20Cursor%20%7C%20Codex%20Preview%20%7C%20OpenCode-blueviolet)](https://github.com/Haaaiawd/Anws)
6
+ [![Version](https://img.shields.io/badge/version-v2.0.2-7FB5B6)](https://github.com/Haaaiawd/Anws/releases)
7
+ [![Targets](https://img.shields.io/badge/Targets-Windsurf%20%7C%20Claude%20Code%20%7C%20Copilot%20%7C%20Cursor%20%7C%20Codex%20Preview%20%7C%20OpenCode%20%7C%20Trae%20%7C%20Qoder%20%7C%20Kilo%20Code-blueviolet)](https://github.com/Haaaiawd/Anws)
8
8
 
9
9
  [English](./README.md) | [中文](./README_CN.md)
10
10
 
@@ -14,15 +14,15 @@
14
14
 
15
15
  # Anws
16
16
 
17
- **Anws** is a spec-driven workflow framework for AI-assisted software development.
17
+ **Anws** is a spec-driven workflow framework for AI-assisted development across modern AI IDEs and coding tools.
18
18
 
19
- It gives coding agents a disciplined path:
19
+ It helps teams build production-ready software through a disciplined path:
20
20
 
21
21
  `PRD -> Architecture -> ADR -> Tasks -> Review -> Code -> Upgrade`
22
22
 
23
- Instead of letting AI jump straight into implementation, Anws forces design, preserves context in files, and projects the right workflow assets into the native layout of your target AI IDE.
23
+ Anws enforces design-first principles, preserves context in files, and prevents architectural drift across multi-tool AI coding workflows.
24
24
 
25
- > **TL;DR**: stop treating AI like an autocomplete toy. Give it architecture, constraints, and a lifecycle.
25
+ > **TL;DR**: a design-first workflow framework for AI coding tools that turns vibe coding into production-oriented engineering.
26
26
 
27
27
  ## ANWS
28
28
 
@@ -79,8 +79,13 @@ Anws addresses those problems with:
79
79
  - **Codex projection strategy update**
80
80
  - Codex is now treated as **Preview**
81
81
  - because Codex prompts are no longer available, Anws now packages workflow guidance into `.codex/skills/anws-system/`
82
- - `/quickstart` maps to `SKILL.md`
83
- - the rest of the workflow docs are exposed as `references/*.md` under the same aggregated skill
82
+ - `SKILL.md` is the navigation shell for the bundle
83
+ - workflow details, including `/quickstart`, now live under `references/*.md`
84
+
85
+ - **Trae / Qoder / Kilo Code support**
86
+ - Trae follows the same skills-only bundle family as Codex via `.trae/skills/anws-system/`
87
+ - Qoder adds native `.qoder/commands/` + `.qoder/skills/`
88
+ - Kilo Code adds native `.kilocode/workflows/` + `.kilocode/skills/`
84
89
 
85
90
  - **OpenCode support**
86
91
  - adds native projection support for `.opencode/commands/` and `.opencode/skills/`
@@ -135,6 +140,7 @@ anws update
135
140
  - **State source**
136
141
  - `anws update` reads `.anws/install-lock.json`
137
142
  - if the lock is missing or invalid, it falls back to directory scan
143
+ - a real `anws update` can rebuild `.anws/install-lock.json` from detected targets when fallback is active
138
144
 
139
145
  - **`AGENTS.md` behavior**
140
146
  - marker-based file -> update stable sections, preserve `AUTO` block
@@ -171,16 +177,28 @@ If you maintain old docs or release notes, update those references before publis
171
177
  ## Compatibility
172
178
 
173
179
  Anws keeps a **single canonical workflow / skill source**, then projects it into the native directory structure expected by each tool.
180
+ Every supported target now receives:
181
+
182
+ - a root `AGENTS.md`
183
+ - a target-native `skills/` projection
184
+ - one target-native workflow entry surface, depending on the tool:
185
+ - `workflows`
186
+ - `commands`
187
+ - `prompts`
188
+ - aggregated `skills` for Codex / Trae skills-only bundles
174
189
 
175
190
  | Environment | Status | Layout |
176
191
  | --- | --- | --- |
177
- | **Windsurf** | ✅ Full Support | `.windsurf/workflows/` + `.windsurf/skills/` |
192
+ | **Windsurf** | ✅ Full Support | `AGENTS.md` + `.windsurf/workflows/` + `.windsurf/skills/` |
178
193
  | **Antigravity** | ✅ Full Support | `.agents/workflows/` + `.agents/skills/` + `AGENTS.md` |
179
- | **Claude Code** | ✅ Full Support | `.claude/commands/` |
180
- | **GitHub Copilot** | ✅ Full Support | `.github/agents/` + `.github/prompts/` |
181
- | **Cursor** | ✅ Supported | `.cursor/commands/` |
182
- | **Codex** | ⚠️ Preview | `.codex/skills/anws-system/` + `.codex/skills/<skill>/` |
183
- | **OpenCode** | ✅ Supported | `.opencode/commands/` + `.opencode/skills/` |
194
+ | **Claude Code** | ✅ Full Support | `AGENTS.md` + `.claude/commands/` + `.claude/skills/` |
195
+ | **GitHub Copilot** | ✅ Full Support | `AGENTS.md` + `.github/prompts/` + `.github/skills/` |
196
+ | **Cursor** | ✅ Supported | `AGENTS.md` + `.cursor/commands/` + `.cursor/skills/` |
197
+ | **Codex** | ⚠️ Preview | `AGENTS.md` + `.codex/skills/anws-system/` + `.codex/skills/<skill>/` |
198
+ | **OpenCode** | ✅ Supported | `AGENTS.md` + `.opencode/commands/` + `.opencode/skills/` |
199
+ | **Trae** | ✅ Supported | `AGENTS.md` + `.trae/skills/anws-system/` + `.trae/skills/<skill>/` |
200
+ | **Qoder** | ✅ Supported | `AGENTS.md` + `.qoder/commands/` + `.qoder/skills/` |
201
+ | **Kilo Code** | ✅ Supported | `AGENTS.md` + `.kilocode/workflows/` + `.kilocode/skills/` |
184
202
 
185
203
  ---
186
204
 
@@ -234,21 +252,45 @@ your-project/
234
252
  │ ├── install-lock.json
235
253
  │ ├── changelog/
236
254
  │ └── v{N}/
255
+ ├── AGENTS.md
237
256
  ├── .windsurf/
238
257
  │ ├── workflows/
239
258
  │ └── skills/
240
259
  ├── .agents/
241
260
  │ ├── workflows/
242
261
  │ └── skills/
243
- ├── AGENTS.md
244
- ├── .cursor/commands/
245
- ├── .claude/commands/
262
+ ├── .cursor/
263
+ ├── commands/
264
+ │ └── skills/
265
+ ├── .claude/
266
+ │ ├── commands/
267
+ │ └── skills/
246
268
  ├── .github/
247
- │ ├── agents/
248
- │ └── prompts/
269
+ │ ├── prompts/
270
+ │ └── skills/
271
+ ├── .opencode/
272
+ │ ├── commands/
273
+ │ └── skills/
274
+ ├── .qoder/
275
+ │ ├── commands/
276
+ │ └── skills/
277
+ ├── .kilocode/
278
+ │ ├── workflows/
279
+ │ └── skills/
280
+ ├── .trae/
281
+ │ └── skills/
282
+ │ ├── anws-system/
283
+ │ │ ├── SKILL.md
284
+ │ │ └── references/
285
+ │ └── <skill>/
286
+ │ └── SKILL.md
249
287
  └── .codex/
250
- ├── prompts/
251
- └── skills/
288
+ ├── skills/
289
+ │ ├── anws-system/
290
+ │ │ ├── SKILL.md
291
+ │ │ └── references/
292
+ │ └── <skill>/
293
+ │ └── SKILL.md
252
294
  ```
253
295
 
254
296
  > One source model. Multiple target layouts. Explicit ownership on disk.
package/bin/cli.js CHANGED
@@ -23,12 +23,24 @@ OPTIONS
23
23
  -v, --version Print version number
24
24
  -h, --help Show this help message
25
25
  --target Target AI IDE(s) for \`init\`, comma-separated (${TARGET_IDS.join(', ')})
26
- --check Preview grouped update diffs without writing files or install-lock state
26
+ --check Preview grouped update diffs without writing files or rebuilding install-lock state
27
+
28
+ SUPPORTED TARGETS
29
+ windsurf workflows + skills
30
+ antigravity workflows + skills
31
+ cursor commands + skills
32
+ claude commands + skills
33
+ copilot prompts + skills
34
+ codex preview, skills-only bundle via anws-system
35
+ opencode commands + skills
36
+ trae skills-only bundle via anws-system
37
+ qoder commands + skills
38
+ kilo workflows + skills
27
39
 
28
40
  EXAMPLES
29
41
  anws init # Choose target IDEs and install their managed workflow projections
30
- anws init --target windsurf,codex
31
- anws update # Update all matched targets from install-lock or directory scan
42
+ anws init --target windsurf,codex,opencode
43
+ anws update # Update all matched targets from install-lock or directory scan fallback
32
44
  anws update --check # Preview grouped changes per target without writing files
33
45
  `.trimStart();
34
46
 
@@ -7,7 +7,7 @@ const TARGETS = {
7
7
  windsurf: {
8
8
  id: 'windsurf',
9
9
  label: 'Windsurf',
10
- rootAgentFile: false,
10
+ rootAgentFile: true,
11
11
  projectionTypes: {
12
12
  workflow: ['workflows'],
13
13
  skill: ['skills']
@@ -35,7 +35,7 @@ const TARGETS = {
35
35
  cursor: {
36
36
  id: 'cursor',
37
37
  label: 'Cursor',
38
- rootAgentFile: false,
38
+ rootAgentFile: true,
39
39
  projectionTypes: {
40
40
  workflow: ['commands'],
41
41
  skill: ['skills']
@@ -49,7 +49,7 @@ const TARGETS = {
49
49
  claude: {
50
50
  id: 'claude',
51
51
  label: 'Claude',
52
- rootAgentFile: false,
52
+ rootAgentFile: true,
53
53
  projectionTypes: {
54
54
  workflow: ['commands'],
55
55
  skill: ['skills']
@@ -63,7 +63,7 @@ const TARGETS = {
63
63
  copilot: {
64
64
  id: 'copilot',
65
65
  label: 'GitHub Copilot',
66
- rootAgentFile: false,
66
+ rootAgentFile: true,
67
67
  projectionTypes: {
68
68
  workflow: ['prompts'],
69
69
  skill: ['skills']
@@ -77,7 +77,7 @@ const TARGETS = {
77
77
  codex: {
78
78
  id: 'codex',
79
79
  label: 'Codex (Preview)',
80
- rootAgentFile: false,
80
+ rootAgentFile: true,
81
81
  projectionTypes: {
82
82
  workflow: ['skills'],
83
83
  skill: ['skills']
@@ -87,10 +87,51 @@ const TARGETS = {
87
87
  },
88
88
  detect: ['.codex/skills/anws-system/SKILL.md']
89
89
  },
90
+ trae: {
91
+ id: 'trae',
92
+ label: 'Trae (Preview)',
93
+ rootAgentFile: true,
94
+ projectionTypes: {
95
+ workflow: ['skills'],
96
+ skill: ['skills']
97
+ },
98
+ projections: {
99
+ skills: '.trae/skills'
100
+ },
101
+ detect: ['.trae/skills/anws-system/SKILL.md']
102
+ },
103
+ qoder: {
104
+ id: 'qoder',
105
+ label: 'Qoder',
106
+ rootAgentFile: true,
107
+ projectionTypes: {
108
+ workflow: ['commands'],
109
+ skill: ['skills']
110
+ },
111
+ projections: {
112
+ commands: '.qoder/commands',
113
+ skills: '.qoder/skills'
114
+ },
115
+ detect: ['.qoder/commands/genesis.md']
116
+ },
117
+ kilo: {
118
+ id: 'kilo',
119
+ label: 'Kilo Code',
120
+ rootAgentFile: true,
121
+ projectionTypes: {
122
+ workflow: ['workflows'],
123
+ skill: ['skills']
124
+ },
125
+ projections: {
126
+ workflows: '.kilocode/workflows',
127
+ skills: '.kilocode/skills'
128
+ },
129
+ detect: ['.kilocode/workflows/genesis.md']
130
+ },
90
131
  opencode: {
91
132
  id: 'opencode',
92
133
  label: 'OpenCode',
93
- rootAgentFile: false,
134
+ rootAgentFile: true,
94
135
  projectionTypes: {
95
136
  workflow: ['commands'],
96
137
  skill: ['skills']
package/lib/init.js CHANGED
@@ -1,9 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  const path = require('node:path');
4
+ const fs = require('node:fs/promises');
4
5
  const { buildProjectionPlan } = require('./manifest');
5
6
  const { getTarget, listTargets } = require('./adapters');
6
- const { resolveAgentsInstall, printLegacyMigrationWarning, pathExists } = require('./agents');
7
+ const { planAgentsUpdate, resolveAgentsInstall, printLegacyMigrationWarning, pathExists } = require('./agents');
7
8
  const { ensureChangelogDir } = require('./changelog');
8
9
  const { ROOT_AGENTS_FILE, resolveCanonicalSource } = require('./resources');
9
10
  const { writeTargetFiles } = require('./copy');
@@ -35,9 +36,11 @@ async function init() {
35
36
  const skipped = [];
36
37
  const successfulTargets = [];
37
38
  const failedTargets = [];
39
+ const sessionWrittenFiles = new Set();
38
40
 
39
41
  for (const targetPlan of targetPlans) {
40
42
  const target = getTarget(targetPlan.targetId);
43
+ const rootAgentsExists = await pathExists(path.join(cwd, 'AGENTS.md'));
41
44
  const agentsDecision = target.id === 'antigravity'
42
45
  ? await resolveAgentsInstall({
43
46
  cwd,
@@ -45,11 +48,19 @@ async function init() {
45
48
  forceYes: !!global.__ANWS_FORCE_YES
46
49
  })
47
50
  : {
48
- shouldWriteRootAgents: false,
49
- shouldWarnMigration: false
51
+ shouldWriteRootAgents: true,
52
+ shouldWarnMigration: false,
53
+ rootExists: rootAgentsExists
50
54
  };
51
55
 
52
- const conflicting = await findConflicts(cwd, targetPlan.managedFiles);
56
+ let agentsUpdatePlan = null;
57
+ if (agentsDecision.shouldWriteRootAgents && agentsDecision.rootExists) {
58
+ const templateContent = await fs.readFile(srcAgents, 'utf8');
59
+ const existingContent = await fs.readFile(path.join(cwd, 'AGENTS.md'), 'utf8');
60
+ agentsUpdatePlan = planAgentsUpdate({ templateContent, existingContent });
61
+ }
62
+
63
+ const conflicting = await findConflicts(cwd, targetPlan.managedFiles, sessionWrittenFiles);
53
64
  if (conflicting.length > 0) {
54
65
  const confirmed = await askOverwrite(conflicting.length, target.label);
55
66
  if (!confirmed) {
@@ -68,10 +79,14 @@ async function init() {
68
79
  protectedFiles: targetPlan.userProtectedFiles,
69
80
  srcAgents,
70
81
  shouldWriteRootAgents: agentsDecision.shouldWriteRootAgents,
82
+ agentsUpdatePlan,
71
83
  resolveCanonicalSource
72
84
  });
73
85
 
74
86
  written.push(...result.written);
87
+ for (const rel of result.written) {
88
+ sessionWrittenFiles.add(rel);
89
+ }
75
90
  skipped.push(...result.skipped);
76
91
  successfulTargets.push(summarizeTargetState(targetPlan, cliVersion));
77
92
 
@@ -122,9 +137,12 @@ async function init() {
122
137
  * 找出 cwd 中已存在的托管文件列表。
123
138
  * @returns {Promise<string[]>} 已存在的托管文件相对路径数组
124
139
  */
125
- async function findConflicts(cwd, managedFiles) {
140
+ async function findConflicts(cwd, managedFiles, sessionWrittenFiles = new Set()) {
126
141
  const conflicts = [];
127
142
  for (const rel of managedFiles) {
143
+ if (sessionWrittenFiles.has(rel)) {
144
+ continue;
145
+ }
128
146
  const abs = path.join(cwd, rel);
129
147
  const exists = await pathExists(abs);
130
148
  if (exists) conflicts.push(rel);
@@ -236,4 +254,4 @@ function printTargetSummary(successfulTargets, failedTargets) {
236
254
  }
237
255
 
238
256
  module.exports = init;
239
-
257
+
@@ -166,16 +166,24 @@ async function detectInstallState(cwd) {
166
166
  const lockResult = await readInstallLock(cwd);
167
167
  const scannedTargets = await detectInstalledTargets(cwd);
168
168
  const lockTargets = lockResult.lock?.targets || [];
169
+ const needsFallback = !lockResult.exists || !!lockResult.error;
170
+ const fallbackReason = !needsFallback
171
+ ? null
172
+ : (!lockResult.exists ? 'missing_lock' : 'invalid_lock');
169
173
  const selectedTargets = lockTargets.length > 0
170
174
  ? lockTargets.map((item) => item.targetId)
171
175
  : scannedTargets.map((item) => item.id);
176
+ const drift = detectLockDrift(lockResult.lock, scannedTargets);
172
177
 
173
178
  return {
174
179
  lockResult,
175
180
  scannedTargets,
176
181
  selectedTargets,
177
- drift: detectLockDrift(lockResult.lock, scannedTargets),
178
- needsFallback: !lockResult.exists || !!lockResult.error
182
+ drift,
183
+ needsFallback,
184
+ fallbackReason,
185
+ stateSource: needsFallback ? 'directory_scan_fallback' : 'install_lock',
186
+ canRebuildLock: needsFallback && selectedTargets.length > 0
179
187
  };
180
188
  }
181
189
 
package/lib/manifest.js CHANGED
@@ -19,6 +19,7 @@ const RESOURCE_REGISTRY = [
19
19
  { id: 'probe', type: 'workflow', source: '.agents/workflows/probe.md', fileName: 'probe.md' },
20
20
  { id: 'quickstart', type: 'workflow', source: '.agents/workflows/quickstart.md', fileName: 'quickstart.md' },
21
21
  { id: 'upgrade', type: 'workflow', source: '.agents/workflows/upgrade.md', fileName: 'upgrade.md' },
22
+ { id: 'anws-system', type: 'skill', source: '.agents/skills/anws-system/SKILL.md', fileName: 'anws-system/SKILL.md', targets: ['codex', 'trae'] },
22
23
  { id: 'concept-modeler', type: 'skill', source: '.agents/skills/concept-modeler/SKILL.md', fileName: 'concept-modeler/SKILL.md' },
23
24
  { id: 'design-reviewer', type: 'skill', source: '.agents/skills/design-reviewer/SKILL.md', fileName: 'design-reviewer/SKILL.md' },
24
25
  { id: 'nexus-mapper', type: 'skill', source: '.agents/skills/nexus-mapper/SKILL.md', fileName: 'nexus-mapper/SKILL.md' },
@@ -53,10 +54,8 @@ function toArray(value) {
53
54
  }
54
55
 
55
56
  function toProjectionFileName(resource, projectionType, targetId) {
56
- if (targetId === 'codex' && projectionType === 'skills' && resource.type === 'workflow') {
57
- return resource.id === 'quickstart'
58
- ? 'anws-system/SKILL.md'
59
- : `anws-system/references/${resource.id}.md`;
57
+ if ((targetId === 'codex' || targetId === 'trae') && projectionType === 'skills' && resource.type === 'workflow') {
58
+ return `anws-system/references/${resource.id}.md`;
60
59
  }
61
60
  if (projectionType === 'commands') {
62
61
  return `${resource.id}.md`;
@@ -75,6 +74,9 @@ function buildProjectionEntries(targetId) {
75
74
  const typeMap = target.projectionTypes;
76
75
 
77
76
  return RESOURCE_REGISTRY.flatMap((resource) => {
77
+ if (resource.targets && !resource.targets.includes(target.id)) {
78
+ return [];
79
+ }
78
80
  const projectionTypes = typeMap[resource.type];
79
81
  if (!projectionTypes) {
80
82
  return [];
@@ -129,6 +131,9 @@ function buildProjectionPlan(targetIds = ['antigravity'], resources = RESOURCE_R
129
131
  const target = getTarget(targetId);
130
132
  const typeMap = target.projectionTypes;
131
133
  const projectionEntries = resources.flatMap((resource) => {
134
+ if (resource.targets && !resource.targets.includes(target.id)) {
135
+ return [];
136
+ }
132
137
  const projectionTypes = typeMap[resource.type];
133
138
  if (!projectionTypes) {
134
139
  return [];
package/lib/update.js CHANGED
@@ -128,6 +128,21 @@ async function update(options = {}) {
128
128
  logo();
129
129
  blank();
130
130
  }
131
+ printTargetSelection(installState, targetContexts.map((context) => context.target));
132
+ if (!check && installState.needsFallback && selectedTargetIds.length > 0) {
133
+ const generatedAt = new Date().toISOString();
134
+ await writeInstallLock(cwd, createInstallLock({
135
+ cliVersion: version,
136
+ generatedAt,
137
+ targets: dedupeTargets(targetPlans.map((targetPlan) => summarizeTargetState(targetPlan, version))),
138
+ lastUpdateSummary: {
139
+ successfulTargets: [],
140
+ failedTargets: [],
141
+ updatedAt: generatedAt
142
+ }
143
+ }));
144
+ info('Rebuilt .anws/install-lock.json from the detected target layout.');
145
+ }
131
146
  info(`Already up to date. Latest recorded version is v${versionState.latestVersion || version}.`);
132
147
  return;
133
148
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haaaiawd/anws",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "Anws — A spec-driven workflow framework for AI-assisted development. Empowers prompt engineers to build production-ready software through structured PRD → Architecture → Task decomposition. Works with Claude Code, GitHub Copilot, Cursor, Windsurf, and any tool that reads AGENTS.md.",
5
5
  "keywords": [
6
6
  "anws",
@@ -0,0 +1,106 @@
1
+ ---
2
+ name: anws-system
3
+ description: 当用户在 skills-only 环境中需要判断应该从哪个 anws 工作流开始,或需要在 forge / change / genesis / probe / blueprint / challenge / upgrade 之间路由时使用。它是 anws 工作流集合的导航入口。
4
+ ---
5
+
6
+ # ANWS System Router Manual
7
+
8
+ 你是 **ANWS Router**。
9
+
10
+ 你的职责不是直接替代所有工作流,而是作为 **skills-only 模式** 下的统一导航入口:
11
+
12
+ - 判断当前请求应路由到哪个工作流
13
+ - 告诉模型还需要读取哪个 `references/*.md`
14
+ - 在开始执行前明确权限边界,避免把 `/forge`、`/change`、`/genesis` 混用
15
+
16
+ ## 激活规则
17
+
18
+ 出现以下任一情况时使用本 Skill:
19
+
20
+ 1. 用户不知道该从哪个工作流开始
21
+ 2. 用户明确提到 `/quickstart`、`/forge`、`/change`、`/genesis` 等工作流,但当前环境只有 skills
22
+ 3. 用户请求涉及“下一步该走哪个流程”
23
+ 4. 用户请求跨越设计、任务、实现多个阶段,需要先判断阶段边界
24
+
25
+ ## 首次激活的强制步骤
26
+
27
+ 1. 先读取 `references/quickstart.md`
28
+ 2. 判断当前请求更接近哪一种场景
29
+ 3. 再按需读取对应 workflow reference
30
+ 4. 没有读完对应 reference 前,不得直接执行该 workflow 的写操作
31
+
32
+ ## Workflow Map
33
+
34
+ - `references/quickstart.md`
35
+ - 用途:总入口。用于判断项目目前处于哪一阶段,以及应先调用哪个工作流
36
+ - `references/probe.md`
37
+ - 用途:接手遗留项目、重大改动前做系统风险探测
38
+ - `references/genesis.md`
39
+ - 用途:新项目、重大重构、架构升级、需要新版本时使用
40
+ - `references/design-system.md`
41
+ - 用途:为单个系统补详细设计文档
42
+ - `references/blueprint.md`
43
+ - 用途:将架构设计拆成可执行的 `05_TASKS.md`
44
+ - `references/challenge.md`
45
+ - 用途:在编码前系统性挑战设计或任务清单
46
+ - `references/forge.md`
47
+ - 用途:按 `05_TASKS.md` 执行编码任务,并维护 Wave 进度
48
+ - `references/change.md`
49
+ - 用途:只微调已有任务定义,不创建新任务,不推进实现状态
50
+ - `references/explore.md`
51
+ - 用途:做调研、探索、方案发散与收敛
52
+ - `references/craft.md`
53
+ - 用途:创建新的 workflow、skill 或 prompt
54
+ - `references/upgrade.md`
55
+ - 用途:处理 `anws update` 之后的升级编排
56
+
57
+ ## 路由规则
58
+
59
+ ### Route 1: 不确定起点
60
+
61
+ 如果用户不知道从哪里开始,或你对当前阶段没有把握:
62
+
63
+ 1. 读取 `references/quickstart.md`
64
+ 2. 根据项目状态判断入口
65
+ 3. 给出建议 workflow,并说明理由
66
+ 4. 等待用户确认
67
+
68
+ ### Route 2: 请求是“开始编码 / 继续实现 / 做当前波次”
69
+
70
+ 1. 读取 `references/forge.md`
71
+ 2. 检查 `.anws/v{N}/05_TASKS.md` 是否存在且任务已定义
72
+ 3. 若缺任务清单,不得直接实现,先回到 `blueprint` 或 `genesis`
73
+
74
+ ### Route 3: 请求是“微调现有任务 / 修正文案 / 调整验收标准”
75
+
76
+ 1. 读取 `references/change.md`
77
+ 2. 确认只修改已有任务,不新增任务
78
+ 3. 若需要新增任务或超出 PRD,改走 `genesis`
79
+
80
+ ### Route 4: 请求是“新项目 / 大重构 / 新版本 / 架构升级”
81
+
82
+ 1. 读取 `references/genesis.md`
83
+ 2. 进入版本化架构流程
84
+
85
+ ### Route 5: 请求是“先调研 / 先探测风险”
86
+
87
+ - 遗留项目或重大变更前 → `references/probe.md`
88
+ - 技术调研或方案发散 → `references/explore.md`
89
+
90
+ ## 边界守则
91
+
92
+ 1. 你是导航层,不是所有 workflow 的替身
93
+ 2. 每次只路由到一个主 workflow;如需串联,必须说明顺序
94
+ 3. 未读取目标 workflow reference 前,不得假装已经遵循该流程
95
+ 4. 若用户请求同时跨越设计与实现,先收敛边界,再决定 `/change` 或 `/genesis`
96
+ 5. skills-only 模式下,workflow 详情全部位于 `references/`
97
+
98
+ ## 输出格式
99
+
100
+ 当你完成路由判断时,输出应包含:
101
+
102
+ - 当前判断的阶段
103
+ - 建议读取的 reference
104
+ - 建议进入的 workflow
105
+ - 为什么不是其他 workflow
106
+ - 是否需要等待用户确认
@@ -1,166 +1,179 @@
1
- ---
2
- name: sequential-thinking
3
- description: 当复杂问题需要系统性逐步推理时使用。适用于多阶段分析、设计规划、问题分解,或初始范围不明确且可能需要修正、分支与动态调整思考范围的任务。
4
- license: MIT
5
- ---
6
-
7
- # Sequential Thinking
8
-
9
- 通过可修正、可分支、可动态扩展的顺序推理,帮助 AI 处理复杂问题。
10
-
11
- ## Core Capabilities
12
-
13
- - **迭代推理**: 将复杂问题拆解为连续的 thought 步骤
14
- - **动态范围**: 随着理解深入调整 `totalThoughts`
15
- - **修正能力**: 当新证据出现时回看并修正早期判断
16
- - **分支探索**: 从关键分叉点探索替代路径
17
- - **上下文保持**: 在整个推理过程中维持清晰的思考链条
18
-
19
- ## When to Use
20
-
21
- 在以下场景使用:
22
- - 问题需要多个相互关联的推理步骤
23
- - 初始范围或方法不明确
24
- - 需要在复杂性中找到核心问题
25
- - 可能需要回溯或修正早期结论
26
- - 想探索替代方案路径
27
-
28
- **不适用场景**: 简单查询、直接事实、单步任务,或解决路径已经非常明确的问题。
29
-
30
- ## Basic Usage
31
-
32
- 按如下 JSON 形态组织思考步骤。
33
-
34
- ### Required Fields
35
-
36
- - `thought` (string): 当前推理内容
37
- - `nextThoughtNeeded` (boolean): 是否还需要继续推理
38
- - `thoughtNumber` (integer): 当前 thought 编号,从 `1` 开始
39
- - `totalThoughts` (integer): 当前预估总步数,可动态调整
40
-
41
- ### Optional Fields
42
-
43
- - `isRevision` (boolean): 标记当前 thought 是否在修正先前思路
44
- - `revisesThought` (integer): 指明修正的是哪一个 thought
45
- - `branchFromThought` (integer): 指明从哪一个 thought 开始分支
46
- - `branchId` (string): 当前分支标识符
47
-
48
- ## Workflow Pattern
49
-
50
- ```
51
- 1. 从 `thoughtNumber: 1` 开始。
52
- 2. 每一步:
53
- - 在 `thought` 中表达当前推理
54
- - 用 `totalThoughts` 估计整体范围,必要时调整
55
- - 若还需继续,设置 `nextThoughtNeeded: true`
56
- 3. 当结论已经足够清晰时,设置 `nextThoughtNeeded: false`
57
- ```
58
-
59
- ## Example 1: 基础推演 (Baseline Reasoning)
60
-
61
- ```typescript
62
- // First thought
63
- {
64
- thought: "问题表面上是“查询性能下降”,但先不要急着选优化手段。需要先把问题拆成三层:是单条 SQL 退化、接口级 N+1、还是更上层的调用放大。若根因没分清,后面的缓存、索引、重写都可能只是补丁。",
65
- thoughtNumber: 1,
66
- totalThoughts: 4,
67
- nextThoughtNeeded: true
68
- }
69
-
70
- // Second thought
71
- {
72
- thought: "从查询日志看,用户详情接口在一次请求里触发了大量重复读取,已经出现明显的 N+1 信号。但还不能直接下结论,因为重复查询也可能只是症状;需要继续确认慢点究竟来自“查询次数过多”,还是“某条关键查询本身很慢”。因此总步数上调一档。",
73
- thoughtNumber: 2,
74
- totalThoughts: 6,
75
- nextThoughtNeeded: true
76
- }
77
-
78
- // Final thought
79
- {
80
- thought: "结论可以收敛了:主因是列表页批量加载时触发的 N+1,次因是关联字段缺少索引放大了单次查询成本。优化顺序应该先消除 N+1,再补索引验证尾延迟;这样既先打掉主矛盾,也避免一上来引入缓存复杂度。",
81
- thoughtNumber: 6,
82
- totalThoughts: 6,
83
- nextThoughtNeeded: false
84
- }
85
- ```
86
-
87
- ## Example 2: 修正前提 (Revision in Flight)
88
-
89
- ```typescript
90
- {
91
- thought: "回看 profiling 结果后,前面的判断需要修正:真正拖垮接口的不是 N+1 本身,而是关联列缺少索引,导致每次关联查询都在放大全表扫描成本。也就是说,N+1 仍然存在,但它不是第一性瓶颈,优先级应该后移。",
92
- thoughtNumber: 4,
93
- totalThoughts: 6,
94
- isRevision: true,
95
- revisesThought: 2,
96
- nextThoughtNeeded: true
97
- }
98
- ```
99
-
100
- ## Example 3: 复杂变更拆解 (Structured Impact Analysis)
101
-
102
- ```typescript
103
- {
104
- thought: "用户一次性提出了多项规则修改,不该把它们当成同一种改动处理。先拆开看:有的是机制原则调整,有的是数值平衡,有的是接口语义变化,还有的是文档与实现脱节。如果不先分型,后面会把“该改 ADR 的”“该改设计文档的”“该补代码契约的”混成一锅。",
105
- thoughtNumber: 1,
106
- totalThoughts: 3,
107
- nextThoughtNeeded: true
108
- }
109
-
110
- {
111
- thought: "先做影响矩阵。机制原则类改动通常会回流到 ADR 和 System Design;数值平衡会影响规则表、配置与测试基线;接口语义变化最危险,因为它会悄悄破坏调用方的假设。这里最该警惕的不是改动数量,而是有没有改到“被多个模块默认依赖、但文档里没写清楚”的隐性契约。",
112
- thoughtNumber: 2,
113
- totalThoughts: 3,
114
- nextThoughtNeeded: true
115
- }
116
-
117
- {
118
- thought: "可以收敛了:先处理那些会改变系统边界或调用语义的项,再处理数值与体验层面的项。顺序上应优先修正文档与契约,再讨论平衡性;否则后续所有实现和评审都会建立在漂移的前提上。结论不是“先改最显眼的”,而是“先修最容易污染系统认知的”。",
119
- thoughtNumber: 3,
120
- totalThoughts: 3,
121
- nextThoughtNeeded: false
122
- }
123
- ```
124
-
125
- ## Example 4: 分支比较 (Branching Trade-offs)
126
-
127
- ```typescript
128
- // Branch A
129
- {
130
- thought: "方案 A:先引入缓存削峰。好处是见效快、对接口层侵入小,适合先止血;坏处是会把问题从“数据库慢”转成“缓存一致性与失效策略复杂”,如果根因其实是查询设计不合理,这条路容易把偶然复杂度永久留在系统里。",
131
- thoughtNumber: 3,
132
- totalThoughts: 7,
133
- branchFromThought: 2,
134
- branchId: "cache",
135
- nextThoughtNeeded: true
136
- }
137
-
138
- // Branch B
139
- {
140
- thought: "方案 B:直接做索引优化和查询重写。好处是从根上消除瓶颈,长期结构更干净;代价是需要更仔细验证写入放大、锁竞争和回归风险。这条路更慢,但如果业务模型稳定,通常比提前上缓存更符合简单优先的原则。",
141
- thoughtNumber: 3,
142
- totalThoughts: 7,
143
- branchFromThought: 2,
144
- branchId: "query",
145
- nextThoughtNeeded: true
146
- }
147
- ```
148
-
149
- ## Heuristic Reminders
150
-
151
- 以下提醒是**辅助思考的启发式问题**,不是硬约束。按任务性质选择性使用即可。
152
-
153
- - **问题定义提醒**: 你现在是在描述现象,还是在定位根因?
154
- - **证据提醒**: 当前判断基于事实、观察结果,还是基于猜测与假设?
155
- - **边界提醒**: 当前问题影响的是局部模块、单系统,还是跨系统结构?
156
- - **复杂度提醒**: 你是在消除本质复杂度,还是在增加偶然复杂度?
157
- - **收敛提醒**: 当前是否已经足够形成结论,还是仍在无效发散?
158
-
159
- ## Tips
160
-
161
- - 先给出粗略的 `totalThoughts`,随着理解深入再调整
162
- - 当早期假设被证伪时,优先修正,不要沿着错误前提继续推进
163
- - 当存在明确替代路径时,可以用分支并行比较
164
- - `thought` 中明确表达不确定性,比过早下结论更可靠
165
- - 最后一个 thought 应明确给出结论,必要时补充下一步行动
166
-
1
+ ---
2
+ name: sequential-thinking
3
+ description: 当复杂问题需要系统性逐步推理时使用。适用于多阶段分析、设计规划、问题分解,或初始范围不明确且需要受控收敛的任务。
4
+ license: MIT
5
+ ---
6
+
7
+ # Sequential Thinking
8
+
9
+ 这个 skill 的核心不是“多写几段 thought”,而是让 AI 在复杂问题里**持续推进、允许修正,并最终收敛成结论**。CLI 只是执行载体;skill 本身负责定义什么时候该进入这种思考方式,以及如何避免把顺序思考退化成松散输出。
10
+
11
+ ## Mission
12
+
13
+ 这个 skill 用来把复杂问题处理成一个**有边界、可修正、可复核的推理过程**:
14
+
15
+ - 先澄清问题,而不是急着给答案
16
+ - 在推进过程中允许修正和调整判断
17
+ - 在复杂度上升时比较替代路径,而不是单线硬推
18
+ - 在有限步数内收敛成结论与建议
19
+ - 最后保留可回放的推理轨迹
20
+
21
+ 它解决的不是“不会想”,而是“想得太散、太早下结论、太难复核”。
22
+
23
+ ## Core Capabilities
24
+
25
+ - **迭代推进**: 把复杂问题拆成连续步骤,而不是试图一口气得到完整答案
26
+ - **动态修正**: 当新证据出现时,允许回看并修正前面的判断
27
+ - **分支比较**: 当存在替代路径时,允许先比较再收敛
28
+ - **上下文保持**: 在多步推理中维持清晰的问题边界与目标
29
+ - **结论收束**: 最终必须形成判断,而不是无限发散
30
+
31
+ ## When to Use
32
+
33
+ 在以下场景调用:
34
+
35
+ - 问题需要多个相互关联的推理步骤
36
+ - 初始范围或方法不明确,需要先拆问题、再形成方法
37
+ - 需要在有限候选方案之间做比较,而不是无限发散
38
+ - 需要回看已有判断、识别漏洞、证据不足与隐含假设
39
+ - 需要留下可回放、可导出的推理轨迹
40
+
41
+ **不适用场景**:
42
+
43
+ - 简单事实查询
44
+ - 单步即可完成的任务
45
+ - 路径已经非常明确、无需多步推演的问题
46
+ - 纯头脑风暴且暂时不要求收敛的场景
47
+
48
+ ## Working Philosophy
49
+
50
+ - **先找主问题,再找答案**:不要把现象描述误当作根因定位
51
+ - **允许修正,而不是硬撑前提**:前面想错了,就回头修,不要带着错误前提继续推进
52
+ - **先消除复杂度,再堆解决方案**:优先识别主矛盾,而不是抢着给补丁
53
+ - **每一步只推进一步**:当前步只表达当前判断,不重复整套背景
54
+ - **最终必须落到结论**:不能把“我还能继续想”当作默认出口
55
+
56
+ ## Installation & Runtime Model
57
+
58
+ 这个 skill 面向 agent 交付思考方式与调用约束;CLI 通过 npm 分发。
59
+
60
+ 在使用前,应先确保本地已安装对应 CLI:
61
+
62
+ ```bash
63
+ npm install -g sequential-thinking-cli
64
+
65
+ #
66
+ pnpm add -g sequential-thinking-cli
67
+ ```
68
+
69
+ 安装后,使用 `sthink` 作为命令入口。
70
+
71
+ ## CLI Contract
72
+
73
+ skill 不再要求 AI 手写 thought JSON。执行层通过 CLI 主路径动作完成:
74
+
75
+ - `start`
76
+ - `step`
77
+ - `replay`
78
+
79
+ ### `start`
80
+
81
+ 只接受四个输入:
82
+
83
+ - `name`
84
+ - `goal`
85
+ - `mode`
86
+ - `totalSteps`
87
+
88
+ 约束:
89
+
90
+ - `mode` 仅允许 `explore`、`branch`、`audit`
91
+ - `totalSteps` 仅允许 `5` `8`
92
+
93
+ 如果你不确定该选哪种模式,默认用 `explore`。只有在任务明显是在比较候选路径时才用 `branch`;只有在任务明显是在审查既有判断时才用 `audit`。
94
+
95
+ ### `step`
96
+
97
+ 只接受:
98
+
99
+ - `content`
100
+
101
+ 其余上下文应由 runtime 自动恢复并注入。
102
+
103
+ ### `replay`
104
+
105
+ 用于读取已完成会话并生成 replay 文档;如需要,可额外导出到当前目录。
106
+
107
+ ## Recommended Workflow
108
+
109
+ ```text
110
+ 1. 先判断问题是否真的需要 sequential-thinking,而不是默认套用。
111
+ 2. 如需要,先安装或确认本地已有 npm CLI。
112
+ 3. 用 `sthink start` 给出 `name`、`goal`、`mode`、`totalSteps`。
113
+ 4. 用 `sthink step` 逐步推进,每一步只写当前推进内容。
114
+ 5. 当出现新证据时,允许修正,而不是硬撑旧判断。
115
+ 6. 到收敛阶段时,必须输出结论、风险与下一步建议。
116
+ 7. 完成后按需使用 `sthink replay` 生成与导出回放文档。
117
+ ```
118
+
119
+ ## Examples
120
+
121
+ 以下示例不是为了让你回去手写 JSON,而是为了说明这种 skill 真正有价值的地方:**如何推进、如何修正、如何收敛**。
122
+
123
+ ### Example 1: 基础推演
124
+
125
+ ```bash
126
+ sthink start --name "query-diagnosis" --goal "定位查询性能下降的主因" --mode explore --totalSteps 5
127
+ sthink step --sessionPath "<session-path>" --content "先不要急着选优化手段。需要先把问题拆成几层:是单条 SQL 退化、接口级 N+1,还是更上层的调用放大。若根因没分清,后面的缓存、索引、重写都可能只是补丁。"
128
+ sthink step --sessionPath "<session-path>" --content "从查询日志看,用户详情接口在一次请求里触发了大量重复读取,已经出现明显的 N+1 信号。但还不能直接下结论,因为重复查询也可能只是症状;需要继续确认慢点究竟来自“查询次数过多”,还是“某条关键查询本身很慢”。因此总步数上调一档。"
129
+ sthink step --sessionPath "<session-path>" --content "结论可以收敛了:主因是列表页批量加载时触发的 N+1,次因是关联字段缺少索引放大了单次查询成本。优化顺序应该先消除 N+1,再补索引验证尾延迟;这样既先打掉主矛盾,也避免一上来引入缓存复杂度。"
130
+ ```
131
+
132
+ ### Example 2: 修正前提
133
+
134
+ ```bash
135
+ sthink step --sessionPath "<session-path>" --content "回看 profiling 结果后,前面的判断需要修正:真正拖垮接口的不是 N+1 本身,而是关联列缺少索引,导致每次关联查询都在放大全表扫描成本。也就是说,N+1 仍然存在,但它不是第一性瓶颈,优先级应该后移。"
136
+ ```
137
+
138
+ ### Example 3: 复杂变更拆解
139
+
140
+ ```bash
141
+ sthink start --name "change-impact-analysis" --goal "拆解复杂变更的影响与优先级" --mode explore --totalSteps 5
142
+ sthink step --sessionPath "<session-path>" --content "用户一次性提出了多项规则修改,不该把它们当成同一种改动处理。先拆开看:有的是机制原则调整,有的是数值平衡,有的是接口语义变化,还有的是文档与实现脱节。如果不先分型,后面会把“该改 ADR 的”“该改设计文档的”“该补代码契约的”混成一锅。"
143
+ sthink step --sessionPath "<session-path>" --content "先做影响矩阵。机制原则类改动通常会回流到 ADR 和 System Design;数值平衡会影响规则表、配置与测试基线;接口语义变化最危险,因为它会悄悄破坏调用方的假设。这里最该警惕的不是改动数量,而是有没有改到“被多个模块默认依赖、但文档里没写清楚”的隐性契约。"
144
+ sthink step --sessionPath "<session-path>" --content "可以收敛了:先处理那些会改变系统边界或调用语义的项,再处理数值与体验层面的项。顺序上应优先修正文档与契约,再讨论平衡性;否则后续所有实现和评审都会建立在漂移的前提上。结论不是“先改最显眼的”,而是“先修最容易污染系统认知的”。"
145
+ ```
146
+
147
+ ### Example 4: 分支比较
148
+
149
+ ```bash
150
+ sthink start --name "performance-tradeoff" --goal "比较缓存止血与查询优化的优先级" --mode branch --totalSteps 5
151
+ sthink step --sessionPath "<session-path>" --content "方案 A:先引入缓存削峰。好处是见效快、对接口层侵入小,适合先止血;坏处是会把问题从“数据库慢”转成“缓存一致性与失效策略复杂”,如果根因其实是查询设计不合理,这条路容易把偶然复杂度永久留在系统里。与此同时,方案 B:直接做索引优化和查询重写。好处是从根上消除瓶颈,长期结构更干净;代价是需要更仔细验证写入放大、锁竞争和回归风险。这条路更慢,但如果业务模型稳定,通常比提前上缓存更符合简单优先的原则。"
152
+ ```
153
+
154
+ ## Storage & Export Boundary
155
+
156
+ - runtime 会自动保存会话状态与步骤记录
157
+ - 完成态可生成 replay 文档
158
+ - `replay` 支持导出到当前目录,便于审阅与复用
159
+
160
+ ## Heuristic Reminders
161
+
162
+ 以下提醒是启发式问题,不是硬约束。真正重要的是:它们能帮助你减少空转,逼近结论。
163
+
164
+ - **问题定义提醒**: 你现在是在描述现象,还是在定位根因?
165
+ - **证据提醒**: 当前判断基于事实、观察结果,还是基于猜测与假设?
166
+ - **边界提醒**: 当前问题影响的是局部模块、单系统,还是跨系统结构?
167
+ - **复杂度提醒**: 你是在消除本质复杂度,还是在增加偶然复杂度?
168
+ - **收敛提醒**: 当前是否已经足够形成结论,还是仍在无效发散?
169
+
170
+ ## Tips
171
+
172
+ - 不要再手写 thought JSON;让 CLI runtime 负责节奏、落盘与 replay
173
+ - 不要把 sequential-thinking 当成默认模式,只在真正需要多步收敛时调用
174
+ - 如果不确定模式,先用 `explore`
175
+ - `step` 的 `content` 只表达当前推进内容,不要重复补全系统上下文
176
+ - 如果发现前提错了,就明确修正,不要硬撑
177
+ - 到收敛阶段时,应明确输出结论、风险和下一步动作
178
+ - 只有已完成会话才能执行 `replay`
179
+
@@ -15,6 +15,7 @@ description: "处理微调级变更请求,仅允许修改已有任务的细节
15
15
  - **忠于 Blueprint** - 所有修改必须在 `01_PRD.md` 已定义的需求范围内
16
16
  - **人类审批** - 所有写操作必须先展示计划,经人类确认后才能执行
17
17
  - **可追溯** - 所有变更都记录在 CHANGELOG
18
+ - **不维护完成状态** - `/change` 只修改任务定义,不负责回填 `05_TASKS.md` checkbox
18
19
 
19
20
  **Output Goal**:
20
21
  - 更新 `.anws/v{N}/05_TASKS.md` (仅修改已有任务)
@@ -35,6 +36,8 @@ description: "处理微调级变更请求,仅允许修改已有任务的细节
35
36
  > | 调整已有任务的估时 | ✅ | |
36
37
  > | 标记任务阻塞/重分优先级 | ✅ | |
37
38
  > | 微调 `04_SYSTEM_DESIGN/` 中已有文件的细节 | ✅ | |
39
+ > | 更新任务说明字段,但不改变完成状态 | ✅ | |
40
+ > | **回填 `05_TASKS.md` checkbox** | | ❌ |
38
41
  > | **创建新任务 (T{X}.{Y}.{Z})** | | ❌ |
39
42
  > | **创建新文件** | | ❌ |
40
43
  > | **添加 AI 自认为好的功能** | | ❌ |
@@ -43,8 +46,6 @@ description: "处理微调级变更请求,仅允许修改已有任务的细节
43
46
  > | **修改 `02_ARCHITECTURE_OVERVIEW.md`** | | ❌ |
44
47
  > | **修改 `03_ADR/` 中的任何文件** | | ❌ |
45
48
  >
46
- > **单次 /change 最多影响 3 个已有任务 + 对应的设计文件微调。**
47
- >
48
49
  > **违反以上任何一条 → 变更无效,引导用户运行 `/genesis`。**
49
50
 
50
51
  ---
@@ -158,8 +159,8 @@ description: "处理微调级变更请求,仅允许修改已有任务的细节
158
159
 
159
160
  3. **定位任务**:
160
161
  - 找到与变更相关的已有任务 (如 `T2.1.3`)
161
- - **最多 3 个任务**受影响
162
- - 如果超过 3 个 → 跳转 Step 4
162
+ - 记录所有实际受影响的已有任务
163
+ - 如果需要创建新任务才能承接变更 → 跳转 Step 4
163
164
 
164
165
  4. **定位相关设计文件** (如需要):
165
166
  - 检查 `{TARGET_DIR}/04_SYSTEM_DESIGN/` 中是否有对应的系统设计文件
@@ -230,7 +231,9 @@ description: "处理微调级变更请求,仅允许修改已有任务的细节
230
231
  ### Step 3.1: 执行修改 (仅在人类批准后)
231
232
 
232
233
  1. **修改任务清单**:
233
- 使用 `replace_file_content` 修改 `{TARGET_DIR}/05_TASKS.md` 中的对应任务
234
+ 使用 `replace_file_content` 修改 `{TARGET_DIR}/05_TASKS.md` 中的对应任务定义
235
+ - 仅允许修改任务描述、验收标准、估时、优先级、阻塞说明等定义字段
236
+ - **禁止**在 `/change` 中将 `- [ ]` 改为 `- [x]` 或反向修改 checkbox
234
237
 
235
238
  2. **记录变更日志**:
236
239
  读取并追加到 `{TARGET_DIR}/06_CHANGELOG.md`:
@@ -225,6 +225,15 @@ T{X.Y.Z}, T{X.Y.Z}, T{X.Y.Z}
225
225
  读取该任务 `**输入**` 字段指定的文档和章节。
226
226
  如果任务依赖已完成的前置任务,浏览相关已有代码了解接口。
227
227
 
228
+ > [!IMPORTANT]
229
+ > **开始写代码前,必须对本波次每个任务都完成一次依赖读取。**
230
+ >
231
+ > - 至少读取该任务 `**输入**` 字段指定的文档/章节
232
+ > - 如任务依赖其他任务,补读前置任务相关接口或实现代码
233
+ > - 未完成该任务的依赖读取,不得开始该任务编码
234
+ >
235
+ > **为什么?** `/forge` 允许按本波次批量推进和批量回填 checkbox,但前提是每个任务都已完成最小上下文装载,不能只看标题就动手。
236
+
228
237
  ---
229
238
 
230
239
  ### 3.2 Think Before Code (编码前思考)
@@ -331,7 +340,10 @@ T{X.Y.Z}, T{X.Y.Z}, T{X.Y.Z}
331
340
  > 下次加载 TASKS.md 就能看到精确进度。
332
341
  > 配合 AGENTS.md 的 Wave 块形成**双层恢复机制**: 粗粒度(Wave) + 细粒度(Task checkbox)。
333
342
 
334
- - 将该任务的 `- [ ]` 改为 `- [x]`
343
+ - 本波次允许批量回填已全部验证通过的任务 checkbox
344
+ - 仅按 **Task ID** 精确定位并更新状态,禁止按标题模糊匹配
345
+ - 将对应任务的 `- [ ]` 改为 `- [x]`
346
+ - 不得顺手修改未完成、未验证或不在当前波次内的任务
335
347
  - 确保回写后的 `05_TASKS.md` 与实际进度一致
336
348
 
337
349
  3. **继续下一个任务** → 回到 3.1