@haaaiawd/anws 2.0.0 → 2.0.1
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 +37 -17
- package/lib/adapters/index.js +6 -6
- package/lib/init.js +11 -4
- package/package.json +1 -1
- package/templates/.agents/skills/sequential-thinking/SKILL.md +179 -166
package/README.md
CHANGED
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
|
|
15
15
|
# Anws
|
|
16
16
|
|
|
17
|
-
**Anws** is a spec-driven workflow framework for AI-assisted
|
|
17
|
+
**Anws** is a spec-driven workflow framework for AI-assisted development across modern AI IDEs and coding tools.
|
|
18
18
|
|
|
19
|
-
It
|
|
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
|
-
|
|
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**:
|
|
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
|
|
|
@@ -171,16 +171,25 @@ If you maintain old docs or release notes, update those references before publis
|
|
|
171
171
|
## Compatibility
|
|
172
172
|
|
|
173
173
|
Anws keeps a **single canonical workflow / skill source**, then projects it into the native directory structure expected by each tool.
|
|
174
|
+
Every supported target now receives:
|
|
175
|
+
|
|
176
|
+
- a root `AGENTS.md`
|
|
177
|
+
- a target-native `skills/` projection
|
|
178
|
+
- one target-native workflow entry surface, depending on the tool:
|
|
179
|
+
- `workflows`
|
|
180
|
+
- `commands`
|
|
181
|
+
- `prompts`
|
|
182
|
+
- aggregated `skills` for Codex Preview
|
|
174
183
|
|
|
175
184
|
| Environment | Status | Layout |
|
|
176
185
|
| --- | --- | --- |
|
|
177
|
-
| **Windsurf** | ✅ Full Support | `.windsurf/workflows/` + `.windsurf/skills/` |
|
|
186
|
+
| **Windsurf** | ✅ Full Support | `AGENTS.md` + `.windsurf/workflows/` + `.windsurf/skills/` |
|
|
178
187
|
| **Antigravity** | ✅ Full Support | `.agents/workflows/` + `.agents/skills/` + `AGENTS.md` |
|
|
179
|
-
| **Claude Code** | ✅ Full Support | `.claude/commands/` |
|
|
180
|
-
| **GitHub Copilot** | ✅ Full Support | `.github/
|
|
181
|
-
| **Cursor** | ✅ Supported | `.cursor/commands/` |
|
|
182
|
-
| **Codex** | ⚠️ Preview | `.codex/skills/anws-system/` + `.codex/skills/<skill>/` |
|
|
183
|
-
| **OpenCode** | ✅ Supported | `.opencode/commands/` + `.opencode/skills/` |
|
|
188
|
+
| **Claude Code** | ✅ Full Support | `AGENTS.md` + `.claude/commands/` + `.claude/skills/` |
|
|
189
|
+
| **GitHub Copilot** | ✅ Full Support | `AGENTS.md` + `.github/prompts/` + `.github/skills/` |
|
|
190
|
+
| **Cursor** | ✅ Supported | `AGENTS.md` + `.cursor/commands/` + `.cursor/skills/` |
|
|
191
|
+
| **Codex** | ⚠️ Preview | `AGENTS.md` + `.codex/skills/anws-system/` + `.codex/skills/<skill>/` |
|
|
192
|
+
| **OpenCode** | ✅ Supported | `AGENTS.md` + `.opencode/commands/` + `.opencode/skills/` |
|
|
184
193
|
|
|
185
194
|
---
|
|
186
195
|
|
|
@@ -234,21 +243,32 @@ your-project/
|
|
|
234
243
|
│ ├── install-lock.json
|
|
235
244
|
│ ├── changelog/
|
|
236
245
|
│ └── v{N}/
|
|
246
|
+
├── AGENTS.md
|
|
237
247
|
├── .windsurf/
|
|
238
248
|
│ ├── workflows/
|
|
239
249
|
│ └── skills/
|
|
240
250
|
├── .agents/
|
|
241
251
|
│ ├── workflows/
|
|
242
252
|
│ └── skills/
|
|
243
|
-
├──
|
|
244
|
-
├──
|
|
245
|
-
|
|
253
|
+
├── .cursor/
|
|
254
|
+
│ ├── commands/
|
|
255
|
+
│ └── skills/
|
|
256
|
+
├── .claude/
|
|
257
|
+
│ ├── commands/
|
|
258
|
+
│ └── skills/
|
|
246
259
|
├── .github/
|
|
247
|
-
│ ├──
|
|
248
|
-
│ └──
|
|
260
|
+
│ ├── prompts/
|
|
261
|
+
│ └── skills/
|
|
262
|
+
├── .opencode/
|
|
263
|
+
│ ├── commands/
|
|
264
|
+
│ └── skills/
|
|
249
265
|
└── .codex/
|
|
250
|
-
├──
|
|
251
|
-
|
|
266
|
+
├── skills/
|
|
267
|
+
│ ├── anws-system/
|
|
268
|
+
│ │ ├── SKILL.md
|
|
269
|
+
│ │ └── references/
|
|
270
|
+
│ └── <skill>/
|
|
271
|
+
│ └── SKILL.md
|
|
252
272
|
```
|
|
253
273
|
|
|
254
274
|
> One source model. Multiple target layouts. Explicit ownership on disk.
|
package/lib/adapters/index.js
CHANGED
|
@@ -7,7 +7,7 @@ const TARGETS = {
|
|
|
7
7
|
windsurf: {
|
|
8
8
|
id: 'windsurf',
|
|
9
9
|
label: 'Windsurf',
|
|
10
|
-
rootAgentFile:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
80
|
+
rootAgentFile: true,
|
|
81
81
|
projectionTypes: {
|
|
82
82
|
workflow: ['skills'],
|
|
83
83
|
skill: ['skills']
|
|
@@ -90,7 +90,7 @@ const TARGETS = {
|
|
|
90
90
|
opencode: {
|
|
91
91
|
id: 'opencode',
|
|
92
92
|
label: 'OpenCode',
|
|
93
|
-
rootAgentFile:
|
|
93
|
+
rootAgentFile: true,
|
|
94
94
|
projectionTypes: {
|
|
95
95
|
workflow: ['commands'],
|
|
96
96
|
skill: ['skills']
|
package/lib/init.js
CHANGED
|
@@ -35,6 +35,7 @@ async function init() {
|
|
|
35
35
|
const skipped = [];
|
|
36
36
|
const successfulTargets = [];
|
|
37
37
|
const failedTargets = [];
|
|
38
|
+
const sessionWrittenFiles = new Set();
|
|
38
39
|
|
|
39
40
|
for (const targetPlan of targetPlans) {
|
|
40
41
|
const target = getTarget(targetPlan.targetId);
|
|
@@ -45,11 +46,11 @@ async function init() {
|
|
|
45
46
|
forceYes: !!global.__ANWS_FORCE_YES
|
|
46
47
|
})
|
|
47
48
|
: {
|
|
48
|
-
shouldWriteRootAgents:
|
|
49
|
+
shouldWriteRootAgents: true,
|
|
49
50
|
shouldWarnMigration: false
|
|
50
51
|
};
|
|
51
52
|
|
|
52
|
-
const conflicting = await findConflicts(cwd, targetPlan.managedFiles);
|
|
53
|
+
const conflicting = await findConflicts(cwd, targetPlan.managedFiles, sessionWrittenFiles);
|
|
53
54
|
if (conflicting.length > 0) {
|
|
54
55
|
const confirmed = await askOverwrite(conflicting.length, target.label);
|
|
55
56
|
if (!confirmed) {
|
|
@@ -72,6 +73,9 @@ async function init() {
|
|
|
72
73
|
});
|
|
73
74
|
|
|
74
75
|
written.push(...result.written);
|
|
76
|
+
for (const rel of result.written) {
|
|
77
|
+
sessionWrittenFiles.add(rel);
|
|
78
|
+
}
|
|
75
79
|
skipped.push(...result.skipped);
|
|
76
80
|
successfulTargets.push(summarizeTargetState(targetPlan, cliVersion));
|
|
77
81
|
|
|
@@ -122,9 +126,12 @@ async function init() {
|
|
|
122
126
|
* 找出 cwd 中已存在的托管文件列表。
|
|
123
127
|
* @returns {Promise<string[]>} 已存在的托管文件相对路径数组
|
|
124
128
|
*/
|
|
125
|
-
async function findConflicts(cwd, managedFiles) {
|
|
129
|
+
async function findConflicts(cwd, managedFiles, sessionWrittenFiles = new Set()) {
|
|
126
130
|
const conflicts = [];
|
|
127
131
|
for (const rel of managedFiles) {
|
|
132
|
+
if (sessionWrittenFiles.has(rel)) {
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
128
135
|
const abs = path.join(cwd, rel);
|
|
129
136
|
const exists = await pathExists(abs);
|
|
130
137
|
if (exists) conflicts.push(rel);
|
|
@@ -236,4 +243,4 @@ function printTargetSummary(successfulTargets, failedTargets) {
|
|
|
236
243
|
}
|
|
237
244
|
|
|
238
245
|
module.exports = init;
|
|
239
|
-
|
|
246
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haaaiawd/anws",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
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",
|
|
@@ -1,166 +1,179 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: sequential-thinking
|
|
3
|
-
description:
|
|
4
|
-
license: MIT
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Sequential Thinking
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
##
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
-
|
|
157
|
-
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
-
|
|
165
|
-
-
|
|
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
|
+
|