Skip to content

Commit 39f5216

Browse files
Bill-Billionclaude
andcommitted
fix: address Q2 and Q6 from PR #265 review
Q2: Replace stage labels ("阶段一:工具管线 | 第 1/4 章") with simple chapter numbering ("第 1/19 章") — beginner-friendly, no unexplained jargon Q6: Add inline footnotes to s02 CC deep dive for forward references - TaskCreate → "(TaskCreate 在 s12 介绍)" - PreToolUse hooks → "(s04 详细介绍)" - Zod schema → "(教学版用 JSON Schema 替代)" - FileRead Infinity → expanded circular loop explanation Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent b6ab4ec commit 39f5216

19 files changed

Lines changed: 24 additions & 24 deletions

File tree

s01_agent_loop/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
`s01` → s02 → s03 → s04 → ... → s19
66

7-
> 阶段一:工具管线 | 第 1/4
7+
> 第 1/19
88
99
---
1010

s02_tool_use/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
s01 → `s02`[s03](../s03_permission/) → s04 → ... → s19
66

7-
> 阶段一:工具管线 | 第 2/4
7+
> 第 2/19
88
99
---
1010

@@ -209,7 +209,7 @@ s03 Permission → 在工具执行之前加一道门:这个操作安全吗?
209209
| Glob | true | true |
210210
| Bash `ls` | true | **true** ← 关键差异 |
211211
| Bash `rm` | false | false |
212-
| TaskCreate | false | **true** ← 改状态但可并发 |
212+
| TaskCreate | false | **true** ← 改状态但可并发(TaskCreate 在 s12 介绍) |
213213

214214
CC 的 Bash tool 的 `isConcurrencySafe` 等于 `isReadOnly`——只读命令可并发,写命令不可。TaskCreate 虽然改了任务文件,但每次都写不同的文件,所以可以并发。教学版用工具名硬编码分组,丢了 Bash 的输入相关性,但保留了核心概念。
215215

@@ -230,10 +230,10 @@ CC 的 `partitionToolCalls()`(`toolOrchestration.ts:91`)不是分两组,
230230

231231
CC 的每个工具调用经过严格的 5 步验证(`toolExecution.ts:599`):
232232

233-
1. **Zod schema 验证**:参数类型/结构检查
233+
1. **Zod schema 验证**(教学版用 JSON Schema 替代):参数类型/结构检查
234234
2. **工具级 validateInput()**:参数值验证(如路径是否在工作区内)
235-
3. **PreToolUse hooks**:钩子可以返回消息、修改输入、阻止执行
236-
4. **权限检查**:canUseTool + checkPermissions → allow/deny/ask
235+
3. **PreToolUse hooks**(s04 详细介绍):钩子可以返回消息、修改输入、阻止执行
236+
4. **权限检查**(s03 的核心内容):canUseTool + checkPermissions → allow/deny/ask
237237
5. **执行 tool.call()**
238238

239239
教学版省略了 Zod(用 JSON Schema)、省略了 validateInput(用安全函数)、保留了权限检查和钩子概念。
@@ -244,7 +244,7 @@ CC 的 `StreamingToolExecutor`(`StreamingToolExecutor.ts`)让工具在模型
244244

245245
### 六、工具结果持久化
246246

247-
每个工具有一个 `maxResultSizeChars` 字段。结果超过这个值就落盘,模型看到的是预览 + 文件路径。FileRead 特殊——设为 `Infinity`,防止读文件的输出又被当成文件落盘无限循环)。
247+
每个工具有一个 `maxResultSizeChars` 字段。结果超过这个值就落盘,模型看到的是预览 + 文件路径。FileRead 特殊——设为 `Infinity`,防止读文件的输出又被当成文件落盘。具体来说,如果 FileRead 的结果超过阈值被落盘,模型下次读那个落盘文件时又会触发落盘 → 无限循环(读文件 → 落盘 → 再读 → 再落盘 → ...)。
248248

249249
</details>
250250

s03_permission/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
s01 → s02 → `s03`[s04](../s04_hooks/) → s05 → ... → s19
66

7-
> 阶段一:工具管线 | 第 3/4
7+
> 第 3/19
88
99
---
1010

s04_hooks/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
s01 → s02 → s03 → `s04`[s05](../s05_todo_write/) → s06 → ... → s19
66

7-
> 阶段一:工具管线 | 第 4/4
7+
> 第 4/19
88
99
---
1010

s05_todo_write/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
s01 → s02 → s03 → s04 → `s05`[s06](../s06_subagent/) → s07 → ... → s19
66

7-
> 阶段二:单 Agent 能力 | 第 1/4
7+
> 第 5/19
88
99
---
1010

s06_subagent/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
s01 → s02 → s03 → s04 → s05 → `s06`[s07](../s07_skill_loading/) → s08 → ... → s19
66

7-
> 阶段二:单 Agent 能力 | 第 2/4
7+
> 第 6/19
88
99
---
1010

s07_skill_loading/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
s01 → s02 → s03 → s04 → s05 → s06 → `s07`[s08](../s08_context_compact/) → s09 → ... → s19
66

7-
> 阶段二:单 Agent 能力 | 第 3/4
7+
> 第 7/19
88
99
---
1010

s08_context_compact/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
s01 → s02 → s03 → s04 → s05 → s06 → s07 → `s08`[s09](../s09_memory/) → s10 → ... → s19
66

7-
> 阶段二:单 Agent 能力 | 第 4/4
7+
> 第 8/19
88
99
---
1010

s09_memory/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
s01 → ... → s07 → s08 → `s09`[s10](../s10_system_prompt/) → s11 → ... → s19
66

7-
> 阶段三:知识与韧性 | 第 1/3
7+
> 第 9/19
88
99
---
1010

s10_system_prompt/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
s01 → ... → s08 → s09 → `s10`[s11](../s11_error_recovery/) → s12 → ... → s19
66

7-
> 阶段三:知识与韧性 | 第 2/3
7+
> 第 10/19
88
99
---
1010

0 commit comments

Comments
 (0)