← All reports

Changes on 2026-10-21

163 total changes in 5 runs

20:21 EST

🤖 AI Batch Analysis

# 文档变更批量分析 ## 1. 总体概述 本次更新涵盖 SDK 版本全面升级、Claude Code 沙箱与 Hook 机制的重要增强、Ruby SDK 示例迁移到模型常量引用,以及云会话中项目设置作用域的精确化修正。 ## 2. 关键主题 - **SDK 全面版本升级**:所有 8 个 SDK(Python 2.1.0、TypeScript 1.1.0、Java 3.1.0、Go 2.1.0、C# 13.1.0、Ruby 2.1.0、PHP 1.1.0、ant CLI 2.1.0)同步升级 - **Ruby 模型常量化**:所有 Ruby 示例从硬编码字符串(如 `"claude-opus-5-5"`)改为 `Anthropic::Model::CLAUDE_OPUS_5_5` 常量 - **Skill Hook 限制机制**:新增每个来源最多 1,024 个 Hook、16,384 字符 matcher 总限制;新增 `strictPluginOnlyCustomization` 企业锁定场景及排查指南 - **沙箱 Linux 嵌套命名空间**:新增 `allowNestedUserNamespaces` 设置,解决 Chromium/rootless Podman 在 Linux 沙箱中失败的问题,附带安全警告 - **云会话作用域修正**:多处将"outside a project"改为"outside a project's threads",精确界定项目设置何时生效 - **新增 `api-version` 技能**:用于自动升级代码到新版 API 版本(v2.1.307+) - **Hook 输出格式变更**:`PreToolUse` Hook 响应中移除了 `permissionDecision: "allow"` 字段 - **测试过滤正则加固**:costs.md 中的测试过滤模式改为更严格的正则,防止命令注入 ## 3. 影响等级:**Medium** - Hook 输出格式移除 `permissionDecision` 是**行为变更**,依赖该字段的自定义 Hook 需要适配 - `allowNestedUserNamespaces` 带来安全警示,沙箱隔离可能被突破 - Skill Hook 限制(1,024/16,384)可能影响重度使用 Hook 的项目 - SDK 升级和 Ruby 常量迁移属于渐进式改进,破坏性较低 ## 4. 开发者行动项 - **检查自定义 Hook**:若 `PreToolUse` Hook 输出依赖 `permissionDecision` 字段,需移除该字段(参考 costs.md 中的新格式) - **升级 SDK**:将项目中的 Anthropic SDK 升级到最新版本以获取新功能与修复 - **Ruby 项目迁移**:将硬编码模型字符串替换为 `Anthropic::Model::*` 常量,避免拼写错误并提升类型安全 - **评估沙箱兼容性**:若在 Linux/WSL2 沙箱中运行 Chromium 或 rootless Podman,配置 `allowNestedUserNamespaces` 或 `excludedCommands`,但需注意安全提示 - **审查 Skill Hook 用量**:若项目 Hook 数量接近 1,024 上限,需精简 Hook 声明或缩短 matcher 模式
💭 Model Reasoning
Let me analyze the 44 pages of documentation changes and summarize the key themes and impacts. The changes span several areas: 1. **SDK version bumps**: All SDK versions bumped (Python 2.0→2.1, TypeScript 1.0→1.1, Java 3.0→3.1, etc.) 2. **Ruby SDK model constants**: Ruby examples changed from string model names like `"claude-opus-5-5"` to constant references like `Anthropic::Model::CLAUDE_OPUS_5_5` 3. **Skill hooks limits**: New documentation about limits on skill hooks (1,024 hooks per source, 16,384 chars for matchers), plugin-only lock, and troubleshooting 4. **Sandbox improvements**: - New `allowNestedUserNamespaces` setting - New section about Chromium/rootless Podman failing in sandbox on Linux - Warning about protected paths with nested user namespaces - Clarified wording about filesystem isolation 5. **New `api-version` skill**: A new bundled skill for updating API version code 6. **Cloud session thread scoping**: Multiple pages changed "outside a project" to "outside a project's threads" for clarity about when project settings apply 7. **Network watchdog timing**: More precise documentation about event-level watchdog behavior with keep-alive pings 8. **Hook output format change**: In costs.md, the hook output removed `permissionDecision: "allow"` from the response 9. **Test filtering pattern improvement**: The regex for test filtering was tightened to avoid command injection 10. **File mentions variable scope**: `CLAUDE_CODE_DISABLE_FILE_MENTIONS` can now be set in user settings env block and managed settings 11. **Skill folder as plugin**: Clar> Clarified that both personal and project skill folders can be plugins, but may be blocked by managed settings 12. **API versioning wording**: Removed' Removed the sentence about previous versions being deprecated 13. **Minor wording/formatting fixes**: Various small improvements

