### 总体总结
此次文档更新主要涉及权限工具语法的规范化(移除 `(*)` 通配符)、Hook 系统的上下文增强(新增 `cwd`、`model` 及子代理生命周期事件)、配置文件路径的澄清以及针对多工作区 Prompt 缓存的未来架构变更预警。
### 关键变更主题
* **权限工具语法简化**:在 CI/CD 和 IAM 文档中,统一移除了工具权限后的 `(*)` 后缀。现在的写法是直接使用工具名称(如 `Read`),而不是 `Read(*)`,这意味着通配符语法已被弃用或简化。
* **Hooks 上下文与功能增强**:显著增强了 Hook 输入的数据结构,新增了 `cwd`(当前工作目录)和 `model`(模型标识)字段。同时,明确区分了 `Stop` 和 `SubagentStop`,并新增了 `SubagentStart` 事件,为子代理的生命周期管理提供了更细粒度的控制。
* **配置与术语澄清**:更正了 `~/.claude.json` 的描述(移除了“允许的工具”相关说明),澄清了 MCP 服务器的 "local scope"(存储在用户目录)与项目级 "local settings" 的区别,并细化了 `ignorePatterns` 的行为描述。
* **未来架构变更预警**:提示将于 2026 年 2 月 5 日将 Prompt 缓存的隔离级别从组织级(Organization)调整为工作区级(Workspace),这会影响多工作区组织的缓存策略。
* **版本与兼容性**:指定了 Python (0.22.0) 和 TypeScript (0.37.0) SDK 的最低版本要求,并修复了不支持 AVX 指令集的处理器上的崩溃问题。
### 影响等级
**中等**
**理由**:虽然大部分变更是文档层面的澄清或字段增强,但权限工具语法的变更(移除 `(*)`)要求开发者更新现有的 CI/CD 脚本和配置。此外,Prompt 缓存的未来变更属于架构层面的调整,需要提前规划。Hooks 的增强虽然主要是新增字段,但对于依赖特定 Hook 逻辑的高级用户可能需要适配。
### 开发者行动项
1. **更新 CI/CD 脚本**:检查并修改 `gitlab-ci-cd.md` 中的示例,将 `--allowedTools` 参数中的 `Bash(*) Read(*)` 等格式修改为 `Bash Read`(移除 `(*)`)。
2. **适配权限定义**:根据 `iam.md` 的说明,更新代码中的 IAM 权限定义,使用不带括号的工具名称来表示允许所有访问。
3. **利用增强的 Hooks**:如果使用自定义 Hooks,更新代码以利用新增的 `cwd`、`model` 字段,并考虑处理新增的 `SubagentStart` 和 `SubagentStop` 事件以获取更完整的会话上下文。
4. **规划缓存策略**:如果您的组织包含多个工作区并使用了 Prompt 缓存,请针对 2026 年 2 月的隔离级别变更审查当前的缓存策略。
5. **检查 SDK 版本**:确保项目使用的 Python SDK 版本至少为 0.22.0,TypeScript SDK 版本至少为 0.37.0。
💭 Model Reasoning
1. **Analyze the Request:**
* **Role:** World-class programmer analyzing documentation changes.
* **Format:** Markdown, concise, insightful, focus on what matters to developers.
* **Language:** Chinese.
* **Input:** A batch of diffs from 9 pages (`gitlab-ci-cd.md`, `hooks.md`, `iam.md`, `mcp.md`, `settings.md`, `troubleshooting.md`, `api/client-sdks.md`, `build-with-claude/prompt-caching.md`, `CHANGELOG.md.md`).
2. **Analyze the Diffs Page by Page:**
* **`gitlab-ci-cd.md`:**
* *Change:* `--allowedTools "Bash(*) Read(*) Edit(*) Write(*) mcp__gitlab"` -> `--allowedTools "Bash Read Edit Write mcp__gitlab"` (in multiple places).
* *Significance:* Removes the `(*)` wildcard suffix syntax for tool permissions. This is a syntax change for the CLI tool. Likely a simplification or deprecation of the wildcard notation.
* **`hooks.md`:**
* *Change 1:* Separated `Stop` and `SubagentStop` input documentation. `Stop` now includes `cwd`. `SubagentStop` is new/detailed, including `agent_id`, `agent_transcript_path`.
* *Change 2:* `SessionStart` input now includes `cwd`, `model`. Added `source` details (startup, resume, clear, compact) and `agent_type`.
* *Change 3:* New `SubagentStart` input documentation (agent spawning).
* *Significance:* Enhanced hook capabilities. Hooks now get more context (`cwd`, `model`, `agent_id`). Support for subagent lifecycle hooks is more explicit.
* **`iam.md`:**
* *Change:* Added a note about gitignore patterns (`*` vs `**`). Clarified that allowing all access is just the tool name (e.g., `Read`) without parentheses.
* *Significance:* Clarifies permission syntax. Connects back to the `gitlab-ci-cd.md` change regarding `(*)`.
* **`mcp.md`:**
* *Change:* Added a note distinguishing "local scope" (stored in `~/.claude.json`) from "local settings" (` .claude/settings.local.json`).
* *Significance:* Terminology clarification to prevent confusion about where configurations live.
* **`settings.md`:**
* *Change:* Updated description of `ignorePatterns`. Instead of "completely invisible", it now says "excluded from file discovery... read operations denied".
* *Significance:* Precision update on how ignoring works. It's more about operations than visibility conceptually, or perhaps clarifies the mechanism.
* **`troubleshooting.md`:**
* *Change 1:* `~/.claude.json` description: Removed "allowed tools".
* *Change 2:* Warning about removing `~/.claude.json`: Removed "allowed tools".
* *Significance:* Consistent with the IAM/GitLab changes. The concept of "allowed tools" configuration seems to have moved or changed syntax/location, or simply isn't stored there anymore in the same way.
* `api/client-sdks.md`:
* *Change:* Added "Minimum SDK version" tags (0.22.0 for Python, 0.37.0 for TS).
* *Significance:* Version requirement specification.
* `build-with-claude/prompt-caching.md`:
* *Change:* Warning about workspace-level isolation for prompt caching starting Feb 5, 2026 (replacing org-level).
* *Significance:* Future breaking change/change in behavior for multi-workspace organizations.
* `CHANGELOG.md.md`:
* *Change:* Version 2.1.17 entry: Fixed crashes on processors without AVX support.
* *Significance:* Bug fix for older hardware compatibility.
3. **Synthesize and Structure:**
* *Overall Summary:* This batch focuses on refining permission syntax (removing `(*)`), enhancing context for hooks (adding `cwd`, `model`, subagent support), clarifying configuration storage locations, and announcing a future prompt caching isolation change.
* *Key Themes:*
1. **Permissions Syntax Refinement:** The shift from `Tool(*)` to `Tool` across CI/CD and IAM docs.
2. **Hooks Enhancement:** Adding `cwd`, `model`, and explicit subagent lifecycle events (`SubagentStart`, `SubagentStop`).
3. **Configuration Terminology:** Clarifying "local scope" vs "local settings" and removing "allowed tools" from `~/.claude.json` description.
4. **Future API Changes:** Prompt caching isolation shifting from org to workspace level in 2026.
5. **Compatibility:** Fixing AVX crashes and defining minimum SDK versions.
* *Impact Level:* **Medium**.
* *Reasoning:* The permission syntax change (`(*)` removal) is a specific syntax update users need to adopt if they copy-pasted old commands. The prompt caching change is a future architectural shift. The hooks changes are additive (new fields) rather than breaking, but important for advanced users.
* *Action Items:*
1. Update CI/CD scripts to remove `(*)` from `--allowedTools` arguments.
2. Review and update permission definitions (IAM) to use the new syntax.
3. If using custom hooks, update code to handle new fields like `cwd` and `model`.
4. Note the Feb 2026 date for prompt caching isolation changes if managing multi-workspace orgs.
5. Upgrade SDKs if below the new minimum versions (Python 0.22.0+, TS 0.37.0+).
4. **Drafting the Output (in Chinese):**
* *Summary:* 此次更新主要优化了权限工具的语法规范(移除了 `(*)` 通配符),增强了 Hooks 系统的上下文信息(如 `cwd`、`model` 及子代理事件),明确了配置文件的存储位置定义,并提示了未来关于 Prompt 缓存隔离策略的重要变更。
* *Themes:* 权限语法优化, Hooks 功能增强, 配置路径澄清, 未来架构变更.
* *Impact:* Medium.
* *Actions:* Update scripts, update hooks, check SDK versions, plan for caching change.
5. **Refining the Output (Self-Correction/Polish):**
* Ensure the connection between the GitLab page and IAM page is clear (both talk about `(*)` syntax).
* Highlight the specific fields added to hooks.
* Mention the CPU fix in the changelog as it affects environment support.
6. **Final Output Generation (Markdown):** (Proceed to generate response based on these points).