2026 年 8 月 4 日同批发布的 v2.1.221,带来了两项体验和安全并重的更新——VS Code 插件的 Focus View(专注视图),以及沙箱凭据文件的文件级脱敏模式。本文基于官方 Changelog 逐条解读。
VS Code Focus View:把工具活动噪音藏起来
[VSCode] Added Focus view: a chat-menu toggle that hides tool activity
behind an expandable per-turn summary with a live running-tool indicator,
toggled with Ctrl+Alt+F or the "Claude Code: Toggle Focus view" command
这是专门为 VS Code 插件用户设计的界面优化——开启 Focus View 后,原本密密麻麻的工具调用过程(文件读取、命令执行、搜索结果等)会被折叠进一个可展开的每轮摘要中,同时保留一个实时的「当前正在运行哪个工具」指示器。对于只关心「Claude 做了什么、结果如何」而不想被中间过程细节淹没的用户,这是一个很直接的降噪功能。
快捷键:Ctrl+Alt+F
命令面板:Claude Code: Toggle Focus view
沙箱凭据文件脱敏:Linux/WSL 新增 mask 模式
Added mode: "mask" for sandbox credential files on Linux and WSL —
sandboxed commands read a sentinel copy (the whole file, or just the
spans captured by an extract regex) while the sandbox proxy substitutes
the real value on egress; on macOS file masking falls back to deny
这项功能解决了一个很实际的矛盾——某些命令行工具需要读取凭据文件才能正常工作(比如读取 AWS 凭据文件来判断当前是否已登录),但你又不希望 Claude Code 在沙箱中直接看到明文凭据内容。mode: "mask" 的解决方案很巧妙:
工作原理:
1. 沙箱化命令读到的是一份「哨兵副本」(sentinel copy)
—— 可以是整个文件,也可以是通过 extract 正则捕获的特定片段
2. 当这份数据真正需要发往外部网络(egress)时,
沙箱代理会在出口处用真实值替换掉哨兵值
也就是说,Claude 自己看到的凭据文件内容始终是假的,但当命令真的需要用凭据去调用外部 API 时,代理会在网络出口层悄悄替换回真实值——这样既保证了工具功能正常,又避免了凭据明文暴露给模型。需要注意的是,该功能目前仅支持 Linux 和 WSL,macOS 上文件级脱敏会退化为直接拒绝(deny)读取。
这项能力和此前 v2.1.219 引入的 extract/decode: "jwt"/awsPairs/sigv4 等沙箱凭据脱敏选项是同一条产品线的延续——Claude Code 正在为「既要让 Agent 具备操作云资源的能力,又不想让 Agent(或潜在的 Prompt 注入攻击)直接看到明文密钥」这个矛盾,搭建一套越来越完善的解决方案。
zsh 正则条件中隐藏命令的安全修复
Fixed a Bash tool permission-check bypass where zsh could execute hidden
commands in [[ ]] regex conditionals; affected commands now prompt for
permission
又一处 zsh 特殊语法权限检查绕过——这次是 [[ ]] 正则条件表达式中可以执行隐藏命令。结合此前 v2.1.214、v2.1.223 等多个版本对 zsh/Bash 语法解析的持续修补,可以看出 Shell 特殊语法一直是 Claude Code 权限系统最容易被攻击的角落之一。
PowerShell 路径引号处理修复
Fixed PowerShell permission checks mishandling paths containing quote
characters on Windows; such paths now prompt for approval
Windows 上包含引号字符的路径,此前权限检查逻辑处理有误——现在这类路径会统一要求用户批准,而不是可能被误判。
会话中途禁用 MCP 服务器的状态问题
Fixed the thinking toggle having no effect for the rest of a session that
started with thinking off; disabling an MCP server mid-connect no longer
silently reverts
两个独立的状态管理修复:一是如果会话开始时思考模式是关闭的,之后再切换思考开关会没有效果;二是会话连接过程中禁用某个 MCP 服务器,此前可能会被静默还原,现已修复。
print 模式下 MCP 工具调用文本化问题
Fixed MCP servers from --mcp-config not being connected before the first
turn in print mode (-p), which made the model emit tool calls as literal
text
这是一个会直接影响自动化脚本可靠性的问题——在无头 -p 模式下,通过 --mcp-config 指定的 MCP 服务器此前可能在第一轮对话之前还没有完成连接,导致模型把工具调用当作纯文本输出,而不是真正执行工具——如果你的自动化流程依赖 -p 模式 + MCP 工具,这是一个需要升级排查的问题。
新增 prompt-audit 子命令
Added a prompt-audit subcommand to the claude-api skill for auditing
prompts and tool descriptions for patterns written for older models
claude-api 内置技能新增 prompt-audit 子命令,用于审计提示词和工具描述中是否存在为旧版模型编写、可能不再适用于新模型的模式——对于维护大型 Prompt 库或自定义工具描述的团队,这是一个值得纳入日常检查流程的新工具。
总结
v2.1.221 是一次「体验优化 + 安全加固」两不误的更新——Focus View 解决的是日常使用体验的信息过载问题,而沙箱凭据 mask 模式、多处 Shell 权限检查修复,则继续巩固 Claude Code 在「让 Agent 更强大」和「让 Agent 更可控」之间的平衡。
来源:Claude Code Changelog v2.1.221 — Claude Code 官方文档,Anthropic