📚 Claude Code GitHub

17:07 EST

🤖 AI Batch Analysis

# 文档变更分析 ## 总体摘要 本次更新包含两类变更:一是 Claude Code 多项功能的行为澄清与新增文档(路径作用域、hooks 与 `@` 引用的交互、子代理 MCP 命名、后台会话消息队列等),二是大量 API 文档的文风/排版统一性修订(百分比写法、措辞中性化、列表标点等)。 ## 核心主题 - **路径作用域明确化**:`paths` 规则和 skills 的 glob 模式基于"规则的基准目录"或"Claude 当前工作目录"解析,不在当前目录外的文件(如 sibling worktree)不会匹配,需用 `/cd` 切换 - **`@` 引用与 hooks 的交互**:`@` 引用包含文件时不触发 `PreToolUse` hooks(因为没有 tool call),需改用 `Read` deny 规则或 `CLAUDE_CODE_DISABLE_FILE_MENTIONS=1` 来控制 - **子代理 MCP 双下划线命名**:MCP 服务器名含 `__` 时,`tools` 中需写 `mcp__reports__v2__*`(带尾部 `__*`),`disallowedTools` 中的前缀匹配可能误杀同名前缀的其他服务器工具 - **子代理命名依赖 agent teams**:子代理现在必须在启用 agent teams 后才能通过 `name` 参数命名 - **跨会话消息安全策略缩减**:从 4 条减为 3 条,移除了"无人观看的会话不能收发消息"的限制 - **企业自定义角色与云会话**:Enterprise 用户若使用 custom roles,需额外包含 cloud sessions 权限 - **全局文风/排版修订**:`50%` → `50 percent`、`may` → `might`、列表项统一加句号、参数名加反引号、链接锚文本优化等 ## 影响级别:**Medium** **理由**:路径作用域的行为澄清和 `@` 引用不触发 hooks 是开发者可能踩坑的运行时行为差异,尤其是依赖 hooks 做安全控制的团队需调整策略;MCP 双下划线命名问题可能导致子代理静默丢失工具。其余为文档澄清和文风修订,无破坏性变更。 ## 开发者行动项 1. **审查 hooks 安全策略**:若依赖 `PreToolUse` hooks 控制 Claude 读取权限,需为 `@` 引用场景补充 `Read` deny 规则或设置 `CLAUDE_CODE_DISABLE_FILE_MENTIONS=1` 2. **检查 paths 规则和 skills**:确认 `paths` glob 模式在当前工作目录下能正确匹配目标文件;如有 sibling worktree 需求,改用 `/cd` 或在新工作树中启动 3. **排查 MCP 服务器命名**:若 MCP 服务器名含 `__`(如 `reports__v2`),检查子代理的 `tools`/`disallowedTools` 配置是否正确使用了 `__*` 后缀,避免工具静默丢失 4. **Enterprise 管理员**:若组织使用 custom roles,确认角色包含 cloud sessions 权限,否则用户无法使用云会话
💭 Model Reasoning
Let me analyze all the documentation changes across 58 pages and identify the key themes and impacts. The changes fall into several categories: 1. **Claude Code feature updates** (sub-agents, interactive-mode, desktop, common-workflows, memory, skills, slash-commands): - Enterprise custom roles now need cloud sessions permission - `@` file mentions don't trigger PreToolUse hooks - documented workarounds - Cross-session messaging safety behavior reduced from 4 to 3 (removed restriction on unwatched sessions) - Vim mode: Esc twice to cancel a question, keybinding option - Background session with queued messages behavior documented - Path-scoped rules: patterns are relative to rule's base directory, worktree guidance - Managed CLAUDE.md cannot be excluded via claudeMdExcludes (clarified) - Skills/slash-commands: `paths` patterns relative to CWD, files outside don't match - Sub-agents: MCP server names with double underscore handling documented - Subagent naming now requires agent teams enabled - PowerShell exit code link fixed 2. **Style/editorial changes** across many API and build-with-claude pages: - "may" → "might" consistency - "50%" → "50 percent" for accessibility - Capitalization fixes ("API Reference" → "API reference") - List punctuation consistency (adding periods to list items) - "will" → more neutral phrasing - "understand" → "process" for vision - Various minor wording improvements for clarity - Code formatting with backticks for parameter names 3. **API reference changes**: - Ruby SDK example updated to use model constant instead of string - Beta headers example simplified (removed ant CLI example) Let me focus on what matters to developers.

