Claude Code v2.1.299:弃用bold参数、新增idle
v2.1.299
推荐理由
v2.1.299 废弃了 mod 开发中常用的 bold 参数并强制迁移至 weight,同时修复了严重的安全漏洞(沙箱逃逸)。使用 Claude Code SDK 或编写自定义 Mod 的开发者需立即检查代码兼容性并升级。
What's changed
变更内容
- Added CLAUDE_CODE_DISABLE_FILE_MENTIONS environment variable: Claude gets the paths of @ file mentions to read with its file tools, not the files' contents
- Added idle compaction in the terminal: a 200K+ token conversation left idle for about 54 minutes is compacted before its one-hour prompt cache expires, so your next message doesn't reprocess it all
- Added CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS to change idle compaction's 200K-token minimum; "idleCompaction": false in settings.json turns it off. Both need v2.1.290 or later
- Added $.prompt.media so a prompt.submit hook of a mod installed by managed settings can read the bytes of an image or document attached to the prompt
- Added $.session.identity() for mods installed by managed settings: how the session is signed in, and its organization and email when managed forceLoginOrgUUID lists that organization
- Added size, weight, mono and tabular to a mod's Text and named spacing steps (xs to xl) to its Box; bold is deprecated in favor of weight
- Added --shutdown-drain-sec to claude self-hosted-runner orchestrator: on SIGTERM it stops polling and gives the poll in flight and running spawn hooks up to that many seconds to finish
- Added the skill's frontmatter, source, plugin name and file path to what a mod's skill.prompt hook receives
- Added /effort and /fast in agent view to set what new sessions start with; a bare /model, /effort or /fast there now opens a picker
- Added a "safe mode" line to the agents view peek panel for background sessions started with --safe-mode
- Added a one-time note when plan mode won't ask before most edits or commands because bypass permissions is available
- Added --disallow-tools and a disallowed_tools case field to claude plugin eval to keep specific built-in tools, such as Agent, out of eval runs
- Added support for turning off the attribution block in Claude Desktop's Code tab: set CLAUDE_CODE_ATTRIBUTION_HEADER=0 in the env of a Claude apps gateway's code policy
- Added a field to the attribution block in Claude Code sessions behind a Claude apps gateway; remove the block with CLAUDE_CODE_ATTRIBUTION_HEADER=0
- Added a queue door to the session.append mod hook, so a mod can make the transcript's queue records differ from the prompt as sent
- Added a note in /plugin and claude plugin validate naming a mod's hooks that are skipped where an organization manages Claude Code
- Added /usage warnings for max effort, workflows, always-on context and large tool results
- Fixed the error for a denied cloud session, which could point to the wrong organization when a key from apiKeyHelper was in use
- Fixed sessions on a gateway-specific model name behind a custom ANTHROPIC_BASE_URL ending with "Prompt is too long · automatic compaction failed" near 200K tokens instead of sending the request
- Fixed a mod that submits a prompt at the end of every turn keeping a headless run going past --max-turns, --max-budget-usd, an interrupt, or the end of the host's conversation
- Fixed cloud sessions sometimes showing the model's follow-up text after a tool group's one-line label
- Fixed the Write and Edit tools creating a mod in a session's mods folder without asking in accept-edits mode when the config directory's path has no .claude in it
- Fixed installed mods that kept running in an open session after being turned off remotely; they now unload between turns
- Fixed Edit and Retry in Cowork and claude.ai cloud sessions failing on a message stopped while its UserPromptSubmit or mod prompt.submit hooks were still running (regression in 2.1.296)
- Fixed an agent teammate started without a description keeping part of a credential from its prompt in the task description shown for it
- Fixed the claude.ai view of a Remote Control or cloud session freezing when a large batch of events could not finish uploading over a slow connection
- Fixed a sandboxed shell command being able to write into a --plugin-dir folder, whose code Claude Code reloads and runs outside the sandbox
- Fixed memory growth under heavy debug logging (--debug, --debug-file), and a hang on exit when the debug log is on a disk or network mount that stops accepting writes
- Fixed memory growing without bound when debug output goes to stderr and the parent process stops reading it
- Fixed rm prompts on shell -c scripts that don't run rm. An rm built at run time in a script Claude Code can't read no longer prompts unless CLAUDE_CODE_STRICT_INLINE_SHELL_RM_PROMPT=1
- Fixed double-clicking a word in an expanded transcript row in fullscreen mode collapsing the row instead of selecting the word
- Fixed claude mcp list, claude doctor and /status reporting an empty .mcp.json as invalid
- Fixed /btw jumping the transcript to the bottom when asked while scrolled up in fullscreen
- Fixed sandboxed commands failing on WSL2 with bwrap: Can't mkdir /mnt/c/Program Files/ClaudeCode when the sandbox can write to the Windows drive
- Fixed scheduled wakeups (ScheduleWakeup) not firing while a background task was running in Agent SDK, IDE and claude remote-control sessions
- Fixed a mod's prompt.submit rewrite being silently dropped, sending the prompt as typed, for some prompts with a pasted image or an image that can't be read
- Fixed a Remote Control prompt being lost when another queued prompt in the same batch failed to deliver
- Fixed a Remote Control prompt that had passed its hooks being dropped from prompt history when Stop interrupted the next queued prompt's hook
- Fixed sign-in, MCP servers and project trust appearing lost on Linux after a sandboxed command left an empty .config.json in the config directory
- Fixed /sandbox reporting success when its setting could not be saved because the project folder is not writable; it now says nothing changed and why
- Fixed SDK and headless sessions staying in auto mode after the host switched to a model that doesn't support auto mode
- Fixed MCP servers named constructor or prototype in an MCP config never being connected
- Fixed tools of an MCP server named constructor or toString asking for permission in auto mode and bypass permissions mode
- Fixed a spurious "synced[0] commands path not found" plugin error at startup when another Claude Code process had just updated a claude.ai-synced plugin
- Fixed the Artifact tool advising a retry when a publish that requests connectors or other access was refused by the server or a proxy (HTTP 403); it now says so and what to tell the user
- Fixed Cowork cloud sessions staying on an old account plugin after a plugin reload that timed out or a restart that reused a recent sync
- Fixed document blocks being dropped from your own message sent while Claude is working
- Fixed Claude in Chrome asking for permission while no browser is connected; it now says the extension is not connected
- Fixed the fullscreen "Update installed" notice being hidden behind the idle "/clear to save tokens" hint; it now shows beside the hint
- Fixed a mod hook, with or without a .catch, being run again without end when it waits on another mod's noun that does its work outside the call
- Fixed the Claude apps gateway serving models that a policy's availableModelsMatch: exact or deniedModels blocks; it now answers 400 and leaves them out of its model lists
- Fixed the server-managed settings request to Anthropic carrying a third-party gateway's API key when a managed settings file sets ANTHROPIC_BASE_URL
- Fixed streams through a custom ANTHROPIC_BASE_URL being aborted after 180 seconds with no data arriving; they now wait 300 seconds, whether or not feature flags are loaded
- Fixed a mod's tool.describe or prompt.section answer that changed after $.ui.invalidate never reaching Claude; the new answer is now sent on the next turn
- Fixed a settings file being ignored when enabledMcpjsonServers or disabledMcpjsonServers held a single server name (letters, digits, - or _) as a plain string
- 新增 CLAUDE_CODE_DISABLE_FILE_MENTIONS 环境变量:Claude 通过文件工具获取 @ 提及文件的文件路径,而非文件内容
- 终端新增空闲压缩功能:若包含 20 万+ token 的对话在约 54 分钟内处于空闲状态,将在其一小时提示词缓存过期前进行压缩,这样你发送下一条消息时就不会重新处理所有内容
- 新增 CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS 以更改空闲压缩的 20 万 token 最低阈值;settings.json 中的 "idleCompaction": false 可关闭此功能。两者均需 v2.1.290 或更高版本
- 新增 $.prompt.media,以便由托管设置安装的 mod 的 prompt.submit 钩子读取附加到提示的图片或文档的字节数据
- 为托管设置安装的 mod 新增 $.session.identity():用于了解会话的登录方式,以及在 managed forceLoginOrgUUID 列出该组织时,其所属组织和邮箱信息
- 向 mod 的 Box 组件的 Text 和命名间距步骤(xs 至 xl)新增 size、weight、mono 和 tabular 属性;bold 已弃用,建议使用 weight
- claude self-hosted-runner 编排器新增 --shutdown-drain-sec 参数:收到 SIGTERM 信号时停止轮询,并允许当前正在进行的轮询及运行中的 spawn 钩子最多在该秒数内完成
- mod 的 skill.prompt 钩子接收的数据中新增技能的 frontmatter、来源、插件名称和文件路径
- 智能体视图新增 /effort 和 /fast 命令,用于设置新会话的默认配置;此时直接输入 /model、/effort 或 /fast 将打开选择器
- 智能体视图预览面板中,为使用 --safe-mode 启动的后台会话新增一行“安全模式”标识
- 当可用 bypass permissions 时,计划模式不会在大多数编辑或命令前询问,此时会显示一次性提示说明
- claude plugin eval 新增 --disallow-tools 参数及 disallowed_tools 用例字段,以便在评估运行中将特定的内置工具(如 Agent)排除在外
- 支持在 Claude Desktop 的代码标签页中关闭归属声明块:在 Claude apps gateway 代码策略的环境变量中设置 CLAUDE_CODE_ATTRIBUTION_HEADER=0
- 在 Claude apps gateway 后端的 Claude Code 会话的归属声明块中新增字段;可通过设置 CLAUDE_CODE_ATTRIBUTION_HEADER=0 移除该声明块
- session.append mod 钩子新增队列门控功能,使 mod 能够生成与发送提示不同的转录记录队列
- 在 /plugin 和 claude plugin validate 中新增说明:当组织管理 Claude Code 时,会跳过某些 mod 钩子的命名检查
- 新增 /usage 警告,涵盖最大努力模式、工作流、始终在线上下文以及大型工具结果
- 修复了被拒绝的云端会话的错误,当使用 apiKeyHelper 中的密钥时,该错误可能会指向错误的组织
- 修复了自定义 ANTHROPIC_BASE_URL 以 "Prompt is too long · automatic compaction failed" 结尾、在接近 200K token 时未发送请求而是卡在网关特定模型名称上的会话问题
- 修复了一个插件(mod),它在每轮结束时提交提示词,导致无头运行超出 --max-turns、--max-budget-usd、中断或主机对话结束的限制
- 修复了云端会话有时在工具组的一行标签后显示模型的后续文本的问题
- 修复了在 accept-edits 模式下,当配置目录路径中不包含 .claude 时,Write 和 Edit 工具在未询问的情况下在会话的 mods 文件夹中创建插件的问题
- 修复了已安装的插件在远程关闭后仍在打开的会话中继续运行的问题;现在它们会在轮次之间卸载
- 修复了 Cowork 和 claude.ai 云端会话中的 Edit 和 Retry 功能在消息停止但其 UserPromptSubmit 或插件 prompt.submit 钩子仍在运行时失败的问题(2.1.296 版本回归)
- 修复了未提供描述的代理队友在任务描述中保留了其提示词中的部分凭据的问题
- 修复了当大量事件无法通过慢速连接完成上传时,Remote Control 或云端会话的 claude.ai 视图冻结的问题
- 修复了沙盒化 shell 命令能够写入 --plugin-dir 文件夹的问题,而该文件夹的代码由 Claude Code 在沙盒外重新加载并运行
- 修复了在使用重度调试日志记录(--debug, --debug-file)时的内存增长问题,以及当调试日志位于停止接受写入的磁盘或网络挂载上时退出挂起的问题
- 修复了当调试输出发送到 stderr 且父进程停止读取它时无界内存增长的问题
- 修复了对不运行 rm 的 shell -c 脚本发出 rm 提示的问题。在 Claude Code 无法读取的脚本中运行时动态构建的 rm 不再发出提示,除非设置 CLAUDE_CODE_STRICT_INLINE_SHELL_RM_PROMPT=1
- 修复了在全屏模式下双击展开的转录行中的单词时,该行被折叠而不是选中单词的问题
- 修复了 claude mcp list、claude doctor 和 /status 将空的 .mcp.json 报告为无效的问题
- 修复了在全屏查看器向上滚动时询问 /btw 导致转录跳转到底部的问题
- 修复了在 WSL2 上使用 bwrap 的沙盒命令失败的问题,错误信息为:Can't mkdir /mnt/c/Program Files/ClaudeCode,当沙盒可以写入 Windows 驱动器时
- 在 Agent SDK、IDE 和 Claude 远程控制会话中运行后台任务时,修复了定时唤醒(ScheduleWakeup)未触发的问题
- 修复了某些包含粘贴图片或无法读取图片的提示词,其 prompt.submit 重写被静默丢弃,导致按原样发送提示词的问题
- 修复了在同一个批次中另一个排队提示词投递失败时,远程控制提示词丢失的问题
- 修复了当 Stop 中断下一个排队提示词的钩子时,已通过钩子的远程控制提示词从提示词历史中被丢弃的问题
- 修复了在 Linux 上,沙盒命令在配置目录中留下空的 .config.json 后,登录状态、MCP 服务器和项目信任关系看似丢失的问题
- 修复了当项目文件夹不可写导致设置无法保存时,/sandbox 仍报告成功的问题;现在它会显示未进行任何更改及其原因
- 修复了主机切换到不支持自动模式的模型后,SDK 和无头会话仍停留在自动模式的问题
- 修复了 MCP 配置中名为 constructor 或 prototype 的 MCP 服务器从未连接的问题
- 修复了名为 constructor 或 toString 的 MCP 服务器的工具在自动模式和绕过权限模式下请求权限的问题
- 修复了启动时因另一个 Claude Code 进程刚刚更新了 claude.ai-synced 插件而出现的虚假“synced[0] commands path not found”插件错误
- 修复了当请求连接器或其他访问权限的发布被服务器或代理拒绝(HTTP 403)时,Artifact 工具建议重试的问题;现在它会说明情况并告知用户该怎么做
- 修复了插件重载超时或重启复用了最近的同步后,Cowork 云会话停留在旧账户插件上的问题
- 修复了在 Claude 处理过程中发送自己的消息时,文档块被丢弃的问题
- 修复了 Chrome 中的 Claude 在无浏览器连接时请求权限的问题;现在它会提示扩展程序未连接
- 修复了全屏“Update installed”通知被空闲时的“/clear to save tokens”提示隐藏的问题;现在它会显示在提示旁边
- 修复了带有或不带 .catch 的 mod 钩子在等待另一个在其调用外部执行工作的 mod 的名词时,再次无终止地运行的问题
- 修复了 Claude 应用网关提供策略中 availableModelsMatch: exact 或 deniedModels 所阻止的模型的问题;现在它会返回 400 并从其模型列表中排除这些模型
- 修复了当托管设置文件设置了 ANTHROPIC_BASE_URL 时,向 Anthropic 发出的服务器托管设置请求携带第三方网关 API 密钥的问题
- 修复了通过自定义 ANTHROPIC_BASE_URL 建立的流在 180 秒内无数据到达时被中止的问题;现在无论功能标志是否加载,都会等待 300 秒
- 修复了 mod 的 tool.describe 或 prompt.section 回答在 $.ui.invalidate 从未触发 Claude 的情况下发生更改的问题;新的回答将在下一轮发送
- 修复了当 enabledMcpjsonServers 或 disabledMcpjsonServers 包含单个服务器名称(字母、数字、- 或 _)作为普通字符串时,设置文件被忽略的问题
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力