精选85Claude Code(GitHub Releases)AI 编程与模型
Claude Code v2.1.248:新增 --restricted 受限模式
v2.1.248
推荐理由
Claude Code 用户注意:新增 --restricted 模式可限制工具权限,适合安全敏感场景;同时修复了长会话缓存未命中问题,建议升级。
What's changed
变更内容
- Added --restricted (or CLAUDE_CODE_RESTRICTED=1): removes the built-in tools that run commands or code and WebFetch (unless named in --tools), keeps file tools inside the working directory, refuses bypassPermissions, and ignores user, project and local settings files
- Added experimental.cacheTtl ("5m" or "1h") to agent frontmatter: a per-agent prompt cache TTL used when no subagent TTL setting is configured
- Added claude self-hosted-runner --client-label <label> (or SELF_HOSTED_RUNNER_CLIENT_LABEL) to override the label the runner registers with (default: hostname)
- Added server-managed settings diagnostics: a startup warning when the settings fail to load, and a /doctor and /status line explaining a load failure or why they weren't fetched (Bedrock/Vertex/third-party provider, custom ANTHROPIC_BASE_URL)
- Added a warning in /web-setup when the GitHub CLI token lacks the workflow scope, since pushes to very large repositories can be rejected without it
- Added /usage-credits for Enterprise organizations billed through AWS Marketplace, self-serve Enterprise, and Enterprise trials, so members can request a higher usage limit from their admin
- Added cross-session messaging (SendMessage / ListAgents) between sessions on the same machine on Bedrock, Vertex, and Foundry, and when telemetry is disabled
- Fixed a prompt-cache miss (and lost extended-thinking context) roughly once an hour in long sessions, caused by tool definitions being re-rendered after an OAuth token refresh
- Fixed the ScheduleWakeup tool definition changing between a session and its --resume when the account had entered usage overage, causing a full prompt-cache miss on the resumed session's first turn
- Fixed Claude Desktop and Cowork sessions disappearing after 30 days: the transcript cleanup now keeps desktop-written sessions while they are in the app (unless org policy manages retention); the new desktopSessionCleanupPeriodDays setting caps the exemption
- Fixed being sent to the login screen when another Claude Code process held the token refresh lock while the session token had expired; the request now fails with a retryable error instead
- Windows: Fixed the claude agents list not responding to the keyboard after detaching from a session, or when launched in a terminal tab left in win32-input-mode
- Fixed the recommended Console sign-in in /login failing with an OAuth error before showing a sign-in URL on machines where it can't be used (for example when ANTHROPIC_API_KEY or an API key helper is set); it now falls back to the API-key sign-in
- Fixed model names in /model and fast-mode switch notices to render as code, so suffixes like [1m] display literally instead of as a link
- Fixed claude agents skipping the workspace trust prompt when the CI environment variable is set
- Fixed claude agents crashing on launch when the PR-status cache held a malformed entry
- Fixed agent view resurrecting a weeks-old background session after the machine was off: such a session now shows as stopped at its real end, and opening it asks before resuming its saved conversation
- Fixed agent view sometimes opening an older conversation, and dropping the typed prompt, when starting a new session
- Fixed claude agents: opening a stopped session that you already resumed in another terminal no longer starts a second process on that conversation; the row now says it is open in a terminal
- Fixed claude agents and claude rm refusing to delete a session ("has commits that are not pushed anywhere") when its worktree branch was already merged into your checked-out default branch (e.g. local main) but not yet pushed
- Fixed background sessions waiting silently when a PermissionRequest or PreToolUse hook prints an invalid answer: the claude agents row now names the hook and the schema error
- Fixed hooks silently treating a stdout {…} object that isn't valid JSON as plain text; it's now reported as a hook error with the parse message
- Fixed /mcp listing a project .mcp.json entry that declares the claude.ai connector type under the trusted "claude.ai" heading; it now appears under its real scope
- Fixed MCP servers whose headersHelper supplies the Authorization header falling into OAuth discovery on a 401 instead of re-running the helper and retrying the call as documented
- Fixed /login to a Claude apps gateway hanging when the managed-settings security approval dialog was required
- Fixed gateway model discovery (CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY) never running when apiKeyHelper is the only credential
- Fixed claude logs leaving mouse tracking, bracketed paste and the alternate screen switched on in the terminal it was run from
- Fixed the trust dialog's list of repo permission rules showing a garbled character when a long rule was cut off in the middle of an emoji
- Fixed the permission mode indicator staying hidden behind the "Press Ctrl-C again to exit" hint when you press shift+tab right after ctrl+c
- Fixed /ultrareview and locally seeded cloud sessions uploading uncommitted edits to prod.env-style and *.tfvars files, or to editor swap, temp, and backup copies of credential files (e.g. key.pem.tmp, id_rsa.swo); they now stay on your machine
- Fixed Remote Control sessions occasionally never showing a permission prompt or the latest messages on the connected device after the CLI silently reconnected
- Fixed cloud sessions occasionally failing at startup when the container's session credentials were not yet readable
- Fixed claude remote-control rejecting its own flags (e.g. --spawn, --name) when a global flag or a wrapper-injected option precedes the subcommand
- Fixed startup warnings (e.g. "N MCP servers need authentication") rendering one column right of the rest of the transcript
- Fixed a backgrounded worktree session losing its checkout: the background session now holds the worktree's lock while it runs, so cleanup and git worktree remove leave it alone
- Fixed @-mentions of other sessions not matching names typed with non-Latin characters (for example Korean entered through an IME)
- Fixed an invalid crossSessionInbound value being silently ignored: it now warns and holds cross-session messages (user settings) or refuses them (managed settings) until fixed
- Fixed rate-limit, usage, and fast-mode messages telling you to run /usage-credits when that command isn't available for your organization (e.g. hidden with DISABLE_EXTRA_USAGE_COMMAND)
- [VSCode] Fixed a chat tab getting stuck on "No conversation found" when its session was never saved; it now starts a new conversation instead
- Improved the Workflow tool's prompt footprint: its description is now about 1k tokens instead of 5.7k, with the script-writing reference moved into a bundled workflow-authoring skill
- Improved the prompt-footer PR badge to check GitHub less often while the pull request is unchanged; a push or a gh pr command still refreshes it right away
- Improved managed settings: client-side timeout, MCP startup-mode, and stream-watchdog env vars no longer trigger the settings-approval prompt
- Improved /ultrareview <PR#> to check before launch that the GitHub account connected to your Claude account can access the repository, and to explain how to fix it, instead of failing after the cloud session starts
- Improved cross-session messaging: falls back to a private per-user /tmp directory when the default one can't be used, and the notice and /status name the directory to fix
- Changed shift+enter in the agent view dispatch input to insert a newline (matching the prompt); ctrl+enter now dispatches and attaches
- Changed /loop: self-paced dynamic mode and the no-prompt autonomous default are now always available, including on Bedrock/Vertex/Foundry
- Changed Anthropic telemetry export failures to log at debug level as [Anthropic telemetry] instead of [3P telemetry] OTEL diag error, so they are not mistaken for your OTel collector failing
- 新增 --restricted(或 CLAUDE_CODE_RESTRICTED=1):移除运行命令或代码的内置工具及 WebFetch(除非在 --tools 中指定),将文件工具限制在工作目录内,拒绝 bypassPermissions,并忽略用户、项目和本地设置文件。
- 在 agent frontmatter 中新增 experimental.cacheTtl("5m" 或 "1h"):当未配置子代理 TTL 设置时,用于每个代理的提示缓存 TTL。
- 新增 claude self-hosted-runner --client-label <label>(或 SELF_HOSTED_RUNNER_CLIENT_LABEL)以覆盖 runner 注册时使用的标签(默认:主机名)。
- 新增服务器管理的设置诊断:当设置加载失败时启动警告,以及 /doctor 和 /status 行解释加载失败原因或为何未获取设置(Bedrock/Vertex/第三方提供商、自定义 ANTHROPIC_BASE_URL)。
- 在 /web-setup 中新增警告,当 GitHub CLI 令牌缺少 workflow 作用域时,因为缺少该作用域可能导致推送到非常大的仓库被拒绝。
- 为通过 AWS Marketplace 计费的企业组织、自助企业版和企业试用版新增 /usage-credits,以便成员可以向管理员请求更高的使用限制。
- 在 Bedrock、Vertex 和 Foundry 上,以及遥测禁用时,新增同一机器上会话之间的跨会话消息传递(SendMessage / ListAgents)。
- 修复了长时间会话中大约每小时发生一次的提示缓存未命中(以及丢失扩展思考上下文)的问题,该问题由 OAuth 令牌刷新后工具定义被重新渲染引起。
- 修复了当账户进入使用超额时,ScheduleWakeup 工具定义在会话及其 --resume 之间发生变化,导致恢复会话的第一轮完全提示缓存未命中的问题。
- 修复了 Claude Desktop 和 Cowork 会话在 30 天后消失的问题:转录清理现在会保留应用内桌面写入的会话(除非组织策略管理保留);新的 desktopSessionCleanupPeriodDays 设置限制了此豁免。
- 修复了当另一个 Claude Code 进程持有令牌刷新锁且会话令牌已过期时,被发送到登录屏幕的问题;现在请求会以可重试的错误失败。
- Windows:修复了从会话分离后或在保留 win32-input-mode 的终端标签页中启动时,claude agents 列表不响应键盘的问题。
- 修复了 /login 中推荐的 Console 登录在无法使用的情况下(例如设置了 ANTHROPIC_API_KEY 或 API 密钥助手)显示登录 URL 之前因 OAuth 错误而失败的问题;现在会回退到 API 密钥登录。
- 修复了 /model 和快速模式切换通知中的模型名称未以代码形式显示的问题,现在后缀如 [1m] 会按字面显示,而不是作为链接。
- 修复了当设置 CI 环境变量时,claude agents 跳过工作区信任提示的问题。
- 修复了当 PR 状态缓存包含格式错误的条目时,claude agents 启动时崩溃的问题。
- 修复了机器关闭后,agent 视图恢复数周前的后台会话的问题:此类会话现在显示为在其实际结束时间停止,打开时会询问是否恢复其保存的对话。
- 修复了启动新会话时,agent 视图有时会打开较旧的对话并丢失已输入的提示的问题。
- 修复了 claude agents:打开已在另一个终端中恢复的已停止会话时,不再在该对话上启动第二个进程;该行现在显示为“在终端中打开”。
- 修复了 claude agents 和 claude rm 在会话的工作树分支已合并到您检出的默认分支(例如本地 main)但尚未推送时,拒绝删除会话(“有未推送到任何地方的提交”)的问题。
- 修复了当 PermissionRequest 或 PreToolUse 钩子打印无效答案时,后台会话静默等待的问题:claude agents 行现在会显示钩子名称和模式错误。
- 修复了钩子将 stdout 中不是有效 JSON 的 {…} 对象静默视为纯文本的问题;现在会报告为钩子错误,并附带解析消息。
- 修复了 /mcp 在受信任的“claude.ai”标题下列出声明了 claude.ai 连接器类型的项目 .mcp.json 条目;现在会显示在其实际作用域下。
- 修复了 headersHelper 提供 Authorization 头的 MCP 服务器在收到 401 时进入 OAuth 发现,而不是按文档重新运行助手并重试调用的问题。
- 修复了当需要托管设置安全审批对话框时,/login 到 Claude apps 网关挂起的问题。
- 修复了当 apiKeyHelper 是唯一凭据时,网关模型发现(CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY)从未运行的问题。
- 修复了 claude logs 在运行它的终端中留下鼠标跟踪、括号粘贴和备用屏幕开启的问题。
- 修复了信任对话框中的仓库权限规则列表在长规则被截断在表情符号中间时显示乱码字符的问题。
- 修复了在按ctrl+c后紧接着按shift+tab时,权限模式指示器隐藏在“再次按Ctrl-C退出”提示后面的问题
- 修复了/ultrareview和本地种子云会话将未提交的编辑上传到prod.env样式和*.tfvars文件,或上传到凭证文件的编辑器交换、临时和备份副本(如key.pem.tmp、id_rsa.swo)的问题;现在这些文件保留在您的机器上
- 修复了CLI静默重新连接后,远程控制会话偶尔在连接的设备上不显示权限提示或最新消息的问题
- 修复了当容器的会话凭证尚不可读时,云会话偶尔在启动时失败的问题
- 修复了当全局标志或包装器注入的选项位于子命令之前时,claude远程控制拒绝其自身标志(如--spawn、--name)的问题
- 修复了启动警告(如“N个MCP服务器需要认证”)渲染在记录文本右侧一列的问题
- 修复了后台工作树会话丢失其检出状态的问题:后台会话现在在运行时持有工作树的锁,因此清理和git worktree remove不会干扰它
- 修复了@提及其他会话时无法匹配使用非拉丁字符输入的名称(例如通过输入法输入的韩文)的问题
- 修复了无效的crossSessionInbound值被静默忽略的问题:现在它会发出警告,并保留跨会话消息(用户设置)或拒绝它们(托管设置),直到修复为止
- 修复了速率限制、使用量和快速模式消息提示您运行/usage-credits,但该命令在您的组织中不可用(例如通过DISABLE_EXTRA_USAGE_COMMAND隐藏)的问题
- [VSCode] 修复了当会话从未保存时,聊天标签页卡在“未找到对话”的问题;现在它会改为开始新对话
- 改进了Workflow工具的提示占用:其描述现在约为1k个令牌,而不是5.7k,脚本编写参考已移至捆绑的工作流编写技能中
- 改进了提示页脚PR徽章,在拉取请求未更改时减少对GitHub的检查频率;推送或gh pr命令仍会立即刷新它
- 改进了托管设置:客户端超时、MCP启动模式和流看门狗环境变量不再触发设置批准提示
- 改进了/ultrareview <PR#>,在启动前检查与您的Claude账户关联的GitHub账户是否可以访问该仓库,并解释如何修复,而不是在云会话启动后失败
- 改进跨会话消息传递:当默认目录不可用时,回退到每个用户的私有 /tmp 目录,并在通知和 /status 中指明该目录以进行修复
- 更改了代理视图调度输入中的 shift+enter 行为,现在插入换行(与提示符一致);ctrl+enter 现在用于调度并附加
- 更改了 /loop:自定步调动态模式和无提示自主默认现在始终可用,包括在 Bedrock/Vertex/Foundry 上
- 将 Anthropic 遥测导出失败日志级别改为调试,并标记为 [Anthropic telemetry] 而非 [3P telemetry] OTEL 诊断错误,以免与您的 OTel 收集器故障混淆
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力