🤖 AI Batch Analysis
## 文档变更分析
### 1. 总体概要
本次更新澄清了 Stop Hook 连续续接上限的计数规则(工具调用会重置计数),并大幅补充了 MCP 工具输出的多层限制机制细节——包括字符数阈值、错误结果截断策略以及后台任务的差异处理。
### 2. 关键主题
- **Stop Hook 续接上限重置逻辑**:8 次连续续接上限并非绝对 8 次,而是"中间无工具调用"的连续次数;Claude 每调用一次工具,计数归零
- **MCP 输出存在双重阈值**:除了已知的 token 限制(`MAX_MCP_OUTPUT_TOKENS`,默认 25,000),还有一个 50,000 字符的硬阈值——超过即写入文件,不受 token 变量影响
- **MCP 错误结果截断规则**:`isError: true` 的结果文本超过约 11,000 字符时,仅保留前 5,000 + 后 5,000 字符,中间标记省略量
- **后台 vs 前台调用差异**:被自动移至后台的 MCP 调用通过任务通知回报结果,不受前台的两项额外限制约束
- **版本引用清理**:移除了 MCP 认证启动提示的 `v2.1.193` 最低版本要求
### 3. 影响级别:**Medium**
- 非破坏性变更,主要是行为澄清和未文档化行为的补充说明
- Stop Hook 的重置逻辑变更可能影响依赖"绝对 8 次"假设的 hook 脚本行为——实际行为更宽松了(工具调用会重置计数),但开发者如果之前不知此规则可能写了冗余的防护逻辑
- MCP 的 50,000 字符阈值和错误截断是全新披露的行为,直接影响 MCP 服务器开发者对大输出的处理策略
### 4. 开发者行动项
- **审查 Stop Hook 脚本**:如果你的 hook 依赖"最多续接 8 次"的硬性假设,需注意工具调用会重置计数,实际可续接轮次可能远超 8 次
- **MCP 服务器开发者:评估 50,000 字符阈值**:成功文本结果超 50,000 字符会被持久化到磁盘并以文件引用替代——若需在对话中保留完整内容,通过 `_meta["anthropic/maxResultSizeChars"]` 上调(上限 500,000)
- **处理错误结果截断**:`isError: true` 的返回值超过 ~11,000 字符会被截断为头尾各 5,000 字符——确保关键诊断信息放在错误消息的首尾而非中间
- **区分 `MAX_MCP_OUTPUT_TOKENS` 与字符阈值**:两者独立运作,调整 token 限制不会改变 50,000 字符的写盘阈值
💭 Model Reasoning
Let me analyze the documentation changes across the three pages.
**hooks.md**: Clarifies that the 8-consecutive-continuation cap for Stop hooks resets each time Claude calls a tool. This is a significant behavioral detail - previously it was ambiguous whether "8 consecutive" meant 8 total or 8 without any tool call in between.
**hooks-guide.md**: Corresponding change - clarifies "8 times in a row without progress" to "8 times in a row with no tool call from Claude in between". This is the same conceptual change, just explained in the guide.
**mcp.md**: Several changes:
1. MCP output limits: clarifies that successful text results longer than 50,000 characters are saved to a file regardless of `MAX_MCP_OUTPUT_TOKENS` setting (unless the server raises the tool's own limit via `anthropic/maxResultSizeChars`)
2. Removes version reference (v2.1.193) for the startup notice feature
3. Adds detail about character limit (50,000 chars) for text results as a separate threshold from token limit
4. Adds detail about error results: error text > ~11,000 chars gets truncated to first 5,000 + last 5,000 chars
5. Clarifies that the default persist-to-disk threshold is 50,000 characters (was implicit before)
6. Clarifies distinction between background task results and foreground results regarding these limits
Key themes:
- Stop hook continuation cap reset behavior clarification
- MCP output handling: character limits vs token limits, error truncation, background vs foreground
Impact: Medium - these are behavioral clarifications that could affect how developers write stop hooks and MCP servers. The 50,000 character threshold and error truncation behavior are important details that were previously undocumented or unclear.
Action items:
- If using Stop hooks that continue turns, be aware that tool calls reset the continuation counter
- When building MCP servers, know the 50,000 char persist-to-disk threshold is independent of `MAX_MCP_OUTPUT_TOKENS`
- Handle the fact that error results get truncated at ~11,000 characters
- Use `anthropic/maxResultSizeChars` to raise the per-tool character limit if needed
- Be aware background task results have different limit handling