modified Set up Claude Code for your organization View current →
--- a/admin-setup.md +++ b/admin-setup.md @@ -139,5 +139,6 @@ * [Server-managed settings](</docs/en/server-managed-settings>): deliver managed policy from the Claude admin console * [Settings reference](</docs/en/settings>): every setting key, file location, and precedence rule + * [Monorepos and large repos](</docs/en/large-codebases>): per-directory configuration patterns for organizations deploying into a monorepo * [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Vertex AI](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>): provider-specific deployment * [Claude Enterprise Administrator Guide](<https://claude.com/resources/tutorials/claude-enterprise-administrator-guide>): SSO, SCIM, seat management, and rollout playbook
modified How the agent loop works View current →
--- a/agent-loop.md +++ b/agent-loop.md @@ -246,7 +246,7 @@ * **Summarization instructions in CLAUDE.md:** The compactor reads your CLAUDE.md like any other context, so you can include a section telling it what to preserve when summarizing. The section header is free-form (not a magic string); the compactor matches on intent. * **`PreCompact` hook:** Run custom logic before compaction occurs, for example to archive the full transcript. The hook receives a `trigger` field (`manual` or `auto`). See [hooks](</docs/en/agent-sdk/hooks>). - * **Manual compaction:** Send `/compact` as a prompt string to trigger compaction on demand. (Slash commands sent this way are SDK inputs, not CLI-only shortcuts. See [slash commands in the SDK](</docs/en/agent-sdk/slash-commands>).) + * **Manual compaction:** Send `/compact` as a prompt string to trigger compaction on demand. Commands sent this way are SDK inputs, not CLI-only shortcuts. See [commands in the SDK](</docs/en/agent-sdk/slash-commands>). Example: Summarization instructions in CLAUDE.md
modified Manage multiple agents with agent view View current →
--- a/agent-view.md +++ b/agent-view.md @@ -76,7 +76,7 @@ ✽ clawd walk cycle Write assets/sprites/clawd-walk.png 3m Ready for review - ∙ jump physics github.com/example/game/pull/2048 ● 2h + ∙ jump physics Opened PR with collision fix PR #2048 2h Needs input ✻ power-up design needs input: double jump or wall climb? 1m @@ -115,7 +115,7 @@ `∙`| The process has exited. You can still peek, reply, or attach, and Claude restarts from where it left off `✢`| A [`/loop`](</docs/en/scheduled-tasks>) session sleeping between iterations. The row shows its run count and a countdown -The `●` that can appear at the right edge of a row is the pull request status indicator, not part of the state icon. A number before it is the count of pull requests the session has opened. The terminal tab title shows the awaiting-input count while agent view is open: `2 awaiting input · claude agents` when sessions need input, or `claude agents` when none do. Background sessions don’t need any terminal open to keep working. A separate supervisor process runs them, so you can close agent view, close your shell, or start a new interactive session and your dispatched work keeps going. Session state persists on disk through auto-updates and supervisor restarts. Sessions are also preserved when your machine sleeps. Their processes resume on wake and the supervisor reconnects to them instead of treating the time gap as idle. Shutting down still stops running sessions; see Sessions show as failed after shutdown for how to recover them. +The `PR #N` label that can appear at the right edge of a row is the pull request the session opened, not part of the state icon. When a session has opened more than one pull request, the label shows a count instead, such as `3 PRs`. The terminal tab title shows the awaiting-input count while agent view is open: `2 awaiting input · claude agents` when sessions need input, or `claude agents` when none do. Background sessions don’t need any terminal open to keep working. A separate supervisor process runs them, so you can close agent view, close your shell, or start a new interactive session and your dispatched work keeps going. Session state persists on disk through auto-updates and supervisor restarts. Sessions are also preserved when your machine sleeps. Their processes resume on wake and the supervisor reconnects to them instead of treating the time gap as idle. Shutting down still stops running sessions; see Sessions show as failed after shutdown for how to recover them. ### @@ -131,16 +131,16 @@ Pull request status -When a session opens a pull request, a status dot appears at the right edge of the row, linked to the pull request in terminals that support hyperlinks. When the session has opened more than one pull request, the count appears before the dot and the color reflects whichever one most needs attention. - -Dot color| Pull request status +When a session opens a pull request, a `PR #1234` label appears at the right edge of the row, linked to the pull request in terminals that support hyperlinks. The label persists when you send a follow-up to the session, so the pull request remains visible while the row reverts to live progress. When a session has opened more than one pull request, the label shows a count instead, such as `3 PRs`, colored by the open pull request that most needs attention. Open the peek panel to see them all. The pull request number is colored by its status: + +Color| Pull request status ---|--- Yellow| Waiting on checks or review, or checks failed Green| Checks passed and no review is blocking Purple| Merged Grey| Draft or closed -For most tasks this row is where you pick up the result: review and merge the pull request when the dot turns green. +For most tasks this column is where you pick up the result: review and merge the pull request when its number turns green. ### @@ -156,7 +156,7 @@ Attach to a session -Press `Enter` or `→` on a selected row to attach. Agent view is replaced by the full interactive session, exactly as if you had run `claude` in that directory. When you attach, Claude posts a short recap of what happened while you were away. While attached, the session behaves like any other Claude Code session: every [command](</docs/en/commands>), keyboard shortcut, and feature works. Press `←` on an empty prompt to detach and return to agent view. If a dialog has focus and isn’t responding to `←`, press `Ctrl+Z` to detach immediately. Detaching never stops a background session: `←`, `Ctrl+C`, `Ctrl+D`, `Ctrl+Z`, and `/exit` all leave it running. To end a session from inside it, run `/stop`. After you’ve dispatched or backgrounded a session, pressing `←` on an empty prompt works from any Claude Code session, not only ones you attached to from agent view. It backgrounds the current session and opens agent view with that row selected, so you can switch sessions without leaving the terminal. The row is created even from a fresh session with no conversation history, so `→` returns to it. When that row is the only one, agent view shows an onboarding hint below it. You can turn this shortcut off in `/config` (the `leftArrowOpensAgents` setting). +Press `Enter` or `→` on a selected row to attach. Agent view is replaced by the full interactive session, exactly as if you had run `claude` in that directory. When you attach, Claude posts a short recap of what happened while you were away. While attached, the session behaves like any other Claude Code session: every [command](</docs/en/commands>), keyboard shortcut, and feature works. Press `←` on an empty prompt to detach and return to agent view. If a dialog has focus and isn’t responding to `←`, press `Ctrl+Z` to detach immediately. `Ctrl+C` keeps its standard interrupt behavior while attached: it cancels a running response or `!` shell command rather than detaching. Pressing `Ctrl+C` twice on an empty prompt detaches, the same as in any session. Detaching never stops a background session: `←`, `Ctrl+Z`, `/exit`, and double `Ctrl+C` or double `Ctrl+D` all leave it running. To end a session from inside it, run `/stop`. After you’ve dispatched or backgrounded a session, pressing `←` on an empty prompt works from any Claude Code session, not only ones you attached to from agent view. It backgrounds the current session and opens agent view with that row selected, so you can switch sessions without leaving the terminal. The row is created even from a fresh session with no conversation history, so `→` returns to it. When that row is the only one, agent view shows an onboarding hint below it. You can turn this shortcut off in `/config` (the `leftArrowOpensAgents` setting). ### @@ -235,7 +235,7 @@ `<agent-name> <prompt>`| If the first word matches a custom [subagent](</docs/en/sub-agents>) name, that subagent runs as the session’s main agent with the configuration from its frontmatter `@<agent-name>`| Mention a custom subagent anywhere in the prompt to run it as the main agent `@<repo>`| Mention a repository under the directory you opened agent view from to run the session there -`/<skill>`| Suggest [skills](</docs/en/skills>) to dispatch as the prompt +`/<command>`| Suggest [skills](</docs/en/skills>) and [commands](</docs/en/commands>) to dispatch as the prompt `#<number>` or a pull request URL| If a session is already working on that PR, select it instead of dispatching `Shift+Enter`| Dispatch and immediately attach to the new session @@ -261,7 +261,7 @@ From inside a session -Run `/background` or its alias `/bg` to move the current conversation into a background session. Pass a prompt such as `/bg run the test suite and fix any failures` to give one more instruction first. Backgrounding from an interactive session starts a fresh process that resumes from the saved conversation, so running subagents, [monitors](</docs/en/tools-reference#monitor-tool>), and background commands do not transfer to it. Claude asks you to confirm before backgrounding when any are running. Once in the background, the session can start new subagents, monitors, and background commands, and those keep running across later detach and reattach. Configuration flags from the original launch carry through to the backgrounded session, so its MCP servers, settings, and fallback model remain in effect: +Run `/background` or its alias `/bg` to move the current conversation into a background session. Pass a prompt such as `/bg run the test suite and fix any failures` to give one more instruction first. If Claude is responding when you run `/bg`, the response continues in the background session. Backgrounding from an interactive session starts a fresh process that resumes from the saved conversation, so running subagents, [monitors](</docs/en/tools-reference#monitor-tool>), and background commands do not transfer to it. Claude asks you to confirm before backgrounding when any are running. Once in the background, the session can start new subagents, monitors, and background commands, and those keep running across later detach and reattach. Configuration flags from the original launch carry through to the backgrounded session, so its MCP servers, settings, and fallback model remain in effect: * `--mcp-config` and `--strict-mcp-config` * `--settings` @@ -328,10 +328,10 @@ Set the model -The model name shown in the agent view header is the dispatch default. New sessions you start from the input use this model, which comes from the [`model` setting](</docs/en/settings#available-settings>) in your user settings. Set it by pressing `d` on a model in the [`/model` picker](</docs/en/model-config>), or edit the setting directly. To override it for the whole agent view session, pass `--model` when opening agent view. See Permission mode, model, and effort. Each background session can run on a different model. To override it for one session: +The model name shown in the agent view header is the dispatch default. New sessions you start from the input use this model, which comes from the [`model` setting](</docs/en/settings#available-settings>) in your user settings. Set it by selecting a model in the [`/model` picker](</docs/en/model-config>), or edit the setting directly. To override it for the whole agent view session, pass `--model` when opening agent view. See Permission mode, model, and effort. Each background session can run on a different model. To override it for one session: * From the shell, pass `--model` with `claude --bg`. - * Attach to a running session and run `/model` there. The change persists if the session is respawned. + * Attach to a running session, open `/model`, and press `s` on a model to switch for that session only. The change persists if the session is respawned. * Dispatch a [subagent](</docs/en/sub-agents>) whose frontmatter sets a `model` field. ###
modified Claude Code on Amazon Bedrock View current →
--- a/amazon-bedrock.md +++ b/amazon-bedrock.md @@ -157,7 +157,7 @@ When enabling Bedrock for Claude Code, keep the following in mind: * `AWS_REGION` is a required environment variable. Claude Code does not read from the `.aws` config file for this setting. - * When using Bedrock, the `/login` and `/logout` commands are disabled since authentication is handled through AWS credentials. + * When using Bedrock, the `/logout` command is unavailable since authentication is handled through AWS credentials. * You can use settings files for environment variables like `AWS_PROFILE` that you don’t want to leak to other processes. See [Settings](</docs/en/settings>) for more information. ###
modified Best practices for Claude Code View current →
--- a/best-practices.md +++ b/best-practices.md @@ -28,7 +28,7 @@ **Verify UI changes visually**| _”make the dashboard look better"_| _"[paste screenshot] implement this design. take a screenshot of the result and compare it to the original. list differences and fix them”_ **Address root causes, not symptoms**| _”the build is failing"_| _"the build fails with this error: [paste error]. fix it and verify the build succeeds. address the root cause, don’t suppress the error”_ -UI changes can be verified using the [Claude in Chrome extension](</docs/en/chrome>). It opens new tabs in your browser, tests the UI, and iterates until the code works. Your verification can also be a test suite, a linter, or a Bash command that checks output. Invest in making your verification rock-solid. +UI changes can be verified using the [Claude in Chrome extension](</docs/en/chrome>). It opens new tabs in your browser, tests the UI, and iterates until the code works. Your verification can also be a test suite, a linter, or a Bash command that checks output. Invest in making your verification rock-solid. Have Claude show evidence rather than asserting success: the test output, the command it ran and what it returned, or a screenshot of the result. Reviewing evidence is faster than re-running the verification yourself, and it works for sessions you weren’t watching. * * * @@ -184,7 +184,7 @@ * **Project root (`./CLAUDE.md`)**: check into git to share with your team * **Project root (`./CLAUDE.local.md`)**: personal project-specific notes; add this file to your `.gitignore` so it isn’t shared with your team * **Parent directories** : useful for monorepos where both `root/CLAUDE.md` and `root/foo/CLAUDE.md` are pulled in automatically - * **Child directories** : Claude pulls in child CLAUDE.md files on demand when working with files in those directories + * **Child directories** : Claude pulls in child CLAUDE.md files on demand when it reads a file in those directories ### @@ -358,7 +358,7 @@ Keep interviewing until we've covered everything, then write a complete spec to SPEC.md. -Once the spec is complete, start a fresh session to execute it. The new session has clean context focused entirely on implementation, and you have a written spec to reference. +Once the spec is complete, start a fresh session to execute it. The new session has clean context focused entirely on implementation, and you have a written spec to reference. The most useful specs are self-contained: they name the files and interfaces involved, state what is out of scope, and end with an end-to-end verification step that proves the feature works. Time spent making the spec precise pays off more than time spent watching the implementation. * * * @@ -459,7 +459,7 @@ Run non-interactive mode -Use `claude -p "prompt"` in CI, pre-commit hooks, or scripts. Add `--output-format stream-json` for streaming JSON output. +Use `claude -p "prompt"` in CI, pre-commit hooks, or scripts. Add `--output-format stream-json --verbose` for streaming JSON output. With `claude -p "your prompt"`, you can run Claude non-interactively, without a session. [Non-interactive mode](</docs/en/headless>) is how you integrate Claude into CI pipelines, pre-commit hooks, or any automated workflow. The output formats let you parse results programmatically: plain text, JSON, or streaming JSON. @@ -470,7 +470,7 @@ claude -p "List all API endpoints" --output-format json # Streaming for real-time processing - claude -p "Analyze this log file" --output-format stream-json + claude -p "Analyze this log file" --output-format stream-json --verbose ### @@ -546,6 +546,24 @@ For non-interactive runs with the `-p` flag, auto mode aborts if the classifier repeatedly blocks actions, since there is no user to fall back to. See [when auto mode falls back](</docs/en/permission-modes#when-auto-mode-falls-back>) for thresholds. +### + +​ + +Add an adversarial review step + +Before treating a task as done, have a subagent review the diff in a fresh context and report gaps. + +The longer Claude works unattended, the more an independent check matters before you count the work as done. A reviewer running in a fresh [subagent](</docs/en/sub-agents>) context sees only the diff and the criteria you give it, not the reasoning that produced the change, so it evaluates the result on its own terms. For a correctness check, run the bundled [`/code-review` skill](</docs/en/commands>), which reviews the current diff for bugs in a fresh subagent and returns findings to the session. To check the diff against your plan instead, write the review prompt yourself. Name the work to check, the plan to check it against, and what counts as a finding: + + Use a subagent to review the rate limiter diff against PLAN.md. Check that + every requirement is implemented, the listed edge cases have tests, and + nothing outside the task's scope changed. Report gaps, not style preferences. + +Because the reviewer runs as a subagent, the implementing session receives the gaps directly and can fix them and re-review without you copying findings between windows. For longer autonomous runs, an [agent team](</docs/en/agent-teams>) can keep this loop going across many tasks while you spot-check the recorded findings. + +A reviewer prompted to find gaps will usually report some, even when the work is sound, because that is what it was asked to do. Chasing every finding leads to over-engineering: extra abstraction layers, defensive code, and tests for cases that can’t happen. Tell the reviewer to flag only gaps that affect correctness or the stated requirements, and treat the rest as optional. + * * * ##
modified Changelog View current →
--- a/changelog.md +++ b/changelog.md @@ -5,6 +5,89 @@ > Use this file to discover all available pages before exploring further. 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.153 + +May 28, 2026 + + * Added `skipLfs` option to `github`/`git` plugin marketplace sources to skip Git LFS downloads during clone and update + * Claude Code now shows a one-time notice when your npm global install can’t auto-update; `/doctor` lists the fixes + * Status line commands now receive `COLUMNS` and `LINES` environment variables so scripts can size output to the terminal width + * `claude agents`: autocomplete in the dispatch input now suggests native slash commands and bundled skills, not just project skills + * `claude agents`: PR column now shows `PR #N` for a single PR or `N PRs` for multiple + * `claude doctor` now shows the result of your last update attempt + * Combined the separate “needs authentication” startup notifications for MCP servers and connectors into a single message + * macOS: background agents now appear as “Claude Code” in Privacy & Security and keep their permission grants across upgrades + * Fixed stateful MCP servers without the optional GET SSE stream reconnect-looping on `tools/list` (regression in v2.1.147) + * Fixed a regression where a custom API gateway could receive the user’s Anthropic OAuth credential instead of the gateway’s own token + * Fixed subagent (Agent tool) frontmatter MCP servers ignoring `--strict-mcp-config`, `--bare`, remote mode, enterprise managed MCP config, and managed-settings MCP server allow/deny policies + * `--strict-mcp-config` no longer strips inline `mcpServers` from explicitly-passed agent definitions (`--agents` / SDK `agents`), and blocked subagent MCP servers now surface a visible warning + * Fixed the Windows PowerShell installer reporting “Installation complete!” when installation actually failed + * Fixed `claude update` installing the latest version instead of the configured release channel’s version for npm installations + * Fixed excessive memory usage (multiple GB) when resuming a session by transcript file path on machines with many stored sessions + * Fixed `claude agents` and `claude --bg` running on a stale daemon started before binary-takeover support, even after upgrading + * Fixed a hang where the CLI could fail to exit when stdin was closed without EOF in stream-json mode, leaving a stale session marker behind + * Fixed malformed `file://` links in Claude’s responses not being clickable in the terminal + * Fixed `claude --help` rendering unwrapped output on terminals narrower than 92 columns + * Fixed MCP tool progress notifications not rendering in the collapsed tool view + * Fixed `Agent` tool with `subagent_type: 'claude'` running in an undocumented temporary worktree, which could silently discard outputs written to gitignored paths + * `/bg` while Claude is responding now continues the response in the background session instead of dropping it + * Fixed `/btw` keyboard shortcuts becoming unresponsive in background sessions while a task is running + * Fixed background sessions writing temp files to `$CLAUDE_JOB_DIR` triggering a “sensitive file” permission prompt + * Fixed recovering a background agent whose working directory was deleted showing a truncated stack trace instead of a clear error message + * Fixed `EnterWorktree` not being available immediately in background sessions (previously required `ToolSearch` first) + * Fixed `cmd+k` in iTerm2/Terminal.app not repainting attached background sessions + * Fixed the IME candidate window appearing at the bottom of the screen instead of next to the input caret in attached background sessions on Windows + * Fixed background-color bleed when attaching to a background agent from 256-color-only terminals after the agent had rendered file diffs + * Fixed `/copy` and copy-on-select silently failing to update the system clipboard when attached to a background session inside tmux + * Fixed opening `claude agents` with Remote Control enabled leaving zombie session entries on the Code tab after exiting + * Fixed `/rename` in background sessions not updating the session banner immediately + * Fixed Windows update rollback: if a Windows update fails, Claude Code now restores the original executable by copy and tells you how to recover + * [VSCode] Fixed Claude Code processes not shutting down cleanly when VS Code closed on Windows, causing false “unclean exit” reports and orphaned MCP servers + * `/model` now saves your selection as the default for new sessions (matching the IDE). Press `s` in the picker to switch models for the current session only. + * If you customized the `modelPicker:setAsDefault` keybinding, rename it to `modelPicker:thisSessionOnly` in keybindings.json (the `d` action was replaced by `s`) + +​ + +2.1.152 + +May 27, 2026 + + * `/code-review --fix` now applies review findings to your working tree after the review, surfacing reuse, simplification, and efficiency suggestions; `/simplify` now invokes `/code-review --fix` + * Skills and slash commands can now set `disallowed-tools` in frontmatter to remove tools from the model while the skill is active + * Added `/reload-skills` command to re-scan skill directories without restarting the session + * `SessionStart` hooks can now return `reloadSkills: true` to re-scan skill directories, making skills installed by the hook available in the same session + * `SessionStart` hooks can now set the session title via `hookSpecificOutput.sessionTitle` on startup and resume + * Added a `MessageDisplay` hook event that lets hooks transform or hide assistant message text as it is displayed + * Added `pluginSuggestionMarketplaces` managed setting: admins can allowlist org marketplaces whose plugins may be suggested via context-aware tips + * `claude plugin marketplace remove` now accepts `--scope user|project|local` for symmetry with `marketplace add`, `install`, and `uninstall` + * Claude Code now switches to your configured `--fallback-model` for the rest of the session when the primary model is not found, instead of failing every request + * Auto mode no longer requires opt-in consent + * Vim mode: `/` in NORMAL mode now opens reverse history search (like Ctrl+R), matching bash/zsh vi-mode + * The `/usage` breakdown now includes large session files; files are scanned with a streaming read so memory usage stays flat + * Thinking summaries in the collapsed group now stay readable for at least 3 seconds, render as markdown, and cap at 10 lines (`Ctrl+O` shows the full thinking) + * In fullscreen mode, the “Thinking for Ns” indicator now counts up live while the model is thinking, and keeps its value if you interrupt mid-thought + * Simplified the Workflow tool’s inline progress display — live agent counts now show only in the persistent workflow status row below the prompt + * The post-response timer now shows “Waiting for N background agents/workflows to finish” when backgrounded agents or workflows are still running, and reports the cumulative time once their results are processed + * Added the session entrypoint as an OpenTelemetry metric attribute (`app.entrypoint`, opt-in via `OTEL_METRICS_INCLUDE_ENTRYPOINT=true`) + * Fixed terminal styling degrading in very long sessions by recycling the renderer’s style pool + * Fixed the sandbox-enabled warning not appearing in condensed startup mode — it now shows in every layout + * Fixed the loading spinner showing “still thinking”/“almost done thinking” while a tool is running, and reset the thinking status to “thinking” after each tool + * Fixed focus mode showing a spurious “N messages hidden” count on turns with no hidden activity + * Fixed clicking a link inside an expanded tool result collapsing the section instead of opening the link + * Fixed markdown table cell borders inheriting the color of inline code, wrapped continuation lines losing their style, and empty header cells showing a label in the narrow-terminal stacked layout + * Fixed plugin MCP servers with the same command but different environment variables being incorrectly deduplicated + * Fixed `/doctor` reporting “marketplace not found” or “plugin not found” for stale `enabledPlugins` entries referencing removed marketplaces or dropped plugins + * Fixed plugins that track a git branch silently no longer receiving updates after the plugin registry was rebuilt + * Fixed remote MCP servers failing to connect in Claude Code Remote sessions when the egress proxy is enabled + * Fixed the effort-change confirmation dialog appearing when the conversation has no messages or when switching between effort levels that resolve to the same underlying value + * Fixed the Agent tool description referencing an agent list that is never delivered when running with `--bare` or with attachments disabled + * Fixed a background worker crash in `claude agents` when accepting a stale permission prompt after a subagent was cancelled + * Fixed `cache_creation_input_tokens` reporting as 0 in transcript and result usage when the API reports cache writes only via the nested `cache_creation` breakdown + * Fixed the PushNotification tool incorrectly reporting “Mobile push not sent (Remote Control inactive)” in SDK-hosted sessions when Remote Control is enabled + * Fixed sessions getting stuck after a model or login switch left stale thinking-block signatures in history; now stripped proactively with a retry safety-net ​
modified Explore the .claude directory View current →
--- a/claude-directory.md +++ b/claude-directory.md @@ -124,6 +124,7 @@ `shell-snapshots/`| Captured shell environment used by the Bash tool. Removed on clean exit. The sweep clears any left after a crash. `backups/`| Timestamped copies of `~/.claude.json` taken before config migrations `feedback-bundles/`| Redacted transcript archives written by `/feedback` on third-party providers, for sending to your Anthropic account team +`todos/`, `statsig/`, `logs/`| Legacy directories from older versions. No longer written. The sweep removes their contents and then the empty directory. ### @@ -138,7 +139,6 @@ `history.jsonl`| Every prompt you’ve typed, with timestamp and project path. Used for up-arrow recall. `stats-cache.json`| Aggregated token and cost counts shown by `/usage` `remote-settings.json`| Cached copy of [server-managed settings](</docs/en/server-managed-settings>) for your organization. Only present when your organization has configured them. Refreshed on each launch. -`todos/`| Legacy per-session task lists. No longer written by current versions; safe to delete. Other small cache and lock files appear depending on which features you use and are safe to delete. @@ -189,7 +189,7 @@ `~/.claude/stats-cache.json`| Historical totals shown by `/usage` `~/.claude/remote-settings.json`| Nothing. Re-fetched on next launch. `~/.claude/debug/`, `~/.claude/plans/`, `~/.claude/paste-cache/`, `~/.claude/image-cache/`, `~/.claude/session-env/`, `~/.claude/tasks/`, `~/.claude/shell-snapshots/`, `~/.claude/backups/`| Nothing user-facing -`~/.claude/todos/`| Nothing. Legacy directory not written by current versions. +`~/.claude/todos/`, `~/.claude/statsig/`, `~/.claude/logs/`| Nothing. Legacy directories not written by current versions. Don’t delete `~/.claude.json`, `~/.claude/settings.json`, or `~/.claude/plugins/`: those hold your auth, preferences, and installed plugins.
modified CLI reference View current →
--- a/cli-reference.md +++ b/cli-reference.md @@ -75,14 +75,14 @@ `--effort`| Set the [effort level](</docs/en/model-config#adjust-effort-level>) for the current session. Options: `low`, `medium`, `high`, `xhigh`, `max`; available levels depend on the model. Overrides the [`effortLevel`](</docs/en/settings#available-settings>) setting for this session and does not persist| `claude --effort high` `--enable-auto-mode`| Removed in v2.1.111. Auto mode is now in the `Shift+Tab` cycle by default; use `--permission-mode auto` to start in it| `claude --permission-mode auto` `--exclude-dynamic-system-prompt-sections`| Move per-machine sections from the system prompt (working directory, environment info, memory paths, git-repo flag) into the first user message. Improves prompt-cache reuse across different users and machines running the same task. Only applies with the default system prompt; ignored when `--system-prompt` or `--system-prompt-file` is set. Use with `-p` for scripted, multi-user workloads| `claude -p --exclude-dynamic-system-prompt-sections "query"` -`--fallback-model`| Enable automatic fallback to a specified model when the default model is overloaded. Takes effect in print mode (`-p`) and in [background sessions](</docs/en/agent-view>), which run non-interactively; ignored in an interactive session| `claude -p --fallback-model sonnet "query"` +`--fallback-model`| Enable automatic fallback to a specified model when the default model is overloaded or not available, for example a retired model. Takes effect in print mode (`-p`) and in [background sessions](</docs/en/agent-view>), which run non-interactively; ignored in an interactive session| `claude -p --fallback-model sonnet "query"` `--fork-session`| When resuming, create a new session ID instead of reusing the original (use with `--resume` or `--continue`)| `claude --resume abc123 --fork-session` `--from-pr`| Resume sessions linked to a specific pull request. Accepts a PR number, a GitHub or GitHub Enterprise PR URL, a GitLab merge request URL, or a Bitbucket pull request URL. Sessions are linked automatically when Claude creates the pull request| `claude --from-pr 123` `--ide`| Automatically connect to IDE on startup if exactly one valid IDE is available| `claude --ide` `--init`| Run [Setup hooks](</docs/en/hooks#setup>) with the `init` matcher before the session (print mode only)| `claude -p --init "query"` `--init-only`| Run [Setup](</docs/en/hooks#setup>) and `SessionStart` hooks, then exit without starting a conversation| `claude --init-only` -`--include-hook-events`| Include all hook lifecycle events in the output stream. Requires `--output-format stream-json`| `claude -p --output-format stream-json --include-hook-events "query"` -`--include-partial-messages`| Include partial streaming events in output. Requires `--print` and `--output-format stream-json`| `claude -p --output-format stream-json --include-partial-messages "query"` +`--include-hook-events`| Include all hook lifecycle events in the output stream. Requires `--output-format stream-json`| `claude -p --output-format stream-json --verbose --include-hook-events "query"` +`--include-partial-messages`| Include partial streaming events in output. Requires `--print` and `--output-format stream-json`| `claude -p --output-format stream-json --verbose --include-partial-messages "query"` `--input-format`| Specify input format for print mode (options: `text`, `stream-json`)| `claude -p --output-format json --input-format stream-json` `--json-schema`| Get validated JSON output matching a JSON Schema after agent completes its workflow (print mode only, see [structured outputs](</docs/en/agent-sdk/structured-outputs>))| `claude -p --json-schema '{"type":"object","properties":{...}}' "query"` `--maintenance`| Run [Setup hooks](</docs/en/hooks#setup>) with the `maintenance` matcher before the session (print mode only)| `claude -p --maintenance "query"` @@ -104,7 +104,7 @@ `--remote`| Create a new [web session](</docs/en/claude-code-on-the-web>) on claude.ai with the provided task description| `claude --remote "Fix the login bug"` `--remote-control`, `--rc`| Start an interactive session with [Remote Control](</docs/en/remote-control#start-a-remote-control-session>) enabled so you can also control it from claude.ai or the Claude app. Optionally pass a name for the session| `claude --remote-control "My Project"` `--remote-control-session-name-prefix <prefix>`| Prefix for auto-generated [Remote Control](</docs/en/remote-control>) session names when no explicit name is set. Defaults to your machine’s hostname, producing names like `myhost-graceful-unicorn`. Set `CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX` for the same effect| `claude remote-control --remote-control-session-name-prefix dev-box` -`--replay-user-messages`| Re-emit user messages from stdin back on stdout for acknowledgment. Requires `--input-format stream-json` and `--output-format stream-json`| `claude -p --input-format stream-json --output-format stream-json --replay-user-messages` +`--replay-user-messages`| Re-emit user messages from stdin back on stdout for acknowledgment. Requires `--input-format stream-json` and `--output-format stream-json`| `claude -p --input-format stream-json --output-format stream-json --verbose --replay-user-messages` `--resume`, `-r`| Resume a specific session by ID or name, or show an interactive picker to choose a session. Includes sessions that added this directory with `/add-dir`. As of v2.1.144, [background sessions](</docs/en/agent-view>) appear in the picker marked with `bg`| `claude --resume auth-refactor` `--session-id`| Use a specific session ID for the conversation (must be a valid UUID)| `claude --session-id "550e8400-e29b-41d4-a716-446655440000"` `--setting-sources`| Comma-separated list of setting sources to load (`user`, `project`, `local`)| `claude --setting-sources user,project`
modified Code Review View current →
--- a/code-review.md +++ b/code-review.md @@ -14,8 +14,9 @@ * Customizing reviews with `CLAUDE.md` and `REVIEW.md` * Pricing * Troubleshooting failed runs and missing comments - -To review a diff locally in your terminal without installing the GitHub App, run the [`/code-review` command](</docs/en/commands>) in any Claude Code session. It reports correctness bugs in the current diff at a chosen effort level and can post findings as inline PR comments with `--comment`. The command was named `/simplify` before v2.1.147. + * Reviewing a diff locally with the `/code-review` command + +To review a diff locally in your terminal without installing the GitHub App, run the `/code-review` command in any Claude Code session. See Review a diff locally. ## @@ -302,6 +303,14 @@ ​ +Review a diff locally + +The [`/code-review` command](</docs/en/commands>) reviews a diff in your terminal without installing the GitHub App. Run it in any Claude Code session: it reports correctness bugs and reuse, simplification, and efficiency cleanups in the current diff. Pass `--comment` to post findings as inline PR comments, or `--fix` to apply the findings to your working tree after the review. Lower [effort levels](</docs/en/model-config#adjust-effort-level>) return fewer, higher-confidence findings, while `high` through `max` give broader coverage and may include uncertain findings. Without an effort argument, the review uses the session’s current effort. Pass a path or PR reference to review a specific target instead of the current diff. `/code-review ultra --fix` runs the deeper [ultrareview](</docs/en/ultrareview>) in the cloud, then applies its findings to your working tree when they arrive back in your session. The command was named `/simplify` before v2.1.147, when it applied fixes by default. `/simplify` still works and is equivalent to `/code-review --fix`. + +## + +​ + Related resources Code Review is designed to work alongside the rest of Claude Code. If you want to run reviews locally before opening a PR, need a self-hosted setup, or want to go deeper on how `CLAUDE.md` shapes Claude’s behavior across tools, these pages are good next stops:
modified Commands View current →
--- a/commands.md +++ b/commands.md @@ -12,7 +12,7 @@ Commands across a typical workflow -Most commands are useful at a specific point in a session, from setting up a project to shipping a change. **First session in a repo.** Run `/init` to generate a starter `CLAUDE.md`, then `/memory` to refine it. Use `/mcp` and `/agents` to set up any servers or subagents the project needs, and `/permissions` to set the approval rules you want. **During a task.** `/plan` switches into plan mode before a large change. `/model` and `/effort` adjust how much reasoning you’re spending. When the conversation gets long, `/context` shows where the window is going and `/compact` summarizes it down; use `/btw` for a quick aside that shouldn’t bloat history. **Running work in parallel.** `/agents` opens the manager for the [subagents](</docs/en/sub-agents>) Claude can delegate side tasks to, and `/tasks` lists what’s running in the background of the current session. `/background` detaches the whole session to keep running as a [background agent](</docs/en/agent-view>) and frees your terminal. For a large change that spans the codebase, `/batch` decomposes it into independent units and runs each in its own [worktree](</docs/en/worktrees>). See [Run agents in parallel](</docs/en/agents>) for how these approaches relate. **Before you ship.** `/diff` shows what changed, `/code-review` checks the diff for correctness bugs, and `/review` or `/security-review` give a deeper read-only pass. **Between sessions.** `/clear` starts fresh on a new task while keeping project memory. `/resume` and `/branch` let you return to or fork an earlier conversation. `/teleport` pulls a web session into this terminal, and `/remote-control` lets you continue this local session from another device. **When something is wrong.** `/rewind` rolls code and conversation back to a checkpoint, or summarizes part of the conversation. `/doctor` and `/debug` diagnose install and runtime issues, and `/feedback` reports a bug with session context attached. +Most commands are useful at a specific point in a session, from setting up a project to shipping a change. **First session in a repo.** Run `/init` to generate a starter `CLAUDE.md`, then `/memory` to refine it. Use `/mcp` and `/agents` to set up any servers or subagents the project needs, and `/permissions` to set the approval rules you want. **During a task.** `/plan` switches into plan mode before a large change. `/model` and `/effort` adjust how much reasoning you’re spending. When the conversation gets long, `/context` shows where the window is going and `/compact` summarizes it down; use `/btw` for a quick aside that shouldn’t bloat history. **Running work in parallel.** `/agents` opens the manager for the [subagents](</docs/en/sub-agents>) Claude can delegate side tasks to, and `/tasks` lists what’s running in the background of the current session. `/background` detaches the whole session to keep running as a [background agent](</docs/en/agent-view>) and frees your terminal. For a large change that spans the codebase, `/batch` decomposes it into independent units and runs each in its own [worktree](</docs/en/worktrees>). See [Run agents in parallel](</docs/en/agents>) for how these approaches relate. **Before you ship.** `/diff` shows what changed, `/code-review` checks the diff for correctness bugs and cleanups and can apply the findings with `--fix`, and `/review` or `/security-review` give a deeper read-only pass. `/code-review ultra` runs a multi-agent review in the cloud. **Between sessions.** `/clear` starts fresh on a new task while keeping project memory. `/resume` and `/branch` let you return to or fork an earlier conversation. `/teleport` pulls a web session into this terminal, and `/remote-control` lets you continue this local session from another device. **When something is wrong.** `/rewind` rolls code and conversation back to a checkpoint, or summarizes part of the conversation. `/doctor` and `/debug` diagnose install and runtime issues, and `/feedback` reports a bug with session context attached. ## @@ -36,7 +36,7 @@ `/chrome`| Configure [Claude in Chrome](</docs/en/chrome>) settings `/claude-api [migrate|managed-agents-onboard]`| **[Skill](</docs/en/skills#bundled-skills>).** Load Claude API reference material for your project’s language (Python, TypeScript, Java, Go, Ruby, C#, PHP, or cURL) and Managed Agents reference. Covers tool use, streaming, batches, structured outputs, and common pitfalls. Also activates automatically when your code imports `anthropic` or `@anthropic-ai/sdk`. Run `/claude-api migrate` to upgrade existing Claude API code to a newer model: Claude asks which files to scan and which model to target, then updates model IDs, thinking configuration, and other parameters that changed between versions. Run `/claude-api managed-agents-onboard` for an interactive walkthrough that creates a new Managed Agent from scratch `/clear [name]`| Start a new conversation with empty context. The previous conversation stays available in `/resume`. Pass a name to label the previous conversation in the `/resume` picker. To free up context while continuing the same conversation, use `/compact` instead. Aliases: `/reset`, `/new` -`/code-review [low|medium|high|xhigh|max] [--comment] [target]`| **[Skill](</docs/en/skills#bundled-skills>).** Review the current diff for correctness bugs and report findings without editing files. Lower [effort levels](</docs/en/model-config#adjust-effort-level>) return fewer, higher-confidence findings, while `high` through `max` give broader coverage and may include uncertain findings. Without an effort argument, the review uses the session’s current effort. Pass `--comment` to post findings as inline comments on the current GitHub PR. Pass a path or PR reference to review a specific target. Formerly `/simplify`, which still works as an alias +`/code-review [low|medium|high|xhigh|max|ultra] [--fix] [--comment] [target]`| **[Skill](</docs/en/skills#bundled-skills>).** Review the current diff for correctness bugs and for reuse, simplification, and efficiency cleanups. Pass `--fix` to apply findings to your working tree, `--comment` to post them as inline GitHub PR comments, or `ultra` to run a deep [cloud review](</docs/en/ultrareview>). `/simplify` is equivalent to `/code-review --fix`. See [Review a diff locally](</docs/en/code-review#review-a-diff-locally>) for effort levels and targeting `/color [color|default]`| Set the prompt bar color for the current session. Available colors: `red`, `blue`, `green`, `yellow`, `purple`, `orange`, `pink`, `cyan`. Use `default` to reset, or run with no argument to pick a random color. When [Remote Control](</docs/en/remote-control>) is connected, the color syncs to claude.ai/code `/compact [instructions]`| Free up context by summarizing the conversation so far. Optionally pass focus instructions for the summary. See [how compaction handles rules, skills, and memory files](</docs/en/context-window#what-survives-compaction>) `/config`| Open the [Settings](</docs/en/settings>) interface to adjust theme, model, [output style](</docs/en/output-styles>), and other preferences. Alias: `/settings` @@ -70,7 +70,7 @@ `/mcp`| Manage MCP server connections and OAuth authentication `/memory`| Edit `CLAUDE.md` memory files, enable or disable [auto-memory](</docs/en/memory#auto-memory>), and view auto-memory entries `/mobile`| Show QR code to download the Claude mobile app. Aliases: `/ios`, `/android` -`/model [model]`| Set the AI model for the current session. For models that support it, use left/right arrows to [adjust effort level](</docs/en/model-config#adjust-effort-level>). With no argument, opens a picker; press `d` on a row to also save that model as the default for new sessions. The picker asks for confirmation when the conversation has prior output, since the next response re-reads the full history without cached context. Once confirmed, the change applies without waiting for the current response to finish +`/model [model]`| Switch the AI model and save it as your default for new sessions. For models that support it, use left/right arrows to [adjust effort level](</docs/en/model-config#adjust-effort-level>). With no argument, opens a picker; press `s` on a row to switch for the current session only. The picker asks for confirmation when the conversation has prior output, since the next response re-reads the full history without cached context. Once confirmed, the change applies without waiting for the current response to finish `/passes`| Share a free week of Claude Code with friends. Only visible if your account is eligible `/permissions`| Manage allow, ask, and deny rules for tool permissions. Opens an interactive dialog where you can view rules by scope, add or remove rules, manage working directories, and review [recent auto mode denials](</docs/en/auto-mode-config#review-denials>). Alias: `/allowed-tools` `/plan [description]`| Enter plan mode directly from the prompt. Pass an optional description to enter plan mode and immediately start with that task, for example `/plan fix the auth bug` @@ -82,11 +82,12 @@ `/recap`| Generate a one-line summary of the current session on demand. See [Session recap](</docs/en/interactive-mode#session-recap>) for the automatic recap that appears after you’ve been away `/release-notes`| View the changelog in an interactive version picker. Select a specific version to see its release notes, or choose to show all versions `/reload-plugins`| Reload all active [plugins](</docs/en/plugins>) to apply pending changes without restarting. Reports counts for each reloaded component and flags any load errors +`/reload-skills`| Re-scan [skill](</docs/en/skills>) and command directories so skills added or changed on disk during the session become available without restarting. Reports how many skills are available and how many were added or removed `/remote-control`| Make this session available for [remote control](</docs/en/remote-control>) from claude.ai. Alias: `/rc` `/remote-env`| Configure the default remote environment for [web sessions started with `--remote`](</docs/en/claude-code-on-the-web#configure-your-environment>) `/rename [name]`| Rename the current session and show the name on the prompt bar. Without a name, auto-generates one from conversation history `/resume [session]`| Resume a conversation by ID or name, or open the session picker. As of v2.1.144, [background sessions](</docs/en/agent-view>) appear in the picker marked with `bg`. Alias: `/continue` -`/review [PR]`| Review a pull request locally in your current session. For a deeper cloud-based review, see [`/ultrareview`](</docs/en/ultrareview>) +`/review [PR]`| Review a pull request locally in your current session. For a deeper cloud-based review, see [`/code-review ultra`](</docs/en/ultrareview>) `/rewind`| Rewind the conversation and/or code to a previous point, or summarize from a selected message. See [checkpointing](</docs/en/checkpointing>). Aliases: `/checkpoint`, `/undo` `/run`| **[Skill](</docs/en/skills#bundled-skills>).** Launch and drive your project’s app to see a change working in the running app, not just in tests. See [Run and verify your app](</docs/en/skills#run-and-verify-your-app>). Requires Claude Code v2.1.145 or later `/run-skill-generator`| **[Skill](</docs/en/skills#bundled-skills>).** Teach `/run` and `/verify` how to build, launch, and drive your project’s app from a clean environment by writing a per-project [skill](</docs/en/skills#run-and-verify-your-app>). Requires Claude Code v2.1.145 or later @@ -109,9 +110,9 @@ `/theme`| Change the color theme. Includes an `auto` option that matches your terminal’s light or dark background, light and dark variants, colorblind-accessible (daltonized) themes, ANSI themes that use your terminal’s color palette, and any [custom themes](</docs/en/terminal-config#create-a-custom-theme>) from `~/.claude/themes/` or plugins. Select **New custom theme…** to create one `/tui [default|fullscreen]`| Set the terminal UI renderer and relaunch into it with your conversation intact. `fullscreen` enables the [flicker-free alt-screen renderer](</docs/en/fullscreen>). With no argument, prints the active renderer `/ultraplan <prompt>`| Draft a plan in an [ultraplan](</docs/en/ultraplan>) session, review it in your browser, then execute remotely or send it back to your terminal -`/ultrareview [PR]`| Run a deep, multi-agent code review in a cloud sandbox with [ultrareview](</docs/en/ultrareview>). Includes 3 free runs on Pro and Max, then requires [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>) +`/ultrareview [PR]`| Run a deep, multi-agent code review in a cloud sandbox with [ultrareview](</docs/en/ultrareview>). The preferred invocation is now `/code-review ultra`, and `/ultrareview` remains as an alias. Includes 3 free runs on Pro and Max, then requires [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>) `/upgrade`| Open the upgrade page to switch to a higher plan tier -`/usage`| Show session cost, plan usage limits, and activity stats. See the [cost tracking guide](</docs/en/costs#using-the-%2Fusage-command>) for subscription-specific details. `/cost` and `/stats` are aliases +`/usage`| Show session cost, plan usage limits, and activity stats. On a Pro, Max, Team, or Enterprise plan, includes a breakdown of usage by skill, subagent, plugin, and MCP server. See the [cost tracking guide](</docs/en/costs#using-the-%2Fusage-command>) for details. `/cost` and `/stats` are aliases `/usage-credits`| Configure usage credits to keep working when you hit a limit. Previously `/extra-usage` `/verify`| **[Skill](</docs/en/skills#bundled-skills>).** Confirm a code change does what it should by building your project’s app, running it, and observing the result, rather than relying on tests or type checks. See [Run and verify your app](</docs/en/skills#run-and-verify-your-app>). Requires Claude Code v2.1.145 or later `/vim`| Removed in v2.1.92. To toggle between Vim and Normal editing modes, use `/config` → Editor mode
modified Common workflows View current →
--- a/common-workflows.md +++ b/common-workflows.md @@ -27,6 +27,8 @@ Understand new codebases +For configuring Claude Code in a monorepo or large codebase, see [Monorepos and large repos](</docs/en/large-codebases>). + #### ​
modified Manage costs effectively View current →
--- a/costs.md +++ b/costs.md @@ -18,22 +18,24 @@ Using the `/usage` command -The Session block in `/usage` shows API token usage and is intended for API users. Claude Max and Pro subscribers have usage included in their subscription, so the session cost figure isn’t relevant for billing purposes. Subscribers see plan usage bars and activity stats on the same screen. - -The `/usage` command provides detailed token usage statistics for your current session. The dollar figure is an estimate computed locally from token counts and may differ from your actual bill. For authoritative billing, see the Usage page in the [Claude Console](<https://platform.claude.com/usage>). +The Session block in `/usage` shows API token usage and is intended for API users. Claude Max and Pro subscribers have usage included in their subscription, so the session cost figure isn’t relevant for billing purposes. Subscribers see plan usage bars, activity stats, and a usage breakdown on the same screen. + +The Session block at the top of `/usage` shows detailed token usage statistics for your current session. The dollar figure is an estimate computed locally from token counts and may differ from your actual bill. For authoritative billing, see the Usage page in the [Claude Console](<https://platform.claude.com/usage>). Total cost: $0.55 Total duration (API): 6m 19.7s Total duration (wall): 6h 33m 10.2s Total code changes: 0 lines added, 0 lines removed +On a Pro, Max, Team, or Enterprise plan, `/usage` also shows a breakdown of what counts against your plan limits. It attributes recent usage to skills, subagents, plugins, and individual MCP servers, with each shown as a percentage of the total. Press `d` or `w` to switch between the last 24 hours and the last 7 days. The figures are approximate and computed from local session history on this machine, so usage from other devices or claude.ai is not included. + ## ​ Managing costs for teams -When using Claude API, you can [set workspace spend limits](<https://platform.claude.com/docs/en/build-with-claude/workspaces#workspace-limits>) on the total Claude Code workspace spend. Admins can [view cost and usage reporting](<https://platform.claude.com/docs/en/build-with-claude/workspaces#usage-and-cost-tracking>) in the Console. +When using Claude API, you can [set workspace spend limits](<https://platform.claude.com/docs/en/build-with-claude/workspaces#workspace-limits>) on the total Claude Code workspace spend. Admins can [view cost and usage reporting](<https://platform.claude.com/docs/en/build-with-claude/workspaces#usage-and-cost-tracking>) in the Console. On Pro and Max plans, you can set a monthly spend limit on usage credits with the `/usage-credits` command. If you reach that limit while you still have usage credits available, Claude Code prompts you to raise or remove the limit so you can continue without leaving the CLI. Changing the limit requires billing access on the account. When you first authenticate Claude Code with your Claude Console account, a workspace called “Claude Code” is automatically created for you. This workspace provides centralized cost tracking and management for all Claude Code usage in your organization. You cannot create API keys for this workspace; it is exclusively for Claude Code authentication and usage.For organizations with custom rate limits, Claude Code traffic in this workspace counts toward your organization’s overall API rate limits. You can set a [workspace rate limit](<https://platform.claude.com/docs/en/api/rate-limits#setting-lower-limits-for-workspaces>) on this workspace’s Limits page in the Claude Console to cap Claude Code’s share and protect other production workloads.
modified Discover and install prebuilt plugins through marketplaces View current →
--- a/discover-plugins.md +++ b/discover-plugins.md @@ -102,6 +102,14 @@ ​ +Automatic security review + +The `security-guidance` plugin reviews each change Claude makes for common vulnerabilities and instructs Claude to fix what it finds in the same session. See [Catch security issues as Claude writes code](</docs/en/security-guidance>) for what it checks and how to add project-specific rules. + +### + +​ + Development workflows Plugins that add skills and agents for common development tasks: @@ -187,7 +195,7 @@ For example, select **commit-commands** (a plugin that adds git workflow skills) and install it to your user scope.You can also install directly from the command line: - /plugin install commit-commands@anthropics-claude-code + /plugin install commit-commands@claude-code-plugins See [Configuration scopes](</docs/en/settings#configuration-scopes>) to learn more about scopes.
modified Environment variables View current →
--- a/env-vars.md +++ b/env-vars.md @@ -224,6 +224,7 @@ `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 +`CLAUDE_CODE_PROPAGATE_TRACEPARENT`| Set to `1` to propagate W3C trace context when `ANTHROPIC_BASE_URL` points at a custom proxy. Propagation covers the `traceparent` header on model and HTTP MCP requests and the `TRACEPARENT` environment variable for Bash, PowerShell, and hook subprocesses. By default, propagation is enabled only when connected directly to the Anthropic API. See [Traces (beta)](</docs/en/monitoring-usage#traces-beta>) `CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`| Set by host platforms that embed Claude Code and manage model provider routing on its behalf. When set, provider-selection, endpoint, and authentication variables such as `CLAUDE_CODE_USE_BEDROCK`, `ANTHROPIC_BASE_URL`, and `ANTHROPIC_API_KEY` in settings files are ignored so user settings cannot override the host’s routing. The automatic telemetry opt-out for Bedrock, Vertex, and Foundry is also skipped, so telemetry follows the standard `DISABLE_TELEMETRY` opt-out. See [Default behaviors by API provider](</docs/en/data-usage#default-behaviors-by-api-provider>) `CLAUDE_CODE_PROXY_RESOLVES_HOSTS`| Set to `1` to allow the proxy to perform DNS resolution instead of the caller. Opt-in for environments where the proxy should handle hostname resolution `CLAUDE_CODE_REMOTE`| Set automatically to `true` when Claude Code is running as a [cloud session](</docs/en/claude-code-on-the-web>). Read this from a hook or setup script to detect whether you are in a cloud environment @@ -249,6 +250,8 @@ `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`| Set to `1` to strip Anthropic and cloud provider credentials from subprocess environments (Bash tool, hooks, MCP stdio servers). 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 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/` before the first query and resync every 10 minutes. Applies only in non-interactive mode with the `-p` flag. Set automatically in [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions. Requires claude.ai authentication +`CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS`| Timeout in milliseconds for the first query to wait on the initial skills sync when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 5000). When exceeded, the query proceeds and remaining skill downloads continue in the background `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>) 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. See [Task list](</docs/en/interactive-mode#task-list>) `CLAUDE_CODE_TEAM_NAME`| Name of the agent team this teammate belongs to. Set automatically on [agent team](</docs/en/agent-teams>) members @@ -291,7 +294,7 @@ `DISABLE_TELEMETRY`| Set to `1` to opt out of telemetry. Telemetry events do not include user data like code, file paths, or bash commands. Also disables feature-flag fetching with the same effect as `DISABLE_GROWTHBOOK`, so some flagged features may be unavailable `DISABLE_UPDATES`| Set to `1` to block all updates including manual `claude update` and `claude install`. Stricter than `DISABLE_AUTOUPDATER`. Use when distributing Claude Code through your own channels and users should not self-update `DISABLE_UPGRADE_COMMAND`| Set to `1` to hide the `/upgrade` command -`DO_NOT_TRACK`| Set to `1` to opt out of telemetry. Equivalent to setting `DISABLE_TELEMETRY`. Honored as the [standard cross-tool convention](<https://consoledonottrack.com/>) +`DO_NOT_TRACK`| Set to `1` to opt out of telemetry. Equivalent to setting `DISABLE_TELEMETRY`. Claude Code honors this as the cross-tool convention recognized by many developer CLIs `ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>) in Claude Code. Enabled by default for logged-in users `ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Bedrock](</docs/en/amazon-bedrock>), [Vertex](</docs/en/google-vertex-ai>), [Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users within included usage receive 1-hour TTL automatically. 1-hour cache writes are billed at a higher rate `ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead @@ -319,6 +322,7 @@ `OTEL_LOG_TOOL_DETAILS`| Set to `1` to include tool input arguments, MCP server names, raw error strings on tool failures, 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>) +`OTEL_METRICS_INCLUDE_ENTRYPOINT`| Set to `true` to include the session entrypoint in metrics attributes (default: excluded). See [Monitoring](</docs/en/monitoring-usage>) `OTEL_METRICS_INCLUDE_SESSION_ID`| Set to `false` to exclude session ID from metrics attributes (default: included). See [Monitoring](</docs/en/monitoring-usage>) `OTEL_METRICS_INCLUDE_VERSION`| Set to `true` to include Claude Code version in metrics attributes (default: excluded). See [Monitoring](</docs/en/monitoring-usage>) `SLASH_COMMAND_TOOL_CHAR_BUDGET`| Override the character budget for skill metadata shown to the [Skill tool](</docs/en/skills#control-who-invokes-a-skill>). The budget scales dynamically at 1% of the context window, with a fallback of 8,000 characters. Legacy name kept for backwards compatibility
modified Error reference View current →
--- a/errors.md +++ b/errors.md @@ -82,7 +82,7 @@ Claude Code shows the status code and the API’s error message for any 5xx response. The example below shows a 500 response on the Anthropic API: - API Error: 500 Internal server error. This is a server-side issue, usually temporary — try again in a moment. If it persists, check status.claude.com. + API Error: 500 Internal server error. This is a server-side issue, usually temporary — try again in a moment. If it persists, check https://status.claude.com. The trailing sentence names where to check service health and varies by provider. Bedrock, Vertex AI, and Foundry configurations name that provider’s service status. A custom `ANTHROPIC_BASE_URL` names the gateway host. This indicates an unexpected failure inside the API. It is not caused by your prompt, settings, or account. **What to do:** @@ -98,7 +98,7 @@ The API is temporarily at capacity across all users. Claude Code has already retried several times before showing this message: - API Error: Repeated 529 Overloaded errors. The API is at capacity — this is usually temporary. Try again in a moment. If it persists, check status.claude.com. + API Error: Repeated 529 Overloaded errors. The API is at capacity — this is usually temporary. Try again in a moment. If it persists, check https://status.claude.com. The trailing sentence varies by provider in the same way as the 500 error above. A 529 is not your usage limit and does not count against your quota. **What to do:** @@ -209,7 +209,7 @@ You have hit the rate limit configured for your API key, Amazon Bedrock project, or Google Vertex AI project. - API Error: Request rejected (429) · this may be a temporary capacity issue. If it persists, check status.claude.com. + API Error: Request rejected (429) · this may be a temporary capacity issue. If it persists, check https://status.claude.com. The trailing sentence names where to check service health and varies by provider. Bedrock, Vertex AI, and Foundry configurations name that provider’s service status instead of the Anthropic status page. A custom `ANTHROPIC_BASE_URL` names the gateway host. **What to do:**
modified Speed up responses with fast mode View current →
--- a/fast-mode.md +++ b/fast-mode.md @@ -13,7 +13,7 @@ What to know: * Use `/fast` to toggle on fast mode in Claude Code CLI. Also available via `/fast` in Claude Code VS Code Extension. - * Fast mode pricing is 30/30/30/150 MTok on both Opus 4.7 and Opus 4.6. + * Fast mode pricing is $30/$150 MTok on both Opus 4.7 and Opus 4.6. * Available to all Claude Code users on subscription plans (Pro/Max/Team/Enterprise) and Claude Console. * For Claude Code users on subscription plans (Pro/Max/Team/Enterprise), fast mode is available via usage credits only and not included in the subscription rate limits.
modified Extend Claude Code View current →
--- a/features-overview.md +++ b/features-overview.md @@ -150,7 +150,7 @@ **Provides**| Tools and data access| Knowledge, workflows, reference material **Examples**| Slack integration, database queries, browser control| Code review checklist, deploy workflow, API style guide -These solve different problems and work well together:**MCP** gives Claude the ability to interact with external systems. Without MCP, Claude can’t query your database or post to Slack.**Skills** give Claude knowledge about how to use those tools effectively, plus workflows you can trigger with `/<name>`. A skill might include your team’s database schema and query patterns, or a `/post-to-slack` workflow with your team’s message formatting rules.Example: An MCP server connects Claude to your database. A skill teaches Claude your data model, common query patterns, and which tables to use for different tasks. +These solve different problems and work well together:**MCP** gives Claude purpose-built tools for an external system, with the connection and authentication handled by the server.**Skills** give Claude knowledge about how to use those tools effectively, plus workflows you can trigger with `/<name>`. A skill might include your team’s database schema and query patterns, or a `/post-to-slack` workflow with your team’s message formatting rules.Example: An MCP server connects Claude to your database. A skill teaches Claude your data model, common query patterns, and which tables to use for different tasks. A hook fires on a lifecycle event; a skill is loaded into context for Claude to apply. @@ -247,9 +247,9 @@ Use `disable-model-invocation: true` for skills with side effects. This saves context and ensures only you trigger them. -**When:** Session start.**What loads:** Tool names from connected servers. Full JSON schemas stay deferred until Claude needs a specific tool.**Context cost:** [Tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is on by default, so idle MCP tools consume minimal context.**Reliability note:** MCP connections can fail silently mid-session. If a server disconnects, its tools disappear without warning. Claude may try to use a tool that no longer exists. If you notice Claude failing to use an MCP tool it previously could access, check the connection with `/mcp`. - -Run `/mcp` to see token costs per server. Disconnect servers you’re not actively using. +**When:** Session start.**What loads:** Tool names from connected servers. Full JSON schemas stay deferred until Claude needs a specific tool.**Context cost:** [Tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is on by default, so idle MCP tools consume minimal context. + +Run `/mcp` to see connection status and token costs per server. Claude Code [reconnects to remote servers automatically](</docs/en/mcp#automatic-reconnection>) if they drop, and you can disconnect servers you’re not actively using. **When:** After file edits, and on demand when Claude navigates code.**What loads:** Type errors and warnings after each file edit. Definition, reference, and type information when Claude looks up a symbol.**Context cost:** Low. Symbol lookups often replace broad file reads, so net context use can go down.
modified Claude Code with GitHub Enterprise Server View current →
--- a/github-enterprise-server.md +++ b/github-enterprise-server.md @@ -20,6 +20,7 @@ ---|---|--- Claude Code on the web| ✅ Supported| Admin connects the GHES instance once; developers use `claude --remote` or [claude.ai/code](<https://claude.ai/code>) as usual Code Review| ✅ Supported| Same automated PR reviews as github.com +Claude Security| ✅ Supported| Available in public beta for Enterprise plans at [claude.ai/security](<https://claude.ai/security>) Teleport sessions| ✅ Supported| Move sessions between web and terminal with `--teleport` Plugin marketplaces| ✅ Supported| Use full git URLs instead of `owner/repo` shorthand Contribution metrics| ✅ Supported| Delivered via webhooks to the [analytics dashboard](</docs/en/analytics>) @@ -62,7 +63,7 @@ Enable features -Return to [claude.ai/admin-settings/claude-code](<https://claude.ai/admin-settings/claude-code>) and enable [Code Review](</docs/en/code-review#set-up-code-review>) and [contribution metrics](</docs/en/analytics#enable-contribution-metrics>) for your GHES repositories using the same configuration as github.com. +Return to [claude.ai/admin-settings/claude-code](<https://claude.ai/admin-settings/claude-code>) and enable [Code Review](</docs/en/code-review#set-up-code-review>), Claude Security, and [contribution metrics](</docs/en/analytics#enable-contribution-metrics>) for your GHES repositories using the same configuration as github.com. ### @@ -70,7 +71,7 @@ GitHub App permissions -The manifest configures the GitHub App with the permissions and webhook events Claude needs across web sessions, Code Review, and contribution metrics: +The manifest configures the GitHub App with the permissions and webhook events Claude needs across web sessions, Code Review, Claude Security, and contribution metrics: Permission| Access| Used for ---|---|---
modified Claude Code on Google Vertex AI View current →
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -148,7 +148,7 @@ export VERTEX_REGION_CLAUDE_HAIKU_4_5=us-east5 export VERTEX_REGION_CLAUDE_4_6_SONNET=europe-west1 -Most model versions have a corresponding `VERTEX_REGION_CLAUDE_*` variable. See the [Environment variables reference](</docs/en/env-vars>) for the full list. Check [Vertex Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) to determine which models support global endpoints versus regional only. [Prompt caching](</docs/en/prompt-caching>) is enabled automatically. To disable it, set `DISABLE_PROMPT_CACHING=1`. To request a 1-hour cache TTL instead of the 5-minute default, set `ENABLE_PROMPT_CACHING_1H=1`; cache writes with a 1-hour TTL are billed at a higher rate. For heightened rate limits, contact Google Cloud support. When using Vertex AI, the `/login` and `/logout` commands are disabled since authentication is handled through Google Cloud credentials. Claude Code disables [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) by default on Vertex AI, so MCP tool definitions load upfront. Vertex AI supports tool search for Claude Sonnet 4.5 and later and Claude Opus 4.5 and later. Set `ENABLE_TOOL_SEARCH=true` to enable it on those models. Earlier models on Vertex AI do not accept the required beta header, and requests fail if you enable tool search with them. +Most model versions have a corresponding `VERTEX_REGION_CLAUDE_*` variable. See the [Environment variables reference](</docs/en/env-vars>) for the full list. Check [Vertex Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) to determine which models support global endpoints versus regional only. [Prompt caching](</docs/en/prompt-caching>) is enabled automatically. To disable it, set `DISABLE_PROMPT_CACHING=1`. To request a 1-hour cache TTL instead of the 5-minute default, set `ENABLE_PROMPT_CACHING_1H=1`; cache writes with a 1-hour TTL are billed at a higher rate. For heightened rate limits, contact Google Cloud support. When using Vertex AI, the `/logout` command is unavailable since authentication is handled through Google Cloud credentials. Claude Code disables [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) by default on Vertex AI, so MCP tool definitions load upfront. Vertex AI supports tool search for Claude Sonnet 4.5 and later and Claude Opus 4.5 and later. Set `ENABLE_TOOL_SEARCH=true` to enable it on those models. Earlier models on Vertex AI do not accept the required beta header, and requests fail if you enable tool search with them. ###
modified Run Claude Code programmatically View current →
--- a/headless.md +++ b/headless.md @@ -199,7 +199,7 @@ The `--allowedTools` flag uses [permission rule syntax](</docs/en/settings#permission-rule-syntax>). The trailing ` *` enables prefix matching, so `Bash(git diff *)` allows any command starting with `git diff`. The space before `*` is important: without it, `Bash(git diff*)` would also match `git diff-index`. -User-invoked [skills](</docs/en/skills>) like `/commit` and [built-in commands](</docs/en/commands>) are only available in interactive mode. In `-p` mode, describe the task you want to accomplish instead. +User-invoked [skills](</docs/en/skills>) like `/code-review` and [built-in commands](</docs/en/commands>) are only available in interactive mode. In `-p` mode, describe the task you want to accomplish instead. ###
modified Hooks reference View current →
Show diff (135 lines)
--- a/hooks.md +++ b/hooks.md @@ -31,6 +31,7 @@ `PostToolUseFailure`| After a tool call fails `PostToolBatch`| After a full batch of parallel tool calls resolves, before the next model call `Notification`| When Claude Code sends a notification +`MessageDisplay`| While assistant message text is displayed `SubagentStart`| When a subagent is spawned `SubagentStop`| When a subagent finishes `TaskCreated`| When a task is being created via `TaskCreate` @@ -209,7 +210,7 @@ `UserPromptExpansion`| command name| your skill or command names `Elicitation`| MCP server name| your configured MCP server names `ElicitationResult`| MCP server name| same values as `Elicitation` -`UserPromptSubmit`, `PostToolBatch`, `Stop`, `TeammateIdle`, `TaskCreated`, `TaskCompleted`, `WorktreeCreate`, `WorktreeRemove`| no matcher support| always fires on every occurrence +`UserPromptSubmit`, `PostToolBatch`, `Stop`, `TeammateIdle`, `TaskCreated`, `TaskCompleted`, `WorktreeCreate`, `WorktreeRemove`, `MessageDisplay`| no matcher support| always fires on every occurrence The matcher runs against a field from the JSON input that Claude Code sends to your hook on stdin. For tool events, that field is `tool_name`. Each hook event section lists the full set of matcher values and the input schema for that event. This example runs a linting script only when Claude writes or edits a file: @@ -648,6 +649,7 @@ `WorktreeCreate`| Yes| Any non-zero exit code causes worktree creation to fail `WorktreeRemove`| No| Failures are logged in debug mode only `InstructionsLoaded`| No| Exit code is ignored +`MessageDisplay`| No| The original text is displayed ### @@ -768,7 +770,8 @@ WorktreeCreate| path return| Command hook prints path on stdout; HTTP hook returns `hookSpecificOutput.worktreePath`. Hook failure or missing path fails creation Elicitation| `hookSpecificOutput`| `action` (accept/decline/cancel), `content` (form field values for accept) ElicitationResult| `hookSpecificOutput`| `action` (accept/decline/cancel), `content` (form field values override) -SessionStart, Setup, SubagentStart| Context only| `hookSpecificOutput.additionalContext` adds context for Claude. SessionStart also accepts `initialUserMessage` and `watchPaths`. No blocking or decision control +MessageDisplay| `hookSpecificOutput`| `displayContent` replaces the displayed text on screen. Display-only: the transcript and what Claude sees keep the original +SessionStart, Setup, SubagentStart| Context only| `hookSpecificOutput.additionalContext` adds context for Claude. SessionStart also accepts `initialUserMessage`, `watchPaths`, `sessionTitle`, and `reloadSkills`. No blocking or decision control WorktreeRemove, Notification, SessionEnd, PostCompact, InstructionsLoaded, StopFailure, CwdChanged, FileChanged| None| No decision control. Used for side effects like logging or cleanup Here are examples of each pattern in action: @@ -841,7 +844,7 @@ SessionStart input -In addition to the common input fields, SessionStart hooks receive `source`, `model`, and optionally `agent_type`. The `source` field indicates how the session started: `"startup"` for new sessions, `"resume"` for resumed sessions, `"clear"` after `/clear`, or `"compact"` after compaction. The `model` field contains the model identifier. If you start Claude Code with `claude --agent <name>`, an `agent_type` field contains the agent name. +In addition to the common input fields, SessionStart hooks receive `source`, `model`, and optionally `agent_type` and `session_title`. The `source` field indicates how the session started: `"startup"` for new sessions, `"resume"` for resumed sessions, `"clear"` after `/clear`, or `"compact"` after compaction. The `model` field contains the model identifier. If you start Claude Code with `claude --agent <name>`, an `agent_type` field contains the agent name. The `session_title` field carries the current session title if one is already set, for example via `--name` or `/rename`. A hook that emits `sessionTitle` can check `session_title` first to avoid overwriting a title the user set explicitly. { "session_id": "abc123", @@ -864,16 +867,26 @@ ---|--- `additionalContext`| String added to Claude’s context at the start of the conversation, before the first prompt. See Add context for Claude for how the text is delivered and what to put in it `initialUserMessage`| String used as the first user message of the session. Applies in [non-interactive mode](</docs/en/headless>) (`-p`), where it becomes the first turn even if no prompt is provided. If a prompt is provided, it follows as the next turn. Unlike `additionalContext`, which attaches to an existing turn, this creates the turn +`sessionTitle`| Sets the session title, with the same effect as `/rename`. Use to name sessions automatically from the launch folder, git branch, or worktree name. Applies only when `source` is `"startup"` or `"resume"`; ignored on `"clear"` and `"compact"` `watchPaths`| Array of absolute paths to watch for FileChanged events during this session +`reloadSkills`| Boolean. When `true`, Claude Code re-scans the [skill](</docs/en/skills>) and command directories after the SessionStart hooks complete, so skills the hook installed are available in the same session, starting with the first prompt { "hookSpecificOutput": { "hookEventName": "SessionStart", - "additionalContext": "Current branch: feat/auth-refactor\nUncommitted changes: src/auth.ts, src/login.tsx\nActive issue: #4211 Migrate to OAuth2" - } - } - -Since plain stdout already reaches Claude for this event, a hook that only loads context can print to stdout directly without building JSON. Use the JSON form when you need to combine context with other fields such as `suppressOutput`. + "additionalContext": "Current branch: feat/auth-refactor\nUncommitted changes: src/auth.ts, src/login.tsx\nActive issue: #4211 Migrate to OAuth2", + "sessionTitle": "auth-refactor" + } + } + +Since plain stdout already reaches Claude for this event, a hook that only loads context can print to stdout directly without building JSON. Use the JSON form when you need to combine context with other fields such as `suppressOutput` or `sessionTitle`. Use `reloadSkills` when a SessionStart hook installs or updates skills. Skill discovery normally runs before SessionStart hooks finish, so files the hook writes into `~/.claude/skills/` or `.claude/skills/` would otherwise only appear in the next session. This example syncs a shared skills repository and requests the re-scan: + + #!/bin/bash + + git -C ~/.claude/skills/team-skills pull --quiet 2>/dev/null || \ + git clone --quiet https://git.example.com/your-org/team-skills.git ~/.claude/skills/team-skills + + echo '{"hookSpecificOutput": {"hookEventName": "SessionStart", "reloadSkills": true}}' #### @@ -1118,6 +1131,56 @@ "additionalContext": "Additional context for this expansion" } } + +### + +​ + +MessageDisplay + +Runs while an assistant message streams to the screen. Claude Code displays the message in increments: each time a batch of newly completed lines is ready to render, the hook runs once with those lines and Claude Code renders the hook’s replacement text in their place. A long message produces several calls; a short message may produce only one. Use this to reformat, redact, or condense Claude’s responses as they appear on screen. MessageDisplay is display-only: the replacement text changes only what is rendered on screen. The transcript and what Claude sees keep the original text, so Claude never sees the replacement, and verbose mode shows the original. MessageDisplay does not support matchers and fires for every assistant message that streams text; messages with no text, such as tool-call-only responses, do not trigger it. In non-interactive runs, including Agent SDK queries and `claude -p`, MessageDisplay runs once per assistant message instead of once per batch of lines. The single call arrives after the message completes and carries the full message text: `index` is `0`, `final` is `true`, and `delta` holds the entire message. A hook that collects the `delta` text for each message receives the same total text in both modes. + +#### + +​ + +MessageDisplay input + +In addition to the common input fields, MessageDisplay hooks receive identifiers for the turn and message, the position of this call within the message, and the new text in `delta`. Batch boundaries depend on how the text streams, so use `index` and `final` to track progress through a message rather than expecting lines to be grouped a particular way. + +Field| Description +---|--- +`turn_id`| UUID of the current turn +`message_id`| UUID of the assistant message being displayed. Stable across every batch of the same message. This is not the API `msg_…` id, so it cannot be correlated with transcript message ids +`index`| Zero-based index of this batch within the message +`final`| `true` on the message’s last batch. Each message has exactly one final batch +`delta`| The newly completed lines since the prior batch, terminating newlines included. Always whole lines, except the final batch which may end mid-line. In interactive runs, the final batch’s delta is empty when the message ends on a newline, so treat `final`, not a non-empty delta, as the end-of-message signal. In Agent SDK and `claude -p` runs, the single call carries the entire message + + { + "session_id": "abc123", + "transcript_path": "/Users/.../.claude/projects/.../transcript.jsonl", + "cwd": "/Users/my-project", + "hook_event_name": "MessageDisplay", + "turn_id": "0c9e6a2f-7d41-4f4e-9a15-3f4f7c2b8d10", + "message_id": "5b2a9c8e-1f63-4d8a-b7c4-9e0d2a6f1c3b", + "index": 0, + "final": false, + "delta": "Here is the plan:\n" + } + +#### + +​ + +MessageDisplay output + +In addition to the JSON output fields available to all hooks, MessageDisplay hooks can return `displayContent` to replace the delta on screen: + +Field| Description +---|--- +`displayContent`| Text displayed in place of the delta. Omit it to display the original + +MessageDisplay hooks have no decision control. They cannot block the message or change what is stored in the transcript or sent to Claude. ###
modified Automate workflows with hooks View current →
--- a/hooks-guide.md +++ b/hooks-guide.md @@ -88,6 +88,8 @@ * Audit configuration changes * Reload environment when directory or files change * Auto-approve specific permission prompts + +For a production example of hooks that run a separate model review and feed findings back into the session, see [how the `security-guidance` plugin integrates with Claude Code](</docs/en/security-guidance#how-the-plugin-integrates-with-claude-code>). ### @@ -429,6 +431,7 @@ `PostToolUseFailure`| After a tool call fails `PostToolBatch`| After a full batch of parallel tool calls resolves, before the next model call `Notification`| When Claude Code sends a notification +`MessageDisplay`| While assistant message text is displayed `SubagentStart`| When a subagent is spawned `SubagentStop`| When a subagent finishes `TaskCreated`| When a task is being created via `TaskCreate` @@ -610,7 +613,7 @@ `ElicitationResult`| MCP server name| same values as `Elicitation` `FileChanged`| literal filenames to watch (see [FileChanged](</docs/en/hooks#filechanged>))| `.envrc|.env` `UserPromptExpansion`| command name| your skill or command names -`UserPromptSubmit`, `PostToolBatch`, `Stop`, `TeammateIdle`, `TaskCreated`, `TaskCompleted`, `WorktreeCreate`, `WorktreeRemove`, `CwdChanged`| no matcher support| always fires on every occurrence +`UserPromptSubmit`, `PostToolBatch`, `Stop`, `TeammateIdle`, `TaskCreated`, `TaskCompleted`, `WorktreeCreate`, `WorktreeRemove`, `CwdChanged`, `MessageDisplay`| no matcher support| always fires on every occurrence A few more examples showing matchers on different event types:
modified Interactive mode View current →
--- a/interactive-mode.md +++ b/interactive-mode.md @@ -186,6 +186,7 @@ `T{char}`| Jump to just after previous occurrence of character `;`| Repeat last f/F/t/T motion `,`| Repeat last f/F/t/T motion in reverse +`/`| Open reverse history search, same as `Ctrl+R` In vim normal mode, if the cursor is at the beginning or end of input and cannot move further, `j`/`k` and the arrow keys navigate command history instead. @@ -378,10 +379,19 @@ * **Available while Claude is working** : you can run `/btw` even while Claude is processing a response. The side question runs independently and does not interrupt the main turn. * **No tool access** : side questions answer only from what is already in context. Claude cannot read files, run commands, or search when answering a side question. - * **Single response** : there are no follow-up turns. If you need a back-and-forth, use a normal prompt instead. + * **Single response** : there are no follow-up turns in the overlay. To continue the thread, fork it into its own session with `f`. * **Low cost** : the side question reuses the parent conversation’s prompt cache, so the additional cost is minimal. -Press **Space** , **Enter** , or **Escape** to dismiss the answer and return to the prompt. `/btw` is the inverse of a [subagent](</docs/en/sub-agents>): it sees your full conversation but has no tools, while a subagent has full tools but starts with an empty context. Use `/btw` to ask about what Claude already knows from this session; use a subagent to go find out something new. +Once the answer appears, the overlay accepts these keys. Earlier side questions from the same session appear as a dimmed list above the current answer; they stay out of the conversation history but remain visible in the overlay until you clear them. + +Key| Action +---|--- +`Space`, `Enter`, `Escape`| Dismiss the answer and return to the prompt +`Up` / `Down`| Scroll the answer +`f`| Fork into a new session. The fork inherits the parent conversation plus this question and answer as real transcript turns, so you can continue with full tool access. The original session is preserved under [`/resume`](</docs/en/commands>). Available in local sessions only +`x`| Clear the list of earlier `/btw` exchanges shown above the current answer + +`/btw` is the inverse of a [subagent](</docs/en/sub-agents>): it sees your full conversation but has no tools, while a subagent has full tools but starts with an empty context. Use `/btw` to ask about what Claude already knows from this session; use a subagent to go find out something new. ##
modified Customize keyboard shortcuts View current →
--- a/keybindings.md +++ b/keybindings.md @@ -322,11 +322,22 @@ `diff:dismiss`| Escape| Close diff viewer `diff:previousSource`| Left| Previous diff source `diff:nextSource`| Right| Next diff source -`diff:previousFile`| Up| Previous file in diff -`diff:nextFile`| Down| Next file in diff +`diff:previousFile`| Up, K| Previous file in the file list; scroll up one line in the detail view +`diff:nextFile`| Down, J| Next file in the file list; scroll down one line in the detail view `diff:viewDetails`| Enter| View diff details `diff:back`| (context-specific)| Go back in diff viewer +The diff detail view also binds pager-style keys to the standard scroll actions. These bindings are part of the `DiffDialog` context and apply only in the detail view; the `Scroll` context defaults listed under Scroll actions are unchanged. + +Action| Default| Description +---|---|--- +`scroll:pageUp`| PageUp| Scroll up half a viewport +`scroll:pageDown`| PageDown| Scroll down half a viewport +`scroll:fullPageUp`| Shift+Space, B| Scroll up a full viewport +`scroll:fullPageDown`| Space| Scroll down a full viewport +`scroll:top`| G, Home| Jump to the top +`scroll:bottom`| Shift+G, End| Jump to the bottom + ### ​ @@ -339,7 +350,7 @@ ---|---|--- `modelPicker:decreaseEffort`| Left| Decrease effort level `modelPicker:increaseEffort`| Right| Increase effort level -`modelPicker:setAsDefault`| d| Set highlighted model as default for new sessions +`modelPicker:thisSessionOnly`| s| Apply highlighted model to this session only ### @@ -572,6 +583,7 @@ * The Escape key in vim mode switches INSERT to NORMAL mode; it does not trigger `chat:cancel` * Most Ctrl+key shortcuts pass through vim mode to the keybinding system * In vim NORMAL mode, `?` shows the help menu (vim behavior) + * In vim NORMAL mode, `/` opens history search, the same as Ctrl+R in standard mode ##
added Set up Claude Code in a monorepo or large codebase View current →
Show diff (464 lines)
--- a/large-codebases.md +++ b/large-codebases.md @@ -0,0 +1,461 @@ +> ## Documentation Index +> +> Fetch the complete documentation index at: <https://code.claude.com/docs/llms.txt> +> +> Use this file to discover all available pages before exploring further. + +A large codebase can be one repository with millions of lines or a monorepo with many packages. Claude Code works at any size, but as the codebase grows, the defaults tuned for smaller projects can fill the context window with instructions and file reads unrelated to the task, costing tokens and degrading Claude’s performance. This guide shows individual developers and engineering teams how to scope Claude to the part of the codebase a task touches. Each section notes whether a setting is personal to your machine or committed to the repository. + +## + +​ + +What this guide covers + +The table below lists each setting and what it accomplishes. The file tree after it is the example monorepo every code sample on this page refers to. + +### + +​ + +Settings on this page + +Each setting below is independent. They layer rather than replace each other, so apply whichever fit your repository. Choose where to start Claude determines where your settings files live, so read it first. Put it together shows all of them combined. + +I want to| Use +---|--- +Load only the conventions for the code you touch, instead of one root file covering every subsystem| Per-directory CLAUDE.md files +Exclude CLAUDE.md files for packages you never work in| `claudeMdExcludes` +Block Claude from opening build output, generated code, and vendored dependencies| `Read` deny rules in `permissions.deny` +Find a symbol’s definition or callers through the language server instead of scanning files| A code intelligence plugin +Check out only the directories a task needs when Claude creates a worktree| `worktree.sparsePaths` +Read and edit a sibling package or another repository from the same session| `--add-dir` or `additionalDirectories` +Give Claude procedures specific to one area that load only when relevant| Per-directory skills +Replace many per-directory CLAUDE.md files with one set of conventions everyone installs| A plugin in an internal marketplace + +For workflow techniques that keep context small in any repository, such as [running exploration in a subagent](</docs/en/best-practices#use-subagents-for-investigation>) so file reads stay out of the main conversation, see [Best practices for Claude Code](</docs/en/best-practices>). To roll out a baseline configuration to every developer in your organization, see [Set up Claude Code for your organization](</docs/en/admin-setup>). + +### + +​ + +The example monorepo + +The examples throughout this page refer to a monorepo with three packages. The same patterns work in a large single-tree codebase: where an example uses `packages/api/`, substitute your own subsystem directory such as `src/backend/` or `lib/core/`. + + monorepo/ + CLAUDE.md # root instructions + packages/ + api/ + CLAUDE.md # API-specific instructions + .claude/skills/ + src/ + web/ + CLAUDE.md # frontend-specific instructions + .claude/skills/ + src/ + shared/ + CLAUDE.md # shared library instructions + src/ + +## + +​ + +Choose where to start Claude + +Where you launch `claude` determines which files Claude can read and edit without an additional permission grant, which CLAUDE.md files load into context at startup, and which project settings apply. + +Start from| File access| CLAUDE.md loaded at launch| Use when +---|---|---|--- +Repository root| Every file| Root only; subdirectory files load on demand when Claude reads there| Tasks span multiple packages or subsystems +A subdirectory| That subtree only, until you grant more| That directory’s plus every ancestor’s| Work is scoped to one package or subsystem + +Project settings in `.claude/settings.json` load only from your starting directory and are not inherited from parent directories the way CLAUDE.md files are: a `.claude/settings.json` at the repository root applies only when you start from the root. Each section below states whether its settings file belongs at the repository root or in the subdirectory you start from, and whether it is committed or kept local. + +## + +​ + +Layer CLAUDE.md files by directory + +In a large codebase, a single CLAUDE.md at the repository root tends to either grow to cover every subsystem’s conventions, costing context on instructions unrelated to the current task, or stay too generic to be useful. Splitting instructions across per-directory files means Claude loads repository-wide rules plus only the conventions for the code you’re working in. Claude Code loads every [CLAUDE.md](</docs/en/memory>) file from your working directory and every parent directory at launch, then loads each subdirectory’s file on demand when it reads files there. A root file sets repository-wide rules and each subdirectory adds its own. A common split is two levels: + + * **Root`CLAUDE.md`**: instructions that apply everywhere, such as coding standards, commit conventions, and repository layout + * **Per-subdirectory`CLAUDE.md`**: conventions specific to that area’s stack. In a monorepo that’s one per package. In a large single tree it’s one per subsystem such as `src/db/` or `src/api/` + +Commit these files to the repository so teammates inherit them. Each directory’s owner typically maintains its file. The root `CLAUDE.md` orients Claude to the repository structure: + +CLAUDE.md + + This is a monorepo with three packages under packages/: + + - packages/api: Node.js REST API with Express, TypeScript, and PostgreSQL + - packages/web: React frontend with Vite, TypeScript, and TailwindCSS + - packages/shared: shared TypeScript utilities used by both api and web + + Run commands from the package directory, not the monorepo root. + Each package has its own tsconfig.json, package.json, and test suite. + +Each subdirectory’s `CLAUDE.md`, here `packages/api/CLAUDE.md`, adds context specific to that area’s stack: + +packages/api/CLAUDE.md + + This package is the REST API server. + + - Run tests: `npm test` (uses Vitest) + - Run dev server: `npm run dev` (port 3001) + - Database migrations: `npm run migrate` + - Environment variables: copy `.env.example` to `.env` + + API routes are in src/routes/. Each route file exports an Express router. + Database queries use Knex in src/db/. Never write raw SQL strings in route handlers. + +When you start Claude from `packages/api/`, it loads both `packages/api/CLAUDE.md` and the root `CLAUDE.md`. Claude sees the local instructions alongside the repository-wide rules, with no instructions from `packages/web/` in context. The same holds for any subdirectory in a non-monorepo tree. A few ways to keep the files current as the codebase and models change: + + * **Review in pull requests** : treat CLAUDE.md edits like any other documentation change so conventions track the code + * **Revisit after major model releases** : instructions that worked around an older model’s limitation may become overhead once a newer model handles the case on its own. For example, a rule that forces single-file refactors can be deleted once the limitation is gone + * **Add a Stop hook that proposes updates** : a [`Stop` hook](</docs/en/hooks#stop>) receives the path to the session transcript when Claude finishes responding, so a script can review the session and propose CLAUDE.md updates while the gap it exposed is fresh + +For more on how CLAUDE.md files load and interact, see [Memory and project instructions](</docs/en/memory>). + +### + +​ + +Choose between per-directory CLAUDE.md and path-scoped rules + +Per-directory `CLAUDE.md` files and [path-scoped rules](</docs/en/memory#path-specific-rules>) under `.claude/rules/` both let you target instructions to part of the tree. They differ in where the file lives and when it loads. + +Approach| File location| Loads when| Use when +---|---|---|--- +Per-directory `CLAUDE.md`| Inside the directory, alongside its code| At launch when started from that directory, or on demand when Claude reads a file there| Directory owners maintain their own conventions; instructions are versioned with the code +Path-scoped rule in `.claude/rules/`| Central `.claude/` at the repo root| When Claude works with a file matching the rule’s `paths:` glob| You want all conventions in one place, or the same rule applies to many scattered paths + +For a comparison that also covers skills, see [Compare similar features](</docs/en/features-overview#compare-similar-features>). + +### + +​ + +Exclude irrelevant CLAUDE.md files + +When you start Claude from the repository root, each subdirectory’s CLAUDE.md loads as soon as Claude reads a file in that directory. The `claudeMdExcludes` setting skips specific files by path or glob pattern so they never load. Use this for directories you never work in, such as other teams’ packages, legacy code, or vendored subtrees. The exclusion list is static, not a per-task switch. To focus on one package today and another tomorrow, start Claude from that package’s directory instead of editing exclusions. If you only want these exclusions for yourself, put the setting in `.claude/settings.local.json`, which is gitignored and not committed. Patterns use glob syntax matched against absolute file paths, so start relative-style patterns with `**/` to match anywhere in the tree. The example below excludes packages owned by other teams: + +.claude/settings.local.json + + { + "claudeMdExcludes": [ + "**/packages/admin-dashboard/**", + "**/packages/legacy-*/**" + ] + } + +This skips every CLAUDE.md and rules file under those packages. The root CLAUDE.md and the packages you do work in still load normally. These patterns cover other common cases: + + * `"**/packages/*/CLAUDE.md"`: excludes every package’s CLAUDE.md while keeping the root + * `"**/packages/web/**"`: excludes everything under the web package, including rules + * `"/home/user/monorepo/legacy/CLAUDE.md"`: excludes one specific file by absolute path + +Managed policy CLAUDE.md files cannot be excluded, so organization-wide instructions always apply. You can set `claudeMdExcludes` at any [settings scope](</docs/en/settings#configuration-scopes>): user, project, local, or managed. Arrays merge across scopes, so a team can set project-level defaults while individuals add local overrides. For the full exclusion documentation, see [Exclude specific CLAUDE.md files](</docs/en/memory#exclude-specific-claude-md-files>). + +## + +​ + +Reduce what Claude reads + +Instructions are only part of what ends up in Claude’s context. File reads are another cost that grows with the codebase. The settings below block reads of irrelevant paths and replace exhaustive file scans with language-server lookups. + +### + +​ + +Block reads of generated and vendored code + +Claude’s content searches respect `.gitignore` by default, so paths already listed there, such as `node_modules/`, `dist/`, and `build/`, stay out of search results without additional configuration. For paths that are checked in, such as a vendored SDK or committed generated code, add `Read` deny rules in `permissions.deny` to block Claude from opening those files even when a search lists them. To apply these exclusions for everyone working in the repository, commit them to `.claude/settings.json`. To keep them personal, use `.claude/settings.local.json` instead. Like other project settings on this page, these files load only from your starting directory. Place them at the repository root if you start Claude there, or in each package’s `.claude/` if you start from subdirectories. To enforce the same deny rules in every session regardless of starting directory, set them in [managed settings](</docs/en/settings#settings-files>), which user and project settings cannot override. The example below blocks build artifacts and a vendored SDK: + +.claude/settings.json + + { + "permissions": { + "deny": [ + "Read(./**/dist/**)", + "Read(./**/build/**)", + "Read(./**/*.generated.*)", + "Read(./vendor/**)" + ] + } + } + +Deny rules cover Claude’s built-in file tools and recognized Bash file commands, including `cat`, `head`, `grep`, and `find`, when a denied path is passed as an argument. They do not filter denied paths out of a recursive search’s output, and they do not cover arbitrary subprocesses that open files themselves. For the full pattern syntax, see [Read and Edit permission rules](</docs/en/permissions#read-and-edit>). + +### + +​ + +Reduce file reads with code intelligence + +In a large codebase, finding where a symbol is defined or used can cost many file reads and grep calls. [Code intelligence plugins](</docs/en/discover-plugins#code-intelligence>) connect Claude to a language server so it can jump to definitions, find references, and surface type errors directly instead of scanning the tree. The official marketplace has plugins for TypeScript, Python, Go, Rust, and other common languages. The example below installs the TypeScript plugin: + + /plugin install typescript-lsp@claude-plugins-official + +To enable a plugin for everyone in the repository rather than installing it yourself, add it to the [`enabledPlugins` project setting](</docs/en/settings#plugin-settings>). Code intelligence plugins require the language’s language server binary on each developer’s machine. See [which binary each language requires](</docs/en/discover-plugins#code-intelligence>). Installing from the official marketplace requires network access to GitHub, where the marketplace is hosted. On a restricted network, [add the marketplace from an internal Git host or local path](</docs/en/discover-plugins#add-from-other-git-hosts>) instead. This pairs well with `claudeMdExcludes` and the `Read` deny rules above. Those keep irrelevant content out of context, and code intelligence keeps Claude from reading through what remains to locate a definition. + +## + +​ + +Scope worktrees and file access + +These settings control what’s on disk in worktrees and which directories Claude can read and write beyond your starting point. + +### + +​ + +Check out only the directories you need + +The `--worktree` flag starts a session in a new git worktree so changes stay isolated from your main checkout. By default it checks out the entire repository. In a large repository, the `worktree.sparsePaths` setting uses git sparse-checkout to write only the listed directories plus root-level files to disk, so worktrees start faster and use less space. If everyone working in this directory needs the same paths, commit the setting to `.claude/settings.json`. To add paths for yourself, use `.claude/settings.local.json`: the lists merge across scopes, so a local file can add paths to the committed list but not remove them. The example below shows the committed file: + +.claude/settings.json + + { + "worktree": { + "sparsePaths": [ + ".claude", + "packages/api", + "packages/shared" + ] + } + } + +When Claude creates a worktree, it checks out only `.claude/`, `packages/api/`, and `packages/shared/` instead of the full tree. Paths in `sparsePaths` are relative to the repository root, regardless of which subdirectory you start Claude from. Any directory paths work here, not only package roots. This is particularly useful for [subagent worktree isolation](</docs/en/worktrees#isolate-subagents-with-worktrees>). Subagents are parallel Claude instances spawned for subtasks, and each one that runs in a worktree gets a lightweight checkout instead of the full tree. All worktrees in a session share the same `sparsePaths`, so if one subagent needs `packages/api/` and another needs `packages/web/`, list both. List directories in `sparsePaths`, not individual files. Root-level files like `package.json`, `tsconfig.base.json`, and lock files are always checked out alongside the directories you list. Root-level directories are not, so include `.claude` in the list if you want the repository root’s `.claude/settings.json`, `.claude/rules/`, or `.claude/skills/` available inside the worktree. To avoid duplicating large directories like `node_modules` across worktrees, pair `sparsePaths` with `symlinkDirectories` in the same `.claude/settings.json`: + +.claude/settings.json + + { + "worktree": { + "sparsePaths": [ + ".claude", + "packages/api", + "packages/shared" + ], + "symlinkDirectories": [ + "node_modules" + ] + } + } + +This creates a symlink from each worktree’s `node_modules/` back to the main repository’s copy rather than duplicating it on disk. + +The `sparsePaths` and `symlinkDirectories` settings are read from your starting directory before the worktree is created. After creation, the session’s working directory is the worktree root, not the subdirectory you launched from. Project settings inside the worktree therefore load from the worktree root’s `.claude/settings.json`, the checked-out copy of the repository root’s file. Put any other settings you need inside worktrees, such as permission rules or hooks, in the repository root’s `.claude/settings.json`. + +For the full worktree settings reference, see [Worktree settings](</docs/en/settings#worktree-settings>). + +### + +​ + +Grant access across packages or repositories + +This section applies when you start Claude from a subdirectory, or when a task spans multiple checkouts. If you start from the repository root in a single large tree, Claude already has access to every file and you can skip this. When you start Claude from `packages/api/`, it can read and write files within that directory. If a task requires changes across packages, such as updating a shared type that both `api` and `web` import, you need to grant access to the sibling directory. The same mechanism grants access to a separately-checked-out repository. The `additionalDirectories` setting in `.claude/settings.json` gives Claude access to directories outside the working directory. The example below grants access to two sibling packages: + +.claude/settings.json + + { + "permissions": { + "additionalDirectories": [ + "../shared", + "../web" + ] + } + } + +Relative paths resolve against the directory you start Claude from. With this configuration, Claude can read and edit files in `packages/shared/` and `packages/web/` while working from `packages/api/`. You can also grant access at runtime without editing settings by passing `--add-dir` when you start Claude: + + claude --add-dir ../shared + +However you add a directory, Claude can read and edit files in it. Whether the directory’s CLAUDE.md, `.claude/rules/` files, and skills also load depends on how you added it: + +Added with| Loads CLAUDE.md and rules| Loads skills +---|---|--- +`additionalDirectories` setting| Never| Never +`--add-dir` flag or `/add-dir` command| Only with the environment variable below| Yes + +To load CLAUDE.md and rules files from a directory added with `--add-dir` or `/add-dir`, set the `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD` environment variable: + + CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1 claude --add-dir ../shared + +The environment variable has no effect on directories listed in the `additionalDirectories` setting. See [Load from additional directories](</docs/en/memory#load-from-additional-directories>) for details. For sibling directories that everyone in this area needs, commit `additionalDirectories` to `.claude/settings.json`. For a personal selection or one-off access, use `.claude/settings.local.json` or pass `--add-dir` at launch. + +## + +​ + +Add per-directory skills + +Any subdirectory can define [skills](</docs/en/skills>) scoped to its own stack. A skill loads on demand when Claude determines it’s relevant, so API-specific tooling doesn’t consume context during frontend work. Skills live under `.claude/skills/` inside the directory. Commit them alongside that area’s code so anyone who clones the repository gets them. In a monorepo this can be one set of skills per package. In a large single-tree codebase it’s one set per subsystem such as `src/db/.claude/skills/`. Create a skill directory inside the subdirectory: + + mkdir -p packages/api/.claude/skills/api-testing + +Then write `SKILL.md` inside that directory, here `packages/api/.claude/skills/api-testing/SKILL.md`. This example teaches Claude the API package’s testing patterns: + +packages/api/.claude/skills/api-testing/SKILL.md + + --- + name: api-testing + description: Testing patterns for the API package. Use when writing or modifying tests in packages/api/. + --- + + ## Test structure + + Tests are in `src/__tests__/` mirroring the `src/` directory structure. + Each route file has a corresponding `.test.ts` file. + + ## Running tests + + - All tests: `npm test` + - Single file: `npm test -- src/__tests__/routes/users.test.ts` + - Watch mode: `npm test -- --watch` + + ## Test utilities + + - `src/__tests__/helpers/db.ts`: provides `setupTestDb()` and `teardownTestDb()` for database tests + - `src/__tests__/helpers/auth.ts`: provides `createTestUser()` and `getAuthToken()` for authenticated endpoints + + ## Patterns + + - Use `supertest` for HTTP assertions, not raw fetch + - Always wrap database tests in a transaction that rolls back + - Mock external services in `src/__tests__/mocks/` + +A different subdirectory holds different skills the same way: `packages/web/.claude/skills/component-patterns/` describes the frontend’s component conventions instead of testing. When Claude works on a file in `packages/api/`, it loads the api-testing skill. When it works in `packages/web/`, it loads component-patterns instead. Neither directory’s skills load during the other’s tasks. You can also scope a skill by file pattern instead of by placement. The [`paths` frontmatter field](</docs/en/skills#frontmatter-reference>) takes glob patterns, and Claude loads the skill automatically only when it works with matching files. Use this for a skill that lives in the repository root’s `.claude/skills/` but applies only to certain files wherever they appear, such as a database-migration skill scoped to `**/migrations/**`. For more on creating and organizing skills, see [Skills](</docs/en/skills>). + +### + +​ + +Keep skills discoverable + +With skills spread across many directories, the list Claude chooses from can grow large. Claude picks a skill by reading every discovered skill’s name and description, and only the chosen skill’s full content loads into context. This section covers how to keep that list small and write descriptions that survive shortening. Which skills are in scope depends on where you start Claude: + + * **From a subdirectory such as`packages/api/`**: skills from that directory, every parent up to the repository root, and the user and enterprise levels + * **From the repository root** : skills from every subdirectory Claude touches during the session, which can accumulate into the hundreds + * **After adding a sibling with`--add-dir`**: that sibling’s skills load too. The `additionalDirectories` setting grants file access only and does not load skills + +Names always load, but [descriptions are shortened when there are many](</docs/en/skills#skill-descriptions-are-cut-short>), which can strip the keywords Claude uses to decide whether a skill applies. Keep descriptions short and lead with words a request would contain, like “writing or modifying tests in `packages/api/`”. For skills that many directories share, such as PR conventions or a deploy checklist, place them in the repository root’s `.claude/skills/` so they load from any starting directory. When shared skills need their own version history or must work across repositories, package them as a [plugin](</docs/en/plugins>) instead. Plugin skills use a `plugin-name:skill-name` namespace, so they never collide with per-directory skills. A platform team can version and update them in one place. To find which skills go unused, enable the OpenTelemetry [logs exporter](</docs/en/monitoring-usage>) and set `OTEL_LOG_TOOL_DETAILS=1` so skill names are recorded verbatim instead of redacted. The [`skill_activated` event](</docs/en/monitoring-usage#skill-activated-event>) records every invocation in its `skill.name` attribute, and `invocation_trigger` records whether a command, Claude, or a nested skill invoked it, which tells you what to consolidate or retire. + +## + +​ + +Centralize conventions when layering stops scaling + +Per-directory CLAUDE.md files can become hard to govern as the codebase grows. Conventions drift, files go stale, and no one owns the root. Solving that typically falls to the team that maintains the repository’s Claude Code setup rather than to each developer working in their own area. Move conventions and reference content out of always-loaded CLAUDE.md and into mechanisms that load on demand: + + * [Skills](</docs/en/skills>): reference material Claude loads only when relevant to the task + * [Plugins](</docs/en/plugins>): versioned bundles of skills, hooks, and commands that a platform team owns centrally + * [MCP servers](</docs/en/mcp>): if your organization already runs a code search or RAG index over the repository, expose it as an MCP tool so Claude queries it instead of reading files directly + +See [server-managed or endpoint-managed settings](</docs/en/server-managed-settings#choose-between-server-managed-and-endpoint-managed-settings>) for how platform teams can enforce these centrally. + +### + +​ + +Recommend the right plugin at session start + +Once conventions live in plugins, a teammate starting Claude in an unfamiliar part of the tree has no signal about which plugin that area’s owners maintain. A [`SessionStart` hook](</docs/en/hooks#sessionstart>) can close that gap, since anything the hook prints to stdout is added to Claude’s context before the first prompt. For example, you can write a script that reads the launch directory from the [hook input](</docs/en/hooks#common-input-fields>), looks it up in a path-to-plugin map committed to the repository, and prints the recommendation for Claude to relay in its first reply. See [Automate workflows with hooks](</docs/en/hooks-guide>) to write and register the hook. + +## + +​ + +Put it together + +The combined configuration below uses the monorepo layout. The same files work for any subdirectory in a large single tree. Project settings load only from the directory you start Claude in, so each subdirectory’s `.claude/settings.json` must be self-contained rather than layered on a root file. The example commits `worktree`, `additionalDirectories`, and the `Read` deny rules in `.claude/settings.json` so every developer in `packages/api/` gets the same sibling access, sparse paths, and exclusions. The file below is the committed per-area settings for `packages/api/`: + +packages/api/.claude/settings.json + + { + "worktree": { + "sparsePaths": [ + ".claude", + "packages/api", + "packages/shared" + ], + "symlinkDirectories": [ + "node_modules" + ] + }, + "permissions": { + "additionalDirectories": [ + "../shared" + ], + "deny": [ + "Read(./**/dist/**)", + "Read(./**/build/**)" + ] + } + } + +Because this session starts from `packages/api/`, sibling packages’ CLAUDE.md files are already out of scope, so `claudeMdExcludes` is not needed here. Add it to the repository root’s `.claude/settings.local.json` instead if you also start sessions from the root. The `additionalDirectories` entry applies when you start Claude from `packages/api/` directly. Inside a worktree created from this session, the working directory is the worktree root, so this settings file does not load. The sibling packages are already reachable inside the worktree without it, but the deny rules need a second copy in the repository root’s `.claude/settings.json` so worktree sessions pick them up, as the worktree settings note describes: + +.claude/settings.json + + { + "permissions": { + "deny": [ + "Read(./**/dist/**)", + "Read(./**/build/**)" + ] + } + } + +After setup, the repository has this layout: + + monorepo/ + CLAUDE.md + .claude/settings.json # deny rules for worktree sessions + packages/ + api/ + CLAUDE.md + .claude/settings.json # worktree, additionalDirectories, deny rules + .claude/skills/api-testing/SKILL.md + web/ + CLAUDE.md + .claude/skills/component-patterns/SKILL.md + shared/ + CLAUDE.md + +With this setup, starting Claude from `packages/api/`: + + * Loads the root CLAUDE.md and `packages/api/CLAUDE.md`, skips `packages/web/CLAUDE.md` + * Can read and edit files in `packages/api/` and `packages/shared/` + * Skips reads of build output under `dist/` and `build/` in `packages/api/` + * Has the api-testing skill available on demand + * Creates worktrees containing `.claude/`, `packages/api/`, `packages/shared/`, and root-level files, with the deny rules applied across the worktree from the root settings file + +## + +​ + +Scope and plan changes that span packages + +The configuration above controls what Claude sees. When a single change touches several packages, such as updating a shared type along with every call site that uses it, how you scope and sequence the task also affects the result. Two techniques help keep a cross-package change consistent: + + * **Give Claude the whole change in one session** : handing over the shared edit and its call sites together keeps the decisions behind each edit consistent, rather than re-deriving them per package + * **Save the plan to a file before editing** : [plan first](</docs/en/best-practices#explore-first-then-plan-then-code>) and ask Claude to write the plan to a markdown file in the repository. A long cross-package session [compacts its context](</docs/en/context-window#what-survives-compaction>) along the way, and the saved plan survives where conversation history may not + +## + +​ + +Next steps + +Once this configuration is in place, you can refine it: + + * Use [hooks](</docs/en/hooks-guide>) to run per-directory linters or type-checkers after Claude edits files + * Review [Manage costs effectively](</docs/en/costs>) to understand how codebase size affects token usage and how to set spend limits before a wider rollout + * Read [How Claude Code works in large codebases](<https://claude.com/blog/how-claude-code-works-in-large-codebases-best-practices-and-where-to-start>) on the Claude blog for organizational rollout patterns and ownership models that sit above the per-repository configuration on this page
modified Control MCP server access for your organization View current →
--- a/managed-mcp.md +++ b/managed-mcp.md @@ -40,7 +40,7 @@ Exclusive control with managed-mcp.json -If you deploy a `managed-mcp.json` file, Claude Code loads only the servers that file defines. Users cannot add, modify, or use any other MCP servers, including plugin-provided servers and claude.ai connectors. Two other settings can further filter the managed set: +If you deploy a `managed-mcp.json` file, Claude Code loads only the servers that file defines. Users cannot add, modify, or use any other MCP servers, including plugin-provided servers. The file also suppresses claude.ai connectors unless you allow them alongside the managed set. Two other settings can further filter the managed set: * `allowedMcpServers` and `deniedMcpServers` apply to managed servers too, so a managed server that doesn’t pass them won’t load. * A user’s own `deniedMcpServers` merges in from their settings, so users can block a managed server for themselves. @@ -113,6 +113,14 @@ Users see no MCP servers in `/mcp`, and `claude mcp add` fails with the enterprise-policy error above. Servers users had previously configured stop loading the next time they start a session, with no warning that policy is the reason. +### + +​ + +Allow claude.ai connectors alongside the managed set + +Deploying `managed-mcp.json` suppresses [claude.ai connectors](</docs/en/mcp#use-mcp-servers-from-claude-ai>) by default, including connectors an administrator configured for the organization in the claude.ai admin console. To load those connectors alongside the servers in `managed-mcp.json`, set `"allowAllClaudeAiMcps": true` in a [managed settings source](</docs/en/admin-setup#decide-how-settings-reach-devices>). Requires Claude Code v2.1.149 or later. With the setting enabled, Claude Code loads the same claude.ai connectors it would load if `managed-mcp.json` were not deployed. Allowlists and denylists still apply to those connectors, so you can block specific ones with `deniedMcpServers`. The setting affects only claude.ai connectors; plugin-provided servers stay suppressed. Claude Code reads this setting only from admin-controlled policy tiers: server-managed settings, an MDM-deployed plist or HKLM registry key, or a system `managed-settings.json` file. Placing it in user or project settings has no effect, so users cannot re-enable connectors that exclusive control suppressed. + ## ​ @@ -343,6 +351,7 @@ `allowedMcpServers`| Allowlist of permitted servers| Any [settings file](</docs/en/settings#settings-files>); entries from every source merge unless `allowManagedMcpServersOnly` is set| For enforcement, a [managed settings source](</docs/en/admin-setup#decide-how-settings-reach-devices>): server-managed settings, `managed-settings.json`, MDM profile, or registry `deniedMcpServers`| Denylist of blocked servers| Any settings file; entries from every source merge| Same as `allowedMcpServers` `allowManagedMcpServersOnly`| Locks the allowlist to managed sources only| Managed settings sources only; the setting has no effect elsewhere| Same as `allowedMcpServers` +`allowAllClaudeAiMcps`| Loads claude.ai connectors alongside `managed-mcp.json` instead of suppressing them| Managed settings sources only; the setting has no effect elsewhere| Same as `allowedMcpServers` ##
modified Connect Claude Code to tools via MCP View current →
--- a/mcp.md +++ b/mcp.md @@ -41,7 +41,7 @@ /plugin install mcp-server-dev@claude-plugins-official -Then run `/reload-plugins` to activate it in the current session. +If Claude Code reports that the marketplace is not found, run `/plugin marketplace add anthropics/claude-plugins-official` first, then retry the install. Once installed, run `/reload-plugins` to activate it in the current session. 2 @@ -325,7 +325,7 @@ Scope hierarchy and precedence -When the same server is defined in more than one place, Claude Code connects to it once, using the definition from the highest-precedence source: +When the same server is defined in more than one place, Claude Code connects to it once, using the definition from the highest-precedence source. The entire server entry from that source is used; fields are not merged across scopes. 1. Local scope 2. Project scope
modified How Claude remembers your project View current →
--- a/memory.md +++ b/memory.md @@ -22,7 +22,7 @@ CLAUDE.md vs auto memory -Claude Code has two complementary memory systems. Both are loaded at the start of every conversation. Claude treats them as context, not enforced configuration. The more specific and concise your instructions, the more consistently Claude follows them. +Claude Code has two complementary memory systems. Both are loaded at the start of every conversation. Claude treats them as context, not enforced configuration. To block an action regardless of what Claude decides, use a [PreToolUse hook](</docs/en/hooks-guide>) instead. The more specific and concise your instructions, the more consistently Claude follows them. | CLAUDE.md files| Auto memory ---|---|--- @@ -106,7 +106,7 @@ Import additional files -CLAUDE.md files can import additional files using `@path/to/import` syntax. Imported files are expanded and loaded into context at launch alongside the CLAUDE.md that references them. Both relative and absolute paths are allowed. Relative paths resolve relative to the file containing the import, not the working directory. Imported files can recursively import other files, with a maximum depth of five hops. To pull in a README, package.json, and a workflow guide, reference them with `@` syntax anywhere in your CLAUDE.md: +CLAUDE.md files can import additional files using `@path/to/import` syntax. Imported files are expanded and loaded into context at launch alongside the CLAUDE.md that references them. Both relative and absolute paths are allowed. Relative paths resolve relative to the file containing the import, not the working directory. Imported files can recursively import other files, with a maximum depth of four hops. To pull in a README, package.json, and a workflow guide, reference them with `@` syntax anywhere in your CLAUDE.md: See @README for project overview and @package.json for available npm commands for this project. @@ -150,7 +150,7 @@ How CLAUDE.md files load -Claude Code reads CLAUDE.md files by walking up the directory tree from your current working directory, checking each directory along the way for `CLAUDE.md` and `CLAUDE.local.md` files. This means if you run Claude Code in `foo/bar/`, it loads instructions from `foo/bar/CLAUDE.md`, `foo/CLAUDE.md`, and any `CLAUDE.local.md` files alongside them. All discovered files are concatenated into context rather than overriding each other. Across the directory tree, content is ordered from the filesystem root down to your working directory. For the `foo/bar/` example, `foo/CLAUDE.md` appears in context before `foo/bar/CLAUDE.md`, so instructions closer to where you launched Claude are read last. Within each directory, `CLAUDE.local.md` is appended after `CLAUDE.md`, so your personal notes are the last thing Claude reads at that level. Claude also discovers `CLAUDE.md` and `CLAUDE.local.md` files in subdirectories under your current working directory. Instead of loading them at launch, they are included when Claude reads files in those subdirectories. If you work in a large monorepo where other teams’ CLAUDE.md files get picked up, use `claudeMdExcludes` to skip them. Block-level HTML comments (`<!-- maintainer notes -->`) in CLAUDE.md files are stripped before the content is injected into Claude’s context. Use them to leave notes for human maintainers without spending context tokens on them. Comments inside code blocks are preserved. When you open a CLAUDE.md file directly with the Read tool, comments remain visible. +Claude Code reads CLAUDE.md files by walking up the directory tree from your current working directory, checking each directory along the way for `CLAUDE.md` and `CLAUDE.local.md` files. This means if you run Claude Code in `foo/bar/`, it loads instructions from `foo/bar/CLAUDE.md`, `foo/CLAUDE.md`, and any `CLAUDE.local.md` files alongside them. All discovered files are concatenated into context rather than overriding each other. Across the directory tree, content is ordered from the filesystem root down to your working directory. For the `foo/bar/` example, `foo/CLAUDE.md` appears in context before `foo/bar/CLAUDE.md`, so instructions closer to where you launched Claude are read last. Within each directory, `CLAUDE.local.md` is appended after `CLAUDE.md`, so your personal notes are the last thing Claude reads at that level. Claude also discovers `CLAUDE.md` and `CLAUDE.local.md` files in subdirectories under your current working directory. Instead of loading them at launch, they are included when Claude reads files in those subdirectories. If you work in a large monorepo where other teams’ CLAUDE.md files get picked up, use `claudeMdExcludes` to skip them. For the full layout of root and per-directory CLAUDE.md files and rules, see [Monorepos and large repos](</docs/en/large-codebases>). Block-level HTML comments (`<!-- maintainer notes -->`) in CLAUDE.md files are stripped before the content is injected into Claude’s context. Use them to leave notes for human maintainers without spending context tokens on them. Comments inside code blocks are preserved. When you open a CLAUDE.md file directly with the Read tool, comments remain visible. ####
modified Claude Code on Microsoft Foundry View current →
--- a/microsoft-foundry.md +++ b/microsoft-foundry.md @@ -58,7 +58,7 @@ az login -When using Microsoft Foundry, the `/login` and `/logout` commands are disabled since authentication is handled through Azure credentials. +When using Microsoft Foundry, the `/logout` command is unavailable since authentication is handled through Azure credentials. ###
modified Model configuration View current →
--- a/model-config.md +++ b/model-config.md @@ -57,7 +57,12 @@ 3. **Environment variable** \- Set `ANTHROPIC_MODEL=<alias|name>` 4. **Settings** \- Configure permanently in your settings file using the `model` field. -As of v2.1.144, `/model` applies to the current session only and is not written to settings. To save your choice as the default for new sessions, press `d` on the highlighted row in the picker, which writes the `model` field in your user settings. Managed settings take precedence and reapply on the next launch. The `--model` flag and `ANTHROPIC_MODEL` environment variable also apply only to the session you launch with them. To run different models in different terminals at the same time, launch each one with its own `--model` flag rather than switching with `/model`. Resumed sessions started with `claude --resume`, `--continue`, or the `/resume` picker keep the model they were using when the transcript was saved, regardless of the current `model` setting. If that model has been retired, the session falls through to the normal precedence order. This prevents another session’s `/model` choice from changing the model on resume. When the active model at startup comes from project or managed settings rather than your own selection, the startup header shows which settings file set it. Run `/model` to override for the current session. Example usage: +As of v2.1.153, `/model` saves your choice as the default for new sessions by writing the `model` field in your user settings. In the picker: + + * `Enter`: switch model and save as your default + * `s`: switch model for this session only + +Typing `/model <name>` directly behaves like `Enter`. Project and managed settings still take precedence and reapply on the next launch. In v2.1.144 through v2.1.152, `/model` applied to the current session only and `d` in the picker saved a default. The `--model` flag and `ANTHROPIC_MODEL` environment variable apply only to the session you launch with them. To run different models in different terminals at the same time, launch each one with its own `--model` flag rather than switching with `/model`. Resumed sessions started with `claude --resume`, `--continue`, or the `/resume` picker keep the model they were using when the transcript was saved, regardless of the current `model` setting. If that model has been retired, the session falls through to the normal precedence order. This prevents another session’s `/model` choice from changing the model on resume. When the active model at startup comes from project or managed settings rather than your own selection, the startup header shows which settings file set it. Run `/model` to override; the project or managed setting reapplies on the next launch. Example usage: # Start with Opus claude --model opus
modified Monitoring View current →
Show diff (126 lines)
--- a/monitoring-usage.md +++ b/monitoring-usage.md @@ -123,6 +123,7 @@ `OTEL_METRICS_INCLUDE_SESSION_ID`| Include session.id attribute in metrics| `true`| `false` `OTEL_METRICS_INCLUDE_VERSION`| Include app.version attribute in metrics| `false`| `true` `OTEL_METRICS_INCLUDE_ACCOUNT_UUID`| Include user.account_uuid and user.account_id attributes in metrics| `true`| `false` +`OTEL_METRICS_INCLUDE_ENTRYPOINT`| Include app.entrypoint attribute in metrics| `false`| `true` These variables help control the cardinality of metrics, which affects storage requirements and query performance in your metrics backend. Lower cardinality generally means better performance and lower storage costs but less granular data for analysis. @@ -142,7 +143,7 @@ `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT`| OTLP traces endpoint, overrides `OTEL_EXPORTER_OTLP_ENDPOINT`| `http://localhost:4318/v1/traces` `OTEL_TRACES_EXPORT_INTERVAL`| Span batch export interval in milliseconds (default: 5000)| `1000`, `10000` -Spans redact user prompt text, tool input details, and tool content by default. Set `OTEL_LOG_USER_PROMPTS=1`, `OTEL_LOG_TOOL_DETAILS=1`, and `OTEL_LOG_TOOL_CONTENT=1` to include them. When tracing is active, Bash and PowerShell subprocesses automatically inherit a `TRACEPARENT` environment variable containing the W3C trace context of the active tool execution span. This lets any subprocess that reads `TRACEPARENT` parent its own spans under the same trace, enabling end-to-end distributed tracing through scripts and commands that Claude runs. When tracing is active and Claude Code is connected directly to the Anthropic API, each model request carries a W3C `traceparent` header set to the `claude_code.llm_request` span’s context, and the API’s `traceresponse` header is recorded as a span link. Together these connect Claude Code’s client-side spans to the server-side trace through any compliant intermediary. The header is not sent to third-party providers. In Agent SDK and non-interactive sessions started with `-p`, Claude Code also reads `TRACEPARENT` and `TRACESTATE` from its own environment when starting each interaction span. This lets an embedding process pass its active W3C trace context into the subprocess so Claude Code’s spans appear as children of the caller’s distributed trace. Interactive sessions ignore inbound `TRACEPARENT` to avoid accidentally inheriting ambient values from CI or container environments. +Spans redact user prompt text, tool input details, and tool content by default. Set `OTEL_LOG_USER_PROMPTS=1`, `OTEL_LOG_TOOL_DETAILS=1`, and `OTEL_LOG_TOOL_CONTENT=1` to include them. When tracing is active, Bash and PowerShell subprocesses automatically inherit a `TRACEPARENT` environment variable containing the W3C trace context of the active tool execution span. This lets any subprocess that reads `TRACEPARENT` parent its own spans under the same trace, enabling end-to-end distributed tracing through scripts and commands that Claude runs. When tracing is active and Claude Code is connected directly to the Anthropic API, each model request carries a W3C `traceparent` header set to the `claude_code.llm_request` span’s context, and the API’s `traceresponse` header is recorded as a span link. Together these connect Claude Code’s client-side spans to the server-side trace through any compliant intermediary. Outbound HTTP MCP requests carry `traceparent` the same way. The header is not sent to third-party providers. By default, the `traceparent` header on model and HTTP MCP requests is sent only when `ANTHROPIC_BASE_URL` is unset or points at the Anthropic API, since some proxies reject unrecognized headers. The subprocess `TRACEPARENT` variable is controlled by the same switch for consistency. If you run Claude Code through a custom `ANTHROPIC_BASE_URL` proxy and want trace context propagated, set `CLAUDE_CODE_PROPAGATE_TRACEPARENT=1`. In Agent SDK and non-interactive sessions started with `-p`, Claude Code also reads `TRACEPARENT` and `TRACESTATE` from its own environment when starting each interaction span. This lets an embedding process pass its active W3C trace context into the subprocess so Claude Code’s spans appear as children of the caller’s distributed trace. Interactive sessions ignore inbound `TRACEPARENT` to avoid accidentally inheriting ambient values from CI or container environments. #### @@ -272,6 +273,8 @@ "otelHeadersHelper": "/bin/generate_opentelemetry_headers.sh" } +The value can be the path to an executable file, including a path that contains spaces, or a shell command line with arguments. On Windows, the value always runs through the shell, so quote a path that contains spaces inside the JSON value. + #### ​ @@ -283,6 +286,12 @@ #!/bin/bash # Example: Multiple headers echo "{\"Authorization\": \"Bearer $(get-token.sh)\", \"X-API-Key\": \"$(get-api-key.sh)\"}" + +If the helper fails or prints output that doesn’t meet these requirements, Claude Code reports the error in: + + * `/doctor` output + * The debug log, when running with [`--debug`](</docs/en/cli-reference#cli-flags>) or after running `/debug` in the session + * stderr, in non-interactive sessions started with `-p` #### @@ -398,6 +407,7 @@ ---|---|--- `session.id`| Unique session identifier| `OTEL_METRICS_INCLUDE_SESSION_ID` (default: true) `app.version`| Current Claude Code version| `OTEL_METRICS_INCLUDE_VERSION` (default: false) +`app.entrypoint`| How the session was launched, such as `cli`, `sdk-cli`, `sdk-ts`, `sdk-py`, or `claude-vscode`| `OTEL_METRICS_INCLUDE_ENTRYPOINT` (default: false) `organization.id`| Organization UUID (when authenticated)| Always included when available `user.account_uuid`| Account UUID (when authenticated)| `OTEL_METRICS_INCLUDE_ACCOUNT_UUID` (default: true) `user.account_id`| Account ID in tagged format matching Anthropic admin APIs (when authenticated), such as `user_01BWBeN28...`| `OTEL_METRICS_INCLUDE_ACCOUNT_UUID` (default: true) @@ -496,6 +506,8 @@ * `skill.name`: Skill active for the request, set by the Skill tool, a `/` command, or inherited by a spawned subagent. Built-in, bundled, user-defined, and official-marketplace plugin skill names appear verbatim. Third-party plugin skill names are replaced with `"third-party"`. Absent when no skill is active. * `plugin.name`: Owning plugin when the active skill or subagent is provided by a plugin. Official-marketplace plugin names appear verbatim. Third-party plugin names are replaced with `"third-party"`. Absent when neither the skill nor the subagent has an owning plugin. * `marketplace.name`: Marketplace the owning plugin was installed from. Only emitted for official-marketplace plugins. Absent otherwise. + * `mcp_server.name`: MCP server whose tool ran in the turn that produced this request. Built-in, claude.ai-proxied, and official-registry server names appear verbatim. User-configured server names are replaced with `"custom"`. Absent when no MCP tool ran. + * `mcp_tool.name`: MCP tool that ran in the turn that produced this request, with the same redaction as `mcp_server.name`. Absent when no MCP tool ran. #### @@ -511,7 +523,7 @@ * `query_source`: Category of the subsystem that issued the request. One of `"main"`, `"subagent"`, or `"auxiliary"` * `speed`: `"fast"` when the request used fast mode. Absent otherwise * `effort`: [Effort level](</docs/en/model-config#adjust-effort-level>) applied to the request. See Cost counter for details. - * `agent.name`, `skill.name`, `plugin.name`, `marketplace.name`: Skill, plugin, and agent attribution for the request. See Cost counter for definitions and redaction behavior. + * `agent.name`, `skill.name`, `plugin.name`, `marketplace.name`, `mcp_server.name`, `mcp_tool.name`: Skill, plugin, agent, and MCP attribution for the request. See Cost counter for definitions and redaction behavior. #### @@ -585,7 +597,7 @@ Tool result event -Logged when a tool completes execution. **Event Name** : `claude_code.tool_result` **Attributes** : +Logged when a tool completes execution. Not emitted if the tool call was rejected; see the Tool decision event for rejections. **Event Name** : `claude_code.tool_result` **Attributes** : * All standard attributes * `event.name`: `"tool_result"` @@ -597,8 +609,8 @@ * `duration_ms`: Execution time in milliseconds * `error_type`: Error category string when the tool failed, such as `"Error:ENOENT"` or `"ShellError"` * `error` (when `OTEL_LOG_TOOL_DETAILS=1`): Full error message when the tool failed - * `decision_type`: Either `"accept"` or `"reject"` - * `decision_source`: Where the decision came from. One of `"config"`, `"hook"`, `"user_permanent"`, `"user_temporary"`, `"user_abort"`, or `"user_reject"`. See the Tool decision event for what each value means. + * `decision_type`: Always `"accept"`, since this event is only emitted after the tool runs (rejected calls don’t produce a tool result) + * `decision_source`: Where the permission decision came from. One of `"config"`, `"hook"`, `"user_permanent"`, or `"user_temporary"`. See the Tool decision event for what each value means. The reject-only sources `"user_abort"` and `"user_reject"` never appear on this event. * `tool_input_size_bytes`: Size of the JSON-serialized tool input in bytes * `tool_result_size_bytes`: Size of the tool result in bytes * `mcp_server_scope`: MCP server scope identifier (for MCP tools) @@ -632,6 +644,7 @@ * `speed`: `"fast"` or `"normal"`, indicating whether fast mode was active * `query_source`: Subsystem that issued the request, such as `"repl_main_thread"`, `"compact"`, or a subagent name * `effort`: [Effort level](</docs/en/model-config#adjust-effort-level>) applied to the request: `"low"`, `"medium"`, `"high"`, `"xhigh"`, or `"max"`. Absent when the model does not support effort. + * `agent.name`, `skill.name`, `plugin.name`, `marketplace.name`, `mcp_server.name`, `mcp_tool.name`: Skill, plugin, agent, and MCP attribution for the request. See Cost counter for definitions and redaction behavior. #### @@ -654,6 +667,7 @@ * `speed`: `"fast"` or `"normal"`, indicating whether fast mode was active * `query_source`: Subsystem that issued the request, such as `"repl_main_thread"`, `"compact"`, or a subagent name * `effort`: [Effort level](</docs/en/model-config#adjust-effort-level>) applied to the request. Absent when the model does not support effort. + * `agent.name`, `skill.name`, `plugin.name`, `marketplace.name`, `mcp_server.name`, `mcp_tool.name`: Skill, plugin, agent, and MCP attribution for the request. See Cost counter for definitions and redaction behavior. #### @@ -710,12 +724,12 @@ * `tool_use_id`: Unique identifier for this tool invocation. Matches the `tool_use_id` passed to hooks, allowing correlation between OTel events and hook-captured data. * `decision`: Either `"accept"` or `"reject"` * `source`: Where the decision came from: - * `"config"`: Decided automatically without prompting, based on project settings, allow rules in the user’s personal settings, enterprise managed policy, `--allowedTools` or `--disallowedTools` flags, the active permission mode, a session-scoped grant from an earlier prompt in the same interactive CLI session, or because the tool is inherently safe. The event does not indicate which of these sources matched. + * `"config"`: Decided automatically without prompting, based on project settings, allow or deny rules in the user’s personal settings, enterprise managed policy, `--allowedTools` or `--disallowedTools` flags, the active permission mode, a session-scoped grant from an earlier prompt in the same interactive CLI session, or because the tool is inherently safe. The event does not indicate which of these sources matched. * `"hook"`: A `PreToolUse` or `PermissionRequest` hook returned the decision. * `"user_permanent"`: Emitted when the user chose “Yes, and don’t ask again for …” at a permission prompt, which saves an allow rule to their personal settings. In the interactive CLI this is emitted only for that choice itself; later calls that match the saved rule emit `"config"` instead. In Agent SDK or non-interactive `-p` sessions, both the initial choice and later rule matches emit `"user_permanent"`. Treated as an accept. * `"user_temporary"`: Emitted when the user chose “Yes” at a permission prompt for a one-time approval, or chose one of the ”… during this session” options on a file edit or read prompt. In the interactive CLI this is emitted only for the choice itself; later calls allowed by that session-scoped grant emit `"config"` instead. In Agent SDK or non-interactive `-p` sessions, both the choice and later matches emit `"user_temporary"`. Treated as an accept. * `"user_abort"`: Emitted when the user dismissed the permission prompt without answering. Treated as a reject. - * `"user_reject"`: Emitted when the user chose “No” when prompted, or a call matched a deny rule in their personal settings. Treated as a reject. + * `"user_reject"`: Emitted when the user chose “No” when prompted. In the interactive CLI this is emitted only for that choice itself; calls that match a deny rule in the user’s personal settings emit `"config"` instead. In Agent SDK or non-interactive `-p` sessions, calls that match a deny rule in personal settings emit `"user_reject"`. Treated as a reject. #### @@ -976,6 +990,7 @@ * `pre_tokens`: Approximate token count before compaction * `post_tokens`: Approximate token count after compaction * `error`: Error message when compaction failed + * `precompute_reuse`: Only set when `trigger` is `"manual"`. Auto-compaction can prepare a summary in the background before the context window fills, and this attribute records whether `/compact` reused that prepared summary. `"hit"` means it was reused; `"miss_custom_instructions"`, `"miss_hook"`, and `"miss_not_ready"` give the reason a fresh summary was computed instead. Requires Claude Code v2.1.153 or later ####
modified Observability with OpenTelemetry View current →
--- a/observability.md +++ b/observability.md @@ -118,7 +118,7 @@ Link traces to your application -The SDK automatically propagates W3C trace context into the CLI subprocess. When you call `query()` while an OpenTelemetry span is active in your application, the SDK injects `TRACEPARENT` and `TRACESTATE` into the child process environment, and the CLI reads them so its `claude_code.interaction` span becomes a child of your span. The agent run then appears inside your application’s trace instead of as a disconnected root. The CLI also forwards `TRACEPARENT` to every Bash and PowerShell command it runs. If a command launched through the Bash tool emits its own OpenTelemetry spans, those spans nest under the `claude_code.tool.execution` span that wraps the command. Auto-injection is skipped when you set `TRACEPARENT` explicitly in `options.env`, so you can pin a specific parent context if needed. Interactive CLI sessions ignore inbound `TRACEPARENT` entirely; only Agent SDK and `claude -p` runs honor it. See [Traces (beta)](</docs/en/monitoring-usage#traces-beta>) in the Monitoring reference for the full span and attribute reference. +The SDK automatically propagates W3C trace context into the CLI subprocess. When you call `query()` while an OpenTelemetry span is active in your application, the SDK injects `TRACEPARENT` and `TRACESTATE` into the child process environment, and the CLI reads them so its `claude_code.interaction` span becomes a child of your span. The agent run then appears inside your application’s trace instead of as a disconnected root. When trace-context propagation is enabled, the CLI also forwards `TRACEPARENT` to every Bash and PowerShell command it runs. If a command launched through the Bash tool emits its own OpenTelemetry spans, those spans nest under the `claude_code.tool.execution` span that wraps the command. Auto-injection is skipped when you set `TRACEPARENT` explicitly in `options.env`, so you can pin a specific parent context if needed. Interactive CLI sessions ignore inbound `TRACEPARENT` entirely; only Agent SDK and `claude -p` runs honor it. See [Traces (beta)](</docs/en/monitoring-usage#traces-beta>) in the Monitoring reference for the full span and attribute reference. ##
modified Output styles View current →
--- a/output-styles.md +++ b/output-styles.md @@ -24,7 +24,11 @@ Change your output style -Run `/config` and select **Output style** to pick a style from a menu. Your selection is saved to `.claude/settings.local.json` at the [local project level](</docs/en/settings>). To set a style without the menu, edit the `outputStyle` field directly in a settings file: +Run `/config` and select **Output style** to pick a style from a menu. Your selection is saved to `.claude/settings.local.json` at the [local project level](</docs/en/settings>). + +The standalone `/output-style` command was deprecated in v2.1.73 and removed in v2.1.91. Use `/config` or edit the `outputStyle` setting directly. + +To set a style without the menu, edit the `outputStyle` field directly in a settings file: { "outputStyle": "Explanatory"
modified Configure permissions View current →
--- a/permissions.md +++ b/permissions.md @@ -316,7 +316,7 @@ Additional directories grant file access, not configuration -Adding a directory extends where Claude can read and edit files. It does not make that directory a full configuration root: most `.claude/` configuration is not discovered from additional directories, though a few types are loaded as exceptions. The following configuration types are loaded from `--add-dir` directories: +Adding a directory extends where Claude can read and edit files. It does not make that directory a full configuration root: most `.claude/` configuration is not discovered from additional directories, though a few types are loaded as exceptions. These exceptions apply only to directories added with the `--add-dir` flag or the `/add-dir` command. Directories listed in `permissions.additionalDirectories` in a settings file grant file access only and do not load any of the configuration below. The following configuration types are loaded from `--add-dir` directories: Configuration| Loaded from `--add-dir` ---|--- @@ -368,6 +368,7 @@ Setting| Description ---|--- +`allowAllClaudeAiMcps`| When `true`, claude.ai connectors load alongside a deployed `managed-mcp.json` instead of being suppressed by its exclusive control. See [Managed MCP configuration](</docs/en/managed-mcp>) `allowedChannelPlugins`| Allowlist of channel plugins that may push messages. Replaces the default Anthropic allowlist when set. Requires `channelsEnabled: true`. See [Restrict which channel plugins can run](</docs/en/channels#restrict-which-channel-plugins-can-run>) `allowManagedHooksOnly`| When `true`, only managed hooks, SDK hooks, and hooks from plugins force-enabled in managed settings `enabledPlugins` are loaded. User, project, and all other plugin hooks are blocked `allowManagedMcpServersOnly`| When `true`, only `allowedMcpServers` from managed settings are respected. `deniedMcpServers` still merges from all sources. See [Managed MCP configuration](</docs/en/managed-mcp>)
modified Create and distribute a plugin marketplace View current →
--- a/plugin-marketplaces.md +++ b/plugin-marketplaces.md @@ -921,13 +921,19 @@ Remove a configured marketplace. The alias `rm` is also accepted. - claude plugin marketplace remove <name> + claude plugin marketplace remove <name> [options] **Arguments:** * `<name>`: marketplace name to remove, as shown by `claude plugin marketplace list`. This is the `name` from `marketplace.json`, not the source you passed to `add` -Removing a marketplace also uninstalls any plugins you installed from it. To refresh a marketplace without losing installed plugins, use `claude plugin marketplace update` instead. +**Options:** + +Option| Description| Default +---|---|--- +`--scope <scope>`| Restrict removal to a single settings scope: `user`, `project`, or `local`. See [Plugin installation scopes](</docs/en/plugins-reference#plugin-installation-scopes>). When omitted, the declaration is removed from every editable scope. When given, only that scope’s declaration is removed; the shared state, cache, and installed plugin data are preserved when the marketplace is still declared in another scope| (all scopes) + +Removing a marketplace from its last remaining scope also uninstalls any plugins you installed from it. To refresh a marketplace without losing installed plugins, use `claude plugin marketplace update` instead. ###
modified Plugins reference View current →
--- a/plugins-reference.md +++ b/plugins-reference.md @@ -105,6 +105,7 @@ `PostToolUseFailure`| After a tool call fails `PostToolBatch`| After a full batch of parallel tool calls resolves, before the next model call `Notification`| When Claude Code sends a notification +`MessageDisplay`| While assistant message text is displayed `SubagentStart`| When a subagent is spawned `SubagentStop`| When a subagent finishes `TaskCreated`| When a task is being created via `TaskCreate` @@ -922,9 +923,9 @@ This example shows what the output looks like for a plugin with two skills: - security-guidance 1.2.0 - Real-time security analysis for Claude Code sessions - Source: security-guidance@claude-code-marketplace + dependency-guard 1.2.0 + Dependency analysis for Claude Code sessions + Source: dependency-guard@example-marketplace Component inventory Skills (2) scan-dependencies, review-changes
modified How Claude Code uses prompt caching View current →
--- a/prompt-caching.md +++ b/prompt-caching.md @@ -20,12 +20,12 @@ Project context| CLAUDE.md, auto memory, unscoped rules| Session starts, or after `/clear` or `/compact` Conversation| Your messages, Claude’s responses, tool results| Every turn -A change to the conversation layer leaves the system prompt and project context cached. A change to the system prompt invalidates everything, because all later content now sits behind a different prefix. The third column gives common triggers rather than an exhaustive list, and the sections below cover the full set, including content such as output style that is fixed at session start. The prefix-match rule explains most of the behaviors on this page. [Plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) and [skill loading](</docs/en/skills>), for example, append their instructions as conversation messages, so the cached prefix stays intact. Two settings aren’t part of the prompt text at all, so they don’t appear in the layer table. They behave differently for caching: - - * **Model** : the cache is keyed by model, so each model has its own cache. Switching models recomputes the entire request even when the content is identical. See Switching models below. - * **Effort level** : not part of the cache key or the prompt, so [changing it](</docs/en/model-config#adjust-effort-level>) mid-session has no effect on the cache. - -Pick your model and connect MCP servers at the top of a session, then save `/compact` for natural breaks between tasks. The fewer changes you make mid-task, the higher your cache hit rate. +A change to the conversation layer leaves the system prompt and project context cached. A change to the system prompt invalidates everything, because all later content now sits behind a different prefix. The third column gives common triggers rather than an exhaustive list, and the sections below cover the full set, including content such as output style that is fixed at session start. The prefix-match rule explains most of the behaviors on this page. [Plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) and [skill loading](</docs/en/skills>), for example, append their instructions as conversation messages, so the cached prefix stays intact. Two settings aren’t part of the prompt text at all, so they don’t appear in the layer table, but both are part of the cache key: + + * **Model** : each model has its own cache. Switching models recomputes the entire request even when the content is identical. See Switching models below. + * **Effort level** : each effort level has its own cache for the same model. Changing it mid-session recomputes the entire request, and Claude Code asks you to confirm before applying the change. See Changing effort level below. + +Pick your model, effort level, and MCP servers at the top of a session, then save `/compact` for natural breaks between tasks. The fewer changes you make mid-task, the higher your cache hit rate. ### @@ -51,6 +51,7 @@ These actions cause the next request to miss part or all of the cache. You see a one-time slower, more expensive turn, after which the new prefix is cached. Most of them are avoidable mid-task once you know they have a cost. A model switch or an MCP reconnect can feel free until you notice the slower turn that follows. * Switching models + * Changing effort level * Connecting or disconnecting an MCP server * Denying an entire tool * Compacting the conversation @@ -63,6 +64,14 @@ Switching models Each model has its own cache. Switching with [`/model`](</docs/en/model-config#setting-your-model>) means the next request reads the entire conversation history with no cache hits, even though the content is identical. The [`opusplan` model setting](</docs/en/model-config#opusplan-model-setting>) resolves to Opus during plan mode and Sonnet during execution, so each plan-mode toggle is a model switch and starts a fresh cache. + +### + +​ + +Changing effort level + +The cache is keyed by [effort level](</docs/en/model-config#adjust-effort-level>) as well as model, so switching with `/effort` means the next request reads the entire conversation history with no cache hits. Once a conversation has started, Claude Code shows a confirmation dialog before applying an effort change that would invalidate the cache. A change that resolves to the same level already in effect, such as setting the model’s default explicitly, skips the dialog and keeps the cache. ###
modified Agent SDK reference - Python View current →
--- a/python.md +++ b/python.md @@ -2076,7 +2076,7 @@ "PermissionRequest", # Called when a permission decision is needed ] -The TypeScript SDK supports additional hook events not yet available in Python: `SessionStart`, `SessionEnd`, `Setup`, `TeammateIdle`, `TaskCompleted`, `ConfigChange`, `WorktreeCreate`, `WorktreeRemove`, and `PostToolBatch`. +The TypeScript SDK supports additional hook events not yet available in Python: `SessionStart`, `SessionEnd`, `Setup`, `TeammateIdle`, `TaskCompleted`, `ConfigChange`, `WorktreeCreate`, `WorktreeRemove`, `PostToolBatch`, and `MessageDisplay`. ### @@ -3497,6 +3497,8 @@ `ignoreViolations`| `SandboxIgnoreViolations`| `None`| Configure which sandbox violations to ignore `enableWeakerNestedSandbox`| `bool`| `False`| Enable a weaker nested sandbox for compatibility +The sandbox depends on platform support and, on Linux, tools like `bubblewrap` and `socat`. By default, when `enabled` is `True` but the sandbox can’t start, commands run unsandboxed with a warning on stderr. This default differs from the TypeScript SDK, where `failIfUnavailable` defaults to `true`.Set `"failIfUnavailable": True` in your sandbox settings to stop instead. The key isn’t declared on `SandboxSettings` yet, but the SDK forwards it to Claude Code, which honors it. `query()` then reports a `ResultMessage` with `subtype="error_during_execution"` and the reason in `errors`. Watch for that subtype rather than expecting `query()` to raise before yielding messages. + #### ​
modified Continue local sessions from any device with Remote Control View current →
--- a/remote-control.md +++ b/remote-control.md @@ -110,7 +110,7 @@ 3. The last meaningful message in existing conversation history 4. An auto-generated name like `myhost-graceful-unicorn`, where `myhost` is your machine’s hostname or the prefix you set with `--remote-control-session-name-prefix` -If you didn’t set an explicit name, the title updates to reflect your prompt once you send one. If the environment already has an active session, you’ll be asked whether to continue it or start a new one. If you don’t have the Claude app yet, use the `/mobile` command inside Claude Code to display a download QR code for [iOS](<https://apps.apple.com/us/app/claude-by-anthropic/id6473753684>) or [Android](<https://play.google.com/store/apps/details?id=com.anthropic.claude>). +If you didn’t set an explicit name, the title updates to reflect your prompt once you send one. Renaming a session from claude.ai or the Claude app also updates the local title shown in `claude --resume`. If the environment already has an active session, you’ll be asked whether to continue it or start a new one. If you don’t have the Claude app yet, use the `/mobile` command inside Claude Code to display a download QR code for [iOS](<https://apps.apple.com/us/app/claude-by-anthropic/id6473753684>) or [Android](<https://play.google.com/store/apps/details?id=com.anthropic.claude>). ###
modified Security View current →
--- a/security.md +++ b/security.md @@ -189,6 +189,7 @@ Related resources + * [Security guidance plugin](</docs/en/security-guidance>): have Claude review and fix vulnerabilities in its own code changes during the session * [Sandbox environments](</docs/en/sandbox-environments>): compare isolation approaches and choose one for your threat model * [Sandboxing](</docs/en/sandboxing>): filesystem and network isolation for Bash commands * [Permissions](</docs/en/permissions>): configure permissions and access controls
added Catch security issues as Claude writes code View current →
Show diff (280 lines)
--- a/security-guidance.md +++ b/security-guidance.md @@ -0,0 +1,277 @@ +> ## Documentation Index +> +> Fetch the complete documentation index at: <https://code.claude.com/docs/llms.txt> +> +> Use this file to discover all available pages before exploring further. + +The security guidance plugin makes Claude review its own code changes for common vulnerabilities while it works and fix what it finds in the same session. The plugin catches issues such as injection, unsafe deserialization, and unsafe DOM APIs before the code reaches a pull request, reducing how much security review falls to human reviewers downstream. Once installed, the plugin runs automatically. There is nothing to invoke and no separate command to remember. The plugin is the in-session companion to [Code Review](</docs/en/code-review>), which runs on pull requests. This plugin reduces what reaches the PR. Code Review catches what does. For how the plugin layers with on-demand review and CI scanning, see How this fits with other security tools. + +## + +​ + +Prerequisites + + * Claude Code CLI version 2.1.144 or later + * Python 3.8 or later on your `PATH`. The plugin tries `python3`, `python`, and `py -3` in that order + * A git repository for the directory you work in. The end-of-turn and commit reviews diff against git state and skip silently outside a repository. The per-edit pattern check works anywhere + +On first run the plugin creates a virtual environment under `~/.claude/security/` and installs the Claude Agent SDK into it, which requires `pip` and network access. If that install fails, the commit review falls back to a single-shot review instead of the agentic one. On Windows the virtual environment step is skipped, so the agentic commit review runs only if `claude-agent-sdk` is already importable and otherwise falls back the same way. + +## + +​ + +Install the plugin + +In a Claude Code session, install from the [official Anthropic marketplace](</docs/en/discover-plugins#official-anthropic-marketplace>): + + /plugin install security-guidance@claude-plugins-official + +The install prompts for a scope. Choose user scope to write the plugin to your user settings, so it loads in every new local session you start on this machine. If Claude Code reports that the marketplace is not found, run `/plugin marketplace add anthropics/claude-plugins-official` first, then retry the install. Then activate it in the current session with `/reload-plugins`, which applies pending plugin changes without a restart: + + /reload-plugins + +### + +​ + +Enable in cloud sessions and shared repositories + +User-scoped plugins do not carry into [Claude Code on the web](</docs/en/claude-code-on-the-web>), because those sessions run on Anthropic infrastructure rather than your machine. To enable the plugin there, or to turn it on for everyone who clones a repository, declare it in the project’s checked-in settings: + +.claude/settings.json + + { + "enabledPlugins": { + "security-guidance@claude-plugins-official": true + } + } + +Administrators can enable the plugin organization-wide by setting [`enabledPlugins`](</docs/en/settings#plugin-settings>) in [managed settings](</docs/en/admin-setup>). + +## + +​ + +What the plugin checks + +The plugin reviews Claude’s work at three points, each at a different depth: + + * On each file edit: a fast pattern match for risky calls, with no model call + * At the end of each turn: a background model review of everything that turn changed + * On each commit or push Claude makes: a deeper agentic review that reads surrounding code + +You can extend each layer by adding your own rules. Built-in checks cannot be removed individually, but you can disable each layer independently. + +### + +​ + +On each file edit + +When Claude writes to a file, the plugin scans the new content for known risky patterns. This is a pattern match with no model call, so it adds no usage cost. Example pattern categories: + + * Dynamic code execution: `eval(`, `new Function`, `os.system`, `child_process.exec` + * Unsafe deserialization: `pickle` + * DOM injection: `dangerouslySetInnerHTML`, `.innerHTML =`, `document.write` + * Workflow files: edits under `.github/workflows/`, which can grant repository-level permissions + +The check runs after the edit lands and appends the warning to Claude’s context for the next step. Each warning fires once per pattern per file per session, so repeat matches in the same file do not flood the conversation. You can add your own patterns to this layer with a `security-patterns.yaml` file. + +### + +​ + +At the end of each turn + +A turn is one round of Claude responding: you send a message, Claude works and replies, and the turn ends. After each turn, the plugin computes a git diff of everything that changed in the working tree during the turn, including changes from Claude’s edit tools, Bash commands, and subagents, and sends it to a separate Claude review focused on security. The review runs in the background, so Claude’s reply is not delayed. If the review finds issues, Claude is re-prompted with the findings and addresses them as a follow-up. This catches issues a string match cannot, such as: + + * Authorization bypass + * Insecure direct object references + * Injection + * Server-side request forgery + * Weak cryptography + +You see both the finding and Claude’s resolution directly in your session. The review covers up to 30 changed files per turn and fires at most three times in a row before yielding back to you. + +### + +​ + +On each commit or push Claude makes + +When Claude runs `git commit` or `git push` through its Bash tool, the plugin runs a deeper agentic review of the change in the background. This review reads surrounding code, including callers, sanitizers, and related files, to decide whether a finding is real before reporting it. The extra context keeps false positives low on patterns that look dangerous in isolation but are safe in your codebase. This layer fires only on commits and pushes Claude makes through its Bash tool. Commits you run from your own shell, including the `!` shell escape inside a session, are not reviewed. Commit and push reviews are capped at 20 per rolling hour. If the commit review’s findings duplicate what the end-of-turn review already reported, Claude is not re-prompted, so a clean commit produces no visible output from this layer. + +### + +​ + +Review independence and limits + +The plugin does not ask the same Claude instance that wrote the code to grade itself. The per-edit check is a deterministic string match with no model involved. The end-of-turn and commit reviews run as a separate Claude call with a fresh context and a security-focused prompt: the reviewer starts from the diff, has no investment in the original approach, and is instructed only to find problems. None of the layers block writes or commits. Findings reach the writing Claude as instructions, Claude addresses them in the conversation, and the review model can miss issues. Treat the plugin as one layer of defense in depth, not a complete security solution. See How this fits with other security tools. + +## + +​ + +Add your own rules + +The plugin has two extension points: a Markdown guidance file for the model-backed reviews, and a YAML or JSON patterns file for the per-edit string match. Both are additive. You can add checks but cannot disable built-in ones from these files. + +### + +​ + +Add guidance for the model-backed reviews + +Create `.claude/claude-security-guidance.md` in your project and describe your threat model and review checklist in plain language. The model-backed reviews load it as additional context alongside the built-in vulnerability checklist. The following example is for a web service with role-gated admin routes and a customer-data logging policy: + +.claude/claude-security-guidance.md + + # Security guidance for this repo + + - Do not log `customer_id` or `account_number` at INFO level or above. + - All routes under `/admin` must call `require_role("admin")` before any database read. + - Use `crypto.timingSafeEqual` for token comparison instead of `===`. + +These rules are guidance for the reviewer, not deterministic guardrails. The plugin surfaces violations as findings for Claude to fix, but it does not block writes or guarantee every violation is caught. The guidance is additive only: a rule that says to ignore a vulnerability class does not suppress those findings. For hard enforcement, pair the plugin with a [hook that blocks the edit](</docs/en/hooks-guide#block-edits-to-protected-files>) or a CI check. + +### + +​ + +Add custom per-edit patterns + +Create `.claude/security-patterns.yaml` to add regex or substring rules to the per-edit pattern check. These run as deterministic string matches alongside the built-in patterns: + +.claude/security-patterns.yaml + + patterns: + - rule_name: internal_api_key + substrings: ["sk_live_", "AKIA"] + reminder: "Hardcoded API key prefix. Load credentials from the secret manager." + - rule_name: tenant_unfiltered_query + regex: "\\.objects\\.all\\(\\)" + paths: ["**/src/tenants/**"] + reminder: "Multi-tenant code must filter by org_id." + +Field| Type| Description +---|---|--- +`rule_name`| string| Identifier shown in the warning +`reminder`| string| Warning text appended to Claude’s context, capped at 1 KB +`regex`| string| Python regex matched against the edited content +`substrings`| list| Literal substrings; provide this or `regex` +`paths`| list| Optional glob patterns; the rule applies only to matching files. Globs match against the full file path, so prefix project-relative patterns with `**/` +`exclude_paths`| list| Optional glob patterns to skip; same matching as `paths` + +The plugin also reads `.claude/security-patterns.yml` and `.claude/security-patterns.json` with the same schema. JSON works on any Python install. The YAML forms require PyYAML to be importable, which the plugin does not install for you. The plugin loads up to 50 custom rules and skips regexes that look prone to catastrophic backtracking. + +### + +​ + +Rule file lookup locations + +The plugin looks for `claude-security-guidance.md` and `security-patterns.yaml` in the same locations, independently of how the plugin was enabled: + +Scope| Path| Notes +---|---|--- +User| `~/.claude/claude-security-guidance.md`| Applies to every project on your machine +Project| `.claude/claude-security-guidance.md`| Checked in with the repository +Project local| `.claude/claude-security-guidance.local.md`| Gitignored, for personal overrides + +The plugin loads all locations that exist and concatenates them, with a combined cap of 8 KB for the guidance file. Administrators can distribute organization-wide rules by pushing the user-scope file to `~/.claude/` through device management. The same paths apply to `security-patterns.yaml`. + +## + +​ + +Usage cost + +The per-edit pattern check makes no model call and adds no cost. The end-of-turn and commit reviews each spend additional model usage that counts toward your [usage](</docs/en/costs>) like any other Claude request. The commit review is agentic and may take several model turns per commit, capped at 20 reviews per rolling hour. Expect roughly one review call per turn that changes files and one deeper review per commit, both subject to the caps above. Both model-backed reviews use Claude Opus 4.7 by default. Set `SECURITY_REVIEW_MODEL` to choose a different model for the end-of-turn review and `SG_AGENTIC_MODEL` for the commit review. The plugin is available on all plans. + +## + +​ + +Disable or uninstall + +To turn off individual layers while keeping the rest, set the matching environment variable: + +Variable| Effect +---|--- +`ENABLE_PATTERN_RULES=0`| Disable the per-edit pattern check +`ENABLE_STOP_REVIEW=0`| Disable the end-of-turn diff review +`ENABLE_COMMIT_REVIEW=0`| Disable the commit and push review +`ENABLE_CODE_SECURITY_REVIEW=0`| Disable all model-backed reviews at once +`SECURITY_GUIDANCE_DISABLE=1`| Disable the plugin entirely without uninstalling + +To pause the plugin in your user scope: + + /plugin disable security-guidance@claude-plugins-official + +To remove it from your user scope: + + /plugin uninstall security-guidance@claude-plugins-official + +If the plugin was enabled through a project’s `.claude/settings.json`, disabling it from `/plugin` writes an override to your `.claude/settings.local.json` rather than editing the checked-in file, so the plugin stays off for you while teammates are unaffected. If it was enabled through [managed settings](</docs/en/admin-setup>), only an administrator can disable it. + +## + +​ + +How the plugin integrates with Claude Code + +The plugin is built entirely on [hooks](</docs/en/hooks>), the mechanism for running your own code at specific points in Claude’s loop. It registers: + +Hook event| Purpose +---|--- +`SessionStart`| Bootstrap the plugin’s Python environment +`UserPromptSubmit`| Capture the working-tree baseline that the end-of-turn review diffs against +`PostToolUse` on `Edit`, `Write`, and `NotebookEdit`| Per-edit pattern match +`Stop`| End-of-turn diff review, run in the background +`PostToolUse` on `Bash`, filtered to `git commit` and `git push`| Commit and push review, run in the background + +If you build your own hooks, the [plugin’s source](<https://github.com/anthropics/claude-plugins-official/tree/main/plugins/security-guidance>) is a working example of running a separate model call from a hook and feeding the result back to the session. + +## + +​ + +How this fits with other security tools + +The plugin is one layer in a defense-in-depth approach. It catches issues earliest, while code is still in the editor, but it is not a guarantee and does not replace later checks. A typical stack: + +Stage| Tool| What it covers +---|---|--- +In session| Security guidance plugin| Common vulnerabilities in code Claude writes, fixed in the same session +On demand| [`/security-review`](</docs/en/commands#all-commands>)| One-time security pass on the current branch, run when you ask +On pull request| [Code Review](</docs/en/code-review>), Team and Enterprise plans| Multi-agent correctness and security review with full codebase context +In CI| Your existing static analysis and dependency scanners| Language-specific rules, supply-chain checks, and policy enforcement the plugin does not attempt + +Each later stage catches what earlier ones miss. The plugin’s value is reducing the volume that reaches them, not eliminating the need for them. + +## + +​ + +Troubleshooting + +The plugin writes runtime diagnostics to `~/.claude/security/log.txt`. Check there first if reviews are not appearing. Common reasons a review layer skips without a message in the conversation: + + * The directory is not a git repository: the end-of-turn and commit reviews require git state and skip outside a repository + * The session has no Anthropic authentication: the model-backed reviews skip and only the per-edit pattern check runs + * A `security-patterns.yaml` file is present but PyYAML is not importable: the file is ignored. Use `security-patterns.json` instead + +## + +​ + +Related resources + +To go deeper on the pieces this page touches: + + * [Code Review](</docs/en/code-review>): set up the PR-time multi-agent review + * [Automate workflows with hooks](</docs/en/hooks-guide>): build your own checks at the same lifecycle points + * [Discover and install plugins](</docs/en/discover-plugins#official-anthropic-marketplace>): browse other official plugins
modified Claude Code settings View current →
--- a/settings.md +++ b/settings.md @@ -179,6 +179,7 @@ Key| Description| Example ---|---|--- `agent`| Run the main thread as a named subagent. Applies that subagent’s system prompt, tool restrictions, and model. See [Invoke subagents explicitly](</docs/en/sub-agents#invoke-subagents-explicitly>)| `"code-reviewer"` +`allowAllClaudeAiMcps`| (Managed settings only) Load claude.ai connectors alongside a deployed `managed-mcp.json`, which otherwise takes exclusive control and suppresses them. See [Managed MCP configuration](</docs/en/managed-mcp>)| `true` `allowedChannelPlugins`| (Managed settings only) Allowlist of channel plugins that may push messages. Replaces the default Anthropic allowlist when set. Undefined = fall back to the default, empty array = block all channel plugins. Requires `channelsEnabled: true`. See [Restrict which channel plugins can run](</docs/en/channels#restrict-which-channel-plugins-can-run>)| `[{ "marketplace": "claude-plugins-official", "plugin": "telegram" }]` `allowedHttpHookUrls`| Allowlist of URL patterns that HTTP hooks may target. Supports `*` as a wildcard. When set, hooks with non-matching URLs are blocked. Undefined = no restriction, empty array = block all HTTP hooks. Arrays merge across settings sources. See Hook configuration| `["https://hooks.example.com/*"]` `allowedMcpServers`| When set in managed-settings.json, allowlist of MCP servers users can configure. Undefined = no restrictions, empty array = lockdown. Applies to all scopes. Denylist takes precedence. See [Managed MCP configuration](</docs/en/managed-mcp>)| `[{ "serverName": "github" }]` @@ -238,6 +239,7 @@ `parentSettingsBehavior`| (Managed settings only) Controls whether managed settings supplied programmatically by an embedding host process, such as the Agent SDK or an IDE extension, apply when an admin-deployed managed tier is also present. `"first-wins"`: the parent-supplied settings are dropped and only the admin tier applies. `"merge"`: the parent-supplied settings apply under the admin tier, filtered so they can tighten policy but not loosen it. Has no effect when no admin tier is deployed. Default: `"first-wins"`. Requires Claude Code v2.1.133 or later| `"merge"` `permissions`| See table below for structure of permissions.| `plansDirectory`| Customize where plan files are stored. Path is relative to project root. Default: `~/.claude/plans`| `"./plans"` +`pluginSuggestionMarketplaces`| (Managed settings only) Marketplace names whose plugins can appear as contextual install suggestions, in addition to the official marketplace. Suggestions come from each plugin’s `relevance` declaration in its marketplace entry. A name only takes effect when the marketplace is registered on the machine and its registered source is also declared in managed settings, either as the `extraKnownMarketplaces` entry for that name or as an entry of `strictKnownMarketplaces`. A marketplace registered from a different source under an allowlisted name is ignored.| `["acme-corp-plugins"]` `pluginTrustMessage`| (Managed settings only) Custom message appended to the plugin trust warning shown before installation. Use this to add organization-specific context, for example to confirm that plugins from your internal marketplace are vetted.| `"All plugins from our marketplace are approved by IT"` `policyHelper`| Admin-deployed executable that computes managed settings dynamically at startup. Only honored from MDM or a system `managed-settings.json` file. See Compute managed settings with a policy helper. Requires Claude Code v2.1.136 or later| `{"path": "/usr/local/bin/claude-policy"}` `preferredNotifChannel`| Method for task-complete and permission-prompt notifications: `"auto"`, `"terminal_bell"`, `"iterm2"`, `"iterm2_with_bell"`, `"kitty"`, `"ghostty"`, or `"notifications_disabled"`. Default: `"auto"`, which sends a desktop notification in iTerm2, Ghostty, and Kitty and does nothing in other terminals. Set `"terminal_bell"` to ring the bell character in any terminal. Appears in `/config` as **Notifications**. See [Get a terminal bell or notification](</docs/en/terminal-config#get-a-terminal-bell-or-notification>)| `"terminal_bell"` @@ -714,7 +716,7 @@ * `hostPattern`: regex pattern to match marketplace hosts (uses `hostPattern`) * `settings`: inline marketplace declared directly in settings.json without a separate hosted repository (uses `name` and `plugins`) -Each marketplace entry also accepts an optional `autoUpdate` Boolean. Set `"autoUpdate": true` alongside `source` to make Claude Code refresh that marketplace and update its installed plugins at startup. When omitted, official Anthropic marketplaces default to `true` and all other marketplaces default to `false`. See [Configure auto-updates](</docs/en/discover-plugins#configure-auto-updates>). Use `source: 'settings'` to declare a small set of plugins inline without setting up a hosted marketplace repository. Plugins listed here must reference external sources such as GitHub or npm. You still need to enable each plugin separately in `enabledPlugins`. +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. Requires Claude Code v2.1.153 or later. Each marketplace entry also accepts an optional `autoUpdate` Boolean. Set `"autoUpdate": true` alongside `source` to make Claude Code refresh that marketplace and update its installed plugins at startup. When omitted, official Anthropic marketplaces default to `true` and all other marketplaces default to `false`. See [Configure auto-updates](</docs/en/discover-plugins#configure-auto-updates>). Use `source: 'settings'` to declare a small set of plugins inline without setting up a hosted marketplace repository. Plugins listed here must reference external sources such as GitHub or npm. You still need to enable each plugin separately in `enabledPlugins`. { "extraKnownMarketplaces": {
modified Advanced setup View current →
--- a/setup.md +++ b/setup.md @@ -162,7 +162,7 @@ Auto-updates -Claude Code checks for updates on startup and periodically while running. Updates download and install in the background, then take effect the next time you start Claude Code. +Claude Code checks for updates on startup and periodically while running. Updates download and install in the background, then take effect the next time you start Claude Code. Run `claude doctor` to see the result of the most recent update attempt. If an npm global install can’t auto-update because the npm global directory isn’t writable, Claude Code shows a one-time notice at startup, and `claude doctor` lists the available fixes. See [permission errors during installation](</docs/en/troubleshoot-install#permission-errors-during-installation>) for details. Homebrew, WinGet, apt, dnf, and apk installations do not auto-update by default; see below to opt in for Homebrew and WinGet. To upgrade Homebrew manually, run `brew upgrade claude-code` or `brew upgrade claude-code@latest`, depending on which cask you installed. For WinGet, run `winget upgrade Anthropic.ClaudeCode`. For Linux package managers, see the upgrade commands in Install with Linux package managers.To have Claude Code run the upgrade command for you on Homebrew or WinGet, set [`CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE`](</docs/en/env-vars>) to `1`. Claude Code then runs the upgrade in the background when a new version is available and shows a restart prompt on success. The upgrade targets only the Claude Code package and does not affect other software you have installed.On WinGet the upgrade may fail while Claude Code is running because Windows locks the executable. In that case Claude Code shows the manual command instead. apt, dnf, and apk continue to require a manual upgrade because those commands need elevated privileges.**Known issue:** Claude Code may notify you of updates before the new version is available in these package managers. If an upgrade fails, wait and try again later.Homebrew keeps old versions on disk after upgrades. Run `brew cleanup` periodically to reclaim disk space.
modified Extend Claude with skills View current →
--- a/skills.md +++ b/skills.md @@ -141,7 +141,7 @@ Skills from additional directories -The `--add-dir` flag [grants file access](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>) rather than configuration discovery, but skills are an exception: `.claude/skills/` within an added directory is loaded automatically. See Live change detection for how edits are picked up during a session. Other `.claude/` configuration such as subagents, commands, and output styles is not loaded from additional directories. See the [exceptions table](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>) for the complete list of what is and isn’t loaded, and the recommended ways to share configuration across projects. +The `--add-dir` flag and `/add-dir` command [grant file access](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>) rather than configuration discovery, but skills are an exception: `.claude/skills/` within an added directory is loaded automatically. This exception applies only to `--add-dir` and `/add-dir`. The `permissions.additionalDirectories` setting in `settings.json` grants file access only and does not load skills. See Live change detection for how edits are picked up during a session. Other `.claude/` configuration such as subagents, commands, and output styles is not loaded from additional directories. See the [exceptions table](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>) for the complete list of what is and isn’t loaded, and the recommended ways to share configuration across projects. CLAUDE.md files from `--add-dir` directories are not loaded by default. To load them, set `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1`. See [Load from additional directories](</docs/en/memory#load-from-additional-directories>). @@ -208,14 +208,15 @@ Field| Required| Description ---|---|--- -`name`| No| Display name for the skill. If omitted, uses the directory name. Lowercase letters, numbers, and hyphens only (max 64 characters). +`name`| No| Display name shown in skill listings. Defaults to the directory name. See How a skill gets its command name for how this differs from the name you type to invoke the skill. `description`| Recommended| What the skill does and when to use it. Claude uses this to decide when to apply the skill. If omitted, uses the first paragraph of markdown content. Put the key use case first: the combined `description` and `when_to_use` text is truncated at 1,536 characters in the skill listing to reduce context usage. `when_to_use`| No| Additional context for when Claude should invoke the skill, such as trigger phrases or example requests. Appended to `description` in the skill listing and counts toward the 1,536-character cap. `argument-hint`| No| Hint shown during autocomplete to indicate expected arguments. Example: `[issue-number]` or `[filename] [format]`. `arguments`| No| Named positional arguments for `$name` substitution in the skill content. Accepts a space-separated string or a YAML list. Names map to argument positions in order. `disable-model-invocation`| No| Set to `true` to prevent Claude from automatically loading this skill. Use for workflows you want to trigger manually with `/name`. Also prevents the skill from being [preloaded into subagents](</docs/en/sub-agents#preload-skills-into-subagents>). Default: `false`. `user-invocable`| No| Set to `false` to hide from the `/` menu. Use for background knowledge users shouldn’t invoke directly. Default: `true`. -`allowed-tools`| No| Tools Claude can use without asking permission when this skill is active. Accepts a space-separated string or a YAML list. +`allowed-tools`| No| Tools Claude can use without asking permission when this skill is active. Accepts a space- or comma-separated string, or a YAML list. +`disallowed-tools`| No| Tools removed from Claude’s available pool while this skill is active. Use for autonomous skills that should never call certain tools, such as `AskUserQuestion` for a background loop. Accepts a space- or comma-separated string, or a YAML list. The restriction clears when you send your next message. `model`| No| Model to use when this skill is active. The override applies for the rest of the current turn and is not saved to settings; the session model resumes on your next prompt. Accepts the same values as [`/model`](</docs/en/model-config>), or `inherit` to keep the active model. `effort`| No| [Effort level](</docs/en/model-config#adjust-effort-level>) when this skill is active. Overrides the session effort level. Default: inherits from session. Options: `low`, `medium`, `high`, `xhigh`, `max`; available levels depend on the model. `context`| No| Set to `fork` to run in a forked subagent context. @@ -223,6 +224,23 @@ `hooks`| No| Hooks scoped to this skill’s lifecycle. See [Hooks in skills and agents](</docs/en/hooks#hooks-in-skills-and-agents>) for configuration format. `paths`| No| Glob patterns that limit when this skill is activated. Accepts a comma-separated string or a YAML list. When set, Claude loads the skill automatically only when working with files matching the patterns. Uses the same format as [path-specific rules](</docs/en/memory#path-specific-rules>). `shell`| No| Shell to use for `!`command`` and ````!` blocks in this skill. Accepts `bash` (default) or `powershell`. Setting `powershell` runs inline shell commands via PowerShell on Windows. Requires `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`. + +#### + +​ + +How a skill gets its command name + +The command you type to invoke a skill comes from where the skill file lives. The frontmatter `name` field sets the display label shown in skill listings and, except for a plugin-root `SKILL.md`, does not change what you type after `/`. The table below shows where the command name comes from for each layout: + +Skill location| Command name source| Example +---|---|--- +Skill directory under `~/.claude/skills/` or `.claude/skills/`| Directory name| `.claude/skills/deploy-staging/SKILL.md` → `/deploy-staging` +File under `.claude/commands/`| File name without extension| `.claude/commands/deploy.md` → `/deploy` +Plugin `skills/` subdirectory| Directory name, namespaced by plugin| `my-plugin/skills/review/SKILL.md` → `/my-plugin:review` +Plugin root `SKILL.md`| Frontmatter `name`, with the plugin directory name as a fallback| `my-plugin/SKILL.md` with `name: review` → `/my-plugin:review`. See [Path behavior rules](</docs/en/plugins-reference#path-behavior-rules>) + +The plugin-root case is the one place where `name` does set the command name, because there is no skill directory to take it from. If `name` is not set in the frontmatter, the plugin’s directory name is used instead. ####
modified Customize your status line View current →
--- a/statusline.md +++ b/statusline.md @@ -133,6 +133,8 @@ * **Multiple lines** : each `echo` or `print` statement displays as a separate row. See the multi-line example. * **Colors** : use [ANSI escape codes](<https://en.wikipedia.org/wiki/ANSI_escape_code#Colors>) like `\033[32m` for green (terminal must support them). See the git status example. * **Links** : use [OSC 8 escape sequences](<https://en.wikipedia.org/wiki/ANSI_escape_code#OSC>) to make text clickable (Cmd+click on macOS, Ctrl+click on Windows/Linux). Requires a terminal that supports hyperlinks like iTerm2, Kitty, or WezTerm. See the clickable links example. + +**Sizing output to the terminal** Claude Code captures your script’s output instead of connecting it directly to the terminal, so `tput cols` and language-level width detection cannot read the terminal size from inside the script. Read the `COLUMNS` and `LINES` environment variables instead. Claude Code sets these to the current terminal dimensions before running your script. Requires Claude Code v2.1.153 or later. The status line runs locally and does not consume API tokens. It temporarily hides during certain UI interactions, including autocomplete suggestions, the help menu, and permission prompts.
modified Create custom subagents View current →
--- a/sub-agents.md +++ b/sub-agents.md @@ -305,7 +305,16 @@ Available tools -Subagents can use any of Claude Code’s [internal tools](</docs/en/tools-reference>). By default, subagents inherit all tools from the main conversation, including MCP tools. To restrict tools, use either the `tools` field (allowlist) or the `disallowedTools` field (denylist). This example uses `tools` to exclusively allow Read, Grep, Glob, and Bash. The subagent can’t edit files, write files, or use any MCP tools: +Subagents inherit the [internal tools](</docs/en/tools-reference>) and MCP tools available in the main conversation by default. The following tools depend on the main conversation’s UI or session state and are not available to subagents, even when listed in the `tools` field: + + * `Agent` + * `AskUserQuestion` + * `EnterPlanMode` + * `ExitPlanMode`, unless the subagent’s `permissionMode` is `plan` + * `ScheduleWakeup` + * `WaitForMcpServers` + +To restrict tools, use either the `tools` field (allowlist) or the `disallowedTools` field (denylist). This example uses `tools` to exclusively allow Read, Grep, Glob, and Bash. The subagent can’t edit files, write files, or use any MCP tools: --- name: safe-researcher @@ -377,7 +386,13 @@ Use the Playwright tools to navigate, screenshot, and interact with pages. -Inline definitions use the same schema as `.mcp.json` server entries (`stdio`, `http`, `sse`, `ws`), keyed by the server name. To keep an MCP server out of the main conversation entirely and avoid its tool descriptions consuming context there, define it inline here rather than in `.mcp.json`. The subagent gets the tools; the parent conversation does not. +Inline definitions use the same schema as `.mcp.json` server entries (`stdio`, `http`, `sse`, `ws`), keyed by the server name. To keep an MCP server out of the main conversation entirely and avoid its tool descriptions consuming context there, define it inline here rather than in `.mcp.json`. The subagent gets the tools; the parent conversation does not. As of v2.1.153, the MCP restrictions that apply to the main session also cover servers declared in subagent frontmatter: + + * [`--strict-mcp-config`](</docs/en/cli-reference>) and [`--bare`](</docs/en/cli-reference>) + * [Enterprise managed MCP configuration](</docs/en/managed-mcp>) + * [`allowedMcpServers` and `deniedMcpServers` policies](</docs/en/managed-mcp#policy-based-control-with-allowlists-and-denylists>) + +When one of these blocks a server, Claude Code skips it and shows a warning naming the blocked servers. Managed-settings restrictions apply to every subagent regardless of how it is defined. `--strict-mcp-config` does not filter servers you pass inline via `--agents` or the SDK `agents` option, since those are explicit caller input. ####
modified Tools reference View current →
--- a/tools-reference.md +++ b/tools-reference.md @@ -16,9 +16,9 @@ `CronList`| Lists all scheduled tasks in the session| No `Edit`| Makes targeted edits to specific files. See Edit tool behavior| Yes `EnterPlanMode`| Switches to plan mode to design an approach before coding| No -`EnterWorktree`| Creates an isolated [git worktree](</docs/en/worktrees>) and switches into it. Pass a `path` to switch into an existing worktree of the current repository instead of creating a new one. Not available to subagents| No +`EnterWorktree`| Creates an isolated [git worktree](</docs/en/worktrees>) and switches into it. Pass a `path` to switch into an existing worktree of the current repository instead of creating a new one. Not available to subagents that already run in their own working directory, such as with [`isolation: worktree`](</docs/en/sub-agents#supported-frontmatter-fields>)| No `ExitPlanMode`| Presents a plan for approval and exits plan mode| Yes -`ExitWorktree`| Exits a worktree session and returns to the original directory. Not available to subagents| No +`ExitWorktree`| Exits a worktree session and returns to the original directory. Not available to subagents that already run in their own working directory, such as with [`isolation: worktree`](</docs/en/sub-agents#supported-frontmatter-fields>)| No `Glob`| Finds files based on pattern matching. See Glob tool behavior| No `Grep`| Searches for patterns in file contents. See Grep tool behavior| No `ListMcpResourcesTool`| Lists resources exposed by connected [MCP servers](</docs/en/mcp>)| No
modified Agent SDK reference - TypeScript View current →
--- a/typescript.md +++ b/typescript.md @@ -505,7 +505,7 @@ `disallowedTools`| `string[]`| `[]`| Tools to deny. A bare name such as `"Bash"` removes the tool from Claude’s context. A scoped rule such as `"Bash(rm *)"` leaves the tool available and denies matching calls in every permission mode, including `bypassPermissions`. See [Permissions](</docs/en/agent-sdk/permissions#allow-and-deny-rules>) `effort`| `'low' | 'medium' | 'high' | 'xhigh' | 'max'`| `'high'`| Controls how much effort Claude puts into its response. Works with adaptive thinking to guide thinking depth `enableFileCheckpointing`| `boolean`| `false`| Enable file change tracking for rewinding. See [File checkpointing](</docs/en/agent-sdk/file-checkpointing>) -`env`| `Record<string, string | undefined>`| `process.env`| Environment variables. See [Environment variables](</docs/en/env-vars>) for variables the underlying CLI reads, and Handle slow or stalled API responses for timeout-related variables. Set `CLAUDE_AGENT_SDK_CLIENT_APP` to identify your app in the User-Agent header +`env`| `Record<string, string | undefined>`| `process.env`| Environment variables. When set, this replaces the subprocess environment instead of merging with `process.env`, so pass `{ ...process.env, YOUR_VAR: 'value' }` to keep inherited variables like `PATH`. See Handle slow or stalled API responses for an example of this pattern, and [Environment variables](</docs/en/env-vars>) for variables the underlying CLI reads. Set `CLAUDE_AGENT_SDK_CLIENT_APP` to identify your app in the User-Agent header `executable`| `'bun' | 'deno' | 'node'`| Auto-detected| JavaScript runtime to use `executableArgs`| `string[]`| `[]`| Arguments to pass to the executable `extraArgs`| `Record<string, string | null>`| `{}`| Additional arguments @@ -1411,7 +1411,8 @@ | "TaskCompleted" | "ConfigChange" | "WorktreeCreate" - | "WorktreeRemove"; + | "WorktreeRemove" + | "MessageDisplay"; ### @@ -1468,7 +1469,8 @@ | TaskCompletedHookInput | ConfigChangeHookInput | WorktreeCreateHookInput - | WorktreeRemoveHookInput; + | WorktreeRemoveHookInput + | MessageDisplayHookInput; ### @@ -1762,6 +1764,21 @@ type WorktreeRemoveHookInput = BaseHookInput & { hook_event_name: "WorktreeRemove"; worktree_path: string; + }; + +#### + +​ + +`MessageDisplayHookInput` + + type MessageDisplayHookInput = BaseHookInput & { + hook_event_name: "MessageDisplay"; + turn_id: string; + message_id: string; + index: number; + final: boolean; + delta: string; }; ### @@ -3586,6 +3603,7 @@ type SandboxSettings = { enabled?: boolean; + failIfUnavailable?: boolean; autoAllowBashIfSandboxed?: boolean; excludedCommands?: string[]; allowUnsandboxedCommands?: boolean; @@ -3599,6 +3617,7 @@ Property| Type| Default| Description ---|---|---|--- `enabled`| `boolean`| `false`| Enable sandbox mode for command execution +`failIfUnavailable`| `boolean`| `true`| Stop at startup if `enabled` is `true` but the sandbox can’t start. Set `false` to fall back to unsandboxed execution with a warning on stderr `autoAllowBashIfSandboxed`| `boolean`| `true`| Auto-approve bash commands when sandbox is enabled `excludedCommands`| `string[]`| `[]`| Commands that always bypass sandbox restrictions (e.g., `['docker']`). These run unsandboxed automatically without model involvement `allowUnsandboxedCommands`| `boolean`| `true`| Allow the model to request running commands outside the sandbox. When `true`, the model can set `dangerouslyDisableSandbox` in tool input, which falls back to the permissions system @@ -3607,6 +3626,8 @@ `ignoreViolations`| `Record<string, string[]>`| `undefined`| Map of violation categories to patterns to ignore (e.g., `{ file: ['/tmp/*'], network: ['localhost'] }`) `enableWeakerNestedSandbox`| `boolean`| `false`| Enable a weaker nested sandbox for compatibility `ripgrep`| `{ command: string; args?: string[] }`| `undefined`| Custom ripgrep binary configuration for sandbox environments + +The sandbox depends on platform support and, on Linux, tools like `bubblewrap` and `socat`. When `enabled` is `true` and the sandbox can’t start, `query()` reports a `result` message with `subtype: "error_during_execution"` and the reason in `errors`, then stops. Watch for that subtype rather than expecting `query()` to throw before yielding messages.To run unsandboxed instead, set `failIfUnavailable: false`. ####
modified Find bugs with ultrareview View current →
--- a/ultrareview.md +++ b/ultrareview.md @@ -4,9 +4,9 @@ > > Use this file to discover all available pages before exploring further. -Ultrareview is a research preview feature available in Claude Code v2.1.86 and later. The feature, pricing, and availability may change based on feedback. +Ultrareview is a research preview feature available in Claude Code v2.1.86 and later. The feature, pricing, and availability may change based on feedback. The command is now invoked as `/code-review ultra`, and `/ultrareview` remains as an alias. -Ultrareview is a deep code review that runs on Claude Code on the web infrastructure. When you run `/ultrareview`, Claude Code launches a fleet of reviewer agents in a remote sandbox to find bugs in your branch or pull request. Compared to a local `/review`, ultrareview offers: +Ultrareview is a deep code review that runs on Claude Code on the web infrastructure. When you run `/code-review ultra`, Claude Code launches a fleet of reviewer agents in a remote sandbox to find bugs in your branch or pull request. Compared to a local `/review`, ultrareview offers: * **Higher signal** : every reported finding is independently reproduced and verified, so the results focus on real bugs rather than style suggestions * **Broader coverage** : many reviewer agents explore the change in parallel, which surfaces issues that a single-pass review can miss @@ -22,17 +22,17 @@ Start a review from any git repository in the Claude Code CLI. - /ultrareview + /code-review ultra Without arguments, ultrareview reviews the diff between your current branch and the default branch, including any uncommitted and staged changes in your working tree. Claude Code bundles the repository state and uploads it to a remote sandbox for the review. To review a GitHub pull request instead, pass the PR number. - /ultrareview 1234 + /code-review ultra 1234 -In PR mode, the remote sandbox clones the pull request directly from GitHub rather than bundling your local working tree. PR mode requires a `github.com` remote on the repository. +In PR mode, the remote sandbox clones the pull request directly from the host rather than bundling your local working tree. PR mode works with repositories on `github.com` and on [GitHub Enterprise Server](</docs/en/github-enterprise-server>) instances that an admin has connected to Claude Code. -If your repository is too large to bundle, Claude Code prompts you to use PR mode instead. Push your branch and open a draft PR, then run `/ultrareview <PR-number>`. +If your repository is too large to bundle, Claude Code prompts you to use PR mode instead. Push your branch and open a draft PR, then run `/code-review ultra <PR-number>`. -Before launching, Claude Code shows a confirmation dialog with the review scope (including the file and line count when reviewing a branch), your remaining free runs, and the estimated cost. After you confirm, the review continues in the background and you can keep using your session. The command runs only when you invoke it with `/ultrareview`; Claude does not start an ultrareview on its own. +Before launching, Claude Code shows a confirmation dialog with the review scope (including the file and line count when reviewing a branch), your remaining free runs, and the estimated cost. After you confirm, the review continues in the background and you can keep using your session. The command runs only when you invoke it with `/code-review ultra`; Claude does not start an ultrareview on its own. ## @@ -64,7 +64,7 @@ Run ultrareview non-interactively -Use the `claude ultrareview` subcommand to start an ultrareview from CI or a script without an interactive session. The subcommand launches the same review as `/ultrareview`, blocks until the remote review finishes, prints the findings to stdout, and exits with code 0 on success or 1 on failure. +Use the `claude ultrareview` subcommand to start an ultrareview from CI or a script without an interactive session. The subcommand launches the same review as `/code-review ultra`, blocks until the remote review finishes, prints the findings to stdout, and exits with code 0 on success or 1 on failure. claude ultrareview claude ultrareview 1234 @@ -77,7 +77,7 @@ `--json`| Print the raw `bugs.json` payload instead of the formatted findings `--timeout <minutes>`| Maximum minutes to wait for the review to finish. Defaults to 30 -Running `claude ultrareview` requires the same authentication and usage credit configuration as `/ultrareview`. The subcommand exits with code 0 when the review completes with or without findings, code 1 when the review fails to launch, the remote session errors, or the timeout elapses, and code 130 when interrupted with Ctrl-C. The remote review keeps running if you interrupt the subcommand; follow the session URL printed to stderr to watch it in the browser. For automatic reviews on GitHub pull requests, [Code Review](</docs/en/code-review>) integrates with your repository directly and posts findings as inline PR comments without a CLI step. +Running `claude ultrareview` requires the same authentication and usage credit configuration as `/code-review ultra`. The subcommand exits with code 0 when the review completes with or without findings, code 1 when the review fails to launch, the remote session errors, or the timeout elapses, and code 130 when interrupted with Ctrl-C. The remote review keeps running if you interrupt the subcommand; follow the session URL printed to stderr to watch it in the browser. For automatic reviews on GitHub pull requests, [Code Review](</docs/en/code-review>) integrates with your repository directly and posts findings as inline PR comments without a CLI step. ## @@ -87,7 +87,7 @@ Both commands review code, but they target different stages of your workflow. -| `/review`| `/ultrareview` +| `/review`| `/code-review ultra` ---|---|--- Runs| locally in your session| remotely in a cloud sandbox Depth| single-pass review| multi-agent fleet with independent verification @@ -95,7 +95,7 @@ Cost| counts toward normal usage| free runs, then roughly $5 to $20 per review as usage credits Best for| quick feedback while iterating| pre-merge confidence on substantial changes -Use `/review` for fast feedback as you work. Use `/ultrareview` before merging a substantial change when you want a deeper pass that catches issues a single review might miss. +Use `/review` for fast feedback as you work. Use `/code-review ultra` before merging a substantial change when you want a deeper pass that catches issues a single review might miss. ##
removed desktop-changelog View current →
Show diff (121 lines)
--- a/desktop-changelog.md +++ b/desktop-changelog.md @@ -1,118 +0,0 @@ -> ## Documentation Index -> -> Fetch the complete documentation index at: <https://code.claude.com/docs/llms.txt> -> -> Use this file to discover all available pages before exploring further. - -This page covers Claude Code-specific changes in the Desktop app. For changes to the Claude Code CLI bundled inside the app, see the [CLI changelog](</docs/en/changelog>). - -​ - -1.7196.0 - -May 12, 2026 - - * Fixed auto-update hanging indefinitely on Relaunch to Update when popout windows refused to close. - * Fixed local sessions failing to start after a corrupted bundled Claude Code binary was cached. - * Fixed the credential helper opening duplicate browser sign-in tabs when starting a new conversation. - * Fixed Code tab PR status icons showing the wrong state for merged, merge-queued, and draft pull requests. - * Fixed Quick Entry dropping characters entered with a Korean, Japanese, or Chinese input method. - * Added an “Also delete files on disk” option to the scheduled task delete dialog; checking it removes the task’s `SKILL.md` file and associated data from `~/.claude/scheduled-tasks/`. - * Added support for mouse back and forward buttons for navigating the chat view. - -**3P managed deployments** - - * Added an organization banner across the top of the app window, configured by IT administrators. - -​ - -1.6889.0 - -May 8, 2026 - - * Added MCP App widget rendering in Code tab sessions. - * Added an OS notification when a Code session finishes a task and you aren’t currently viewing it. - * Added automatic detection and re-download of corrupted Claude Code CLI binaries on macOS. - * Added support for scheduled tasks to modify their own schedule or prompt during a run using the `update_scheduled_task` MCP tool. - * Updated the list of available MCP tools to reload automatically when the local MCP configuration changes. - * Updated PR auto-fix to post a reply on each review thread it addresses and mark the thread resolved. - * Improved SSH session startup speed by preconnecting saved SSH configurations at app launch. - * Fixed pasting a code block into a busy terminal; the app now opens a new terminal tab when the existing one has a process running. - * Fixed PR bar issues in Code sessions: each row now shows its own diff, and the sidebar status icon updates when a PR is merged. - * Fixed garbled scrollback, such as stray `%` marks and half-wrapped prompts, when opening the terminal pane after running a code block. - * Fixed Code session links opening with overlapping window controls when reached via Handoff or share links. - * Fixed git commit signing failing in local sessions when the signing key is held by 1Password or Secretive. - * Fixed locally installed plugins disappearing from sessions after the plugin registry file became corrupted by concurrent writes. - * Fixed scheduled tasks running with auto-approve echoing tool-use suggestions into the session. - * Fixed SSH plugin sync so a single problematic plugin no longer blocks sync for the rest. - -**3P managed deployments** - - * Added support for stdio-transport local MCP servers via the `managedMcpServers` managed-settings key; the connector detail panel now shows the command and arguments, and environment variable values are masked outside the admin Setup screen. - * Added a managed-settings option to disable `claude://` deep-link handling. - * Added support for customizing model display names in the model picker via `labelOverride`. - * Fixed per-tool MCP server policies set by administrators not being enforced in all session types. - -​ - -1.6608.0 - -May 7, 2026 - - * Fixed scheduled tasks failing to run when a previous run was stuck waiting on a permission prompt. - * Fixed scheduled tasks repeatedly retrying a failed run instead of waiting for the next scheduled time. - * Fixed scheduled-task history incorrectly showing “computer asleep” for runs skipped due to a concurrency limit. - * Added per-plugin auto-install for organization-provisioned plugins via the plugin manifest. - * Added Unarchive to the Code session context menu; sending a message in an archived session now restores it automatically. - * Added a warning when archiving a Code session that has uncommitted changes in its worktree. - * Added a warning when quitting or restarting the app while local Code sessions are running. - * Added csh and tcsh login shell support when connecting to remote SSH hosts. - * Fixed folder permission rules failing to match when the connected folder is a drive root. - * Fixed Windows installs leaving an empty folder under `%LOCALAPPDATA%`. - -​ - -1.6259.0 - -May 5, 2026 - - * Code sessions now default the working directory to the home folder when none is configured. - * `settings.json` project settings now cascade from the SSH host for SSH Code sessions. - * “Always allow” tool permissions now persist across app restarts and display their scope. - * Added automatic detection and re-download of corrupted Claude Code CLI binaries on Windows. - * The PR bar now shows stacked and sibling pull requests alongside the branch’s own PR. - * Messages sent while a turn is running are now queued rather than dropped. - * Opening a Code session link on iOS now continues the session on macOS via Handoff. - -​ - -1.5354.0 - -April 29, 2026 - - * Disabling the org Skills toggle in the admin console now removes the skill management tools `list_skills`, `save_skill`, and `propose_skills` from Code sessions. - * The preview pane now opens automatically when a session’s working directory is a symlink. - * Improved login-shell PATH extraction for more reliable tool discovery. - -​ - -1.5220.0 - -April 28, 2026 - - * Added a multi-tab terminal pane; click **+** in the terminal pane header to open a second tab, or right-click a folder in the chat to choose **Open in terminal**. - * Fixed worktree pool re-lease creating a fresh worktree on checkout failure instead of re-using an existing one. - * Fixed rewind selecting the wrong assistant message after a previous rewind created a fork. - -​ - -1.5186.0 - -April 28, 2026 - - * Added `list_sessions`, `search_session_transcripts`, and `archive_session` MCP tools for managing Code sessions from within a session. - * Improved SSH wake-path reliability and surfaced `ProxyCommand` stderr output for easier debugging. - * Fixed login-shell PATH extraction for fish shell users. It was returning a newline-separated list instead of a colon-separated one. - * Fixed the SSH remote control socket directory permissions so `~/.claude/remote` is no longer world-traversable. - * PR review bodies and issue comments are now forwarded to the auto-fix engine. - * Added a category-driven error UI for Code sessions that groups failures by type and surfaces actionable recovery steps.