### 总体摘要
此次更新主要优化了后台任务(特别是 Monitor 工具和子代理)的调度逻辑,明确了“严格沙箱模式”对用户手动命令的限制范围,引入了用于分析技能使用情况的 `/skill-doctor` 命令,并修正了部分交互快捷键(如 `Ctrl+W`)的行为定义及文档细节。
### 关键变更主题
* **技能性能优化与监控**:新增 `/skill-doctor` 命令和插件管理器中的 **Stats** 标签页,帮助开发者识别未使用的技能及其上下文成本,从而优化 Token 使用。
* **沙箱安全策略细化**:明确了 `allowUnsandboxedCommands: false`(严格沙箱模式)主要限制的是 *Claude 执行* 的命令。用户在 `!` 提示符下手动输入的命令在大多数情况下仍可在沙箱外运行(特定环境除外),这修正了之前版本的默认行为。
* **Headless 模式任务生命周期**:重构了 `claude -p` 模式下的后台任务处理。明确了 Monitor 工具的等待机制(默认 5 分钟超时或 10 分钟空闲上限),以及子代理/工作流完成后的等待上限。
* **交互体验与快捷键调整**:`Ctrl+W` 的行为从“删除上一个单词”变为“删除回退至前一个空白处”,这意味着在删除路径或 `--flag=value` 时会一次性删除整段。同时,`--add-dir` 明确了不支持网络路径。
* **数据清理与保留策略**:澄清了检查点文件快照是在会话“最后一次保存快照”约 30 天后被清理,而非简单的会话创建时间。删除远程 MCP 服务器现在会同时清理 OAuth 令牌。
### 影响等级:**中等 (Medium)**
**理由**:
虽然没有破坏性的 API 变更,但 **严格沙箱模式**适用范围的澄清改变了安全边界,可能影响企业环境的安全配置。`Ctrl+W` 快捷键行为的变化直接影响用户的肌肉记忆和编辑体验。快照保留策略的细节澄清也可能导致用户在执行 `/rewind` 时遇到意外错误(如果快照已被清理)。
### 开发者行动项
1. **适应快捷键变化**:注意 `Ctrl+W` 现在会一次性删除路径或整个参数值(直到遇到空白符),编辑命令时需更加谨慎。
2. **审查沙箱安全配置**:如果你依赖严格沙箱模式来限制开发者在 `!` shell 中的操作,请根据新文档重新评估安全性,因为现在手动命令通常不受此限制。
3. **使用 `/skill-doctor` 优化性能**:在拥有大量技能的项目中运行 `/skill-doctor`,识别并禁用未使用的技能,以减少上下文窗口的占用。
4. **更新 Headless 脚本预期**:如果在 `claude -p` 中使用 Monitor 工具,请确保新的 10 分钟空闲等待上限符合你的自动化脚本需求。
5. **注意快照过期逻辑**:如果需要回退到超过 30 天的检查点,请理解快照是基于“最后保存时间”而非会话开始时间计算的,可能需要调整 `cleanupPeriodDays` 设置。
💭 Model Reasoning
1. **Understand the Goal:** The user wants a concise, insightful analysis of a batch of documentation changes for "Claude Code" (a developer tool). The output must be in Chinese, Markdown format, and focus on what matters to developers.
2. **Analyze the Input Data:**
* **Total pages:** 16.
* **Format:** Diffs for each page.
* **Page-by-Page Analysis:**
* *checkpointing.md*: Clarified retention behavior. Snapshots are deleted ~30 days after the *session last saved one*, not necessarily the session itself. Added warning about rewinding to deleted snapshots (`No files were restored` error).
* *cli-reference.md*: `--add-dir` description updated. Clarified network paths (`\\server\share`) can't be added. Grammar fix ("doesn't discover").
* *discover-plugins.md*: Added a new tab in the plugin manager called **"Stats"**. It shows skill costs and usage (linked to `/skill-doctor`).
* *headless.md*: Refined logic for `claude -p` (headless mode) regarding background tasks.
* Bash tasks: 5-sec grace.
* Subagents/Workflows: Waits until completion or 10-min idle cap.
* Monitor watches: New logic. Waits until timeout or cap.
* API Retry Events: Table reformatting (looks mostly formatting, but check for content changes). The text description above the table changed significantly, clarifying quiet retries for auth errors (401/403) with `apiKeyHelper`.
* *hooks.md*: `DirectoryAdded` hook trigger condition clarified. Adding a directory *inside* a working directory also triggers it (not just adding an existing working dir).
* *interactive-mode.md*: Text editing shortcuts table updated.
* `Ctrl+W`: Changed description to "Delete back to previous whitespace". Old was "Delete previous word". Crucial change in behavior/description.
* `Alt+F`: Changed move behavior (end of current/next word).
* `Alt+D`: Changed delete behavior (to end of current/next word).
* `Ctrl+Y`: Clarified paste behavior.
* *mcp.md*: Added note: removing a remote server deletes OAuth tokens and client registration.
* *memory.md*: Minor clarification. "excludes the memory files in the memory directory". (Redundant removal of "the files in").
* *monitoring-usage.md*: `settings_unknowable` reason updated. Now mentions `desktopSessionCleanupPeriodDays` in addition to `cleanupPeriodDays`.
* *network-config.md*: Clarification on `CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS`. Removed reference to `API_TIMEOUT_MS` derivation, now strictly uses byte-level watchdog timeout. Added note about retry wait duration.
* *plugins-reference.md*: Path traversal limitations. Added explicit mention that symlinks leading outside the plugin root are blocked (except within a marketplace). Split the rejection sentence for clarity.
* *sandboxing.md*: Significant updates on "Strict sandbox mode" (`allowUnsandboxedCommands: false`).
* Clarified it applies to commands *Claude runs*, not necessarily user-typed commands at `!` prompt.
* Exceptions listed: Background sessions, Linux with specific env var.
* Historical note: Before v2.1.260, it sandboxed shell-mode commands in *every* session.
* FAQ updates: Added `git` command failure troubleshooting split into paragraphs.
* *skills.md* (and *slash-commands.md*, identical diff):
* Added tip: use `/add-dir` to load subdirectory skills before file interaction (requires v2.1.257).
* Added section: "Find unused skills" using `/skill-doctor`. Details on reporting (Stats tab, text in headless, excludes bundled/enterprise skills).
* Updated reference to `/doctor` to suggest `/skill-doctor` for turning off skills.
* *sub-agents.md*: Refined git command refusal logic. "Refuses a command when it can't verify from the command text that any git... stays inside the worktree".
* *terminal-config.md*: Minor grammar fix in paste deletion restoration description.
3. **Synthesize Key Themes:**
* **Sandboxing Security/Behavior:** Refined definitions of strict mode, what applies to Claude vs. user commands, and historical context.
* **Skill Management & Optimization:** Introduction of `/skill-doctor`, Stats tab, and better loading control via `/add-dir`.
* **Headless/Background Task Orchestration:** Clearer rules on when processes die vs. wait, especially for Monitors and Subagents.
* **CLI/UX Refinements:** Text editing shortcuts (`Ctrl+W` behavior change), network path restrictions, MCP cleanup.
* **Retention/Storage:** Clarified when snapshots are actually deleted.
4. **Determine Impact Level:**
* **Medium.** While there are no "breaking" changes in the traditional API sense (like a removed endpoint), behavioral changes in `Ctrl+W` (interactive mode), Strict Sandbox mode, and Snapshot retention are significant for daily workflow and security configuration. The new `/skill-doctor` is a helpful utility.
5. **Draft Action Items:**
* Update muscle memory for `Ctrl+W` (now whitespace-based).
* Review sandbox settings if relying on strict mode to sandbox *user* shell commands.
* Use `/skill-doctor` to audit context usage.
* Adjust expectations for headless mode background tasks (Monitor behavior).
6. **Drafting the Response (in Chinese):**
* *Overall Summary:* 此次更新主要集中在优化后台任务的行为逻辑、明确沙箱模式的适用范围、引入技能使用分析工具,并调整了部分交互快捷键的功能定义。
* *Key Themes:*
* **技能与性能监控**: 新增 `/skill-doctor` 命令和 "Stats" 标签页,帮助分析技能成本和未使用情况,优化上下文窗口占用。
* **沙箱与安全细化**: 明确 "Strict sandbox mode" 主要限制 Claude 执行的命令,而非用户手动输入的 `!` 命令(除特定环境外)。
* **Headless 模式任务调度**: 重构了后台任务(Bash, Subagent, Workflow, Monitor)的终止和等待逻辑,明确了 10 分钟的空闲等待上限。
* **交互体验调整**: `Ctrl+W` 快捷键行为从 "删除上一个词" 改为 "删除至前一个空白处";`--add-dir` 增加了对网络路径的限制说明。
* *Impact Level:* **Medium** (中等)
* *Reasoning*: 虽然 API 层面没有破坏性变更,但交互快捷键 (`Ctrl+W`) 的行为改变会影响用户习惯;沙箱模式适用范围的澄清修正了潜在的安全误解;快照保留策略的细节更新可能导致用户回退操作时的意外失败。
* *Action Items:*
* **调整快捷键习惯**: 注意 `Ctrl+W` 现在是删除至空白处,而非单词,路径或参数值可能会被一次性删除。
* **审查沙箱配置**: 如果你依赖 `allowUnsandboxedCommands: false` 来限制用户在 `!` 提示符下的操作,请注意新版本中用户命令通常不受此限制。
* **优化技能配置**: 运行 `/skill-doctor` 清理未使用的技能以节省上下文 token。
* **确认快照保留逻辑**: 如果依赖超过 30 天的 `/rewind` 功能,请确保理解快照是在 "session last saved one" 之后约 30 天删除,而非简单的会话时间。
* **检查 Headless 脚本**: 如果在 `claude -p` 中使用 Monitor 工具,需确认新的 10 分钟等待上限是否符合需求。
7. **Review and Refine:**
* The translation of "Delete back to previous whitespace" for `Ctrl+W` is accurate.
* The Sandbox point is critical—previous behavior (before v2.1.260) sandboxed everything, now it mostly only sandboxes Claude's actions. The docs explicitly warn about this distinction.
* The Snapshot point is subtle but important: if you don't save a checkpoint for a long time within a session, the snapshots might disappear sooner than expected relative to the session start date? No, the text says "after the session last saved one". This implies snapshots are tied to activity within the session.
8. **Final Output Generation.** (Matches the structure requested).