Claude Code 2.1.248
Highlights in this release
New 14
Restricted mode narrows tools and settings
Run claude --restricted, or CLAUDE_CODE_RESTRICTED=1 claude, when Claude Code should work within a narrower boundary. It removes built-in tools that execute commands or code and removes WebFetch, unless you explicitly name a tool in --tools; this is not a promise of no network access. File tools stay inside the working directory, bypassPermissions is refused, and user, project, and local settings files are ignored. ⟦Think of packing a small work kit for a trip: it contains only the named equipment, and that equipment has a limited work area.⟧
Original changelog
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
Each agent can set a prompt-cache lifetime
An agent can now carry its own prompt-cache lifetime in its frontmatter. ⟦It is like putting a separate use-by label on each container in a refrigerator instead of giving the entire refrigerator one date.⟧ Set experimental.cacheTtl to "5m" or "1h". This per-agent value is used only when no subagent TTL setting has been configured. Copy this frontmatter example:
```
---
name: reviewer
experimental:
cacheTtl: "1h"
---
```
Original changelog
Added experimental.cacheTtl ("5m" or "1h") to agent frontmatter: a per-agent prompt cache TTL used when no subagent TTL setting is configured
Self-hosted runners can register a clearer label
A row of self-hosted runners labeled only by hostname can be hard to identify. Override the registration label with --client-label; hostname remains the default. Run:
```
claude self-hosted-runner --client-label ci-box-3
```
Or set the environment variable:
```
export SELF_HOSTED_RUNNER_CLIENT_LABEL=ci-box-3
```
Both forms override the registration label. ⟦It is a moving box labeled by room instead of only “box N”: the contents do not change, but the person sorting boxes knows where it belongs.⟧
Original changelog
Added claude self-hosted-runner --client-label <label> (or SELF_HOSTED_RUNNER_CLIENT_LABEL) to override the label the runner registers with (default: hostname)
Managed-settings failures now explain themselves
A centrally managed setting could fail to load without giving users a useful starting point. ⟦Now the building-management notice says whether the records failed to load or whether this building never fetches from that source.⟧ Startup shows a warning, while /doctor and /status add a line explaining the load failure or why settings were not fetched. The latter covers Bedrock, Vertex, third-party providers, and a custom ANTHROPIC_BASE_URL. It is diagnosis, not an automatic repair.
Original changelog
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)
Web setup warns about a missing workflow scope
During /web-setup, Claude Code now warns if the GitHub CLI token lacks the workflow scope. Without that scope, a push to a very large repository can be rejected. This is a warning about a possible failure, not a claim that every push will fail, and /web-setup does not grant the scope for you. ⟦Before household electrical work, an electrician checks whether the meter capacity can run heavy equipment: insufficient capacity may trip the power during a large job, so it is a prompt to check, not a claim that the work cannot happen or an offer to replace the meter.⟧
Original changelog
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
Eligible enterprise members can request more usage
Members of eligible Enterprise organizations can now run /usage-credits to ask an administrator for a higher usage limit. Eligibility covers organizations billed through AWS Marketplace, self-serve Enterprise, and Enterprise trials. Rate-limit, usage, and fast-mode messages also stop recommending the command when the organization does not offer it, including when DISABLE_EXTRA_USAGE_COMMAND hides it. ⟦It works like a company purchasing office: eligible staff get a request form, while departments without that process are not told to submit a form that does not exist.⟧
Original changelog
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
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)
Cross-session messaging reaches more environments
Sessions on the same machine can now use SendMessage and ListAgents on Bedrock, Vertex, Foundry, and when telemetry is disabled. ⟦Picture pneumatic tubes between office desks: more office sections now connect, and a broken default chute sends each person's capsules through that person's private backup tube.⟧ If the default /tmp cannot be used, messaging falls back to a private per-user /tmp directory; the notice and /status name it. Mentions also match non-Latin session names, including Korean entered through an IME.
Original changelog
Added cross-session messaging (SendMessage / ListAgents) between sessions on the same machine on Bedrock, Vertex, and Foundry, and when telemetry is disabled
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
Fixed @-mentions of other sessions not matching names typed with non-Latin characters (for example Korean entered through an IME)
Cross-session routes and trust become stricter
An invalid crossSessionInbound value is no longer ignored. The key lives in ~/.claude/settings.json; the changelog lists no valid values, so choose one from the documentation. User settings warn and hold cross-session messages, while managed settings warn and refuse them, in both cases until fixed. In Linux user namespaces, root-equivalent trust for unmapped owners is limited to canonical system directories. A reply to a subagent's SendMessage goes to the parent session conversation. ⟦The office tubes now hold or return a capsule with a bad route label, narrow what counts as internal pipework, and return a delegated reply to the sender's own desk.⟧
Original changelog
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
Changed cross-session messaging in Linux user namespaces: root-equivalent trust for unmapped owners is limited to canonical system directories
Changed SendMessage from a subagent to another session: the result now notes that any reply is delivered to the parent session's conversation, not to the subagent
Agent board keyboard input and key roles work again
On Windows, the claude agents list responds to the keyboard again after detaching from a session or when launched in a terminal tab left in win32-input-mode. The dispatch input also gives its keys distinct jobs: shift+enter inserts a newline, while ctrl+enter dispatches and attaches. ⟦On the same workshop job board, the pen still marks the list after detaching a job or entering a special writing mode; starting a new line and sending the job onward each have their own key.⟧
Original changelog
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
Changed shift+enter in the agent view dispatch input to insert a newline (matching the prompt); ctrl+enter now dispatches and attaches
Ultrareview checks repository access before launch
Before /ultrareview <PR#> launches, Claude Code checks whether the GitHub account connected to your Claude account can access the repository. If not, it explains how to fix the connection before creating the cloud session instead of failing afterward. The check concerns the linked account's repository access. ⟦It is checking whether a membership covers a particular meeting room before booking it, then explaining how to fix the membership before the group arrives.⟧
Original changelog
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
Workflow's built-in prompt becomes much smaller
The Workflow tool carries its description in the prompt whenever it is available. ⟦Its pocket instruction card has been cut from about 5.7k tokens to about 1k, while the detailed script-writing manual now sits in the bundled workflow-authoring skill.⟧ The reference material was moved, not removed. This change reduces prompt footprint; the changelog makes no numerical promise about execution speed or output quality.
Original changelog
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
The PR badge polls less until the PR changes
The prompt-footer PR badge now checks GitHub less often while its pull request remains unchanged. A push or any gh pr command still refreshes it immediately. Automatic checking has not disappeared; explicit actions that can change the PR remain immediate triggers. ⟦A gardener stops repeatedly measuring an unchanged seedling, but measures again right after watering or pruning, avoiding duplicate notes without missing a fresh change.⟧
Original changelog
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
Loop's flexible pacing works across providers
/loop no longer loses an operating style because of the model provider. ⟦The metronome's free-tempo setting now works with every instrument: the player may set the pace, or the instrument may continue at its autonomous default without a prompt, even after moving to another performance setup.⟧ Self-paced dynamic mode and the no-prompt autonomous default are always available, including on Bedrock, Vertex, and Foundry. This expands existing modes; it does not add another mode or declare one faster.
Original changelog
Changed /loop: self-paced dynamic mode and the no-prompt autonomous default are now always available, including on Bedrock/Vertex/Foundry
Anthropic telemetry errors identify their real source
[3P telemetry] OTEL diag error could make operators suspect their own OTel collector even when Anthropic's telemetry export had failed. These failures now log at debug level as [Anthropic telemetry], identifying the source and lowering the apparent severity. The export failure itself is not claimed to be fixed; the message no longer blames the user's collector. ⟦A factory announcement labels noise from its own equipment as internal instead of mixing it with external alarms, so technicians do not dismantle a healthy outside alarm.⟧
Original changelog
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
Performance 1
Routine managed-setting variables stop asking for approval
Changing the managed environment variables for client-side timeout, MCP startup-mode, or stream-watchdog no longer triggers a settings-approval prompt. The changelog does not provide their exact variable names, so there is no new name to copy from this card. The exemption is limited to those categories. ⟦In the same property-management office, routine adjustments to equipment timing and monitoring no longer require a fresh resident signature.⟧
Original changelog
Improved managed settings: client-side timeout, MCP startup-mode, and stream-watchdog env vars no longer trigger the settings-approval prompt
Fixed 19
Long sessions stop losing cached context
A long, complex Claude session could lose its extended-thinking context when tool definitions were rendered again after an OAuth token refresh. ⟦It was a prep counter where chopped ingredients were periodically dumped out and cut again; the prepared ingredients now stay in place.⟧ The roughly hourly prompt-cache miss is fixed. ScheduleWakeup also keeps the same definition on the first --resume turn after an account enters usage overage, avoiding a full cache miss.
Original changelog
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
Agent view stops reviving or duplicating old work
After a machine wakes, you need to know where background work really stopped. ⟦The workshop job board now leaves a weeks-old ticket at its true stopping point and asks before restarting it, instead of powering old machinery as soon as the shop opens.⟧ A new session no longer opens an older conversation or drops the prompt you typed. Opening a stopped session already resumed in another terminal does not start a second process; its claude agents row says it is open in a terminal.
Original changelog
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
Agent board startup keeps its trust check and survives bad data
When claude agents opens, setting the CI environment variable no longer skips the workspace trust prompt. A malformed entry in the PR-status cache also no longer crashes launch. ⟦At the same workshop job board, the attendant still asks you to confirm use of the workspace; even a damaged ticket mixed into the tray does not make the whole board collapse when the door opens.⟧
Original changelog
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
Bad hook output no longer leaves agents waiting
A background session no longer waits silently when a PermissionRequest or PreToolUse hook prints an invalid answer. Its claude agents row names the hook and schema error. If hook stdout prints a {…} object that is not valid JSON, it is no longer accepted as plain text; Claude Code reports a hook error with the parse message. ⟦An intake clerk now returns an unreadable form with the bad field marked instead of placing it under the desk while the applicant waits forever.⟧
Original changelog
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
Active worktrees stop being removed or misjudged
If a worktree branch is already merged into the checked-out default branch, such as local main, claude agents and claude rm no longer refuse deletion merely because that merge has not been pushed. Meanwhile, a running background session holds its worktree lock. Cleanup and git worktree remove leave it alone instead of taking away its checkout. ⟦A shared-office locker can be cleared after its contents are filed, but remains locked while its owner is still using the desk.⟧
Original changelog
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 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
Token-refresh contention becomes retryable
If another Claude Code process holds the token-refresh lock just as the current session token expires, you are no longer sent to the login screen. ⟦The telephone exchange now returns a busy tone that invites a redial instead of disconnecting the call and making you establish your identity again.⟧ The request fails with a retryable error. It is still a failed request, not a promise of automatic success; the temporary lock conflict is simply no longer mistaken for a lost login.
Original changelog
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
Login falls back to an API key when Console sign-in cannot work
Some machines cannot use the recommended Console sign-in because ANTHROPIC_API_KEY or an API-key helper is set. /login used to stop with an OAuth error before even showing the sign-in URL. It now falls back to API-key sign-in and uses the credential path already available. This is a login-method fallback, separate from retrying token-refresh contention. ⟦At the telephone exchange, the operator connects an available line when the preferred extension cannot work instead of ending the call before reading the number.⟧
Original changelog
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
Claude apps gateway login and discovery stop stalling
/login no longer hangs when connecting to a Claude apps gateway requires the managed-settings security-approval dialog. Gateway model discovery also runs when apiKeyHelper is the only credential source. The environment variable named in the changelog is:
```
CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY
```
⟦The telephone exchange no longer leaves a caller on hold at an approval step, and it can still find available extensions when the assistant's line is the only contact route.⟧
Original changelog
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
MCP entries now follow their real scope
MCP entries now appear under their real scope. A project .mcp.json entry declaring the claude.ai connector type no longer appears under the trusted “claude.ai” heading. That type declaration does not change its classification. ⟦When restocking a supermarket, goods go on the aisle named by their real label, not into the promotion section because the box says “featured.”⟧
Original changelog
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
MCP authorization headers now retry as documented
When an MCP server’s headersHelper supplies the Authorization header and gets a 401, Claude Code now reruns the helper and retries the call as documented instead of entering OAuth discovery. ⟦When a vending machine returns your coin, it reads that coin again and lets you press the button once more; it does not lock up and demand that you link a different payment method.⟧
Original changelog
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
Desktop sessions survive routine transcript cleanup
A session you opened in Claude Desktop or Cowork keeps its transcript as long as the app still holds it; routine cleanup no longer deletes it after 30 days. An organization retention rule, if you have one, still wins. To put a limit on that keep-alive, add one line to ~/.claude/settings.json and change the number to the days you want (30 is the example):
```
{"desktopSessionCleanupPeriodDays": 30}
```
⟦During a museum's routine stock-take, pieces currently on display are left off the removal list; the museum can still rule how many days such a piece may stay on show before it goes back.⟧
Original changelog
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
Claude logs restores terminal modes on exit
After claude logs exits, its terminal should no longer behave as if the log viewer were still open. Claude Code now switches off mouse tracking, bracketed paste, and the alternate screen in the terminal where the command ran. The fix concerns modes enabled by claude logs; it does not claim to replace other terminal preferences. ⟦When borrowing a workbench, you may temporarily turn on a hand-following task light, label delivered materials with start and end markers, and lay down a temporary work surface; before leaving, switch off the light, remove the labels, and put away the surface so the bench is restored.⟧
Original changelog
Fixed claude logs leaving mouse tracking, bracketed paste and the alternate screen switched on in the terminal it was run from
Terminal text renders literally and lines up
Several terminal glitches had one theme: text should remain literal and columns should align. ⟦A sign printer now prints the supplied characters, never slices an emoji through its middle, and places every line on the same grid.⟧ Model names in /model and fast-mode notices render as code, so a suffix such as [1m] stays literal instead of becoming a link. Long repository-permission rules no longer show a garbled character when truncated inside an emoji. Startup warnings also align with the rest of the transcript instead of shifting one column right.
Original changelog
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 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 startup warnings (e.g. "N MCP servers need authentication") rendering one column right of the rest of the transcript
Permission mode stays visible after Ctrl-C
Pressing shift+tab immediately after ctrl+c used to leave the permission-mode indicator hidden behind “Press Ctrl-C again to exit.” The indicator now remains visible, so you can see the selected mode while the exit hint is present. The fix changes this display overlap, not what ctrl+c or shift+tab does. ⟦It is a car dashboard where a temporary reminder note no longer covers a warning lamp: both the reminder and the current mode remain readable.⟧
Original changelog
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
Temporary copies of sensitive files stay local
/ultrareview and locally seeded cloud sessions no longer upload uncommitted edits hidden in swap, temporary, or backup copies of sensitive files. This covers prod.env-style files, *.tfvars, and credential-file copies such as key.pem.tmp and id_rsa.swo; they stay on your machine. The statement is specific to these files, not every uncommitted edit. ⟦Before sending a stack of work papers, the confidential pages and their copier leftovers go back into the safe, while only approved pages leave the office.⟧
Original changelog
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
Remote Control catches up after reconnecting
After the CLI silently reconnected a Remote Control session, a connected device could remain on stale state: no permission prompt and no latest messages. ⟦An elevator panel now restores the pressed-floor lights and current trip after a brief reconnection instead of making riders infer the destination from an old display.⟧ That occasional catch-up failure is fixed. The scope is the missing prompt and messages after silent CLI reconnection, not every possible Remote Control connection problem.
Original changelog
Fixed Remote Control sessions occasionally never showing a permission prompt or the latest messages on the connected device after the CLI silently reconnected
Remote Control accepts its flags after global options
A wrapper may inject an option before the claude remote-control subcommand, and users may place a global flag there too. That prefix used to make remote-control reject its own flags, including --spawn and --name. The parser now accepts those flags despite the preceding options. ⟦On the same elevator panel, a floor pressed before yours no longer causes the panel to reject your button; each input still reaches its own control.⟧
Original changelog
Fixed claude remote-control rejecting its own flags (e.g. --spawn, --name) when a global flag or a wrapper-injected option precedes the subcommand
Cloud sessions tolerate credentials that are still becoming readable
A cloud session could occasionally fail at startup because its container's session credentials were not readable yet. Startup now handles that transition instead of treating “not readable yet” as a final failure. The changelog gives no wait duration or retry count, and does not say invalid credentials are accepted. ⟦At a dock, cargo still hanging from the crane has not been handed over yet; the crew does not count it as undelivered and takes it once it lands, managing the timing gap without recording undelivered cargo as stored.⟧
Original changelog
Fixed cloud sessions occasionally failing at startup when the container's session credentials were not yet readable
VS Code opens a new chat when no saved conversation exists
A VS Code chat tab could become stuck on “No conversation found” when its session had never been saved, meaning there was no old conversation to load. It now starts a new conversation so you can type. This does not recover missing history; it handles the specific never-saved state. ⟦A drawing app that finds no saved artwork opens a blank canvas instead of repeating that the old picture is missing while refusing to let a new one begin.⟧
Original changelog
[VSCode] Fixed a chat tab getting stuck on "No conversation found" when its session was never saved; it now starts a new conversation instead