modified Set up Claude Code for your organization View current →
--- a/admin-setup.md +++ b/admin-setup.md @@ -83,7 +83,8 @@ [Managed policy CLAUDE.md](</docs/en/memory#deploy-organization-wide-claude-md>)| Org-wide instructions loaded in every session, can’t be excluded| File at the managed policy path [MCP server control](</docs/en/managed-mcp>)| Restrict which MCP servers users can add or connect to, deploy a fixed set, or provide remote servers to every user alongside their own| `allowedMcpServers`, `deniedMcpServers`, `allowManagedMcpServersOnly`, `managedMcpServers`, or a deployed `managed-mcp.json` file [Plugin marketplace control](</docs/en/plugin-marketplaces#managed-marketplace-restrictions>)| Restrict which marketplace sources users can add and install from, reject the CLI flags that sideload plugins, agents, and MCP servers for a single run, block [`command` plugin sources](</docs/en/plugin-marketplaces#command-sources>), and allowlist which marketplaces’ plugins can be suggested| `strictKnownMarketplaces`, `blockedMarketplaces`, `disableSideloadFlags`, `disableCommandPluginSources`, `pluginSuggestionMarketplaces` -[Customization lockdown](</docs/en/settings-reference#strictpluginonlycustomization>)| Block skills, agents, hooks, and MCP servers from user and project sources, so they can only come from plugins or managed settings| `strictPluginOnlyCustomization` +[Customization lockdown](</docs/en/settings-reference#strictpluginonlycustomization>)| Block skills, agents, hooks, and MCP servers from user and project sources, so they can only come from plugins or managed settings. Locking skills also stops the [skills your developers enable on claude.ai](</docs/en/skills#where-synced-skills-load>) from syncing| `strictPluginOnlyCustomization` +[Disable claude.ai sync](</docs/en/settings-reference#syncclaudeaiskills>)| Stop Claude Code from loading the [skills](</docs/en/skills#how-synced-skills-behave>) and [plugins](</docs/en/plugins-reference#synced-plugins>) your developers enable on claude.ai. If you turn off Skills for your organization on claude.ai, Claude Code stops syncing both, and on v2.1.273 or later it also removes the ones it already synced. To stop either one without turning Skills off, set its key to `false` in managed settings| `syncClaudeAiSkills`, `syncClaudeAiPlugins` [Hook restrictions](</docs/en/settings-reference#allowmanagedhooksonly>)| Restrict which hooks run and restrict HTTP hook URLs; see [what runs under `allowManagedHooksOnly`](</docs/en/settings-reference#what-runs-under-allowmanagedhooksonly>) for the full effect list| `allowManagedHooksOnly`, `allowedHttpHookUrls` [Login enforcement](</docs/en/settings-reference#forceloginmethod>)| Restrict login to a specific method or Anthropic organization. The method restriction applies across the VS Code extension, Agent SDK, `claude setup-token`, and `/install-github-app`, and the terminal’s interactive login screen, reached by `/login` or first-run onboarding, pre-selects the method without enforcing it; Claude Code verifies the organization for claude.ai account logins in the terminal, VS Code extension, and Agent SDK, and doesn’t check it for Claude Console logins or for [gateway](</docs/en/claude-apps-gateway>) sign-in. Before v2.1.212, only terminal logins applied either key. When set, sessions authenticated by `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, or `apiKeyHelper` are blocked at startup; cloud provider sessions aren’t affected| `forceLoginMethod`, `forceLoginOrgUUID` [Disable agent view](</docs/en/agent-view#how-background-sessions-are-hosted>)| Turn off `claude agents`, `--bg`, `/background`, and the on-demand supervisor| `disableAgentView`
modified Orchestrate teams of Claude Code sessions View current →
--- a/agent-teams.md +++ b/agent-teams.md @@ -98,7 +98,7 @@ `tmux` has known limitations on certain operating systems and traditionally works best on macOS. Using `tmux -CC` in iTerm2 is the suggested entrypoint into `tmux`. -The default is `"in-process"`. Before v2.1.179 the default was `"auto"`, so upgraded sessions that previously opened split panes now stay in one terminal unless you set the mode explicitly. Set `"auto"` to enable split panes when you’re already running inside a tmux session, or when your terminal is iTerm2 with the `it2` CLI installed, falling back to in-process otherwise. The `"tmux"` setting enables split-pane mode and auto-detects whether to use tmux or iTerm2 based on your terminal. As of v2.1.186, set `"iterm2"` to use iTerm2 native split panes explicitly. This mode requires the [`it2` CLI](<https://github.com/mkusaka/it2>) and shows an error with the install command if `it2` is missing. The setup prompt that offers to install `it2` or switch to tmux appears under `"auto"` or `"tmux"` when your terminal is iTerm2 and tmux is available as a fallback. To override the default, set [`teammateMode`](</docs/en/settings-reference#teammatemode>) in `~/.claude/settings.json`: +The default is `"in-process"`. Set `"auto"` to enable split panes when you’re already running inside a tmux session, or when your terminal is iTerm2 with the `it2` CLI installed, falling back to in-process otherwise. The `"tmux"` setting enables split-pane mode and auto-detects whether to use tmux or iTerm2 based on your terminal. As of v2.1.186, set `"iterm2"` to use iTerm2 native split panes explicitly. This mode requires the [`it2` CLI](<https://github.com/mkusaka/it2>) and shows an error with the install command if `it2` is missing. The setup prompt that offers to install `it2` or switch to tmux appears under `"auto"` or `"tmux"` when your terminal is iTerm2 and tmux is available as a fallback. To override the default, set [`teammateMode`](</docs/en/settings-reference#teammatemode>) in `~/.claude/settings.json`: { "teammateMode": "auto"
modified Share session output as artifacts View current →
--- a/artifacts.md +++ b/artifacts.md @@ -1,6 +1,6 @@ Artifacts are available on Pro, Max, Team, and Enterprise plans and require a session signed in with [`/login`](</docs/en/setup#authenticate>). See Availability for the full set of requirements. -An artifact is a live, interactive web page that Claude Code publishes from your session to a private URL on claude.ai. You open it in a browser, and it updates in place as the session continues. Share it from the page header when you want someone else to see it too. +An [artifact](<https://claude.com/features/artifacts>) is a live, interactive web page that Claude Code publishes from your session to a private URL on claude.ai. You open it in a browser, and it updates in place as the session continues. Share it from the page header when you want someone else to see it too. ##
modified Claude Code changelog View current →
Show diff (122 lines)
--- a/changelog.md +++ b/changelog.md @@ -1,4 +1,119 @@ This page is generated from the [CHANGELOG.md on GitHub](<https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md>). Run `claude --version` to check your installed version. + +​ + +2.1.274 + +September 17, 2026 + + * Added a visible warning when memory usage is critical, with steps to free memory or restart safely + * Added `CLAUDE_CODE_MCP_STARTUP_WAIT_MS` to bound how long the first non-interactive turn waits for connecting MCP servers (`0` = don’t wait) + * Added `effort` attribute to the `claude_code.llm_request` OpenTelemetry trace span, matching the `api_request` event + * Added `claude_code.managed_settings_resolved` OTel event: managed-settings sources and policy helper state; redacted settings and digests with `OTEL_LOG_MANAGED_SETTINGS=1` + * Added `store.connect_timeout_seconds` to the Claude apps gateway config to lengthen the Postgres connect timeout (default 5 seconds), and improved the boot error when the database is unreachable to point to `store.postgres_url` and the configured timeout + * Added `enduser.sub`, the IdP subject, to the telemetry Claude Desktop and Cowork send through a Claude apps gateway + * Added a Claude apps gateway warning when a replica has more requests open than the 256 it sends upstream at once, and a startup log line showing that limit + * Added click-to-expand for collapsed teammate and agent messages in fullscreen mode + * Fixed sessions getting stuck endlessly retrying “unexpected tool_use_id” 400 errors: corrupted transcripts now self-heal where possible, and otherwise a clear error (with a `/rewind` hint) ends the loop + * Fixed MCP servers configured as `http` that only speak legacy HTTP+SSE failing to connect when they answer the first request with 422 or another 4xx error + * Fixed Streamable HTTP MCP tool calls timing out after about 5 minutes even when a longer per-server `timeout` was set + * Fixed MCP prompts and resources not refreshing when a server sends list-changed notifications without declaring `listChanged` + * Fixed MCP tool calls refused with 403 insufficient_scope being reported as an expired sign-in: the error now names the missing permissions and points to `/mcp` re-authentication + * Fixed hook-driven sessions (such as an active `/goal`) ending with “Prompt is too long” instead of compacting when the context overflowed again after a reactive compaction + * Fixed an active `/goal` being lost when resuming (`--continue` / `--resume`) a session that had compacted + * Fixed `claude agents` losing `--model`, `--effort`, `--permission-mode`, `--allow-dangerously-skip-permissions` and `--agent` after an auto-update relaunch + * Fixed a per-turn slowdown when a language server publishes project-wide diagnostics for thousands of files + * Fixed subagents with `model: "opus"` on Bedrock, Vertex or Foundry leaving the session’s model when its id has no recognizable model family (unless `ANTHROPIC_DEFAULT_OPUS_MODEL` is set) + * Fixed self-hosted runner sessions failing every turn with a 401 after a few failed token refreshes, until the next scheduled refresh; the runner now keeps retrying, and fetches a new token after a 401 + * Fixed clickable links to local file paths doing nothing in VS Code and other terminals that require a `file://` URI + * Fixed the transcript renumbering ordered lists in your own messages (typing “3. 2. 1.” displayed “3. 4. 5.”); numbers and “N)” markers now show as typed + * Fixed AskUserQuestion preview notes being attached to a previously chosen option instead of the highlighted one + * Fixed AskUserQuestion preview mode dropping the highlighted option when submitting a note with Enter + * Fixed a resumed background agent keeping half of an interrupted tool batch when one of its calls was approved with a message + * Fixed a local `claude -p --resume` started with `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` not reporting background tasks the previous process left unfinished + * Fixed the first turn of a cloud session sometimes starting without the tools of an SDK-hosted MCP server that was still connecting + * Fixed background agent notifications claiming the agent had no live background work when it was still waiting on its own background task and would resume + * Fixed error hints in Claude Desktop sessions to suggest slash commands like `/usage-credits` instead of CLI flags that cannot be used there + * Fixed `/schedule` saving a routine’s prompt without its message role when Claude writes the routine in the shape that listing routines returns + * Fixed `/status` not showing the `apiKeyHelper` failure that its own error banner told you to check + * Fixed `/fast on` in non-interactive sessions reporting on and then turning off under an organization’s managed fast mode policy; it now says the organization has disabled it + * Fixed the Artifact tool asking you to approve an update to an artifact that it then refused because the session had not read the latest version + * Fixed Cowork and claude.ai cloud sessions with network access on treating reads of a teammate’s artifact as if network access were off + * Fixed a plugin or marketplace directory with no git repository of its own taking its version from an enclosing git repository, such as a git-managed `~/.claude` + * Fixed `--strict-mcp-config` with an empty `--mcp-config` holding the first non-interactive turn for up to `MCP_TIMEOUT` on incidental MCP servers + * Fixed Stop prompt hooks re-sending their whole prompt on every block in a conversation; repeat blocks now name the condition with a 500-character label + * Fixed extra empty editor windows opening at startup on Linux under Wayland when running inside the Cursor or VS Code terminal + * Fixed an unhandled promise rejection in the Claude apps gateway when Postgres drops a connection during a spend check + * Fixed Claude apps gateway cutting every open stream on SIGTERM: it now lets in-flight requests finish for up to 25 seconds before exiting (`CLAUDE_GATEWAY_DRAIN_TIMEOUT_MS`) + * Fixed `installed_plugins.json` being rewritten on nearly every start-up when plugin policy comes from remote managed settings, which made Claude Desktop reload every open session’s plugins + * Fixed headless and SDK sessions making a separate model call for every background task that finished; completions already queued are now answered by one call + * Fixed the Bash tool re-sourcing the shell profile (a multi-second stall on the next command) after every plugin reload; it now does so only when the plugins’ `bin/` directories changed + * Fixed plugins with a top-level `$schema` in `hooks/hooks.json` showing an “unknown key” notice + * Fixed MCP connection errors and the MCP login tool’s description showing secrets resolved from `${VAR}` placeholders in MCP configs + * Fixed Bash permission checks for commands that loop over or assign certain special shell variables; these commands now ask for permission + * Fixed worktree-isolated sessions accepting Bash commands with certain nested shell expansions; these are now refused + * Fixed the Edit permission prompt preview sometimes showing a different location than the approved edit in files with multi-byte characters + * Fixed background commands being stopped after 30 idle minutes on machines under mild memory pressure; they’re now stopped only when memory is critically low, and the debug log says why + * Fixed a message a subagent sends to the main session disappearing from the Claude Desktop transcript after a relaunch + * Fixed a plugin loaded from a `.zip` being served from a stale extraction after several overlapping reloads + * Fixed a sub-agent’s progress summary being replaced by a runaway multi-paragraph reply + * Improved startup in `--input-format stream-json` sessions: the first turn no longer waits up to 2s for still-connecting MCP servers whose tools tool search defers; they arrive on a later turn + * Improved Monitor tool notifications: a script’s final output and its exit now arrive as one notification instead of two, saving a model turn + * Improved Artifact tool errors: when you are not signed in to claude.ai the terminal now says so on the first attempt, and Claude is told to stop retrying a rejected call sooner + * Improved artifact publishing: a publish built on an older version is stopped before it is sent, with the newer page to merge + * Improved safety checks before removing an agent worktree that contains submodule checkouts + * Improved `OTEL_LOG_RAW_API_BODIES=file:<dir>` output: a new `index.jsonl` and `request_body_id` / `message.id` event attributes link each response to its request file and transcript message + * Improved Claude apps gateway boot: it now tries the first Postgres connection up to three times before exiting, so a database that is reachable a few seconds late no longer fails the boot + * Improved the Claude apps gateway’s spend-limit check under load: it now takes one database round trip instead of four, so fewer checks time out on a busy gateway + * Improved Claude apps gateway sign-in rate limit errors: `/login` now explains the refusal, and the gateway log says which limit was hit and which setting to change + * Changed Bedrock, Vertex, Foundry and telemetry-disabled installs to use the v2 MCP client and MCP 2026-07-28 negotiation with direct HTTP servers by default, as other installs already do (opt out: `MCP_SDK_GENERATION=v1` or `MCP_PROTOCOL_NEGOTIATION=legacy`) + * Changed `/code-review` to use leaner inline review prompts for every model that has no tuned settings of its own, instead of spawning many review subagents + * Changed `"type": "sdk"` MCP entries in `.mcp.json`, settings, plugins and agent files to be skipped with a warning: only an SDK host application can register in-process servers + * Changed artifact watching in local sessions: a new version published elsewhere no longer starts a turn; Claude learns of it from a later Artifact tool result + * Changed plugin and marketplace clones to leave Git LFS files as pointers instead of downloading them; `git lfs pull` in the checkout fetches them + * Changed self-hosted runners to skip a read-only repository the git host refuses at the access check instead of failing the session start + * Changed the `/status` GitHub line to read “Cloud sessions”, and `/web-setup`, `/ultrareview`, and teleport messages to say “cloud session” instead of “Claude Code on the web” + * [VSCode] Added continuation of the step a window reload interrupted, labeled in the chat, with a Claude Code: Continue After Reload setting to turn it off + * [VSCode] Added Memory and Instructions entries to the Customize menu: Memory shows the auto-memory toggles, the saved memories and the memory folders, and Instructions edits the CLAUDE.md files + * [VSCode] Added a `claudeCode.lockEditorGroups` setting to stop Claude from locking the editor groups it opens in + * [VSCode] Fixed a `/btw` side question asked in a new conversation’s first seconds occasionally showing another session’s side-question history + * [VSCode] Fixed a brief freeze when the extension first looks up your global gitignore file + * [VSCode] Fixed a message sent while Claude was running a tool disappearing from the conversation after a window reload + * [VSCode] Fixed the Manage Plugins enable toggle and MCP servers dialog rows being unreachable from the keyboard + * [VSCode] Fixed sign-ins and sign-outs made in a terminal not showing until a reload after `CLAUDE_CONFIG_DIR` changed in the Environment Variables setting + * [VSCode] Fixed Edit diffs in the chat being cut off at the bottom at some panel widths and for long wrapped lines; diff boxes now fit the rows shown + * [VSCode] Fixed overlapping settings writes from the extension leaving `~/.claude/settings.json` unparseable or dropping a setting + * [VSCode] Fixed Open in New Tab (Ctrl/Cmd+Shift+Esc) sometimes leaving the new tab’s message box unfocused, so typing went nowhere until you clicked it + * [VSCode] Fixed reopening a closed Claude tab splitting the editor layout when its locked group still holds another Claude tab and a file + * [VSCode] Fixed New session opening another locked editor group whenever a file tab shared the group with your Claude tab + * [VSCode] Fixed session names shifting sideways in the session picker while typing a search query + * [VSCode] Fixed the plan review card cutting off its Send feedback button and reason field when a plan has several comments; the comment list now scrolls + * [VSCode] Fixed inline code and code blocks in chat replies being unreadable under the High Contrast themes + * [VSCode] Improved screen reader navigation of the conversation: each message is announced as “You” or “Claude”, with the tool name for tool steps + * [VSCode] Changed the default global gitignore file to `$XDG_CONFIG_HOME/git/ignore` when `XDG_CONFIG_HOME` is an absolute path + * [Claude Code on the web] Added a “Compare against” branch picker to a cloud session’s diff view, so you can diff its changes against any branch instead of only the base branch + * [Claude Code on the web] Fixed git operations in cloud sessions failing with “service unavailable” when GitHub’s token renewal briefly errors + * [Claude Code on the web] Fixed editing a routine occasionally making it fire twice or re-enabling a routine that had just been paused + * [Claude Code on the web] Fixed commits in cloud sessions occasionally failing with a signing error for a few minutes after the session’s credentials refreshed + * [Claude Code on the web] Fixed the toast after saving a routine whose GitHub trigger couldn’t be linked to show the reason, such as a per-repository trigger limit, instead of only “edit to retry” + * [Claude Code on the web] Fixed sessions sometimes flipping back to unread right after you mark them read + * [Claude Code on the web] Changed routines to skip a run and retry for up to 72 hours when the owner’s GitHub connection is missing, instead of switching the routine off at the first failed check + * [Claude Code on the web] Changed a routine’s on-hold notice: when your subscription is paused it now tells you to turn the routine back on yourself instead of promising an automatic resume + * [Claude Tag] Added a Guests setting to the Add channel and Add workspace forms in Claude Tag admin settings, so owners can pick Inherit, Allow, Channel only or Restrict up front + * [Claude Tag] Fixed Claude not answering when another Slack app or bot @mentions it; the tag now gets a reply and wakes Claude in a channel it had stopped following after days of inactivity + * [Claude Tag] Fixed Claude missing another app’s message that tagged @Claude right after a new Slack channel was created; it’s now delivered once Claude has joined + * [Claude Tag] Fixed Claude folding a follow-up sent minutes after its last Slack message into it as a silent edit; late updates such as blockers now post as a new reply that notifies + * [Claude Tag] Fixed Claude’s Slack search failing with an error whenever it searched within a single channel; it now returns that channel’s matching messages + * [Claude Tag] Fixed a safety-filter stop silently resetting a Slack thread’s context when nobody was waiting; Claude now always says so and no longer cancels background work still running + * [Claude Tag] Fixed email addresses in Claude’s Slack replies rendering with a visible `mailto:` prefix; they now show as the plain, clickable address + * [Claude Tag] Fixed Claude refusing to watch an Enterprise Grid channel shared with the whole organization when asked from another workspace in the grid + * [Claude Tag] Fixed the Environment picker in Claude Tag admin settings showing a raw environment ID instead of the environment’s name for archived or app-created environments + * [Claude Tag] Improved Claude’s live progress checklist in Slack: capped at 2,000 characters, reposted at most every 15 minutes in busy threads, with older “Latest task list” links updated + * [Claude Tag] Removed the repeated guest-attribution note Claude appended to a Slack canvas each time it edited one in a channel using the “Channel only” guest setting + * [Code Review] Fixed re-reviews occasionally leaving a fixed finding’s thread open when the new review also filed a lower-severity note under it + * [Code Review] Fixed rare reviews ending with “Code review encountered an error” when GitHub or an internal service failed transiently at launch; they now wait and retry + * [Code Review] Improved how Code Review words each posted finding: short plain sentences that say who is affected, where the code goes wrong, and the fix up front + * [Code Review] Improved the check-run card and PR comment when a review is skipped because of an organization limit: each cause now links the admin page that fixes it ​
modified CLI reference View current →
--- a/cli-reference.md +++ b/cli-reference.md @@ -163,7 +163,7 @@ System prompt flags in resumed conversations -By default, Claude Code builds the system prompt once, on a conversation’s first request, with the text from any system prompt flags applied, and records it in the session. Until the conversation is compacted, every later request uses that recorded prompt, including after you return to the conversation with `--resume` or `--continue`. If you pass different system prompt flag text, or none, on that later launch, it takes effect once the conversation is compacted or when you start a new conversation. If you start Claude Code in [bare mode](</docs/en/headless#start-faster-with-bare-mode>), by passing `--bare` or setting `CLAUDE_CODE_SIMPLE=1`, recording stays off unless you pass `--system-prompt-snapshot on`. Before v2.1.268, sessions that don’t [fetch feature flags](</docs/en/env-vars#features-that-need-feature-flag-fetching>), including sessions on Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry, rebuilt the prompt on every request and `--system-prompt-snapshot` had no effect. To rebuild the prompt on every request instead, for example while you iterate on its wording across `--continue` runs, pass `--system-prompt-snapshot off`. Before v2.1.265, passing any of the system prompt flags also turned recording off unless you passed `--system-prompt-snapshot on`. +By default, Claude Code builds the system prompt once, on a conversation’s first request, with the text from any system prompt flags applied, and records it in the session. Until the conversation is compacted, every later request uses that recorded prompt, including after you return to the conversation with `--resume` or `--continue`. If you pass different system prompt flag text, or none, on that later launch, it takes effect once the conversation is compacted or when you start a new conversation. Outside of [cloud sessions](</docs/en/cloud-environments>), if you start Claude Code in [bare mode](</docs/en/headless#start-faster-with-bare-mode>) by passing `--bare` or setting `CLAUDE_CODE_SIMPLE=1`, recording stays off unless you pass `--system-prompt-snapshot on`. Before v2.1.268, sessions that don’t [fetch feature flags](</docs/en/env-vars#features-that-need-feature-flag-fetching>), including sessions on Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry, rebuilt the prompt on every request and `--system-prompt-snapshot` had no effect. To rebuild the prompt on every request instead, for example while you iterate on its wording across `--continue` runs, pass `--system-prompt-snapshot off`. Before v2.1.265, passing any of the system prompt flags also turned recording off unless you passed `--system-prompt-snapshot on`. ##
modified Configure cloud environments View current →
--- a/cloud-environments.md +++ b/cloud-environments.md @@ -340,7 +340,7 @@ Link output back to the session -Each cloud session has a transcript URL on claude.ai, and the session can read its own ID from the `CLAUDE_CODE_REMOTE_SESSION_ID` environment variable. Use this to put a traceable link in PR bodies, commit messages, Slack posts, or generated reports so a reviewer can open the run that produced them. Commits that Claude creates in a cloud session include a `Claude-Session: <url>` git trailer, and PR bodies include the session URL on its own line. This requires v2.1.179 or later. To omit the trailer and the PR-body link, set [`attribution.sessionUrl`](</docs/en/settings-reference#attribution-sessionurl>) to `false`. The setting requires v2.1.182 or later. To include the session link in something other than a commit or PR, such as a Slack message Claude posts or a report file it writes, have Claude run the following command and use its output. The command converts the `cse_` prefix in the environment variable’s value to the `session_` prefix that the transcript URL expects: +Each cloud session has a transcript URL on claude.ai, and the session can read its own ID from the `CLAUDE_CODE_REMOTE_SESSION_ID` environment variable. Use this to put a traceable link in PR bodies, commit messages, Slack posts, or generated reports so a reviewer can open the run that produced them. Commits that Claude creates in a cloud session include a `Claude-Session: <url>` git trailer, and PR bodies include the session URL on its own line. To omit the trailer and the PR-body link, set [`attribution.sessionUrl`](</docs/en/settings-reference#attribution-sessionurl>) to `false`. The setting requires v2.1.182 or later. To include the session link in something other than a commit or PR, such as a Slack message Claude posts or a report file it writes, have Claude run the following command and use its output. The command converts the `cse_` prefix in the environment variable’s value to the `session_` prefix that the transcript URL expects: echo "https://claude.ai/code/${CLAUDE_CODE_REMOTE_SESSION_ID/#cse_/session_}"
modified Desktop application View current →
--- a/desktop.md +++ b/desktop.md @@ -434,7 +434,7 @@ Extend Claude Code -Connect external services, add reusable workflows, customize Claude’s behavior, and configure preview servers. To manage connectors, skills, and plugins in one place, click **Customize** in the sidebar. The [Cowork](<https://claude.com/product/cowork>) tab in the Desktop app sources its skills, plugins, and connectors from this Customize configuration, which syncs through your claude.ai account, not from the CLI’s `~/.claude` directory. +Connect external services, add reusable workflows, customize Claude’s behavior, and configure preview servers. To manage connectors, skills, and plugins in one place, click **Customize** in the sidebar. The [Cowork](<https://claude.com/product/cowork>) tab in the Desktop app sources its skills, plugins, and connectors from this Customize configuration, which syncs through your claude.ai account, not from the CLI’s `~/.claude` directory. Claude Code also loads the skills and plugins enabled for your claude.ai account in terminal sessions where you sign in with the same account. See [Skills synced from claude.ai](</docs/en/skills#how-synced-skills-behave>) and [Plugins synced from claude.ai](</docs/en/plugins-reference#synced-plugins>). ### @@ -450,7 +450,7 @@ Use skills -[Skills](</docs/en/skills>) extend what Claude can do. Claude loads them automatically when relevant, or you can invoke one directly: type `/` in the prompt box or click the **+** button and select **Slash commands** to browse what’s available. This includes [built-in commands](</docs/en/commands>), your [custom skills](</docs/en/skills#create-your-first-skill>), project skills from your codebase, and skills from any [installed plugins](</docs/en/plugins>). Select one and it appears highlighted in the input field. Type your task after it and send as usual. You can send a command while Claude is working, the same as any other message, and the session returns to idle once the turn finishes. Before v2.1.206, a command sent mid-turn could leave the session showing as running and messages you sent afterward weren’t delivered. Personal skills in `~/.claude/skills/` apply to local sessions; an SSH session reads `~/.claude/skills/` from the remote host’s home directory, not from your machine. Cloud sessions load the skills enabled for your claude.ai account instead. See [Skills in Cowork and cloud sessions](</docs/en/skills#skills-in-cowork-and-cloud-sessions>). +[Skills](</docs/en/skills>) extend what Claude can do. Claude loads them automatically when relevant, or you can invoke one directly: type `/` in the prompt box or click the **+** button and select **Slash commands** to browse what’s available. This includes [built-in commands](</docs/en/commands>), your [custom skills](</docs/en/skills#create-your-first-skill>), project skills from your codebase, and skills from any [installed plugins](</docs/en/plugins>). Select one and it appears highlighted in the input field. Type your task after it and send as usual. You can send a command while Claude is working, the same as any other message, and the session returns to idle once the turn finishes. Before v2.1.206, a command sent mid-turn could leave the session showing as running and messages you sent afterward weren’t delivered. Local sessions load your personal skills from `~/.claude/skills/`. An SSH session reads `~/.claude/skills/` from the remote host’s home directory, not from your machine. Local and cloud sessions also load the skills enabled for your claude.ai account. Cloud sessions load them instead of `~/.claude/skills/`, as [Skills in Cowork and cloud sessions](</docs/en/skills#skills-in-cowork-and-cloud-sessions>) describes. ###
modified Discover and install prebuilt plugins through marketplaces View current →
--- a/discover-plugins.md +++ b/discover-plugins.md @@ -1,4 +1,4 @@ -Plugins extend Claude Code with skills, agents, hooks, and MCP servers. Plugin marketplaces are catalogs that help you discover and install these extensions without building them yourself. Looking to create and distribute your own marketplace? See [Create and distribute a plugin marketplace](</docs/en/plugin-marketplaces>). +Plugins extend Claude Code with skills, agents, hooks, and MCP servers. Plugin marketplaces are catalogs that help you discover and install these extensions without building them yourself. You can also enable plugins on claude.ai, for yourself or through your organization. Claude Code syncs those into your sessions without a marketplace install, as [Plugins synced from claude.ai](</docs/en/plugins-reference#synced-plugins>) describes. Looking to create and distribute your own marketplace? See [Create and distribute a plugin marketplace](</docs/en/plugin-marketplaces>). ## @@ -328,7 +328,7 @@ * type to filter by plugin name or description * press Enter to open a plugin’s detail view and enable, disable, or uninstall it -When you uninstall a plugin that a project’s `.claude/settings.json` enables, Claude Code asks which scope you mean: disable it for you alone, which writes an override to your `.claude/settings.local.json` and leaves the plugin installed for the project, or uninstall it for everyone, which removes it from the shared `.claude/settings.json`. The detail view shows the components the plugin contributes: commands, skills, agents, hooks, MCP servers, and LSP servers. The same inventory is available from the command line with `claude plugin details`. Claude Code also lists marketplace plugins you installed yourself but haven’t used in at least two weeks, over a span of at least 10 sessions, under a **Not used recently** header in the **Installed** tab. The detail view shows a **Last used** line for each plugin. Use these to find plugins that still add startup and context cost even though you no longer use them, then disable or uninstall them. Two kinds of plugins are never listed as unused: +Claude Code also lists the [plugins synced from your claude.ai account](</docs/en/plugins-reference#synced-plugins>) in the **Installed** tab, with `synced` as their source. You can enable or disable one there unless your organization marked it as required. To remove one, turn it off on claude.ai. Synced plugins appear in terminal sessions on Claude Code v2.1.273 or later. When you uninstall a plugin that a project’s `.claude/settings.json` enables, Claude Code asks which scope you mean: disable it for you alone, which writes an override to your `.claude/settings.local.json` and leaves the plugin installed for the project, or uninstall it for everyone, which removes it from the shared `.claude/settings.json`. The detail view shows the components the plugin contributes: commands, skills, agents, hooks, MCP servers, and LSP servers. The same inventory is available from the command line with `claude plugin details`. Claude Code also lists marketplace plugins you installed yourself but haven’t used in at least two weeks, over a span of at least 10 sessions, under a **Not used recently** header in the **Installed** tab. The detail view shows a **Last used** line for each plugin. Use these to find plugins that still add startup and context cost even though you no longer use them, then disable or uninstall them. Two kinds of plugins are never listed as unused: * plugins that your organization manages or that you load with `--plugin-dir` * plugins that contribute a theme, output style, monitor, or workflow, since those deliver value without an invocation to track @@ -370,6 +370,7 @@ * A `claude plugin` command you ran in another terminal * Edits to a plugin you loaded with [`--plugin-dir`](</docs/en/plugins#test-your-plugins-locally>) while you develop it * A plugin auto-update whose notification asks you to reload + * A [sync from your claude.ai account](</docs/en/plugins-reference#synced-plugins>) that added, updated, or removed a plugin and showed a notification asking you to reload * A change in a [`--plugin-dir` folder](</docs/en/plugins#test-your-plugins-locally>) that Claude Code held because applying it would invalidate the prompt cache Before v2.1.268, plugins you enabled, disabled, or uninstalled in the menu, and installs that didn’t activate during the install, stayed pending until you ran `/reload-plugins`. `/reload-plugins` also runs in sessions without an interactive terminal, such as the desktop app, the Agent SDK, and [non-interactive mode](</docs/en/headless>) with `-p`. Requires Claude Code v2.1.260 or later. Two limits apply in those sessions:
modified Environment variables View current →
--- a/env-vars.md +++ b/env-vars.md @@ -306,7 +306,7 @@ `CLAUDE_CODE_PERFORCE_MODE`| Set to `1` to enable Perforce-aware write protection. When set, Edit, Write, and NotebookEdit fail with a `p4 edit <file>` hint if the target file lacks the owner-write bit, which Perforce clears on synced files until `p4 edit` opens them. This prevents Claude Code from bypassing Perforce change tracking `CLAUDE_CODE_PLUGIN_CACHE_DIR`| Override the plugins root directory. Despite the name, this sets the parent directory, not the cache itself: marketplaces and the plugin cache live in subdirectories under this path. Defaults to `~/.claude/plugins` `CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS`| Timeout in milliseconds for git operations when installing or updating plugins (default: 120000). Increase this value for large repositories or slow network connections. See [Git operations time out](</docs/en/plugin-marketplaces#git-operations-time-out>) -`CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE`| Set to `1` to skip the re-clone attempt and keep using the existing marketplace cache when a `git pull` fails. Useful in offline or airgapped environments where re-cloning would fail the same way. See [Marketplace updates fail in offline environments](</docs/en/plugin-marketplaces#marketplace-updates-fail-in-offline-environments>) +`CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE`| Set to `1` to skip the re-clone attempt and keep using the existing marketplace checkout when a marketplace refresh can’t reach or authenticate to the remote. Useful in offline or airgapped environments where re-cloning would fail the same way. See [Marketplace updates fail in offline environments](</docs/en/plugin-marketplaces#marketplace-updates-fail-in-offline-environments>) `CLAUDE_CODE_PLUGIN_PREFER_HTTPS`| Set to `1` to clone GitHub `owner/repo` shorthand sources over HTTPS instead of SSH. Applies to plugin install and update, and to `/plugin marketplace add` and `update`. Useful in CI runners, containers, or any environment without a configured SSH key for `github.com` `CLAUDE_CODE_PLUGIN_SEED_DIR`| Path to one or more read-only plugin seed directories, separated by `:` on Unix or `;` on Windows. Use this to bundle a pre-populated plugins directory into a container image. Claude Code registers marketplaces from these directories at startup and uses pre-cached plugins without re-cloning. See [Pre-populate plugins for containers](</docs/en/plugin-marketplaces#pre-populate-plugins-for-containers>) `CLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICY`| Set to `1` to stop Claude Code from passing `-ExecutionPolicy Bypass` when spawning PowerShell for tool calls, hooks, and status line commands, and respect the machine’s effective execution policy instead. By default Claude Code bypasses execution policy at process scope so `.ps1` scripts and module imports work on default-Restricted Windows installs. Process-scope bypass never overrides Group Policy `MachinePolicy` or `UserPolicy` regardless of this setting @@ -350,8 +350,8 @@ `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`| Set to `1` to strip credentials from subprocess environments (Bash tool, hooks, MCP stdio servers): Anthropic and cloud provider credentials, any other variable that Claude Code recognizes as a credential, and credentials embedded in package registry URLs. The parent Claude process keeps these credentials for API calls, but child processes cannot read them, reducing exposure to prompt injection attacks that attempt to exfiltrate secrets via shell expansion. On v2.1.251 or later, the scrub also removes Claude Code’s own configuration-store pointer variables (such as `CLAUDE_CONFIG_DIR`), so a child process cannot locate a relocated configuration directory. Leave the scrub unset if a subprocess needs these variables. On Linux, this also runs Bash subprocesses in an isolated PID namespace so they cannot read host process environments via `/proc`; as a side effect, `ps`, `pgrep`, and `kill` cannot see or signal host processes. `claude-code-action` sets this automatically when `allowed_non_write_users` is configured `CLAUDE_CODE_SYNC_PLUGIN_INSTALL`| Set to `1` in non-interactive mode (the `-p` flag) to wait for plugin installation to complete before the first query. Without this, plugins install in the background and may not be available on the first turn. Combine with `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS` to bound the wait `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for synchronous plugin installation. When exceeded, Claude Code proceeds without plugins and logs an error. No default: without this variable, synchronous installation waits until complete -`CLAUDE_CODE_SYNC_SKILLS`| Set to `1` to download your enabled claude.ai skills into `~/.claude/skills/synced/` and resync every 10 minutes. Before it runs the first query, Claude Code waits up to `CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS` for the list of your skills. The downloads themselves finish in the background, and Claude waits for a skill’s download when it invokes that skill. The `synced` folder name is [reserved for this download](</docs/en/skills#where-skills-live>). Before v2.1.227, the skills downloaded into `~/.claude/skills/` directly. Applies only in non-interactive mode with the `-p` flag. Requires claude.ai authentication. [Cloud sessions](</docs/en/claude-code-on-the-web>) receive your enabled claude.ai skills automatically; you don’t need to set this there. Claude Code applies [extra rules to the downloaded skills](</docs/en/skills#how-synced-skills-behave>), such as not running their `!` commands on your machine -`CLAUDE_CODE_SYNC_SKILLS_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for a mid-session skills resync when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 30000). Bounds the download triggered when the host requests a skill reload during the session. When exceeded, the resync stops and remaining downloads continue in the background +`CLAUDE_CODE_SYNC_SKILLS`| Set to `1` in non-interactive mode with the `-p` flag to make Claude Code download the skills enabled for your claude.ai account in that run and wait for the list of them, up to `CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS`, before it runs the first query. The downloads themselves finish in the background, and Claude waits for a skill’s download when it invokes that skill. Requires claude.ai authentication. Terminal sessions where you sign in with your claude.ai account [download these skills](</docs/en/skills#where-synced-skills-load>) into `~/.claude/skills/synced/` and resync about every 10 minutes without this variable, so set it only when a `-p` run needs your current skills on its first query. Before v2.1.273, terminal sessions downloaded them only in a `-p` run with this variable set. The `synced` folder name is [reserved for this download](</docs/en/skills#where-skills-live>). Before v2.1.227, the skills downloaded into `~/.claude/skills/` directly. Claude Code applies [extra rules to the downloaded skills](</docs/en/skills#how-synced-skills-behave>), such as not running their `!` commands on your machine +`CLAUDE_CODE_SYNC_SKILLS_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for the skills resync that runs mid-session when an app built on the [Agent SDK](</docs/en/agent-sdk/typescript#query-object>) reloads skills (default: 30000). When exceeded, the reload continues with whichever skills have arrived, and the remaining downloads finish in the background `CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS`| Timeout in milliseconds for the first query to wait for the initial skill list when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 5000). When exceeded, the first query runs with whichever skills have arrived. The downloads finish in the background either way, and Claude waits for a skill’s download when it invokes that skill `CLAUDE_CODE_SYNTAX_HIGHLIGHT`| Set to `false` to disable syntax highlighting in diff output. Useful when colors interfere with your terminal setup. To also disable highlighting in code blocks and file previews, use the [`syntaxHighlightingDisabled`](</docs/en/settings-reference#syntaxhighlightingdisabled>) setting `CLAUDE_CODE_TASK_LIST_ID`| Share a task list across sessions. Set the same ID in multiple Claude Code instances to coordinate on a shared task list, in [sessions that have the Task tools](</docs/en/tools-reference#task-tool-availability>). See [Task list](</docs/en/interactive-mode#task-list>) @@ -431,9 +431,9 @@ `MCP_DISCOVERY_CACHE_STRIKES`| At a start where a [discovery-cache](</docs/en/mcp#server-status-detail>) entry is older than `MCP_DISCOVERY_CACHE_TTL_S`, Claude Code refreshes it in the background. This variable sets how many refreshes in a row can fail before Claude Code discards the entry and connects the server at the next start instead (default: 1). Raise it if your network connection drops occasionally, so that one failed refresh doesn’t discard the entry. Requires Claude Code v2.1.238 or later `MCP_DISCOVERY_CACHE_TTL_S`| Seconds for which Claude Code uses a [discovery-cache](</docs/en/mcp#server-status-detail>) entry without refreshing it (default: 900). At a start where the entry is older than that, Claude Code still uses it but refreshes it in the background. Once the entry is older than `MCP_DISCOVERY_CACHE_MAX_STALE_S`, Claude Code discards it instead. Claude Code caps the value at `MCP_DISCOVERY_CACHE_MAX_STALE_S`, which is 4 hours by default. Before v2.1.238, Claude Code didn’t cap the value `MCP_OAUTH_CALLBACK_PORT`| Fixed port for the OAuth redirect callback, as an alternative to `--callback-port` when adding an MCP server with [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>) -`MCP_PROTOCOL_NEGOTIATION`| On the [v2 MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) only, whether Claude Code probes servers for MCP protocol revision 2026-07-28. Set `auto` to probe HTTP, claude.ai connector, and stdio servers; a server that doesn’t answer the probe connects on the earlier protocol instead, as SSE and WebSocket servers always do. Set `legacy` to skip the probe for every server. Without the variable, Claude Code probes HTTP and claude.ai connector servers on Claude Code v2.1.232 or later, with the exceptions the [MCP client runtimes](</docs/en/mcp#mcp-client-runtimes>) section lists. Any other value is ignored with a warning in the debug log. Requires Claude Code v2.1.221 or later +`MCP_PROTOCOL_NEGOTIATION`| On the [v2 MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) only, whether Claude Code probes servers for MCP protocol revision 2026-07-28. Set `auto` to probe HTTP, claude.ai connector, and stdio servers; a server that doesn’t answer the probe connects on the earlier protocol instead, as SSE and WebSocket servers always do. Set `legacy` to skip the probe for every server. Without the variable, Claude Code probes HTTP servers, and also probes claude.ai connector servers in sessions where it fetches feature flags. Any other value is ignored with a warning in the debug log. Requires Claude Code v2.1.221 or later `MCP_REMOTE_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of remote MCP servers (HTTP/SSE) to connect in parallel during startup (default: 20) -`MCP_SDK_GENERATION`| Pin which [MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) this process connects to MCP servers with: `v1`, built on MCP TypeScript SDK 1.x, or `v2`, built on [MCP TypeScript SDK 2.0](<https://ts.sdk.modelcontextprotocol.io/v2/>). Without the variable, Claude Code uses v2 on Claude Code v2.1.232 or later, except where that section says it uses v1. On Claude Code v2.1.221 or later, the v2 runtime checks the issuer an MCP OAuth server returns in its authorization response and fails the sign-in with an error that begins `Issuer mismatch in authorization response` when it doesn’t match. The v1 runtime doesn’t run this check. If you set an unrecognized value, Claude Code ignores it and writes a warning to the debug log. Claude Code reads the value once per process. Requires Claude Code v2.1.218 or later +`MCP_SDK_GENERATION`| Pin which [MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) this process connects to MCP servers with: `v1`, built on MCP TypeScript SDK 1.x, or `v2`, built on [MCP TypeScript SDK 2.0](<https://ts.sdk.modelcontextprotocol.io/v2/>). Without the variable, Claude Code uses v2, starting with the versions listed in that section. On Claude Code v2.1.221 or later, the v2 runtime checks the issuer an MCP OAuth server returns in its authorization response and fails the sign-in with an error that begins `Issuer mismatch in authorization response` when it doesn’t match. The v1 runtime doesn’t run this check. If you set an unrecognized value, Claude Code ignores it and writes a warning to the debug log. Claude Code reads the value once per process. Requires Claude Code v2.1.218 or later `MCP_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of local MCP servers (stdio) to connect in parallel during startup (default: 3) `MCP_TIMEOUT`| Timeout in milliseconds for MCP server startup (default: 30000, or 30 seconds) `MCP_TOOL_TIMEOUT`| Timeout in milliseconds for MCP tool execution (default: 100000000, about 28 hours). For an HTTP, SSE, or claude.ai connector server, each request also times out after 60 seconds by default; set this variable, or the per-server `timeout`, above 60000 to raise that per-request limit. A lower value still shortens the overall tool-execution timeout but leaves the per-request limit at 60 seconds. Stdio and WebSocket servers have no per-request timer. A per-server `timeout` field in `.mcp.json` overrides this for that server. A per-server `timeout` of at least 1000 also sets the minimum idle window for that server’s tool calls, so `CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT` never aborts them sooner; this floor requires Claude Code v2.1.203 or later. For the env variable, values below 1000 are floored to one second; for the per-server field, values below 1000 are ignored @@ -441,7 +441,7 @@ `OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`| Standard OpenTelemetry SDK limit on attribute value length. Claude Code caps content-bearing telemetry attributes at the smaller of this and `CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH`, so the truncation marker stays within the SDK limit. Claude Code reads the `OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT` and `OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT` variants the same way, and the smallest set value applies to all signals. Requires Claude Code v2.1.214 or later. See [Monitoring](</docs/en/monitoring-usage#common-configuration-variables>) `OTEL_LOG_ASSISTANT_RESPONSES`| Set to `1` to include the model’s response text on `assistant_response` OpenTelemetry log events. When unset, the value of `OTEL_LOG_USER_PROMPTS` is used instead. Set to `0` to keep responses redacted even when `OTEL_LOG_USER_PROMPTS` is set. Requires Claude Code v2.1.193 or later. See [Monitoring](</docs/en/monitoring-usage#assistant-response-event>) `OTEL_LOG_RAW_API_BODIES`| Emit Anthropic Messages API request and response JSON as `api_request_body` / `api_response_body` log events. Set to `1` for inline bodies truncated at the content limit, or `file:<dir>` to write untruncated bodies to disk and emit a `body_ref` path instead. `CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH` configures the content limit, 60 KB by default. Disabled by default; bodies include the entire conversation history. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). See [Monitoring](</docs/en/monitoring-usage#api-request-body-event>) -`OTEL_LOG_TOOL_CONTENT`| Set to `1` to include tool input and output content in OpenTelemetry span events. Disabled by default to protect sensitive data. See [Monitoring](</docs/en/monitoring-usage>) +`OTEL_LOG_TOOL_CONTENT`| Set to `1` to include tool content in the `tool.output` OpenTelemetry span event. Span attributes carry tool content under [their own gates](</docs/en/monitoring-usage#new-context-gates>). Requires [tracing](</docs/en/monitoring-usage#traces-beta>). Disabled by default to protect sensitive data. See [Monitoring](</docs/en/monitoring-usage#tool-output-span-event>) `OTEL_LOG_TOOL_DETAILS`| Set to `1` to include tool input arguments, MCP server names, user-authored workflow names, raw error strings on tool failures, the refusal `category` on `api_refusal` events, and other tool details in OpenTelemetry traces and logs. Disabled by default to protect PII. See [Monitoring](</docs/en/monitoring-usage>) `OTEL_LOG_USER_PROMPTS`| Set to `1` to include user prompt text in OpenTelemetry traces and logs. Disabled by default (prompts are redacted). See [Monitoring](</docs/en/monitoring-usage>) `OTEL_METRICS_INCLUDE_ACCOUNT_UUID`| Set to `false` to exclude account UUID from metrics attributes (default: included). See [Monitoring](</docs/en/monitoring-usage>) @@ -494,9 +494,10 @@ * [Message sessions beyond this machine](</docs/en/cross-session-messaging#message-sessions-on-other-machines>); messaging between sessions on this machine works with fetching off * Run [`claude import` or the `/import` command](</docs/en/cli-reference#cli-commands>) * Run [`/skill-doctor`](</docs/en/skills#find-unused-skills>) or open its report in the `/plugin` **Stats** tab + * Sync the [skills](</docs/en/skills#where-synced-skills-load>) and [plugins](</docs/en/plugins-reference#synced-plugins>) enabled for your claude.ai account into your terminal sessions * Use [the advisor tool](</docs/en/advisor#requirements>) * Read or reply to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>) - * Get the [v2 MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) and its protocol probe without setting `MCP_SDK_GENERATION` and `MCP_PROTOCOL_NEGOTIATION`; Claude Code uses the v1 runtime unless you set `MCP_SDK_GENERATION=v2`, and skips the probe unless you set `MCP_PROTOCOL_NEGOTIATION=auto` + * Have Claude Code probe claude.ai connector servers for [MCP protocol revision 2026-07-28](</docs/en/mcp#mcp-client-runtimes>) unless you set `MCP_PROTOCOL_NEGOTIATION=auto` * Get the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) by default for claude.ai and Console accounts on Windows with Git Bash installed; Claude Code routes shell commands through Git Bash unless you set `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`. On Windows without Git Bash, the tool stays on * Get [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), which Claude Code turns on through a fetched flag * Have Claude Code [exclude MCP tools whose input schema the API would reject](</docs/en/mcp#tools-with-invalid-input-schemas>); it sends the schema anyway, and a request that includes it fails with [a 400 error naming the tool by its position](</docs/en/errors#tool-input-schema-is-invalid>)
modified Claude Code gateway compatibility guide View current →
--- a/llm-gateway-protocol.md +++ b/llm-gateway-protocol.md @@ -152,10 +152,10 @@ What Claude Code does after an upstream rejection depends on what was rejected: * When the upstream rejects the `thinking` field, a mid-conversation system message, or the `cache_control` marker on such a message, Claude Code retries the request and disables the rejected capability for the rest of the conversation - * When the upstream rejects a [thinking signature](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>), Claude Code retries the request without the conversation’s earlier thinking blocks and keeps them out of every later request. New responses still include thinking + * When the upstream rejects a [thinking signature](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>), including with a `400` whose message says the block is `bound to a different conversation`, Claude Code removes earlier thinking blocks from the request, retries, and keeps them out of every later request. New responses still include thinking * Claude Code doesn’t retry rejections of context management or tool schema fields, so those `400` errors reach the developer -The retry logic matches on the upstream’s error wording, so forward error response bodies unmodified. A gateway that wraps upstream errors in its own envelope breaks the recovery path, even when it preserves the status code, unless the envelope’s message carries a stable `capability_rejected:` token. [Claude apps gateway substitutes those tokens for cloud providers’ error wording](</docs/en/claude-apps-gateway-config#upstream-error-messages>), for example `capability_rejected: prompt_too_long`. +The `bound to a different conversation` rejection comes from the API’s [preserved thinking](<https://platform.claude.com/docs/en/build-with-claude/preserved-thinking>) check, which fails when `system`, `tools`, or earlier `messages` content differs from the request that produced the thinking. A gateway that rewrites any of that content can cause the rejection itself; [Libraries, proxies, and gateways](<https://platform.claude.com/docs/en/build-with-claude/preserved-thinking#libraries-proxies-gateways>) covers what to pass through unchanged. The retry logic matches on the upstream’s error wording, so forward error response bodies unmodified. A gateway that wraps upstream errors in its own envelope breaks the recovery path, even when it preserves the status code, unless the envelope’s message carries a stable `capability_rejected:` token. [Claude apps gateway substitutes those tokens for cloud providers’ error wording](</docs/en/claude-apps-gateway-config#upstream-error-messages>), for example `capability_rejected: prompt_too_long`. ###
modified Deploy managed settings View current →
--- a/managed-settings.md +++ b/managed-settings.md @@ -155,7 +155,7 @@ * The sandbox binary paths `sandbox.bwrapPath` and `sandbox.socatPath` * The sandbox `ripgrep` binary, [`sandbox.ripgrep`](</docs/en/settings-reference#sandbox-ripgrep>) * `sandbox.filesystem.disabled` and `sandbox.network.strictAllowlist` - * [`useAutoModeDuringPlan`](</docs/en/settings-reference#useautomodeduringplan>) and [`syncClaudeAiSkills`](</docs/en/settings-reference#syncclaudeaiskills>), where a `false` from any admin source turns the behavior off. A `false` in the developer’s user or local settings turns it off too; each key can only deny + * [`useAutoModeDuringPlan`](</docs/en/settings-reference#useautomodeduringplan>), [`syncClaudeAiSkills`](</docs/en/settings-reference#syncclaudeaiskills>), and [`syncClaudeAiPlugins`](</docs/en/settings-reference#syncclaudeaiplugins>), where a `false` from any admin source turns the behavior off. A `false` in the developer’s user or local settings turns it off too; each key can only deny * [`enableArtifact`](</docs/en/settings-reference#enableartifact>), where a `false` from any admin source turns the [Artifact tool](</docs/en/artifacts>) off. A `false` in the developer’s user, project, or local settings turns it off too, and no source turns it back on; see [which lower-level values still count](</docs/en/settings#exceptions-to-managed-settings-precedence>). Requires Claude Code v2.1.242 or later * [`maxEffortLevel`](</docs/en/settings-reference#maxeffortlevel>), where the lowest cap in any admin source applies. If a developer sets a lower cap in their own settings or with `--settings`, Claude Code applies that one; no source can raise the cap. Requires Claude Code v2.1.267 or later * A commit-trailer opt-out in `attribution`, or in the deprecated `includeCoAuthoredBy`, from any tier
modified Modifying system prompts View current →
--- a/modifying-system-prompts.md +++ b/modifying-system-prompts.md @@ -334,7 +334,7 @@ Cache the static part of a custom prompt -In the TypeScript SDK, you can pass a custom prompt as an array of strings instead of one string, with the `SYSTEM_PROMPT_DYNAMIC_BOUNDARY` marker between the static part and the rest. Use this when your prompt combines instructions that are the same on every request with context that changes per request, such as the customer or ticket the agent is handling. When you pass both parts as one string, a change to the per-request part changes the whole system prompt, so the static instructions miss the cache too. This form isn’t available in the Python SDK, whose `system_prompt` option accepts a string, a preset, or a [file](</docs/en/agent-sdk/python#systempromptfile>). +In the TypeScript SDK, you can pass a custom prompt as an array of strings instead of one string, with the `SYSTEM_PROMPT_DYNAMIC_BOUNDARY` marker between the static part and the rest. Use this when your prompt combines instructions that are the same on every request with context that changes per request, such as the customer or ticket the agent is handling. When you pass both parts as one string, a change to the per-request part changes the whole system prompt, so the static instructions miss the cache too. The array form isn’t available in the Python SDK; [`ClaudeAgentOptions`](</docs/en/agent-sdk/python#claudeagentoptions>) lists the forms `system_prompt` accepts. The SDK splits the prompt only when it calls the Claude API directly or runs on [Claude Platform on AWS](</docs/en/claude-platform-on-aws>). In every other configuration, such as Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, or an [LLM gateway](</docs/en/llm-gateway-connect>), and whenever you set [`CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1`](</docs/en/llm-gateway-protocol#disable-pre-release-capabilities>), the SDK sends the whole prompt as one block, the same as passing one string. @@ -371,7 +371,26 @@ Change the prompt of an existing session -By default, Claude Code builds the system prompt once, on a session’s first request, with your `append` text or custom prompt included, and records it in the session. Until the session is compacted, every later request uses that recorded prompt, including after you return to the session with `resume` or `continue`. If you pass a different `append` or custom prompt on that later call, it takes effect once the session is compacted or in a new session. If you start Claude Code in [bare mode](</docs/en/headless#start-faster-with-bare-mode>) by passing `--bare` through `extraArgs` or setting `CLAUDE_CODE_SIMPLE=1`, recording stays off unless you set `snapshot: true` on the object form of `systemPrompt`. Recording an `append` or custom prompt by default requires Claude Code v2.1.265 or later, which the TypeScript Agent SDK bundles from v0.3.265. Before Claude Code v2.1.268, sessions that don’t [fetch feature flags](</docs/en/env-vars#features-that-need-feature-flag-fetching>), including sessions on Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry, rebuilt the prompt on every request and `snapshot` had no effect. To rebuild the prompt on every request instead, set `snapshot: false` on the object form of `systemPrompt` in the TypeScript SDK: `{ type: "preset", preset: "claude_code", append, snapshot: false }` or `{ type: "custom", prompt, snapshot: false }`. Use this form while you iterate on prompt wording, or when your application changes `append` between calls that resume the same session. The `snapshot` field requires `@anthropic-ai/claude-agent-sdk` v0.3.257 or later. +By default, if you pass a different `append` or custom prompt when you return to a session with `resume` or `continue`, Claude doesn’t see it on the next turn. Claude Code records the system prompt on a session’s first request and reuses that record until the session is compacted. The new text takes effect after that compaction, or in a new session. + +#### + +​ + +Update Claude’s instructions mid-session + +If the instructions you put in the system prompt need to change while a session is running, for example because your user switched the agent to a read-only mode or edited its configuration in your app, send the new instructions in the conversation instead of changing `systemPrompt`: + + * **In your next message** : include the new instructions in the next user message you send. + * **From a hook** : return [`additionalContext`](</docs/en/hooks#add-context-for-claude>) from a `UserPromptSubmit` or `PostToolUse` [hook callback](</docs/en/agent-sdk/hooks#outputs>), written as a factual statement such as “The workspace is now read-only”. The SDK inserts the text into the conversation at the point where the hook fired, so the recorded prompt stays unchanged. + +#### + +​ + +Turn recording off while you iterate on wording + +While you iterate on prompt wording and want each edit to reach a session you resume, set `snapshot` to false on the object form of the system prompt. Claude Code then rebuilds the prompt on every request. The field is available on the preset and custom forms of [`systemPrompt`](</docs/en/agent-sdk/typescript#options>) in TypeScript and of [`system_prompt`](</docs/en/agent-sdk/python#systempromptpreset>) in Python, and requires `@anthropic-ai/claude-agent-sdk` v0.3.257 or later, or `claude-agent-sdk` v0.2.153 or later. Keep recording on in production. With recording off, a different `append` or custom prompt on a resumed session reaches Claude on the next turn, and that request can’t reuse the session’s [prompt cache](</docs/en/prompt-caching#how-the-cache-is-organized>). Where the API enforces [preserved thinking](<https://platform.claude.com/docs/en/build-with-claude/preserved-thinking>), Claude also loses its thinking from earlier turns. Outside of [cloud sessions](</docs/en/cloud-environments>), if you start Claude Code in [bare mode](</docs/en/headless#start-faster-with-bare-mode>) by passing `--bare` through `extraArgs` or setting `CLAUDE_CODE_SIMPLE=1`, recording stays off unless you set `snapshot: true`. Recording an `append` or custom prompt by default requires Claude Code v2.1.265 or later, which the TypeScript Agent SDK bundles from v0.3.265 and the Python Agent SDK from v0.2.153. Before Claude Code v2.1.268, sessions that don’t [fetch feature flags](</docs/en/env-vars#features-that-need-feature-flag-fetching>), including sessions on Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry, rebuilt the prompt on every request and `snapshot` had no effect. ##
modified Monitoring View current →
--- a/monitoring-usage.md +++ b/monitoring-usage.md @@ -106,7 +106,7 @@ `OTEL_LOG_USER_PROMPTS`| Enable logging of user prompt content (default: disabled)| `1` to enable `OTEL_LOG_ASSISTANT_RESPONSES`| Enable logging of assistant response text on `assistant_response` events (default: disabled). When unset, falls back to the value of `OTEL_LOG_USER_PROMPTS`. Requires Claude Code v2.1.193 or later| `1` to enable, `0` to keep redacted `OTEL_LOG_TOOL_DETAILS`| Enable logging of tool parameters and input arguments in tool events and trace span attributes: Bash commands, MCP server and tool names, skill names, user-authored workflow names, and tool input. Also enables custom, plugin, and MCP command names on `user_prompt` events (default: disabled). For Claude Desktop’s built-in servers, in sessions Claude Desktop owns, `mcp_server_name`/`mcp_tool_name` emit on `tool_decision`/`tool_result` even with the flag off. The exception requires Claude Code v2.1.214 or later| `1` to enable -`OTEL_LOG_TOOL_CONTENT`| Enable logging of tool input and output content in span events (default: disabled). Requires tracing. Content is truncated at the content limit (60 KB by default)| `1` to enable +`OTEL_LOG_TOOL_CONTENT`| Enable logging of tool content in the `tool.output` span event (default: disabled). Span attributes carry tool content under their own gates. Requires tracing. Content is truncated at the content limit (60 KB by default)| `1` to enable `OTEL_LOG_RAW_API_BODIES`| Emit the full Anthropic Messages API request and response JSON as `api_request_body` / `api_response_body` log events (default: disabled). Bodies include the entire conversation history. Enabling this implies consent to everything `OTEL_LOG_USER_PROMPTS`, `OTEL_LOG_TOOL_DETAILS`, and `OTEL_LOG_TOOL_CONTENT` would reveal| `1` for inline bodies truncated at the content limit (60 KB by default), or `file:<dir>` for untruncated bodies on disk with a `body_ref` pointer in the event `CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH`| Content limit: the maximum length of content-bearing attributes such as model responses, tool content, system prompts, and raw API bodies, truncation marker included, in UTF-16 code units (default: 61440, i.e. 60 KB). The default is sized for backends that cap attribute values at 64 KB; raise it only if your backend accepts larger values, or lower it to cut telemetry volume. When an OpenTelemetry SDK attribute limit, `OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT` or one of its logrecord and span variants, is set lower, Claude Code truncates at that smaller value so the `[TRUNCATED ...]` marker stays within the SDK limit. Requires Claude Code v2.1.214 or later| `262144` `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE`| Metrics temporality preference (default: `delta`). Set to `cumulative` if your backend expects cumulative temporality| `delta`, `cumulative` @@ -256,7 +256,23 @@ `skill_name`| Skill name for the Skill tool| `OTEL_LOG_TOOL_DETAILS` `subagent_type`| Subagent type for the Agent tool or legacy Task tool| `OTEL_LOG_TOOL_DETAILS` -When `OTEL_LOG_TOOL_CONTENT=1`, this span also records a `tool.output` span event whose attributes contain the tool’s input and output bodies, truncated at the content limit (60 KB by default) per attribute. **`claude_code.tool.blocked_on_user`** +**`tool.output` span event on `claude_code.tool`** If you set `OTEL_LOG_TOOL_CONTENT=1`, Read and Bash calls can record a `tool.output` span event on the `claude_code.tool` span. Edit and Write calls record one only when you also set `OTEL_LOG_TOOL_DETAILS=1`. That variable isn’t scoped to those two tools, so check its row in the configuration table for the arguments it adds elsewhere. Claude Code writes this event from a tool call’s successful return, so a call that raises an error records nothing, whatever the tool. Among the calls that do return, it records no `tool.output` event for: + + * A call to any tool other than Read, Edit, Write, and Bash, including MCP tools and WebFetch + * A Read that returns anything other than file text, such as an image, a PDF, or a re-read of a file whose contents haven’t changed + * An Edit or Write call, unless you also set `OTEL_LOG_TOOL_DETAILS=1` + +The event carries these attributes, each truncated at the content limit (60 KB by default). `Gated by` names the variable an attribute needs on top of `OTEL_LOG_TOOL_CONTENT=1`, and for Edit and Write that variable gates the event itself rather than the attribute. + +Attribute| Description| Gated by +---|---|--- +`content`| Text the Read tool returned, or the text a Write call was asked to write| `OTEL_LOG_TOOL_DETAILS` for the Write tool +`output`| Combined output of a Bash command, with stderr interleaved into stdout| +`diff`| Structured patch the Edit tool applied| `OTEL_LOG_TOOL_DETAILS` +`file_path`| Target file path for the Read, Edit, and Write tools, repeating the span attribute of the same name| `OTEL_LOG_TOOL_DETAILS` +`bash_command`| Command string for the Bash tool| `OTEL_LOG_TOOL_DETAILS` + +The parent span’s `tool_name` attribute tells you which tool an event came from. An attribute cut at the content limit is accompanied by `<attribute>_truncated` and `<attribute>_original_length`. **`claude_code.tool.blocked_on_user`** Attribute| Description| Gated by ---|---|--- @@ -289,7 +305,7 @@ `num_non_blocking_error`| Count of hooks that failed without blocking| `num_cancelled`| Count of hooks cancelled before completion| -Additional content-bearing attributes such as `new_context`, `system_prompt_preview`, `user_system_prompt`, `tool_input`, and `response.model_output` are emitted only when detailed beta tracing is active. They are not part of the stable span schema.`user_system_prompt` additionally requires `OTEL_LOG_USER_PROMPTS=1`. It carries only the system prompt text you provide via the `systemPrompt` SDK option or `--system-prompt` and `--append-system-prompt` flags, truncated at the content limit (60 KB by default), and is emitted once per session rather than per request. +Additional content-bearing attributes such as `new_context`, `system_prompt_preview`, `user_system_prompt`, `tool_input`, and `response.model_output` are emitted only when detailed beta tracing is active. They are not part of the stable span schema.The gate on `new_context` depends on which span carries it, and each copy is truncated at the content limit (60 KB by default). On the `claude_code.tool` span it carries that tool call’s result, whatever the tool, and requires `OTEL_LOG_TOOL_CONTENT=1`. On the `claude_code.interaction` span it carries the user prompt, and on the `claude_code.llm_request` span the new user messages and tool results of that request. Both of those require `OTEL_LOG_USER_PROMPTS=1`.`user_system_prompt` additionally requires `OTEL_LOG_USER_PROMPTS=1`. It carries only the system prompt text you provide via the `systemPrompt` SDK option or `--system-prompt` and `--append-system-prompt` flags, truncated at the content limit (60 KB by default), and is emitted once per session rather than per request. ### @@ -807,6 +823,7 @@ * `body_truncated`: `"true"` when inline truncation occurred. Absent in file mode and when no truncation occurred. * `model`: Model identifier from the request parameters * `query_source`: Subsystem that issued the request (for example, `"compact"`) + * `request_body_id`: UUID that identifies this attempt’s request body. The `api_response_body` event for the attempt that succeeds carries the same value, so you can pair a response with the exact request that produced it. Requires Claude Code v2.1.274 or later #### @@ -814,7 +831,7 @@ API response body event -Logged for each successful API response when `OTEL_LOG_RAW_API_BODIES` is set. **Event Name** : `claude_code.api_response_body` **Attributes** : +Logged for each successful API response when `OTEL_LOG_RAW_API_BODIES` is set. In file mode (`OTEL_LOG_RAW_API_BODIES=file:<dir>`), Claude Code also appends one JSON line to `<dir>/index.jsonl` for each successful response, with the fields `timestamp`, `session_id`, `query_source`, `model`, `request_id`, `message_id`, `message_uuid`, `request_file`, and `response_file`. Read it to find the request and response files behind a given transcript message without querying your telemetry backend. The index file requires Claude Code v2.1.274 or later. **Event Name** : `claude_code.api_response_body` **Attributes** : * All standard attributes * `event.name`: `"api_response_body"` @@ -827,6 +844,9 @@ * `model`: Model identifier * `query_source`: Subsystem that issued the request * `request_id`: Anthropic API request ID from the response’s `request-id` header, such as `"req_011..."`. Present only when the API returns one. + * `request_body_id`: The `request_body_id` of the `api_request_body` event that this response answers. Requires Claude Code v2.1.274 or later + * `message.id`: Message ID the API assigned to the response, the `id` field of the response body. Requires Claude Code v2.1.274 or later + * `message.uuid`: UUID of the response’s final transcript entry. Together with `request_body_id`, it links a transcript message to the request and response bodies behind it. Requires Claude Code v2.1.274 or later #### @@ -1429,17 +1449,17 @@ * OpenTelemetry export to your backend is opt-in and requires explicit configuration. For Anthropic’s separate operational telemetry and how to disable it, see [Data usage](</docs/en/data-usage#telemetry-services>) * Raw file contents and code snippets are not included in metrics or events. Trace spans are a separate data path: see the `OTEL_LOG_TOOL_CONTENT` bullet below * When authenticated via OAuth, `user.email` is included in telemetry attributes, sent only to the OTel endpoint you configure, never to Anthropic. If this is a concern for your organization, work with your telemetry backend to filter or redact this field - * User prompt content is not collected by default. Only prompt length is recorded. To include prompt content, set `OTEL_LOG_USER_PROMPTS=1` + * User prompt content is not collected by default. Only prompt length is recorded. To include prompt content, set `OTEL_LOG_USER_PROMPTS=1`. Under detailed beta tracing this variable reaches further than prompt text: it also gates the `new_context` span attribute, which carries tool results on the `claude_code.llm_request` span * Assistant response text is not collected by default. Only response length is recorded. To include response text, set `OTEL_LOG_ASSISTANT_RESPONSES=1`. Like all OpenTelemetry data from Claude Code, the response text is sent only to the OTel endpoint you configure, never to Anthropic. When this variable is unset, `OTEL_LOG_USER_PROMPTS` is used as a fallback, so set `OTEL_LOG_ASSISTANT_RESPONSES=0` if you want prompt content without response content * Tool input arguments and parameters are not logged by default. To include them, set `OTEL_LOG_TOOL_DETAILS=1`. For Claude Desktop’s built-in servers, in sessions Claude Desktop owns, `tool_decision` and `tool_result` carry the `mcp_server_name`/`mcp_tool_name` pair, host-authored names rather than argument content, even with the flag off. The exception requires Claude Code v2.1.214 or later. This data is sent only to the OTEL endpoint you configure, never to Anthropic. Arguments may still contain sensitive values, so configure your telemetry backend to filter or redact these attributes as needed. When enabled: * `tool_result` and `tool_decision` events include a `tool_parameters` attribute with Bash commands, MCP server and tool names, and skill names. Fields such as `full_command` are emitted untruncated * `tool_result` events additionally include a `tool_input` attribute with file paths, URLs, search patterns, and other arguments. Individual values over 512 characters are truncated and the total is bounded to ~4 K characters * `user_prompt` events include the verbatim `command_name` for custom, plugin, and MCP commands * Trace spans include the same `tool_input` attribute and input-derived attributes such as `file_path`, with the same truncation as `tool_input` - * Tool input and output content is not logged in trace spans by default. To include it, set `OTEL_LOG_TOOL_CONTENT=1`. When enabled, span events include full tool input and output content truncated at the content limit (60 KB by default) per attribute. This can include raw file contents from Read tool results and Bash command output. Configure your telemetry backend to filter or redact these attributes as needed + * Tool content is not logged in trace spans by default. To include it, set `OTEL_LOG_TOOL_CONTENT=1`. The `claude_code.tool` span then carries a `tool.output` span event with raw file contents and Bash command output, truncated at the content limit (60 KB by default) per attribute. Tool content also reaches spans through `new_context`, whose gate differs per span. Configure your telemetry backend to filter or redact these attributes as needed * Raw Anthropic Messages API request and response bodies are not logged by default. To include them, set `OTEL_LOG_RAW_API_BODIES` in your shell, user settings, or managed settings. It’s ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). The bodies contain the full conversation history, including the system prompt, every prior user and assistant turn, and tool results, so enabling this implies consent to everything the other `OTEL_LOG_*` content flags would reveal. Claude Code always redacts Claude’s extended-thinking content from these bodies, regardless of other settings. The value you set determines how Claude Code delivers the bodies: * With `=1`, Claude Code emits `api_request_body` and `api_response_body` log events for each API call. The events’ `body` attribute carries the JSON-serialized payload, truncated at the content limit (60 KB by default) - * With `=file:<dir>`, Claude Code writes untruncated bodies to `.request.json` and `.response.json` files under that directory, and the events carry a `body_ref` path instead of the inline body. Ship the directory with a log collector or sidecar rather than through the telemetry stream + * With `=file:<dir>`, Claude Code writes untruncated bodies to `.request.json` and `.response.json` files under that directory, and the events carry a `body_ref` path instead of the inline body. Ship the directory with a log collector or sidecar rather than through the telemetry stream. For each successful response, Claude Code also appends one line to `index.jsonl` in that directory, linking the response file to the request file that produced it and to the transcript message it became. Each line holds no message content, and the API response body event section lists its fields. The index file requires Claude Code v2.1.274 or later ##
modified Observability with OpenTelemetry View current →
--- a/observability.md +++ b/observability.md @@ -221,7 +221,7 @@ ---|--- `OTEL_LOG_USER_PROMPTS=1`| Prompt text on `claude_code.user_prompt` events and on the `claude_code.interaction` span `OTEL_LOG_TOOL_DETAILS=1`| Tool input arguments (file paths, shell commands, search patterns) on `claude_code.tool_result` events -`OTEL_LOG_TOOL_CONTENT=1`| Full tool input and output bodies as span events on `claude_code.tool`, truncated at 60 KB by default, configurable via `CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH`, which requires Claude Code v2.1.214 or later. Requires tracing to be enabled +`OTEL_LOG_TOOL_CONTENT=1`| A [`tool.output` span event](</docs/en/monitoring-usage#tool-output-span-event>) on `claude_code.tool` with file contents and Bash output, truncated at 60 KB by default, configurable via `CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH`, which requires Claude Code v2.1.214 or later. Requires tracing to be enabled. Span attributes carry tool content under [their own gates](</docs/en/monitoring-usage#new-context-gates>) `OTEL_LOG_RAW_API_BODIES`| Full Anthropic Messages API request and response JSON as `claude_code.api_request_body` and `claude_code.api_response_body` log events. Set to `1` for inline bodies truncated at 60 KB by default, or `file:<dir>` for untruncated bodies on disk with a `body_ref` path in the event. `CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH` configures the inline truncation limit, and requires Claude Code v2.1.214 or later. Bodies include the entire conversation history and have extended-thinking content redacted. Enabling this implies consent to everything the three variables above would reveal Leave these unset unless your observability pipeline is approved to store the data your agent handles. See [Security and privacy](</docs/en/monitoring-usage#security-and-privacy>) in the Monitoring reference for the full list of attributes and redaction behavior.
modified Create and distribute a plugin marketplace View current →
--- a/plugin-marketplaces.md +++ b/plugin-marketplaces.md @@ -757,6 +757,8 @@ Host and distribute marketplaces +When users add a marketplace hosted in a git repository, or install a git-based plugin it lists, Claude Code clones that marketplace or plugin repository onto their machine. The clone never downloads [Git LFS](<https://git-lfs.com>) content, so LFS-tracked files arrive as pointer files. Keep the files your plugins need out of LFS. + ### ​ @@ -803,12 +805,12 @@ Background auto-updates -By default, the background refresh disables git credential helpers for its `git pull`, so the pull can’t authenticate to private repositories over HTTPS even when a helper is configured. SSH remotes aren’t affected: a key loaded in `ssh-agent` authenticates background pulls the same way as the commands you run. When the background pull fails, Claude Code falls back to re-cloning the marketplace from scratch. The re-clone does use your stored git credentials, but it can time out on large repositories, so private-marketplace auto-updates may fail intermittently. Two settings make private marketplaces behave predictably: - - * Set `CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE=1` to keep the existing clone when the background pull fails, instead of deleting and re-cloning. Your plugins keep working from the last synced state, and manual updates with `/plugin marketplace update` still pull with your credentials. - * Configure a git credential helper, for example with `gh auth setup-git` for GitHub, so the re-clone fallback can authenticate without prompting. - -Setting a provider token such as `GITHUB_TOKEN` in your environment doesn’t by itself enable background authentication. Tokens take effect only through a configured credential helper, for example the `gh` CLI’s helper, which reads `GH_TOKEN` and `GITHUB_TOKEN`. To make the background pull itself authenticate over HTTPS, configure a global git URL rewrite. The rewrite embeds a token in the remote URL, so it takes effect even though the background pull disables credential helpers, and a successful pull skips the re-clone fallback. The following example rewrites the marketplace repository’s URL to include an access token: +By default, the background refresh disables git credential helpers when it checks the marketplace’s remote for new commits, so the check can’t authenticate to private repositories over HTTPS even when a helper is configured. SSH remotes aren’t affected: a key loaded in `ssh-agent` authenticates the background check the same way as the commands you run. When the check finds new commits, or fails because it can’t reach or authenticate to the remote, Claude Code clones the marketplace again and swaps the new clone in. If that clone fails, the existing checkout stays in place. The re-clone does use your stored git credentials, but it can time out on large repositories, so private-marketplace auto-updates may fail intermittently. Two settings make private marketplaces behave predictably: + + * Set `CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE=1` to keep the existing checkout without attempting the re-clone when the background check can’t reach or authenticate to the remote. Your plugins keep working from the last synced state, and manual updates with `/plugin marketplace update` still authenticate with your credentials. + * Configure a git credential helper, for example with `gh auth setup-git` for GitHub, so the re-clone can authenticate without prompting. + +Setting a provider token such as `GITHUB_TOKEN` in your environment doesn’t by itself enable background authentication. Tokens take effect only through a configured credential helper, for example the `gh` CLI’s helper, which reads `GH_TOKEN` and `GITHUB_TOKEN`. To make the background check itself authenticate over HTTPS, configure a global git URL rewrite. The rewrite embeds a token in the remote URL, so it takes effect even though the background check disables credential helpers. When the check finds the checkout up to date, Claude Code skips the re-clone. The following example rewrites the marketplace repository’s URL to include an access token: git config --global url."https://x-access-token:YOUR_TOKEN@github.com/acme-corp/plugins".insteadOf "https://github.com/acme-corp/plugins" @@ -822,7 +824,7 @@ The rewrite stores the token in plaintext in your gitconfig, so use a token with read-only access to the marketplace repository. -In CI/CD environments, configure a git credential helper before installing plugins from private repositories. On GitHub Actions, export a token with read access to the marketplace repository as `GH_TOKEN`, then run `gh auth setup-git`. The default workflow token can only access the workflow’s own repository, so a private marketplace in another repository needs a personal access token or app token. A global URL rewrite configured in the pipeline also authenticates the background pull directly. +In CI/CD environments, configure a git credential helper before installing plugins from private repositories. On GitHub Actions, export a token with read access to the marketplace repository as `GH_TOKEN`, then run `gh auth setup-git`. The default workflow token can only access the workflow’s own repository, so a private marketplace in another repository needs a personal access token or app token.If you configure a global URL rewrite in the pipeline, the rewrite also authenticates the background check directly. ### @@ -923,7 +925,8 @@ Then set `CLAUDE_CODE_PLUGIN_SEED_DIR=/opt/claude-seed` in your container’s runtime environment so Claude Code reads from the seed on startup. At startup, Claude Code registers marketplaces found in the seed’s `known_marketplaces.json` into the primary configuration, and uses plugin caches found under `cache/` in place without re-cloning. This works in both interactive mode and non-interactive mode with the `-p` flag. Behavior details: - * **Read-only** : the seed directory is never written to. Auto-updates are disabled for seed marketplaces since git pull would fail on a read-only filesystem. + * **Read-only** : Claude Code never writes to the seed directory. + * **Auto-updates disabled** : seed marketplaces don’t auto-update. * **Seed entries take precedence** : marketplaces declared in the seed overwrite any matching entries in the user’s configuration on each startup. To opt out of a seed plugin, use `/plugin disable` rather than removing the marketplace. * **Path resolution** : Claude Code locates marketplace content by probing `$CLAUDE_CODE_PLUGIN_SEED_DIR/marketplaces/<name>/` at runtime, not by trusting paths stored inside the seed’s JSON. This means the seed works correctly even when mounted at a different path than where it was built. * **Mutation is blocked** : running `/plugin marketplace remove` or `/plugin marketplace update` against a seed-managed marketplace fails with guidance to ask your administrator to update the seed image. @@ -955,7 +958,7 @@ "strictKnownMarketplaces": [] } -Allow only the official Anthropic marketplace. Matching for a single-repository entry is exact, so this entry doesn’t cover `ref` or `path` variants of the same repository: +Claude Code downloads the plugins [synced from claude.ai](</docs/en/plugins-reference#synced-plugins>) from your account rather than from a marketplace, so this lockdown doesn’t cover them. To stop those as well, set [`syncClaudeAiPlugins`](</docs/en/settings-reference#syncclaudeaiplugins>) to `false` in managed settings, or turn off Skills for your organization on claude.ai. Allow only the official Anthropic marketplace. Matching for a single-repository entry is exact, so this entry doesn’t cover `ref` or `path` variants of the same repository: { "strictKnownMarketplaces": [ @@ -1432,11 +1435,12 @@ For background auto-updates: - * By default, background refreshes disable git credential helpers for the pull, so the pull can’t authenticate over HTTPS. SSH remotes with a key loaded in `ssh-agent` still authenticate. A failed pull triggers a re-clone from scratch, which uses your stored credentials but may time out on large repositories - * Set `CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE=1` to keep the existing clone when the background pull fails - * Configure a git credential helper, for example `gh auth setup-git`, so the re-clone fallback can authenticate + * By default, background refreshes disable git credential helpers when they check the remote for new commits, so the check can’t authenticate over HTTPS. SSH remotes with a key loaded in `ssh-agent` still authenticate + * When the check can’t authenticate, Claude Code re-clones the marketplace with your stored credentials, but the re-clone may time out on large repositories + * Set `CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE=1` to keep the existing checkout without attempting the re-clone when the background check can’t reach or authenticate to the remote + * Configure a git credential helper, for example `gh auth setup-git`, so the re-clone can authenticate * If the re-clone times out on a large repository, increase the limit with `CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS` - * Configure a git URL rewrite scoped to the marketplace repository so the background pull authenticates directly + * Configure a git URL rewrite scoped to the marketplace repository so the background check authenticates directly * Or update private marketplaces manually with `/plugin marketplace update <name>`, which uses your credentials ### @@ -1445,7 +1449,7 @@ Marketplace updates fail in offline environments -**Symptoms** : Marketplace `git pull` fails in the background and Claude Code repeatedly attempts a re-clone that can’t succeed. **Cause** : By default, when a `git pull` fails, Claude Code attempts a re-clone from scratch. In offline or airgapped environments, re-cloning fails the same way, and the restore of the previous cache afterward is best-effort. The refresh runs in the background after startup, so it doesn’t delay startup, but each session repeats the failed attempts and each git operation can wait out the 120-second timeout. **Solution** : Set `CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE=1` to skip the re-clone attempt and keep using the existing cache when the pull fails: +**Symptoms** : In an offline or airgapped environment, the background marketplace refresh can’t reach the remote and Claude Code repeatedly attempts a re-clone that can’t succeed. **Cause** : The background refresh checks the marketplace’s remote for new commits, and when the check can’t reach the remote, Claude Code attempts to clone the marketplace again. Offline, the clone fails the same way and the existing checkout stays in place. Before v2.1.274, the refresh ran `git pull` in the existing checkout, moved the checkout aside to re-clone when the pull failed, and restored it afterward on a best-effort basis. The refresh runs in the background after startup, so it doesn’t delay startup. Each session still repeats the failed attempt, and each git operation can wait out the 120-second timeout. **Solution** : Set `CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE=1` to skip the re-clone attempt and keep using the existing checkout when the check can’t reach the remote: export CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE=1 @@ -1457,7 +1461,7 @@ Git operations time out -**Symptoms** : Plugin installation or marketplace updates fail with a timeout error like “Git clone timed out after 120s” or “Git pull timed out after 120s”. **Cause** : Claude Code uses a 120-second timeout for all git operations, including cloning plugin repositories and pulling marketplace updates. Large repositories or slow network connections may exceed this limit. **Solution** : Increase the timeout using the `CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS` environment variable. The value is in milliseconds: +**Symptoms** : Plugin installation or marketplace updates fail with a timeout error such as `Git clone timed out after 120s`. **Cause** : Claude Code uses a 120-second timeout for all git operations, including cloning plugin repositories and re-cloning a marketplace to update it. Large repositories or slow network connections may exceed this limit. **Solution** : Increase the timeout using the `CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS` environment variable. The value is in milliseconds: export CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS=300000 # 5 minutes
modified Plugins reference View current →
--- a/plugins-reference.md +++ b/plugins-reference.md @@ -364,13 +364,19 @@ Plugins synced from claude.ai -In [Cowork](<https://claude.com/product/cowork>) and [cloud sessions](</docs/en/cloud-environments#what-carries-over-from-your-setup>), Claude Code downloads the plugins enabled for your claude.ai account into `~/.claude/plugins/synced/` in the session’s own environment and loads each one as `<name>@synced`, with no marketplace and no install record. Claude Code doesn’t load them in sessions you start in your own terminal. Inside that Cowork or cloud environment, `claude plugin list` shows the downloaded copies under a `Synced from claude.ai` heading. Before v2.1.239, Claude Code loaded these plugins as `<name>@inline`, the identity that `--plugin-dir` plugins use. Manage a synced plugin by the `<name>@synced` ID that `claude plugin list` prints: - - * **Turn one off** : in the synced session, run `claude plugin disable <name>@synced`, or ask Claude to run it. Claude Code saves the choice as `"<name>@synced": false` in that environment’s user-level [`enabledPlugins`](</docs/en/settings-reference#enabledplugins>). A synced plugin that your organization requires can’t be turned off this way. The command reports that the plugin is required by your organization and saves nothing. To turn the plugin back on, run `claude plugin enable <name>@synced` in the same session. - * **Keep one out of synced sessions** : to keep a plugin out of every synced session, [turn it off for your claude.ai account](</docs/en/desktop#extend-claude-code>). To keep it out of one project’s synced sessions in every environment, set `"<name>@synced": false` under `enabledPlugins` in that project’s committed `.claude/settings.json`. - * **Manage the plugin itself on claude.ai** : `claude plugin install`, `update`, and `uninstall` don’t apply to a synced plugin. To remove one, turn the plugin off for your claude.ai account; the next synced session starts without it. - -When an enabled plugin from any other source, such as a marketplace install, a skills-directory plugin, or a `--plugin-dir` plugin, matches a synced plugin’s name, Claude Code loads that plugin and reports the synced copy as not loaded. To use the claude.ai copy instead, disable your own copy. Before v2.1.239, Claude Code loaded the synced copy instead of a same-named marketplace install. +Claude Code loads the plugins enabled for your claude.ai account, including plugins your organization turns on for its members, alongside the plugins you install from marketplaces. It downloads each one into `~/.claude/plugins/synced/` and loads it as `<name>@synced`, with no marketplace and no install record. A synced plugin runs with the same trust as a marketplace plugin you installed: its skills, agents, hooks, MCP servers, and LSP servers all load. Where Claude Code syncs these plugins depends on the session: + + * In [Cowork](<https://claude.com/product/cowork>) and [cloud sessions](</docs/en/cloud-environments#what-carries-over-from-your-setup>), Claude Code downloads them into the session’s own environment when the session starts. Before v2.1.239, Claude Code loaded these plugins as `<name>@inline`, the identity that `--plugin-dir` plugins use. + * In terminal sessions where you sign in with your claude.ai account, Claude Code checks your account once each time it starts, then downloads new and updated plugins and removes the ones that you or your organization turned off, all in the background. Syncing in terminal sessions requires Claude Code v2.1.273 or later. + +The launch check runs in the background, so it can finish after your session has started. When it adds, updates, or removes a synced plugin in an interactive session, Claude Code shows `Plugins changed. Run /reload-plugins to activate.` Run [`/reload-plugins`](</docs/en/discover-plugins#apply-plugin-changes-without-restarting>) to load the change in that session, or leave it for the next time you start Claude Code. If you enable a plugin on claude.ai while a session is running, Claude Code downloads it the next time it starts. Plugin sync in terminal sessions runs under the same sign-in conditions as [skills synced from claude.ai](</docs/en/skills#where-synced-skills-load>). It also needs a sign-in that grants Claude Code access to your account’s plugins. A sign-in from an earlier version of Claude Code picks up plugin access the next time Claude Code renews that sign-in in the background, within a few hours, or right away if you run `/login` again. Plugin sync starts the next time you start Claude Code after that. `claude plugin list` shows synced plugins under a `Synced from claude.ai` heading, and the `/plugin` **Installed** tab lists them with `synced` as their source. Manage a synced plugin by the `<name>@synced` ID that `claude plugin list` prints: + + * **Turn one off** : run `claude plugin disable <name>@synced`, or disable it from the `/plugin` **Installed** tab. Claude Code saves the choice as `"<name>@synced": false` in your user-level [`enabledPlugins`](</docs/en/settings-reference#enabledplugins>). To turn the plugin back on, run `claude plugin enable <name>@synced`. + * **Keep one out everywhere** : [turn the plugin off for your claude.ai account](</docs/en/desktop#extend-claude-code>). To keep it out of one project in every environment, set `"<name>@synced": false` under `enabledPlugins` in that project’s committed `.claude/settings.json`. + * **Manage the plugin itself on claude.ai** : `claude plugin install`, `update`, and `uninstall` don’t apply to a synced plugin. Claude Code downloads a plugin’s updates at the next sync. To remove one, turn the plugin off for your claude.ai account, and Claude Code removes it at the next sync. + * **Stop syncing on a machine** : set [`syncClaudeAiPlugins`](</docs/en/settings-reference#syncclaudeaiplugins>) to `false` in your user settings. Claude Code stops downloading, and the next time it starts it moves the plugins it already synced to `~/.claude/plugins/.trash/` and no longer loads them. Your organization can set the same key in [managed settings](</docs/en/managed-settings>), or turn off Skills on claude.ai, which stops plugins from syncing too. + +You can’t turn off a plugin that your organization marks as required on claude.ai. Claude Code loads it even if you disabled it earlier, and `claude plugin disable` refuses with `Plugin "<name>@synced" is required by your organization and can't be disabled here. Contact your admin to change it.` In `claude plugin list`, these plugins are marked `required by your org`. When an enabled plugin from any other source matches a synced plugin’s name, Claude Code loads that plugin and reports the synced copy as not loaded. Other sources include marketplace installs, skills-directory plugins, `--plugin-dir` plugins, and plugins built into Claude Code. To use the claude.ai copy instead, disable your own copy. Before v2.1.239, Claude Code loaded the synced copy instead of a same-named marketplace install. * * * @@ -725,10 +731,11 @@ Plugin caching and file resolution -Plugins are specified in one of two ways: +Plugins are specified in one of three ways: * Through `claude --plugin-dir` or `claude --plugin-url`, for the duration of a session. * Through a marketplace, installed for future sessions. + * Through your claude.ai account, synced into `~/.claude/plugins/synced/`. For security and verification purposes, Claude Code copies _marketplace_ plugins to the user’s local **plugin cache** (`~/.claude/plugins/cache`), unless the plugin loads in place. A [`command` source in link mode](</docs/en/plugin-marketplaces#copy-mode-and-link-mode>) loads in place through links in the cache entry. A [relative path source](</docs/en/plugin-marketplaces#relative-paths>) in a marketplace added from a local directory loads in place from the marketplace folder. For a plugin loaded in place from a local-directory marketplace, your edits to the source directory take effect at the next session start or `/reload-plugins`. You don’t need a version bump. The plugin’s hook processes and MCP and LSP servers receive a `CLAUDE_PLUGIN_ROOT` that points at the source directory. Claude Code doesn’t install the plugin’s Node.js package dependencies into the source directory. Install them there yourself, or from a hook into the persistent data directory. For copied plugins, each installed version is a separate directory in the cache, grouped by marketplace and plugin and named for the resolved version, with its own copy of the plugin’s files and Node.js package dependencies. A dependency resolved from a [release tag](</docs/en/plugin-dependencies#tag-plugin-releases-for-version-resolution>) gets a directory name with a commit-SHA suffix. When you update or uninstall a plugin, Claude Code marks the previous version directory as orphaned and removes it in a background sweep roughly 14 days later. The grace period lets concurrent Claude Code sessions that already loaded the old version keep running without errors. Claude Code runs the sweep only while at least one plugin is installed; after you uninstall your last plugin, orphaned directories stay on disk until you install a plugin again. Claude Code removes a plugin or marketplace folder from the cache only when it no longer contains any directory or symlink. If you symlink a development checkout into the cache as a plugin’s version entry, Claude Code never marks the link as orphaned and never removes it or the folders that hold it. Claude Code also never writes its version-tracking files inside the linked checkout. Claude’s Glob and Grep tools skip orphaned version directories during searches, so file results don’t include outdated plugin code. @@ -1020,7 +1027,7 @@ The command takes these arguments: - * `<plugin>`: Plugin name or `plugin-name@marketplace-name` + * `<plugin>`: Plugin name, `plugin-name@marketplace-name`, or `plugin-name@synced` for a plugin synced from claude.ai The command accepts these options: @@ -1042,7 +1049,7 @@ The command takes these arguments: - * `[plugin]`: Plugin name or `plugin-name@marketplace-name`. Optional when using `--all` + * `[plugin]`: Plugin name, `plugin-name@marketplace-name`, or `plugin-name@synced` for a plugin synced from claude.ai. Optional when using `--all` The command accepts these options: @@ -1102,7 +1109,7 @@ Within an interactive session, `/plugin list` prints a similar listing inline, but it covers marketplace-installed plugins only: * Plugins loaded from skills directories appear in the `/plugin` interface and in `claude plugin list`, but not in the inline `/plugin list` output. - * On Claude Code v2.1.239 or later, plugins synced from claude.ai appear in `claude plugin list` when you run it in the environment where a synced session downloaded them. They don’t appear in the inline `/plugin list` output. + * Plugins synced from claude.ai appear in `claude plugin list` on Claude Code v2.1.239 or later and in the `/plugin` interface, but not in the inline `/plugin list` output. * Plugins loaded for the session with `--plugin-dir` or `--plugin-url` appear in the `/plugin` interface, and in `claude plugin list` only when the same flag precedes the subcommand, as in `claude --plugin-dir <dir> plugin list`. Only the flag names their location, so a bare `claude plugin list` can’t find them, unlike synced plugins and skills-directory plugins, whose fixed directories Claude Code scans. The interactive form accepts `--enabled` or `--disabled` to show only plugins in that state, and `ls` as a shorthand for `list`.
modified How Claude Code uses prompt caching View current →
--- a/prompt-caching.md +++ b/prompt-caching.md @@ -270,7 +270,7 @@ Resuming a session -When you [resume a session](</docs/en/sessions#resume-a-session>), Claude Code sends the whole conversation again, and the request reads from the cache whatever part of its prefix is unchanged and still within the cache lifetime. The layer table at the top of this page says what changes each layer. The system prompt would change after a Claude Code upgrade or with different [`--append-system-prompt`](</docs/en/cli-reference#system-prompt-flags>) text on the resume. By default, the resumed conversation keeps the system prompt it started with, so its history still sits behind the same prompt, and the change takes effect once the conversation is compacted or in a new conversation. [System prompt flags in resumed conversations](</docs/en/cli-reference#system-prompt-flags-in-resumed-conversations>) covers `--system-prompt-snapshot off` and bare mode, where this doesn’t apply. +When you [resume a session](</docs/en/sessions#resume-a-session>), Claude Code sends the whole conversation again, and the request reads from the cache whatever part of its prefix is unchanged and still within the cache lifetime. The layer table at the top of this page says what changes each layer. The system prompt would change after a Claude Code upgrade or with different [`--append-system-prompt`](</docs/en/cli-reference#system-prompt-flags>) text on the resume. By default, the resumed conversation keeps the system prompt it started with, so its history still sits behind the same prompt, and the change takes effect once the conversation is compacted or in a new conversation. [System prompt flags in resumed conversations](</docs/en/cli-reference#system-prompt-flags-in-resumed-conversations>) covers the cases where Claude Code rebuilds the prompt on every request instead. ##
modified Agent SDK reference - Python View current →
--- a/python.md +++ b/python.md @@ -843,7 +843,7 @@ class ClaudeAgentOptions: tools: list[str] | ToolsPreset | None = None allowed_tools: list[str] = field(default_factory=list) - system_prompt: str | SystemPromptPreset | SystemPromptFile | None = None + system_prompt: str | SystemPromptPreset | SystemPromptCustom | SystemPromptFile | None = None mcp_servers: dict[str, McpServerConfig] | str | Path = field(default_factory=dict) strict_mcp_config: bool = False permission_mode: PermissionMode | None = None @@ -894,7 +894,7 @@ ---|---|---|--- `tools`| `list[str] | ToolsPreset | None`| `None`| Tools configuration. Use `{"type": "preset", "preset": "claude_code"}` for Claude Code’s default tools `allowed_tools`| `list[str]`| `[]`| Tools to auto-approve without prompting. This does not restrict Claude to only these tools. If you name one of the [task-tracking tools](</docs/en/agent-sdk/todo-tracking#model-availability>) here, Claude Code also opts the session in. Other unlisted tools fall through to `permission_mode` and `can_use_tool`. Use `disallowed_tools` to block tools. See [Permissions](</docs/en/agent-sdk/permissions#allow-and-deny-rules>) -`system_prompt`| `str | SystemPromptPreset | SystemPromptFile | None`| `None`| System prompt configuration. Pass a string for a custom prompt, `{"type": "preset", "preset": "claude_code"}` for Claude Code’s system prompt with optional `"append"`, or `{"type": "file", "path": "..."}` to load a large prompt from disk. See `SystemPromptPreset` and `SystemPromptFile` +`system_prompt`| `str | SystemPromptPreset | SystemPromptCustom | SystemPromptFile | None`| `None`| System prompt configuration. Pass a string for a custom prompt, `{"type": "preset", "preset": "claude_code"}` for Claude Code’s system prompt with optional `"append"`, `{"type": "custom", "prompt": "..."}` for a custom prompt that can also set `"snapshot"`, or `{"type": "file", "path": "..."}` to load a large prompt from disk. See `SystemPromptPreset`, `SystemPromptCustom`, and `SystemPromptFile` `mcp_servers`| `dict[str, McpServerConfig] | str | Path`| `{}`| MCP server configurations or path to config file `strict_mcp_config`| `bool`| `False`| When `True`, use only the servers passed in `mcp_servers` and ignore project `.mcp.json`, user settings, plugin-provided MCP servers, and [claude.ai connectors](</docs/en/mcp#use-mcp-servers-from-claude-ai>). Maps to the CLI `--strict-mcp-config` flag `permission_mode`| `PermissionMode | None`| `None`| Permission mode for tool usage @@ -996,6 +996,7 @@ preset: Literal["claude_code"] append: NotRequired[str] exclude_dynamic_sections: NotRequired[bool] + snapshot: NotRequired[bool] Field| Required| Description ---|---|--- @@ -1003,6 +1004,26 @@ `preset`| Yes| Must be `"claude_code"` to use Claude Code’s system prompt `append`| No| Additional instructions to append to the preset system prompt `exclude_dynamic_sections`| No| Move per-session context such as working directory, the git-repo flag, and auto memory paths from the system prompt into the first user message. Improves prompt-cache reuse across users and machines. See [Modify system prompts](</docs/en/agent-sdk/modifying-system-prompts#improve-prompt-caching-across-users-and-machines>) +`snapshot`| No| Set to `False` to rebuild the system prompt on every request instead of [reusing the prompt the session recorded on its first request](</docs/en/agent-sdk/modifying-system-prompts#change-the-prompt-of-an-existing-session>). Requires `claude-agent-sdk` v0.2.153 or later + +### + +​ + +`SystemPromptCustom` + +A custom system prompt in object form, equivalent to passing a string as `system_prompt`, that can also set `snapshot`. Requires `claude-agent-sdk` v0.2.153 or later. + + class SystemPromptCustom(TypedDict): + type: Literal["custom"] + prompt: str + snapshot: NotRequired[bool] + +Field| Required| Description +---|---|--- +`type`| Yes| Must be `"custom"` +`prompt`| Yes| The system prompt text. Passed to the CLI as a command-line argument, so the command-line length limits apply +`snapshot`| No| Same as `SystemPromptPreset.snapshot`, applied to `prompt` ###
modified Settings files and precedence View current →
--- a/settings.md +++ b/settings.md @@ -342,6 +342,7 @@ [`crossSessionInbound`](</docs/en/settings-reference#crosssessioninbound>)| A stricter value from `.claude/settings.json` or `.claude/settings.local.json`, on the `accept` < `hold` < `refuse` ladder| Honored over managed, `--settings`, and user values; a project or local value that isn’t stricter is ignored [`useAutoModeDuringPlan`](</docs/en/settings-reference#useautomodeduringplan>)| `false` from any managed source, `--settings`, `~/.claude/settings.json`, or `.claude/settings.local.json`| Honored even when the winning managed source sets `true`; a `false` in `.claude/settings.json` is ignored [`syncClaudeAiSkills`](</docs/en/settings-reference#syncclaudeaiskills>)| `false` from any managed source, `--settings`, `~/.claude/settings.json`, or `.claude/settings.local.json`| Honored even when the winning managed source sets `true`; a `false` in `.claude/settings.json` is ignored +[`syncClaudeAiPlugins`](</docs/en/settings-reference#syncclaudeaiplugins>)| `false` from any managed source, `--settings`, `~/.claude/settings.json`, or `.claude/settings.local.json`| Honored even when the winning managed source sets `true`; a `false` in `.claude/settings.json` is ignored [`maxEffortLevel`](</docs/en/settings-reference#maxeffortlevel>)| A lower cap from any scope, including `--settings`| Honored even when the managed settings Claude Code applies set a higher cap; the lowest cap applies. Requires Claude Code v2.1.267 or later An app that runs Claude Code inside itself and sets [`CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`](</docs/en/env-vars>) is also an exception. Claude Code takes that app’s model configuration over the `model`, `fallbackModel`, `modelPicker`, and `modelOverrides` keys from every managed source, and over the model-selection variables in a managed `env` block, such as `ANTHROPIC_MODEL` and the `ANTHROPIC_DEFAULT_*_MODEL` family. Claude Code keeps a managed [`availableModels`](</docs/en/settings-reference#availablemodels>) allowlist in force unless the app supplies its own.
modified All settings View current →
--- a/settings-reference.md +++ b/settings-reference.md @@ -213,7 +213,8 @@ `subagentPromptCacheTtl`| Choose the [prompt cache lifetime](</docs/en/prompt-caching#cache-lifetime>) for subagents and other requests outside the main conversation| Model and responses| Any file `subagentStatusLine`| Rewrite rows in the [subagent](</docs/en/sub-agents>) task display with your own command| Interface and terminal| Any file `switchModelsOnFlag`| Switch models automatically or pause when a [safety classifier](</docs/en/model-config#ask-before-switching>) flags a request| Model and responses| Any file -`syncClaudeAiSkills`| Stop downloading the [skills enabled on your claude.ai account](</docs/en/skills#how-synced-skills-behave>) and hide the ones already synced| Plugins and skills| User, local, or managed +`syncClaudeAiPlugins`| Stop loading the [plugins enabled on your claude.ai account](</docs/en/plugins-reference#synced-plugins>) and stop downloading new ones| Plugins and skills| User, local, or managed +`syncClaudeAiSkills`| Stop loading the [skills enabled on your claude.ai account](</docs/en/skills#how-synced-skills-behave>) and stop downloading new ones| Plugins and skills| User, local, or managed `syntaxHighlightingDisabled`| Turn off syntax highlighting in diffs and code blocks| Interface and terminal| Any file `taskOutputMaxChars`| Set how much of a [background task’s](</docs/en/tools-reference#background-commands>) output Claude receives inline| Memory and context| Any file `teammateDefaultModel`| Removed in v2.1.234; see [Specify teammates and models](</docs/en/agent-teams#specify-teammates-and-models>) for how Claude Code picks a teammate’s model| Global config settings| Global config @@ -4033,20 +4034,42 @@ `syncClaudeAiSkills` -Turn off the download of the [skills you enable on claude.ai](</docs/en/skills#how-synced-skills-behave>). Claude Code downloads them into `~/.claude/skills/synced/` when you run it in [non-interactive mode](</docs/en/headless>) with the `-p` flag and [`CLAUDE_CODE_SYNC_SKILLS`](</docs/en/env-vars#variables>) set. Set `false` to stop that download and hide the skills it already synced. Claude Code honors only `false`: `true` is the same as unset and doesn’t turn syncing on. - - * **Scope** : `User, local, or managed`. A repository can’t turn it off for you. - * **Type** : Boolean - * `false`: Claude Code stops downloading synced skills and hides the ones already in `~/.claude/skills/synced/`. In user or managed settings, it also moves them to `~/.claude/skills/.trash/` +Turn off the download of the [skills enabled for your claude.ai account](</docs/en/skills#how-synced-skills-behave>). Claude Code downloads them into `~/.claude/skills/synced/` in [terminal sessions where you sign in with your claude.ai account](</docs/en/skills#where-synced-skills-load>), interactive or non-interactive, and in Cowork and cloud sessions. Set `false` to stop that download and stop loading the skills it already synced. Claude Code honors only `false`: `true` is the same as unset and doesn’t turn syncing on where it’s otherwise off. + + * **Scope** : `User, local, or managed`, and files passed with `--settings`. A repository can’t turn it off for you. + * **Type** : Boolean + * `false`: Claude Code stops downloading synced skills and stops loading the ones already in `~/.claude/skills/synced/`. In user or managed settings, it also moves them to `~/.claude/skills/.trash/` * `true`: the same as unset - * **Default** : unset, so a non-interactive run with `CLAUDE_CODE_SYNC_SKILLS` set downloads the skills - -This example keeps a machine from downloading the account’s skills, whatever a session sets in its environment: + * **Default** : unset, so sessions signed in with your claude.ai account sync your skills + +This example keeps a machine from downloading the account’s skills in any session: settings.json { "syncClaudeAiSkills": false + } + +### + +​ + +`syncClaudeAiPlugins` + +Turn off the download of the [plugins enabled for your claude.ai account](</docs/en/plugins-reference#synced-plugins>). Claude Code downloads them into `~/.claude/plugins/synced/` at the start of terminal sessions where you sign in with your claude.ai account, and in Cowork and cloud sessions, and loads each one as `<name>@synced`. Set `false` to stop that download and stop loading the plugins it already synced. Claude Code honors only `false`: `true` is the same as unset and doesn’t turn syncing on where it’s otherwise off. Requires Claude Code v2.1.273 or later. + + * **Scope** : `User, local, or managed`, and files passed with `--settings`. A repository can’t turn it off for you. + * **Type** : Boolean + * `false`: Claude Code stops downloading synced plugins and stops loading the ones already in `~/.claude/plugins/synced/`. In user or managed settings, it also moves them to `~/.claude/plugins/.trash/` + * `true`: the same as unset + * **Default** : unset, so sessions signed in with your claude.ai account sync your plugins + +To turn off one synced plugin rather than all of them, set `"<name>@synced": false` in `enabledPlugins`. This example keeps a machine from downloading the account’s plugins in any session: + +settings.json + + { + "syncClaudeAiPlugins": false } ### @@ -4514,7 +4537,7 @@ * **`directory`** : a local filesystem path, with `path`, for development only * **`settings`** : an inline marketplace declared directly in the settings file without a hosted repository, with `name` and `plugins` -The `git` source type works with any git hosting service, including self-hosted GitLab and Bitbucket. Claude Code clones the repository with the same authentication that `git clone` would use on that machine: configured credential helpers or SSH keys. A provider token such as `GITHUB_TOKEN` takes effect only through a credential helper that reads it. See [Private repositories](</docs/en/plugin-marketplaces#private-repositories>) for setup details. For `github` and `git` sources, set `"skipLfs": true` inside the `source` object, alongside `repo` or `url`, to skip Git LFS downloads when Claude Code clones or updates the marketplace repository. LFS pointer files remain as pointers instead of downloading their content. Use this when the repository contains large LFS objects unrelated to plugin content. For a `url` source, set `headersHelper` inside the `source` object when the credential in `headers` expires and a command has to produce a fresh one. Requires Claude Code v2.1.238 or later. For what the command must print and where Claude Code runs it, see [Write the headersHelper command](</docs/en/plugin-marketplaces#write-the-headershelper-command>), and for the cases where Claude Code doesn’t run it, see [When Claude Code skips a headersHelper command](</docs/en/plugin-marketplaces#when-claude-code-skips-a-headershelper-command-or-drops-its-output>). Once you set `headersHelper` on an `https://` marketplace URL, Claude Code runs the command at two points, reusing one run’s output for up to 60 seconds: +The `git` source type works with any git hosting service, including self-hosted GitLab and Bitbucket. Claude Code clones the repository with the same authentication that `git clone` would use on that machine: configured credential helpers or SSH keys. A provider token such as `GITHUB_TOKEN` takes effect only through a credential helper that reads it. See [Private repositories](</docs/en/plugin-marketplaces#private-repositories>) for setup details. For `github` and `git` sources, Claude Code never downloads [Git LFS](<https://git-lfs.com>) content when it clones the marketplace repository to add or update it. LFS-tracked files are checked out as pointer files, and the add or update output reports how many. The `skipLfs` field inside the `source` object is accepted and has no effect. Before v2.1.274, Claude Code downloaded LFS content unless you set `"skipLfs": true`. For a `url` source, set `headersHelper` inside the `source` object when the credential in `headers` expires and a command has to produce a fresh one. Requires Claude Code v2.1.238 or later. For what the command must print and where Claude Code runs it, see [Write the headersHelper command](</docs/en/plugin-marketplaces#write-the-headershelper-command>), and for the cases where Claude Code doesn’t run it, see [When Claude Code skips a headersHelper command](</docs/en/plugin-marketplaces#when-claude-code-skips-a-headershelper-command-or-drops-its-output>). Once you set `headersHelper` on an `https://` marketplace URL, Claude Code runs the command at two points, reusing one run’s output for up to 60 seconds: * Before each fetch of that marketplace’s `marketplace.json`, including a later refresh. Claude Code sends the printed headers with that fetch. * Before each plugin archive download on the marketplace URL’s origin, meaning the same scheme, host, and port. Claude Code sends the output with that download, and no other download gets the headers. @@ -4946,7 +4969,7 @@ "teammateMode": "auto" } -Before v2.1.179, the default was `auto`. The `iterm2` value requires Claude Code v2.1.186 or later. +The `iterm2` value requires Claude Code v2.1.186 or later. ###
modified Run parallel sessions with worktrees View current →
--- a/worktrees.md +++ b/worktrees.md @@ -111,7 +111,7 @@ Claude Code runs a periodic sweep that removes worktrees that Claude created for subagents and [background sessions](</docs/en/agent-view#how-file-edits-are-isolated>) once they are older than your [`cleanupPeriodDays`](</docs/en/settings-reference#cleanupperioddays>) setting, following the [retention sweep rules](</docs/en/claude-directory#cleaned-up-automatically>). When you [background](</docs/en/agent-view#send-the-session-to-the-background>) a `--worktree` session, its worktree becomes a background-session worktree that the sweep can remove. The sweep leaves a worktree in place in these cases: * The worktree still holds work: changed or untracked files, or unpushed commits. - * Claude Code can’t determine which filter drivers the repository config defines, in any of the three cases that also block worktree creation. + * One of the four cases that also block worktree creation applies: Claude Code can’t determine which filter drivers the repository config defines, or finds a setting there it can’t switch off. * The worktree belongs to a `--worktree` session you haven’t backgrounded, whatever its age. * You created the worktree yourself with `git worktree add`, even if you then ran a `--worktree <name>` session in it and backgrounded that session. @@ -305,11 +305,12 @@ Git LFS files are pointer files in a worktree Claude Code created -If you set up [Git LFS](<https://git-lfs.com>) with `git lfs install --local`, a worktree that Claude Code creates contains LFS pointer files instead of the real files. The `--local` flag writes the LFS filter into the repository’s own `.git/config` rather than your global git config. A plain `git lfs install` writes to your global config and isn’t affected. The same applies to any other [filter driver](<https://git-scm.com/docs/gitattributes>) defined in the repository’s own config. Claude Code skips the repository’s own filter drivers when it creates a worktree because a filter driver is a shell command, and anything that can write to the repository, including Claude, could have put one there. Before v2.1.247, Claude Code ran those drivers during worktree creation. To get the real files, run `git lfs pull` inside the worktree. In three rare cases, Claude Code can’t tell which filter drivers the repository’s config defines, and creates no worktree at all. Match the error to its fix: +If you set up [Git LFS](<https://git-lfs.com>) with `git lfs install --local`, a worktree that Claude Code creates contains LFS pointer files instead of the real files. The `--local` flag writes the LFS filter into the repository’s own `.git/config` rather than your global git config. A plain `git lfs install` writes to your global config and isn’t affected. The same applies to any other [filter driver](<https://git-scm.com/docs/gitattributes>) defined in the repository’s own config. Claude Code skips the repository’s own filter drivers when it creates a worktree because a filter driver is a shell command, and anything that can write to the repository, including Claude, could have put one there. Before v2.1.247, Claude Code ran those drivers during worktree creation. To get the real files, run `git lfs pull` inside the worktree. In four rare cases, Claude Code creates no worktree at all: it can’t tell which filter drivers the repository’s config defines, or it finds a setting there it can’t switch off. Match the error to its fix: * **`Could not read the repository git config to neutralize filter drivers`** : Claude Code couldn’t read the repository’s `.git/config`, for example because of its permissions. Fix that and retry. * **`The repository git config defines a filter driver whose name cannot be neutralized (contains "=" or a newline)`** : rename or remove that filter driver in `.git/config` and retry. * **`The repository git config has a conditional include (includeIf)`** : move the settings the `includeIf` in `.git/config` pulls in directly into that file, remove the `includeIf`, and retry. An `includeIf` in your global git config doesn’t trigger this. + * **`Git was not run: the repository's own git config sets<key>`**: the message names a key that points Git LFS at a program to run, such as `lfs.customtransfer.<name>.path` or `lfs.standalonetransferagent`. If that setting is yours, move it to your global git config. If you don’t recognize it, remove it from the repository’s git config, since a tool or checkout you don’t trust may have written it. Retry once the key is gone from the repository’s config. ###