modified Claude Code changelog View current →
--- a/changelog.md +++ b/changelog.md @@ -1,4 +1,48 @@ This page is generated from the [CHANGELOG.md on GitHub](<https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md>). Longer releases are grouped by type of change, with long lists of improvements and bug fixes collapsed. Run `claude --version` to check your installed version. + +​ + +2.1.310 + +October 23, 2026 + +**Added** + + * Added the Monitor tool and plugin monitors on Bedrock, Vertex, and Foundry, and when telemetry or nonessential traffic is disabled; long foreground sleeps are now blocked there too + * [Cloud sessions] Added Claude Code cloud sessions and Remote Control permissions to Enterprise custom roles, so Owners can control access to each by role + * [Cloud sessions] Added a Choose file button to load a cloud environment’s setup script from a file + +**Changed** + + * Changed the error for an MCP tool call that times out in a non-interactive session while the server’s elicitation is unanswered: it now tells Claude that no answer came and not to repeat the call + * [Cloud sessions] Changed turning on Cloud sessions or Remote Control in admin settings to ask for confirmation and list the custom roles that have that permission + * [Cloud sessions] Changed the cloud environment dialog to open network access, setup script and environment variables from rows instead of listing every editor at once + +Show 6 improvements + + * Improved auto mode’s prompt before the first read outside the working directories: it now says when blocking those reads makes shell commands ask for permission + * Improved memory use of non-interactive sessions (`-p`, Agent SDK) during compaction when the transcript file is very large + * Improved a mod’s `Image` to draw inside tmux with `allow-passthrough` and `focus-events` on, in kitty, Ghostty, and iTerm2 3.5+ with fullscreen rendering, where it showed only its `alt` text + * Linux: Improved `/sandbox` and the sandbox startup warning to name Ubuntu’s AppArmor restriction on user namespaces, and how to lift it, when it keeps bubblewrap from starting the sandbox + * [Cloud sessions] Improved the session start checklist to show a cloud environment’s setup script output in a scrolling box + * [Code Review] Improved the Code Review admin section to retry the first load and show one Try again banner when it still fails + +Show 14 bug fixes + + * Fixed requests failing behind some gateways and compatible servers that reject the `effort-2025-11-24` beta value or mid-conversation system messages; Claude Code now retries without them + * Fixed background cleanup deleting some recent files, such as pasted images, when `cleanupPeriodDays` is set to a very large value + * Fixed compaction after a “Prompt is too long” error keeping too much of a conversation with dense text, such as base64 or SVG, so the next request could fail again + * Fixed file read permission prompts not showing where a symbolic link leads + * Fixed a question’s auto-continue timeout firing the moment the external editor closed after a long edit + * Windows: Fixed PreToolUse and PermissionRequest hooks letting a tool call through when Git Bash is missing and the hook’s command is only quoted strings, such as a quoted path + * [VSCode] Fixed pressing Enter on the plan review card’s “Send feedback and keep planning” button approving the plan instead of sending your comments back + * [VSCode] Fixed the panel showing “Something went wrong” after “Switch branch & continue” on a cloud session opened from Session history’s Web tab + * [Cloud sessions] Fixed failed saves and archives in the cloud environment edit dialog showing no error inside the dialog + * [Cloud sessions] Fixed failed routine API token actions showing only a toast; the error now appears in the routine edit dialog + * [Claude Tag] Fixed Claude Tag treating `!` commands such as `!restart` and `!help` as ordinary messages when sent in bold, italic or strikethrough + * [Claude Tag] Fixed Claude Tag admin channel and workspace pages being replaced by a load error when a background refresh of the bundle list fails + * [Claude Tag] Fixed Claude Tag’s spend limits page in admin settings reporting that no channels match a filter while channel names are still loading + * [Code Review] Fixed the Code Review admin section hiding its repositories and switches after a failed refresh of the repository list ​
modified Explore the .claude directory View current →
--- a/claude-directory.md +++ b/claude-directory.md @@ -131,6 +131,7 @@ `projects/<project>/<session>.orphaned-<timestamp>-<suffix>.jsonl`, `projects/<project>/<session>.jsonl.superseded-<timestamp>`| A previous transcript for the session that Claude Code set aside instead of overwriting or deleting it. It doesn’t appear in the session picker `projects/<project>/<session>/subagents/`| [Subagent](</docs/en/sub-agents>) conversation transcripts, removed with the parent session transcript when it ages out `projects/<project>/<session>/tool-results/`| Large tool outputs spilled to separate files, and full-size copies of [images that MCP tools return](</docs/en/mcp#images-in-tool-results>) +`projects/<project>/<session>/mcp-tasks/`| What a resumed session needs to follow its running [MCP tasks](</docs/en/mcp#mcp-tasks-that-run-on-the-server>) again, and the results of finished tasks that Claude hasn’t read yet `file-history/<session>/`| Pre-edit snapshots of files Claude changed, used for [checkpoint restore](</docs/en/checkpointing>). Holds snapshots for the 100 most recent checkpoints; snapshot files that no retained checkpoint references are deleted, except each file’s first snapshot `plans/`| Plan files written during [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) `debug/`| Per-session debug logs, written while debug logging is on, such as when you start with [`--debug`](</docs/en/cli-reference#cli-flags>) or run `/debug`
modified Review locally with /code-review View current →
--- a/code-review-local.md +++ b/code-review-local.md @@ -121,7 +121,7 @@ To make the review run in the foreground, do one of these: * Run it in non-interactive mode, with the `-p` flag or the Agent SDK. Claude Code waits for the review and includes the findings in the response, except for `ultra`, which [doesn’t wait for the cloud review](</docs/en/ultrareview#run-ultrareview-non-interactively>). - * Set [`CLAUDE_CODE_DISABLE_BACKGROUND_TASKS`](</docs/en/env-vars>) to `1`, which also turns off every other background task feature + * Set [`CLAUDE_CODE_DISABLE_BACKGROUND_TASKS`](</docs/en/env-vars>) to `1`, which also turns off other background task features * Run `/code-review` again while an earlier review is still in progress Before v2.1.218, the review ran inside your conversation.
modified Desktop application View current →
Show diff (252 lines)
--- a/desktop.md +++ b/desktop.md @@ -937,9 +937,18 @@ ​ -Local sessions - -The desktop app does not always inherit your full shell environment. On macOS, when you launch the app from the Dock or Finder, it reads your shell profile, such as `~/.zshrc` or `~/.bashrc`, to give Claude Code `PATH` and a fixed set of Claude Code variables, but not other variables you export there. On Windows, the app inherits user and system environment variables but does not read PowerShell profiles. +Environment variables in local sessions + +To set an environment variable for a local session, add it to a saved local environment, then start a new session from that environment. Variables such as `PATH` and `CLAUDE_CONFIG_DIR` have their own instructions: + +Variable| What to do instead +---|--- +`PATH`, the folders your system searches for programs such as `npm`| See Session not finding installed tools. On Windows, Desktop doesn’t read PowerShell profiles, so set `PATH` in your user or system environment variables, then quit and reopen Desktop. +A variable for an MCP server from `claude_desktop_config.json`| Quit Desktop, set it in that server’s `env` block, then reopen Desktop +[`CLAUDE_CONFIG_DIR`](</docs/en/env-vars#variables>) or [`CLAUDE_CODE_TMPDIR`](</docs/en/env-vars#variables>)| Set it in one of the places you’d set a variable for dev servers, then quit and reopen Desktop +`API_TIMEOUT_MS`, `ANTHROPIC_BASE_URL`, or another variable Desktop sets itself| See Environment variables Desktop sets itself + +On macOS or Linux, if you already set your variable with `export` in `~/.zshrc` or `~/.bashrc`, see Exported variable missing or wrong in commands Claude runs. #### @@ -953,9 +962,10 @@ 1 -Open the environment's form - -Open **New environment** or **Edit environment**. +Open a local environment's form + + * **To create a saved local environment** : select **New environment** at the bottom of the environment selector’s menu, then the **Local** tab + * **To change one you already have** : in the environment selector, hover over a saved environment under **Local** and click the gear icon to open **Edit environment** 2 @@ -1002,6 +1012,40 @@ ​ +Exported variable missing or wrong in commands Claude runs + +If a command Claude runs on macOS or Linux doesn’t get a variable you set with `export` in `~/.zshrc` or `~/.bashrc`, or gets the wrong value, try these in order: + +1 + +Start a new session + +Ask Claude to run the command again. + +2 + +Quit and reopen Desktop + +Then start a new session. + +3 + +Check your saved variables + +If a command gets the wrong value, check whether you also set the variable in a saved environment or the local environment editor. If so, change the value there and start a new session. + +4 + +Use a saved environment + +Add the variable to a saved local environment, then start a new session from that environment. For a variable such as `PATH` or `CLAUDE_CONFIG_DIR`, follow its own instructions instead. + +Before v2.1.304, Claude Code doesn’t pass exported variables to commands, so check which version the session runs. + +#### + +​ + Environment variables Desktop sets itself If you set `API_TIMEOUT_MS` or `ANTHROPIC_BASE_URL` and nothing changed in your local sessions, it’s because Desktop sets those [variables](</docs/en/env-vars#variables>), among others, itself. A local session gets Desktop’s value whether you set yours in your shell profile, your Windows user or system variables, the local environment editor, or a saved environment. Moving yours to a settings file doesn’t help, because Claude Code [ignores that value](</docs/en/settings-reference#how-env-values-interact-with-your-shell>) in a local session. @@ -1025,7 +1069,7 @@ On models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>), Claude Code ignores the number itself in a positive `MAX_THINKING_TOKENS` value because adaptive reasoning controls thinking depth instead. On Opus 4.6 and Sonnet 4.6, set `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` to `1` to use a fixed thinking budget; Fable models, Sonnet 5 and later, Haiku 5.5, and Opus 4.7 and later always use adaptive reasoning and have no fixed-budget mode. -#### +### ​ @@ -1621,6 +1665,146 @@ * **The link isn’t valid** : Desktop shows a message that says what to fix, and doesn’t fill in the prompt. * **Desktop is older than v2.110.0** : earlier versions ignore the SSH parameters and open the new-session page with only the prompt. * **SSH sessions are turned off** : if your administrator sets the allowlist to an empty array, Desktop refuses SSH links. + +#### + +​ + +Create an SSH connection from a command + +If a command-line tool makes your remote machines on demand, add its command to `sshHostCommands` in [`~/.claude/settings.json`](</docs/en/settings#settings-files>). The environment selector then lists an item named after your entry, such as **Create Dev box**. When you select it, Desktop runs the command on your computer, saves the host that the command prints as an SSH connection, and connects. + +Connections from a command require Claude Desktop v3.6556.0 or later on macOS or Linux, signed in with a Claude account. Administrators can distribute commands to a team. + +Each entry is one connection, with one host at a time. Desktop runs the command only when you create the connection or replace its host, not each time you connect. To keep two machines at once, add a second entry. + +Desktop doesn’t stop or delete machines. Each of these keeps running, and can keep costing money, until you delete it with your tool: + + * A host that you replaced + * The host of an entry that you removed from the file, or whose `id` you changed + * A machine that your command made without Desktop saving its host, for example in these cases: + * The command fails or runs out of time + * Desktop can’t use the printed host, another connection already uses it, or your organization doesn’t allow it + * While the command runs, you cancel it, remove its entry, change its `command` or `id`, or quit Desktop + +The following example adds a connection named Dev box. If the file doesn’t exist, create it. If it already holds settings, add the key beside them. The command `acme-dev create` stands for your own tool, and `~/project` is the folder that Desktop selects on each machine your command makes: + +~/.claude/settings.json + + { + "sshHostCommands": [ + { + "id": "devbox", + "name": "Dev box", + "command": "acme-dev create", + "startDirectory": "~/project" + } + ] + } + +Each entry takes these fields, and `id`, `name`, and `command` are required: + +Field| Value +---|--- +`id`| Up to 64 ASCII letters, digits, `.`, `_`, and `-`, starting with a letter or digit. Use an `id` that no other entry in `sshHostCommands` or `sshConfigs` has. Desktop keeps the connection’s host under it, so if you change it, the connection starts over with no host and the old machine keeps running. +`name`| The connection’s name in the environment selector, up to 200 characters on one line +`command`| A program and its arguments, as Write the command describes +`sshIdentityFile`| Path to your private key, such as `~/.ssh/id_ed25519`. Leave it out to use your SSH configuration or SSH agent. +`startDirectory`| The default folder on the remote machine. Start it with `/` or `~/`, or use `~`. + +To change or remove the connection, edit its entry in the file, because the app’s SSH connection dialog doesn’t open for it. You don’t need to restart Desktop after you edit the file. If the entry doesn’t show up or you can’t select it, see If a command is missing or gray. + +##### Write the command + +Desktop starts the program directly, with no shell and no terminal: + + * **Program** : write its name, or its full path from `/`, without spaces. Desktop looks for a bare name on the `PATH` that your login shell exports. Relative paths such as `./acme-dev`, paths that start with `~`, and shell aliases and functions don’t work. + * **Arguments** : separate plain arguments with spaces. The command can hold only spaces, ASCII letters, digits, and the characters `+,-./:=@_~`, and no word can start with `~`. + * **Scripts** : if the command needs anything else, such as quotes, pipes, variables, or a URL with `?` or `&`, put it in a script. Make the script executable, start it with a `#!` line, and set `command` to its full path, such as `/Users/you/bin/make-devbox`. On macOS, keep the script out of the Documents, Desktop, and Downloads folders, where macOS can block it. + * **Input** : the program gets no input and no terminal, so it can’t prompt you there. If your tool signs you in through a browser or a prompt, sign in from a terminal first, and again whenever that sign-in lapses. + * **Environment** : the program runs in your home directory with the variables that your login shell exports. Desktop reads them when it starts, as it does for a `ProxyCommand`, so quit and reopen Desktop after you change them. + * **Time limit** : Desktop stops a program that is still running after 10 minutes. Desktop’s progress message doesn’t show the program’s output. To stop the program sooner, select **Cancel** next to that message. + +The program has to exit with code 0 and print only the host on standard output, in one of two forms: + + * **One line** : `host` or `user@host`, written as for `ssh_host` in an SSH link. To name a port, use the JSON form. + * **One JSON object** : `sshHost`, and optionally a numeric `sshPort` and a `startDirectory` that replaces the entry’s, such as `{"sshHost": "dev@devbox-1234.example.com", "sshPort": 2222}` + +To see the output that Desktop reads, run the command in a terminal with no input and with standard output in a file: + + acme-dev create < /dev/null > host.txt + +The file has to hold only the host. When you run this test, your tool makes a machine too, so delete it with your tool afterward. If your tool prints other lines before the host, such as progress messages, wrap it in a script that prints only the host. The following script prints the last line of your tool’s output. If your tool fails, the script exits with the same code, so that Desktop reports the failure: + + #!/bin/bash + out=$(mktemp) || exit + trap 'rm -f "$out"' EXIT + acme-dev create > "$out" || exit + tail -n 1 "$out" + +If the command fails, **View details** in Desktop’s message shows the last line that the command wrote to standard error, if any. + +##### Connect to a new host + +Answer two questions the first time you connect to each new host: + + * **Host key** : with OpenSSH’s default host key checking, check the key’s fingerprint, then choose whether to connect. To skip the question, have your command add the key to `~/.ssh/known_hosts` before it prints the host, using a key that your tool learned when it made the machine. For a port other than 22, that line starts with `[host]:port`. If your tool reuses host names, remove the old key’s line too. + * **Folder** : choose whether you trust the folder that you open there + +Keep host key checking on for these hosts, and keep a `known_hosts` file for them. If `StrictHostKeyChecking` is `no` or `accept-new` and `UserKnownHostsFile` is also `/dev/null` or `none`, nothing records the key. When your tool then reuses a name, you can connect to a different machine without a warning. + +##### Replace the host + +Once Dev box has a host, the selector lists Dev box among your SSH connections, and **Create Dev box** becomes **Replace Dev box’s host**. If that item isn’t in the list, look under **More**. Select it when the machine is gone or you want a fresh one. On the new-session page, the message that says Desktop can’t reach the host offers it too. Desktop runs the command again, and new sessions use the new host. + + * **A new host** : the item is gray for 10 minutes after Desktop saves a host, because a new machine can take a while to start. While a new host doesn’t answer, the new-session page keeps trying to connect for those 10 minutes. + * **Sessions on the old host** : they stay on it, and Desktop doesn’t connect to that host unless you add it back. To continue one, open the session and select **Add SSH connection**. Desktop fills in the old host. Save it as a connection of its own. + +##### Distribute commands to your team + +To give your team a connection, set `sshHostCommands` in Claude Code’s [managed settings](</docs/en/managed-settings>) file or MDM policy on each computer, not in the desktop app’s own device management policy. Users see your entries alongside their own, and the app offers no way to edit or remove an entry, theirs or yours. The following managed settings file gives users a connection named Dev box and turns off their own entries, along with Claude Code hooks from user, project, and local settings: + +managed-settings.json + + { + "sshHostCommands": [ + { + "id": "acme-devbox", + "name": "Dev box", + "command": "/usr/local/bin/acme-dev create" + } + ], + "strictPluginOnlyCustomization": ["hooks"] + } + +Before you deploy the key, settle each of these: + + * **Where to put the key** : if your MDM policy for Claude Code already sets a [policy key](</docs/en/managed-settings#how-claude-code-combines-managed-sources>), put it there. Otherwise, put it in the managed settings file. By default, such a policy outranks the file, and Desktop then ignores entries in the file. Set it on the computer even where [server-managed settings](</docs/en/server-managed-settings>) apply: Desktop ignores the key there, and in project and local settings. + * **The`id`**: if a user’s `sshHostCommands` entry has your `id`, only yours works. If any other SSH connection has it, such as one in a user’s `sshConfigs`, your entry is gray. Pick an `id` that users are unlikely to choose. + * **The program** : give its full path, because Desktop looks up a bare name on each user’s own `PATH`. The program runs as the user, with the variables that their login shell exports. + * **Users’ own entries** : Desktop treats a user’s entry like a [hook](</docs/en/hooks>), because both run a program on the computer. To allow only your entries, set [`strictPluginOnlyCustomization`](</docs/en/settings-reference#strictpluginonlycustomization>) to `["hooks"]`, or add `"hooks"` to its list. You also stop Claude Code hooks from user, project, and local settings, with no way to keep them. If you set that key or [`allowManagedHooksOnly`](</docs/en/settings-reference#allowmanagedhooksonly>) to `true` instead, you block more, as each key’s entry lists. + * **Every entry** : to turn off your entries too, set [`disableAllHooks`](</docs/en/settings-reference#disableallhooks>) in managed settings. If you set [`disableDesktopLocalSessions`](</docs/en/settings-reference#disabledesktoplocalsessions>), or an `sshHostAllowlist` that allows no host, the selector lists no **Create** or **Replace** items. + * **Where the locks count** : for these entries, Desktop reads `allowManagedHooksOnly`, `strictPluginOnlyCustomization`, and `disableAllHooks` from server-managed settings and from the computer’s own file or policy, and applies the stricter result. Every entry stays gray until Desktop has checked claude.ai for server-managed settings, even if your organization has none. + * **Allowed hosts** : if you set `sshHostAllowlist`, make sure that a pattern matches each hostname that your tool prints, and leave `user@` out of the pattern. Desktop checks the printed name only after the command has run, so a machine that the list refuses already exists, and the user has to delete it with your tool. At each connection, the resolved `HostName` has to match too. + +After you deploy the key, restart Desktop on a test computer. In the Code tab’s environment selector, look under **SSH** , or in the single **SSH** row. Your entry shows as a **Create** item, or as a gray item that gives the reason when you hover over it. If it’s missing, check where you put the key, then the cases in If a command is missing or gray. + +##### If a command is missing or gray + +The environment selector lists no **Create** or **Replace** item in these cases: + + * **The file** : `~/.claude/settings.json` has [invalid JSON or a value that the schema rejects](</docs/en/settings#fix-a-broken-settings-file>), you misspelled the key, or you put it in a project’s settings. Fix the file. + * **Platform and account** : you use Windows, or a [third-party provider](</docs/en/third-party-integrations>) instead of a Claude account. Add each host as an SSH connection yourself. + * **Your organization’s settings** : your administrator turned off local sessions, or turned off SSH sessions. Ask them whether you can use commands. + * **No`ssh` program**: Desktop couldn’t start the OpenSSH client on your computer. Install it, or ask your administrator to allow it, then restart Desktop. + +An entry that you can’t select is gray. Hover over it to see the reason: + + * **A mistake in the entry** : fix the field or the command that the message names. If the `id` is in use, give the entry another one. + * **A broken settings file** : while your own settings file is broken, your administrator’s entries may be gray, with a message that names the file. [Fix the file](</docs/en/settings#fix-a-broken-settings-file>). + * **A new host** : you can replace a host once it’s 10 minutes old. + * **Hooks are off or restricted** : your own entries work only where your own hooks can run. Remove `disableAllHooks` from your settings, or ask your administrator. + * **Settings are still loading** : every entry is gray until Desktop has loaded your organization’s [server-managed settings](</docs/en/server-managed-settings>), usually a few seconds after launch. If the entries stay gray, check your connection to claude.ai. #### @@ -1786,7 +1970,7 @@ Managed settings -Managed settings override project and user settings and apply to Claude Code sessions in Desktop. You can set these keys in your organization’s [managed settings](</docs/en/managed-settings>) file or push them remotely through the admin console. +Managed settings override project and user settings and apply to Claude Code sessions in Desktop. You can set these keys in your organization’s [managed settings](</docs/en/managed-settings>) file or push them remotely through the admin console, unless a key’s row says otherwise. Key| Description ---|--- @@ -1797,6 +1981,7 @@ `disableMobileSimulatorTools`| set to `true` to block Claude’s tools for controlling and capturing devices in the [iOS Simulator pane](</docs/en/desktop-ios-simulator#turn-off-simulator-access>). The pane stays usable for the user’s own taps; only Claude’s access is removed. The value must be the JSON boolean `true`; the string `"true"` is ignored. `disableBrowserExternalNavigation`| set to `true` to turn off external browsing in the Browser pane entirely. Neither users nor Claude can navigate to external sites, and localhost dev server previews are unaffected. The value must be the JSON boolean `true`; the string `"true"` is ignored. `sshConfigs`| pre-configure SSH connections that appear in the environment selector. Users can’t delete managed connections or edit anything but their own **Worktree folder**. +`sshHostCommands`| give users SSH connections whose host comes from a command, alongside their own. Desktop reads it from the managed settings file or MDM policy on the computer, and ignores it in [server-managed settings](</docs/en/server-managed-settings>). Requires Claude Desktop v3.6556.0 or later on macOS or Linux, signed in with a Claude account. `sshHostAllowlist`| restrict SSH sessions to hosts whose resolved hostname matches one of these patterns. Read from managed settings only. `disableDesktopLocalSessions`| set to `true` to turn off Code sessions that run on the device, leaving SSH sessions to other hosts and cloud sessions available. The value must be the JSON boolean `true`. Read from managed settings only. Requires Claude Desktop v1.37937.0 or later. `disableSshSavedPasswords`| set to `true` to stop Desktop from offering to remember SSH passwords and from using or showing the ones it saved earlier. Turning it on doesn’t delete them. Read from managed settings only. Requires Claude Desktop v1.49585.0 or later.
modified Environment variables View current →
--- a/env-vars.md +++ b/env-vars.md @@ -215,7 +215,7 @@ `CLAUDE_CODE_DISABLE_ATTACHMENTS`| Set to `1` to disable attachment processing. File mentions with `@` syntax are sent as plain text instead of being expanded into file content. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CLAUDE_CODE_DISABLE_AUTH_REFRESH_LOCK`| Set to `1` to make a Claude Code process run its [`gcpAuthRefresh`](</docs/en/settings-reference#gcpauthrefresh>) or [`awsAuthRefresh`](</docs/en/settings-reference#awsauthrefresh>) command itself instead of waiting while another process runs it. Requires Claude Code v2.1.286 or later `CLAUDE_CODE_DISABLE_AUTO_MEMORY`| Set to `1` to disable [auto memory](</docs/en/memory#auto-memory>). Set to `0` to force auto memory on even when `--bare` mode or [`autoMemoryEnabled: false`](</docs/en/settings-reference#automemoryenabled>) would otherwise disable it. When disabled, Claude does not create or load auto memory files -`CLAUDE_CODE_DISABLE_BACKGROUND_TASKS`| Set to `1` to disable all background task functionality, including the `run_in_background` parameter on Bash and subagent tools, auto-backgrounding, and the Ctrl+B shortcut +`CLAUDE_CODE_DISABLE_BACKGROUND_TASKS`| Set to `1` to remove the `run_in_background` parameter from the Bash, PowerShell, and subagent tools and to turn off the Ctrl+B shortcut and background runs of [forked skills](</docs/en/skills#run-skills-in-a-subagent>). Claude Code then also stops moving subagents, long MCP tool calls, and timed-out shell commands to the background automatically. [MCP tasks](</docs/en/mcp#make-claude-wait-for-the-result-of-an-mcp-task>) and the [Monitor tool](</docs/en/tools-reference#monitor-tool>) still run in the background `CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_DEFAULT`| Set to `1` to stop Claude Code from treating an [Amazon Bedrock](</docs/en/amazon-bedrock>) streaming response with a missing or empty `Content-Type` header as Amazon Bedrock’s binary event stream. By default, Claude Code assumes a gateway dropped the header from an otherwise unmodified response, so it decodes the body and streaming keeps working. Set this only for a gateway that also re-emits the stream as server-sent events; Claude Code then reads the header-less body as server-sent events instead. Requires Claude Code v2.1.239 or later `CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_GUARD`| Set to `1` to skip the check that an [Amazon Bedrock](</docs/en/amazon-bedrock>) streaming response carries the `application/vnd.amazon.eventstream` content-type. Without this variable, when a response carries a different content-type, Claude Code fails the request with an error naming that type, which means a [gateway or proxy is transforming the response](</docs/en/amazon-bedrock#streaming-errors-behind-a-gateway-or-proxy>). Configure the gateway to forward the `Content-Type` header and body unmodified rather than setting this variable. Requires Claude Code v2.1.208 or later `CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF`| Set to `1` to stop a [background session’s](</docs/en/agent-view>) in-flight work when the [supervisor](</docs/en/agent-view#the-supervisor-process>) stops, restarts, or updates that session’s process, instead of handing it to the session’s next process. That work is the session’s running background shell commands and dynamic workflows, plus background subagents as of v2.1.198. Affects only that handoff: backgrounding a session with `←` or [`/background`](</docs/en/agent-view#from-inside-a-session>) still carries in-flight background work over. Requires Claude Code v2.1.196 or later @@ -234,6 +234,7 @@ `CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS`| Set to `1` to remove built-in commit and PR workflow instructions and the git status snapshot from Claude’s context. Useful when using your own git workflow skills. Takes precedence over the [`includeGitInstructions`](</docs/en/settings-reference#includegitinstructions>) setting when set `CLAUDE_CODE_DISABLE_INLINE_SHELL_RM_PROMPT`| Set to `1` to stop Claude Code from reading scripts passed to a shell with `-c`, such as `bash -c 'rm -rf ~'`, for [critical-path](</docs/en/permission-modes#removals-inside-nested-commands-and-inline-scripts>) removals. Claude Code still checks the shell variable and positional parameter targets in those scripts, and the other critical-path checks keep running. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.288 or later `CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4 and Opus 4.1 to the current Opus version on the Anthropic API. Use when you intentionally want to pin an older model. The remap does not run on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry +`CLAUDE_CODE_DISABLE_MCP_TASK_BACKGROUND`| Set to `1` so that Claude waits for the result of an [MCP task](</docs/en/mcp#make-claude-wait-for-the-result-of-an-mcp-task>) in an interactive session. While [automatic backgrounding](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) is on, it still moves the call to the background after two minutes by default. Requires Claude Code v2.1.304 or later `CLAUDE_CODE_DISABLE_MODEL_ACCESS_FALLBACK`| Set to `1` to stop Claude Code on [Amazon Bedrock](</docs/en/amazon-bedrock#when-a-model-is-disabled-mid-session>) and [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai#when-a-model-is-disabled-mid-session>) from switching to an older model when your account loses access to a session’s model mid-session; the refused request fails at once instead. A [fallback model chain](</docs/en/model-config#fallback-model-chains>) you configure still switches on that refusal, and the [startup model checks](</docs/en/amazon-bedrock#startup-model-checks>) still fall back at launch. Requires Claude Code v2.1.285 or later `CLAUDE_CODE_DISABLE_MOUNTED_DRIVE_RM_PROMPT`| Set to `1` to turn off the [mounted drive prompt](</docs/en/permission-modes#the-mounted-drive-prompt>) for paths such as `/Volumes/USB`. Set it in the environment that launches Claude Code, because Claude Code [ignores it in a settings `env` block](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). Requires Claude Code v2.1.304 or later `CLAUDE_CODE_DISABLE_MOUSE`| Set to `1` to disable mouse tracking in [fullscreen rendering](</docs/en/fullscreen>). Keyboard scrolling with `PgUp` and `PgDn` still works. Use this to keep your terminal’s native copy-on-select behavior @@ -305,7 +306,7 @@ `CLAUDE_CODE_MAX_TURNS`| Cap the number of agentic turns when no explicit limit is passed. Equivalent to passing [`--max-turns`](</docs/en/cli-reference#cli-flags>), which takes precedence when both are set. A value that is not a positive integer is rejected at startup with an error rather than treated as no cap `CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION`| Cap on [WebSearch](</docs/en/tools-reference#session-search-limit>) calls (default: 200). When Claude reaches the cap, further WebSearch calls return a notice telling it to continue with the information it already gathered and say so in its answer. Accepts a positive whole number with no upper bound. Anything else is ignored and the default applies, so the cap can be raised but not turned off. Requires Claude Code v2.1.212 or later `CLAUDE_CODE_MCP_ALLOWLIST_ENV`| Set to `1` to spawn stdio MCP servers with only a safe baseline environment plus the server’s configured `env`, instead of inheriting your shell environment -`CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS`| Elapsed time in milliseconds before a still-running MCP tool call [moves to a background task](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) (default: 120000, or 2 minutes). Set to `0` to turn automatic backgrounding off. Requires Claude Code v2.1.212 or later +`CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS`| Elapsed time in milliseconds before a still-running MCP tool call [moves to a background task](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) (default: 120000, or 2 minutes). Set to `0` to turn automatic backgrounding off and, in an interactive session, to make Claude wait for [MCP tasks](</docs/en/mcp#make-claude-wait-for-the-result-of-an-mcp-task>). Requires Claude Code v2.1.212 or later `CLAUDE_CODE_MCP_STARTUP_WAIT_MS`| How long in milliseconds the first turn of a [non-interactive](</docs/en/headless>) session waits for MCP servers that are still connecting, in place of the default [first-turn wait](</docs/en/agent-sdk/mcp#connection-timing>). In a [self-hosted environment](</docs/en/self-hosted-environments-configuration#connection-timing>), it changes only how long the wait lasts. Some servers keep a wait of their own regardless of the value; [Connection timing](</docs/en/agent-sdk/mcp#connection-timing>) lists them. Set to `0` to skip the wait for every other server. Requires Claude Code v2.1.274 or later `CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT`| Idle timeout in milliseconds for MCP tool calls. When a stdio, HTTP, SSE, WebSocket, or [claude.ai connector](</docs/en/mcp#use-mcp-servers-from-claude-ai>) MCP server sends no response and no progress notification for this long, the tool call aborts with an error instead of waiting for the overall `MCP_TOOL_TIMEOUT`. Overrides the per-transport defaults of 300000 (5 minutes) for network servers and 1800000 (30 minutes) for stdio servers. Set to `0` to disable the idle check. Values below 1000 are raised to one second, and the value is capped at the effective `MCP_TOOL_TIMEOUT`. A per-server `timeout` in `.mcp.json` of at least 1000 raises that server’s idle window to at least the `timeout` value. Doesn’t apply to IDE servers or SDK in-process servers. Requires Claude Code v2.1.187 or later. Before v2.1.203, stdio servers were exempt from the idle timeout `CLAUDE_CODE_MESSAGING_SOCKET`| Set by Claude Code, not by you: in sessions that bind an [inbox socket](</docs/en/cross-session-messaging#the-sessions-inbox-socket>), Claude Code exports that socket’s path to hooks and Bash commands when it binds the socket. In a session that starts with messaging on, Claude Code binds the socket before any hook runs. Other sessions on the machine deliver messages to this path. Each session exports its own socket rather than one inherited from a parent, and messages arriving on it go through the session’s [inbound controls](</docs/en/cross-session-messaging#control-inbound-messages>). Settings `env` blocks can’t set it. Requires Claude Code v2.1.224 or later @@ -553,6 +554,7 @@ * Sync the [skills](</docs/en/skills#where-synced-skills-load>) and [plugins](</docs/en/plugins/loading#synced-plugins>) enabled for your claude.ai account into your terminal sessions * Turn on the [You should know mod](</docs/en/interactive-mode#you-should-know-suggestions>) * Use [the advisor tool](</docs/en/advisor#requirements>) + * Use [MCP tasks](</docs/en/mcp#mcp-tasks-that-run-on-the-server>) * Read or reply to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>) * Have Claude read [another organization’s public artifact](</docs/en/artifacts#read-an-artifact-shared-with-you>) * Get the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) by default for claude.ai and Console accounts on Windows with Git Bash installed; Claude Code routes shell commands through Git Bash unless you set `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`. On Windows without Git Bash, the tool stays on
modified Error reference View current →
--- a/errors.md +++ b/errors.md @@ -309,6 +309,7 @@ `Skipping connection (recent failure cached; retries automatically in 15 min, or edit the plugin config to retry now)`| Plugin errors `Error: No such tool available: <tool name>`| Tool errors `MCP server "<name>" connection closed before the tool call was answered`| Tool errors +`MCP server "<name>" tool "<tool>" timed out after <N>s. The server asked the user a question, and no answer came before the time limit.`| Tool errors `would be spawned with zero tools — refusing`| Tool errors `File is covered by a Read deny rule in your permission settings`| Tool errors `cannot contain null bytes (\0)`| Tool errors @@ -4222,6 +4223,23 @@ ​ +MCP tool call timed out with the server’s question unanswered + +In [non-interactive mode](</docs/en/headless>), an [MCP server](</docs/en/mcp>) asked for input through [elicitation](</docs/en/mcp#respond-to-mcp-elicitation-requests>) during a tool call, and the call’s time limit ran out before an answer came: + + MCP server "<name>" tool "<tool>" timed out after <N>s. The server asked the user a question, and no answer came before the time limit. Do not call this tool again in this turn. Tell the user that the server's question got no answer, and wait for their reply. + +Before v2.1.310, the result ended at `timed out after <N>s` and said nothing about the question. **What to do:** + + * Set up an [`Elicitation` hook](</docs/en/hooks#elicitation>) that answers the server’s requests + * In a TypeScript Agent SDK application, make your [`onElicitation`](</docs/en/agent-sdk/typescript#options>) callback return its answer before the limit runs out + * To give an answer more time, set a longer [`timeout`](</docs/en/mcp#time-limits-on-mcp-tool-calls>) in milliseconds in the server’s configuration entry, such as `"timeout": 600000` for 10 minutes + * Run the task in an interactive session instead and answer the server’s [dialog](</docs/en/mcp#respond-to-mcp-elicitation-requests>) yourself + +### + +​ + Agent would be spawned with zero tools Every entry in the subagent’s [`tools` list](</docs/en/sub-agents#supported-frontmatter-fields>) failed to match a usable tool, so Claude Code refused to launch the subagent: with no tools, it couldn’t act. The message groups your entries by what went wrong:
modified Run Claude Code programmatically View current →
--- a/headless.md +++ b/headless.md @@ -46,7 +46,7 @@ * **MCP servers** : only servers supplied on the command line connect, for example with `--mcp-config`. In an interactive session, Claude Code also skips the automatic IDE connection unless you pass `--ide`. * **System reminders** : Claude gets your prompts and the tool results without the [system reminders](</docs/en/glossary#system-reminder>) Claude Code would add alongside them. For example, Claude isn’t told when a file it read earlier changes on disk, and it doesn’t get the list of available skills, including skills from an `--add-dir` folder. - * **Background tasks** : none run. A command that reaches its [timeout](</docs/en/tools-reference#timeout-and-output-limits>) stops instead of [moving to the background](</docs/en/tools-reference#background-commands>). + * **Background tasks** : Claude can’t run background commands or background subagents, and the other features that [`CLAUDE_CODE_DISABLE_BACKGROUND_TASKS`](</docs/en/env-vars>) turns off are off too. A command that reaches its [timeout](</docs/en/tools-reference#timeout-and-output-limits>) stops instead of [moving to the background](</docs/en/tools-reference#background-commands>). Before v2.1.286, these limits held only partly: an interactive `--bare` session connected the MCP servers that a normal session would, every `--bare` session sent system reminders, and background tasks stayed available. @@ -66,6 +66,17 @@ * **Pending wakeups** : in a run whose prompt you passed as text rather than with `--input-format stream-json`, when Claude has scheduled a [self-paced `/loop` wakeup](</docs/en/scheduled-tasks#let-claude-choose-the-interval>), the run waits for each wakeup to fire and runs its iteration until the [loop ends](</docs/en/scheduled-tasks#stop-a-loop>), even past the 10-minute cap. When stderr is a terminal and the run has waited five seconds, Claude Code prints a line to stderr that starts with `Waiting for background work to finish` and names the work. With `json` or `stream-json` output, the line prints only when stdout isn’t a terminal, so the JSON your script reads never carries it. If the run reaches its [`--max-budget-usd`](</docs/en/cli-reference#cli-flags>) cap, Claude Code stops the remaining background work instead of waiting. When background work starts another turn, the run prints each turn’s result with the default `text` output and the last turn’s result with `json` output. Before v2.1.295, the run printed only the last turn’s result with `text` output too. + +#### + +​ + +MCP work when a non-interactive run ends + +A `claude -p` run doesn’t wait for MCP work in the background: + + * **[MCP tasks](</docs/en/mcp#mcp-tasks-that-run-on-the-server>)** : on a remote server the job goes on. To follow it again, [resume that session](</docs/en/mcp#exit-clear-or-resume-while-an-mcp-task-runs>), not as a one-shot `claude -p "<prompt>"` run. + * **MCP calls that[automatic backgrounding](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) moved**: the call’s result is lost. ###
modified Interactive mode View current →
--- a/interactive-mode.md +++ b/interactive-mode.md @@ -369,7 +369,7 @@ * Prompt Claude Code to run a command in the background * Press `Ctrl+B` to move a regular Bash tool invocation to the background. Tmux users must press `Ctrl+B` twice due to tmux’s prefix key. -When a command reaches its timeout before it finishes, Claude Code automatically [moves it to the background](</docs/en/tools-reference#foreground-commands-that-move-to-the-background>) instead of stopping it, unless the command starts with `sleep`. If you’ve turned background tasks off with [`CLAUDE_CODE_DISABLE_BACKGROUND_TASKS`](</docs/en/env-vars#variables>) or by starting in [bare mode](</docs/en/headless#start-faster-with-bare-mode>), the command stops at its timeout. To change the timeout, set the [Bash timeout environment variables](</docs/en/tools-reference#timeout-and-output-limits>). **Key features:** +When a command reaches its timeout before it finishes, Claude Code automatically [moves it to the background](</docs/en/tools-reference#foreground-commands-that-move-to-the-background>) instead of stopping it, unless the command starts with `sleep`. If you’ve turned background commands off with [`CLAUDE_CODE_DISABLE_BACKGROUND_TASKS`](</docs/en/env-vars#variables>) or by starting in [bare mode](</docs/en/headless#start-faster-with-bare-mode>), the command stops at its timeout. To change the timeout, set the [Bash timeout environment variables](</docs/en/tools-reference#timeout-and-output-limits>). **Key features:** * Output is written to a file and Claude can retrieve it using the Read tool * Background tasks have unique IDs for tracking and output retrieval @@ -382,7 +382,7 @@ * Background commands in a local session you work in from a terminal, the desktop app, or the VS Code extension have no time limit. In a session that runs unattended, such as a `-p` run or a cloud session, Claude Code stops a background command at its [time limit](</docs/en/tools-reference#time-limit-for-background-commands>) * A background command that a foreground [subagent](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) started ends when that subagent’s run ends, whether it finished, failed, or was interrupted; see [When a background command stops](</docs/en/tools-reference#when-a-background-command-stops>) in the tools reference -To disable all background task functionality, set the [`CLAUDE_CODE_DISABLE_BACKGROUND_TASKS`](</docs/en/env-vars#variables>) environment variable to `1`. Starting in [bare mode](</docs/en/headless#start-faster-with-bare-mode>) turns it off as well. **Common backgrounded commands:** +To turn off background commands, set the [`CLAUDE_CODE_DISABLE_BACKGROUND_TASKS`](</docs/en/env-vars#variables>) environment variable to `1`. With it set, you also lose background subagents, background forked skills, and `Ctrl+B`. Starting in [bare mode](</docs/en/headless#start-faster-with-bare-mode>) has the same effect. **Common backgrounded commands:** * Build tools (webpack, vite, make) * Package managers (npm, yarn, pnpm)
modified JetBrains IDEs View current →
--- a/jetbrains.md +++ b/jetbrains.md @@ -75,7 +75,7 @@ /ide -When the connection succeeds, Claude Code confirms with a message like `Connected to IntelliJ IDEA.` If Claude Code detects a running IDE that doesn’t have the plugin, `/ide` installs the plugin for you and asks you to restart the IDE. If you want Claude to have access to the same files as your IDE, start Claude Code from the same directory as your IDE project root. +When the connection succeeds, Claude Code confirms with a message like `Connected to IntelliJ IDEA.` If you want Claude to have access to the same files as your IDE, start Claude Code from the same directory as your IDE project root. ##
modified Monitoring View current →
--- a/monitoring-usage.md +++ b/monitoring-usage.md @@ -563,8 +563,10 @@ * `prompt.id`: UUID correlating a user prompt with all subsequent events until the next prompt. See Event correlation attributes. * `workspace.host_paths`: host workspace directories selected in the desktop app, as a string array - * `workflow.run_id`: run identifier, prefixed `wf_`, on the API and tool events emitted by agents that belong to a [Workflow](</docs/en/workflows>) tool run. Filtering events by one `workflow.run_id` reconstructs that run’s API requests and tool results. The identifier covers the agents the workflow script spawns and any agents those spawn in turn, such as skill invocations. It matches the run identifier reported in the Workflow tool result. Absent on all other events. + * `workflow.run_id`: run identifier, prefixed `wf_`, on the API and tool events emitted by agents that belong to a [Workflow](</docs/en/workflows>) tool run. Filtering events by one `workflow.run_id` reconstructs that run’s API requests and tool results. The identifier covers the agents the workflow script spawns and any agents those spawn in turn, such as skill invocations. It matches the run identifier reported in the Workflow tool result. * `workflow.name`: name of the workflow, its script’s `meta.name`, emitted alongside `workflow.run_id`. Built-in workflow names appear verbatim when the run executes the unmodified built-in script. User-authored names, including edited copies of built-in scripts, are replaced with `custom` unless `OTEL_LOG_TOOL_DETAILS=1` is set. + * `agent_id`: identifier of the [subagent](</docs/en/sub-agents>) that raised the event, such as `a3f2c1b4d5e6f7a80`. Events that carry it include a subagent’s API and tool events, its `assistant_response` events, and `subagent_completed` for the finished subagent. Absent on main-session and [in-process teammate](</docs/en/agent-teams#choose-a-display-mode>) events. The subagent’s span `agent_id` is the same value, or adds a label after the leading `a` as in `acompact-3f2c1b4d5e6f7a80`. Requires Claude Code v2.1.310 or later + * `parent_agent_id`: the `agent_id` of the agent that spawned or last resumed the subagent that raised the event. Absent when that agent is the main session. Requires Claude Code v2.1.310 or later #### @@ -737,7 +739,7 @@ `prompt.id`| UUID v4 identifier linking all events produced while processing a single user prompt `event.sequence`| 0-based counter for ordering events, counted per Claude Code process rather than per session `message.uuid`| UUID of the message as persisted in the session transcript, the `~/.claude/projects/*/*.jsonl` files. Present on `assistant_response`, on `api_response_body`, and on `user_prompt` except for command dispatches, which can produce zero or many messages. On `assistant_response` and `api_response_body`, this is the response’s final transcript entry, which the next turn’s `parentUuid` chains from. Requires Claude Code v2.1.274 or later on `api_response_body` -`request_id`| Server-assigned ID of the API request, read from the `request-id` response header, such as `req_011...`. On a response with no `request-id` header, as on [Amazon Bedrock](</docs/en/amazon-bedrock>), the value comes from the `x-amzn-requestid` header instead. Present on `api_request`, `api_error`, `api_refusal`, `assistant_response`, and `api_response_body` when the response carries either header. Matches the same attribute on the `llm_request` trace span. The `x-amzn-requestid` source requires Claude Code v2.1.282 or later +`request_id`| Server-assigned ID of the API request, read from the `request-id` response header, such as `req_011...`. On a response with no `request-id` header, as on [Amazon Bedrock](</docs/en/amazon-bedrock>), the value comes from the `x-amzn-requestid` header instead. Present on `api_request`, `api_error`, `api_refusal`, `assistant_response`, `api_response_body`, `tool_result`, and `tool_decision` when the response carries either header. Matches the same attribute on the `llm_request` trace span. The `x-amzn-requestid` source requires Claude Code v2.1.282 or later `client_request_id`| Client-generated UUID sent as the `x-client-request-id` request header. Present on `api_request` and `api_error` on first-party API connections; absent on third-party provider backends and when the request was retried through the non-streaming fallback. Pairs a request with its response and remains available for failures such as timeouts that never produced a server `request_id`. Matches the same attribute on the `llm_request` trace span To trace all activity triggered by a single prompt, filter your events by a specific `prompt.id` value. This returns the user_prompt event, any api_request events, and any tool_result events that occurred while processing that prompt. `event.sequence` starts at 0 each time a Claude Code process starts and counts up for the life of that process. It keeps counting across `/clear`, which assigns a new `session.id`. If you [resume a session without forking](</docs/en/how-claude-code-works#resume-or-fork-sessions>), the session keeps its `session.id` but takes its `event.sequence` values from the process that resumed it, so within one session a later event can carry a lower value than an earlier one, or repeat one. To order a session’s events, sort by `event.timestamp` and use `event.sequence` to order events that share a timestamp. For message-level reconstruction, each event class carries a key that matches a field in the session transcript. The transcript entry format is [internal to Claude Code](</docs/en/sessions#where-transcripts-are-stored>) and changes between versions, so a pipeline that joins on these fields can break on any release; treat the joins as version-specific rather than a stable contract: @@ -798,6 +800,7 @@ * `event.sequence`: per-process counter for ordering events, described under Event correlation attributes * `tool_name`: Name of the tool * `tool_use_id`: Unique identifier for this tool invocation. Matches the `tool_use_id` passed to hooks, allowing correlation between OTel events and hook-captured data. + * `request_id`: the `request_id` of the API response that contained this tool call, so you can join the call to that response’s API events. Absent when that response had no request ID, or when no API response contained the call. Requires Claude Code v2.1.310 or later * `success`: `"true"` or `"false"` * `duration_ms`: Execution time in milliseconds * `error_type`: Error category string when the tool failed, such as `"Error:ENOENT"` or `"ShellError"` @@ -948,6 +951,7 @@ * `event.sequence`: per-process counter for ordering events, described under Event correlation attributes * `tool_name`: Name of the tool (for example, “Read”, “Edit”, “Write”, “NotebookEdit”) * `tool_use_id`: Unique identifier for this tool invocation. Matches the `tool_use_id` passed to hooks, allowing correlation between OTel events and hook-captured data. + * `request_id`: the `request_id` of the API response that contained this tool call, so you can join the call to that response’s API events. Absent when that response had no request ID, or when no API response contained the call. Requires Claude Code v2.1.310 or later * `decision`: Either `"accept"` or `"reject"` * `tool_source`: Always present. The tool’s provenance, as a closed set of CLI-authored values: * `"builtin"`: the CLI’s own tools @@ -991,7 +995,16 @@ * For Skill tool: includes `skill_name` * For Agent tool or legacy Task tool: includes `subagent_type` -If you lower the OpenTelemetry SDK’s `OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT` below the number of attributes on a `tool_decision` event, the SDK drops the attributes that Claude Code set last. The SDK drops `permission_mode` first, `classifier_category` second, and `classifier_verdict` third, and drops the event’s other attributes only after those three. This ordering requires Claude Code v2.1.302 or later. +If you lower the OpenTelemetry SDK’s `OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT` below the number of attributes on a `tool_decision` event, the SDK drops the attributes that Claude Code set last. The SDK drops these before any other attribute, in this order, skipping any the event doesn’t carry: + + 1. `parent_agent_id` + 2. `agent_id` + 3. `request_id` + 4. `permission_mode` + 5. `classifier_category` + 6. `classifier_verdict` + +`permission_mode`, `classifier_category`, and `classifier_verdict` drop in this order on Claude Code v2.1.302 or later. `parent_agent_id`, `agent_id`, and `request_id` require v2.1.310 or later. ####
modified Customize sessions in self-hosted environments View current →
--- a/self-hosted-environments-configuration.md +++ b/self-hosted-environments-configuration.md @@ -58,10 +58,10 @@ Keep stdin and file descriptor 3 attached -The child’s stdin is the runner’s control channel. Token rotations and session-end signals arrive on it. The runner also opens a pipe on file descriptor 3 and reads the child’s activity signals from it to drive idle and startup timeouts. A plain `exec "$CLAUDE_RUNNER_CLAUDE_BIN" "$@"` preserves both automatically. If your wrapper backgrounds the child with a bare `&`, it severs the child’s stdin. The session looks healthy until the initial OAuth token’s roughly 30-minute lifetime expires, and then every API call that uses the token fails with `401 authentication_error`. If your wrapper must background the child, for example to keep a teardown trap alive, save stdin on file descriptor 4 or higher and re-attach it explicitly: - - exec 4<&0 - "$CLAUDE_RUNNER_CLAUDE_BIN" "$@" <&4 4<&- & +The child’s stdin is the runner’s control channel. Token rotations and session-end signals arrive on it. The runner also opens a pipe on file descriptor 3 and reads the child’s activity signals from it to drive idle and startup timeouts. A plain `exec "$CLAUDE_RUNNER_CLAUDE_BIN" "$@"` preserves both automatically. If your wrapper backgrounds the child with a bare `&`, it severs the child’s stdin. The session looks healthy until the initial OAuth token’s roughly 30-minute lifetime expires, and then every API call that uses the token fails with `401 authentication_error`. If your wrapper must background the child, for example to keep a teardown trap alive, save stdin on file descriptor 9 and re-attach it explicitly: + + exec 9<&0 # the runner uses 3, and from v2.1.309 reserves 4 and 5 + "$CLAUDE_RUNNER_CLAUDE_BIN" "$@" <&9 9<&- & CHILD=$! trap 'teardown' EXIT wait "$CHILD" @@ -69,6 +69,7 @@ You can redirect the child’s stdout. Keep file descriptor 3 and stderr attached to the runner: * **File descriptor 3** : carries the child’s activity signals to the runner. Don’t close it or reuse it in the wrapper. + * **File descriptors 4 and 5** : runners on Claude Code v2.1.309 or later reserve them for the child. Don’t close or reuse them in the wrapper. If your wrapper uses either, for example to save stdin, move that use to a descriptor from 6 to 9, which earlier versions leave free too. * **stderr** : when the wrapper or the child exits non-zero, the runner posts the last lines of stderr to the session and prints them in its own log. The session’s user sees those lines, so don’t print secrets to stderr, and remove `set -x` before you deploy the wrapper. If you redirect stderr, sessions still run, but the runner reports a failure with the exit code alone. ###
modified All settings View current →
--- a/settings-reference.md +++ b/settings-reference.md @@ -217,6 +217,7 @@ `spinnerVerbs`| Add or replace the verbs shown while a turn runs| Interface and terminal| Any file `sshConfigs`| Add [SSH connections](</docs/en/desktop#pre-configure-ssh-connections-for-your-team>) to the Desktop environment selector| Remote, desktop, and notifications| User or managed `sshHostAllowlist`| Limit which hosts [Desktop SSH sessions](</docs/en/desktop#restrict-which-ssh-hosts-users-can-connect-to>) can reach| Remote, desktop, and notifications| Managed +`sshHostCommands`| Add [SSH connections whose host comes from a command](</docs/en/desktop#create-an-ssh-connection-from-a-command>) to the Desktop environment selector| Remote, desktop, and notifications| User or managed `statusLine`| Run your own command to render a [status line](</docs/en/statusline>) below the prompt| Interface and terminal| Any file `strictKnownMarketplaces`| Allowlist the [marketplace](</docs/en/plugins/overview>) sources users can add and install from| Plugins and skills| Managed `strictPluginOnlyCustomization`| Block [skills](</docs/en/skills>), [agents](</docs/en/sub-agents>), [hooks](</docs/en/hooks>), and [MCP servers](</docs/en/mcp>) from user and project sources| Plugins and skills| Managed @@ -5731,6 +5732,34 @@ A value that Desktop can’t read as a list of hosts, such as `true` or an object, counts as an empty array until you correct it, except `null`, which counts as unset. Requires Claude Desktop v2.26454.0 or later. If you set `managedSourcesBehavior` to `"merge"` in your highest-ranked source, Desktop combines the lists from every [admin source](</docs/en/managed-settings#how-claude-code-combines-managed-sources>) and allows a host that matches any of them. If you set an empty array in one source, SSH sessions stay on for the hosts another source lists. +### + +​ + +`sshHostCommands` + +Add SSH connections whose host comes from a command to the [Desktop](</docs/en/desktop#create-an-ssh-connection-from-a-command>) environment selector. When you create a connection or replace its host, Desktop runs the entry’s command on your computer and connects to the host that the command prints. Requires Claude Desktop v3.6556.0 or later on macOS or Linux, signed in with a Claude account. + + * **Scope** : `User or managed`. Only the desktop app reads this key. It reads managed entries from [one managed settings file or MDM policy](</docs/en/desktop#distribute-commands-to-your-team>) on the computer, and ignores the key in [server-managed settings](</docs/en/server-managed-settings>). + * **Type** : array of objects, each with required `id`, `name`, and `command` and optional `sshIdentityFile` and `startDirectory`. Desktop starts `command` without a shell, so [write it as a program and plain arguments](</docs/en/desktop#write-the-command>). + * **Default** : unset + +This example adds one connection named `Dev box`, where `acme-dev create` stands for your own tool: + +settings.json + + { + "sshHostCommands": [ + { + "id": "devbox", + "name": "Dev box", + "command": "acme-dev create" + } + ] + } + +Before Claude Code v2.1.307, the Edit tool refused a change that added this key to a valid settings file, with the error `Unrecognized field: sshHostCommands`. On those versions, add the key in a text editor instead; Claude Code loads a file that holds the key. In Desktop, the version that counts is the [Code tab’s Claude Code version](</docs/en/desktop#claude-code-version-in-the-code-tab>), not your terminal’s. + ## ​
modified Create custom subagents View current →
--- a/sub-agents.md +++ b/sub-agents.md @@ -842,7 +842,7 @@ 2. Run `claude` again from your shell, or open a new VS Code conversation. 3. Ask Claude to wait when you need a result first, for example “run the reviewer subagent and wait for its report”. -To keep working while Claude waits, press **Ctrl+B** in the terminal or click [**Run in background**](</docs/en/vs-code#move-a-running-command-or-subagent-to-the-background>) in VS Code. If you set the [`CLAUDE_CODE_DISABLE_BACKGROUND_TASKS`](</docs/en/env-vars>) environment variable to `1` instead of turning fork mode off, Claude waits for every subagent and background tasks are off, **Ctrl+B** included. +To keep working while Claude waits, press **Ctrl+B** in the terminal or click [**Run in background**](</docs/en/vs-code#move-a-running-command-or-subagent-to-the-background>) in VS Code. If you set the [`CLAUDE_CODE_DISABLE_BACKGROUND_TASKS`](</docs/en/env-vars>) environment variable to `1` instead of turning fork mode off, Claude waits for every subagent. Background commands are off too, and **Ctrl+B** doesn’t move anything to the background. ####
modified Tools reference View current →
--- a/tools-reference.md +++ b/tools-reference.md @@ -218,7 +218,7 @@ Foreground commands that move to the background -When a foreground command reaches its timeout without finishing, Claude Code moves it to the background instead of stopping it, unless the command starts with `sleep`. A moved command’s time limit counts from the move, and a foreground subagent’s moved command still stops when that subagent’s run ends. Setting [`CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1`](</docs/en/env-vars#variables>) or running in [bare mode](</docs/en/headless#start-faster-with-bare-mode>) disables auto-backgrounding along with the rest of the background task functionality, so a command that reaches its timeout stops instead. The result of a command moved to the background states what happened: +When a foreground command reaches its timeout without finishing, Claude Code moves it to the background instead of stopping it, unless the command starts with `sleep`. A moved command’s time limit counts from the move, and a foreground subagent’s moved command still stops when that subagent’s run ends. Setting [`CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1`](</docs/en/env-vars#variables>) or running in [bare mode](</docs/en/headless#start-faster-with-bare-mode>) disables auto-backgrounding, so a command that reaches its timeout stops instead. The result of a command moved to the background states what happened: * When the timeout triggers the move, the result reports it explicitly: `Command did not complete within its 120s timeout and was moved to the background`, with the seconds matching the timeout that applied, followed by the task ID and the path of the file the output is being written to. * A `cd`, `pushd`, `popd`, or `chdir` inside a command that is moved to the background never carries over: the result states `Session cwd remains <dir>; directory changes made by the backgrounded command do not apply to subsequent commands.`, so Claude doesn’t act on a directory change that didn’t happen.