modified Manage mods for your organization View current →
--- a/admin.md +++ b/admin.md @@ -425,4 +425,4 @@ * [Plugin security](</docs/en/plugins/security>): what any plugin can do on a user’s machine, and how to review one before it’s installed * [Mods overview](</docs/en/plugins/mods/overview>): what a mod is and how it compares to hooks, skills, and MCP servers * [The order mods run in](</docs/en/plugins/mods/events#the-order-mods-run-in>): how `prependPlugins` and `appendPlugins` fit with users’ mods - * [Settings and environment variables](</docs/en/plugins/mods/reference#settings-and-environment-variables>): every setting named on this page in one table + * [Settings reference](</docs/en/settings-reference>): scope, type, and default for each settings key
modified Set up Claude Code for your organization View current →
--- a/admin-setup.md +++ b/admin-setup.md @@ -93,6 +93,7 @@ * **Cloud environments page** : Owners create [organization-shared environments](</docs/en/cloud-environments#organization-shared-environments>) that set the [network access level](</docs/en/cloud-environments#network-access>), environment variables, and setup script for members’ cloud sessions. * **Default environment** : Owners choose the organization’s default environment separately, at [claude.ai/admin-settings/claude-code](<https://claude.ai/admin-settings/claude-code>). * **Git providers page** : see Connected GitHub accounts for the GitHub accounts linked to your organization. + * **Projects page** : Owners [turn Projects on or off](</docs/en/claude-projects#turn-projects-on-for-your-organization>) for the organization. Permission rules and sandboxing cover different layers. Denying WebFetch blocks Claude’s fetch tool, but if Bash is allowed, `curl` and `wget` can still reach any URL. Sandboxing closes that gap with a network domain allowlist enforced at the OS level. For the threat model these controls defend against, see [Security](</docs/en/security>).
modified Run agents in parallel View current →
--- a/agents.md +++ b/agents.md @@ -5,7 +5,7 @@ [Subagents](</docs/en/sub-agents>)| Delegated workers inside one session that do a side task in their own context and return a summary| A side task would flood your main conversation with search results, logs, or file contents you won’t reference again [Agent view](</docs/en/agent-view>)| One screen to dispatch and monitor sessions running in the background, opened with `claude agents`. Research preview| You have several independent tasks and want to hand them off, check status at a glance, and step in only when one needs you [Agent teams](</docs/en/agent-teams>)| Multiple coordinated sessions with a shared task list and inter-agent messaging, managed by a lead. Experimental and disabled by default| You want Claude to split a project into pieces, assign them, and keep the workers in sync -[Projects](</docs/en/claude-projects>)| One ongoing conversation at claude.ai/code or in the desktop app. Claude starts parallel sessions called threads, in the cloud or, when you ask, on your computer through Remote Control. It gives each one the project’s instructions and shows you which ones need you. Public beta on Pro, Max, and Ultra| The work spans many tasks over days or weeks, should keep running when your machine is off, and you’d rather describe it once than dispatch and track each session +[Projects](</docs/en/claude-projects>)| One ongoing conversation at claude.ai/code or in the desktop app. Claude starts parallel sessions called threads, gives each one the project’s instructions, and shows you which ones need you. Threads run in the cloud, or on your computer through Remote Control when you ask. Public beta on Pro, Max, Ultra, Team, and Enterprise| The work spans many tasks over days or weeks, should keep running when your machine is off, and you’d rather describe it once than dispatch and track each session [Dynamic workflows](</docs/en/workflows>)| A script that runs many subagents and cross-checks their results, for work too big to coordinate one turn at a time or that needs more than a single pass| A job outgrows a handful of subagents, or you want findings verified against each other: a codebase-wide audit, a 500-file migration, cross-checked research, or a plan drafted from several angles In every approach the workers are Claude sessions. To involve a different tool, expose it to Claude as an [MCP server](</docs/en/mcp>). Three more tools support this work without being a way to run agents themselves:
modified Use the mods API View current →
--- a/api.md +++ b/api.md @@ -1,8 +1,8 @@ -The mods API is the set of methods a mod calls to act: add commands and tools, call a model, run work between events, and reach the file system, processes, and the network. Every hook receives it as its first argument, `$`, with the methods grouped in namespaces such as `$.ui` and `$.fs`. [Events](</docs/en/plugins/mods/events>) decide when a hook runs, and the mods API is what the hook calls once it does. Build your [first mod](</docs/en/plugins/mods/create>) before you start here. For every method, see [mods API methods](</docs/en/plugins/mods/reference#mods-api-methods>) or read [the types for your build](</docs/en/plugins/mods/create#get-the-types-for-your-build>). +The mods API is the set of methods a mod calls to act: add commands and tools, call a model, run work between events, and reach the file system, processes, and the network. Every hook receives it as its first argument, `$`, with the methods grouped in namespaces such as `$.ui` and `$.fs`. [Events](</docs/en/plugins/mods/events>) decide when a hook runs, and the mods API is what the hook calls once it does. Build your [first mod](</docs/en/plugins/mods/create>) before you start here. For every method, see the [type declarations](</docs/en/plugins/mods/reference#look-up>). ## Add a command or a tool -A mod can add a command for the user to run and a tool for Claude to call. Register both in a [`session.start`](</docs/en/plugins/mods/reference#session>) hook. Claude Code waits for that hook before the first prompt, so what you register is available from the first turn. +A mod can add a command for the user to run and a tool for Claude to call. Register both in a `session.start` hook. Claude Code waits for that hook before the first prompt, so what you register is available from the first turn. ### Add a command @@ -202,7 +202,7 @@ ### Stop background work -Timers stop after the module reloads. For long-running work inside a hook, [`next.signal`](</docs/en/plugins/mods/reference#the-hook-function>) is an `AbortSignal` that aborts when the event your hook is handling is abandoned, for example when the user interrupts. Pass it to anything long-running. +Timers stop after the module reloads. For long-running work inside a hook, `next.signal` is an `AbortSignal` that aborts when the event your hook is handling is abandoned, for example when the user interrupts. Pass it to anything long-running. ### Calls and background work after the user interrupts a turn @@ -377,4 +377,4 @@ * [React to events](</docs/en/plugins/mods/events>): hook tool calls, prompts, and turns * [Draw in the interface](</docs/en/plugins/mods/interface>): show what your mod collects in a pane or above the prompt * [Test a mod](</docs/en/plugins/mods/test>): stub any of these calls in a test - * [Mods reference](</docs/en/plugins/mods/reference>): events, mods API methods, and limits + * [Mods reference](</docs/en/plugins/mods/reference>): where to look up a method, and the limits
modified Let Claude coordinate ongoing work with Projects View current →
Show diff (393 lines)
--- a/claude-projects.md +++ b/claude-projects.md @@ -1,12 +1,22 @@ -Projects are in public beta on Pro, Max, and Ultra plans and rolling out gradually. The rollout started with accounts that have used [cloud sessions](</docs/en/claude-code-on-the-web>) and don’t have existing projects in claude.ai chat or Cowork. Projects aren’t offered on Team or Enterprise plans yet.If you don’t see **Projects** in the sidebar at [claude.ai/code](<https://claude.ai/code>) or in the Code tab of the [desktop app](</docs/en/desktop>), check under **More** there. If it’s missing there too, the rollout hasn’t reached your account yet. You can [join the waitlist](<https://claude.com/form/projects>), and see [Run agents in parallel](</docs/en/agents>) for what you can use in the meantime. - -A project is one ongoing conversation where Claude coordinates a stream of related work for you. You tell it what needs doing and it starts a thread for each task. Each thread is usually a [cloud session](</docs/en/claude-code-on-the-web>): Claude Code running in the cloud rather than on your machine. When a task needs something only your computer has, you can ask Claude to run that thread on your computer instead of in the cloud, through [Remote Control](</docs/en/remote-control>). Threads run in parallel, and you can check on them and steer them from your phone. Cloud threads keep going after you close your laptop, while a thread on your computer runs only while that computer is awake. Without a project, running several sessions means doing the coordinating yourself: you decide what each one works on, repeat the same background at the start of each, and check back to see which finished or needs an answer. With a project, you instead: - - * **Send work to one place** : paste a bug report, a stack trace, or a list of tasks into the conversation whenever one comes up. Claude starts a thread for each piece of work or passes it to the thread already working in that area, and answers quick questions in place. +Projects are in public beta on Pro, Max, Ultra, Team, and Enterprise plans. Look for the **Projects** item in the sidebar at [claude.ai/code](<https://claude.ai/code>) or in the Code tab of the [desktop app](</docs/en/desktop>). If you don’t see it there, open the **More** menu. + + * **Pro, Max, and Ultra** : Projects are rolling out gradually. If you don’t see the **Projects** item, [join the waitlist](<https://claude.com/form/projects>). + * **Team and Enterprise** : if you don’t see the **Projects** item, ask an [Owner](</docs/en/server-managed-settings#access-control>) to turn Projects on. If you see “Project coordinator is off for your organization” or “Projects aren’t available to you right now”, do the same. If you’re on a custom role, ask the Owner to check the permissions your role needs. + * **Enterprise Standard and Chat seats** : select **Projects** in the sidebar at [claude.ai](<https://claude.ai>). Your seat doesn’t include Claude Code, so the Code tab isn’t available to you. + +To run work in parallel without Projects, see [Run agents in parallel](</docs/en/agents>). + +A project is one ongoing conversation where Claude coordinates a stream of related work for you. You tell it what needs doing and it starts a thread for each task. Threads run in parallel, and you can check on them and steer them from your phone. Each one is a [cloud session](</docs/en/claude-code-on-the-web>) unless you let Claude run it on your computer. Cloud threads keep going after you close your laptop. + +## What you can do with a project + +If you already know the work you want a project to run, go straight to Create a project. With a project, you send work to Claude as it comes up and check back on the results: + + * **Send work to one place** : paste a bug report, a stack trace, or a list of tasks into the project conversation whenever one comes up. Claude starts a thread for each piece of work or passes it to the thread already working in that area, and answers quick questions in place. * **Set context once** : every new thread starts with the project’s instructions, so a rule you state once, such as which branch to target, reaches all of them. * **Walk away and come back to finished work** : the Overview pane shows which threads finished, which pull requests are ready for review, and which thread is waiting for your answer. -If you already know the work you want a project to run, go straight to Create a project. +Projects you already use in claude.ai chat or Cowork are classic projects, an earlier kind of project that groups conversations and reference files but has no threads. ## When to use a project @@ -34,7 +44,7 @@ A project is one coordinating conversation with Claude plus the threads it starts to do the work. These are its parts: - * **The project conversation** : one long-running session where Claude acts as coordinator. It takes what you send, decides what becomes a thread, and keeps track of every thread it started. It sees what threads report back, not every step they take. + * **The project conversation** : one long-running session where Claude acts as the Project coordinator. In that role, Claude takes what you send, decides what becomes a thread, and keeps track of every thread it started. It sees what threads report back, not every step they take. * **Threads** : the workers. Each is a separate session with its own context window that does one piece of work and reports back to the conversation when it finishes. A cloud thread works on its own branch and opens a pull request when the work calls for one. * **What every cloud thread starts with** : * The project’s repositories and files, plus its instructions and memory @@ -50,16 +60,18 @@ You create and use projects at [claude.ai/code](<https://claude.ai/code>), in the Code tab of the desktop app, or in the Claude mobile app for [iOS](<https://apps.apple.com/us/app/claude-by-anthropic/id6473753684>) and [Android](<https://play.google.com/store/apps/details?id=com.anthropic.claude>). In the browser and the desktop app there are two ways to start a project: * **From scratch** , when you know the stream of work you want Claude to run: open the **New project** dialog and name it. Start a new project from scratch walks through the dialog. - * **From a cloud session that’s already doing the work** : in that session’s sidebar menu, choose **Continue in project** , then **Continue as new project**. Claude proposes the project’s setup from what the session was doing. See Start from an existing cloud session. + * **From a cloud session that’s already doing the work** : on a Pro, Max, or Ultra plan, open that session’s sidebar menu and choose **Continue in project** , then **Continue as new project**. Claude proposes the project’s setup from what the session was doing. See Start from an existing cloud session. Either way, check the prerequisites first. -### Check the prerequisites +### Prerequisites Before you create a project, check your plan, your GitHub setup, and what the work needs to reach: - * **Plan** : you’re on Pro, Max, or Ultra, and **Projects** shows in your sidebar, directly or under **More**. Select **Projects** and check that it offers **New project**. - * **GitHub, if the project will work on code** : your code is on github.com rather than GitHub Enterprise Server, GitLab, or Bitbucket, your connected GitHub account has push access to it, and the Claude GitHub App is installed on it. If you connected GitHub with [`/web-setup`](</docs/en/web-quickstart#connect-from-your-terminal>), that token lets your other cloud sessions reach a repository but isn’t enough for a project’s cloud threads, which need the Claude GitHub App. Set up GitHub access has the steps. + * **Plan** : you’re on a Pro, Max, Ultra, or Team plan, or you have an Enterprise seat other than **Lite**. Then check that you see a **New project** button: + * **Pro, Max, and Ultra** : at claude.ai/code or in the desktop app’s Code tab, select **Projects** in the sidebar and look for the button. If you don’t see the **Projects** item there or in the sidebar’s **More** menu, [join the waitlist](<https://claude.com/form/projects>). + * **Team and Enterprise** : an Owner has to turn Projects on for your organization first. On the **Projects** page in claude.ai chat or Cowork, a **New project** button isn’t a sign that Projects are on, because it also creates classic projects. To check, open [claude.ai/code/projects/browse](<https://claude.ai/code/projects/browse>) in a browser. That page opens on Enterprise **Standard** and **Chat** seats too. If you don’t see the **New project** button there, ask an Owner. + * **GitHub, if the project will work on code** : your code is on github.com rather than GitHub Enterprise Server, GitLab, or Bitbucket. Your connected GitHub account has push access to the repository, and the Claude GitHub App is installed on it. Set up GitHub access has the steps. * **Network access, secrets, and tools** : for cloud threads, these come from the project’s cloud environment. The default environment already reaches [common package registries](</docs/en/cloud-environments#default-allowed-domains>), so check this only if the work needs other domains, a secret, or a tool that isn’t preinstalled. If the work needs an MCP server, check that it shows as connected in your [claude.ai connectors](<https://claude.ai/customize/connectors>). ### Start a new project from scratch @@ -70,7 +82,7 @@ Open Projects -At [claude.ai/code](<https://claude.ai/code>) or in the Code tab of the desktop app, select **Projects** in the left sidebar, or under **More** there. In a browser you can also go straight to [claude.ai/code/projects/browse](<https://claude.ai/code/projects/browse>). Then select **New project**. +At [claude.ai/code](<https://claude.ai/code>) or in the Code tab of the desktop app, select **Projects** in the left sidebar. If you don’t see it there, open the **More** menu and select **Projects**. In a browser you can also go straight to [claude.ai/code/projects/browse](<https://claude.ai/code/projects/browse>). Then select **New project**. 2 @@ -81,6 +93,7 @@ * **Name** : how the project appears in the **Projects** list. * **What do you want to work on?** (optional): one line that becomes the project’s goal, such as “Hold p95 API latency under 200 ms”. Claude in the conversation works toward it. Without a goal, Claude works from the tasks you send, and you can add a goal later in **Project settings > General**. * **Context** (optional): the GitHub repositories this project works on, plus any files, folders, or Google Drive folders threads should read. Click **+** for each. Add the repositories most tasks need rather than every one the work might touch; Decide which repositories to add covers the choice, and you can add more later in **Project settings > Environment**. + * **Project coordinator** : if you see this toggle, leave it on. If you turn it off, you create a classic project. Standing rules for how threads should work go in project instructions, which you set after the project exists. @@ -90,24 +103,29 @@ Click **Create project**. The project’s conversation opens with a message box at the bottom, where you describe work for Claude.On your first project, Claude takes a turn of its own as soon as the project is created, unless you send a message first. That turn uses your plan. In it, Claude may: - * Start one thread that explores the repository without changing anything and proposes next steps, if the project has a repository it can read. - * Post **Setup recommendations** drawn from your recent cloud sessions: repositories to add, scheduled tasks to create, and threads it could start. Every recommended repository and scheduled task starts switched on. Switch off the ones you don’t want, then click **Update setup** to add the rest, or ignore the recommendations and describe work yourself. + * Start one thread that explores the repository and proposes next steps, if the project has a repository it can read. + * Post **Setup recommendations** : repositories to add, scheduled tasks to create, and threads it could start. Each recommended repository and scheduled task is on by default. Turn off the ones you don’t want, then click **Update setup** to add the rest, or ignore the recommendations and describe work yourself. The project is now in the sidebar, and its conversation is open. Your first batch covers what to set up before you send it work. ### Start from an existing session -If a cloud session you started yourself is doing work that belongs in a project, open its sidebar menu and choose **Continue in project** , then pick from the submenu: +On Team and Enterprise plans, you don’t see a **Continue in project** option in a session’s sidebar menu. Bring the session’s work into a project yourself instead. If a cloud session you started yourself is doing work that belongs in a project, open its sidebar menu and choose **Continue in project** , then pick from the submenu: * Choose **Continue as new project** to create a new project from the session. The project opens, and Claude reads the session and posts **Setup recommendations** in the project conversation for you to confirm. The original session stays in your session list. If it was in the middle of a turn it keeps running, so stop it yourself if you don’t want both working at once. * Choose one of your existing projects to bring the session’s work into that project. That project opens, and a message sent on your behalf asks Claude to read the session and pick up where it left off. The original session stays in your session list, unchanged. -A **Set up project** banner can also appear above a cloud session’s message box. If you use it instead of **Continue as new project** , the result is the same, except that the session’s running turn stops once the project opens. A session on your own machine gets the same sidebar menu at claude.ai/code once you connect it through [Remote Control](</docs/en/remote-control#start-a-remote-control-session>). From a project, Claude can’t read the transcript of a session that connected while [**Require trusted devices**](</docs/en/remote-control#trusted-devices>) was on for your account. If that setting is off: +A session on your own machine gets the same sidebar menu at claude.ai/code once you connect it through [Remote Control](</docs/en/remote-control#start-a-remote-control-session>). From a project, Claude can’t read the transcript of a session that connected while the [**Require trusted devices**](</docs/en/remote-control#trusted-devices>) setting was on for your account. If that setting is off: 1. If the session isn’t connected yet, run `/remote-control` in it. If it connected while that setting was on, disconnect it and connect it again first. 2. In a browser, find the session’s row in the sidebar at [claude.ai/code](<https://claude.ai/code>), open its menu, and pick from the same submenu. -If **Require trusted devices** is on, or you don’t use Remote Control, describe the work in the project conversation yourself. Or push the session’s branch, add its repository to the project, and tell Claude the branch name. +#### Bring a session’s work into a project yourself + +If you don’t see the **Continue in project** option in a session’s sidebar menu, start a project from scratch or open an existing one. Then either describe the session’s work in the project conversation, or push the session’s branch, add its repository to the project, and tell Claude the branch name. Do the same for a session on your own machine if: + + * The [**Require trusted devices**](</docs/en/remote-control#trusted-devices>) setting is on for your account. + * You don’t use Remote Control. ### Set up GitHub access @@ -143,7 +161,7 @@ 1. Write project instructions: the brief every thread starts from, such as which branch to target, how a thread checks its work, and what needs your go-ahead. 2. Send one small piece of the real work, or start one of the threads Claude suggested if it offered any, and open the thread when it finishes to see how it reports back and what it did on its branch. If it assumed something wrong or couldn’t reach what it needed, Threads guessed or stalled instead of asking covers where to fix that. - 3. Check **Threads** in **Project settings > General**, which sets the model and effort for new threads. A new project runs every thread on Opus at medium effort; Choose models and let Claude manage context covers the alternatives. + 3. Check the model and effort for new threads in the **Threads** setting in **Project settings > General**. To use a different model for one task or thread, see Choose models and let Claude manage context. 4. Ask Claude to propose threads before starting them and to run a few at a time, and drop those limits once a few threads come back the way you want. ### Send work and read results @@ -175,7 +193,7 @@ **Ready for review**| Threads whose pull request is open and awaiting review **Waiting on you**| Threads that need your reply or approval, or that failed **Working**| Threads still running -**Landing**| Threads whose pull request is approved or queued to merge +**Landing**| Threads whose pull request is queued to merge, or approved with auto-merge on **Idle**| Threads that finished and aren’t waiting on anything **Resolved**| Threads marked done: by you from the thread’s menu, by Claude once you’ve taken the last step, such as merging its pull request, or automatically after a week with no activity. You can reopen one from the same menu @@ -195,12 +213,12 @@ ### Choose models and let Claude manage context -Set models and thread effort in **Project settings > General**. A new project runs Opus everywhere, with medium [effort](</docs/en/model-config#adjust-effort-level>) for threads and low effort for the conversation: - - * **Threads** sets the model and effort for new threads. To use a different model for one task, ask for it in the task; for a thread already running, use that thread’s model picker. - * **Coordinator** sets the model for Claude in the project conversation. - -You don’t manage context windows in a project. Threads compact automatically, and the conversation works from recent messages, recent threads, and project memory rather than its full history, so it keeps going for as long as the project runs. Put anything that must never be dropped in project memory. If one thread outgrows its context, it shows Claude ran out of context on this turn. +Set the model and [effort level](</docs/en/model-config#adjust-effort-level>) for new threads, and the model for the project conversation, in **Project settings > General**: + + * **Threads** : the model and effort for new threads. To use a different model for one task, ask for it in the task; for a thread already running, use that thread’s model picker. + * **Coordinator** : the model for Claude in the project conversation. + +You don’t manage context windows in a project. Threads compact automatically, and the conversation works from recent messages, recent threads, and project memory rather than its full history. Put anything Claude should remember in project memory. If one thread outgrows its context, it shows Claude ran out of context on this turn. ### Tune how Claude runs a project @@ -219,21 +237,23 @@ ### Unblock a thread waiting on approval -Threads run in [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) when the thread’s model supports it, so most tool calls run without asking you. When a thread needs your approval, the prompt is inside that thread and the thread waits until you answer it there. Telling Claude in the project conversation to go ahead doesn’t reach it. Each approval covers that prompt, or the rest of that thread if you choose the broader option. Cloud threads don’t read [permission rules](</docs/en/permissions>) from a repository’s `.claude/settings.json`, so you rely on auto mode and on the approvals you give inside each thread. +When a thread needs your approval, the prompt is inside that thread and the thread waits until you answer it there. If you tell Claude in the project conversation to proceed, the thread keeps waiting. Threads run in [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) when it’s available, so most tool calls run without asking you. Cloud threads don’t read [permission rules](</docs/en/permissions>) from a repository’s `.claude/settings.json`, so you rely on auto mode and on the approvals you give inside each thread. ### Run a thread on your own computer -When a task needs something only your computer has, such as a local database, a device emulator, or an API behind your VPN, ask Claude to run the thread for that task on your computer instead of in the cloud. When you ask in the project conversation, the thread is a Claude Code session in a folder on your machine, connected through [Remote Control](</docs/en/remote-control>). The project’s other threads keep running in the cloud. Compared with a cloud thread, a thread on your computer: +Some tasks need something only your computer has, such as a local database, a device emulator, or an API behind your VPN. For a task like that, ask Claude to run its thread on your computer instead of in the cloud. That thread is a Claude Code session in a folder on your computer, connected through [Remote Control](</docs/en/remote-control>). Compared with a cloud thread, a thread on your computer: * Works with the files, tools, MCP servers, and Claude Code settings on that machine, including its hooks and permission rules, instead of the project’s cloud environment * Starts with the project’s instructions, but not with its memory files loaded * Runs only while that computer is awake with Remote Control turned on +On Team and Enterprise plans, an Owner needs to [turn on Remote Control for the organization](</docs/en/remote-control#requirements>) first. + 1 Connect the folder -On the computer that has the folder the task needs, make it available through Remote Control in one of two ways. Both need Claude Code v2.1.280 or later on that computer. +On the computer that has the folder the task needs, make it available through Remote Control in one of two ways. Both need Claude Code v2.1.302 or later on that computer. * **In the Claude desktop app** : open **Settings > Code** or **Settings > Claude Code** and turn on **Let your phone and claude.ai start sessions here**. Add the folder to the list under that switch. Threads can run on this computer while the app is open. * **In a terminal** : run `claude remote-control` in the folder and leave it running. In a git repository, add `--spawn worktree` to give each thread there its own [worktree](</docs/en/worktrees>) instead of the folder itself. @@ -242,7 +262,7 @@ Ask for the task -In the project conversation, choose **Work locally** from the **+** menu, or **Work in a local folder** in the desktop app, and write what you want done. Saying in the message that the task should run on your computer works too.If **Work locally** is greyed out with a note about trusted devices, [**Require trusted devices**](</docs/en/remote-control#trusted-devices>) is on for your account and this project can’t run a thread on your computer. To work in that folder, run Claude Code on that computer directly. +In the project conversation, choose **Work locally** from the **+** menu, or **Work in a local folder** in the desktop app, and write what you want done. Saying in the message that the task should run on your computer works too. 3 @@ -295,7 +315,7 @@ * **Add it to the project** , in the **New project** dialog, in **Project settings > Environment**, or by asking Claude in the conversation to add it to the project. Every cloud thread from then on clones it and starts with its `CLAUDE.md` loaded, whether or not the task touches it. * **Leave it off and let threads add it when needed.** A cloud thread whose task needs a repository the project doesn’t have can add it to itself, and a note in the thread says it was added to this thread only. The clone happens partway through the task, so that repository’s `CLAUDE.md` wasn’t there when the thread started. The next thread starts without it. A repository added this way needs the same prerequisites as a project repository: the Claude GitHub App installed on it and push access from your GitHub account. -A project doesn’t need a repository at all. Its cloud threads can still research, write documents, and write and run code in their own sandbox. They deliver files to the project’s **Context** tab. Any of its cloud threads can still add a repository to itself when a task calls for one. Once the project has repositories, Claude can only add repositories from a GitHub owner the project already uses, whether it adds one to the project or a thread adds one to itself. To bring in a repository from a different owner, add it to the project yourself in **Project settings > Environment**. For a project that spans many repositories, such as one feature with server, web, mobile, and desktop code, add the one or two repositories nearly every task touches and name the others in project instructions so Claude knows where the rest of the code lives. Cloud threads then start small and pull in the other repositories only for the tasks that need them. +A project doesn’t need a repository at all. Its cloud threads can still research, write documents, and write and run code in their own sandbox. They deliver files to the project’s **Context** tab. Any of its cloud threads can still add a repository to itself when a task calls for one. For a project that spans many repositories, such as one feature with server, web, mobile, and desktop code, add the one or two repositories nearly every task touches and name the others in project instructions so Claude knows where the rest of the code lives. Cloud threads then start small and pull in the other repositories only for the tasks that need them. ### Add files and folders @@ -328,7 +348,7 @@ ### Choose an environment for threads -Every new cloud thread starts in the project’s [cloud environment](</docs/en/cloud-environments>). The environment sets which domains threads can reach, which environment variables they have, which network secrets are added to their requests, and what the setup script installs before Claude starts. Cloud threads use a default Anthropic-hosted environment until you pick one in **Project settings > Environment**. If cloud threads need to reach an internal API or a private package registry, or need a token your machine normally holds, change the environment rather than the project: see [Network access](</docs/en/cloud-environments#network-access>), [Add network secrets](</docs/en/cloud-environments#add-network-secrets>), and [Setup scripts](</docs/en/cloud-environments#setup-scripts>). +Every new cloud thread starts in the project’s [cloud environment](</docs/en/cloud-environments>). The environment sets which domains threads can reach, which environment variables they have, which network secrets are added to their requests, and what the setup script installs before Claude starts. Cloud threads use a default environment until you pick one in **Project settings > Environment**. If cloud threads need to reach an internal API or a private package registry, or need a token your machine normally holds, change the environment rather than the project: see [Network access](</docs/en/cloud-environments#network-access>), [Add network secrets](</docs/en/cloud-environments#add-network-secrets>), and [Setup scripts](</docs/en/cloud-environments#setup-scripts>). ### Get skills, plugins, connectors, and tools into threads @@ -336,7 +356,7 @@ * Skills: enable them for your claude.ai account, and cloud threads load the [skills you enable there](</docs/en/skills#skills-in-cowork-and-cloud-sessions>), apart from [some threads in a self-hosted environment](</docs/en/self-hosted-environments-configuration#how-each-session%E2%80%99s-config-is-assembled>). For skills committed to a repository, see What threads pick up from your repositories. * Plugins: enable them for your claude.ai account at [claude.ai/customize/plugins](<https://claude.ai/customize/plugins>), and the cloud threads that Claude starts load them. - * MCP servers: cloud threads get their MCP tools from the connectors on your claude.ai account, which are MCP servers you connect once at [claude.ai/customize/connectors](<https://claude.ai/customize/connectors>). Every cloud thread can use all of them with no per-project setup. The project conversation itself has no connectors, so send work that needs one as a task for a cloud thread. [How connectors reach Claude Code](</docs/en/mcp#how-connectors-reach-claude-code>) lists the rules for cloud sessions and the settings that turn connectors off. + * MCP servers: cloud threads get their MCP tools from the connectors on your claude.ai account, which are MCP servers you connect once at [claude.ai/customize/connectors](<https://claude.ai/customize/connectors>). Every cloud thread can use all of them with no per-project setup. [How connectors reach Claude Code](</docs/en/mcp#how-connectors-reach-claude-code>) lists the rules for cloud sessions and the settings that turn connectors off. * Command-line tools and packages: install them in the environment’s [setup script](</docs/en/cloud-environments#setup-scripts>). To see which connectors a running cloud thread has at claude.ai/code, open the thread and select **Connectors** from the **+** menu beside its message box. Turning a connector off there removes it from that thread and saves that as your account default, so new threads and claude.ai chats start without it until you turn it back on. A cloud thread picks up a connector you add or reconnect after the next message you send it. @@ -364,29 +384,97 @@ **Pause** is in **Project settings > Advanced**. **Archive** and **Delete** are at the bottom of **General** : - * **Pause** : stops everything at once. Every running thread and the conversation are interrupted, no new threads start, scheduled tasks don’t run, and the project doesn’t accept messages until you resume it. Click **Resume** in the same place or on the banner above the project’s message box; a paused thread continues when you send it a message after that. - * **Archive** : hides the project from the sidebar and archives its threads, which stops any thread that was running or watching a pull request. Scheduled tasks in the project don’t run while it’s archived. To bring the project back, open it from the Projects page and click **Unarchive**. Its threads stay archived until you unarchive them individually from the session list. + * **Pause** : interrupts the project conversation and every running cloud thread, and blocks new threads, scheduled task runs, and messages until you resume it. Click **Resume** in the same place or on the banner that replaces the project’s message box; a paused thread continues when you send it a message after that. + * **Archive** : hides the project from the sidebar and archives its cloud threads, which stops any that were running or watching a pull request. Scheduled tasks in the project don’t run while it’s archived. To bring the project back, open it from the Projects page and click **Unarchive** , then tell Claude in the project conversation which work to pick up. * **Delete** : permanently removes the project along with its threads, its memory, and its files, and turns off the project’s scheduled tasks. This can’t be undone. Branches and pull requests the threads pushed to GitHub aren’t affected. +After you pause or archive the project, a thread on your computer keeps running. To stop that thread, click the laptop icon in its header and select **Disconnect**. + +## Turn Projects on for your organization + +To turn Projects on for a Team or Enterprise organization, an [Owner](</docs/en/server-managed-settings#access-control>) needs to turn on three settings in this order: **Cloud sessions** , **Chat and Cowork unified** , and **Project coordinator**. Some organizations can’t use Projects, so check the organization and seat requirements before you start. + +1 + +Turn on Cloud sessions + +Go to [**Organization settings > Claude Code**](<https://claude.ai/admin-settings/claude-code>) and turn on the **Cloud sessions** setting. + +2 + +Turn on Chat and Cowork unified + +Go to [**Organization settings > Capabilities**](<https://claude.ai/admin-settings/capabilities>) and turn on **Chat and Cowork unified** , the setting for the [unified Claude experience](<https://support.claude.com/en/articles/16761823-claude-cowork-and-chat-are-one-claude>). + +3 + +Turn on Project coordinator + +Go to [**Organization settings > Projects**](<https://claude.ai/admin-settings/projects>) and turn on the **Project coordinator** setting. Project coordinator is the role Claude takes in a project. + +To confirm Projects are on, go to [claude.ai/code/projects/browse](<https://claude.ai/code/projects/browse>) and check that it has a **New project** button. + +### Organization and seat requirements + +Projects aren’t available to some organizations, including those that have: + + * [HIPAA enabled](</docs/en/hipaa-setup>) + * [Zero Data Retention](</docs/en/zero-data-retention>) + * Customer-managed encryption keys (CMEK) + * Some [custom data retention](<https://support.claude.com/en/articles/10440198-configure-custom-data-retention-controls-for-enterprise-plans>) settings. If yours is one of them, you see “Projects isn’t available for organizations with a custom data retention period” when you turn on the **Project coordinator** setting. + +On Enterprise, members need a [seat type](<https://support.claude.com/en/articles/13393991-purchase-and-manage-seats-on-enterprise-plans>) other than **Lite** , such as **Standard** or **Chat**. To change a member’s seat type, go to [**Organization settings > Members**](<https://claude.ai/admin-settings/members>). + +### Give custom roles access to Projects + +If your Enterprise organization uses [custom roles](<https://support.claude.com/en/articles/13930452>), a member on a custom role needs six permissions to use Projects. Turn the permissions on in the role at [**Organization settings > Roles**](<https://claude.ai/admin-settings/roles>): + + * **Chat section** : **Chat** , **Code execution and file creation** , **Chat and Cowork unified** , and **Projects** + * **Claude Code section** : **Claude Code** and **Claude Code cloud sessions**. A member on a **Standard** or **Chat** seat needs these two permissions too. + +When a custom role is missing one of the six permissions, you see an **On for some roles** caption beside the **Project coordinator** toggle at [**Organization settings > Projects**](<https://claude.ai/admin-settings/projects>). To add the missing permissions, select **Edit role access** beside the toggle. If a role uses the **All generally available** option, also turn on the **Projects** permission in that role, because Projects are in beta. + +### Members keep classic projects + +After you turn Projects on, members keep their classic projects, the kind they already have in claude.ai chat and Cowork. A member can upgrade a classic project they created, from that project’s page. Some projects can’t be upgraded, such as a shared or archived project. After an upgrade, the member has two projects, the new one and the original: + + * **The new project** : has copies of the original’s instructions, files, and memory. Its `UPGRADE-NOTES.md` file lists anything that was skipped. + * **The original** : archived. The member can restore it from its page with the **Restore** button. The new project stays, and what they added to it isn’t copied back. + +### Turn Projects off + +To turn Projects off, go to [**Organization settings > Projects**](<https://claude.ai/admin-settings/projects>) and turn off the **Project coordinator** setting. While it’s off, members can still open, read, pause, archive, and delete their projects, but they can’t send messages or start threads. In place of the message box, they see a message such as “Project coordinator is off for your organization. Ask your admin to turn it on.” [Cloud scheduled tasks](</docs/en/routines>) in a project skip their runs while the **Project coordinator** setting is off. + +#### Stop threads that are already running + +When you turn the **Project coordinator** setting off, threads that are already running aren’t interrupted. To stop them, ask members to do this: + + * **Cloud threads** : pause their projects, then resume them after you turn the **Project coordinator** setting back on. + * **Threads on their own computer** : quit the desktop app or `claude remote-control`, whichever they connected the folder with. + +#### Keep Projects off on a Team plan + +If a notice under the **Project coordinator** toggle says Projects will be turned on for your team, select **Keep disabled** under the notice to keep them off. + ## Usage and cost -A thread that stops at your plan’s limit waits and by default continues on its own when the limit resets. Its work then counts against your next usage window. To keep threads from continuing, see A thread hit the usage limit. Work goes past your plan’s limits only if you have turned on [usage credits](</docs/en/costs#add-usage-credits-to-your-subscription>) for your account. +A thread that stops at your plan’s limit waits and by default continues on its own when the limit resets. Its work then counts against your next usage window. To keep threads from continuing, see A thread hit the usage limit. If you need more usage than your plan includes, [add usage credits to your subscription](</docs/en/costs#add-usage-credits-to-your-subscription>). If you manage a Team or Enterprise organization, see [Manage costs for your organization](</docs/en/costs#manage-costs-for-your-organization>) and the [Claude Enterprise consumption guide](<https://support.claude.com/en/articles/14782391-claude-enterprise-consumption-guide>). ### What draws on your plan -A project uses your limits faster than a single session does, and on a Pro plan in particular you should expect to reach your limit sooner on days you run one. These are the parts of a project that use your plan: - - * **Running threads** : each is a full session, and several can run at once. There’s no fixed number; Claude starts as many as the work calls for, and a limit you ask for is a preference rather than a cap. The enforced limit is 500 new threads per day across your projects. +You reach your usage limits sooner with a project than with a single session, especially on a Pro plan. Running threads, the project conversation, and threads watching a pull request each use your plan: + + * **Running threads** : each is a full session, and several can run at once. * **The conversation** : Claude uses tokens of its own reading what threads report and deciding what to do next. * **Threads watching a pull request** : an idle thread wakes up and uses your plan again when CI fails or a review comment arrives on its pull request. To stop that, ask in the thread for it to stop watching the pull request. -A project with no running threads, no watched pull requests, and no new messages doesn’t use your plan while it sits idle, and neither does an archived project. +An idle project uses your plan only when something wakes it, such as a scheduled task, a watched pull request, or a thread waiting on a limit. ### See and reduce a project’s usage Open **Usage** in **Project settings** to see token use by thread and how much went to the project conversation. To bring it down: - * On Pro, Max, and Ultra within your plan’s limits, the [cache lifetime](</docs/en/prompt-caching#cache-lifetime>) is an hour. A thread that has been idle longer than that re-reads its whole conversation before doing anything when a follow-up reaches it. For new work, ask Claude to start a fresh thread, which can use less than reviving a large old one. + * When a thread has been idle longer than the [cache lifetime](</docs/en/prompt-caching#cache-lifetime>), ask Claude to start a fresh thread for new work. The idle thread re-reads its whole conversation when a follow-up reaches it, so a fresh thread can use less. * For work that doesn’t need the largest model, choose a smaller model, or a lower effort level for threads. * Ask Claude in the project conversation to run fewer threads at a time, or to answer small questions itself instead of starting a thread. @@ -394,25 +482,28 @@ Several Claude Code features let more than one session work at the same time, so running work in parallel is not by itself what a project is for. In a project, Claude starts and tracks the sessions instead of you, and each one starts from the same instructions. This is how each neighboring feature connects to a project: - * **Claude Tag** : [Claude Tag](<https://claude.com/docs/claude-tag/overview>) is Claude in your team’s Slack channels, on Team and Enterprise plans. Anyone in a channel can give it work, everyone in the channel sees and steers it, and it uses connections an admin set up for that channel. Projects are on Pro, Max, and Ultra. A project is yours alone: you’re the only one who sends it work or sees its threads, and it uses your own GitHub access and connectors. [How Claude Tag differs from Cowork and Claude Code](<https://claude.com/docs/claude-tag/concepts/how-it-works#how-claude-tag-differs-from-cowork-and-claude-code>) has the side-by-side. - * **Cloud sessions** : every thread is a [cloud session](</docs/en/claude-code-on-the-web>) unless you ask Claude to run it on your machine. Either way, Claude starts and tracks it instead of you. You can also bring the work of a cloud session you started yourself into a project: choose **Continue in project** in that session’s sidebar menu. + * **Claude Tag** : [Claude Tag](<https://claude.com/docs/claude-tag/overview>) is Claude in your team’s Slack channels, on Team and Enterprise plans. Anyone in a channel can give it work, everyone in the channel sees and steers it, and it uses connections an admin set up for that channel. You give a project its work, and it uses your own GitHub access and connectors. [How Claude Tag differs from Cowork and Claude Code](<https://claude.com/docs/claude-tag/concepts/how-it-works#how-claude-tag-differs-from-cowork-and-claude-code>) has the side-by-side. + * **Cloud sessions** : every thread is a [cloud session](</docs/en/claude-code-on-the-web>) unless you let Claude run it on your machine. Either way, Claude starts and tracks it instead of you. You can also bring the work of a cloud session you started yourself into a project. * **Scheduled tasks** : when you ask for scheduled work in a project, Claude creates a [cloud scheduled task](</docs/en/routines>) that runs as threads in that project and appears in its **Scheduled tasks** view. Scheduled tasks you create outside a project keep working on their own. - * **Remote Control** : [Remote Control](</docs/en/remote-control>) connects claude.ai to a Claude Code session running on your machine. When you ask Claude in a project to run a thread on your computer, the project uses Remote Control to do it. + * **Remote Control** : [Remote Control](</docs/en/remote-control>) connects claude.ai to a Claude Code session running on your machine. A project uses it to run a thread on your computer. * **Local sessions and agent view** : a session you start yourself in your terminal, IDE, or the desktop app’s local environment stays outside your projects, though you can bring its work into one. [Agent view](</docs/en/agent-view>) is a screen for tracking several local sessions side by side, and you still start each one and give it its task yourself. * **Worktrees** : a [worktree](</docs/en/worktrees>) gives each local session its own working copy of a repository. Cloud threads don’t need them: each clones its repositories into its own cloud sandbox and works on its own branch. * **Agent teams** : an [agent team](</docs/en/agent-teams>) is one session that starts teammate sessions for a single task, on your machine or inside a cloud session, and ends with that task. * **Subagents** : a [subagent](</docs/en/sub-agents>) runs inside one session, does a side task in its own context window, and returns a summary to that session. A project’s threads are whole sessions that Claude starts and that report back to the project conversation, and a thread can still use subagents for its own side tasks. - * **Projects in claude.ai chat and Cowork** : the [earlier Projects experience](<https://support.claude.com/en/articles/9517075-what-are-projects>), which groups conversations and reference files without threads or a coordinator. Those projects keep working as they do today until the redesigned experience reaches them. [Run agents in parallel](</docs/en/agents>) compares these options side by side. +### Classic projects + +A classic project is the earlier kind of project in claude.ai chat and Cowork. It groups conversations and reference files, without threads or a Project coordinator. To use or upgrade one, see [What are projects?](<https://support.claude.com/en/articles/9517075-what-are-projects>). If you’re an Owner, see Members keep classic projects. + ## Limitations * Projects are available at claude.ai/code, in the desktop app, and in the Claude mobile app, not in the terminal CLI, the VS Code extension, or the JetBrains plugin, and not through Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry. - * Project threads are [cloud sessions](</docs/en/claude-code-on-the-web>), or sessions on your own machine through [Remote Control](</docs/en/remote-control>), with Anthropic as the model provider in both cases. [Security](</docs/en/security>) and [Data usage](</docs/en/data-usage>) cover how cloud sessions are isolated and what’s retained, and [Connection and security](</docs/en/remote-control#connection-and-security>) covers how a thread on your machine connects and what’s stored. - * You can’t add a session you started yourself on your machine to a project, though you can bring its work into one. A project reaches your machine by running a thread there through Remote Control, and that section lists what it needs. + * Project threads are [cloud sessions](</docs/en/claude-code-on-the-web>), or sessions on your own machine connected through [Remote Control](</docs/en/remote-control>). [Security](</docs/en/security>) and [Data usage](</docs/en/data-usage>) cover how cloud sessions are isolated and what’s retained, and [Connection and security](</docs/en/remote-control#connection-and-security>) covers how a thread on your machine connects and what’s stored. + * You can’t add a session you started yourself on your machine to a project, though you can bring its work into one. * A cloud thread’s sandbox pauses between turns and resumes when the thread continues. If the sandbox can’t be resumed, the thread continues from a fresh clone, so uncommitted changes can be lost. On long tasks, ask Claude to commit and push work in progress. - * A project belongs to one user. You can’t share a project with another user. There are no organization-level controls for projects during the beta. + * A project belongs to one user. You can’t share a project with another user. * A thread belongs to the one project that started it. You can’t move or copy a thread to another project, or move it out to stand alone. **Continue in project** goes the other way only: it brings a cloud session’s work into a project. You can’t merge two projects into one. ## Troubleshooting @@ -437,13 +528,12 @@ ### Repository access errors -Three messages mean a thread or the project can’t reach one of its repositories. A project’s cloud threads need the GitHub prerequisites even when your other cloud sessions clone the same repository without trouble. +These messages mean a thread or the project can’t reach one of its repositories: * **“Couldn’t start the session — Claude doesn’t have GitHub access to this project’s repository”** , reported before the thread starts, when the Claude GitHub App isn’t installed on that repository, is suspended, or isn’t linked to the GitHub account you connected. * **“Unable to access your repository”** , reported by a thread when its clone fails: GitHub rejected the clone, the repository wasn’t found under the name the project has, or the branch the thread was asked to start from doesn’t exist. - * **“Claude can’t access” a repository** , shown when you save repositories in the **New project** dialog or **Project settings**. The message continues with an install link and a reconnect link. Use the install link if the Claude GitHub App isn’t on that repository, and the reconnect link if it is, since the GitHub App can be installed on GitHub without being linked to the account you connected to Claude. If the message says the GitHub App is suspended or doesn’t include this repository, follow its link to GitHub to fix that. - -To fix GitHub access for “Couldn’t start the session” or “Unable to access your repository”, click the button the message offers, such as **Install on GitHub** or **Select repositories**. If there’s no button, follow Set up GitHub access. After the fix, ask Claude in the project conversation to start a new thread for the same work. + +To fix GitHub access, click the button the message offers, such as **Install on GitHub** or **Select repositories**. If there’s no button, follow Set up GitHub access. After the fix, ask Claude in the project conversation to start a new thread for the same work. ### A thread hit the usage limit @@ -451,7 +541,7 @@ ### Additional usage credits are required -A thread or the project conversation made a request your plan covers only with usage credits, such as one to a model or context size your plan doesn’t include, and usage credits aren’t turned on for your account. [Add usage credits to your subscription](</docs/en/costs#add-usage-credits-to-your-subscription>) covers who can turn them on or buy them on each plan. Once credits are available, send another message to retry. +A thread or the project conversation made a request your plan covers only with usage credits, and usage credits aren’t turned on. For example, it asked for a model or context size your plan doesn’t include. [Add usage credits to your subscription](</docs/en/costs#add-usage-credits-to-your-subscription>) covers who can turn them on or buy them on each plan. Once credits are available, send another message to retry. ### Lost contact with your folder @@ -472,8 +562,7 @@ ”The project’s environment was removed”| Choose a different environment in **Project settings > Environment**; the change applies to new threads ”Setup script failed”| [Setup script failed](</docs/en/web-quickstart#setup-script-failed>) lists common causes. Fix the script in the environment, then ask Claude in the project conversation to run the task in a new thread, so the script runs again ”Claude ran out of context on this turn”| The thread filled its context window. If the message says the thread continues in a fresh session, it carries on by itself; otherwise ask Claude in the project conversation to start a new thread for the remaining work -”Couldn’t start in” followed by your folder’s name| You allowed a thread to run on your computer, but the session couldn’t start there. When a line under the message gives the reason, fix that, then ask Claude to run the task again -”Claude is out of date on your device”| The computer you picked to run a thread has a Claude Code version older than v2.1.280. Update Claude Code there, or update the desktop app if that’s what connects the folder, then ask Claude to run the task again +”Claude is out of date on your device”| The computer you picked to run a thread needs Claude Code v2.1.302 or later. Update Claude Code there, or update the desktop app if that’s what connects the folder. Then ask Claude to run the task again ”Reached the turn limit”| The thread reached the cap on agentic turns that [`CLAUDE_CODE_MAX_TURNS`](</docs/en/env-vars>) sets. Send another message to continue, or raise or remove that variable where it’s set ## Related resources
modified Create a mod View current →
--- a/create.md +++ b/create.md @@ -25,7 +25,7 @@ When Claude saves the first file, Claude Code asks whether to enable hot reloading for the session. Hot reloading runs the mods Claude writes in this session and picks up each later change. You don’t see this question in a session that loads new mods without asking or can’t load them.Choose one of these answers: - * **Turn them on** : the mods in the session’s mods folder load when the turn ends, and reload at the end of each turn that changes them. Your answer lasts for the session, including after you resume it. + * **Turn them on** : the mods in the session’s mods folder load when the turn ends, and reload at the end of each turn that changes their code. Your answer lasts for the session, including after you resume it. * **Not now** : nothing loads for now. The files stay where Claude wrote them, and the mods load the next time that session starts. To keep a mod from ever loading, delete its directory. 3 @@ -38,7 +38,7 @@ Try the mod -Use what you asked for. For the example prompt, the current branch name appears above the prompt box. If the mod doesn’t do what you wanted, tell Claude what to change. The mod reloads at the end of each turn that changes its files, so you can try the change as soon as Claude finishes.If a transcript line that starts with the mod’s name says the [change didn’t load](</docs/en/plugins/mods/troubleshoot#this-mods-change-didnt-load>), paste that line into your next message when you ask Claude for a fix. Claude doesn’t see the line unless you paste it. +Use what you asked for. For the example prompt, the current branch name appears above the prompt box. To adjust the mod, tell Claude what to change. The mod reloads at the end of each turn that changes its code, so you can try the change as soon as Claude finishes.If a transcript line that starts with the mod’s name says the [change didn’t load](</docs/en/plugins/mods/troubleshoot#this-mods-change-didnt-load>), paste that line into your next message when you ask Claude for a fix. Claude doesn’t see the line unless you paste it. ### Use the mod in other sessions @@ -122,7 +122,7 @@ Write the code -This file is the mod’s code, called the hooks module. When the mod loads, Claude Code calls the `register` function the file exports and passes it a function named [`on`](</docs/en/plugins/mods/reference#the-hook-function>). Each call to `on` registers an event handler, called a hook, for the event it names.Save this as `first-mod/hooks/register.js`: +This file is the mod’s code, called the hooks module. When the mod loads, Claude Code calls the `register` function the file exports and passes it a function named [`on`](</docs/en/plugins/mods/events#how-a-hook-handles-an-event>). Each call to `on` registers an event handler, called a hook, for the event it names.Save this as `first-mod/hooks/register.js`: first-mod/hooks/register.js @@ -166,10 +166,10 @@ The file keeps a count in `calls` and registers four hooks: - * **[`session.start`](</docs/en/plugins/mods/reference#session>)** runs when the session starts, before your first prompt, and again each time the mod reloads. It adds the `/tally` command to Claude Code. - * **[`tool.call`](</docs/en/plugins/mods/reference#tools>)** runs each time Claude is about to use a tool. It adds one to `calls` and asks Claude Code to draw the interface again. - * **[`command.run`](</docs/en/plugins/mods/reference#commands-and-configuration>)** runs when you type `/tally`. It returns the text to print. - * **[`ui.render`](</docs/en/plugins/mods/reference#interface>)** runs each time Claude Code draws the spinner. It adds the count after the spinner’s word. + * **[`session.start`](</docs/en/plugins/mods/api#add-a-command-or-a-tool>)** runs when the session starts, before your first prompt, and again each time the mod reloads. It adds the `/tally` command to Claude Code. + * **[`tool.call`](</docs/en/plugins/mods/events#guard-or-change-a-tool-call>)** runs each time Claude is about to use a tool. It adds one to `calls` and asks Claude Code to draw the interface again. + * **[`command.run`](</docs/en/plugins/mods/api#add-a-command>)** runs when you type `/tally`. It returns the text to print. + * **[`ui.render`](</docs/en/plugins/mods/interface#pick-where-to-draw>)** runs each time Claude Code draws the spinner. It adds the count after the spinner’s word. How the example mod works explains the three arguments each hook takes and what each one returns. @@ -213,8 +213,8 @@ Each function you pass to `on` is a hook, which is an event handler. Claude Code passes every hook the same three arguments: - * **The mods API** , named `$`: every method a mod can call to reach outside itself, in [namespaces](</docs/en/plugins/mods/reference#mods-api-methods>) such as `$.ui` and `$.command` - * **The event** , named `e`: the [event’s input](</docs/en/plugins/mods/reference#events>) as plain data, such as a tool call’s name and arguments + * **The mods API** , named `$`: every method a mod can call to reach outside itself, in [namespaces](</docs/en/plugins/mods/api>) such as `$.ui` and `$.command` + * **The event** , named `e`: the [event’s input](</docs/en/plugins/mods/events#how-a-hook-handles-an-event>) as plain data, such as a tool call’s name and arguments * **The next handler** , named [`next`](</docs/en/plugins/mods/events#how-a-hook-handles-an-event>): a function that passes the event on to the other mods and then to Claude Code’s own behavior, and returns the result The hooks in `first-mod` handle their events in these ways: @@ -223,7 +223,7 @@ * **Answer** : the `command.run` hook returns its own result and never calls `next`. The second argument to `on`, `{ command: 'tally' }`, is a filter, called a [matcher](</docs/en/plugins/mods/events#filter-which-events-a-hook-handles>), so the hook runs only for `/tally`. * **Rewrite** : the `ui.render` hook calls `next` with a copy of `e` whose `suffix` holds the count, so Claude Code draws its usual spinner with your text after the word -Claude Code watches a directory loaded with `--plugin-dir` and hot-reloads the hooks module when a file in it changes. Each reload runs `register` again, so `calls` resets to `0` and `/tally` starts counting again. To keep a value across reloads, see [Keep state](</docs/en/plugins/mods/interface#keep-state>). +When you change the hooks module’s code during an interactive `--plugin-dir` session, Claude Code hot-reloads the module. Each reload runs `register` again, so `calls` resets to `0` and `/tally` starts counting again. To keep a value across reloads, see [Keep state](</docs/en/plugins/mods/interface#keep-state>). ## Keep working on a mod @@ -235,7 +235,7 @@ claude --plugin-dir ./first-mod -Then ask for the change, for example `add a /tally-reset command to this mod that sets the tally back to zero`. Claude edits the hooks module, runs `claude plugin validate`, and fixes what it reports. A directory you load with `--plugin-dir` is a [protected path](</docs/en/permission-modes#protected-paths>), so in `default` and `acceptEdits` modes you’re asked to approve each of Claude’s edits to the mod. The protected paths table gives the result for the other permission modes. Files Claude saves during its turn reload when the turn ends, so you can try `/tally-reset` as soon as Claude finishes. +Then ask for the change, for example `add a /tally-reset command to this mod that sets the tally back to zero`. Claude edits the hooks module, runs `claude plugin validate`, and fixes what it reports. A directory you load with `--plugin-dir` is a [protected path](</docs/en/permission-modes#protected-paths>), so in `default` and `acceptEdits` modes you’re asked to approve each of Claude’s edits to the mod. The protected paths table gives the result for the other permission modes. The mod reloads when Claude’s turn ends, so you can try `/tally-reset` as soon as Claude finishes. ### Get type definitions for your version @@ -245,11 +245,11 @@ ---|--- `claude-code/index.d.ts`| Every event and its input and result, every mods API namespace and method, and the elements each surface can draw `claude-code-tools/index.d.ts`| The built-in tools’ inputs and results, so that checking `e.tool === 'Bash'` narrows `e` -`claude-code-mcp/index.d.ts`| The inputs of the MCP tools that were connected the last time you saved a file in the mod +`claude-code-mcp/index.d.ts`| The inputs of the session’s MCP tools, updated when the mod hot-reloads with a server connected `index.d.ts` in a directory named for a plugin| What that plugin adds to the mods API. There’s one directory for each plugin your `plugin.json` lists under `dependencies`. `tsconfig.json`| Compiler options that fit a hooks module -If your mod has no `tsconfig.json` of its own, Claude Code adds one at the mod’s root that extends the generated one, so your editor and `tsc -p ./first-mod` type-check the mod without more setup. The events and methods can change between releases, so trust these files over any page, this one included, when they disagree. `claude-code/index.d.ts` is the fullest reference for your build, with a comment and an example for every mods API method. To look something up, search the file for its name, such as `'tool.call'`. +If your mod has no `tsconfig.json` of its own, Claude Code adds one at the mod’s root that extends the generated one, so your editor and `tsc -p ./first-mod` type-check the mod without more setup. Events and methods can change between releases, so use these files as the reference for your version. To look up an event or method, [search `claude-code/index.d.ts`](</docs/en/plugins/mods/reference#look-up>) for its name, such as `'tool.call'`. ### Check what Claude Code reads from your mod
modified Desktop application View current →
Show diff (163 lines)
--- a/desktop.md +++ b/desktop.md @@ -107,16 +107,16 @@ In an SSH or [WSL](</docs/en/desktop-wsl>) session, click an HTML file’s path in the chat to preview the file in the Browser pane. If charts or tables in the preview stay empty, the notice above it tells you why: - * **`This preview doesn't load anything from the web`** : scripts written in the file run, but a chart that loads its library from the web stays empty. If the notice has an **Export** button, select it and open the saved file in your browser, where content from the web loads. - * **`This preview doesn't run scripts or load anything from the web`** : before Claude Desktop v4.23118.0, these previews didn’t run scripts, so update Desktop and open the file again. If Desktop is up to date and the notice stays, restart Desktop. If it still stays, scripts may be off for your organization, so ask your administrator. + * **The notice says that scripts don’t run** : before Claude Desktop v4.23118.0, these previews didn’t run scripts, so update Desktop and open the file again. If Desktop is up to date and the notice stays, restart Desktop. If it still stays, scripts may be off for your organization, so ask your administrator. + * **The notice says nothing about scripts** : for example, `Parts may be missing here`. Scripts written in the file run, but a chart that loads its library from the web stays empty. If the notice has an **Export** button, select it and open the saved file in your browser, where content from the web loads. If you closed the notice, open the file again to bring it back. #### Turn off scripts in SSH and WSL previews for your organization -To keep the Browser pane’s HTML previews in SSH and WSL sessions from running scripts, set the `disableRemotePreviewScripts` managed setting to `true`. Users can still browse external sites. Requires Claude Desktop v5.1231.0 or later. - -Earlier versions ignore `disableRemotePreviewScripts`. To stop the scripts there, update Desktop, or also set `disableBrowserExternalNavigation` to `true`. Users then can’t browse external sites on any computer that receives `disableBrowserExternalNavigation`. +To keep HTML previews in SSH and WSL sessions from running scripts in the Browser pane and the **Files** pane, set the `disableRemotePreviewScripts` managed setting to `true`. Users can still browse external sites. Requires Claude Desktop v5.1231.0 or later for the Browser pane, and v7.37095.0 or later for the file pane. + +To stop scripts in the Browser pane’s HTML previews on versions before v5.1231.0, update Desktop, or also set `disableBrowserExternalNavigation` to `true`. Users then can’t browse external sites on any computer that receives `disableBrowserExternalNavigation`. For the file pane, both keys require v7.37095.0 or later, so update Desktop. Set each key in your [server-managed settings](</docs/en/server-managed-settings>), or in a [Claude Code MDM policy or managed settings file](</docs/en/managed-settings#where-each-mechanism-stores-the-policy>) on the computer that runs Desktop. Desktop doesn’t read these keys from the remote machine, the WSL distribution, a [`policyHelper`](</docs/en/settings-reference#policyhelper>), or Desktop’s own policies. With a [third-party provider](</docs/en/third-party-integrations>), use the MDM policy or the file. @@ -125,12 +125,13 @@ Then have users restart Desktop to make sure that the setting applies, and tell them what to expect: * **SSH and WSL files they open in the Browser pane** : the preview doesn’t run scripts, so charts and tables that scripts draw stay empty - * **Previews that are running scripts** : if Desktop picks up the setting before the restart, they close. Users see `This preview closed because scripts are turned off for previews. Open the file again to view it without scripts.` + * **Browser pane previews that are running scripts** : if Desktop picks up the setting before the restart, they close. Users see `This preview closed because scripts are turned off for previews. Open the file again to view it without scripts.` + * **SSH and WSL files they open in the file pane** : an HTML file shows as code in place of its preview. Users see `HTML preview isn’t available here, so this file is shown as code.` * **Files they export** : if a user exports a file and opens it in a browser, its scripts run there, with or without this setting ##### Check a computer for scripts that still run -After the restart, open an HTML file from an SSH or WSL session on that computer. If the notice above the preview starts with `This preview doesn't load anything from the web`, scripts still run there. Check Desktop’s version, where you put the key, and that its value is the JSON Boolean `true`. +After the restart, open any HTML file from an SSH or WSL session on that computer, in the Browser pane. If the notice above the preview says nothing about scripts, scripts still run there. Check Desktop’s version, where you put the key, and that its value is the JSON Boolean `true`. Then select **Files** and open the same file from the file tree. With scripts off, after a few seconds the pane offers no **Preview** (an eye icon) for the file. If the pane shows the page or still offers **Preview** , scripts still run there. Make the same checks; for the file pane, Desktop’s version must be v7.37095.0 or later. ### Browse external sites @@ -542,7 +543,7 @@ * **Add plugins** : select it * **Plugins** : select it, then **Browse plugins**. If that’s missing, select **Manage plugins**. -To enable, disable, or uninstall plugins when the **+** menu shows **Plugins** , select **Plugins > Manage plugins**. In a local session, you can also click **Customize** or **Plugins** in the sidebar. You can scope plugins to your user account, a specific project, or local-only. If your organization manages plugins centrally, those plugins are available in desktop sessions the same way they are in the CLI, except the ones the desktop app [withholds under `disableSideloadFlags`](</docs/en/settings-reference#disablesideloadflags>). +To enable, disable, or uninstall plugins when the **+** menu shows **Plugins** , select **Plugins > Manage plugins**. In a local session, you can also click **Customize** or **Plugins** in the sidebar. You can scope plugins to your user account, a specific project, or local-only. If your organization manages plugins centrally, those plugins are available in local sessions the same way they are in the CLI, except the ones the desktop app [withholds under `disableSideloadFlags`](</docs/en/settings-reference#disablesideloadflags>). Plugins you install on your computer at user or local scope aren’t available in cloud sessions. To use one there, see the **Cloud session** tab under [Install a plugin](</docs/en/plugins/install#install-a-plugin>). Plugins aren’t available in WSL sessions. @@ -1247,7 +1248,7 @@ * **Folder restrictions** : if your organization restricts which folders sessions may use, Desktop checks each file read, search, and edit, with or without a worktree. On a Linux or macOS remote machine, with Claude Desktop v6.6395.0 or later, all three can keep working while Desktop is disconnected. Keep the task’s files in the session’s worktree, or in the session’s folder if it has no worktree, then test the remote machine. On a Windows remote machine, or with an earlier version, keep Desktop connected: while it is disconnected, each of the three waits up to 10 minutes and then fails. * **Connectors** : connectors and other tools that Desktop provides run through Desktop, so while it is disconnected each call fails after about 30 seconds * **Workflows** : Desktop checks each new [workflow](</docs/en/workflows>) before it starts, so while Desktop is disconnected a new one waits up to 10 minutes and then fails. Under folder restrictions, behind a [corporate launcher](</docs/en/corporate-launcher>), or before Claude Desktop v5.11492.0, new workflows can’t start while Desktop is disconnected. Otherwise, approve a workflow before the long task: ask Claude for one in a session on the remote machine, and [approve it](</docs/en/workflows#approve-the-plan-before-it-runs>) if Desktop asks. Then open a new session for the long task, because the approval takes effect only in sessions that you open afterward. In the new session, choose a permission mode that doesn’t ask before each workflow, such as Auto, and test the remote machine first. - * **MCP servers** : MCP servers that Claude Code starts on the remote machine don’t run through Desktop, so Claude can still call their tools. Servers from `claude_desktop_config.json` are among them only if Desktop doesn’t use its built-in SSH client. Otherwise, and on some Windows remote machines, Claude can’t call their tools while Desktop is disconnected. + * **MCP servers** : MCP servers that Claude Code starts on the remote machine don’t run through Desktop, so Claude can still call their tools. To keep the tools of servers from `claude_desktop_config.json` working too, update to Claude Desktop v5.11492.0 or later, because earlier versions lose them where Desktop uses its built-in SSH client. On some Windows remote machines, keep Desktop connected, because Claude can’t call those tools without it. When edits in a worktree keep working @@ -1428,9 +1429,24 @@ * **`mode`** : set it to `normal` wherever your jail sets it, in a `mode` line or in the brackets of a line such as `filter = sshd[mode=aggressive]`. You give up every count that only the other modes make, for example of clients that connect and leave without trying to log in. * **`ignoreip`** : set it to the addresses that people connect from, for example `ignoreip = 203.0.113.7`. fail2ban then counts nothing from those addresses, failed logins included. +#### Skills, hooks, and settings from your computer + +Desktop doesn’t copy your `~/.claude/skills/` folder, or the hooks and other settings in your `~/.claude/settings.json`, to the remote machine. To use your skills, hooks, and settings in an SSH session, set them up in `~/.claude/` in your home directory on the remote machine. Copy any scripts that your hooks run too, and change the hooks to the scripts’ paths on that machine. For a project’s own settings, copy any `.claude/` file that the project folder on the remote machine lacks, such as `settings.local.json`, which Git usually excludes. Then start a new session. If a skill, hook, or setting still does nothing, see [Debug your configuration](</docs/en/debug-your-config>). + +#### MCP servers from `claude_desktop_config.json` + +In an SSH session, most MCP servers from `claude_desktop_config.json` start on the remote machine, so install the commands that they run on the remote machine. Check for these causes if a server is missing, fails to start, or stops responding: + + * **Absolute path** : Desktop omits some servers whose command is an absolute path, such as one under `/Users/`, `/opt/homebrew/`, or `/Applications/`. Where you can, give the command as a bare name, such as `npx`, or set the server up on the remote machine. + * **Environment variables** : from a server’s `env` in `claude_desktop_config.json`, Desktop sends only names that start with `MCP_` and a few fixed names, such as `DEBUG` and `NODE_ENV`. If a server needs others, set it up on the remote machine. + * **No server appears** : if Desktop finds a [`managed-mcp.json`](</docs/en/managed-mcp#exclusive-control-with-managed-mcp-json>) file on the remote machine, it sends none of these servers. Ask your administrator to add the server to that file. + * **Desktop disconnected** : on some remote machines, Claude can’t call these servers’ tools while Desktop is disconnected. See the **MCP servers** entry under Limits while Desktop is disconnected. + +Keep a secret out of these servers’ arguments and `MCP_` variables in `claude_desktop_config.json` unless you trust the remote machine with it, because Desktop sends both unchanged. + #### Use MCP servers set up on the remote machine -To use an [MCP server](</docs/en/mcp>) from `~/.claude.json` or a project’s `.mcp.json` in an SSH session, set it up in those files on the remote machine. Claude Code starts their stdio servers there, so install the commands those servers run on the remote machine. For servers from `claude_desktop_config.json`, see Limits while Desktop is disconnected. +To use an [MCP server](</docs/en/mcp>) from `~/.claude.json` or a project’s `.mcp.json` in an SSH session, set it up in those files on the remote machine. Claude Code starts their stdio servers there, so install the commands those servers run on the remote machine. For servers from `claude_desktop_config.json`, see MCP servers from `claude_desktop_config.json`. #### Open an SSH session from a link @@ -1824,8 +1840,8 @@ `model`| set the model ID that new local sessions start on `browserExternalPageTools`| set to `"disabled"` to prevent Claude from using tools to read or act on external pages in the Browser pane. Users can still navigate to external sites themselves, and local dev server previews are unaffected. `disableMobileSimulatorTools`| set to `true` to block Claude’s tools for controlling and capturing devices in the [iOS Simulator pane](</docs/en/desktop-ios-simulator#turn-off-simulator-access>). The pane stays usable for the user’s own taps; only Claude’s access is removed. The value must be the JSON boolean `true`; the string `"true"` is ignored. -`disableBrowserExternalNavigation`| set to `true` to turn off external browsing in the Browser pane entirely. Neither users nor Claude can go to external sites, and localhost dev server previews are unaffected. The Browser pane’s HTML previews in SSH and WSL sessions don’t run scripts. The value must be the JSON boolean `true`; the string `"true"` is ignored. -`disableRemotePreviewScripts`| set to `true` to turn off scripts in the Browser pane’s HTML previews in SSH and WSL sessions, without turning off external browsing. Desktop doesn’t read it from the remote machine or the WSL distribution. The value must be the JSON boolean `true`; the string `"true"` is ignored. Requires Claude Desktop v5.1231.0 or later. +`disableBrowserExternalNavigation`| set to `true` to turn off external browsing in the Browser pane entirely. Users and Claude can’t go to external sites, and localhost dev server previews are unaffected. HTML files that users open in Desktop’s SSH and WSL sessions don’t run scripts. For the file pane, that requires Claude Desktop v7.37095.0 or later. The value must be the JSON boolean `true`; the string `"true"` is ignored. +`disableRemotePreviewScripts`| set to `true` to turn off scripts in HTML files that users open in Desktop’s SSH and WSL sessions, without turning off external browsing. Desktop doesn’t read it from the remote machine or the WSL distribution. The value must be the JSON boolean `true`; the string `"true"` is ignored. Requires Claude Desktop v5.1231.0 or later for the Browser pane, and v7.37095.0 or later for the file pane. `sshConfigs`| pre-configure SSH connections that appear in the environment selector. Users can’t delete managed connections or edit anything but their own **Worktree folder**. `sshHostCommands`| give users SSH connections whose host comes from a command, alongside their own. Desktop reads it from the managed settings file or MDM policy on the computer, and ignores it in [server-managed settings](</docs/en/server-managed-settings>). Requires Claude Desktop v3.6556.0 or later on macOS or Linux, or v4.16336.0 or later on Windows, signed in with a Claude account. On Windows, Desktop also has to connect through the OpenSSH client. `sshHostAllowlist`| restrict SSH sessions to hosts whose resolved hostname matches one of these patterns. Read from managed settings only. With server-managed settings, set the same list in both places. @@ -1836,7 +1852,7 @@ If you turn a feature off with one of these four keys in a computer’s [highest-ranked MDM policy or managed settings file](</docs/en/managed-settings#how-claude-code-combines-managed-sources>), the feature stays off there: * **`browserExternalPageTools`, `disableMobileSimulatorTools`, `disableBrowserExternalNavigation`**: requires Claude Desktop v4.4212.0 or later - * **`disableRemotePreviewScripts`** : requires Claude Desktop v5.1231.0 or later + * **`disableRemotePreviewScripts`** : requires Claude Desktop v5.1231.0 or later for the Browser pane It stays off even when your [server-managed settings](</docs/en/server-managed-settings>) leave that key unset or allow the feature. Don’t use a user-level `HKCU` registry value for this. To turn the feature back on, remove the value wherever you set it. Which managed settings reach a Desktop session depends on where that session runs. Model restrictions such as [`availableModels`](</docs/en/model-config#restrict-model-selection>) are enforced in Desktop’s Claude Code sessions the same way as in the terminal CLI; see [surface coverage](</docs/en/model-config#surface-coverage>). @@ -1948,6 +1964,16 @@ * **Enterprise Admin Console** : if it delivers your computers’ Claude Desktop configuration, update them to Claude Desktop v2.37337.0 or later first, because earlier versions ignore it once this key is set. See [Keep a device on its managed profile](<https://claude.com/docs/third-party/claude-desktop/admin-console#keep-a-device-on-its-managed-profile>). * **Third-party providers** : if people set up their own [third-party inference configuration](<https://claude.com/docs/third-party/claude-desktop/in-app-configuration>) in the app, Claude Desktop ignores that configuration from the next launch after you deploy this key. To keep people on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, or an LLM gateway, [deploy a configuration](<https://claude.com/docs/third-party/claude-desktop/configuration>) to their computers in the same Claude Desktop policy. +#### Restrict sign-in to Claude Console + +If you set `forceLoginMethod` to `"console"` in Claude Code’s [managed settings](</docs/en/managed-settings>), people can still run local Code tab sessions with a claude.ai account. If you set `forceLoginOrgUUID` there to Console organization IDs only, those sessions don’t start, but people can still use Chat with that account. To stop both, move the whole app to a third-party (3P) deployment with Claude Console sign-in. On Claude Desktop v4.16336.0 or later, set these keys in the Claude Desktop policy: + + * **`inferenceProvider`** : [set it to `anthropic`](<https://claude.com/docs/third-party/claude-desktop/claude-api>) + * **`deploymentMode`** : [set it to `3p`](<https://claude.com/docs/third-party/claude-desktop/mdm#restrict-a-device-to-one-deployment-mode>) + * **`disableDeploymentModeChooser`** : set it to `true` while any device runs an earlier version, because earlier versions ignore `deploymentMode` + +Before you deploy, check the 3P column of the [feature comparison](<https://claude.com/docs/third-party/claude-desktop/feature-matrix>) and read [how your Claude Code settings apply on 3P](<https://claude.com/docs/third-party/claude-desktop/code#interaction-with-claude-code%E2%80%99s-own-managed-settings>). You can keep `forceLoginMethod` set to `"console"`. Deploy the policy in `HKLM` on Windows and as a [machine profile](<https://claude.com/docs/third-party/claude-desktop/mdm#4-deploy-the-configuration>) on macOS. From the app’s next launch, people [sign in with Claude Console](<https://claude.com/docs/third-party/claude-desktop/claude-api#choose-an-authentication-approach>) and can’t switch the app to a claude.ai account. They can choose any Console organization, including a personal one, even with Claude Code’s `forceLoginOrgUUID` set. To limit that choice, follow [Keep a device on its managed profile](<https://claude.com/docs/third-party/claude-desktop/admin-console#keep-a-device-on-its-managed-profile>). The Code tab [doesn’t list the sessions](<https://claude.com/docs/third-party/claude-desktop/data-storage#data-shared-with-standard-claude-desktop>) that they started with a claude.ai account. + ### Network access requirements Desktop loads its application code and user content from Anthropic CDN hosts. @@ -2037,7 +2063,7 @@ ### Shared configuration -Desktop and CLI read the same configuration files, so your setup carries over: +For SSH sessions, see Skills, hooks, and settings from your computer and Use MCP servers set up on the remote machine. In local sessions, Desktop and CLI read the same configuration files, so your setup carries over: * **[CLAUDE.md](</docs/en/memory>)** and `CLAUDE.local.md` files in your project are used by both * **[MCP servers](</docs/en/mcp>)** configured in `~/.claude.json` or `.mcp.json` work in both @@ -2047,7 +2073,7 @@ #### MCP servers from the Claude Desktop chat app -The Desktop app loads MCP servers from `claude_desktop_config.json` into local Code tab sessions, alongside servers from `~/.claude.json` and `.mcp.json`. The servers from `claude_desktop_config.json` also load in a [WSL session](</docs/en/desktop-wsl>), unless the session [lacks connectors](</docs/en/desktop-wsl#check-for-the-terminal-and-connectors>). In a WSL session, those servers run on Windows. +The Desktop app loads MCP servers from `claude_desktop_config.json` into local Code tab sessions, alongside servers from `~/.claude.json` and `.mcp.json`. The servers from `claude_desktop_config.json` also load in a [WSL session](</docs/en/desktop-wsl>), unless the session [lacks connectors](</docs/en/desktop-wsl#check-for-the-terminal-and-connectors>). In a WSL session, those servers run on Windows. In an SSH session, most of them start on the remote machine: see MCP servers from `claude_desktop_config.json`. The standalone CLI does not read `claude_desktop_config.json`. On macOS and WSL, run `claude mcp add-from-claude-desktop` to copy those servers into `~/.claude.json`. See [Import MCP servers from Claude Desktop](</docs/en/mcp#import-mcp-servers-from-claude-desktop>) for the import flow and scope options. @@ -2219,6 +2245,23 @@ Look through those files too before you send them. +### SSH session stops or fails to start + +If an SSH session stops or doesn’t start and shows an error card, find the card’s title in this table, then do what the last column says. + +Card title| What it means| What to do +---|---|--- +`Session was interrupted`| Claude Code runs as a process on the remote machine, and Desktop’s connection to that process ended| If the card tells you to send a message again, do as it says. Otherwise, select **Try again** , or send a message such as `continue`. +`Claude Code on <host> stopped when its sign-in expired`| Claude Code on the remote machine gets its sign-in to your Claude account from Desktop, and that sign-in expired. See when that sign-in can expire.| Select **Try again** , or send a message, to continue +`Sign in again to continue`| Desktop needs a new sign-in for the session, and your last sign-in to your Claude account is too old for that. See [Claude Code needs a recent sign-in](</docs/en/errors#claude-code-needs-a-recent-sign-in>).| Select **Sign in again** , then sign in. If the session doesn’t continue on its own, send a message. +`Folder not found on <host>`| The folder or worktree that the session works in is missing on the remote machine| Do what the card offers: fork the session, choose another folder, create the folder again at the same path and send a message, or start a new session. If **Fork session** fails, start a new session. +`<host> doesn’t have this conversation` or `<host> doesn’t have this conversation right now`| Claude Code didn’t find the conversation’s [saved history](</docs/en/sessions#where-transcripts-are-stored>), a file on the remote machine that is under `~/.claude/projects/` by default| Bring `~/.claude/projects/` back first if it’s missing for the user you connect as, for example by mounting the home directory, then select **Try again** or send a message. If the history is gone, start a new session. After **Start fresh** , which the card can offer, the session can’t return to the earlier conversation. +`Claude no longer has the earlier messages`| Claude Code found no [saved history](</docs/en/sessions#where-transcripts-are-stored>) for the conversation on the remote machine, and Desktop no longer tries to resume that conversation| Select **Start fresh** , or send a message. Claude starts a new conversation in the session, without the earlier messages. +`Couldn’t create a worktree on <host>`| The session is set to run in its own worktree, and Desktop couldn’t create it on the remote machine| Fix the cause that the card shows in its details, then select **Try again** or send a message. To work without a worktree, select **Start without a worktree** when the card offers it. +`Couldn’t start Claude Code on the remote host`, with a line under it that starts `Claude Code is missing on the remote host`| The copy of Claude Code that Desktop installs on the remote machine isn’t there| Select **Try again** , or send your message again, to have Desktop reinstall Claude Code + +For a card whose title or text isn’t in the table, see SSH connection fails after you log in and SSH host key verification failed. If the card isn’t there either, or you see the same card again after these steps, see Get Desktop’s logs for an SSH problem and Still stuck?. + ### App won’t quit * **macOS** : press Cmd+Q. If the app doesn’t respond, use Force Quit with Cmd+Option+Esc, select Claude, and click Force Quit.
modified Schedule recurring tasks in Claude Code Desktop View current →
--- a/desktop-scheduled-tasks.md +++ b/desktop-scheduled-tasks.md @@ -84,13 +84,13 @@ In the instructions box’s toolbar, select a permission mode and model. * **Permission mode** : if you leave it unchanged, runs use your Claude Code settings. - * **Model** : if the model menu reads **Default · Set by admin** and you don’t pick another model, runs use the model your organization set in [managed settings](</docs/en/managed-settings>). A catch-up run that starts as the app opens can use the [runtime default for your account](</docs/en/model-config#default-model-setting>) instead. + * **Model** : when **Only on this computer** is on and your account can use a model your organization set in [managed settings](</docs/en/managed-settings>), the menu button shows **Default** and that model’s name. For example, if your organization set Sonnet 4.6, you see **Default · Sonnet 4.6**. Where Desktop can’t name the model, the button reads **Default · Set by admin** instead. If you then keep **Default** , Desktop starts runs with your organization’s model. A catch-up run that starts as the app opens can use the [runtime default for your account](</docs/en/model-config#default-model-setting>) instead. 9 Create the task -Click **Create**. If you haven’t trusted the folder yet, Desktop asks you to trust it at this point. The task’s detail page opens.To see which model **Default · Set by admin** stands for, click **Run now** on the detail page to run the task at once. Then open the run’s session, where the row under the prompt box shows the model’s name. +Click **Create**. If you haven’t trusted the folder yet, Desktop asks you to trust it at this point. The task’s detail page opens.If the model menu read **Default · Set by admin** and you want the model’s name, click **Run now** on the detail page to run the task at once. Then open the run’s session, where the row under the prompt box shows the model’s name. On the detail page, click the pencil icon to open the **Edit** form. There you can change the **Description** that Desktop filled in from your instructions, select **Worktree** , or switch the schedule to **Manual** or **Custom**. You can also create a task by describing what you want in any session. For example, “set up a daily code review that runs every morning at 9am” creates a recurring task. A request like “remind me at 3pm tomorrow to check the deploy” creates a one-time task that disables itself after it fires.
modified Environment variables View current →
--- a/env-vars.md +++ b/env-vars.md @@ -275,9 +275,9 @@ `CLAUDE_CODE_EXTRA_BODY`| JSON object to merge into the top level of model request bodies except on some requests outside the conversation, such as `/model` checks. Useful for passing provider-specific parameters that Claude Code doesn’t expose directly. A value exported in your shell also applies to the [background sessions](</docs/en/agent-view>) you dispatch with `claude agents` or `--bg`. Before v2.1.206, background sessions ignored a shell-exported value and used whatever copy the background supervisor process inherited `CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS`| Override the default token limit for [file reads](</docs/en/tools-reference#large-files>), which is 25,000 tokens. Useful when you need to read larger files in full. A read that Claude makes with the `allow_large` parameter can go past this limit when the context window has room `CLAUDE_CODE_FORCE_SESSION_PERSISTENCE`| Set to `1` to force transcript persistence, prompt history, and `claude agents` registration even when this `claude` was launched from inside another Claude Code session. Use when an inherited `CLAUDE_CODE_CHILD_SESSION` value, for example from a `screen` session or a background launcher first started by Claude Code’s Bash tool, causes a genuine top-level session to be misclassified as nested. As of v2.1.178, Claude Code detects the tmux case automatically and ignores the inherited marker, so tmux no longer needs this variable. Also honored on v2.1.169 and earlier; has no effect on v2.1.170 and v2.1.171, where the nested-session detection it overrides was removed -`CLAUDE_CODE_FORCE_STRIKETHROUGH`| Set to `1` to force strikethrough rendering for `~~text~~` in Claude’s responses when your terminal supports it but is not auto-detected, such as over SSH without `TERM_PROGRAM` forwarded. Without this, undetected terminals show the literal `~~` markers instead of rendering the text as strikethrough. Requires Claude Code v2.1.186 or later +`CLAUDE_CODE_FORCE_STRIKETHROUGH`| Set to `1` to force strikethrough rendering for `~~text~~` in Claude’s responses when your terminal supports it but is not auto-detected, such as over SSH without `TERM_PROGRAM` forwarded. Without this, undetected terminals show the literal `~~` markers instead of rendering the text as strikethrough `CLAUDE_CODE_FORCE_SYNC_OUTPUT`| Set to `1` to force-enable DEC private mode 2026 [synchronized output](<https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036>) when your terminal supports it but is not auto-detected. Useful for emulators such as Emacs `eat` that implement BSU/ESU but do not reply to the capability probe. Has no effect under tmux. Unlike `CLAUDE_CODE_NO_FLICKER`, which switches to [fullscreen rendering](</docs/en/fullscreen>), this doesn’t change the renderer -`CLAUDE_CODE_FORCE_TERMINAL_IMAGES`| Set to `1` to draw [mod `Image` elements](</docs/en/plugins/mods/reference#elements>) as pictures when your terminal draws kitty graphics protocol images with Unicode placeholders and you still see an `Image`’s dimmed `alt` text. See [which terminals draw an `Image` and where not to set this variable](</docs/en/plugins/mods/gallery#image-and-client>) +`CLAUDE_CODE_FORCE_TERMINAL_IMAGES`| Set to `1` to draw [mod `Image` elements](</docs/en/plugins/mods/interface#build-a-tree-from-elements>) as pictures when your terminal draws kitty graphics protocol images with Unicode placeholders and you still see an `Image`’s dimmed `alt` text. See [which terminals draw an `Image` and where not to set this variable](</docs/en/plugins/mods/gallery#image-and-client>) `CLAUDE_CODE_FORK_SUBAGENT`| Controls fork mode, which is on by default and lets Claude start [forks](</docs/en/sub-agents#fork-the-current-conversation>) on its own. Set to `0` to turn fork mode off, for example to [let Claude wait for a subagent](</docs/en/sub-agents#let-claude-wait-for-a-subagent>). For versions, see [Turn fork mode off](</docs/en/sub-agents#turn-fork-mode-on-or-off>) `CLAUDE_CODE_FORWARD_SUBAGENT_TEXT`| Set to `1` to emit [subagent](</docs/en/sub-agents>) text and thinking blocks in `claude -p --output-format stream-json` output, the same behavior as the [`--forward-subagent-text`](</docs/en/cli-reference#cli-flags>) flag. Use the variable when a harness invokes `claude` and can’t pass the flag itself. Unlike the flag, which exits with an error outside non-interactive mode with stream-json output, the variable is ignored there so that nested invocations keep working when it’s set process-wide. Requires Claude Code v2.1.211 or later `CLAUDE_CODE_FULL_SIGN_IN_LINK`| Set to `1` to print the full login URL. Use it when a short login URL shows an error or your script reads values from the URL. Set it in your shell or user settings. Requires Claude Code v2.1.330 or later @@ -330,7 +330,7 @@ `CLAUDE_CODE_PERFORCE_MODE`| Set to `1` to enable Perforce-aware write protection. When set, Edit, Write, and NotebookEdit fail with a `p4 edit <file>` hint if the target file lacks the owner-write bit, which Perforce clears on synced files until `p4 edit` opens them. This prevents Claude Code from bypassing Perforce change tracking `CLAUDE_CODE_PLUGIN_CACHE_DIR`| Override the plugins root directory. Despite the name, this sets the parent directory, not the cache itself: marketplaces and the plugin cache live in subdirectories under this path. Defaults to `~/.claude/plugins` `CLAUDE_CODE_PLUGIN_DIRS`| Plugin directories to load for the session, each loaded the way a [`--plugin-dir`](</docs/en/plugins/cli-reference#flags-that-load-a-plugin-for-one-session>) flag loads it. Separate multiple paths with `:` on Unix or `;` on Windows. Give each path as an absolute path or start it with `~`, because Claude Code skips relative paths. Requires Claude Code v2.1.280 or later. See [Load a plugin for one session](</docs/en/plugins/create#load-a-directory-or-archive-for-one-session>) -`CLAUDE_CODE_PLUGIN_DIR_WATCH`| Controls whether a [mod](</docs/en/plugins/mods/overview>) reloads when its files change. By default, mods in [skills directories](</docs/en/plugins/org#keep-skills-directory-plugins-loading>) reload in any session that takes more than one prompt, [non-interactive](</docs/en/headless>) included. Mods in `--plugin-dir` directories reload only in interactive terminal sessions. Set to `1` to reload them as skills-directory mods do, or `0` to turn reloading off everywhere. Requires Claude Code v2.1.287 or later +`CLAUDE_CODE_PLUGIN_DIR_WATCH`| Controls whether a [mod](</docs/en/plugins/mods/overview>) reloads when its code changes. By default, mods in [skills directories](</docs/en/plugins/org#keep-skills-directory-plugins-loading>) reload in any session that takes more than one prompt, [non-interactive](</docs/en/headless>) included. Mods in `--plugin-dir` directories reload only in interactive terminal sessions. Set to `1` to reload them as skills-directory mods do, or `0` to turn reloading off everywhere. Requires Claude Code v2.1.287 or later `CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS`| Timeout in milliseconds for cloning or refreshing a plugin marketplace (default: 120000). Increase this value for large repositories or slow network connections. See [Git clone timed out](</docs/en/plugins/troubleshooting#git-clone-timed-out-after-120s>) `CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE`| Set to `1` to skip the re-clone attempt and keep using the existing marketplace checkout when a marketplace refresh can’t reach or authenticate to the remote. Useful in offline or airgapped environments where re-cloning would fail the same way. See [Marketplace updates fail in offline environments](</docs/en/plugins/troubleshooting#marketplace-updates-keep-failing-offline>) `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` @@ -509,9 +509,9 @@ `VERTEX_REGION_CLAUDE_4_8_OPUS`| Override region for Claude Opus 4.8 when using Google Cloud’s Agent Platform `VERTEX_REGION_CLAUDE_5_5_OPUS`| Override region for Claude Opus 5.5 when using Google Cloud’s Agent Platform. Added in v2.1.280 `VERTEX_REGION_CLAUDE_5_5_SONNET`| Override region for Claude Sonnet 5.5 when using Google Cloud’s Agent Platform. Added in v2.1.284 -`VERTEX_REGION_CLAUDE_5_OPUS`| Override region for Claude Opus 5 when using Google Cloud’s Agent Platform. Added in v2.1.219 -`VERTEX_REGION_CLAUDE_5_SONNET`| Override region for Claude Sonnet 5 when using Google Cloud’s Agent Platform. Added in v2.1.197 -`VERTEX_REGION_CLAUDE_FABLE_5`| Override region for Claude Fable 5 when using Google Cloud’s Agent Platform. Added in v2.1.170 +`VERTEX_REGION_CLAUDE_5_OPUS`| Override region for Claude Opus 5 when using Google Cloud’s Agent Platform +`VERTEX_REGION_CLAUDE_5_SONNET`| Override region for Claude Sonnet 5 when using Google Cloud’s Agent Platform +`VERTEX_REGION_CLAUDE_FABLE_5`| Override region for Claude Fable 5 when using Google Cloud’s Agent Platform `VERTEX_REGION_CLAUDE_FABLE_5_1`| Override region for Claude Fable 5.1 when using Google Cloud’s Agent Platform. Added in v2.1.257 `VERTEX_REGION_CLAUDE_FABLE_5_2`| Override region for Claude Fable 5.2 when using Google Cloud’s Agent Platform. Added in v2.1.321 `VERTEX_REGION_CLAUDE_HAIKU_4_5`| Override region for Claude Haiku 4.5 when using Google Cloud’s Agent Platform
modified Error reference View current →
--- a/errors.md +++ b/errors.md @@ -507,6 +507,13 @@ `A message is still queued` / `A /clear is still queued`, when you rewind code in VS Code| Stop Claude, then follow the rest of the message. `Couldn’t load the diff view or code colors`, in VS Code| Click a diff to try again, or reload the window. `Settings file is empty, and another program may still be writing it: <path>`, in VS Code| Try again in a minute. If the message repeats, put `{}` in the file. +`Session was interrupted`, in an SSH session in the Desktop app| [SSH session stops or fails to start](</docs/en/desktop#ssh-session-stops-or-fails-to-start>) +`Claude Code on <host> stopped when its sign-in expired`, in an SSH session in the Desktop app| [SSH session stops or fails to start](</docs/en/desktop#ssh-session-stops-or-fails-to-start>) +`Folder not found on <host>`, in an SSH session in the Desktop app| [SSH session stops or fails to start](</docs/en/desktop#ssh-session-stops-or-fails-to-start>) +`<host> doesn’t have this conversation` / `<host> doesn’t have this conversation right now`, in an SSH session in the Desktop app| [SSH session stops or fails to start](</docs/en/desktop#ssh-session-stops-or-fails-to-start>) +`Claude no longer has the earlier messages`, in an SSH session in the Desktop app| [SSH session stops or fails to start](</docs/en/desktop#ssh-session-stops-or-fails-to-start>) +`Couldn’t create a worktree on <host>`, in an SSH session in the Desktop app| [SSH session stops or fails to start](</docs/en/desktop#ssh-session-stops-or-fails-to-start>) +`Couldn’t start Claude Code on the remote host` / `Claude Code is missing on the remote host`, in an SSH session in the Desktop app| [SSH session stops or fails to start](</docs/en/desktop#ssh-session-stops-or-fails-to-start>) `Could not locate the Claude CLI on PATH`| Wrapper and IDE errors `Claude Code could not be started from <command>: it is the <system> build, and this computer needs the <build> build`| If you set [`claudeCode.claudeProcessWrapper`](</docs/en/vs-code#extension-settings>), point it at a program built for `<build>`. Otherwise, install the VS Code extension package for `<build>`. `The Claude Code program for this computer, the <build> build, could not be found`| Wrapper and IDE errors @@ -3077,7 +3084,7 @@ The list after `Available MCP tools:` names the MCP tools that were connected. **What to do:** - * Check that the server starts and stays connected: run `claude mcp list` in the same directory and confirm the server is listed as connected + * Check that Claude Code connects to the server: rerun your `claude -p` command with `--output-format stream-json --verbose`. In the [line with `"subtype":"init"`](</docs/en/headless#read-session-metadata>), confirm that the `mcp_servers` field lists the server as `connected`. If it doesn’t, see [the possible statuses and what to check](</docs/en/agent-sdk/mcp#error-handling>). * Confirm the tool name matches the `mcp__<server>__<tool>` name the server exposes * If the server needs longer than 30 seconds to start, raise [`MCP_TIMEOUT`](</docs/en/env-vars>)
modified React to events with a mod View current →
--- a/events.md +++ b/events.md @@ -1,4 +1,4 @@ -A hook is an event handler: a function that Claude Code runs when a named event happens. Claude Code fires an event at each point where it’s about to act, such as when it runs a tool, submits a prompt, sends a request to the model, or starts or ends a session. Your hook runs before Claude Code acts, so it can observe the event, rewrite it, or answer it in Claude Code’s place. You register a hook with [`on(eventName, handler)`](</docs/en/plugins/mods/reference#the-hook-function>). Build your [first mod](</docs/en/plugins/mods/create>) before you start here. For every event and its exact fields, see the [reference](</docs/en/plugins/mods/reference#events>) or read [the types for your build](</docs/en/plugins/mods/create#get-the-types-for-your-build>). +A hook is an event handler: a function that Claude Code runs when a named event happens. Claude Code fires an event at each point where it’s about to act, such as when it runs a tool, submits a prompt, sends a request to the model, or starts or ends a session. Your hook runs before Claude Code acts, so it can observe the event, rewrite it, or answer it in Claude Code’s place. You register a hook with [`on(eventName, handler)`](</docs/en/plugins/mods/reference#the-hook-function>). Build your [first mod](</docs/en/plugins/mods/create>) before you start here. For every event and its exact fields, see the [type declarations](</docs/en/plugins/mods/reference#look-up>). ## How a hook handles an event @@ -48,7 +48,7 @@ return { deny: 'Bash is turned off in this project. Use the file tools.' } }) -When Claude tries a Bash command, the command doesn’t run, and Claude reads the `deny` text as the tool’s result. Each event has its own result shape, which the [events reference](</docs/en/plugins/mods/reference#events>) lists. +When Claude tries a Bash command, the command doesn’t run, and Claude reads the `deny` text as the tool’s result. Each event has its own result shape, which the [type declarations](</docs/en/plugins/mods/reference#look-up>) list. ### Filter which events a hook handles @@ -71,7 +71,7 @@ ## Hook what Claude is doing -Handle these events to see or change a tool call, a prompt, a turn, or a settings read as it happens. For every event and what a hook can return, see the [events reference](</docs/en/plugins/mods/reference#events>). +Handle these events to see or change a tool call, a prompt, a turn, or a settings read as it happens. For every event and what a hook can return, see the [type declarations](</docs/en/plugins/mods/reference#look-up>). ### Guard or change a tool call @@ -145,7 +145,7 @@ #### Approve or refuse a tool call before the user is asked -To decide whether a tool call may run, handle [`tool.check`](</docs/en/plugins/mods/reference#tools>), the event where Claude Code makes that decision. For a fixed command or path, use a [permission rule](</docs/en/permissions#permission-rule-syntax>) such as `Bash(npm test)`, which takes no code. Handle `tool.check` when the decision depends on what’s true at that moment, such as the current Git branch or a value another hook recorded. +To decide whether a tool call may run, handle `tool.check`, the event where Claude Code makes that decision. For a fixed command or path, use a [permission rule](</docs/en/permissions#permission-rule-syntax>) such as `Bash(npm test)`, which takes no code. Handle `tool.check` when the decision depends on what’s true at that moment, such as the current Git branch or a value another hook recorded. * **What to return** : to decide the call yourself, return an object of your own, such as `{ decision: 'allow' }` or `{ decision: 'deny', reason }`. To leave the decision alone, return what `await next(e)` gives you. * **What`await next(e)` gives you**: Claude Code’s own decision, as an object whose `decision` is `allow`, `ask`, or `deny`. No permission prompt appears while `next(e)` runs. @@ -234,7 +234,7 @@ #### Change system prompt, context, or skill text -[Other events](</docs/en/plugins/mods/reference#prompts-and-what-claude-reads>) cover the rest of what Claude reads: `prompt.section` for each section of the system prompt, `prompt.context` for the context sent with the first message, and `skill.prompt` for a skill’s text. To change a section after a conversation has started, see [Send a changed system prompt section or tool description](</docs/en/plugins/mods/reference#break-prompt-cache>). In a `skill.prompt` hook, you can also read [which plugin or file the skill came from](</docs/en/plugins/mods/reference#skill-prompt-fields>). +[Other events](</docs/en/plugins/mods/reference#prompts-and-what-claude-reads>) cover the rest of what Claude reads: `prompt.section` for each section of the system prompt, `prompt.context` for the context sent with the first message, and `skill.prompt` for a skill’s text. To change a section after a conversation has started, see [Send a changed system prompt section or tool description](</docs/en/plugins/mods/reference#break-prompt-cache>). In a `skill.prompt` hook, you can also read which plugin or file the skill came from, in `e.pluginName` and `e.path`. Those fields require Claude Code v2.1.299 or later. ### Follow a turn @@ -386,7 +386,7 @@ * **`guard` failed before it called `next`**: the command doesn’t run, and Claude reads the `deny` text with the kind at the end * **`guard` failed after it called `next`**: the handler’s `next(e)` resolves to the result that `guard`’s call produced without running the command again, and Claude reads that result -The handler has a shorter [time limit](</docs/en/plugins/mods/reference#limits>) of its own. If the handler itself throws or times out, Claude Code skips the hook as if it had no handler. When `guard` hadn’t called `next`, the command then goes on as it would without the mod. The same handler shape fits a guard on `prompt.submit` or `config.set`. When `next.called` is false, return the refusal that the [events reference](</docs/en/plugins/mods/reference#events>) lists for that event: `{ drop: 'the reason' }` for `prompt.submit`, `{ deny: 'the reason' }` for `config.set`. At `tool.check` and `plugin.register`, a refusal returned after `next` resolved still holds, so return it without testing `next.called`: +The handler has a shorter [time limit](</docs/en/plugins/mods/reference#limits>) of its own. If the handler itself throws or times out, Claude Code skips the hook as if it had no handler. When `guard` hadn’t called `next`, the command then goes on as it would without the mod. The same handler shape fits a guard on `prompt.submit` or `config.set`. When `next.called` is false, return the refusal for that event: `{ drop: 'the reason' }` for `prompt.submit`, `{ deny: 'the reason' }` for `config.set`. At `tool.check` and `plugin.register`, a refusal returned after `next` resolved still holds, so return it without testing `next.called`: * **`tool.check`** : return `{ decision: 'deny', reason: 'the reason' }` * **`plugin.register`** : return `{ refuse: 'the reason' }`. On v2.1.326 or later, the other mod’s whole plugin then stays out. To stop only the mod, see [Refuse mods when your check fails](</docs/en/plugins/mods/admin#refuse-mods-when-your-check-fails>). @@ -398,4 +398,4 @@ * [Use the mods API](</docs/en/plugins/mods/api>): add commands and tools, call a model, and run work on a timer * [Draw in the interface](</docs/en/plugins/mods/interface>): show what your hooks collect in a pane or above the prompt * [Test a mod](</docs/en/plugins/mods/test>): fire any of these events from a test - * [Mods reference](</docs/en/plugins/mods/reference>): every event, every mods API method, and the limits + * [Mods reference](</docs/en/plugins/mods/reference>): where to look up an event, and the limits
modified Interface gallery for mods View current →
--- a/gallery.md +++ b/gallery.md @@ -1,4 +1,4 @@ -A mod draws its interface from elements: text, boxes, buttons, fields, and a few that format content for you. The samples here show the code that draws an element, and most come with a screenshot of the result in a terminal pane, so you can pick an element by how it looks. To learn how drawing works, start with [Draw in the interface](</docs/en/plugins/mods/interface>). For the main props and which apps draw each element, see the [elements reference](</docs/en/plugins/mods/reference#elements>). The [type declarations](</docs/en/plugins/mods/create#get-the-types-for-your-build>) list every prop. +A mod draws its interface from elements: text, boxes, buttons, fields, and a few that format content for you. The samples here show the code that draws an element, and most come with a screenshot of the result in a terminal pane, so you can pick an element by how it looks. To learn how drawing works, start with [Draw in the interface](</docs/en/plugins/mods/interface>). For which apps draw each element, see [Build a tree from elements](</docs/en/plugins/mods/interface#build-a-tree-from-elements>). The [type declarations](</docs/en/plugins/mods/reference#look-up>) list every prop. ## Try a sample @@ -76,7 +76,7 @@ Swap in a sample -Copy a sample from this page. In `register.js`, paste it over `Text({ children: ['Plain text'] })`, so that it follows `return`, and save the file. Claude Code reloads the module each time you save, so run `/gallery` again to see the new sample. +Copy a sample from this page. In `register.js`, paste it over `Text({ children: ['Plain text'] })`, so that it follows `return`, and save the file. Run `/gallery` again to see the new sample. ## Pick an element @@ -285,7 +285,7 @@ ### `Image` and `Client` -`Image` and `Client` have no sample here. `Image` draws a PNG or raw pixels in the terminal. `Client` is a region that a second file of yours draws, for animation and pointer input. The [elements reference](</docs/en/plugins/mods/reference#elements>) lists their props. An `Image` draws as a picture in these terminals: +`Image` and `Client` have no sample here. `Image` draws a PNG or raw pixels in the terminal. `Client` is a region that a second file of yours draws, for animation and pointer input. The [type declarations](</docs/en/plugins/mods/reference#look-up>) list their props. An `Image` draws as a picture in these terminals: * kitty 0.28 or later * Ghostty @@ -334,4 +334,4 @@ * [Draw in the interface](</docs/en/plugins/mods/interface>): build a pane with tabs, step by step * [Test a drawing](</docs/en/plugins/mods/test#test-a-drawing>): press your buttons from a test - * [Elements reference](</docs/en/plugins/mods/reference#elements>): each element’s main props and the apps that draw it + * [Elements reference](</docs/en/plugins/mods/reference#elements>): border styles and the props the VS Code extension ignores
modified Interactive mode View current →
--- a/interactive-mode.md +++ b/interactive-mode.md @@ -435,7 +435,7 @@ ## Check spelling as you type -Claude Code can underline misspelled words in the prompt input while you type. It checks only the text in the input box, never Claude’s replies or your files. It also checks nothing while the input box is in shell mode, `Ctrl+R` history search, or [voice dictation](</docs/en/voice-dictation>). Spell checking is off by default, and Claude Code checks nothing in [screen reader mode](</docs/en/accessibility>). Requires Claude Code v2.1.235 or later. +Claude Code can underline misspelled words in the prompt input while you type. It checks only the text in the input box, never Claude’s replies or your files. It also checks nothing while the input box is in shell mode, `Ctrl+R` history search, or [voice dictation](</docs/en/voice-dictation>). Spell checking is off by default, and Claude Code checks nothing in [screen reader mode](</docs/en/accessibility>). ### Prerequisites
modified Draw in the interface with a mod View current →
Show diff (108 lines)
--- a/interface.md +++ b/interface.md @@ -1,6 +1,6 @@ -A mod can draw its own interface in Claude Code and change parts of the interface Claude Code already draws. Each place a mod can draw is called a [render site](</docs/en/plugins/mods/reference#render-sites>), such as a pane, the band above the prompt, or the spinner. Claude Code fires the [`ui.render`](</docs/en/plugins/mods/reference#interface>) event each time it’s about to draw a render site, and your hook for that event returns what to draw there. This map shows where a mod can draw in a terminal session: In a narrower terminal, the pane sits above the prompt instead of beside the transcript. Build your [first mod](</docs/en/plugins/mods/create>) before you start here. Begin with the worked example, which builds a pane with two tabs and a counter, then read the section for each piece you want to change. - -To look up one prop or limit, see the [reference](</docs/en/plugins/mods/reference#render-sites>). +A mod can draw its own interface in Claude Code and change parts of the interface Claude Code already draws. Each place a mod can draw is called a [render site](</docs/en/plugins/mods/reference#render-sites>), such as a pane, the band above the prompt, or the spinner. Claude Code fires the `ui.render` event each time it’s about to draw a render site, and your hook for that event returns what to draw there. This map shows where a mod can draw in a terminal session: In a narrower terminal, the pane sits above the prompt instead of beside the transcript. Build your [first mod](</docs/en/plugins/mods/create>) before you start here. Begin with the worked example, which builds a pane with two tabs and a counter, then read the section for each piece you want to change. + +To look up one prop or limit, see the [reference](</docs/en/plugins/mods/reference>). ## Build a pane with tabs @@ -238,7 +238,7 @@ ### Open a pane at the right time -A pane appears only when your mod opens it. How and when you open it decides whether it takes keyboard focus, how much room it asks for, and whether it shows at all in a narrow terminal. To open a pane, call [`$.ui.open`](</docs/en/plugins/mods/reference#mods-api-methods>) with an `id` you choose. The `id` is the pane’s name: your `ui.render` hook checks for it, and you pass it again to close the pane. If another mod has a pane open with that `id`, the call rejects. +A pane appears only when your mod opens it. How and when you open it decides whether it takes keyboard focus, how much room it asks for, and whether it shows at all in a narrow terminal. To open a pane, call `$.ui.open` with an `id` you choose. The `id` is the pane’s name: your `ui.render` hook checks for it, and you pass it again to close the pane. If another mod has a pane open with that `id`, the call rejects. await $.ui.open({ id: 'hello-tabs', title: 'Hello tabs', focus: true }) @@ -279,7 +279,7 @@ ### Draw in the VS Code extension -In the VS Code extension, what a mod draws appears in the chat panel with extension version 2.1.299 or later. A session that [doesn’t fetch feature flags](</docs/en/env-vars#features-that-need-feature-flag-fetching>), such as one on Amazon Bedrock, needs 2.1.304 or later. In a `ui.render` hook for the panel, `e.surface` is `vscode`. To check which sites and elements the panel draws, and which props it ignores, see the [render sites](</docs/en/plugins/mods/reference#render-sites>) and [elements](</docs/en/plugins/mods/reference#elements>) tables. To make a mod work in the panel as well as the terminal, account for these differences: +In the VS Code extension, what a mod draws appears in the chat panel with extension version 2.1.299 or later. A session that [doesn’t fetch feature flags](</docs/en/env-vars#features-that-need-feature-flag-fetching>), such as one on Amazon Bedrock, needs 2.1.304 or later. In a `ui.render` hook for the panel, `e.surface` is `vscode`. To check what the panel draws, see the [render sites](</docs/en/plugins/mods/reference#render-sites>) and elements tables and the [props it ignores](</docs/en/plugins/mods/reference#vs-code-ignored-props>). To make a mod work in the panel as well as the terminal, account for these differences: * **Panes** : in a panel 800 pixels or wider, panes dock beside the conversation, `e.props.placement` is `'dock'`, and `e.viewport.isFullscreen` is `true`. In a narrower panel, panes draw above the prompt box, `placement` is `'inline'`, and a pane shows 12 rows before it scrolls. * **Toasts and status lines** : these sit in one stack directly above the prompt box, together with the panes when the panel is narrow, with one status line per mod. The stack is hidden while a permission request or a dialog shows. @@ -298,7 +298,7 @@ Place the row -Call [`$.ui.place`](</docs/en/plugins/mods/reference#mods-api-methods>) with an `id`. The `id` is a name you make up for the row, such as `build-status`. It can be 1 to 64 letters, digits, `_`, or `-`, and each row your mod has in the transcript needs its own. +Call `$.ui.place` with an `id`. The `id` is a name you make up for the row, such as `build-status`. It can be 1 to 64 letters, digits, `_`, or `-`, and each row your mod has in the transcript needs its own. 2 @@ -846,6 +846,8 @@ `Client`| A region drawn by a second file of yours, for animation and pointer input. That file gets no mods API. It reaches your hooks by posting data, which arrives as a `ui.message` event. If it fails to load, draw, or run, your hooks receive a [`ui.fault`](</docs/en/plugins/mods/reference#interface>) event.| Terminal, Desktop `Raster`, `Image`| A grid of colored cells, and a picture| Terminal +Spacing step names and the `Text` props `size`, `weight`, `mono`, and `tabular` require Claude Code v2.1.299 or later. On an earlier release, a tree that uses one doesn’t draw. + If your module is a `.tsx` or `.jsx` file, you can write the tree as JSX. Destructure the elements from `$.ui.resolve(e)` first. If your drawing doesn’t show up, check its tree for a prop an element doesn’t take or a child where none goes. A hook that returns such a tree [fails](</docs/en/plugins/mods/events#handle-a-hook-that-fails>), and a [`hook skipped` line](</docs/en/plugins/mods/troubleshoot#a-pane-or-band-is-empty>) names your mod and the rule the tree broke. For a `Text` in a pane with a prop named `bogusProp`, that line reads: my-mod: ui.render hook skipped: returned the wrong shape (a tree Pane refuses: Text prop "bogusProp" is not allowed) @@ -862,7 +864,7 @@ ### When a `Client` fails -In the terminal, when the file a `Client` runs fails, a dimmed line such as `my-mod: Client client/spinner.js: boom` takes the `Client`’s place, and the rest of your drawing still shows. If your mod handles [`ui.fault`](</docs/en/plugins/mods/reference#interface>), Claude Code then draws the site again. +In the terminal, when the file a `Client` runs fails, a dimmed line such as `my-mod: Client client/spinner.js: boom` takes the `Client`’s place, and the rest of your drawing still shows. If your mod handles `ui.fault`, Claude Code then draws the site again. The event requires Claude Code v2.1.289 or later. ### Draw a grid of colored cells @@ -917,7 +919,7 @@ ### Keyboard focus and hotkeys -Your mod never reads the keyboard itself. The user presses a key, Claude Code decides which of your controls it’s for, and that control’s callback runs. Apart from a [digit hotkey on the band or an `action` binding](</docs/en/plugins/mods/reference#elements>), that happens only while your pane or band has keyboard focus. The rest of the time, keys go to the prompt. In the VS Code extension, buttons have no hotkeys: the user clicks a button or presses Enter on it, and types into fields. +The user presses a key, Claude Code decides which of your controls it’s for, and that control’s callback runs. Apart from a [digit hotkey on the band or an `action` binding](</docs/en/plugins/mods/reference#look-up>), that happens only while your pane or band has keyboard focus. In the VS Code extension, buttons have no hotkeys: the user clicks a button or presses Enter on it, and types into fields. #### How a pane gets keyboard focus @@ -959,7 +961,7 @@ With brackets, the default| `[ Add one ]`, with no hotkey shown| The label with a small key beside it| The label, and the hotkey does nothing With `plain: true`| `1: One`| The label with a small key beside it| The label, and the hotkey does nothing -In the terminal, name the key in a bracketed button’s label, or use `plain: true`, so the user can see what to press. The [elements reference](</docs/en/plugins/mods/reference#elements>) has the other `Button` rules: `action`, digit hotkeys on the band, and two buttons on one hotkey. +In the terminal, name the key in a bracketed button’s label, or use `plain: true`, so the user can see what to press. The [type declarations](</docs/en/plugins/mods/reference#look-up>) have the other `Button` rules: `action`, digit hotkeys on the band, and two buttons on one hotkey. #### When the user collapses the band @@ -972,7 +974,7 @@ ▸ plugin panel hidden · ctrl+x ctrl+a or click to show -The same keys, or in fullscreen rendering a click on the row, expand the band again. Until then, nothing presses a button in it: no hotkey, no digit typed into an empty prompt, and no keybinding for a button’s [`action`](</docs/en/plugins/mods/reference#elements>). If the band has keyboard focus when the user collapses it, the focus returns to the prompt, and Ctrl+X then Tab skips the band while it’s collapsed. The band stays collapsed until the user expands it, even after `/clear`, and is expanded again the next time Claude Code starts. Your mod can’t expand it. Don’t make the band the only place your mod shows something the user has to answer. To show that elsewhere only while the band is collapsed, read `e.props.isCollapsed` in your `ui.render` hook, which keeps running. `isCollapsed` requires Claude Code v2.1.321 or later. +The same keys, or in fullscreen rendering a click on the row, expand the band again. Until then, nothing presses a button in it. If the band has keyboard focus when the user collapses it, the focus returns to the prompt, and Ctrl+X then Tab skips the band while it’s collapsed. The band stays collapsed until the user expands it, even after `/clear`, and is expanded again the next time Claude Code starts. Your mod can’t expand it. Don’t make the band the only place your mod shows something the user has to answer. To show that elsewhere only while the band is collapsed, read `e.props.isCollapsed` in your `ui.render` hook, which keeps running. `isCollapsed` requires Claude Code v2.1.321 or later. ### Take typed input and draw a row for each item @@ -1067,7 +1069,7 @@ ### When Claude Code redraws without being asked -Claude Code runs your `ui.render` hook again when the site’s props change or the terminal’s width changes. When a `Client` in the site fails and your mod handles [`ui.fault`](</docs/en/plugins/mods/reference#interface>), Claude Code runs the hook once more after your `ui.fault` hooks return, so your `ui.render` hook can leave the `Client` out. It doesn’t run the hook on a timer, and it can’t tell when a variable in your module changes. +Claude Code runs your `ui.render` hook again when the site’s props change or the terminal’s width changes. When a `Client` in the site fails and your mod handles `ui.fault`, Claude Code runs the hook once more after your `ui.fault` hooks return, so your `ui.render` hook can omit the `Client`. It doesn’t run the hook on a timer, and it can’t tell when a variable in your module changes. ### Redraw when your data changes @@ -1120,7 +1122,7 @@ Keep it in| It lasts until| Use it for ---|---|--- -A module-level variable| The module reloads, which happens every time you save a file during development| Values you can lose, as `tab` is in `hello-tabs` +A module-level variable| The module reloads, such as when you edit the module during development| Values you can lose, such as `tab` in `hello-tabs` `$.state`| The session ends, or the user runs `/clear`, `/resume`, or `/branch`| Values a drawing depends on that should survive a reload `$.store`| Your mod deletes it, or no session reads or writes the store for [`cleanupPeriodDays`](</docs/en/settings-reference#cleanupperioddays>). In an Anthropic-hosted cloud session, values can be missing sooner.| Settings, history, anything the user expects to find next time @@ -1247,4 +1249,4 @@ * [React to events](</docs/en/plugins/mods/events>): feed your drawing from tool calls and turns * [Use the mods API](</docs/en/plugins/mods/api>): feed your drawing from timers and model calls * [Test a drawing](</docs/en/plugins/mods/test#test-a-drawing>): press your buttons from a test, on more than one surface - * [Render sites](</docs/en/plugins/mods/reference#render-sites>) and [elements](</docs/en/plugins/mods/reference#elements>): each site’s props and each element’s props + * [Mods reference](</docs/en/plugins/mods/reference>): where to look up a prop, which app draws each site, and the limits
modified Marketplace reference View current →
--- a/marketplace-reference.md +++ b/marketplace-reference.md @@ -45,7 +45,7 @@ `description`| string| Marketplace description shown to users. `claude plugin validate` warns when it’s missing `version`| string| Marketplace manifest version `metadata.description`, `metadata.version`| string| Alternate location for `description` and `version` -`metadata.pluginRoot`| string| Directory that bare plugin source names resolve under. See Relative path plugin source. Requires Claude Code v2.1.239 or later +`metadata.pluginRoot`| string| Directory that bare plugin source names resolve under. See Relative path plugin source `forceRemoveDeletedPlugins`| boolean| When `true`, a plugin you remove from `plugins` is uninstalled on users’ machines. See [Host and maintain a marketplace](</docs/en/plugins/host-marketplace>) `allowCrossMarketplaceDependenciesOn`| array of strings| Marketplace names whose plugins may be installed as dependencies of this marketplace’s plugins. When you install a plugin, only the list in that plugin’s own marketplace applies, for its whole dependency chain. See [Plugin dependencies](</docs/en/plugins/dependencies>) `renames`| object| Map from a former plugin `name` to its current name, or to `null` for a plugin you removed. See [Host and maintain a marketplace](</docs/en/plugins/host-marketplace>) @@ -160,7 +160,7 @@ #### Bare names under pluginRoot -A bare name is a single directory name with no `/`, such as `"formatter"`. To write bare names instead of `./` paths, set `metadata.pluginRoot` to the directory they resolve under. With `"pluginRoot": "./plugins"`, `"source": "formatter"` resolves to `./plugins/formatter`. Requires Claude Code v2.1.239 or later. `metadata.pluginRoot` has these limits: +A bare name is a single directory name with no `/`, such as `"formatter"`. To write bare names instead of `./` paths, set `metadata.pluginRoot` to the directory they resolve under. With `"pluginRoot": "./plugins"`, `"source": "formatter"` resolves to `./plugins/formatter`. `metadata.pluginRoot` has these limits: * It must itself be a relative path inside the marketplace. * It has no effect on a source that already starts with `./`.
modified Model configuration View current →
--- a/model-config.md +++ b/model-config.md @@ -230,16 +230,28 @@ Delivery mechanism| CLI and IDE| Desktop local sessions| Web, mobile, and cloud sessions| Agent SDK and non-interactive| Cowork ---|---|---|---|---|--- -[Server-managed settings](</docs/en/server-managed-settings>) from the admin console| Enforced| Enforced| Enforced, but not delivered to [Claude Tag](<https://claude.com/docs/claude-tag/overview>) sessions or to sessions on a self-hosted runner that [uses Amazon Bedrock or Google Cloud’s Agent Platform](</docs/en/self-hosted-environments-configuration#what-differs-from-sessions-on-the-anthropic-api>)| Enforced| Remote Cowork sessions: the server checks the model. On the user’s machine: not delivered. +[Server-managed settings](</docs/en/server-managed-settings>) from the admin console| Enforced| Enforced| Enforced, but not delivered to [Claude Tag](<https://claude.com/docs/claude-tag/overview>) sessions or to sessions on a self-hosted runner that [uses Amazon Bedrock or Google Cloud’s Agent Platform](</docs/en/self-hosted-environments-configuration#what-differs-from-sessions-on-the-anthropic-api>)| Enforced| Not delivered. See When the allowlist limits Cowork. [MDM or managed settings files](</docs/en/managed-settings#delivery-mechanisms>)| Enforced| Enforced| Not delivered in Anthropic-hosted environments; in [self-hosted environments](</docs/en/self-hosted-environments>), enforced from the runner image per [how Claude Code combines managed sources](</docs/en/managed-settings#how-claude-code-combines-managed-sources>)| Enforced| Enforced where deployed * [Cloud sessions](</docs/en/claude-code-on-the-web>), including those you start from the Desktop app, run on Anthropic-managed VMs by default: settings deployed to your device do not reach them, so deliver the allowlist through server-managed settings. Sessions your organization routes to a [self-hosted environment](</docs/en/self-hosted-environments>) run on your own compute and also read the managed settings file in the runner image. [How Claude Code combines managed sources](</docs/en/managed-settings#how-claude-code-combines-managed-sources>) says when that file applies. A mid-session model switch in a cloud session is rejected when the requested model is excluded by the allowlist. When the `availableModels` list in your server-managed settings is non-empty, the server rejects a request to start a cloud session at claude.ai/code or from the Desktop app on a model the list excludes. * [Claude Tag](<https://claude.com/docs/claude-tag/overview>) sessions run in cloud environments but don’t receive server-managed settings; in a [self-hosted environment](</docs/en/self-hosted-environments>), they still read the managed settings file in the runner image. To set the model for those sessions, see [Choose the model for a scope](<https://claude.com/docs/claude-tag/admins/customize#choose-the-model-for-a-scope>) in the Claude Tag admin guide. - * Cowork, the agentic-work tab in the Claude Desktop app, runs its sessions on Claude Code but, by design, does not receive server-managed settings from the claude.ai admin console. When the `availableModels` list in your server-managed settings is non-empty and a user picks a model outside it, the server rejects that model for a remote Cowork session. A managed settings file applies to Cowork sessions when it is present where the session runs; remote Cowork sessions run on Anthropic-managed VMs, where a device-deployed file is not present. + * Cowork, the agentic-work tab in the Claude Desktop app, runs its sessions on Claude Code but, by design, does not receive server-managed settings from the claude.ai admin console. claude.ai can apply the `availableModels` list in those settings to Cowork. + * A managed settings file applies to Cowork sessions when it is present where the session runs; remote Cowork sessions run on Anthropic-managed VMs, where a device-deployed file is not present. * For sessions on [third-party providers](</docs/en/server-managed-settings#platform-availability>) such as Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), deliver the allowlist through MDM or managed settings files. * Delivery from the admin console requires the session to fetch with an [eligible login](</docs/en/server-managed-settings#platform-availability>) to your organization or an OAuth token issued for it. For fleets that authenticate with API keys, whether configured directly or generated by an [`apiKeyHelper`](</docs/en/settings-reference#apikeyhelper>) script, deliver the allowlist through MDM or managed settings files. * The Desktop Code tab also hosts [SSH sessions](</docs/en/desktop#ssh-sessions>), which read the managed settings file from the remote host they run on. See [Desktop managed settings](</docs/en/desktop#managed-settings>). - * The model pickers on claude.ai and in the Desktop app hide or grey out models excluded by your organization’s allowlist. The picker state is a convenience for users; it doesn’t enforce the allowlist. + * Claude Code’s model pickers on claude.ai and in the Desktop app hide or grey out models excluded by your organization’s allowlist. The picker state is a convenience for users; it doesn’t enforce the allowlist. + +#### When the allowlist limits Cowork + +On Team plans, claude.ai applies a non-empty `availableModels` list from your [server-managed settings](</docs/en/server-managed-settings>) to Cowork. On Enterprise plans, it does the same until Anthropic turns this off for your organization. With the list applied: + + * **Model picker** : Cowork’s picker normally hides or greys out the models outside the list, wherever the session runs + * **Remote Cowork sessions** : the server also checks the model a user picks, and rejects one outside the list + * **Unified conversations** : a conversation in the [new unified Claude experience](<https://support.claude.com/en/articles/17444462-set-up-and-manage-the-new-unified-claude-experience-for-your-enterprise-organization>) isn’t checked until it runs in a remote Cowork session, for example to run code or work with files. One that moves there on a model outside the list normally switches to a listed model with no notice. There, a pick outside the list fails, normally with a message starting `Your organization's settings don't allow this model here`. + * **Sessions on the user’s machine** : the list isn’t enforced beyond the picker. [Where and when a policy applies](</docs/en/managed-settings#where-and-when-a-policy-applies>) covers which device policy reaches those sessions. + +After Anthropic turns this off, claude.ai doesn’t apply the list to members’ Cowork sessions or unified conversations. Claude Code outside Cowork still follows it. Models outside the list can then appear in Cowork’s picker, and a member whose default model in Cowork is outside the list can start on it without picking it. A scheduled Cowork task saved on such a model can run on it. On an Enterprise plan, don’t count on the list to keep a model out of Cowork or unified conversations. No setting shows whether Anthropic has turned this off. For any model but Haiku, disable it in [**Organization settings > Models**](<https://claude.ai/admin-settings/models>), which sets organization model restrictions. You can’t disable a model there for one product alone, so members lose it in Claude Code and chat as well as Cowork. ### Default model behavior
modified Output styles View current →
--- a/output-styles.md +++ b/output-styles.md @@ -30,7 +30,7 @@ ### Concise -In the Concise style, the first sentence of a response states what happened or what the answer is. Claude leaves out the lead-in, the step-by-step narration, and the closing recap, and answers a simple question in one to three sentences. It does the engineering work as thoroughly as in the Default style. Requires Claude Code v2.1.237 or later. Claude still writes at full length in these cases: +In the Concise style, the first sentence of a response states what happened or what the answer is. Claude leaves out the lead-in, the step-by-step narration, and the closing recap, and answers a simple question in one to three sentences. It does the engineering work as thoroughly as in the Default style. Claude still writes at full length in these cases: * **Anything you ask for** : when you ask for an explanation or more detail, Claude answers in full. * **Anything you need in order to act safely** : error reports, failing test output, security warnings, and confirmations for destructive actions keep their complete content.
modified Mods reference View current →
Show diff (482 lines)
--- a/reference.md +++ b/reference.md @@ -1,6 +1,16 @@ -Look up any event a [mod](</docs/en/plugins/mods/overview>) can handle, mods API method it can call, or render site it can draw in. Entries cover the Claude Code CLI and the Desktop app as of v2.1.290, and the VS Code extension as of v2.1.299. Each entry gives the name and a one-line description, and links to the guide section that explains it where there is one. - -The complete reference is Claude Code’s [TypeScript declarations for mods](<https://github.com/anthropics/claude-code/blob/main/mods/types/claude-code.d.ts>), which describe every event, method, and element, with examples. The copy on GitHub can be older than the Claude Code version you have installed. When the two disagree, trust [the copy Claude Code writes for your version](</docs/en/plugins/mods/create#get-the-types-for-your-build>). +The [type declarations on GitHub](<https://github.com/anthropics/claude-code/blob/main/mods/types/claude-code.d.ts>) document the events, mods API methods, and props a [mod](</docs/en/plugins/mods/overview>) can use. Start with how to search the declarations, or go to a mod’s files, render sites by app, or limits. + +## Look up an event, method, or prop + +To look up a name, open the [type declarations on GitHub](<https://github.com/anthropics/claude-code/blob/main/mods/types/claude-code.d.ts>) and search for the name in one of these forms: + + * **An event** : its name in quotes, such as `'tool.call'`. The entry names the type that holds the event’s fields, so search for that type next. + * **A hook’s`next` argument**: `type Next<` + * **A mods API method** : its namespace, a colon, and a brace, such as `fs: {` for `$.fs.write`. The namespace’s methods follow. + * **Arender site’s props**: the site’s name and a colon, such as `AbovePrompt:` + * **An element’s props** : the element’s name and `Props`, such as `ButtonProps` + +The comment above an entry says what the event, method, or prop does. If your browser’s search misses a name on GitHub, search the [raw file](<https://raw.githubusercontent.com/anthropics/claude-code/main/mods/types/claude-code.d.ts>). The GitHub copy can describe a newer or older Claude Code version than you run. For your version’s declarations, search the [copy Claude Code writes](</docs/en/plugins/mods/create#get-the-types-for-your-build>) into your mod’s directory. ## Files @@ -16,188 +26,35 @@ `register` receives `on` and `options`. `options` holds the values of the [`userConfig`](</docs/en/plugins/components#user-configuration>) fields the manifest declares, with defaults filled in. -## The hook function - -A mod registers each of its hooks, which are event handlers, by calling `on` inside `register`. `on` takes the event’s name, an optional [matcher](</docs/en/plugins/mods/events#filter-which-events-a-hook-handles>), which is a filter on the event’s fields, and the hook, as in `on('tool.call', { tool: 'Bash' }, async ($, e, next) => next(e))`. `on` returns a registration with one method, `.catch(handler)`, which sets the hook’s [error handler](</docs/en/plugins/mods/events#handle-a-hook-that-fails>). - -Argument| What it is ----|--- -[`$`](</docs/en/plugins/mods/events#how-a-hook-handles-an-event>)| The mods API: every method in mods API methods. Write each call in full, namespace then method, as in `$.fs.read('notes.md')`. -[`e`](</docs/en/plugins/mods/events#how-a-hook-handles-an-event>)| The event’s input. To change it, pass a copy to `next`. -[`next(e)`](</docs/en/plugins/mods/events#how-a-hook-handles-an-event>)| The next handler, as in middleware. Runs the hooks after this one, then Claude Code’s behavior. Resolves to the event’s result. -[`next.signal`](</docs/en/plugins/mods/api#stop-background-work>)| An `AbortSignal` that aborts when the event is abandoned -`next.origin`| `{ plugin, tier }` of whoever fired the event. Claude Code itself is `{ plugin: 'engine', tier: 'core' }`. A mod’s `tier` is its priority group in the [order mods run in](</docs/en/plugins/mods/events#the-order-mods-run-in>): `prepend`, `user`, `append`, or `builtin`. -`next.budget`| The hook’s time limit in milliseconds: `next.budget.ms` is the whole limit, and `next.budget.remainingMs` is what’s left now -`next.to(e, tier)`| Skips to a later tier, which is `append`, `builtin`, or `core`. `next.to(e, 'append')` skips the mods a user installed. Only a mod in `prependPlugins` or `appendPlugins` can call it. -`next.error`| In a `.catch` handler only. `kind` is `throw` or `timeout`, and `message` is the error’s text. -`next.called`| In a `.catch` handler only. `true` when the hook had called `next`. - -## Events - -Events are grouped by what they concern, each with when it fires and what a hook on it can return. Hooks on `turn.step` and `process.spawn` are async generators, and other hooks are async functions. The last column of each table uses shorthand. `next(e)` passes the event on unchanged. `next({ ...e, text })` passes on a copy with the named field changed, as in `next({ ...e, text: e.text.trim() })`. An object answers the event without calling `next`, and a word such as `reason` stands for a string you write, as in `{ deny: 'Use the file tools.' }`. - -### Tools - -Tool events fire around each tool call Claude makes, from the description Claude reads to the decision on whether the call runs: - -Event| Fires when| A hook can return ----|---|--- -[`tool.call`](</docs/en/plugins/mods/events#guard-or-change-a-tool-call>)| A tool is about to run| `next(e)`, `{ deny: reason }`, or `{ result }` -[`tool.check`](</docs/en/plugins/mods/events#where-settings-hooks-run-in-the-order>)| Claude Code decides whether a tool call may run, after the `tool.call` and `PreToolUse` hooks. `next(e)` resolves to the decision the rules, the permission mode, and those hooks reached.| `next(e)` or `{ decision }`, with `decision` set to `allow`, `ask`, or `deny` and an optional `reason` -`tool.judge`| [Auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) is about to ask its classifier about a call. Requires Claude Code v2.1.326 or later.| `next(e)` or `{ decision }` -`tool.run`| An allowed call is about to run. Requires Claude Code v2.1.326 or later.| `next(e)`, `{ deny: reason }`, or `{ result }` -`tool.describe`| Once for each tool, when its description is first sent to Claude. A second time for an MCP tool when Claude loads it through [tool search](</docs/en/mcp#scale-with-mcp-tool-search>), with `e.description` set to the text Claude reads for the loaded tool.| `{ description }`, optionally with `isDeferred` set to `true` to put the tool behind tool search or `false` to load it upfront. Add `breakPromptCache: true` to send a changed description on the next turn. -`tool.offer`| Claude Code builds Claude’s tool list, and again when Claude calls a tool. Requires Claude Code v2.1.328 or later.| `next(e)`, or `{ isOffered: false }` to withhold the tool from Claude. See Send a changed tool list. - -#### Agent and organization fields on `tool.check` - -In a `tool.check` hook, read these fields to tell a subagent’s call from the main conversation’s, and to see whether your organization requires approval for a connector tool: - - * **`e.agentId`** : set when a [subagent](</docs/en/sub-agents>) or an [in-process teammate](</docs/en/agent-teams#choose-a-display-mode>) makes the call, and absent when the main conversation does - * **`e.ceiling`** : `ask` for a connector tool your organization set to `ask`, in [sessions where that setting reaches Claude Code](</docs/en/mcp#organization-controls-on-connector-tools>) - -On `tool.check`, `e.agentId` and `e.ceiling` require Claude Code v2.1.290 or later. - -#### The `e.isReadOnly` field on `tool.check` - -In a `tool.check` hook, `e.isReadOnly` is `true` when the tool reports this call as read-only. Otherwise the field is absent, not `false`. The value is the tool’s own report, so read [Check whether a tool call is read-only](</docs/en/plugins/mods/events#check-whether-a-tool-call-is-read-only>) before you approve a call on this field alone. On `tool.check`, `e.isReadOnly` requires Claude Code v2.1.304 or later. - -### Prompts and what Claude reads - -Prompt events cover the text the user types and the text Claude Code sends to Claude on its own, such as the system prompt and reminders: - -Event| Fires when| A hook can return ----|---|--- -[`prompt.submit`](</docs/en/plugins/mods/events#rewrite-or-add-to-a-prompt>)| A prompt is submitted| `next({ ...e, text })`, `next({ ...e, context })`, or `{ drop: reason }` -`prompt.fill`, `prompt.suggest`| Text is about to go into the prompt box as a draft, or as a dim suggestion| `next(e)` with changed text -`prompt.edit`| The user edits the prompt box| `next(e)` -`prompt.autocomplete`| The user types in the prompt box and a word ends at the cursor. `e.token` is that word. Claude Code doesn’t wait for the hook: its own autocomplete rows show first.| `{ suggestions }`, a list of `{ text, label, description }` rows shown below Claude Code’s own. Choosing a row writes its `text` over the word. -`prompt.compose`| Claude Code renders a system prompt| `{ sections }`, a list of `{ id, text, scope }` in the order they’re sent -[`prompt.section`](</docs/en/plugins/mods/events#rewrite-or-add-to-a-prompt>)| Once for each named section of the system prompt. `e.name` is the section’s `id` in `prompt.compose`.| `{ text }`, or `{ text: null }` to omit the section. Add `breakPromptCache: true` to send a changed section on the next turn. -[`prompt.context`](</docs/en/plugins/mods/events#rewrite-or-add-to-a-prompt>)| Once for each conversation, for the context sent with the first message| `{ blocks }` -`prompt.attachment`| Claude Code adds a message of its own for Claude, such as a reminder. `e.type` names the kind, and for the kinds the types declare, `e.detail` holds the facts the text was written from.| `{ text }`, or `{ text: null }` to omit it -`prompt.mention`| Claude Code is about to read a file that a prompt @-mentions. Requires Claude Code v2.1.290 or later.| `next({ ...e, path })` to read a different file, or `{ deny: reason }` -[`skill.prompt`](</docs/en/plugins/mods/events#rewrite-or-add-to-a-prompt>)| A skill’s text is expanded for Claude| `{ text }` -`attribution.text`| Claude Code composes commit or pull request attribution text| `{ text }` - -#### Source and frontmatter fields on `skill.prompt` - -In a `skill.prompt` hook, you can read these fields along with the skill’s name in `e.skill` and the text Claude reads in `e.text`: - -Field| Type| What it holds ----|---|--- -`e.source`| string| Who provides the skill: `policySettings`, `userSettings`, or `projectSettings` for a skill in the enterprise, personal, or project [location](</docs/en/skills#where-skills-live>), respectively. Other sources give a word such as `plugin`, `mcp`, `syncedSkills`, or `built-in`. -`e.pluginName`| string| The plugin’s name, for a skill whose `e.source` is `plugin` -`e.path`| string| The absolute path of the skill’s `SKILL.md` file, or of its `.md` file for a skill written as a [command file](</docs/en/skills#where-skills-live>). Absent when the skill has no file on this machine, as with a built-in skill. -`e.frontmatter`| object| The frontmatter of the skill’s file, as plain data -`e.frontmatterProblem`| string| The reason `e.frontmatter` is missing the file’s frontmatter or one of its keys, as in `is a list or a single value, not a table`. Absent when `e.frontmatter` holds the whole frontmatter or the skill has none. - -A hook can pass a changed `text` or `frontmatter` to `next`: the hooks after it read both, and Claude reads the final `text`. A hook that changes any other field [fails](</docs/en/plugins/mods/events#handle-a-hook-that-fails>). On `skill.prompt`, `e.source`, `e.pluginName`, `e.path`, `e.frontmatter`, and `e.frontmatterProblem` require Claude Code v2.1.299 or later. - -#### Send a changed system prompt section or tool description with `breakPromptCache` +## Telemetry + +`telemetry.log` fires when a telemetry record is about to be logged. In your mod, give a telemetry hook the filter `{ to: 'collector' }`, as in `on('telemetry.log', { to: 'collector' }, hook)`. Without the filter, the mod fails `claude plugin validate`. + +To run your hook in sessions that load the [built-in guard](</docs/en/plugins/mods/admin#know-what-happens-by-default>), such as on a Team or Enterprise login, ask the organization’s administrator to [install your mod as theirs](</docs/en/plugins/mods/admin#install-your-organizations-mods>). If you or another user installs it instead, the hook [doesn’t run in those sessions](</docs/en/plugins/mods/admin#hooks-the-guard-passes-over>) on Claude Code v2.1.328 or later. + +## Send a changed system prompt section or tool description with `breakPromptCache` To change a section or a tool description in a running conversation, call `$.ui.invalidate('prompt.section')` or `$.ui.invalidate('tool.describe')` so your hook runs again. Return `{ text, breakPromptCache: true }` or `{ description, breakPromptCache: true }` from it. Without the field, Claude keeps reading the text [saved with the conversation](</docs/en/cli-reference#system-prompt-flags-in-resumed-conversations>) for a section or a tool loaded upfront until a new conversation or a [compaction](</docs/en/prompt-caching#compacting-the-conversation>). The changed text reaches Claude on the next turn, and the [prompt cache](</docs/en/prompt-caching>) starts over, so that turn is slower and more expensive. The field requires Claude Code v2.1.321 or later. From v2.1.299 until v2.1.321, a running conversation got the changed text on the next turn. -#### Send a changed tool list +## Send a changed tool list To change the main conversation’s tool list, call `$.ui.invalidate('tool.offer')` and return `{ isOffered, breakPromptCache: true }` from your `tool.offer` hook. The [prompt cache](</docs/en/prompt-caching>) then starts over. Requires Claude Code v2.1.331 or later. -### Commands and configuration - -Event| Fires when| A hook can return ----|---|--- -[`command.run`](</docs/en/plugins/mods/api#add-a-command>)| A command is about to run| `{ text }`, `{}`, or `next(e)` -`command.describe`| Once for each command, for the command list| `{ description, argumentHint, isHidden }` -`config.set`| A `/config` row is about to change| `next({ ...e, value })` or `{ deny: reason }` -`config.describe`| Once for each `/config` row| `{ label, description, isHidden }` -[`settings.read`](</docs/en/plugins/mods/events#settings-read-hook>)| A mod calls [`$.settings.read`](</docs/en/plugins/mods/api#reach-files-processes-and-the-network>), or Claude Code builds the session’s merged settings. Requires Claude Code v2.1.304 or later on Claude Code’s own read and for `e.layers`| `next(e)`, `{ value }`, or `{ deny: reason }` - -#### `e.layers` and `e.source` on `settings.read` - - * **`e.layers`** : one `{ source, settings }` object for each source in use that holds settings, lowest [precedence](</docs/en/settings#settings-precedence>) first. See [What a `settings.read` hook receives](</docs/en/plugins/mods/events#settings-read-receives>). - * **`e.source`** : the one source a mod asked for, as in `$.settings.read({ source: 'policy' })`. Absent on Claude Code’s own read and on a read of the merged settings - -### Turns - -Turn events follow one answer from start to finish, including each request to the model within it: - -Event| Fires when| A hook can return ----|---|--- -[`turn.start`](</docs/en/plugins/mods/events#follow-a-turn>)| A turn begins| `next(e)` -[`turn.step`](</docs/en/plugins/mods/events#follow-a-turn>)| One request is about to go to the model| `yield* next(e)`, or `next({ ...e, model })`, `next({ ...e, effort })` -[`turn.complete`](</docs/en/plugins/mods/events#follow-a-turn>)| A turn ended| `next(e)`, or `{ text }` to show a line under the main conversation’s answer - -### Session - -Session events mark the session starting, ending, compacting, and exchanging messages with other sessions: - -Event| Fires when| A hook can return ----|---|--- -[`session.start`](</docs/en/plugins/mods/api#add-a-command-or-a-tool>)| Once for each loaded mod, before the first prompt, and again after a reload of that mod. Not after `/clear`, `/resume`, or `/branch`.| `next(e)` -`session.end`| The session ends, or `/clear`, `/resume`, or `/branch` runs. `e.reason` is `clear`, `resume`, `logout`, `prompt_input_exit`, or `other`. `/branch` reports `resume`.| `next(e)` -`session.compact`| The conversation is about to be compacted| `{ skip: reason }` -[`session.receive`](</docs/en/plugins/mods/api#send-and-receive-messages-between-sessions>), [`session.send`](</docs/en/plugins/mods/api#send-and-receive-messages-between-sessions>)| A message arrives from, or is about to go to, another agent or session. See [Send and receive messages between sessions](</docs/en/plugins/mods/api#send-and-receive-messages-between-sessions>).| `{ consumed: reason }` for `receive`, `{ isDelivered: false, reason }` for `send` -`session.append`| Once for each row the conversation keeps, such as a prompt, a response block, a tool result, or a notice, before it’s stored| `next({ ...e, message })` with a changed `message.content`, to rewrite the row’s text blocks or the `content` of a `tool_result` block in it. You can’t rewrite a row that holds a [skill from an MCP server](</docs/en/mcp#use-skills-from-mcp-servers>). To change that skill’s text, hook `skill.prompt` instead. -`session.attach`, `session.detach`| Another app connects to or disconnects from the session| `next(e)` -`session.measure`| After each turn, and when a plan limit’s percent used changes| `next(e)` -`session.stop`| The user stops Claude, such as with Esc during a turn. Requires Claude Code v2.1.326 or later.| `next(e)` - -### Subagents - -Subagent events fire when a subagent type is offered to Claude and when a subagent or an agent-team teammate is about to start: - -Event| Fires when| A hook can return ----|---|--- -`agent.offer`| A subagent type is offered to Claude| `{ isOffered: false }` to withhold it -`agent.spawn`| A subagent or an [agent team](</docs/en/agent-teams>) teammate is about to start, or a subagent that finished or stopped is about to run again. For a teammate, `e.isTeammate` is `true`. For a resumed run, `e.resume` is set.| `next({ ...e, model })` to choose the model of one that is starting, or `{ deny: reason }` +## Subagent starts + +`agent.spawn` fires when a subagent or an [agent team](</docs/en/agent-teams>) teammate is about to start. To choose the model of one that is starting, call `next({ ...e, model })`. + +### Resumed subagent runs Your `agent.spawn` hook also runs when a subagent that finished or stopped is about to run again, such as when Claude sends it a message with the [`SendMessage`](</docs/en/sub-agents#resume-subagents>) tool. On that event, `e.resume` is `{ agentId }`. If your hook counts subagents, skip the events where `e.resume` is set, so a resumed subagent isn’t counted again. Return `{ deny: reason }` to refuse a resumed run. The run doesn’t start, and the subagent stays as it was. When a `SendMessage` call asked for the run, Claude reads `a plugin declined the resume:` followed by your reason as that call’s result. If you pass a changed event to `next` for a resumed run, such as a different `model`, Claude Code ignores the change. The event for a resumed run requires Claude Code v2.1.299 or later. Before v2.1.299, your `agent.spawn` hook didn’t run when a subagent resumed. On those versions, to refuse the `SendMessage` calls that resume a subagent, match that tool in a [`tool.call`](</docs/en/plugins/mods/events#guard-or-change-a-tool-call>) hook. -### Interface - -Interface events fire when Claude Code draws a render site and when the user uses a control a mod drew. [Draw in the interface](</docs/en/plugins/mods/interface>) shows what a `ui.render` hook returns: - -Event| Fires when ----|--- -[`ui.render`](</docs/en/plugins/mods/interface#pick-where-to-draw>)| A render site is about to be drawn -`ui.resolve`| Mods load, once for each app, render site, and mod. The result is the element table that `$.ui.resolve(e)` reads. -[`ui.press`](</docs/en/plugins/mods/interface#respond-to-presses-and-typing>), [`ui.input`](</docs/en/plugins/mods/interface#respond-to-presses-and-typing>), [`ui.select`](</docs/en/plugins/mods/interface#respond-to-presses-and-typing>)| A `Button`, `Input`, or `Select` a mod drew is used -[`ui.pointer`](</docs/en/plugins/mods/interface#animate-a-backdrop-with-a-shader>)| The user clicks a part of your mod’s backdrop that the app doesn’t cover. Requires Claude Code v2.1.326 or later. -`ui.focus`, `ui.scroll`| The focused control or the scroll position of a pane or the band is about to change -`ui.close`| A pane is about to close. `e.id` is the pane and `e.origin.kind` is `plugin`, `person`, or `unload`. -[`ui.message`](</docs/en/plugins/mods/interface#build-a-tree-from-elements>)| A `Client` element posts data to its mod -[`ui.fault`](</docs/en/plugins/mods/interface#redraw-when-something-changes>)| A `Client` element your mod drew failed to load, draw, or run. `e.phase` is `load`, `render`, or `run`, and `e.reason` is the error message. Requires Claude Code v2.1.289 or later. - -### Other mods - -These events let a mod act on other mods as they load, to refuse one or change the mods API it receives: - -Event| Fires when| A hook can return ----|---|--- -[`plugin.register`](</docs/en/plugins/mods/admin#enforce-a-policy-with-a-mod-of-your-own>)| A hooks module is about to load, or, on v2.1.326 or later, a plugin without one. `e.uses` lists the module’s events, mods API calls, environment variables, and state, as `claude plugin validate` prints them. Each call is written without the `$.` prefix, such as `fs.read`.| `{ refuse: reason }`. On v2.1.326 or later, a refusal keeps out the whole plugin, and `next({ ...e, provides: { ...e.provides, modules: [] } })` keeps out only its hooks module. Earlier versions ignore `provides` and load the module. -`engine.create`| The mods API is being built for this mod| A changed mods API, to add a namespace. A mod in the `prepend` or `append` tier can also withhold one. - -When another mod’s hook calls a method on a namespace you added in `engine.create`, your method’s `$` calls run in that hook’s context until every hook on that event returns. For example, a relative path resolves against that hook’s working directory, and `$.prompt.submit` rejects while the turn is waiting on that hook. Calls your method makes after that run in your mod’s own context. - -### Telemetry - -Telemetry events fire for the usage records Claude Code logs: - -Event| Fires when| A hook can return ----|---|--- -`telemetry.log`, `telemetry.mark`| A telemetry record is about to be logged, or one use of a feature is marked. In a mod you install, give a telemetry hook the filter `{ to: 'collector' }`, as in `on('telemetry.log', { to: 'collector' }, hook)`. Without the filter, the mod fails `claude plugin validate`. `*` doesn’t match these events.| `next(e)`, or `{ deny: reason }` - -### Settings hook events - -Each [settings hook event](</docs/en/hooks#hook-events>) is an event named `classic.<Event>`, such as `classic.Stop`. For the fields on `e`, see [Handle the settings hook events](</docs/en/plugins/mods/events#hook-the-settings-hook-events>). - -### Mods API calls +## Mods API calls Every mods API method is also an event, named for its namespace and method, such as `fs.read`, `model.complete`, or `ui.open`. A hook on one can return `next(e)`, `{ deny: reason }`, or `{ value }`. Some of these events also fire for Claude Code’s own actions, so check whether `next.origin.plugin` is `engine` before you refuse one. -#### Fields on Claude Code’s own `http.fetch` requests +### Fields on Claude Code’s own `http.fetch` requests In an `http.fetch` hook, a `next.origin` of `{ plugin: 'engine', tier: 'core' }` marks one of Claude Code’s own requests, such as a model request, not a mod’s `$.http.fetch` call. Where the [built-in guard](</docs/en/plugins/mods/admin#know-what-happens-by-default>) is loaded, your hook doesn’t get these events unless your mod [counts as your organization’s](</docs/en/plugins/mods/admin#install-your-organizations-mods>). On these events, `e.init` and the `value` that `next(e)` resolves to can hold these fields, among others: @@ -208,66 +65,46 @@ These events and fields require Claude Code v2.1.321 or later. -## Mods API methods - -The mods API is the `$` argument every hook receives. Its methods are grouped in namespaces, such as `$.ui`. This table lists each namespace’s methods by name, so `open` in the `$.ui` row is the call `$.ui.open(...)`. The guides show the common ones in use, and [the types for your build](</docs/en/plugins/mods/create#get-the-types-for-your-build>) document every method with an example. - -Namespace| Methods +## Skip other mods’ hooks with `next.to` + +To call `next.to`, your mod has to run in the `prepend` or `append` tier. To see who can put it there, check the scope of [`prependPlugins`](</docs/en/settings-reference#prependplugins>) or [`appendPlugins`](</docs/en/settings-reference#appendplugins>). The `to` entry under `type Next<` lists the tiers each one can skip to. + +## Namespaces you add + +When another mod’s hook calls a method on a namespace you added in `engine.create`, your method’s `$` calls run in that hook’s context until every hook on that event returns. For example, a relative path resolves against that hook’s working directory, and `$.prompt.submit` rejects while the turn is waiting on that hook. Calls your method makes after that run in your mod’s own context. + +## File writes + +`$.fs.write` isn’t atomic: it replaces the file’s content in place, so another process can read a partly written file. Keep data that several sessions change in `$.store`. + +## Render sites + +A render site is an extension point in Claude Code’s interface. Each row is a value of `e.component` in a `ui.render` hook, with the apps that render it. For a site’s `e.props`, search the type declarations. For the VS Code extension’s version requirements and differences, see [Draw in the VS Code extension](</docs/en/plugins/mods/interface#draw-in-the-vs-code-extension>). + +Site| Rendered on ---|--- -`$.plugin`| `name`, `root`: this plugin’s name and directory -[`$.ui`](</docs/en/plugins/mods/interface#pick-where-to-draw>)| `resolve`, `invalidate`, `open`, `close`, `panes`, [`place`](</docs/en/plugins/mods/interface#place-a-row-in-the-transcript>), `focus`, `scroll`, `toast`, `notify`, `status`, `log`, `notice`, `ask`, `copy`, `selection`, `blit`, `view`. `view` requires Claude Code v2.1.300 or later and `place` v2.1.314 or later. -[`$.theme`](</docs/en/plugins/mods/interface#put-a-backdrop-behind-the-conversation>)| `set`, `clear`: set a backdrop for the Desktop or mobile app to draw, and take the backdrop off. Requires Claude Code v2.1.319 or later. [Message styles](</docs/en/plugins/mods/interface#style-messages-in-the-desktop-app>) and [sound](</docs/en/plugins/mods/interface#add-sound-to-a-theme>) require v2.1.329 or later. -[`$.command`](</docs/en/plugins/mods/api#add-a-command>)| `register`, `run`, `list` -[`$.tool`](</docs/en/plugins/mods/api#add-a-tool>)| `register`, `call`, `check`, `list` -`$.agent`| `register`, `spawn`, `call`, `list`, `limits`. `call` and `limits` require Claude Code v2.1.326 or later. `list()` returns this session’s subagents and teammates, each with a `status` of `pending`, `running`, `waiting`, `idle`, `completed`, `failed`, or `killed`, where `idle` and `waiting` require Claude Code v2.1.289 or later. -[`$.model`](</docs/en/plugins/mods/api#call-a-model>)| `complete`, `fork`, `classify` -[`$.prompt`](</docs/en/plugins/mods/api#start-a-turn-from-a-background-job>)| `submit`, `read`, `fill`, `suggest`, `compose`. Claude reads text from `submit({ text })` after a sentence that names your mod as the sender. `submit({ text, asUser: true })` sends the text as the user’s own words, without that sentence. -`$.turn`| `abort` -[`$.session`](</docs/en/plugins/mods/api#send-and-receive-messages-between-sessions>)| `messages`, `cwd`, `root`, `model`, `turns`, `id`, `repo`, `surfaces`, `usage`, `version`, `info`, `compact`, `send`, `append`, `authorize`, `redact`. `info` requires Claude Code v2.1.326 or later. `redact`, a best-effort mask for credentials only, requires v2.1.331 or later. `usage()` returns `{ startedAt, context, rateLimits, cost }`: `context` has `tokens`, `window`, and `percent`, and `rateLimits` is a list of `{ kind, percentUsed, resetsAt }`. -`$.config`| `list`, `set` -[`$.settings`](</docs/en/plugins/mods/api#reach-files-processes-and-the-network>)| `read` -[`$.env`](</docs/en/plugins/mods/api#reach-files-processes-and-the-network>)| `get`, `set`. A refused `set` either rejects or resolves to `{ deny }`. The `{ deny }` result requires Claude Code v2.1.301 or later. -[`$.fs`](</docs/en/plugins/mods/api#reach-files-processes-and-the-network>)| `read`, `write`, `list`, `exists`, `stat`, `ancestors`. `write` isn’t atomic: it replaces the file’s content in place, so another process can read a partly written file. Keep data that several sessions change in `$.store`. -[`$.store`](</docs/en/plugins/mods/interface#keep-state>)| `get`, `set`, `delete`, `keys`. A key-value store that every session on the machine shares. See [Save from more than one session](</docs/en/plugins/mods/interface#save-from-more-than-one-session>). -[`$.state`](</docs/en/plugins/mods/interface#keep-a-value-in-$-state>)| Reactive state: `get`, `set`, with the helpers `atom`, `read`, `update`, `derive`, and `memberOf` imported from `claude-code` -[`$.clock`](</docs/en/plugins/mods/api#run-work-in-the-background>)| `now`, `sleep`, `after`, `every` -[`$.http`](</docs/en/plugins/mods/api#reach-files-processes-and-the-network>)| `fetch` -[`$.process`](</docs/en/plugins/mods/api#reach-files-processes-and-the-network>)| `run`, `spawn`, `hookEnv`. `hookEnv` requires Claude Code v2.1.326 or later. -[`$.mcp`](</docs/en/plugins/mods/api#reach-files-processes-and-the-network>)| `call`, `connect`. `connect(server)` connects an MCP server that your own plugin’s manifest lists. -[`$.wasm`](</docs/en/plugins/mods/api#reach-files-processes-and-the-network>)| `compile`. Requires Claude Code v2.1.326 or later. -`$.audio`| `play`, `speak` -`$.telemetry`| `log`, `mark`. A record is sent only when Claude Code or a built-in mod makes the call. - -In the terminal, `$.ui.view({ agentId })` shows an agent’s transcript and `$.ui.view({})` switches back. Call either from a command or button. A timer’s call resolves to `{ deny: 'not person-initiated' }`. - -## Render sites - -A render site is an extension point in Claude Code’s interface. Each row is a value of `e.component` in a `ui.render` hook, with the fields of `e.props` and the apps that render it. `e.surface` names the app that’s drawing, such as `terminal`, `desktop`, or `vscode`. [Change what Claude Code already draws](</docs/en/plugins/mods/interface#change-what-claude-code-already-draws>) shows what a hook can do at a site, with an example of each choice. Rendering in the VS Code extension requires extension version 2.1.299 or later. A session that [doesn’t fetch feature flags](</docs/en/env-vars#features-that-need-feature-flag-fetching>) needs 2.1.304 or later. [Draw in the VS Code extension](</docs/en/plugins/mods/interface#draw-in-the-vs-code-extension>) lists what the extension draws differently. - -Site| `e.props`| `e.requestId`| Rendered on ----|---|---|--- -[`Pane`](</docs/en/plugins/mods/interface#pick-where-to-draw>)| `title`, `isFocused`, `bodyColumns`, `placement`, `scroll`, `view`| The pane’s `id`| Terminal, Desktop, VS Code -[`AbovePrompt`](</docs/en/plugins/mods/interface#pick-where-to-draw>)| `hasSurvey`, [`isCollapsed`](</docs/en/plugins/mods/interface#when-the-user-collapses-the-band>), `isWorking`, `maxRows`, `bodyColumns`, `scroll`, `view`| One instance| Terminal, Desktop, VS Code -`AbovePromptList`, the stack of `AbovePrompt` rows| `rows`, a list with one `{ plugin, tree }` for each mod’s row, plus the `AbovePrompt` props| One instance| Terminal, Desktop, VS Code. Requires Claude Code v2.1.323 or later. -`BesidePrompt`, a cell to the right of the prompt| `maxColumns`, `floatRows`, `floatColumns`, `isWorking`, `view`| One instance| Terminal in [fullscreen rendering](</docs/en/fullscreen>), Desktop. Requires Claude Code v2.1.331 or later. -`Underlay`, a layer visible only where the interface is blank| `columns`, `rows`, `isWorking`, `view`| `site:underlay`| Terminal in fullscreen rendering. Requires Claude Code v2.1.331 or later. -`BesidePromptList` and `UnderlayList`, the order of the `BesidePrompt` cells and `Underlay` layers| `plugins`| One instance| The same apps as the site it orders. Requires Claude Code v2.1.331 or later. -[`Placed`](</docs/en/plugins/mods/interface#place-a-row-in-the-transcript>)| `id`, `plugin`, `onScreen`| The `requestId` that `$.ui.place` returned| Terminal -[`Backdrop`](</docs/en/plugins/mods/interface#put-a-backdrop-behind-the-conversation>)| `scene`, `plugin`, `glass`, `overrideColorScheme`. Before v2.1.323, `scene` was `id` and `overrideColorScheme` was `colorScheme`.| `backdrop`| `desktop` and `mobile` surfaces. Your hook runs when the Desktop or mobile app asks to draw a backdrop. -`UserMessage`| `text`, `origin`, `isExpanded`, and `task` or `from` by origin| The drawn row’s id| Terminal, Desktop, VS Code -`AssistantMessage`| The reply’s text| The drawn row’s id| Terminal, Desktop, VS Code -`ToolUse`, `ToolResult`, `ToolGroup`| The tool’s name, input, and result| The tool call id| Terminal, Desktop, VS Code -`CommandOutput`| `command`, `text`| The drawn row’s id| Terminal, Desktop -[`AskUserQuestion`](</docs/en/plugins/mods/interface#change-what-claude-code-already-draws>)| The question and options| The tool call id| Terminal, Desktop, VS Code -`ToolProgress`| `kind`| The tool call id| Terminal -[`Spinner`](</docs/en/plugins/mods/interface#change-what-claude-code-already-draws>)| `word`, `message`, `suffix`, `mode`| The agent id| Terminal, Desktop, VS Code -`TurnDuration`| `word`, `durationMs`| The drawn row’s id| Terminal -`InfoNotice`| `text`, `command`| The notice’s `text` prefixed with `notice:`| Terminal -`SessionMode`| `modes`| One instance| Terminal, Desktop -`PromptHint`| `isDraft`, `isWorking`, `hint`| One instance| Terminal, Desktop -`AgentRow`| The agent’s [`$.agent.list()` fields](</docs/en/plugins/mods/create#get-the-types-for-your-build>), plus `rowIds`, `columns`, `body`, and `isHidden`| The agent id| Terminal and VS Code’s [Focus view](</docs/en/vs-code#extension-settings>). Requires v2.1.326 or later of Claude Code or the extension. - -`e.viewport` holds `columns`, `rows`, and `isFullscreen`. In the terminal and the Desktop app, it’s absent until the app has measured its window. There, its `rows` is the height of the whole window, not of your pane. In the VS Code extension, it’s always present. To fit a tree to its site, read these props in the hook: +[`Pane`](</docs/en/plugins/mods/interface#pick-where-to-draw>)| Terminal, Desktop, VS Code +[`AbovePrompt`](</docs/en/plugins/mods/interface#pick-where-to-draw>)| Terminal, Desktop, VS Code +`AbovePromptList`, the stack of `AbovePrompt` rows| Terminal, Desktop, VS Code. Requires Claude Code v2.1.323 or later. +`BesidePrompt`, a cell to the right of the prompt| Terminal in [fullscreen rendering](</docs/en/fullscreen>), Desktop. Requires Claude Code v2.1.331 or later. +`Underlay`, a layer visible only where the interface is blank| Terminal in fullscreen rendering. Requires Claude Code v2.1.331 or later. +`BesidePromptList` and `UnderlayList`, the order of the `BesidePrompt` cells and `Underlay` layers| The same apps as the site it orders. Requires Claude Code v2.1.331 or later. +[`Placed`](</docs/en/plugins/mods/interface#place-a-row-in-the-transcript>)| Terminal +[`Backdrop`](</docs/en/plugins/mods/interface#put-a-backdrop-behind-the-conversation>)| `desktop` and `mobile` surfaces. Your hook runs when the Desktop or mobile app asks to draw a backdrop. +`UserMessage`| Terminal, Desktop, VS Code +`AssistantMessage`| Terminal, Desktop, VS Code +`ToolUse`, `ToolResult`, `ToolGroup`| Terminal, Desktop, VS Code +`CommandOutput`| Terminal, Desktop +[`AskUserQuestion`](</docs/en/plugins/mods/interface#change-what-claude-code-already-draws>)| Terminal, Desktop, VS Code +`ToolProgress`| Terminal +[`Spinner`](</docs/en/plugins/mods/interface#change-what-claude-code-already-draws>)| Terminal, Desktop, VS Code +`TurnDuration`| Terminal +`InfoNotice`| Terminal +`SessionMode`| Terminal, Desktop +`PromptHint`| Terminal, Desktop +`AgentRow`| Terminal and VS Code’s [Focus view](</docs/en/vs-code#extension-settings>). Requires v2.1.326 or later of Claude Code or the extension. + +`e.viewport` holds `columns`, `rows`, and `isFullscreen`. In the terminal and the Desktop app, it’s absent until the app has measured its window. There, its `rows` is the height of the whole window. To fit a tree to its site, read these props in the hook: * **Width of a`Pane` or the band**: draw to `e.props.bodyColumns` * **Height of a`Pane` beside the transcript**: where `e.props.placement` is `'dock'`, `e.props.scroll.bodyRows` is the number of rows the pane has for your tree @@ -277,43 +114,15 @@ ## Elements -Elements are the building blocks of a tree a `ui.render` hook returns, and you get them from `$.ui.resolve(e)`. [Build a tree from elements](</docs/en/plugins/mods/interface#build-a-tree-from-elements>) shows the common ones with how the terminal draws them, and the [interface gallery](</docs/en/plugins/mods/gallery>) has screenshots of most. A check mark means the app can draw the element. - -Element| Main props| Terminal| Desktop| VS Code ----|---|---|---|--- -[`Box`](</docs/en/plugins/mods/interface#build-a-tree-from-elements>)| `key`, flex layout, `gap`, `padding`, `margin`, `width`, `height`, `minWidth`, `minHeight`, `borderStyle`, `borderColor`, `borderDimColor`, `backgroundColor`, `position`, `top`, `left`, `right`, `bottom`, `overflow`, `display`, `hover`| ✓| ✓| ✓ -[`Text`](</docs/en/plugins/mods/interface#build-a-tree-from-elements>)| `color`, `backgroundColor`, `bold`, `italic`, `underline`, `strikethrough`, `dimColor`, `inverse`, `wrap`, `size`, `weight`, `mono`, `tabular`, `hover`| ✓| ✓| ✓ -[`Button`](</docs/en/plugins/mods/interface#respond-to-presses-and-typing>)| `key`, `label`, `children`, `onPress`, `hotkey`, `plain`, `dimColor`, `autoFocus`, `action`, `variant`, `role`, `hover`| ✓| ✓| ✓ -[`Link`](</docs/en/plugins/mods/interface#link-in-the-desktop-app>)| `href`, `label`. See Limits.| ✓| ✓| ✓ -[`Code`](</docs/en/plugins/mods/gallery#show-code-and-changes>)| `source`, `language`, `path`, `startLine`, `format`, `wrap`| ✓| ✓| ✓ -`Markdown`| `text`, `key`, `dimColor`, `onLinkPress`, `pressableLinks`| ✓| ✓| ✓ -[`Input`](</docs/en/plugins/mods/interface#take-typed-input-and-draw-a-row-for-each-item>)| `key`, `label`, `placeholder`, `value`, `submitLabel`, [`rows`](</docs/en/plugins/mods/gallery#input>), `onSubmit`, `onInput`, `autoFocus`| ✓| ✓| ✓ -`Select`| `key`, `label`, `options`, `value`, `onSelect`, `autoFocus`| ✓| ✓| ✓ -`Svg`| a `source` of SVG markup up to 131,072 characters, `alt` text, `width`, `height`, and `isInteractive`| | ✓| ✓ -[`Shader`](</docs/en/plugins/mods/interface#animate-a-backdrop-with-a-shader>)| `module`, `values`, and one `Svg` child. Draws in a `Backdrop` only. Requires Claude Code v2.1.326 or later.| | ✓| -[`Client`](</docs/en/plugins/mods/interface#build-a-tree-from-elements>)| `module`, `key`, `props`, `width`, `height`, `flexGrow`| ✓| ✓| -[`Raster`](</docs/en/plugins/mods/interface#draw-a-grid-of-colored-cells>)| `key`, `columns` up to 512, `rows` up to 256, `cells`. See [Draw a grid of colored cells](</docs/en/plugins/mods/interface#draw-a-grid-of-colored-cells>).| ✓| | -`Image`| `key`, a `source` such as PNG or RGBA bytes up to 2 MiB, or a file path, `columns` and `rows` up to 255, and `alt` text. See [which terminals draw it](</docs/en/plugins/mods/gallery#image-and-client>).| ✓| | - -More `Button` rules: - - * **`action`** : names one of Claude Code’s own [keybinding actions](</docs/en/keybindings>), and the user’s binding for it presses the button when that binding is a chord or a modified key - * **Digit hotkeys on the band** : a digit `hotkey` on a button in the band also fires when the user types that digit alone into an empty prompt and pauses - * **A collapsed band** : while the band is [collapsed](</docs/en/plugins/mods/interface#when-the-user-collapses-the-band>), neither an `action` binding nor a hotkey presses a button in it - * **Two buttons on one hotkey** : when two of your buttons in one drawing name the same `hotkey`, the later one gets it. For another mod’s button on the same key, see [Hotkeys do nothing](</docs/en/plugins/mods/troubleshoot#hotkeys-do-nothing>). - * **`variant`** : `primary` or `secondary`, and any other value throws. In the terminal, a `primary` button draws in the accent color unless it’s `plain`. - * **`role`** : `dismiss` marks a close button, and any other value throws. Do the closing in your `onPress`. In a band that holds text and a row of buttons, the Desktop app can draw the row’s first `dismiss` button as its own close control. The terminal draws the button as it would without `role`. - -A `Button` can hold `children` in place of a `label`: - - * **What children can be** : strings and `Text` elements, such as a name followed by a dim detail or a colored chip. Claude Code refuses any other element inside a `Button`. - * **Naming the button** : the `label` names the button and defaults to the text of its children. Give a button with children other than one string a `key` or a `label`. - * **In the terminal** : the children draw where the label would be, and a press anywhere on them counts as one press, so you can make each row of a list a single button - * **In the Desktop app and the VS Code extension** : the button draws its `label` - -A `Button` with children other than a single string requires Claude Code v2.1.295 or later. - -`autoFocus` accepts only `true` on any control, so omit the prop to leave it off. The VS Code extension ignores some element props and draws the element as if you had left them out: +Elements are the building blocks of a tree a `ui.render` hook returns. For the main elements and the apps that draw them, see [Build a tree from elements](</docs/en/plugins/mods/interface#build-a-tree-from-elements>). For an element’s props, search the type declarations. + +### Buttons with children in the Desktop app and VS Code + +For a `Button` that holds `children`, the Desktop app and the VS Code extension draw its `label` in place of the children. To choose that text, set `label`, which otherwise defaults to the text of the children. A `Button` with children other than a single string requires Claude Code v2.1.295 or later. + +### Props the VS Code extension ignores + +The VS Code extension ignores some element props and draws the element as if you had left them out: * **`Box`** : `position` with its `top`, `left`, `right`, and `bottom`, `alignSelf`, `borderDimColor`, and `hover` * **`Text`** : `size`, `mono`, `tabular`, and `hover` @@ -321,6 +130,8 @@ * **`Code`** : `language`, `path`, `startLine`, `format`, and `wrap`, so code draws without colors or line numbers, and a `format: 'diff'` block shows the diff’s raw text * **`Input` and `Select`**: `autoFocus`, and `rows` on an `Input` * **`Svg`** : `isInteractive` + +The terminal also ignores `size`, `mono`, and `tabular` on a `Text`. ### `Box` border styles @@ -340,37 +151,6 @@ `'quote'`| A bar, `▎`, down the left side and blank cells on the other three sides| Blank A `Box` whose `borderStyle` names anything else, such as `'rounded'`, draws with no border. - -### `Box` spacing steps - -The `Box` spacing props are `gap`, `columnGap`, `rowGap`, `padding`, `margin`, and the one-side and one-axis forms of `padding` and `margin`, such as `paddingX` and `marginTop`. Each takes a number of terminal cells such as `gap: 1`, or a step name such as `gap: 'md'`. In the terminal and the VS Code extension, each step is this many cells: - -Step| Cells across| Cells down ----|---|--- -`'xs'`| 1| 0 -`'sm'`| 1| 0 -`'md'`| 2| 1 -`'lg'`| 3| 1 -`'xl'`| 4| 2 - -If you set `gap`, `padding`, or `margin` to a step, the step applies across and down at once. For example, in the terminal and the VS Code extension, `padding: 'md'` is two cells at each side and one row above and below. Step names require Claude Code v2.1.299 or later. On an earlier release, a tree that uses a step name doesn’t draw. - -### `Text` typography props - -Set `size`, `weight`, `mono`, or `tabular` on a `Text` to ask the app drawing your tree for a text size, a weight, a monospaced typeface, or equal-width digits. Before you rely on a prop, check what the terminal and the VS Code extension do with it. If an app ignores a prop you set, your tree still draws there, with the text as if you’d left that prop out. - -Prop| Values| In the terminal| In the VS Code extension ----|---|---|--- -`size`| `'caption'`, `'footnote'`, `'body'`, `'heading'`, or `'title'`| Ignored: the terminal has one text size| Ignored -`weight`| `'regular'`, `'medium'`, `'semibold'`, or `'bold'`| `semibold` and `bold` draw as bold text| `semibold` and `bold` draw as bold text -`mono`| `true` to ask for the app’s monospaced typeface| Ignored: the terminal is always monospaced| Ignored, so text keeps the extension’s own typeface -`tabular`| `true` to ask for digits of equal width, so that a number that updates in place or a column of numbers stays aligned| Ignored: the terminal’s digits are already one cell wide| Ignored - -These four props require Claude Code v2.1.299 or later. On an earlier release, a tree that sets `size`, `weight`, `mono`, or `tabular` doesn’t draw. - -#### Replace `bold` with `weight` - -`bold` on a `Text` is deprecated in favor of `weight` and still works. To replace it on a `Text` with no `weight`, change `bold: true` to `weight: 'semibold'` for the same result on Claude Code v2.1.299 or later. On a release earlier than v2.1.299, a tree that sets `weight` doesn’t draw. If you set both `bold` and `weight` on a `Text`, `bold` has no effect. ## Limits @@ -400,6 +180,9 @@ Depth and size of a tree counted with its prop values| Claude Code refuses anything `nested more than 100 lists and objects deep` or with `more than 1000000 values once written out`. Requires Claude Code v2.1.326 or later. Elements and text children in one tree| 20,000 `Raster` cells in one tree, each `Raster`’s `columns` times its `rows`| 262,144 +One `Raster`| 512 columns and 256 rows +One `Image`| 255 columns and 255 rows +One `Svg`’s `source`| 131,072 characters The rows above the prompt, stacked| Elements, `Raster` cells, and `Image` bytes add up across the rows, against the limits for one tree PNG or RGBA bytes of all the `Image`s in one tree| 2 MiB `$.store`| 4 MiB of JSON in total @@ -421,32 +204,10 @@ Command, tool, subagent type, and pane names, the `id` of a placed row, and the `scene` of a backdrop| Letters, digits, `_`, and `-`, up to 64 characters One `claude plugin test` test| 5 seconds unless the test sets `timeoutMs` -## Settings and environment variables - -These are the settings and environment variables that affect mods. The Where column says which settings file or environment each one is read from: - -Name| Where| What it does ----|---|--- -`CLAUDE_CODE_PLUGIN_DIRS`| Environment, or `env` in `~/.claude/settings.json`| Plugin directories to load as `--plugin-dir` does, for apps you can’t pass a flag to. Absolute paths separated by `:`, or `;` on Windows. -`CLAUDE_CODE_PLUGIN_DIR_WATCH`| Environment| Whether mods reload on save. See the [environment variables reference](</docs/en/env-vars>) for the defaults and values -`prependPlugins`, `appendPlugins`| Managed settings. User settings only on a machine with no managed settings or [`managed-mcp.json`](</docs/en/managed-mcp#deploy-managed-mcp-json>) file, in a session whose credential isn’t a Team or Enterprise `/login`.| Lists of plugin ids, such as `acme-guard@acme-tools`. Mods in `prependPlugins` run before every mod a user installs, and mods in `appendPlugins` run after, in the listed order. See [The order mods run in](</docs/en/plugins/mods/events#the-order-mods-run-in>). -`allowManagedModsOnly`| Managed settings, as an [option on the built-in guard](</docs/en/plugins/mods/admin#set-options-on-the-built-in-guard>)| Only mods that [count as your organization’s](</docs/en/plugins/mods/admin#install-your-organizations-mods>), and mods built into Claude Code, run their hooks. Users’ settings hooks keep running. -`allowModsToOverrideDenyRules`| Managed settings, as an [option on the built-in guard](</docs/en/plugins/mods/admin#set-options-on-the-built-in-guard>)| Lets a mod a user installed approve a tool call past most of [the outcomes that stay in place by default](</docs/en/permissions#precedence-among-rules-hooks-and-mods>), including a `deny` rule -`allowManagedHooksOnly`| Managed settings| Blocks hooks and installed mods that aren’t your organization’s. See [what keeps running](</docs/en/settings-reference#what-runs-under-allowmanagedhooksonly>). -`disableAllHooks`| Any settings file| In managed settings, no mod or hook from an installed plugin runs. In your own settings, what your organization manages keeps running. See [`disableAllHooks`](</docs/en/settings-reference#disableallhooks>). -`disableSideloadFlags`| Managed settings| Rejects `--plugin-dir` and `--plugin-url` at startup -`pluginConfigs`| User or managed settings| Holds `userConfig` values for a mod, keyed by the plugin’s id, such as `acme-guard@acme-tools`, or its name and `@inline`, such as `first-mod@inline`, for one loaded with `--plugin-dir` - -`sec-default@builtin` is a guard built into Claude Code, listed as `cc-plugin-sec-default` in `/plugin` and the debug log. [Where it loads](</docs/en/plugins/mods/admin#know-what-happens-by-default>), it runs ahead of every mod a person installs. If managed `prependPlugins` is set, the guard loads only when that list names it, at the position listed. Its source is in the [`mods/sec-default` directory of the Claude Code repository](<https://github.com/anthropics/claude-code/tree/main/mods/sec-default>). - -## Commands - -These commands and flags load, inspect, and test a mod. The `claude` commands run in your shell and the `/` commands at the Claude Code prompt. In the table, `<directory>` stands for a path you type, as in `claude plugin validate ./first-mod`. Square brackets mark an optional argument. - -Command| What it does ----|--- -[`/plugin`](</docs/en/plugins/mods/overview#see-which-mods-a-session-loaded>)| Shows a line such as `1 mod active · first-mod` under its tabs when a mod that isn’t built in has loaded -[`claude plugin validate <directory>`](</docs/en/plugins/mods/create#check-what-claude-code-reads-from-your-mod>)| Reads a plugin’s manifest and hooks module and reports errors, the events it handles, and the mods API calls it makes. `--strict` treats warnings as errors and `--json` prints a machine-readable report. -[`claude plugin test [directory]`](</docs/en/plugins/mods/test#write-a-test>)| Runs every file under the directory, or the current directory when you give none, whose name ends in `.test.ts` or `.test.tsx`. Exits with status 1 when a test fails. -[`claude --plugin-dir <directory>`](</docs/en/plugins/mods/create#write-a-mod-yourself>)| Loads a plugin directory for one session. In an interactive terminal session, reloads the hooks module when you save. Repeat the flag to load several. -`/reload-plugins`| Reloads plugins when you run it +## Related resources + + * [React to events](</docs/en/plugins/mods/events>) and [Draw in the interface](</docs/en/plugins/mods/interface>): examples of the common events and elements + * [Manage mods for your organization](</docs/en/plugins/mods/admin>): the managed settings that control mods + * [Plugin and skill settings](</docs/en/settings-reference#plugins-and-skills>): scope and type for keys such as `prependPlugins` and `pluginConfigs` + * [Environment variables](</docs/en/env-vars>): variables such as `CLAUDE_CODE_PLUGIN_DIRS` and `CLAUDE_CODE_PLUGIN_DIR_WATCH` + * [Plugin CLI reference](</docs/en/plugins/cli-reference>): commands such as `claude plugin validate` and `claude plugin test`
modified Automate work with scheduled tasks View current →
--- a/routines.md +++ b/routines.md @@ -1,4 +1,4 @@ -Scheduled tasks are in research preview. Behavior, limits, and the API surface may change. +Cloud scheduled tasks in Claude Code, which this page covers, are in research preview, including on Enterprise plans. Their behavior, limits, and API surface may change. On Enterprise plans with [Chat and Cowork unified](<https://support.claude.com/en/articles/17444462-set-up-and-manage-the-new-unified-claude-experience-for-your-enterprise-organization>) turned on, cloud scheduled tasks in claude.ai chat and Claude Cowork are generally available.On Team and Enterprise plans, one scheduled tasks toggle at [**Organization settings > Capabilities > Remote sessions**](<https://claude.ai/admin-settings/capabilities>) must be on for either kind of task. An Owner can’t use it to allow the generally available kind and block the preview kind. A cloud scheduled task, formerly a routine, is a saved Claude Code configuration: a prompt, one or more repositories, and a set of [connectors](</docs/en/mcp>), packaged once and run automatically. Scheduled tasks execute on Anthropic-managed cloud infrastructure, or on your organization’s [self-hosted environment](</docs/en/self-hosted-environments>) when routed there, so they keep working when your laptop is closed. Each scheduled task can have one or more triggers attached to it:
modified Configure server-managed settings View current →
--- a/server-managed-settings.md +++ b/server-managed-settings.md @@ -121,7 +121,11 @@ Click **Switch to group-based configurations** in the banner at the top of the page and confirm. Members receive their configurations within about an hour, apart from the keys that apply only at the next launch. To go back, switch to organization-wide mode from the same banner: the organization-wide configuration applies again, if you have one, and your group configurations are kept. -A group’s model limits hold only in local sessions. Cloud and remote Cowork sessions use the [`availableModels`](</docs/en/model-config#restrict-model-selection>) list in the catch-all. If you set no catch-all, it comes from your organization-wide configuration, even after you switch to group-based mode. If you leave the key out of the catch-all, members aren’t limited by this list in those sessions. If you use a group’s configuration to set where API requests go, that applies only to Claude Code, not to other tools that call the API. +A group’s model limits hold in local Claude Code sessions. Cloud sessions are held to the [`availableModels`](</docs/en/model-config#restrict-model-selection>) list in the catch-all. claude.ai applies it to Cowork and unified conversations until Anthropic [turns that off](</docs/en/model-config#when-the-allowlist-limits-cowork>). Without a catch-all, that list comes from your organization-wide configuration, even after you switch to group-based mode. If you omit `availableModels` from the catch-all, members aren’t limited by that list in cloud sessions, Cowork, or unified conversations. If you use a group’s configuration to set where API requests go, that applies only to Claude Code, not to other tools that call the API. + +#### Copy a setting into group configurations from a script + +To copy a setting into every group configuration and the catch-all from a script, use the [Claude Code Managed Settings API](<https://platform.claude.com/docs/en/api/beta/organization/claude_code/managed_settings>), which is in beta. Only the Primary Owner can create the [Admin API key](<https://platform.claude.com/docs/en/manage-claude/admin-api-keys#create-a-key-for-a-claude-enterprise-organization>) it requires. Send each configuration’s full settings in its own request, including the copied setting, because the API replaces the stored settings. ### Access control
modified Example settings files View current →
--- a/settings-example.md +++ b/settings-example.md @@ -119,7 +119,7 @@ "hooks": [ { "type": "command", - "command": "${CLAUDE_PROJECT_DIR}/.claude/hooks/block-rm.sh" + "command": "\"${CLAUDE_PROJECT_DIR}\"/.claude/hooks/block-rm.sh" } ] } @@ -182,7 +182,7 @@ "hooks": [ { "type": "command", - "command": "${CLAUDE_PROJECT_DIR}/.claude/hooks/block-rm.sh" + "command": "\"${CLAUDE_PROJECT_DIR}\"/.claude/hooks/block-rm.sh" } ] }
modified All settings View current →
--- a/settings-reference.md +++ b/settings-reference.md @@ -77,7 +77,7 @@ `disabledMcpjsonServers`| Reject specific servers from a project’s [`.mcp.json`](</docs/en/mcp#project-scope>)| MCP| Any file `disableMobileSimulatorTools`| Block Claude’s tools in the [desktop](</docs/en/desktop>) iOS Simulator pane| Tools| Managed `disableRemoteControl`| Turn off [Remote Control](</docs/en/remote-control>) everywhere it can start| Remote, desktop, and notifications| Any file -`disableRemotePreviewScripts`| Turn off scripts in the Browser pane’s HTML previews in the [desktop](</docs/en/desktop#preview-html-files-in-ssh-and-wsl-sessions>) app’s SSH and WSL sessions| Remote, desktop, and notifications| Managed +`disableRemotePreviewScripts`| Turn off scripts in HTML files that people open in the [desktop](</docs/en/desktop#preview-html-files-in-ssh-and-wsl-sessions>) app’s SSH and WSL sessions| Remote, desktop, and notifications| Managed `disableSideloadFlags`| Reject the CLI flags that sideload [plugins](</docs/en/plugins/overview>), [subagents](</docs/en/sub-agents>), and [MCP servers](</docs/en/mcp>)| Enterprise and managed settings| Managed `disableSkillShellExecution`| Stop [skills](</docs/en/skills>) and custom commands from running inline shell| Plugins and skills| Any file `disableWorkflows`| Turn [dynamic workflows](</docs/en/workflows>) off for everyone; use `enableWorkflows` for yourself| Hooks and automation| Any file @@ -2883,7 +2883,7 @@ ### `spellcheck` -Underline misspelled words in the prompt input as you type, using a spell checker you install. Claude Code checks only the text in the input box. [Check spelling as you type](</docs/en/interactive-mode#check-spelling-as-you-type>) covers installing aspell, hunspell, or ispell and what the checker covers. Requires Claude Code v2.1.235 or later. +Underline misspelled words in the prompt input as you type, using a spell checker you install. Claude Code checks only the text in the input box. [Check spelling as you type](</docs/en/interactive-mode#check-spelling-as-you-type>) covers installing aspell, hunspell, or ispell and what the checker covers. * **Scope** : `User or managed`. The block from the highest tier that sets it applies as a whole. * **Type** : object with `enabled` (Boolean), `checker` (`"aspell"`, `"hunspell"`, `"ispell"`, or `"auto"`), `language` (string, passed to the checker as its dictionary name), and `color` (string, a terminal color name, `#rrggbb`, `rgb(r,g,b)`, `ansi256(n)`, or `ansi:<name>`) @@ -4770,11 +4770,11 @@ ### `disableRemotePreviewScripts` -Keep scripts from running when people [preview an HTML file](</docs/en/desktop#preview-html-files-in-ssh-and-wsl-sessions>) in the desktop app’s Browser pane from an SSH or WSL session. External browsing in that pane is unaffected. The desktop app reads this key; the terminal CLI ignores it. Requires Claude Desktop v5.1231.0 or later. Earlier versions ignore the key: to stop the scripts there, also set `disableBrowserExternalNavigation`, which turns off external browsing too. +Keep scripts from running when people [open an HTML file](</docs/en/desktop#preview-html-files-in-ssh-and-wsl-sessions>) in an SSH or WSL session, in the desktop app’s Browser pane or [**Files** pane](</docs/en/desktop#open-and-edit-files>). With the key set to `true`, the file pane shows the file as code. External browsing in the Browser pane is unaffected. The desktop app reads this key; the terminal CLI ignores it. Requires Claude Desktop v5.1231.0 or later for the Browser pane, and v7.37095.0 or later for the file pane. To stop scripts in the Browser pane’s HTML previews on versions before v5.1231.0, also set `disableBrowserExternalNavigation`, which turns off external browsing too. * **Scope** : `Managed`. The desktop app doesn’t read the key from the remote machine or the WSL distribution. * **Type** : Boolean; only the JSON Boolean `true` takes effect - * `true`: in SSH and WSL sessions, HTML previews in the Browser pane don’t run scripts + * `true`: in SSH and WSL sessions, HTML previews in the Browser pane don’t run scripts. The file pane opens those sessions’ HTML files as code. * `false`: the key doesn’t turn scripts off * **Default** : unset, so the key has no effect @@ -5068,7 +5068,7 @@ * **Scope** : `Any file`. Claude Code honors `"gateway"` from the same sources as `forceLoginGatewayUrl` and treats it as unset everywhere else. * **Type** : string, one of: * `"claudeai"`: claude.ai sign-in - * `"console"`: Claude Console sign-in + * `"console"`: Claude Console sign-in. For Claude Desktop’s own sign-in, see [Restrict sign-in to Claude Console](</docs/en/desktop#restrict-sign-in-to-claude-console>). * `"gateway"`: Claude Code sends people to a cloud gateway instead of a first-party login * **Default** : unset, so people pick a login method @@ -5257,7 +5257,7 @@ ### `disableBrowserExternalNavigation` -Turn off external browsing in the desktop app’s [Browser pane](</docs/en/desktop#browse-external-sites>) for people and Claude alike. Localhost dev server previews keep working. The Browser pane’s HTML previews in SSH and WSL sessions still open, but they [don’t run scripts](</docs/en/desktop#turn-off-scripts-in-ssh-and-wsl-previews-for-your-organization>). The desktop app reads this key; the terminal CLI ignores it. +Turn off external browsing in the desktop app’s [Browser pane](</docs/en/desktop#browse-external-sites>) for people and Claude alike. Localhost dev server previews keep working. The Browser pane’s HTML previews in SSH and WSL sessions still open, but they [don’t run scripts](</docs/en/desktop#turn-off-scripts-in-ssh-and-wsl-previews-for-your-organization>). The desktop app reads this key; the terminal CLI ignores it. With the key set to `true`, in SSH and WSL sessions, the [**Files** pane](</docs/en/desktop#open-and-edit-files>) opens HTML files as code, which requires Claude Desktop v7.37095.0 or later. * **Scope** : `Managed` * **Type** : Boolean; only the JSON Boolean `true` takes effect
modified Configure your terminal for Claude Code View current →
--- a/terminal-config.md +++ b/terminal-config.md @@ -117,7 +117,7 @@ set -s extended-keys on set -as terminal-features 'xterm*:extkeys' -To use Shift+Enter, keep the last two lines, then detach from tmux, attach again, and restart Claude Code. To send notifications from a visible pane to Ghostty, Kitty, or iTerm2, keep the `allow-passthrough` line and restart Claude Code. With this sample, a pane in a window you aren’t viewing sends none. Before v2.1.326 or inside tmux older than 3.3, which has no `allow-passthrough`, set [`preferredNotifChannel`](</docs/en/settings-reference#preferrednotifchannel>) to `"iterm2"`, `"kitty"`, or `"ghostty"`. A [mod’s `Image`](</docs/en/plugins/mods/reference#elements>) needs the `allow-passthrough` and `focus-events` lines, along with the other [requirements for drawing inside tmux](</docs/en/plugins/mods/gallery#draw-an-image-inside-tmux>). After you add the lines, also detach from tmux, attach again, and restart Claude Code. +To use Shift+Enter, keep the last two lines, then detach from tmux, attach again, and restart Claude Code. To send notifications from a visible pane to Ghostty, Kitty, or iTerm2, keep the `allow-passthrough` line and restart Claude Code. With this sample, a pane in a window you aren’t viewing sends none. Before v2.1.326 or inside tmux older than 3.3, which has no `allow-passthrough`, set [`preferredNotifChannel`](</docs/en/settings-reference#preferrednotifchannel>) to `"iterm2"`, `"kitty"`, or `"ghostty"`. A [mod’s `Image`](</docs/en/plugins/mods/gallery#image-and-client>) needs the `allow-passthrough` and `focus-events` lines, along with the other [requirements for drawing inside tmux](</docs/en/plugins/mods/gallery#draw-an-image-inside-tmux>). After you add the lines, also detach from tmux, attach again, and restart Claude Code. ## Fix Backspace deleting a whole word on Windows
modified Test a mod View current →
--- a/test.md +++ b/test.md @@ -1,4 +1,4 @@ -You can write automated tests for a mod and run them from your shell with [`claude plugin test`](</docs/en/plugins/mods/reference#commands>). A test fires the events your hooks handle and checks what the hooks did, so you catch a problem before it reaches a session. The first example tests the mod from [Create a mod](</docs/en/plugins/mods/create>). +You can write automated tests for a mod and run them from your shell with [`claude plugin test`](</docs/en/plugins/cli-reference#plugin-test>). A test fires the events your hooks handle and checks what the hooks did, so you catch a problem before it reaches a session. The first example tests the mod from [Create a mod](</docs/en/plugins/mods/create>). ## Write a test @@ -34,7 +34,7 @@ 0 fail Ran 1 test across 1 file. [0.19s] -Each `$.tool.call` went through the mod’s [`tool.call`](</docs/en/plugins/mods/reference#tools>) hook, which added one to its count and passed the call on to the stub. No `ls` ran and no file was read. `$.command.run` then went to the mod’s [`command.run`](</docs/en/plugins/mods/reference#commands-and-configuration>) hook, and `answer` is the object that hook returned. The command exits with status 1 when a test fails, so it works in CI. If your own mods can’t load in the shell that runs it, it prints a line starting `claude plugin test: hooks modules are turned off` with the reason, and exits with status 1. +Each `$.tool.call` went through the mod’s [`tool.call`](</docs/en/plugins/mods/events#guard-or-change-a-tool-call>) hook, which added one to its count and passed the call on to the stub. No `ls` ran and no file was read. `$.command.run` then went to the mod’s [`command.run`](</docs/en/plugins/mods/api#add-a-command>) hook, and `answer` is the object that hook returned. The command exits with status 1 when a test fails, so it works in CI. If your own mods can’t load in the shell that runs it, it prints a line starting `claude plugin test: hooks modules are turned off` with the reason, and exits with status 1. ### Stub what Claude Code would answer @@ -96,7 +96,7 @@ ### Follow the test kit’s rules * **Register every stub before the test’s first call on`$`.** Calling `on` after that throws an error such as `on("ui.render") after the test first called $`. - * **[`session.start`](</docs/en/plugins/mods/reference#session>) doesn’t run by itself.** Each test starts with your module freshly loaded and none of its hooks called, so module-level variables hold their initial values. If a hook depends on what `session.start` sets up, fire it first: + * **[`session.start`](</docs/en/plugins/mods/api#add-a-command-or-a-tool>) doesn’t run by itself.** Each test starts with your module freshly loaded and none of its hooks called, so module-level variables hold their initial values. If a hook depends on what `session.start` sets up, fire it first: // Answer the event after your hook passes it on with next(e) on('session.start', () => ({ cwd: '/work' })) @@ -106,7 +106,7 @@ await $.session.start({ surface: 'terminal', isInteractive: true, cwd: '/work' }) The second stub answers the `$.command.register` call that a `session.start` hook such as the [tutorial’s](</docs/en/plugins/mods/create#write-a-mod-yourself>) makes. Without it, that call rejects with `no implementation for command.register` and the kit skips your hook, so nothing after the call in the hook runs. The test doesn’t fail at that point. The skipped hook is listed under `the engine reported:` only if a later check fails. - * **Register a`ui.render` stub to choose what `next(e)` returns.** When your [`ui.render`](</docs/en/plugins/mods/reference#interface>) hook returns `next(e)`, for example to draw nothing while Claude is idle, the mount succeeds with no stub. To make `next(e)` return an element you pick, register a stub that returns it as plain data: + * **Register a`ui.render` stub to choose what `next(e)` returns.** When your [`ui.render`](</docs/en/plugins/mods/interface#pick-where-to-draw>) hook returns `next(e)`, for example to draw nothing while Claude is idle, the mount succeeds with no stub. To make `next(e)` return an element you pick, register a stub that returns it as plain data: // Stands for what Claude Code would draw at the site on('ui.render', () => ({ type: 'Text', props: {}, children: ['drawn by Claude Code'] })) @@ -283,7 +283,7 @@ `drawn()`| Returns the whole tree as last drawn `unmount()`| Removes the drawing -Each method resolves after your handler has finished, so you can check the result on the next line. Set `props` to what Claude Code would pass for that site. The [render sites table](</docs/en/plugins/mods/reference#render-sites>) lists each site’s props, and [the types for your build](</docs/en/plugins/mods/create#get-the-types-for-your-build>) have their types. To catch an [element tree](</docs/en/plugins/mods/interface#build-a-tree-from-elements>) that isn’t valid for the app you named in `surface`, check with `find` for an element your hook adds. The test doesn’t check how the app paints a tree, so look at a new layout in a real session too. +Each method resolves after your handler has finished, so you can check the result on the next line. Set `props` to what Claude Code would pass for that site. The [type declarations](</docs/en/plugins/mods/reference#look-up>) list each site’s props. To catch an [element tree](</docs/en/plugins/mods/interface#build-a-tree-from-elements>) that isn’t valid for the app you named in `surface`, check with `find` for an element your hook adds. The test doesn’t check how the app paints a tree, so look at a new layout in a real session too. ### Test a drawing after `/clear` @@ -370,4 +370,4 @@ ## Next steps * [Troubleshoot a mod](</docs/en/plugins/mods/troubleshoot>): find out why a mod does nothing in a session - * [Mods reference](</docs/en/plugins/mods/reference>): every event’s input and result, for writing stubs + * [Type definitions for your version](</docs/en/plugins/mods/create#get-the-types-for-your-build>): every event’s input and result, for writing stubs
modified Troubleshoot a mod View current →
--- a/troubleshoot.md +++ b/troubleshoot.md @@ -156,7 +156,7 @@ ### `$.agent.register refused: the hooks module that made the call is no longer loaded` -The line starts with your mod’s name, as in `first-mod: $.agent.register refused: the hooks module that made the call is no longer loaded (it was reloaded or removed)`, and the agent isn’t registered. Your mod was reloaded or unloaded before the call. A reload loads a fresh copy of the hooks module, and this call came from code still running in the old copy, such as a hook that hadn’t returned yet. If that hook doesn’t catch the rejection, it fails and Claude Code skips it. To register the agent from the copy that stays loaded, make the call in your [`session.start`](</docs/en/plugins/mods/reference#session>) hook, which runs again in each fresh copy after a reload. +The line starts with your mod’s name, as in `first-mod: $.agent.register refused: the hooks module that made the call is no longer loaded (it was reloaded or removed)`, and the agent isn’t registered. Your mod was reloaded or unloaded before the call. A reload loads a fresh copy of the hooks module, and this call came from code still running in the old copy, such as a hook that hadn’t returned yet. If that hook doesn’t catch the rejection, it fails and Claude Code skips it. To register the agent from the copy that stays loaded, make the call in your [`session.start`](</docs/en/plugins/mods/api#add-a-command-or-a-tool>) hook, which runs again in each fresh copy after a reload. ### `mods that run in the hooks worker are off for this session` @@ -168,7 +168,7 @@ ### `a hook changed this call's input after the model wrote it` -In auto mode, a denied tool call gives this reason. A hook changed the tool call’s input after the [server-side classifier](</docs/en/permission-modes#server-side-classifier-review>) reviewed it, so that review doesn’t cover what would run. The hook can be a mod’s [`tool.call`](</docs/en/plugins/mods/reference#tools>) or [`turn.step`](</docs/en/plugins/mods/reference#turns>) hook, or a [`PreToolUse`](</docs/en/hooks#pretooluse>) settings hook. The message doesn’t say which. The message tells Claude to issue the call once more as recorded. If that’s denied too, the hook changes the input every time, so turn off the mod or hook, or leave auto mode and approve the call yourself. +In auto mode, a denied tool call gives this reason. A hook changed the tool call’s input after the [server-side classifier](</docs/en/permission-modes#server-side-classifier-review>) reviewed it, so that review doesn’t cover what would run. The hook can be a mod’s [`tool.call`](</docs/en/plugins/mods/events#guard-or-change-a-tool-call>) or [`turn.step`](</docs/en/plugins/mods/events#follow-a-turn>) hook, or a [`PreToolUse`](</docs/en/hooks#pretooluse>) settings hook. The message doesn’t say which. The message tells Claude to issue the call once more as recorded. If that’s denied too, the hook changes the input every time, so turn off the mod or hook, or leave auto mode and approve the call yourself. In [some interactive terminal sessions and VS Code sessions](</docs/en/hooks#pretooluse-updatedinput-in-auto-mode>), the same denial gives the reason `a hook changed this call's input after auto mode reviewed it`. The repeated call there carries the mod’s first change, and a `tool.call` hook still runs on it, but a further change is dropped. You don’t need to change your mod unless Claude tells you in its reply that [auto mode couldn’t check the call](</docs/en/errors#hook-changed-input-after-review>). @@ -226,7 +226,7 @@ ### A `ui.render` line says `threw while drawn` -The line names the [render site](</docs/en/plugins/mods/reference#render-sites>), then says `threw while drawn:` and the error, as in `first-mod: ui.render (ToolUse) threw while drawn: <error>; the engine drew its own`. Claude Code hit that error while drawing the tree your [`ui.render`](</docs/en/plugins/mods/reference#interface>) hook returned, or while drawing the site from the [`props` your hook passed to `next`](</docs/en/plugins/mods/interface#change-what-claude-code-already-draws>). The ending `the engine drew its own` means the site shows Claude Code’s usual content. Read the error and fix the value in your hook that caused it. Before v2.1.289, this error in a transcript row ended the session with [`Claude Code exited after an unrecoverable interface error`](</docs/en/errors#exited-after-an-unrecoverable-interface-error>). +The line names the [render site](</docs/en/plugins/mods/reference#render-sites>), then says `threw while drawn:` and the error, as in `first-mod: ui.render (ToolUse) threw while drawn: <error>; the engine drew its own`. Claude Code hit that error while drawing the tree your [`ui.render`](</docs/en/plugins/mods/interface#pick-where-to-draw>) hook returned, or while drawing the site from the [`props` your hook passed to `next`](</docs/en/plugins/mods/interface#change-what-claude-code-already-draws>). The ending `the engine drew its own` means the site shows Claude Code’s usual content. Read the error and fix the value in your hook that caused it. Before v2.1.289, this error in a transcript row ended the session with [`Claude Code exited after an unrecoverable interface error`](</docs/en/errors#exited-after-an-unrecoverable-interface-error>). ### `the module failed without a message` @@ -268,7 +268,7 @@ Either that app doesn’t draw the site or element, or the session is one where the VS Code extension draws nothing for mods. The mod’s other hooks still run. Check for these causes: - * **The site or element isn’t drawn in that app** : look up your site in the [render sites](</docs/en/plugins/mods/reference#render-sites>) table and your elements in the [elements](</docs/en/plugins/mods/reference#elements>) table. For an element the app lacks, check `e.surface` in the hook and return a tree the app can draw. + * **The site or element isn’t drawn in that app** : look up your site in the [render sites](</docs/en/plugins/mods/reference#render-sites>) table and your elements in the [elements](</docs/en/plugins/mods/interface#build-a-tree-from-elements>) table. For an element the app lacks, check `e.surface` in the hook and return a tree the app can draw. * **The VS Code extension is older than 2.1.299** : the chat panel draws for mods from [extension version](</docs/en/vs-code#install-the-extension>) 2.1.299. Check the version in VS Code’s Extensions view and update the extension there. * **The extension is older than 2.1.304 and the session doesn’t fetch feature flags** : update the extension, or run `claude` in VS Code’s integrated terminal instead. Sessions on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry skip the fetch. For the others that skip it, such as a [Claude apps gateway](</docs/en/claude-apps-gateway>) session, see [Features that need feature-flag fetching](</docs/en/env-vars#features-that-need-feature-flag-fetching>). @@ -278,7 +278,7 @@ ### Your edits don’t take effect -If your plugin was [copied at install](</docs/en/plugins/loading#in-place-and-copied-plugins>), Claude Code runs that copy. Develop with `--plugin-dir` pointed at your working copy, as in `claude --plugin-dir ./first-mod`, which reloads when you save. +If your plugin was [copied at install](</docs/en/plugins/loading#in-place-and-copied-plugins>), Claude Code runs that copy. Develop with `--plugin-dir` pointed at your working copy, as in `claude --plugin-dir ./first-mod`. ### A value resets when the module reloads
modified Troubleshoot installation and login View current →
--- a/troubleshoot-install.md +++ b/troubleshoot-install.md @@ -261,15 +261,19 @@ * `~/.cache/claude/`: staged downloads * [`~/.claude.json`](</docs/en/claude-directory>): your global config file, where the installer records the install method -If you set `XDG_DATA_HOME`, `XDG_STATE_HOME`, or `XDG_CACHE_HOME`, the install uses those in place of `~/.local/share`, `~/.local/state`, and `~/.cache`. If you set [`CLAUDE_CONFIG_DIR`](</docs/en/env-vars>), the global config file lives under that directory instead of your home directory. Check whether the directories are writable: - - test -w ~/.local/bin && echo "writable" || echo "not writable" - test -w ~/.claude && echo "writable" || echo "not writable" - -If either directory isn’t writable, create the install directory and set your user as the owner: - - sudo mkdir -p ~/.local/bin - sudo chown -R $(whoami) ~/.local +If you set `XDG_DATA_HOME`, `XDG_STATE_HOME`, or `XDG_CACHE_HOME`, the install uses those in place of `~/.local/share`, `~/.local/state`, and `~/.cache`. If you set [`CLAUDE_CONFIG_DIR`](</docs/en/env-vars>), the global config file lives under that directory instead of your home directory. In Bash or Zsh, create missing directories and check whether each one is writable: + + for dir in ~/.claude/downloads ~/.local/bin ~/.local/share/claude ~/.local/state/claude ~/.cache/claude; do + mkdir -p "$dir" && test -w "$dir" && echo "writable: $dir" || echo "not writable: $dir" + done + +If a directory isn’t writable, or the install error names a path inside one, take ownership of all these directories. The first `chown` is for `~/.local/bin` and the parent directories, and the second is for the install directories and their contents: + + sudo mkdir -p ~/.claude/downloads ~/.local/bin ~/.local/share/claude ~/.local/state/claude ~/.cache/claude + sudo chown -h $(whoami) ~/.claude ~/.local ~/.local/bin ~/.local/share ~/.local/state ~/.cache + sudo chown -R $(whoami) ~/.claude/downloads ~/.local/share/claude ~/.local/state/claude ~/.cache/claude + +Then run the [install command](</docs/en/setup#install-claude-code>) again. ### Verify the binary works
modified Agent SDK reference - TypeScript View current →
--- a/typescript.md +++ b/typescript.md @@ -3003,7 +3003,7 @@ metadata?: { source?: string }; }; -Asks the user clarifying questions during execution. See [Handle approvals and user input](</docs/en/agent-sdk/user-input#handle-clarifying-questions>) for usage details. When a user skips a question, describe the skip in `answers`, which Claude reads. To tell a skip from an answer in `tool_use_result`, also set `unanswered` on that question’s entry in `updatedInput.annotations`. Set `unanswered` only when `SDKSystemMessage.capabilities` lists `ask_user_question_unanswered_v1`. This `canUseTool` return value sets `answers` and `unanswered`: +Asks the user clarifying questions during execution. See [Handle approvals and user input](</docs/en/agent-sdk/user-input#handle-clarifying-questions>) for usage details. When a user skips a question, describe the skip in `answers`. To tell a skip from an answer in `tool_use_result`, also set `unanswered` on that question’s entry in `updatedInput.annotations`. Set `unanswered` only when `SDKSystemMessage.capabilities` lists `ask_user_question_unanswered_v1`. This `canUseTool` return value sets `answers` and `unanswered`: return { behavior: "allow",
modified Zero data retention View current →
--- a/zero-data-retention.md +++ b/zero-data-retention.md @@ -33,7 +33,7 @@ ---|--- Chat on claude.ai| Chat conversations through the Claude for Enterprise web interface are not covered by ZDR. Cowork| Cowork sessions are not covered by ZDR. -Artifacts| Artifacts in chat conversations and Cowork sessions are not covered by ZDR, and are kept until deleted unless your organization sets a retention period for them. Artifacts are not available in Claude Code with ZDR. +Artifacts| Artifacts in chat conversations and Cowork sessions are not covered by ZDR, and are kept until deleted unless your organization sets a retention period for them. This includes [Claude Docs](<https://support.claude.com/en/articles/16923645-get-started-with-claude-docs>) and [Claude Sheets](<https://support.claude.com/en/articles/18324300-get-started-with-claude-sheets>). Artifacts are not available in Claude Code with ZDR. Claude in Chrome| The [Claude in Chrome](<https://support.claude.com/en/articles/13065128-claude-in-chrome-admin-controls>) browser extension is not covered by ZDR. It is [not available in Claude Code](</docs/en/chrome#chrome-availability-with-hipaa-or-zero-data-retention>) with ZDR, but members can still use it outside Claude Code where your organization allows it. Claude Code Analytics| Does not store prompts or model responses, but collects productivity metadata such as account emails and usage statistics. Contribution metrics are not available for ZDR organizations; the [analytics dashboard](</docs/en/analytics>) shows usage metrics only. User and seat management| Administrative data such as account emails and seat assignments is retained under standard policies. @@ -48,8 +48,7 @@ [Cloud sessions](</docs/en/claude-code-on-the-web>), including those started from the [Desktop app](</docs/en/desktop#cloud-sessions>)| Requires server-side storage of session data, including conversation history with prompts and completions. [Chat and Cowork unified](<https://support.claude.com/en/articles/17444462-set-up-and-manage-the-new-unified-claude-experience-for-your-enterprise-organization>)| Requires cloud sessions. [Claude Tag](<https://claude.com/docs/claude-tag>)| Retains channel memory and session transcripts. -[Artifacts](</docs/en/artifacts>) in Claude Code| Requires storing published page content on Anthropic-operated infrastructure. -[Claude Docs](<https://support.claude.com/en/articles/16923645-get-started-with-claude-docs>)| Requires storing document content on Anthropic-operated infrastructure. +[Artifacts](</docs/en/artifacts>) in Claude Code, including [Claude Docs](<https://support.claude.com/en/articles/16923645-get-started-with-claude-docs>) and [Claude Sheets](<https://support.claude.com/en/articles/18324300-get-started-with-claude-sheets>)| Requires storing their content on Anthropic-operated infrastructure. Feedback submission (`/feedback`, `/bug`, `/share`)| Submitting feedback sends conversation data to Anthropic. [Remote Control](</docs/en/remote-control>)| Stores the session transcript on Anthropic servers to sync the conversation across devices.