📚 Anthropic API

13:49 EST

🤖 AI Batch Analysis

# 文档变更批量分析 ## 总体摘要 Anthropic 发布了新的 API 版本 `2026-10-21`,伴随所有 SDK 的主版本升级(Python 2.0、TypeScript 1.0、Java 3.0、C# 13.0、Go 2.0、PHP 1.0、Ruby 2.0),同时引入了多项破坏性变更;Claude Code 方面改进了 VM 恢复后的上下文提示、子代理重启后按名称消息的限制说明,以及 Desktop 上下文用量可视化。 ## 关键主题 - **API 版本 `2026-10-21` 正式发布**:`temperature`/`top_p`/`top_k` 从"在新模型上废弃"变为"在新 API 版本中彻底移除,所有模型均返回 400";Messages API 增加多条校验规则(assistant 消息不可含 document 块、user 消息 text 块不可带 citations);Admin API 多个字段重命名(`roles`→`role_ids`、`group_id`→`rbac_group_id`、`name`→`display_name`、`group_type`→`group.type`、`workspace_id`→`scope.workspace_id`);Analytics API 字段重命名(`actor.email`→`actor.email_address`、`summaries`→`data`) - **SDK 全线主版本升级**:每个主版本对应一个 API 版本,升级指南指向 `migration-2026-10-21` - **C# SDK 消息构造 API 重构**:`new() { Role = Role.User, Content = ... }` → `new UserMessageParam { Content = ... }`,移除 `Role` 显式赋值和 `MessageParamContent` 包装器;类似地引入 `AssistantMessageParam`、`BetaUserMessageParam`、`BetaSystemMessageParam` 等强类型 - **Java SDK API 重命名**:`addUserMessageOfBlockParams` → `addUserMessageOfContentBlockParams`;`MessageParam.builder().role(...)` → `MessageParam.ofUser()`/`ofAssistant()`;`BetaMessageParam` 按角色拆分为 `BetaSystemMessageParam` 等 - **Python SDK 倾向字典语法**:示例从 `MessageParam(role="user", content=...)` 改为 `{"role": "user", "content": ...}` - **Claude Code VM 恢复细节化**:不再笼统说"后台工作未恢复",而是分别列出 shell 命令(可要求 Claude 重跑)、子代理(可 resume 而非重跑)、会话级定时任务(需重新调度) - **子代理重启后名称丢失问题**:压缩前的名称不存活,需改用 agent ID(记录在 `agent-{agentId}.meta.json` 中),一条 ID 消息后名称恢复;标注了 v2.1.299 和 v2.1.304 前的 bug - **Desktop 上下文用量可视化增强**:新增 Context 卡片头显示百分比、`/context` 命令按类别展示上下文占用 ## 影响等级:**Breaking(破坏性)** **理由**:`temperature`/`top_p`/`top_k` 在 API 版本 `2026-10-21` 中被完全移除(所有模型),所有 SDK 主版本号跳变意味着存在不兼容的 API 变更;C# 和 Java SDK 的消息构造方式发生破坏性重构;Admin API 和 Analytics API 多个响应字段被替换。如果不升级则可继续使用旧 API 版本,但新用户可能无法使用旧版本。 ## 开发者行动项 1. **评估 API 版本迁移**:审查是否依赖 `temperature`/`top_p`/`top_k` 或 Admin API 旧字段名,按 [migration-2026-10-21 指南](https://platform.claude.com/docs/en/api/migration-2026-10-21) 逐步迁移 2. **升级 SDK 主版本**:升级到对应新主版本(Python ≥2.0、TypeScript ≥1.0、Java ≥3.0、C# ≥13.0 等),并适配消息构造 API 的破坏性变更(C# `UserMessageParam`/`AssistantMessageParam`;Java `addUserMessageOfContentBlockParams`/`MessageParam.ofUser()`) 3. **更新 C# 消息构造代码**:全局替换 `new() { Role = Role.User, Content = ... }` 为 `new UserMessageParam { Content = ... }`,移除 `MessageParamContent` 包装 4. **Claude Code 用户注意 VM 恢复行为**:重启后要求 Claude 重跑必要命令、resume 可恢复的子代理、重新调度 `/loop` 和定时任务 5. **子代理重启后按 ID 消息**:若重启后按名称消息失败,从 `~/.claude/projects/{project}/{sessionId}/subagents/agent-{agentId}.meta.json` 查找 agent ID 并用 ID 发送一次
💭 Model Reasoning
Let me analyze these documentation changes across 44 pages to identify the key themes and impacts. The main changes I see are: 1. **API Version `2026-10-21` release**: A new major API version is being introduced, replacing `2023-06-01`. This includes breaking changes like removing `temperature`, `top_p`, `top_k` parameters entirely, changes to Admin API response fields, and Analytics API changes. 2. **SDK major version bumps**: All SDKs are getting major version bumps (Python 1.17→2.0, TypeScript 0.137→1.0, C# 12.60→13.0, Go 1.84→2.0, Java 2.75→3.0, PHP 0.61→1.0, Ruby 1.82→2.0, ant CLI 1.44→2.0). Each major SDK version maps to an API version. 3. **C# SDK API changes**: `new() { Role = Role.User, Content = ... }` is replaced with `new UserMessageParam { Content = ... }` - removing the need to explicitly set Role. Similarly `AssistantMessageParam`, `BetaUserMessageParam`, etc. Also `MessageParamContent` wrapper is removed. 4. **Java SDK API changes**: `addUserMessageOfBlockParams` → `addUserMessageOfContentBlockParams`, `MessageParam.builder().role(Role.USER)` → `MessageParam.ofUser()`, `BetaMessageParam.builder().role(Role.SYSTEM)` → `BetaSystemMessageParam.builder()` 5. **Claude Code improvements**: - VM session restoration now provides more detail about what wasn't restored (shell commands, subagents that can be resumed, scheduled tasks) - Subagent resume after restart: names may not survive if they were before compaction, need to use agent ID - Desktop app: Context usage card added to session details panel, `/context` command - VS Code: Network path files shown as non-clickable for security - Subagent version notes about bugs before v2.1.304 and v2.1.299 6. **Python SDK changes**: `MessageParam(role="user", content=...)` → `{"role": "user", "content": ...}` dict syntax preferred Let me summarize this.

📚 Claude Code

📚 Anthropic API

08:39 EST

🤖 AI Batch Analysis

## 文档变更分析 ### 1. 总体概要 本次更新为 Claude Code 引入了 **"Projects"(项目)** 概念及其 **"Cloud Threads"(云端线程)**,明确了项目内云端线程与普通云端会话在配置加载行为上的关键差异——项目内的云端线程**不再读取仓库级别的 settings、skills、subagents 和 MCP 配置**。 ### 2. 关键主题 - **Projects 特性的隔离语义**:项目内的云端线程对仓库级配置(`.claude/settings.json`、`.claude/skills/`、`.claude/agents/`)的加载被显式排除,需改用 claude.ai 账户级配置或环境变量。 - **Settings 层级重构**:`settings.md` 将云端会话的设置来源拆分为三条:项目内线程、单仓库非项目会话、多仓库会话,各自适用不同规则。 - **Skills 可用性收窄**:项目和嵌套目录级别的 skills 在项目云端线程中不可用;普通云端会话也不再自动加载仓库 `.claude/skills/`(原文"additionally load"被删除)。 - **MCP 安全提示条件化**:跳过 `.mcp.json` 审批提示的行为现在仅适用于"项目外"的云端会话。 - **文档一致性**:`skills.md` 和 `slash-commands.md` 的 skills 部分变更完全同步。 ### 3. 影响级别:**Medium** **理由**:这不涉及 API 或 CLI 参数的 breaking change,但对使用 Claude Code Web/云端环境的团队影响显著——如果你依赖仓库内提交的 `.claude/settings.json`(权限规则、hooks、env)、`.claude/skills/` 或 `.claude/agents/`,在项目的云端线程中将**静默失效**。行为变更容易被忽略,可能导致权限泄露或功能缺失。 ### 4. 开发者行动项 - **审查现有仓库级配置**:检查 `.claude/settings.json` 中的 permission rules、hooks、`env` 是否被项目云端线程依赖,若是则迁移至环境变量或 server-managed settings。 - **迁移项目线程所需的 skills**:将仓库 `.claude/skills/` 中的 skill 启用到 claude.ai 账户级别,否则项目云端线程中无法使用。 - **迁移项目线程所需的 subagents**:同理,`.claude/agents/` 中的自定义 subagent 在项目线程中不会自动加载,需考虑替代方案。 - **关注 MCP 安全边界**:项目内的云端线程会要求 `.mcp.json` 中项目级 MCP server 的审批(不再自动跳过),确认自动化流水线不会因此中断。 - **阅读 Projects 文档**:深入了解 [claude-projects](/docs/en/claude-projects#what-threads-pick-up-from-your-repositories) 中"线程从仓库加载什么"的完整列表,确保配置策略与新的隔离模型一致。
💭 Model Reasoning
Let me analyze the documentation changes across all 5 pages. The changes all revolve around a new concept: "projects" (linked to `claude-projects`) and their "cloud threads." The key change is that cloud threads within a project have different behavior for settings, skills, subagents, and MCP servers compared to regular cloud sessions. Specifically: 1. **claude-code-on-the-web.md**: `/config` and subagents behavior now distinguishes between sessions inside vs. outside a project. Settings via `.claude/settings.json` only work "outside a project," and subagents only load automatically "outside a project's threads." 2. **mcp.md**: Project-scoped MCP servers from `.mcp.json` skip the approval prompt in cloud sessions *outside a project* (added that qualifier). 3. **settings.md**: Major restructuring of cloud session settings. New bullet for "Cloud threads in a project" — these don't read repository `.claude/settings.json` permission rules, hooks, or env. The existing bullet for shared project settings now says "outside a project." Separated the "several repositories" case into its own bullet. `/config` behavior updated similarly. 4. **skills.md** and **slash-commands.md** (identical changes): Project and nested skills now exclude "cloud threads in a project." Cloud sessions no longer "additionally load project skills committed to the cloned repository's `.claude/skills/`" — that was removed. Instead, for project cloud threads, skills must be enabled via claude.ai account. For non-project cloud sessions, committing to repo still works. So the overall theme: A new "projects" feature (likely claude.ai projects that group repositories) introduces "cloud threads" that have restricted access to repository-level configurations (settings, skills, subagents, MCP servers). This is a significant behavioral distinction.

📚 Claude Code

02:54 EST

🤖 AI Batch Analysis

### 总体概览 此次文档更新主要集中在优化非交互模式下的工具延迟与恢复机制,新增了针对插件通知的 Hook 支持,并完善了 MCP 工具加载行为及 API 缓存错误的诊断说明。同时包含若干重要的 Bug 修复,涉及云会话的登录状态及多 MCP 工具场景下的错误处理。 ### 核心主题 * **Hook 与工具编排增强**:大幅细化了 `PreToolUse` Hook 中 `"defer"` 决策的行为描述。明确指出 `defer` 是结束当前“轮次”而非直接退出进程,并增加了恢复会话时若工具不可用(如 MCP 服务器断开)的处理逻辑(返回 `tool_deferred_unavailable`)。 * **插件生态系统扩展**:在 `Notification` Hook 类型中新增了 `plugin_notification`,允许 Mods 通过 `$.ui.notify` 触发通知事件。 * **MCP 与工具搜索逻辑澄清**:详细解释了当 `ENABLE_TOOL_SEARCH` 设置为 `auto` 阈值模式时,工具为何会在定义总大小低于阈值时仍保持延迟加载的状态。 * **API 诊断可观测性**:为 Messages API 中的各类 `cache_miss_reason`(如 `model_changed`, `tools_changed` 等)补充了详细描述和外部文档链接,便于调试缓存失效问题。 * **Bug 修复**:修复了在云会话中使用 `claude -p` 时因环境变量缺失而误报“Not logged in”的问题,以及修复了在 MCP 工具较多时 API 错误被错误替换为“prompt is too long”的缺陷。 ### 影响等级:中等 **理由**:虽然大部分变动属于文档澄清,但对于构建基于 Agent SDK 的复杂封装或非交互式自动化工作流的开发者来说,`defer` 机制的语义变化及错误处理逻辑更新至关重要。插件通知的 Hook 也为扩展开发提供了新能力。 ### 开发者行动项 1. **检查 Defer 处理逻辑**:如果你的应用使用了 `permissionDecision: "defer"`,请务必更新代码以处理新的 `stop_reason: "tool_deferred_unavailable"` 状态,并理解恢复时发送 Prompt 与不发送 Prompt 的区别。 2. **适配新 Hook 类型**:在 Hook 监听器中增加对 `plugin_notification` 类型的处理,以支持插件的 UI 通知功能。 3. **审查 MCP 工具加载配置**:如果你的环境依赖 `ENABLE_TOOL_SEARCH=auto`,请查阅更新后的文档,理解工具在会话恢复或重连时可能保持延迟加载的行为。 4. **利用缓存诊断信息**:在调试 API 缓存命中率时,参考新增的 `cache_miss_reason` 详细说明来优化 Prompt 构建策略。 5. **更新环境变量配置**:针对云会话或无写入权限目录下的沙盒配置,参考文档中的 `~/.claude/settings.json` 配置方案进行修正。
💭 Model Reasoning
1. **Analyze the Request**: * **Role**: World-class programmer analyzing documentation changes. * **Input**: 12 pages of documentation diffs (hooks, hooks-guide, mcp, model-config, sandboxing, setup, api/messages, api/models/list, api/beta/files/upload, claude-in-microsoft-foundry, mcp-connector, CHANGELOG). * **Task**: Summarize what changed, why it matters, key themes, impact level, and action items. * **Format**: Markdown. * **Language**: Chinese. 2. **Process the Diffs (Page by Page Analysis)**: * **Page: `hooks.md`**: * *Change 1*: Added `plugin_notification` to the `Notification` hook types. * *Change 2*: Updated `permissionDecision` for `"defer"`. Now clarifies that it ends the turn so the tool can be resumed later, and requires the `-p` flag (non-interactive). * *Change 3*: Refined the `PreToolUse` -> `defer` flow description. * *Change 4*: Added handling for when a deferred tool is unavailable upon resume (`tool_deferred_unavailable`). Clarified behavior when sending prompts vs. no prompts during resume. * *Theme*: Hook extensibility (plugins), Tool deferral/resume logic refinements. * **Page: `hooks-guide.md`**: * *Change 1*: Added `plugin_notification` description (Mod raising notifications). * *Change 2*: Updated description of `"defer"` to mention it ends the turn (not just "exits the process"). * *Change 3*: Added `plugin_notification` to the notification types table. * *Theme*: Consistency with `hooks.md`. * **Page: `mcp.md`**: * *Change 1*: Clarified `ENABLE_TOOL_SEARCH=auto` behavior. Specifically, tools stay deferred below the threshold if tool search was already on. * *Theme*: Tool loading and MCP configuration clarity. * **Page: `model-config.md`**: * *Change 1*: Clarified warnings for `maxEffortLevel` caps. Warnings go to stderr for `--print`, debug log otherwise. * *Change 2*: Minor text correction regarding 200K limit warnings. * *Theme*: Effort level cap warnings/logging. * **Page: `sandboxing.md`**: * *Change 1*: Added a workaround for when no writable project folder is available. Suggests enabling sandbox via `~/.claude/settings.json` user settings. * *Theme*: Sandbox configuration edge cases. * **Page: `setup.md`**: * *Change 1*: Removed duplicate `theme={null}` attributes from code blocks (cosmetic cleanup). * *Theme*: Documentation hygiene. * **Page: `api/messages.md`**: * *Change 1*: Added detailed descriptions for various `cache_miss_reason` types (e.g., `model_changed`, `system_changed`, etc.) and linked to the cache diagnostics guide. * *Theme*: API diagnostics and caching clarity. * **Page: `api/models/list.md`** & `api/beta/files/upload.md`**: * *Change 1*: Added `"webhooks-2026-10-07"` to headers. * *Theme*: API versioning/headers update. * **Page: `claude-in-microsoft-foundry.md`** & `agents-and-tools/mcp-connector.md`**: * *Change 1*: Minor text corrections/formatting (e.g., Markdown code backticks in URL text). * *Theme*: Documentation hygiene/formatting. * **Page: `CHANGELOG.md.md`**: * *Change 1*: Added entry for v2.1.306. * *Fixes*: Fixed `claude -p` inside cloud sessions reporting "Not logged in". Fixed API error being replaced by "prompt is too long" in sessions with many MCP tools. * *Theme*: Bug fixes. 3. **Synthesize and Structure**: * **Overall Summary**: The changes focus on refining the "defer" mechanism for tools in non-interactive modes, adding hook support for plugin notifications, clarifying tool loading behaviors with MCP, and adding diagnostic details to the API cache miss reasons. There are also minor bug fixes and documentation cleanups. * **Key Themes**: * **Hook & Tool Orchestration**: Significant updates to how the `"defer"` permission decision works, specifically regarding tool unavailability during resume and the state of the turn (ending vs. exiting). Support for plugin notifications via hooks. * **MCP & Tool Search**: Clarification on the `auto` threshold for tool loading and when tools stay deferred. * **API Diagnostics**: Enhanced documentation for `cache_miss_reason` types in the Messages API. * **Bug Fixes & Stability**: Fixes related to cloud sessions (`-p` flag) and error handling with many MCP tools. * **Impact Level**: **Medium**. * *Reasoning*: The changes to the `defer` logic and tool unavailability are critical for developers building advanced Agent SDK wrappers or non-interactive workflows. The plugin notification hook enables new integration capabilities. Other changes are informational or cosmetic. * **Action Items**: * Review Agent SDK implementations handling the `defer` logic to account for the new `tool_deferred_unavailable` state and the distinction between sending prompts vs. resuming without prompts. * Update hook listeners to handle the new `plugin_notification` type if plugin integration is relevant. * Check `tool_deferred_unavailable` handling in custom integrations. * Consult the new cache diagnostics guide if implementing caching strategies with the API. 4. **Drafting the Response (in Chinese)**: * *Summary*: 此次更新主要优化了非交互模式下的工具延迟机制,增加了插件通知的 Hook 支持,并明确了 MCP 工具加载逻辑及 API 缓存诊断细节。 * *Themes*: * Hook 与工具编排:细化了 `defer` 权限决策的行为,特别是恢复会话时工具不可用的处理逻辑;新增 `plugin_notification` Hook 类型。 * MCP 与工具搜索:阐明了 `ENABLE_TOOL_SEARCH=auto` 阈值下的工具加载行为。 * API 诊断:为 Messages API 的 `cache_miss_reason` 类型补充了详细说明。 * Bug 修复:解决了云会话中 `claude -p` 的登录状态报错及多 MCP 工具场景下的错误处理问题。 * *Impact*: Medium (主要影响构建 Agent SDK 封装或高级自动化工作流的开发者)。 * *Actions*: * 调整处理 `defer` 逻辑的代码,以应对新增的 `tool_deferred_unavailable` 状态。 * 在 Hook 监听器中添加对 `plugin_notification` 的处理。 * 参考新的缓存诊断指南优化 API 缓存策略。 5. **Refining Language**: Ensure technical terms are accurate (e.g., "defer", "non-interactive", "Agent SDK", "MCP"). 6. **Final Polish**: (Self-correction: Ensure I mention the change from "process exits" to "turn ends" for defer, as that's a nuance). 7. **Final Output Generation**. (Matches the thought process above).

📚 Claude Code

📚 Claude Code GitHub