modified Set up Claude Code for your organization View current →
--- a/admin-setup.md +++ b/admin-setup.md @@ -46,7 +46,7 @@ Windows: `C:\Program Files\ClaudeCode\managed-settings.json`| Medium| All Windows user registry| `HKCU\SOFTWARE\Policies\ClaudeCode`| Lowest| Windows only -Server-managed settings reach devices at authentication time and refresh hourly during active sessions, with no endpoint infrastructure. Delivery through the claude.ai admin console requires a Claude for Teams or Enterprise plan. Deployments on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry can get the same remote delivery by running a [Claude apps gateway](</docs/en/claude-apps-gateway>), or use one of the file-based or OS-level mechanisms instead. If your organization mixes providers, configure [server-managed settings](</docs/en/server-managed-settings>) for claude.ai users plus a [file-based or plist/registry fallback](</docs/en/managed-settings#delivery-mechanisms>) so other users still receive managed policy. The plist and HKLM registry locations work with any provider and resist tampering because they require admin privileges to write. The Windows user registry at HKCU is writable without elevation, so treat it as a convenience default rather than an enforcement channel. By default, WSL reads only the Linux file path at `/etc/claude-code`. To extend your Windows registry and `C:\Program Files\ClaudeCode` policy to WSL on the same machine, set [`wslInheritsWindowsSettings: true`](</docs/en/settings-reference#wslinheritswindowssettings>) in either of those admin-only Windows sources. Whichever mechanism you choose, managed values take precedence over user and project settings, apart from a few security-sensitive [exceptions](</docs/en/settings#exceptions-to-managed-settings-precedence>). Array settings such as `permissions.allow` and `permissions.deny` merge entries from all sources, so developers can extend managed lists but not remove from them. For `fallbackModel`, `availableModels`, and [`modelPicker`](</docs/en/settings-reference#modelpicker>), the managed value replaces lower layers rather than merging. +Claude Code fetches server-managed settings at startup and refreshes them hourly during the session, with no endpoint infrastructure to deploy. Delivery through the claude.ai admin console requires a Claude for Teams or Enterprise plan. Deployments on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry can get the same remote delivery by running a [Claude apps gateway](</docs/en/claude-apps-gateway>), or use one of the file-based or OS-level mechanisms instead. If your organization mixes providers, configure [server-managed settings](</docs/en/server-managed-settings>) for claude.ai users plus a [file-based or plist/registry fallback](</docs/en/managed-settings#delivery-mechanisms>) so other users still receive managed policy. The plist and HKLM registry locations work with any provider and resist tampering because they require admin privileges to write. The Windows user registry at HKCU is writable without elevation, so treat it as a convenience default rather than an enforcement channel. By default, WSL reads only the Linux file path at `/etc/claude-code`. To extend your Windows registry and `C:\Program Files\ClaudeCode` policy to WSL on the same machine, set [`wslInheritsWindowsSettings: true`](</docs/en/settings-reference#wslinheritswindowssettings>) in either of those admin-only Windows sources. Whichever mechanism you choose, managed values take precedence over user and project settings, apart from a few security-sensitive [exceptions](</docs/en/settings#exceptions-to-managed-settings-precedence>). Array settings such as `permissions.allow` and `permissions.deny` merge entries from all sources, so developers can extend managed lists but not remove from them. For `fallbackModel`, `availableModels`, and [`modelPicker`](</docs/en/settings-reference#modelpicker>), the managed value replaces lower layers rather than merging. ### @@ -62,7 +62,9 @@ Desktop reads the policy each time a WSL session starts, so you don’t need to restart the app after deploying it. If a device still refuses WSL sessions, open **Help > Troubleshooting > Show Logs in Explorer** in Claude Desktop on that device, which saves a copy of its log folder to Downloads. Search `main.log` in that copy for `[wslPolicyGate] denying WSL session`. The reason for the denial follows in parentheses, such as `(cli-file-present)`. If Claude Desktop was installed with the `.exe` installer, you can also read the live file at `%APPDATA%\Claude\logs\main.log`. After WSL sessions are enabled, extend your managed settings to them: * Deploy `wslInheritsWindowsSettings: true` through the HKLM registry or the `C:\Program Files\ClaudeCode` file so WSL sessions inherit the same policy as host sessions. - * Verify by running `/status` inside a WSL session: the `Setting sources` line should show `Enterprise managed settings` with the Windows source you deployed, `(HKLM)` or `(file)`. + * Verify by running `/status` inside a WSL session and reading the `Setting sources` line. Claude Code names only the [managed source it selected](</docs/en/server-managed-settings#settings-precedence>), so what the line tells you depends on the session: + * **In a session that[fetches server-managed settings](</docs/en/server-managed-settings#platform-availability>) and receives any keys**: `Enterprise managed settings (remote)`, because Claude Code selects them ahead of the Windows sources, so the line doesn’t show whether the flag arrived. + * **In any other session** : `Enterprise managed settings (HKLM)` confirms a registry deployment. `(file)` names the Windows file or the distribution’s own `/etc/claude-code/managed-settings.json`, so it confirms a Windows file deployment only when the distribution has no managed file of its own. Processes inside the WSL 2 utility VM aren’t visible to Windows-side endpoint detection sensors. To observe in-distro process and file activity, check your endpoint detection vendor’s WSL guidance for a Linux sensor you can run inside the distribution and the exclusions it needs. Claude Code’s [OpenTelemetry tool-execution telemetry](</docs/en/monitoring-usage>) is emitted identically for WSL and native sessions.
modified Use Claude Code on the web View current →
--- a/claude-code-on-the-web.md +++ b/claude-code-on-the-web.md @@ -317,7 +317,8 @@ * **Isolated virtual machines** : each session runs in an isolated, Anthropic-managed VM. Sessions your organization routes to a [self-hosted environment](</docs/en/self-hosted-environments>) run on your own infrastructure instead, where isolation is your deployment’s responsibility * **Network access controls** : in Anthropic-hosted environments, network access is limited by default and can be disabled. In a self-hosted environment, you restrict session egress at your own network boundary. When running with network access disabled, Claude Code can still communicate with the Anthropic API, which may allow data to exit the VM. - * **Credential protection** : in Anthropic-hosted environments, sensitive credentials such as git credentials or signing keys are never inside the sandbox with Claude Code; authentication is handled through a secure proxy using scoped credentials. Sessions in a self-hosted environment authenticate git with credentials your deployment provides; [Configure git](</docs/en/self-hosted-environments-deploy#configure-git>) covers the options, including per-session minted credentials and the same proxy. + * **Credential protection** : in Anthropic-hosted environments, git credentials and signing keys stay outside the sandbox, and a proxy authenticates on the session’s behalf with scoped credentials. In a self-hosted environment, your deployment supplies git credentials; see [Configure git](</docs/en/self-hosted-environments-deploy#configure-git>) + * **API credentials** : in Anthropic-hosted environments, keys you [add to a cloud environment](</docs/en/cloud-environments#add-api-credentials>) stay outside the sandbox the same way, attached to matching requests after they leave the session. A self-hosted environment doesn’t have API credentials * **Secure analysis** : code is analyzed and modified within the session’s isolated environment before creating PRs ##
modified Explore the .claude directory View current →
--- a/claude-directory.md +++ b/claude-directory.md @@ -126,12 +126,16 @@ `usage-data/`| `report.html` and timestamped report copies written by [`/insights`](</docs/en/costs#analyze-your-usage-patterns>), plus cached per-session analysis data used to build them `todos/`, `statsig/`, `logs/`| Legacy directories from older versions. No longer written. The sweep removes their contents and then the empty directory. -Claude Code makes four exceptions to this sweep: +Session files in `sessions/`, auto memory, and Claude Desktop and Cowork transcripts each follow their own retention rule: * **`sessions/`** : holds one small file per running session, used to detect concurrent sessions and crashes. It isn’t part of the age-based sweep: Claude Code removes each file when its session exits and clears crash leftovers on the next launch. * **Auto memory** : Claude Code excludes a project’s [auto memory](</docs/en/memory#auto-memory>) directory, `projects/<project>/memory/`, from this sweep, and removes the directory itself only after it has been empty for the whole retention period. Before v2.1.228, the sweep treated folders inside the memory directory as session data and could delete old files beneath it. + * **Claude Desktop and Cowork transcripts** : Claude Code keeps the transcript of a session you started or most recently continued in Claude Desktop or Cowork at any age. To give these transcripts an age limit, set [`desktopSessionCleanupPeriodDays`](</docs/en/settings-reference#desktopsessioncleanupperioddays>). When [managed settings](</docs/en/managed-settings>) set `cleanupPeriodDays`, Claude Code deletes these transcripts after that period instead. Requires Claude Code v2.1.248 or later; earlier versions delete them after `cleanupPeriodDays`. + +Claude Code skips the sweep entirely in these cases: + * **Bare mode** : when you run `claude -p` with [`--bare`](</docs/en/headless#start-faster-with-bare-mode>), Claude Code doesn’t run the sweep in that session. - * **Paused sweep** : if Claude Code can’t safely determine the retention period, it pauses the retention cleanup sweep; the [`retention_sweep` event](</docs/en/monitoring-usage#retention-sweep-event>) lists each configuration that pauses it. When the cause is a settings file that can’t be read or parsed, or settings errors with `cleanupPeriodDays` explicitly set, Claude Code also shows a warning in `/status` until you fix the settings errors. When [managed settings](</docs/en/server-managed-settings>) provide `cleanupPeriodDays`, Claude Code runs the sweep at the managed value in either case. + * **Paused sweep** : if Claude Code can’t safely determine the retention period, it pauses the retention cleanup sweep; the [`retention_sweep` event](</docs/en/monitoring-usage#retention-sweep-event>) lists each configuration that pauses it. When the cause is a settings file that can’t be read or parsed, or settings errors with `cleanupPeriodDays` or `desktopSessionCleanupPeriodDays` explicitly set, Claude Code also shows a warning in `/status` until you fix the settings errors. When [managed settings](</docs/en/server-managed-settings>) provide `cleanupPeriodDays`, Claude Code runs the sweep at the managed value in either case. ### @@ -159,7 +163,8 @@ Transcripts and history are not encrypted at rest. OS file permissions are the only protection. If a tool reads a `.env` file or a command prints a credential, that value is written to `projects/<project>/<session>.jsonl`. To reduce exposure: - * Lower `cleanupPeriodDays` to shorten how long transcripts are kept + * Lower `cleanupPeriodDays` to shorten how long Claude Code keeps transcripts + * Set [`desktopSessionCleanupPeriodDays`](</docs/en/settings-reference#desktopsessioncleanupperioddays>) to give Claude Desktop and Cowork transcripts an age limit too * Set the [`CLAUDE_CODE_SKIP_PROMPT_HISTORY`](</docs/en/env-vars>) environment variable to skip writing transcripts and prompt history in any mode. In non-interactive mode, you can instead pass `--no-session-persistence` alongside `-p`, or set `persistSession: false` in the TypeScript Agent SDK; the Python SDK has no equivalent option. * Use [permission rules](</docs/en/permissions>) to deny reads of credential files
modified Configure cloud environments View current →
Show diff (175 lines)
--- a/cloud-environments.md +++ b/cloud-environments.md @@ -1,6 +1,6 @@ Cloud environments require [Claude Code on the web](</docs/en/claude-code-on-the-web>), which is in research preview for Pro, Max, and Team users, and for Enterprise users with [premium seats or Chat + Claude Code seats](<https://support.claude.com/en/articles/11845131-use-claude-code-with-your-team-or-enterprise-plan>). -Each [cloud session](</docs/en/claude-code-on-the-web>) runs in a cloud environment. You can configure an environment to allow or deny network access, set environment variables for the session, and run a setup script before Claude starts working. The same environments apply wherever you start a cloud session: [Claude Code on the web](</docs/en/claude-code-on-the-web>), the terminal with [`claude --cloud`](</docs/en/claude-code-on-the-web#from-terminal-to-web>), [Claude Tag](<https://claude.com/docs/claude-tag/overview>), [routines](</docs/en/routines>), the [Claude mobile app](</docs/en/mobile>), and the [Desktop app](</docs/en/desktop>). Each of these surfaces can also route to a [self-hosted environment](</docs/en/self-hosted-environments>). [Availability and limitations](</docs/en/self-hosted-environments#availability-and-limitations>) covers what Claude can’t use yet when a Claude Tag session runs in one. +Each [cloud session](</docs/en/claude-code-on-the-web>) runs in a cloud environment. You can configure an environment to allow or deny network access, set environment variables for the session, store API credentials that sessions use without seeing them, and run a setup script before Claude starts working. The same environments apply wherever you start a cloud session: [Claude Code on the web](</docs/en/claude-code-on-the-web>), the terminal with [`claude --cloud`](</docs/en/claude-code-on-the-web#from-terminal-to-web>), [Claude Tag](<https://claude.com/docs/claude-tag/overview>), [routines](</docs/en/routines>), the [Claude mobile app](</docs/en/mobile>), and the [Desktop app](</docs/en/desktop>). Each of these surfaces can also route to a [self-hosted environment](</docs/en/self-hosted-environments>). [Availability and limitations](</docs/en/self-hosted-environments#availability-and-limitations>) covers what Claude can’t use yet when a Claude Tag session runs in one. [Remote Control](</docs/en/remote-control>) sessions connect the web and mobile interfaces to a session on your own machine, which uses your machine’s network and files, not a cloud environment. Claude Tag channel sessions use organization-level environments only, either shared environments or [self-hosted environments](</docs/en/self-hosted-environments>). @@ -46,7 +46,7 @@ Add or edit an environment -Select **Add cloud environment** , or hover over an existing environment and select the settings icon that appears on the right. The dialog includes the name, network access level, environment variables, and setup script. +Select **Add cloud environment** , or hover over an existing environment and select the settings icon that appears on the right. The dialog includes the name, network access level, environment variables, and setup script. When you edit an existing cloud environment, the dialog also includes API credentials. ### @@ -60,7 +60,84 @@ LOG_LEVEL=debug DATABASE_URL=postgres://localhost:5432/myapp -Each session copies the environment’s values once, at startup, into ordinary environment variables that any command Claude runs can read. Because running sessions don’t re-read the configuration, editing or adding variables affects sessions you start afterward; sessions already running keep the values they started with. Claude Code on the web also sets some variables itself when it starts a session. For [`CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`](</docs/en/claude-code-on-the-web#manage-context>), the value Claude Code on the web sets overrides one you add here, so adding that key here has no effect. Anyone who uses the environment can read the values, and cloud environments have no dedicated secrets store, so don’t add API keys or other credentials. If a session needs a credential anyway, see What carries over from your setup. +Each session copies the environment’s values once, at startup, into ordinary environment variables that any command Claude runs can read. Because running sessions don’t re-read the configuration, editing or adding variables affects sessions you start afterward; sessions already running keep the values they started with. Claude Code on the web also sets some variables itself when it starts a session. For [`CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`](</docs/en/claude-code-on-the-web#manage-context>), the value Claude Code on the web sets overrides one you add here, so adding that key here has no effect. Anyone who uses the environment can read the values. For a key the agent proxy can attach to a request, use an API credential instead. The requests that never get a credential are listed there. + +### + +​ + +Add API credentials + +An API credential is an API key or token you store on a cloud environment so Claude can call that API from any session in the environment without seeing the key. Anthropic’s agent proxy adds the key to requests for the hosts you list, after each request leaves the session’s VM. The key never reaches Claude, the commands it runs, or the session’s environment variables. + +#### + +​ + +Requirements + +Two of these decide whether you can add a credential, and two decide whether the agent proxy can use it once added: + + * **Role** : an organization admin role in your claude.ai organization, which Admins and Owners hold + * On Pro and Max, you hold it in your own organization + * Without it, you see a note instead of the credential list, on your own environments too. Ask an Owner to add the credential to a shared environment and run your sessions there + * **Environment type** : an Anthropic-hosted cloud environment that already exists. A [self-hosted environment](</docs/en/self-hosted-environments>) doesn’t have API credentials + * **API reachability** : the API accepts connections from the internet, because requests leave from Anthropic’s network + * **Encryption keys** : if your organization uses customer-managed encryption keys, you can’t save credentials + +#### + +​ + +Add a credential + +You add credentials one at a time from the editor of an environment that already exists. The dialog for a new environment doesn’t offer them. There’s no edit, either. To change a credential’s hosts or value, delete it and add it again. + +1 + +Open the environment's API credentials + +Open the environment for editing at [claude.ai/code](<https://claude.ai/code>). In the **Update cloud environment** dialog, find **API credentials** below **Environment variables**. You see the credentials already on the environment, each with the hosts it applies to. + +2 + +Add the credential + +Select **Add credential** and fill in the form. Keep the default **Credential type** , **Bearer** , for an API key that travels in a request header, and fill in these fields: + + * **Name** : a label for the credential, such as `Internal billing API` + * **Allowed websites** : the API’s hosts, such as `api.example.com`. A leading `*.` matches every subdomain + * **Custom headers** : one row for the header that carries the key. The row starts with `Authorization` as the header’s **Name** and `Bearer` as its **Prefix** ; paste the key itself as the **Value**. For a header like `X-Api-Key` that takes the bare value, change the name and clear the prefix + +For an API that authenticates another way, pick a different **Credential type**. The list is the same one [Claude Tag](<https://claude.com/docs/claude-tag/overview>), the Slack integration for Team and Enterprise plans, offers for [connections](<https://claude.com/docs/claude-tag/admins/add-connections>). + +3 + +Save the credential + +Select **Connect**. The credential appears in the list with its hosts, saved without the dialog’s **Save changes** button. You can’t view the value again after saving. + +To confirm the credential works, start a session in the environment and ask Claude to call the API, for example with `curl`. The API answers as if the key were in the request, and the key doesn’t appear in the session’s environment variables or in any file. If the list marks a credential **Not sent** instead, the note under it says why and what to do. Two credentials whose hosts overlap without matching exactly get no marker, and the agent proxy sends only one of them. + +#### + +​ + +Which requests get the credential + +The agent proxy attaches a credential to a request when the request’s host matches one you listed on that credential. Sessions can reach those hosts even when the environment’s network access level wouldn’t otherwise allow them, except the hosts the agent proxy skips. The credential applies in every session that runs in the environment, whoever started it, until you delete it. + +#### + +​ + +Requests that never get the credential + +The agent proxy never attaches a credential you add to these requests: + + * **GitHub** : the GitHub proxy authenticates requests to GitHub instead, so you don’t need an API credential for it + * **The Anthropic API and public package registries** : requests to `api.anthropic.com`, `registry.npmjs.org`, `jsr.io`, `npm.jsr.io`, `pypi.org`, `files.pythonhosted.org`, `index.crates.io`, and `proxy.golang.org` don’t go through the agent proxy + * **Setup script requests** : Claude Code connects to the agent proxy when it launches, after the setup script has run ### @@ -80,6 +157,7 @@ * Sessions already running in the environment continue to work. * The environment disappears from the selector and from `/remote-env`, so you can’t pick it for new sessions. + * API credentials on the environment stay attached in its running sessions. Delete any you no longer want before you archive. * No new session can start in an archived environment, on any surface. If the environment was your saved CLI default, Claude Code starts CLI cloud sessions in the Anthropic-hosted environment when your list has one, and otherwise in the first environment in your list that isn’t a Remote Control bridge environment. Anything configured with the environment explicitly, such as a [routine](</docs/en/routines#environments-and-network-access>), can’t start new sessions in it. Point it at another environment. ### @@ -88,7 +166,15 @@ Organization-shared environments -On Team and Enterprise plans, an Owner can create cloud environments that are shared with every member of the organization. The same role manages everything else on the **Cloud environments** admin page, including [self-hosted environments](</docs/en/self-hosted-environments>); the Admin role can’t open the page. The full list of roles that can open it is the one for [managing server-managed settings](</docs/en/server-managed-settings#access-control>). Shared environments appear in each member’s environment selector alongside their personal ones, so a team can standardize on one configuration instead of each member recreating it. Create, edit, and archive shared environments from the **Cloud environments** page in [admin settings](<https://claude.ai/admin-settings>). Each shared environment has a name, a network access level, environment variables in `.env` format, and a setup script. Owners choose the organization’s default environment separately, at [claude.ai/admin-settings/claude-code](<https://claude.ai/admin-settings/claude-code>). Values in a shared environment reach every member’s sessions in that environment. Like personal environments, shared environments have no dedicated secrets store, so don’t include secrets. In [Claude Tag](<https://claude.com/docs/claude-tag/overview>) channels, Claude works as your organization’s shared identity, not as any member, so channel sessions use organization-level environments only, either shared environments or [self-hosted environments](</docs/en/self-hosted-environments>). You can set the environment a channel uses in two ways: +On Team and Enterprise plans, an Owner can create cloud environments that are shared with every member of the organization. The same role manages everything else on the **Cloud environments** admin page, including [self-hosted environments](</docs/en/self-hosted-environments>); the Admin role can’t open the page. The full list of roles that can open it is the one for [managing server-managed settings](</docs/en/server-managed-settings#access-control>). Shared environments appear in each member’s environment selector alongside their personal ones, so a team can standardize on one configuration instead of each member recreating it. Create, edit, and archive shared environments from the **Cloud environments** page in [admin settings](<https://claude.ai/admin-settings>). A shared environment also opens from the environment selector at [claude.ai/code](<https://claude.ai/code>): an Admin or Owner can edit it there, and that dialog is where API credentials are added. Other members see it read-only. Each shared environment has a name, a network access level, environment variables in `.env` format, and a setup script. Owners choose the organization’s default environment separately, at [claude.ai/admin-settings/claude-code](<https://claude.ai/admin-settings/claude-code>). Every member’s sessions in a shared environment read its variables, so don’t include secrets in them. To give those sessions a key they can’t read, add an API credential from that dialog. + +### + +​ + +Set the environment a Claude Tag channel uses + +In [Claude Tag](<https://claude.com/docs/claude-tag/overview>) channels, Claude works as your organization’s shared identity, not as any member, so channel sessions use organization-level environments only, either shared environments or [self-hosted environments](</docs/en/self-hosted-environments>). To give a channel a toolchain that isn’t pre-installed, such as .NET, an Owner can create a shared environment from the **Cloud environments** admin page with a setup script that installs it. Point the channel at an environment in one of two ways: * Set a shared or self-hosted environment as the organization’s default environment at [claude.ai/admin-settings/claude-code](<https://claude.ai/admin-settings/claude-code>). * [Pin one to a channel](<https://claude.com/docs/claude-tag/admins/troubleshooting#channel-sessions-use-the-wrong-environment-or-can%E2%80%99t-find-one>) in the Claude Tag admin settings. @@ -118,7 +204,12 @@ **Full**| Any domain **Custom**| Your own allowlist, optionally including the defaults -GitHub operations use a separate proxy that is independent of this setting, and Claude Code’s connection to the Anthropic API still works at **None** , as noted under [Security and isolation](</docs/en/claude-code-on-the-web#security-and-isolation>). +Whichever level you pick, sessions can still reach these, because each one takes a path that doesn’t go through the session’s network allowlist: + + * GitHub, through its separate proxy + * MCP connectors you enable, whose traffic travels through Anthropic’s servers + * The hosts you listed on the environment’s API credentials, except the hosts the agent proxy skips + * The Anthropic API, for Claude Code’s own requests, even at **None** , as noted under [Security and isolation](</docs/en/claude-code-on-the-web#security-and-isolation>) ### @@ -132,7 +223,7 @@ *.internal.example.com registry.example.com -Sessions in this environment can now reach `api.example.com`, any subdomain of `internal.example.com`, and `registry.example.com`, and no other domains through the session’s network; GitHub traffic and MCP connector traffic don’t go through this allowlist. A leading `*.` matches every subdomain. To keep the Trusted domains too, check **Also include default list of common package managers** ; leave it unchecked to allow only what you list. If sessions in the environment work with [artifacts](</docs/en/artifacts>), include `*.frame.claudeusercontent.com` in your list. Claude Code fetches artifact content from that host. If you leave it out, Claude can’t read artifacts in sessions that run in the environment. Each environment has its own allowed-domains list; there’s no organization-level allowlist that admins can push to every member’s environments. [Server-managed settings](</docs/en/server-managed-settings>) still apply inside cloud sessions, but none of them adds domains to the environment’s network allowlist. +Sessions in this environment can now reach `api.example.com`, any subdomain of `internal.example.com`, and `registry.example.com`, and no other domains through the session’s network. GitHub traffic, MCP connector traffic, and requests to the hosts of the environment’s API credentials, other than the hosts the agent proxy skips, don’t go through this allowlist. A leading `*.` matches every subdomain. To keep the Trusted domains too, check **Also include default list of common package managers** ; leave it unchecked to allow only what you list. If sessions in the environment work with [artifacts](</docs/en/artifacts>), include `*.frame.claudeusercontent.com` in your list. Claude Code fetches artifact content from that host. If you leave it out, Claude can’t read artifacts in sessions that run in the environment. Each environment has its own allowed-domains list; there’s no organization-level allowlist that admins can push to every member’s environments. [Server-managed settings](</docs/en/server-managed-settings>) still apply inside cloud sessions, but none of them adds domains to the environment’s network allowlist. ### @@ -195,10 +286,10 @@ Plugins enabled only in your user settings| No| User-scoped `enabledPlugins` lives in `~/.claude/settings.json`. Declare them in the repo’s `.claude/settings.json` instead, or enable them for your claude.ai account so Claude Code loads them as [synced plugins](</docs/en/plugins-reference#synced-plugins>) MCP servers you added with `claude mcp add` at the default local scope or the user scope| No| Those write to `~/.claude.json` on your machine, not the repo. Add the server with `claude mcp add --scope project`, which writes the repo’s [`.mcp.json`](</docs/en/mcp#project-scope>), and commit that file Transport variables in your repo’s `.claude/settings.json` `env` block, such as `NODE_EXTRA_CA_CERTS` and the [mTLS client certificate variables](</docs/en/network-config#mtls-authentication>)| No| The hosting environment manages the session’s API connection, so Claude Code ignores these keys and notes each ignored key in the session’s debug log -Static API tokens and credentials| No| No dedicated secrets store exists yet. See below +API keys and tokens for services Claude calls| Yes, as API credentials| You add the key once on the environment and the agent proxy attaches it to requests for the hosts you list. A key the agent proxy can’t attach stays in an environment variable Interactive auth like AWS SSO| No| Not supported. SSO requires browser-based login that can’t run in a cloud session -To make your own configuration available in cloud sessions, commit it to the repo. A dedicated secrets store is not yet available, and the dialog warns against adding secrets or credentials: environment variables and setup scripts live in the environment configuration, where anyone who uses the environment can read them. If a session needs a credential anyway, add it with that visibility in mind. +To make your own configuration available in cloud sessions, commit it to the repo. Anyone who uses the environment can read its environment variables and setup script. The dialog’s note under **Environment variables** says so and warns against putting secrets there. Store a key the agent proxy can attach as an API credential instead. ### @@ -343,7 +434,7 @@ | Setup scripts| SessionStart hooks ---|---|--- -**Where you configure them**| The environment dialog at [claude.ai/code](<https://claude.ai/code>), or the **Cloud environments** admin page for shared environments| A [settings file](</docs/en/settings#where-settings-live>) such as your repo’s `.claude/settings.json`; see What carries over from your setup for which files reach a cloud session +**Where you configure them**| The environment dialog at [claude.ai/code](<https://claude.ai/code>), plus the **Cloud environments** admin page for shared environments| A [settings file](</docs/en/settings#where-settings-live>) such as your repo’s `.claude/settings.json`; see What carries over from your setup for which files reach a cloud session **When they run**| Before Claude Code launches, skipped when a cached environment exists| After Claude Code launches, on every session including resumed **Where they run**| Cloud sessions only| Local and cloud sessions
modified Commands View current →
--- a/commands.md +++ b/commands.md @@ -123,7 +123,7 @@ `/tasks`| View and manage background work in the current session, including subagents that have finished. Also available as `/bashes` `/team-onboarding`| Generate a team onboarding guide from your Claude Code usage history. Claude analyzes your sessions, commands, and MCP server usage from the past 30 days and produces a markdown guide a teammate can paste as a first message to get set up quickly. For claude.ai subscribers on Pro, Max, Team, and Enterprise plans, also returns a share link teammates can open directly in Claude Code `/teleport`| Pull a [Claude Code on the web](</docs/en/claude-code-on-the-web#from-web-to-terminal>) session into this terminal. Opens a picker, then fetches the branch and conversation. Also available as `/tp`. Requires a claude.ai subscription -`/terminal-setup`| Configure terminal keybindings for Shift+Enter and other shortcuts. Only visible in terminals that need it, like VS Code, Cursor, Devin Desktop, Alacritty, or Zed +`/terminal-setup`| [Install a Shift+Enter keybinding for newlines](</docs/en/terminal-config#enter-multiline-prompts>) in VS Code, Cursor, Devin Desktop, Alacritty, or Zed. In Apple Terminal, [enable Option+Enter for newlines and turn off the audible bell](</docs/en/terminal-config#enable-option-key-shortcuts-on-macos>) instead. In iTerm2, [turn on clipboard access so that `/copy` works](</docs/en/terminal-config#enable-option-key-shortcuts-on-macos>) `/theme`| Change the color theme. Includes an `auto` option that matches your terminal’s light or dark background, light and dark variants, colorblind-accessible (daltonized) themes, ANSI themes that use your terminal’s color palette, and any [custom themes](</docs/en/terminal-config#create-a-custom-theme>) from `~/.claude/themes/` or plugins. Select **New custom theme…** to create one `/tui [default|fullscreen]`| Set the terminal UI renderer and relaunch into it with your conversation intact. `fullscreen` enables the [flicker-free alt-screen renderer](</docs/en/fullscreen>). With no argument, prints the active renderer `/ultraplan <prompt>`| Removed. Use [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) instead. Previously sent a planning task to a [Claude Code on the web](</docs/en/claude-code-on-the-web>) session for review in your browser @@ -147,7 +147,7 @@ Claude Code filters the `/` menu as you type. Each bullet below covers one thing you might notice while filtering: * **Highlighting** : Claude Code highlights the top suggestion only when the letters after the `/` match a command’s name or alias, from the start of the name or from a word within it, ignoring the `:`, `_`, and `-` separators. Typing `/adddir` highlights `/add-dir`, and typing `/new` highlights `/clear` through its alias. Press `Enter` to run the highlighted suggestion. These highlighting rules require Claude Code v2.1.236 or later. - * **After a typo** : Claude Code highlights nothing. The close matches stay listed, and you can pick one with `Tab` or the arrow keys, but `Enter` submits your text as typed and reports [Unknown command](</docs/en/errors#unknown-command>). Before v2.1.236, Claude Code ran the closest match when you pressed `Enter`. + * **After a typo** : Claude Code highlights nothing. The close matches stay listed, and you can pick one with `Tab` or the arrow keys, but `Enter` submits your text as typed and reports [Unknown command](</docs/en/errors#unknown-command>). * **Commands that aren’t available to you** : Claude Code leaves them out of the menu. When nothing matches, Claude Code shows `No commands match "/name"`. Most unavailable commands return [Unknown command](</docs/en/errors#unknown-command>) when you submit them; a few, such as [`/schedule` on a Console API key](</docs/en/routines#schedule-returns-unknown-command>), answer with their own availability message instead. * **Hidden commands** : Claude Code keeps a few available commands, such as `/heapdump`, out of the menu by design. A partial name never brings a hidden command into the menu: if the partial matches nothing visible, Claude Code shows the same no-match message. Claude Code lists the command only once you’ve typed its full name, and submitting the full name runs it.
modified Data usage View current →
--- a/data-usage.md +++ b/data-usage.md @@ -58,7 +58,7 @@ * Standard: 30-day retention period * [Zero data retention](</docs/en/zero-data-retention>): available to qualified accounts for Claude Code on Claude for Enterprise. ZDR is not included in the standard Enterprise plan; it is enabled on a per-organization basis by your account team after confirming eligibility - * Local caching: Claude Code clients store session transcripts locally in plaintext under `~/.claude/projects/` for 30 days by default to enable session resumption. Adjust the period with `cleanupPeriodDays`. See [application data](</docs/en/claude-directory#application-data>) for what’s stored and how to clear it. + * Local caching: Claude Code clients store session transcripts locally in plaintext under `~/.claude/projects/` for 30 days by default to enable session resumption. Adjust the period with `cleanupPeriodDays`. See [application data](</docs/en/claude-directory#application-data>) for what’s stored and how to clear it. Transcripts of sessions started or most recently continued in Claude Desktop or Cowork are [exempt from that limit by default](</docs/en/claude-directory#cleaned-up-automatically>). You can delete individual Claude Code on the web sessions at any time. Deleting a session permanently removes the session’s event data. For instructions on how to delete sessions, see [Delete sessions](</docs/en/claude-code-on-the-web#delete-sessions>). Learn more about data retention practices in our [Privacy Center](<https://privacy.anthropic.com/>). For full details, please review our [Commercial Terms of Service](<https://www.anthropic.com/legal/commercial-terms>) (for Team, Enterprise, and API users) or [Consumer Terms](<https://www.anthropic.com/legal/consumer-terms>) (for Free, Pro, and Max users) and [Privacy Policy](<https://www.anthropic.com/legal/privacy>).
modified Schedule recurring tasks in Claude Code Desktop View current →
--- a/desktop-scheduled-tasks.md +++ b/desktop-scheduled-tasks.md @@ -30,7 +30,7 @@ Create a scheduled task -On Claude Desktop before 1.1.5368, local scheduled tasks aren’t available. In the [**Code** tab](</docs/en/desktop>), click **Routines** in the sidebar, then click **New routine** and choose **Local**. If **Routines** is missing from the sidebar, update the Desktop app; [Create a routine](</docs/en/routines#create-a-routine>) says which plan and settings routines need. Configure these fields: +On Claude Desktop before 1.1.5368, local scheduled tasks aren’t available. In the [**Code** tab](</docs/en/desktop>), click **Routines** in the sidebar or in the sidebar’s **More** menu, then click **New routine** and choose **Local**. Configure these fields: Field| Description ---|---
modified Discover and install prebuilt plugins through marketplaces View current →
--- a/discover-plugins.md +++ b/discover-plugins.md @@ -45,7 +45,7 @@ Code intelligence -Code intelligence plugins enable Claude Code’s built-in LSP tool, giving Claude the ability to jump to definitions, find references, and see type errors immediately after edits. These plugins configure [Language Server Protocol](<https://microsoft.github.io/language-server-protocol/>) connections, the same technology that powers VS Code’s code intelligence. Install the language server binary from the table below before using these plugins; the plugin doesn’t install it for you. If you already have a language server installed, Claude may prompt you to install the corresponding plugin when you open a project. +Code intelligence plugins enable Claude Code’s built-in LSP tool, giving Claude the ability to jump to definitions, find references, and see type errors immediately after edits. These plugins configure [Language Server Protocol](<https://microsoft.github.io/language-server-protocol/>) connections, the same technology that powers VS Code’s code intelligence. In [cloud sessions](</docs/en/claude-code-on-the-web>), Claude Code doesn’t start plugin language servers, so Claude doesn’t get the LSP tool there. Install the language server binary from the table below before using these plugins; the plugin doesn’t install it for you. If you already have a language server installed, Claude may prompt you to install the corresponding plugin when you open a project. Language| Plugin| Binary required ---|---|---
modified Environment variables View current →
--- a/env-vars.md +++ b/env-vars.md @@ -396,7 +396,7 @@ `DISABLE_PROMPT_CACHING_HAIKU`| Set to `1` to disable prompt caching for Haiku models `DISABLE_PROMPT_CACHING_OPUS`| Set to `1` to disable prompt caching for Opus models `DISABLE_PROMPT_CACHING_SONNET`| Set to `1` to disable prompt caching for Sonnet models -`DISABLE_TELEMETRY`| Set to any non-empty value, such as `1`, to opt out of telemetry. **Setting it to`0` or `false` still opts out**, unlike most on/off variables; unset the variable to turn telemetry back on. Telemetry events do not include user data like code, file paths, or bash commands. Also disables feature-flag fetching with the same effect as `DISABLE_GROWTHBOOK`, which makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable +`DISABLE_TELEMETRY`| Set to any non-empty value, such as `1`, to opt out of telemetry. **Setting it to`0` or `false` still opts out**, unlike most on/off variables; unset the variable to turn telemetry back on. Telemetry events do not include user data like code, file paths, or bash commands. Also disables feature-flag fetching with the same effect as `DISABLE_GROWTHBOOK`, which makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. See [Turn telemetry off for your organization](</docs/en/managed-settings#turn-telemetry-off-for-your-organization>) `DISABLE_UPDATES`| Set to `1` to block all updates including manual `claude update` and `claude install`. Stricter than `DISABLE_AUTOUPDATER`. Use when distributing Claude Code through your own channels and users should not self-update `DISABLE_UPGRADE_COMMAND`| Set to `1` to hide the `/upgrade` command `DO_NOT_TRACK`| Set to `1` to opt out of telemetry, with the same effect as `DISABLE_TELEMETRY`, including making [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Claude Code reads this variable as a standard boolean, so `0` leaves telemetry on, and honors it as the cross-tool convention recognized by many developer CLIs
modified Glossary View current →
--- a/glossary.md +++ b/glossary.md @@ -274,7 +274,7 @@ Output style -A configuration that modifies Claude’s system prompt to change response behavior, tone, or format. Unlike CLAUDE.md, which Claude Code delivers as a user message after the system prompt, an output style changes the system prompt itself. Custom styles leave out Claude Code’s built-in software engineering instructions unless you set `keep-coding-instructions` to `true`, and the built-in Default, Proactive, Concise, Explanatory, and Learning styles keep them. Learn more: [Output styles](</docs/en/output-styles>) +A configuration that modifies Claude’s system prompt to change response behavior, tone, or format. Unlike CLAUDE.md, which Claude Code delivers as a user message after the system prompt, an output style changes the system prompt itself. Learn more: [Output styles](</docs/en/output-styles>) ##
modified Intercept and control agent behavior with hooks View current →
--- a/hooks.md +++ b/hooks.md @@ -162,6 +162,8 @@ `SubagentStop`| Yes| Yes| Subagent completion| Aggregate results from parallel tasks `PreCompact`| Yes| Yes| Conversation compaction request| Archive full transcript before summarizing `PostCompact`| No| Yes| Conversation compaction completes| Log the generated summary +[`PreModelSwitch`](</docs/en/hooks#premodelswitch>)| No| Yes| A requested model switch, before it happens (can block)| Block switching to a specific model +[`PostModelSwitch`](</docs/en/hooks#postmodelswitch>)| No| Yes| The session’s model changes, including an automatic fallback| Give Claude model-specific guidance for the new model `PermissionRequest`| Yes| Yes| A tool call needs a permission decision| Custom permission handling `PermissionDenied`| No| Yes| Auto mode denies a tool call, including denials without a classifier verdict| Log denials, or tell the model it may retry; Claude Code ignores `retry: true` for no-verdict denials. See [PermissionDenied](</docs/en/hooks#permissiondenied>) `SessionStart`| No| Yes| Session initialization| Initialize logging and telemetry @@ -814,13 +816,14 @@ Hook timeout -Claude Code runs each callback with a timeout, which you set in seconds with the `timeout` field on its `HookMatcher`. When you don’t set one, Claude Code uses the event’s default: 600 seconds for most events, 30 seconds for `UserPromptSubmit`, and 10 seconds for `MessageDisplay`. Claude Code runs `SessionEnd` callbacks during shutdown under the shorter [SessionEnd timeout budget](</docs/en/hooks#sessionend-input>), 1.5 seconds by default. When a callback exceeds its timeout, Claude Code cancels it and treats it as a failed hook: it discards the callback’s output and the session continues rather than hanging. What happens next depends on the event: +Claude Code runs each callback with a timeout, which you set in seconds with the `timeout` field on its `HookMatcher`. When you don’t set one, Claude Code uses the event’s default: 600 seconds for most events, 30 seconds for `UserPromptSubmit`, `PreModelSwitch`, and `PostModelSwitch`, and 10 seconds for `MessageDisplay`. Claude Code runs `SessionEnd` callbacks during shutdown under the shorter [SessionEnd timeout budget](</docs/en/hooks#sessionend-input>), 1.5 seconds by default. When a callback exceeds its timeout, Claude Code cancels it and treats it as a failed hook: it discards the callback’s output and the session continues rather than hanging. What happens next depends on the event: * `PreToolUse`: Claude Code doesn’t run the tool call, Claude receives a tool result stating the hook didn’t respond before its timeout, and the turn continues. If another `PreToolUse` hook returned an explicit deny, Claude receives that denial instead of the timeout error. Before v2.1.210, Claude Code reported the timeout to Claude as a user rejection, which made unattended sessions stop and wait for input. * `PostToolUse` and `PostToolUseFailure`: Claude Code keeps the tool result and the turn continues. * `UserPromptSubmit` and [`UserPromptExpansion`](</docs/en/hooks#userpromptexpansion>): Claude Code blocks the prompt with a message naming the hook and the timeout, and the session continues. Because a callback on these events can act as a policy gate, Claude Code never lets a timed-out prompt through unscreened. Before v2.1.208, Claude Code ended the query with `error_during_execution` when a callback on these events timed out. * `Stop` and `SubagentStop`: Claude Code shows a warning and the agent stops normally. - * Other events, such as `Notification` and `PreCompact`: Claude Code logs the failure and continues. + * `PreModelSwitch`: Claude Code blocks the model switch. A hook that doesn’t answer hasn’t approved the switch. + * Other events, such as `Notification`, `PreCompact`, and `PostModelSwitch`: Claude Code logs the failure and continues. If you interrupt the query while a callback is pending, Claude Code cancels the pending tool call. Before v2.1.208, the tool call could still proceed if you interrupted during a pending `PreToolUse` callback. If your callback needs more time, set a higher `timeout` on its `HookMatcher`. In TypeScript, use the `AbortSignal` from the third callback argument to handle cancellation gracefully when the timeout fires.
modified Automate actions with hooks View current →
--- a/hooks-guide.md +++ b/hooks-guide.md @@ -461,6 +461,8 @@ `WorktreeRemove`| When a worktree is being removed at session exit, when a subagent finishes, or when you delete a background session `PreCompact`| Before context compaction `PostCompact`| After context compaction completes +`PreModelSwitch`| Before Claude Code applies a model switch that you or a client requested. Can block the switch +`PostModelSwitch`| After the session’s model changes, including changes Claude Code makes on its own, such as restoring the model when you resume a session `Elicitation`| When an MCP server requests user input during a tool call `ElicitationResult`| After a user responds to an MCP elicitation, before the response is sent back to the server `SessionEnd`| When a session terminates @@ -557,7 +559,9 @@ The exit code determines what happens next: - * **Exit 0** : the hook reports no objection through its exit code. For a `PreToolUse` hook this doesn’t approve the tool call: the normal [permission flow](</docs/en/permissions>) still applies. For `UserPromptSubmit`, `UserPromptExpansion`, and `SessionStart` hooks, Claude Code adds stdout it [treats as plain text](</docs/en/hooks#exit-code-0>) to Claude’s context. + * **Exit 0** : your hook reports no objection through its exit code. + * For a `PreToolUse` hook this doesn’t approve the tool call: the normal [permission flow](</docs/en/permissions>) still applies. + * For `UserPromptSubmit`, `UserPromptExpansion`, `SessionStart`, and `PostModelSwitch` hooks, Claude Code adds stdout it [treats as plain text](</docs/en/hooks#exit-code-0>) to Claude’s context. * **Exit 2** : Claude Code blocks the action. Write a reason to stderr. Where it lands depends on the event: some events feed it to Claude as feedback so it can adjust, others show it to the user, and a few, such as `ConfigChange` and `Elicitation`, surface no message. Some events can’t be blocked: for `SessionStart` and others, exit 2 shows stderr to the user and execution continues. See [exit code 2 behavior per event](</docs/en/hooks#exit-code-2-behavior-per-event>) for the full list. * **Any other exit code** : for most events, the outcome depends on what your hook printed to stdout: * A parsed object that passes schema validation: Claude Code ignores the exit code, the JSON alone decides the outcome, and the hook isn’t reported as an error. The per-event exceptions, like `WorktreeCreate` failing on any nonzero exit, are listed in the reference’s [Exit code output](</docs/en/hooks#exit-code-output>) section. @@ -584,13 +588,13 @@ } } -With `"deny"`, Claude Code cancels the tool call and feeds `permissionDecisionReason` back to Claude. These `permissionDecision` values are specific to `PreToolUse`: +With `"deny"`, Claude Code cancels the tool call and feeds `permissionDecisionReason` back to Claude. On `PreToolUse`, Claude Code handles each `permissionDecision` value as follows: * `"allow"`: skip the interactive permission prompt. Deny and ask rules, including enterprise managed deny lists, still apply, as do prompts for MCP tools marked [`requiresUserInteraction`](</docs/en/mcp#require-approval-for-a-specific-tool>) and for connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>) in sessions where that setting reaches Claude Code * `"deny"`: cancel the tool call and send the reason to Claude * `"ask"`: show the permission prompt to the user as normal -A fourth value, `"defer"`, is available in [non-interactive mode](</docs/en/headless>) with the `-p` flag. It exits the process with the tool call preserved so an Agent SDK wrapper can collect input and resume. See [Defer a tool call for later](</docs/en/hooks#defer-a-tool-call-for-later>) in the reference. Other events use different decision patterns. For example, `PostToolUse` and `Stop` hooks use a top-level `decision: "block"` field, while `PermissionRequest` uses `hookSpecificOutput.decision.behavior`. See the [summary table](</docs/en/hooks#decision-control>) in the reference for a full breakdown by event. For `UserPromptSubmit` hooks, use `hookSpecificOutput.additionalContext` instead to inject text into Claude’s context. Nest `additionalContext` inside `hookSpecificOutput`; if you place it at the top level of the JSON, Claude Code silently ignores it. For example, this output adds the current branch state to every prompt: +A fourth value, `"defer"`, is available in [non-interactive mode](</docs/en/headless>) with the `-p` flag. It exits the process with the tool call preserved so an Agent SDK wrapper can collect input and resume. See [Defer a tool call for later](</docs/en/hooks#defer-a-tool-call-for-later>) in the reference. A `PreModelSwitch` hook returns the same `permissionDecision` field: `"allow"` lets a model switch proceed, and `"deny"` cancels it. `"ask"` has you confirm the switch when you run `/model` in an interactive session; everywhere else, Claude Code treats `"ask"` as a refusal. See [PreModelSwitch decision control](</docs/en/hooks#premodelswitch-decision-control>). Other events use different decision patterns. For example, `PostToolUse` and `Stop` hooks use a top-level `decision: "block"` field, while `PermissionRequest` uses `hookSpecificOutput.decision.behavior`. See the [summary table](</docs/en/hooks#decision-control>) in the reference for a full breakdown by event. For `UserPromptSubmit` hooks, use `hookSpecificOutput.additionalContext` instead to inject text into Claude’s context. Nest `additionalContext` inside `hookSpecificOutput`; if you place it at the top level of the JSON, Claude Code silently ignores it. For example, this output adds the current branch state to every prompt: { "hookSpecificOutput": { @@ -637,6 +641,7 @@ `Notification`| notification type| `permission_prompt`, `idle_prompt`, `auth_success`, `elicitation_dialog`, `elicitation_url_dialog`, `elicitation_complete`, `elicitation_response`, `agent_needs_input`, `agent_completed`, `quota_auto_resume_fired`, `quota_auto_resume_stale`, `quota_auto_resume_disabled` `SubagentStart`| agent type| `general-purpose`, `Explore`, `Plan`, or custom agent names `PreCompact`, `PostCompact`| what triggered compaction| `manual`, `auto` +`PreModelSwitch`, `PostModelSwitch`| canonical name of the model the session switches to, as described under [PreModelSwitch](</docs/en/hooks#premodelswitch>)| `claude-opus-5`, `claude-opus-4-6|claude-opus-5`, `.*opus.*` `SubagentStop`| agent type| same values as `SubagentStart` `ConfigChange`| configuration source| `user_settings`, `project_settings`, `local_settings`, `policy_settings`, `skills` `DirectoryAdded`| how the directory was added| `slash_command`, `register_repo_root` @@ -874,7 +879,7 @@ * Command hooks communicate through stdout, stderr, and exit codes only. They can’t trigger `/` commands or tool calls. Text returned via `additionalContext` is injected as a system reminder that Claude reads as plain text. HTTP hooks communicate through the response body instead. * Hook timeouts vary by type. Override per hook with the `timeout` field in seconds. - * `command`, `http`, `mcp_tool`: 10 minutes. `UserPromptSubmit` lowers these to 30 seconds, and `MessageDisplay` lowers them to 10 seconds. + * `command`, `http`, `mcp_tool`: 10 minutes. Claude Code lowers this default to 30 seconds for `UserPromptSubmit`, `PreModelSwitch`, and `PostModelSwitch` hooks, and to 10 seconds for `MessageDisplay`. * `prompt`: 30 seconds. * `agent`: 60 seconds. * [`SessionEnd`](</docs/en/hooks#sessionend>) hooks of any type share a 1.5-second budget. If your settings set a longer per-hook `timeout`, Claude Code raises the budget to match, up to 60 seconds.
modified Deploy managed settings View current →
--- a/managed-settings.md +++ b/managed-settings.md @@ -337,6 +337,22 @@ ​ +Turn telemetry off for your organization + +Claude Code sends Anthropic operational [telemetry](</docs/en/data-usage#telemetry-services>) by default on sessions that use the Anthropic API, whether directly, through an LLM gateway, or through a custom `ANTHROPIC_BASE_URL`; [Default behaviors by API provider](</docs/en/data-usage#default-behaviors-by-api-provider>) says which providers send it. To turn it off for every developer without relying on each person’s shell, deliver `DISABLE_TELEMETRY` through the `env` block of your managed settings. This example sets `DISABLE_TELEMETRY` for everyone the policy reaches: + + { + "env": { + "DISABLE_TELEMETRY": "1" + } + } + +Claude Code applies a value of `1` without showing the user the [approval dialog](</docs/en/server-managed-settings#environment-variables-and-the-approval-dialog>). If you turn telemetry off, Claude Code stops sending the usage data that feeds your organization’s [analytics dashboard](</docs/en/analytics>) for the developers the policy reaches. The variable also turns off feature-flag fetching, which makes Remote Control, default auto mode, and the other [features that need feature-flag fetching](</docs/en/env-vars#features-that-need-feature-flag-fetching>) unavailable for those developers. Where and when a policy applies says which delivery mechanism reaches each surface, and [Platform availability](</docs/en/server-managed-settings#platform-availability>) says which sessions skip the server-managed settings fetch. If your organization uses customer-managed encryption keys and routes Claude Code through a gateway, [Configure proxies and gateways](</docs/en/third-party-integrations#configure-proxies-and-gateways>) says why those sessions need this variable. + +## + +​ + See also * [Set up Claude Code for your organization](</docs/en/admin-setup>): decide what to enforce and how
modified Modifying system prompts View current →
--- a/modifying-system-prompts.md +++ b/modifying-system-prompts.md @@ -122,7 +122,7 @@ Create an output style -An output style is a markdown file with [frontmatter](</docs/en/output-styles#frontmatter>) for metadata, followed by the prompt content. Save it to `~/.claude/output-styles/` for a user-level style available in every project, or `.claude/output-styles/` in your repository for a project-level style you can commit and share with your team. By default, a custom output style replaces the `claude_code` preset’s software engineering instructions with your own. To keep them and layer your instructions on top, set `keep-coding-instructions: true` in the frontmatter. Keep them when your agent is still doing software engineering work. Leave them out when you’re replacing the role entirely. The example below defines a code-review persona that keeps the coding instructions, since reviewing code still benefits from Claude Code’s security and code-quality guidance. Save it as `~/.claude/output-styles/code-reviewer.md` to make it available across projects: +An output style is a markdown file with [frontmatter](</docs/en/output-styles#frontmatter>) for metadata, followed by the prompt content. Save it to `~/.claude/output-styles/` for a user-level style available in every project, or `.claude/output-styles/` in your repository for a project-level style you can commit and share with your team. A custom output style leaves the `claude_code` preset’s software engineering instructions out and uses your own. To keep them and layer your instructions on top, set `keep-coding-instructions: true` in the frontmatter. Those instructions are only in Claude Code’s full system prompt, so the setting has no effect in a session on the shorter system prompt, which you pin on or off with [`CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT`](</docs/en/env-vars#variables>). Keep them when your agent is still doing software engineering work. Leave them out when you’re replacing the role entirely. The example below defines a code-review persona that keeps the coding instructions, since reviewing code still benefits from Claude Code’s security and code-quality guidance. Save it as `~/.claude/output-styles/code-reviewer.md` to make it available across projects: ~/.claude/output-styles/code-reviewer.md
modified Monitoring View current →
--- a/monitoring-usage.md +++ b/monitoring-usage.md @@ -1155,8 +1155,9 @@ * `skip_reason`: Why Claude Code paused the sweep. Present only when `result` is `"skipped"`: * `"user_source_disabled"`: User settings are excluded, for example by the [`--setting-sources`](</docs/en/cli-reference#cli-flags>) flag or the SDK’s [`settingSources`](</docs/en/agent-sdk/typescript#options>) option, and no enabled source provides `cleanupPeriodDays` * `"settings_unknowable"`: A settings file couldn’t be read or parsed, so `cleanupPeriodDays` may be set to a value Claude Code can’t see - * `"settings_invalid_key_set"`: Settings have validation errors and `cleanupPeriodDays` is explicitly set, so falling back to the default could delete files the setting was meant to keep + * `"settings_invalid_key_set"`: Settings have validation errors and `cleanupPeriodDays` or `desktopSessionCleanupPeriodDays` is explicitly set, so falling back to the default could delete or keep files against that setting * `transcripts_deleted`: Number of session transcripts, the top-level `~/.claude/projects/*/*.jsonl` files, that the sweep deleted + * `transcripts_exempted_desktop`: Number of transcripts past the retention period that the sweep kept under the [Claude Desktop and Cowork rule](</docs/en/claude-directory#cleaned-up-automatically>). These don’t count toward `files_past_cutoff`. Requires Claude Code v2.1.248 or later * `session_files_deleted`: Number of artifacts the session-files sweep deleted: transcripts plus per-session companion files such as sidecars, recordings, and tool results * `artifacts_deleted`: Total items the sweep deleted across the data directories it covers, including the session files. Some sweeps count a whole removed directory tree as one item and a few cleanup passes don’t contribute to the counter, so treat the value as a floor rather than an exact file count * `files_retained_fresh`: Files inspected and left in place because they’re still within the retention period. Only per-file sweeps count these, so the value is a floor; a nonzero value is the normal steady state
modified Choose a permission mode View current →
--- a/permission-modes.md +++ b/permission-modes.md @@ -247,7 +247,7 @@ Auto mode on Bedrock, Agent Platform, or Foundry -On [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions, auto mode appears in the `Shift+Tab` cycle by default. Appearing in the cycle doesn’t change the permission mode a session starts in: on these providers, terminal sessions start in your [`defaultMode`](</docs/en/settings-reference#permissions-defaultmode>), which is Manual unless you change it, and conversations in the [VS Code extension](</docs/en/vs-code>) start in Manual unless `claudeCode.initialPermissionMode` or a mode you picked in the extension sets one. Only Claude Sonnet 5, Opus 4.7 or later, and Fable 5 are supported on these providers. To make auto mode the default starting permission mode, set `"permissions": {"defaultMode": "auto"}` in user or managed settings. In sessions the VS Code extension starts, select **Auto** from the mode indicator instead. Switch permission modes covers what outranks that pick. The [`/doctor`](</docs/en/commands#all-commands>) checkup proposes this user-settings default on these providers the same way it does on the Anthropic API. To prevent developers from using auto mode, set `disableAutoMode` to `"disable"` in [managed settings](</docs/en/managed-settings>). This removes `auto` from the `Shift+Tab` cycle, and a session started with `--permission-mode auto` starts in Manual instead. In v2.1.158 through v2.1.206, auto mode was off on these providers until you set `CLAUDE_CODE_ENABLE_AUTO_MODE=1`, and Claude Code ignored `defaultMode: "auto"` on these providers unless the variable was also set. The variable is still accepted for compatibility and has no effect from v2.1.207 onward. +On [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions, auto mode appears in the `Shift+Tab` cycle by default. Appearing in the cycle doesn’t change the permission mode a session starts in: on these providers, terminal sessions start in your [`defaultMode`](</docs/en/settings-reference#permissions-defaultmode>), which is Manual unless you change it, and conversations in the [VS Code extension](</docs/en/vs-code>) start in Manual unless `claudeCode.initialPermissionMode` or a mode you picked in the extension sets one. Only Claude Sonnet 5, Opus 4.7 or later, and Fable 5 are supported on these providers. To make auto mode the default starting permission mode, set `"permissions": {"defaultMode": "auto"}` in user or managed settings. In sessions the VS Code extension starts, select **Auto** from the mode indicator instead. Switch permission modes covers what outranks that pick. The [`/doctor`](</docs/en/commands#all-commands>) checkup proposes this user-settings default on these providers the same way it does on the Anthropic API. To prevent developers from using auto mode, set `disableAutoMode` to `"disable"` in [managed settings](</docs/en/managed-settings>). This removes `auto` from the `Shift+Tab` cycle, and a session started with `--permission-mode auto` starts in Manual instead. A session already running in auto mode leaves it when the setting reaches that session from an [admin-deployed source](</docs/en/managed-settings#which-managed-source-claude-code-uses>), and shows `auto mode disabled by settings`. Before v2.1.251, a running session kept auto mode until it ended. In v2.1.158 through v2.1.206, auto mode was off on these providers until you set `CLAUDE_CODE_ENABLE_AUTO_MODE=1`, and Claude Code ignored `defaultMode: "auto"` on these providers unless the variable was also set. The variable is still accepted for compatibility and has no effect from v2.1.207 onward. ###
modified Plugins reference View current →
--- a/plugins-reference.md +++ b/plugins-reference.md @@ -113,6 +113,8 @@ `WorktreeRemove`| When a worktree is being removed at session exit, when a subagent finishes, or when you delete a background session `PreCompact`| Before context compaction `PostCompact`| After context compaction completes +`PreModelSwitch`| Before Claude Code applies a model switch that you or a client requested. Can block the switch +`PostModelSwitch`| After the session’s model changes, including changes Claude Code makes on its own, such as restoring the model when you resume a session `Elicitation`| When an MCP server requests user input during a tool call `ElicitationResult`| After a user responds to an MCP elicitation, before the response is sent back to the server `SessionEnd`| When a session terminates
modified How Claude Code uses prompt caching View current →
--- a/prompt-caching.md +++ b/prompt-caching.md @@ -65,7 +65,7 @@ Switching models -Each model has its own cache. Switching with [`/model`](</docs/en/model-config#setting-your-model>) means the next request reads the entire conversation history with no cache hits, even though the content is identical. When you run `/model` at the terminal, Claude Code asks you to confirm the switch only while the cache is still warm. The cache stays warm for one cache TTL after Claude Code last sent a request in this conversation or Claude last responded. Once that time passes, the cache has expired, so Claude Code switches without asking. Before v2.1.238, Claude Code didn’t check the cache TTL and asked even after the cache had expired. The [`opusplan` model setting](</docs/en/model-config#opusplan-model-setting>) resolves to Opus during plan mode and Sonnet during execution, so each plan-mode toggle is a model switch and starts a fresh cache. [Automatic model fallback](</docs/en/model-config#automatic-model-fallback>) on Fable 5 and Opus 5 is also a model switch. When a safety classifier flags a request and the flagged category has a fallback model, Claude Code re-runs the request on that model and the session continues there. +Each model has its own cache. Switching with [`/model`](</docs/en/model-config#setting-your-model>) means the next request reads the entire conversation history with no cache hits, even though the content is identical. When you run `/model` at the terminal, Claude Code asks you to confirm the switch only while the cache is still warm. The cache stays warm for one cache TTL after Claude Code last sent a request in this conversation or Claude last responded. Once that time passes, the cache has expired, so Claude Code switches without asking. Before v2.1.238, Claude Code didn’t check the cache TTL and asked even after the cache had expired. You can also require this confirmation or skip it with a [PreModelSwitch hook](</docs/en/hooks#premodelswitch-decision-control>). The [`opusplan` model setting](</docs/en/model-config#opusplan-model-setting>) resolves to Opus during plan mode and Sonnet during execution, so each plan-mode toggle is a model switch and starts a fresh cache. [Automatic model fallback](</docs/en/model-config#automatic-model-fallback>) on Fable 5 and Opus 5 is also a model switch. When a safety classifier flags a request and the flagged category has a fallback model, Claude Code re-runs the request on that model and the session continues there. ### @@ -129,7 +129,7 @@ Code intelligence plugins -When you enable a [code intelligence plugin](</docs/en/discover-plugins#code-intelligence>), Claude gets the [LSP tool](</docs/en/tools-reference#lsp-tool-behavior>). If you enable one mid-session, Claude Code changes the tool set at most once in that session. Once Claude Code has had a language server available, it keeps the LSP tool in the request for the rest of the session. Claude Code doesn’t change the tool set or invalidate the cache when a language server stops, fails, or reconnects later. Before v2.1.235, Claude Code removed the tool from the request whenever every language server had crashed or failed to start and added it back when one recovered. +When you enable a [code intelligence plugin](</docs/en/discover-plugins#code-intelligence>), Claude gets the [LSP tool](</docs/en/tools-reference#lsp-tool-behavior>). #### @@ -151,7 +151,7 @@ Plugins you enable and then disable in one session -When you disable a plugin you enabled earlier in the session, Claude Code restores the previous request shape, apart from the LSP tool, which Claude Code keeps for the rest of the session. If that prefix is still within its cache lifetime, the next request reads the older cache entry instead of rebuilding. +When you disable a plugin you enabled earlier in the session, Claude Code restores the previous request shape. If that prefix is still within its cache lifetime, the next request reads the older cache entry instead of rebuilding. ###
modified Automate work with routines View current →
--- a/routines.md +++ b/routines.md @@ -6,7 +6,7 @@ * **API** : trigger on demand by sending an HTTP POST to a per-routine endpoint with a bearer token * **GitHub** : run automatically in response to repository events such as pull requests or releases -A single routine can combine triggers. For example, a PR review routine can run nightly, trigger from a deploy script, and also react to every new PR. Routines are available on Pro, Max, Team, and Enterprise plans with [Claude Code on the web](</docs/en/claude-code-on-the-web>) enabled. Create and manage them at [claude.ai/code/routines](<https://claude.ai/code/routines>), or from the CLI with `/schedule`. Team and Enterprise Owners can disable routines for all members with the Routines toggle at [claude.ai/admin-settings/claude-code](<https://claude.ai/admin-settings/claude-code>). When disabled, existing routines stop running and members cannot create new ones. This page covers creating a routine, configuring each trigger type, managing runs, and how usage limits apply. +A single routine can combine triggers. For example, a PR review routine can run nightly, trigger from a deploy script, and also react to every new PR. Routines are available on Pro, Max, Team, and Enterprise plans. Create and manage them at [claude.ai/code/routines](<https://claude.ai/code/routines>), or from the CLI with `/schedule`. Team and Enterprise Owners can disable routines for all members with the Routines toggle at [claude.ai/admin-settings/claude-code](<https://claude.ai/admin-settings/claude-code>). When disabled, existing routines stop running and members cannot create new ones. This page covers creating a routine, configuring each trigger type, managing runs, and how usage limits apply. ## @@ -22,7 +22,7 @@ Create a routine -Create a routine from the web at [claude.ai/code/routines](<https://claude.ai/code/routines>), from the Desktop app, or from the CLI. All three surfaces write to the same cloud account, so a routine you create in one shows up in the others immediately. In the Desktop app’s **Code** tab, click **Routines** in the sidebar, then **New routine** , and choose **Cloud** ; choosing **Local** instead creates a [Desktop scheduled task](</docs/en/desktop-scheduled-tasks>), which runs on your machine rather than in the cloud. If **Routines** is missing from the Desktop sidebar, routines aren’t available to your account: they need a Pro, Max, Team, or Enterprise plan with Claude Code on the web enabled, and on Team and Enterprise plans an Owner can turn them off with the Routines toggle at [claude.ai/admin-settings/claude-code](<https://claude.ai/admin-settings/claude-code>). The creation form sets up the routine’s prompt, repositories, environment, connectors, and triggers. Routines run autonomously as full Claude Code cloud sessions: there is no permission-mode picker and no approval prompts during a run. The session can run shell commands, use [skills](</docs/en/skills>) committed to the cloned repository, and call any connectors you include. What a routine can reach is determined by the repositories you select, the [environment’s](</docs/en/cloud-environments>) network access and variables, and the connectors you include. Scope each of those to what the routine actually needs. Routines belong to your individual claude.ai account. They are not shared with teammates, and they count against your account’s daily run allowance. Anything a routine does through your connected GitHub identity or connectors appears as you: commits and pull requests carry your GitHub user, and Slack messages, Linear tickets, or other connector actions use your linked accounts for those services. +Create a routine from the web at [claude.ai/code/routines](<https://claude.ai/code/routines>), from the Desktop app, or from the CLI. All three surfaces write to the same cloud account, so a routine you create in one shows up in the others immediately. In the Desktop app’s **Code** tab, click **Routines** in the sidebar or in the sidebar’s **More** menu, then **New routine** , and choose **Cloud** ; choosing **Local** instead creates a [Desktop scheduled task](</docs/en/desktop-scheduled-tasks>), which runs on your machine rather than in the cloud. The creation form sets up the routine’s prompt, repositories, environment, connectors, and triggers. Routines run autonomously as full Claude Code cloud sessions: there is no permission-mode picker and no approval prompts during a run. The session can run shell commands, use [skills](</docs/en/skills>) committed to the cloned repository, and call any connectors you include. What a routine can reach is determined by the repositories you select, the [environment’s](</docs/en/cloud-environments>) network access and variables, and the connectors you include. Scope each of those to what the routine actually needs. Routines belong to your individual claude.ai account. They are not shared with teammates, and they count against your account’s daily run allowance. Anything a routine does through your connected GitHub identity or connectors appears as you: commits and pull requests carry your GitHub user, and Slack messages, Linear tickets, or other connector actions use your linked accounts for those services. ### @@ -55,7 +55,7 @@ Pick a [cloud environment](</docs/en/cloud-environments>) for the routine. Environments control what the cloud session has access to: * **Network access** : set the level of internet access available during each run - * **Environment variables** : provide values Claude can use during each run. They’re [visible to anyone who uses the environment](</docs/en/cloud-environments#what-carries-over-from-your-setup>), so add credentials with that in mind + * **Environment variables** : provide values Claude can use during each run. They’re [visible to anyone who uses the environment](</docs/en/cloud-environments#what-carries-over-from-your-setup>), so store keys for the APIs Claude calls during a run as [API credentials](</docs/en/cloud-environments#add-api-credentials>) instead. That section also lists the requests that never get a credential * **Setup script** : install dependencies and tools the routine needs. The result is [cached](</docs/en/cloud-environments#environment-caching>), so the script doesn’t re-run on every session A **Default** environment is provided with **Trusted** network access, which allows only the [default allowlist](</docs/en/cloud-environments#default-allowed-domains>) of package registries, cloud provider APIs, container registries, and common development domains through the session’s network. Connectors you add to the routine reach their services through Anthropic’s servers, so they don’t need allowlist changes. If your routine needs to reach your own services directly, or a domain outside that list, edit the environment’s [network access](</docs/en/cloud-environments#network-access>) before running. To use a separate environment, [create one](</docs/en/cloud-environments#configure-your-environment>) first.
modified Deploy self-hosted environments to production View current →
--- a/self-hosted-environments-deploy.md +++ b/self-hosted-environments-deploy.md @@ -21,7 +21,7 @@ * An explicit deny for `169.254.169.254` in the session container’s network namespace The block applies to your wrapper script and lifecycle hooks too, since they share the container. Authenticate any token exchange with the [session JWT](</docs/en/self-hosted-environments-identity>) against your own token service over allowlisted egress, or use a file-based web identity such as IAM Roles for Service Accounts (IRSA) on Amazon EKS. * **Per-runner filesystem isolation** : each runner process gets its own working directory that no other process on the host can read or write. Make `--hooks-dir`, the wrapper script, and the host’s `~/.claude/` read-only to the session, either built into the image or mounted read-only. - * **Dispatch has no per-environment access control** : any member of your Anthropic organization can dispatch a session to any of its environments. If an Owner [routes Claude Tag channels to the environment](</docs/en/cloud-environments#organization-shared-environments>), anyone the [Claude Tag access setting](<https://claude.com/docs/claude-tag/admins/restrict-access#restrict-who-can-use-claude>) admits can start channel sessions that run there. By default that’s anyone in the connected Slack workspace, with or without a Claude account. Treat every runner host as reachable for code execution by everyone who can dispatch to it, and place on a runner host only data and credentials that all of those people are allowed to read. [`--lock-to-account`](</docs/en/self-hosted-environments-reference#runner-cli-flags>) bounds which account’s sessions a given host executes, but it doesn’t narrow who can dispatch into the environment. To make self-hosted environments the only picker option, an [Owner](</docs/en/cloud-environments#organization-shared-environments>) can hide Anthropic-hosted environments for the whole organization from the [**Cloud environments** page](<https://claude.ai/admin-settings/cloud-environments>). + * **Dispatch has no per-environment access control** : any member of your Anthropic organization can dispatch a session to any of its environments. If an Owner [routes Claude Tag channels to the environment](</docs/en/cloud-environments#set-the-environment-a-claude-tag-channel-uses>), anyone the [Claude Tag access setting](<https://claude.com/docs/claude-tag/admins/restrict-access#restrict-who-can-use-claude>) admits can start channel sessions that run there. By default that’s anyone in the connected Slack workspace, with or without a Claude account. Treat every runner host as reachable for code execution by everyone who can dispatch to it, and place on a runner host only data and credentials that all of those people are allowed to read. [`--lock-to-account`](</docs/en/self-hosted-environments-reference#runner-cli-flags>) bounds which account’s sessions a given host executes, but it doesn’t narrow who can dispatch into the environment. To make self-hosted environments the only picker option, an [Owner](</docs/en/cloud-environments#organization-shared-environments>) can hide Anthropic-hosted environments for the whole organization from the [**Cloud environments** page](<https://claude.ai/admin-settings/cloud-environments>). * **Enforce the repo-settings guard** : choose the guard mode with [`--confine-repo-settings`](</docs/en/self-hosted-environments-reference#runner-cli-flags>). The default `warn` logs a violation and still spawns the session, `enforce` refuses the session, and `off` disables the scan. The runner scans each repository’s committed settings for: * A grant that resolves outside that session’s own workspace: an `additionalDirectories` entry, an `Edit`, `Write`, or `NotebookEdit` rule in `permissions.allow`, or a `sandbox.filesystem.allowWrite` or `allowRead` entry * A non-empty `env` block
modified Configure server-managed settings View current →
--- a/server-managed-settings.md +++ b/server-managed-settings.md @@ -196,8 +196,8 @@ Delivered payloads parse tolerantly with the same rules as the other managed sources. When part of a payload fails schema validation, Claude Code surfaces a validation error and applies every remaining valid setting; [Invalid entries in managed settings](</docs/en/managed-settings#invalid-entries-in-managed-settings>) says what it drops and which keys fall back to a stricter value. Requires Claude Code v2.1.169 or later. Server-managed delivery adds these behaviors: - * The cache at `~/.claude/remote-settings.json` stores the salvaged payload with invalid entries removed. The raw invalid payload is never persisted. - * When no field in the payload can be salvaged, Claude Code rejects the payload, keeps the last-accepted cached settings, and writes `Remote settings: Settings validation failed - no fields could be salvaged` to the debug log. With `forceRemoteSettingsRefresh` set, the CLI exits instead. + * The cache at `~/.claude/remote-settings.json` stores the salvaged payload with invalid entries removed, apart from invalid `cleanupPeriodDays` and `desktopSessionCleanupPeriodDays` values, which stay in the cached copy and are never applied. + * When no field in the payload can be salvaged and the payload isn’t only those retention keys, Claude Code rejects the payload, keeps the last-accepted cached settings, and writes `Remote settings: Settings validation failed - no fields could be salvaged` to the debug log. With `forceRemoteSettingsRefresh` set, the CLI exits instead. * The security approval dialog evaluates the salvaged payload, so a stripped invalid entry is never presented for approval and never executes. To debug delivery issues, run `claude --debug-file <path>` and search the log for `Remote settings`. Validate a payload change with `claude doctor` on a test machine before rolling it out to the organization.
modified Claude Code settings reference View current →
--- a/settings-reference.md +++ b/settings-reference.md @@ -53,6 +53,7 @@ `crossSessionInbound`| Choose whether Claude Code delivers [messages from your other sessions](</docs/en/cross-session-messaging#control-inbound-messages>), shows a notice without delivering them, or refuses them| Agents, sessions, and worktrees| Any file `defaultShell`| Choose whether Bash or PowerShell runs the shell commands you type with the [`!` prefix](</docs/en/interactive-mode#shell-mode-with-prefix>)| Interface and terminal| Any file `deniedMcpServers`| Block specific [MCP servers](</docs/en/mcp>) by URL, command, or name| MCP| Any file +`desktopSessionCleanupPeriodDays`| Set an age limit in days for [Claude Desktop and Cowork transcripts](</docs/en/claude-directory#cleaned-up-automatically>)| Privacy and telemetry| User or managed `dialogExpiry`| Set how long Claude Code waits for [Remote Control](</docs/en/remote-control>) or an SDK host to answer a forwarded dialog before it cancels the dialog| Interface and terminal| User or managed `diffTool`| Choose whether Claude’s proposed file changes open in the [VS Code](</docs/en/vs-code>) or [JetBrains](</docs/en/jetbrains#features>) diff viewer or stay in the terminal| Global config settings| Global config `disableAgentView`| Turn off background agents and [agent view](</docs/en/agent-view>)| Agents, sessions, and worktrees| Any file @@ -5508,6 +5509,24 @@ ​ +`desktopSessionCleanupPeriodDays` + +Set an age limit in days for the transcripts of sessions you started or most recently continued in Claude Desktop or Cowork. Without this key, Claude Code [keeps those transcripts at any age](</docs/en/claude-directory#cleaned-up-automatically>). Claude Code deletes each one once it’s older than both this limit and `cleanupPeriodDays`, so with `cleanupPeriodDays` at its default of 30, a value of `7` still keeps them 30 days. When managed settings set `cleanupPeriodDays`, that period applies instead and this key is ignored. Requires Claude Code v2.1.248 or later. + + * **Scope** : `User or managed`. Claude Code also reads the key from a file you pass with `--settings`, and ignores it in project and local settings. + * **Type** : number of days, a whole number, minimum `0` + * **Default** : `0`, which sets no age limit + +settings.json + + { + "desktopSessionCleanupPeriodDays": 90 + } + +### + +​ + `feedbackDrafts` Control [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>): whether Claude can queue feedback drafts for you to review, and whether Claude Code shows a card when Claude queues one.
modified Enterprise deployment overview View current →
--- a/third-party-integrations.md +++ b/third-party-integrations.md @@ -40,7 +40,7 @@ * **Corporate proxy** : Routes traffic through an HTTP/HTTPS proxy. Use this if your organization requires all outbound traffic to pass through a proxy server for security monitoring, compliance, or network policy enforcement. Configure with the `HTTPS_PROXY` or `HTTP_PROXY` environment variables. Learn more in [Enterprise network configuration](</docs/en/network-config>). * **LLM Gateway** : A service that sits between Claude Code and the cloud provider to handle authentication and routing. Use this if you need centralized usage tracking across teams, custom rate limiting or budgets, or centralized authentication management. Configure with the `ANTHROPIC_BASE_URL`, `ANTHROPIC_BEDROCK_BASE_URL`, `ANTHROPIC_AWS_BASE_URL`, `ANTHROPIC_VERTEX_BASE_URL`, or `ANTHROPIC_FOUNDRY_BASE_URL` environment variables. Learn more in [LLM gateways](</docs/en/llm-gateway>). -For the per-provider environment variables that route Amazon Bedrock, Microsoft Foundry, or Google Cloud’s Agent Platform through an LLM gateway, see [route to a cloud provider through a gateway](</docs/en/llm-gateway-connect#route-to-a-cloud-provider-through-a-gateway>). Run `/status` in Claude Code to verify which provider, base URL, and proxy a session is using. +For the per-provider environment variables that route Amazon Bedrock, Microsoft Foundry, or Google Cloud’s Agent Platform through an LLM gateway, see [route to a cloud provider through a gateway](</docs/en/llm-gateway-connect#route-to-a-cloud-provider-through-a-gateway>). Run `/status` in Claude Code to verify which provider, base URL, and proxy a session is using. If your organization uses [customer-managed encryption keys](<https://platform.claude.com/docs/en/manage-claude/cmek>) (CMEK) and routes Claude Code through an LLM gateway or a custom `ANTHROPIC_BASE_URL`, CMEK doesn’t apply to Claude Code’s operational telemetry on those sessions. To turn telemetry off for every developer, deliver `DISABLE_TELEMETRY` through managed settings as shown in [Turn telemetry off for your organization](</docs/en/managed-settings#turn-telemetry-off-for-your-organization>). ##
modified Tools reference View current →
--- a/tools-reference.md +++ b/tools-reference.md @@ -293,7 +293,7 @@ * Find implementations of an interface * Trace call hierarchies -Claude Code keeps the tool inactive until you install a [code intelligence plugin](</docs/en/discover-plugins#code-intelligence>) for your language. Claude Code takes the language server’s configuration from the plugin, and you install the server binary yourself. Claude Code keeps the tool active for the rest of a session once it has had a language server available in that session. Claude Code returns an error result for each LSP call on a file whose language server it can’t start. Before v2.1.235, Claude Code deactivated the tool whenever every language server had crashed or failed to start and reactivated it when one recovered. +Claude Code keeps the tool inactive until you install a [code intelligence plugin](</docs/en/discover-plugins#code-intelligence>) for your language. In [cloud sessions](</docs/en/claude-code-on-the-web>), Claude Code doesn’t start plugin language servers, so the LSP tool stays inactive there. Claude Code takes the language server’s configuration from the plugin, and you install the server binary yourself. Claude Code returns an error result for each LSP call on a file whose language server it can’t start. ##
modified Agent SDK reference - TypeScript View current →
--- a/typescript.md +++ b/typescript.md @@ -1835,6 +1835,8 @@ | "SubagentStop" | "PreCompact" | "PostCompact" + | "PreModelSwitch" + | "PostModelSwitch" | "PermissionRequest" | "PermissionDenied" | "Setup" @@ -1905,6 +1907,8 @@ | SubagentStopHookInput | PreCompactHookInput | PostCompactHookInput + | PreModelSwitchHookInput + | PostModelSwitchHookInput | PermissionRequestHookInput | SetupHookInput | TeammateIdleHookInput @@ -2182,6 +2186,48 @@ hook_event_name: "PostCompact"; trigger: "manual" | "auto"; compact_summary: string; + }; + +#### + +​ + +`PreModelSwitchHookInput` + +Fires before a requested model switch takes effect. `context_tokens` and the fields after it estimate what re-sending the conversation to the new model costs. For the full field descriptions and blocking semantics, see [PreModelSwitch](</docs/en/hooks#premodelswitch>). + + type PreModelSwitchHookInput = BaseHookInput & { + hook_event_name: "PreModelSwitch"; + from_model: string; + to_model: string; + requested_model: string | null; + source: "command" | "picker" | "sdk"; + context_tokens: number; + prompt_cache_warm: boolean; + cache_ttl: "5m" | "1h"; + estimated_cache_write_usd: number; + pricing: "configured" | "catalog" | "default"; + }; + +#### + +​ + +`PostModelSwitchHookInput` + +Fires after the session’s model changes. It carries the same fields as `PreModelSwitchHookInput`, with two more `source` values. See [PostModelSwitch](</docs/en/hooks#postmodelswitch>). + + type PostModelSwitchHookInput = BaseHookInput & { + hook_event_name: "PostModelSwitch"; + from_model: string; + to_model: string; + requested_model: string | null; + source: "command" | "picker" | "sdk" | "auto" | "resume"; + context_tokens: number; + prompt_cache_warm: boolean; + cache_ttl: "5m" | "1h"; + estimated_cache_write_usd: number; + pricing: "configured" | "catalog" | "default"; }; #### @@ -2473,6 +2519,22 @@ } | { hookEventName: "Setup"; + additionalContext?: string; + } + | { + hookEventName: "PreModelSwitch"; + /** + * Same contract as PreToolUse: "allow" proceeds, "deny" cancels + * the switch, "ask" asks the user to confirm. Only /model in an + * interactive session shows that prompt; every other surface, + * set_model requests included, treats "ask" as a refusal. + */ + permissionDecision?: "allow" | "deny" | "ask"; + permissionDecisionReason?: string; + } + | { + hookEventName: "PostModelSwitch"; + /** Reaches the model with the next request the new model serves. */ additionalContext?: string; } | {
modified Get started with Claude Code on the web View current →
--- a/web-quickstart.md +++ b/web-quickstart.md @@ -83,9 +83,9 @@ Connect from your terminal -If you already use the GitHub CLI (`gh`), you can set up Claude Code on the web without opening a browser. This requires the [Claude Code CLI](</docs/en/quickstart>). `/web-setup` reads your local `gh` token, links it to your claude.ai account, and creates the **Default** cloud environment if you don’t have one. On Team and Enterprise plans, `/web-setup` is available only after an Owner turns on [Quick web setup](</docs/en/claude-code-on-the-web#github-authentication-options>). - -Organizations with [Zero Data Retention](</docs/en/zero-data-retention>) enabled cannot use `/web-setup` or other cloud session features. If the GitHub CLI isn’t installed or authenticated, `/web-setup` opens the browser onboarding flow instead. +If you already use the GitHub CLI (`gh`), you can set up Claude Code on the web without opening a browser. This requires the [Claude Code CLI](</docs/en/quickstart>). When you run `/web-setup`, Claude Code reads your local `gh` token, links it to your claude.ai account, and creates the **Default** cloud environment if you don’t have one. On Team and Enterprise plans, `/web-setup` is available only after an Owner turns on [Quick web setup](</docs/en/claude-code-on-the-web#github-authentication-options>). + +Organizations with [Zero Data Retention](</docs/en/zero-data-retention>) enabled cannot use `/web-setup` or other cloud session features. If the GitHub CLI isn’t installed or isn’t authenticated, Claude Code opens the browser onboarding flow instead. 1 @@ -242,6 +242,14 @@ ​ +`/web-setup` warns that your token doesn’t have the `workflow` scope + +If `/web-setup` says your GitHub CLI token doesn’t have the `workflow` scope, you can continue, but GitHub can reject some pushes made with that token, such as pushes that change GitHub Actions workflow files. To add the scope, run `gh auth refresh -s workflow` in your shell, then run `/web-setup` again. + +### + +​ + `/web-setup` shows “No commands match” or “Unknown command” `/web-setup` runs inside the Claude Code CLI, not your shell. Launch `claude` first, then type `/web-setup` at the prompt. If you typed it inside Claude Code and the command menu shows `No commands match "/web-setup"`, or submitting it returns `Unknown command: /web-setup`, the command is hidden because a requirement isn’t met. The cause is usually that you’re authenticated with an API key or third-party provider instead of a claude.ai subscription. Run `/login` to sign in with your claude.ai account. On Team and Enterprise plans, the command is hidden by default: the [Quick web setup toggle](</docs/en/claude-code-on-the-web#github-authentication-options>) is off until an Owner turns it on. While it’s off, connect GitHub from the browser instead. The command is also hidden when an administrator has disabled Claude Code on the web for your organization, or when your Enterprise organization has [Zero Data Retention](</docs/en/zero-data-retention>) enabled, which makes Claude Code on the web unavailable.