Follow Discord
Sweep 24 Nov 2026 · 22:58Z Build v2.1.332 549 read Stable v2.1.326 Latest v2.1.332 Next v2.1.332 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One capture · claude-code

One read of Claude Code CLIclaude-code-20261125T010701Z

13 pages moved out of 221 read.

Pages moved 13 significant first
Pages read 221 in this capture
Captured 01:07 UTC
Corpus hash df77cd3f8374 corpus-hash

What this read moved

1-13 of 13

artifacts Changed · +12 / -10 lines

from line 39
3939Build a dashboard artifact of last week's deploy failures by service and keep it updated as you investigate.
4040```
4141 
42Unless you name a location, Claude writes the page to an HTML or Markdown file in a temporary directory outside your project, then publishes it. The artifact stays private to you until you [share it](#share-an-artifact).
42The artifact stays private to you until you [share it](#share-an-artifact).
4343 
4444After the first publish, Claude prints the URL, and your browser opens to the new page.
4545 
from line 54
5454 
5555### When Claude Code asks before publishing
5656 
57A new artifact that Claude publishes in response to a prompt you type goes through without a permission prompt or classifier review. In these cases Claude Code asks you first, or in [auto mode](https://code.claude.com/docs/en/permission-modes.md#eliminate-prompts-with-auto-mode) has the classifier review the publish:
57A new artifact that Claude publishes in response to a prompt you type can go through without a permission prompt or classifier review.
5858 
59Outside `bypassPermissions` mode, the publish needs your approval in cases such as these, or the classifier's review in [auto mode](https://code.claude.com/docs/en/permission-modes.md#eliminate-prompts-with-auto-mode):
60 
5961| When | What Claude Code does |
6062| :- | :- |
6163| The session is in [plan mode](https://code.claude.com/docs/en/permission-modes.md#analyze-before-you-edit-with-plan-mode) | Asks before the first publish of each artifact |
from line 64
6264| The publish declares runtime capabilities for the page, such as [connector calls](#pull-live-data-with-mcp-connectors) or [file downloads](#offer-a-file-download) | Asks before that publish |
6365| You shared the artifact publicly | Asks at least once per conversation before changing it, and before each reply to a comment on it |
6466| Claude publishes in a turn that a [session-scoped scheduled task](https://code.claude.com/docs/en/scheduled-tasks.md) firing in your session started, rather than a prompt you typed | Asks before the first publish of each artifact |
65| Claude can't read the file without your approval | Asks before publishing it. An allow rule for the `Artifact` tool doesn't skip this prompt |
67| Claude publishes from a file it can't read without your approval | Asks before publishing, or refuses the file. An allow rule for the `Artifact` tool doesn't count as approval |
6668| In [Manual](https://code.claude.com/docs/en/permission-modes.md) or `acceptEdits` mode, Claude makes a small change to an artifact's file it can't edit without your approval, such as a project file in Manual mode | Asks before publishing the change. You're asked even if an allow rule covers the `Artifact` tool, because the edit to the file needs your approval |
6769 
68To let Claude read a file outside your [working directories](https://code.claude.com/docs/en/permissions.md#working-directories) without your approval, add its folder as a working directory with [`--add-dir`](https://code.claude.com/docs/en/cli-reference#cli-flags) at launch or `/add-dir` during the session. Claude already reads files in those directories, and in the temporary directory it writes pages to, without asking.
70To let Claude read a file outside your [working directories](https://code.claude.com/docs/en/permissions.md#working-directories) without your approval, add its folder as a working directory with [`--add-dir`](https://code.claude.com/docs/en/cli-reference#cli-flags) at launch or `/add-dir` during the session.
6971 
7072If a publish prompt includes a sentence such as `Also makes 1 edit to that file on disk.`, Claude is changing the artifact's file and publishing it in one step. When you approve the prompt, Claude Code publishes the page, then writes the change to your file.
7173 
7274## Update an artifact
7375 
74Ask Claude to revise the page, or let a long-running task republish as it makes progress. Claude edits the underlying file and publishes again to the same URL.
76Ask Claude to revise the page, or let a long-running task republish as it makes progress. Claude publishes again to the same URL.
7577 
7678```text wrap theme={null}
7779Add a per-region breakdown below the summary chart and republish.
from line 148
146148 
147149When someone shares an artifact with you, you can have Claude read it: give Claude its URL, or attach it from [`/artifacts`](#find-an-artifact-again).
148150 
149Claude reads a page someone else wrote the way it reads a web page with [WebFetch](https://code.claude.com/docs/en/tools-reference.md#webfetch-tool-behavior): it gets a summary of what it asked about rather than the raw page, and the summary reports instructions written into the page instead of relaying them. Claude Code also saves the page's full source to a local file, which Claude can open when it needs the exact content, such as to republish the artifact as an [editor](#let-someone-edit-with-you).
151Claude Code can save the page's full source to a local file, which Claude can open.
150152 
151153Claude Code asks for your approval before Claude reads the artifact in these cases, in addition to any prompt your permission mode or rules call for:
152154 
from line 163
161163 
162164When you share an artifact within your organization, the people you share it with can leave comments on the page, and you can have Claude read those comments and reply to them. You need Claude Code v2.1.221 or later. Claude reads the comments in two cases:
163165 
164* **You ask Claude to read them**: give Claude the artifact's URL and ask for the comments. Claude lists each thread and marks the comments someone who can edit the artifact sent to it.
166* **You ask Claude to read them**: give Claude the artifact's URL and ask for the comments.
165167* **Someone who can edit the artifact sends a comment to Claude**: in a thread on the page, they send a comment with **Send to Claude**, or mention `@claude` in one. Either way, they activate the thread.
166168 
167169Claude can reply to or resolve only an activated thread. Other threads stay open until a person resolves them on the page. Viewers see each reply attributed to Claude, via you.
from line 186
184186 
185187Your [permission mode](https://code.claude.com/docs/en/permission-modes.md) decides what Claude does when a sent comment arrives:
186188 
187* **Claude replies on its own**: if you're in a permission mode that lets Claude post the reply without asking you, Claude reads the thread and replies. You see `Auto-replied to comment thread on Artifact: <name>`.
189* **Claude replies on its own**: if you're in a permission mode that lets Claude post the reply without asking you, Claude reads the thread and replies. You see a notice such as `Auto-replied to comment thread on Artifact: <name>`.
188190* **Claude waits for you**: outside plan mode, when posting the reply [would need your approval](#when-claude-code-asks-before-publishing), you see `Comments are waiting on Artifact: <name>`. Claude then asks you for approval to read the thread, and again to post the reply.
189191* **Claude pauses in plan mode**: you see `Comments are waiting on Artifact: <name>`, and Claude doesn't reply until you leave plan mode and ask it to read and reply.
190192 
from line 200
198200* **Stop the task in `/tasks`**: Claude stops replying on that artifact until you ask it to resume replies there. Publishing the artifact again doesn't start replies again, and the stop still applies when you resume the session later.
199201* **Press `Ctrl+X Ctrl+K` twice within 3 seconds**: the chord that [stops every running background subagent](https://code.claude.com/docs/en/interactive-mode.md#general-controls) also stops Claude from replying on every artifact for the rest of the session. Asking Claude to resume replies doesn't undo this stop.
200202 
201A watch that Claude Code started on its own can end after the artifact goes several hours without activity. You see `Stopped watching Artifact: <name> (idle)`. To start the watch again, publish the artifact again or ask Claude to watch it. If you see `(made room for a newer watch)` in place of `(idle)`, your session reached its limit of 25 watches. Publish again to restart that watch.
203A watch that Claude Code started on its own can end after the artifact goes several hours without activity. You see `Stopped watching Artifact: <name> (idle)`. If you see `(made room for a newer watch)` in place of `(idle)`, your session reached its limit of 25 watches. In either case, ask Claude to republish the artifact to restart the watch.
202204 
203205If the service that delivers comments becomes unavailable or stops answering, Claude Code keeps trying to reconnect for a while, then stops watching each artifact your session was watching.
204206 
from line 353
351353 
352354## Page constraints
353355 
354Each artifact is one self-contained page. Claude Code wraps the file you publish in an HTML document shell and serves it under a strict Content Security Policy (CSP), which shapes what the page can do.
356Each artifact is served under a strict Content Security Policy (CSP) that limits what the page can do.
355357 
356358| Constraint | Effect |
357359| :- | :- |

desktop Changed · +17 / -0 lines

#### Deploy skills for all users

from line 2095
20952095 
20962096For the permission, plugin, and delivery keys only a managed source can set, see [Keys only managed settings can set](https://code.claude.com/docs/en/managed-settings.md#managed-only-settings).
20972097 
2098#### Deploy skills for all users
2099 
2100To give every user the same skills in local and SSH sessions, deploy them as [enterprise skills](https://code.claude.com/docs/en/skills.md#where-skills-live), which you install once on a machine for all of its users. Install them on the machine where the session runs:
2101 
2102* **Local sessions**: each user's computer
2103* **SSH sessions**: each remote host
2104 
2105Install each skill at the path for that machine's platform:
2106 
2107| Platform | Path |
2108| :- | :- |
2109| macOS | `/Library/Application Support/ClaudeCode/.claude/skills/<skill-name>/SKILL.md` |
2110| Linux | `/etc/claude-code/.claude/skills/<skill-name>/SKILL.md` |
2111| Windows | `C:\Program Files\ClaudeCode\.claude\skills\<skill-name>\SKILL.md` |
2112 
2113To confirm that your skills load, test with a skill whose [frontmatter](https://code.claude.com/docs/en/skills.md#frontmatter-reference) sets only `name` and `description`. Start a new session and send a message, then type `/` and the first letters of the skill's name in the prompt box. The skill appears in the list.
2114 
20982115#### Claude Code settings that behave differently in the Code tab
20992116 
21002117In a local session, these keys, among others, have a different effect or no visible one, because the Code tab replaces the terminal interface. They still apply in the terminal, so you can leave them set.

errors Changed · +7 / -0 lines

This page is larger than the 256 KiB this site keeps, so one side of the diff below stops where the stored text does.

from line 348
348348| `/feedback is disabled by your organization's policy`, or the same for `/bug` or `/share` | [Command-line errors](#feedback-is-disabled-by-your-organizations-policy) |
349349| `` `plugin eval` is currently in early access `` / `` `plugin eval` is currently unavailable `` | [Plugin errors](#plugin-eval-is-currently-in-early-access) |
350350| `credential store on this machine holds a symbolic link inside it` | [Grant tools](https://code.claude.com/docs/en/plugin-evals.md#grant-tools) |
351| `cannot be disallowed`, from `claude plugin eval` | Use a built-in tool's [exact name](https://code.claude.com/docs/en/plugin-evals.md#disallow-tools), and [put the target before `--disallow-tools`](https://code.claude.com/docs/en/plugin-evals#choose-what-to-evaluate) |
351352| `cannot be evaluated where sessions load it` | [Test plugins with evals](https://code.claude.com/docs/en/plugin-evals.md#cannot-be-evaluated-where-sessions-load-it) |
352353| `Marketplace "<name>" is registered from an untrusted source` | [Plugin errors](#marketplace-is-registered-from-an-untrusted-source) |
353354| `Claude Code refuses the marketplace name "<name>"` | [Plugin errors](#claude-code-refuses-the-marketplace-name) |
from line 390
389390| `Skipping connection (recent failure cached; retries automatically in 15 min, or edit the plugin config to retry now)` | [Plugin errors](#skipping-connection-recent-failure-cached) |
390391| `is not added on this machine, so your organization's marketplace policy keeps its plugins off` | [Add a marketplace](https://code.claude.com/docs/en/plugins/install.md#add-a-marketplace) |
391392| `A mod's http.fetch hook stopped this request` | [Turn mods on or off](https://code.claude.com/docs/en/plugins/mods/overview.md#turn-mods-on-or-off) |
393| `hook was skipped. "<mod>" runs first and sent the event on past it.` | If you listed the quoted mod in [`prependPlugins`](https://code.claude.com/docs/en/settings-reference#prependplugins) in your user settings, change that mod. Otherwise, ask your administrator. |
394| `<file>: changed while it was read` | If `claude plugin validate` printed this, rerun it. Otherwise, restart the session. |
395| `installed mods are off for now` | [Check whether mods can load](https://code.claude.com/docs/en/plugins/mods/troubleshoot.md#check-whether-mods-can-load) |
396| `the hooks worker was lost with <mod>'s <event> hook in flight` | Fix the named mod. For one cause, see [`it crashed the hooks worker`](https://code.claude.com/docs/en/plugins/mods/troubleshoot#it-crashed-the-hooks-worker). |
397| `dispatches in a row for fills by <mods>` | Change the named mods so they fill the prompt box at most eight times in a row. |
392398| `Error: No such tool available: <tool name>` | [Tool errors](#no-such-tool-available) |
393399| `MCP server "<name>" connection closed before the tool call was answered` | [Tool errors](#connection-closed-before-the-tool-call-was-answered) |
394400| `MCP server "<name>" is disabled — re-enable it via /mcp to use its tools` | [Tool errors](#mcp-server-is-disabled) |
from line 555
549555| `headersHelper not run — this workspace has no persisted trust` | [Configuration warnings](#headershelper-not-run) |
550556| `Invalid permission rule "..." was skipped: Malformed Tool(content) rule` | [Configuration warnings](#malformed-tool-content-rule) |
551557| `matches no tool · check for typos` / `matches no known tool — check for typos` | [Configuration warnings](#matches-no-tool) |
558| `lets <tool> run without asking only in the working directories` / `adds nothing to <tool>'s default` | [Allow a file tool outside the working directories](https://code.claude.com/docs/en/permissions.md#allow-a-file-tool-outside-the-working-directories) |
552559| `... is not matched by file permission checks` | [Configuration warnings](#is-not-matched-by-file-permission-checks) |
553560| `Write(<path>) never matches · use Edit(<path>)` / `Glob(<path>) never matches · use Read(<path>)` | [Configuration warnings](#is-not-matched-by-file-permission-checks) |
554561| `... has a wildcard before the rest of the command` | [Configuration warnings](#has-a-wildcard-before-the-rest-of-the-command) |
from line 2384
23772384 
23782385### Failed to fetch session from Sessions API
23792386 
2380This message means Claude Code found the [cloud session you asked to pull into your terminal](https://code.claude.com/docs/en/claude-code-on-the-web.md#from-cloud-to-terminal) but couldn't read its conversation history from Anthropic's servers, so it didn't open it:
2381 
2382```text theme={null}
2383Failed to fetch session from Sessions API: Failed to fetch session logs
2384```
2385 
2386You see it after `claude --teleport`, `/teleport`, or choosing the session in the [`/tasks`](https://code.claude.com/docs/en/commands) list. `claude --teleport <session-id>` prints it and exits with code 1.
2387 
2388**What to do:**
2389 
2390* Run the same teleport again. If it fails the same way, [report the problem](#report-an-error)
2391 
2392Before v2.1.296, Claude Code didn't retry a failed read, and after one it could open the session with an empty conversation and report success instead of printing this message.
2393 
2394### Couldn't load the history of cloud session
2395 
2396This message means Claude Code found the [cloud session you asked to pull into your terminal](https://code.claude.com/docs/en/claude-code-on-the-web.md#from-cloud-to-terminal), but the request for its conversation history came back as not found:
2397 
2398```text theme={null}
2399Couldn't load the history of cloud session session_01HJKLMNOPQRSTUVWXYZ. Check it at https://claude.ai/code/session_01HJKLMNOPQRSTUVWXYZ?from=cli
2400```
2401 
2402**What to do:**
2403 
2404* Open the link in the message to check the session in your browser. If it opens there and the same teleport fails this way again, [report the problem](#report-an-error).
2405 
2406### Couldn't reconnect to your Remote Control session
2407 
2408For the cause and the fix, see [this message in Remot
2387This message means Claude Code found the [cloud session you asked to pull into your terminal](https://code.claude.com/docs/en/claude-code-on-the-web.md#from-cloud-to-terminal) but couldn't

permissions Changed · +10 / -0 lines

#### Allow a file tool outside the working directories

from line 102
102102 
103103The label shown for a tool in the transcript and permission dialog can differ from its canonical name. For example, the tool labeled `Stop Task` in the transcript has the canonical name `TaskStop`. Permission rules and [hook matchers](https://code.claude.com/docs/en/hooks.md) don't match the label, so a rule written as `Stop Task` doesn't match. For deny and ask rules, a [startup warning](https://code.claude.com/docs/en/errors.md#matches-no-tool) says so. Use the canonical names listed in the [tools reference](https://code.claude.com/docs/en/tools-reference.md).
104104 
105#### Allow a file tool outside the working directories
106 
107With an `Edit(*)`, `Write(*)`, or `NotebookEdit(*)` allow rule, you pre-approve the tool only in the [working directories](#working-directories). To pre-approve paths outside them too, write the bare name of each tool you want, such as `Edit` or `Read`. Some calls still aren't pre-approved, such as writes to [protected paths](https://code.claude.com/docs/en/permission-modes.md#protected-paths) and reads from [network paths](#network-paths).
108 
109When the startup warning says your `Read(*)` rule `adds nothing to Read's default`, you can delete the rule from your settings file.
110 
111> [!WARNING]
112>
113> Don't rely on a file-tool `(*)` allow rule to keep the tool in the working directories. Versions before v2.1.317 treat the rule as the bare name, and later versions can too if Anthropic turns the working-directory limit off. Instead, [block file-tool reads and writes outside the working directories](#block-file-tool-reads-and-writes-outside-the-working-directories).
114 
105115### Use specifiers for fine-grained control
106116 
107117Add a specifier in parentheses to match specific tool uses:

plugin-evals Changed · +32 / -6 lines

#### Pre-approve reads from another path ### Remove a built-in tool from runs

from line 195
195195 
196196### Set run limits and tools in prompt.md
197197 
198Set a case's `max_turns`, `timeout_seconds`, `model`, `tags`, and the `allowed_tools` it may use in `prompt.md` frontmatter; the [prompt.md frontmatter](#prompt-md-fields) reference lists every field and its default.
198Set a case's `max_turns`, `timeout_seconds`, `model`, `tags`, and `allowed_tools` in `prompt.md` frontmatter. For the other fields and the defaults, see the [prompt.md frontmatter](#prompt-md-fields) reference.
199199 
200200Claude receives the body exactly as you wrote it. `@path` mentions in it aren't expanded into file attachments, so if Claude needs to read a file, grant a tool for it in `allowed_tools`.
201201 
from line 334
334334 
335335Add `--case <glob>` to filter by case name and `--tag <tag>` to keep cases with any of the given tags.
336336 
337Put the target before `--tag`, `--allow-tools`, and `--json`. The first two take a list and `--json` takes an optional path, so each of them reads a target that follows as its own value.
337Put the target before `--tag`, `--allow-tools`, `--disallow-tools`, and `--json`. The first three take a list and `--json` takes an optional path, so each of them reads a target that follows as its own value.
338338 
339339### Grant tools
340340 
341341Runs never stop to ask for permission. Built-in tools that need a grant you didn't give, such as `Bash`, `Write`, `Edit`, `WebFetch`, and `WebSearch`, are removed from the session, so Claude can't call them at all.
342342 
343A run allows only the read-only tools the case lists in `allowed_tools`, from `Read`, `Glob`, `Grep`, `NotebookRead`, `Skill`, `AskUserQuestion`, `Agent`, `TodoWrite`, and the task tools `TaskCreate`, `TaskGet`, `TaskList`, `TaskUpdate`, and `TaskStop`, plus whatever you grant with `--allow-tools`. That grant applies to every case in the run. To let cases use `Bash`, `Write`, `Edit`, `WebFetch`, or `WebSearch`, grant them yourself:
343A run pre-approves the read-only tools the case lists in `allowed_tools`, from `Read`, `Glob`, `Grep`, `NotebookRead`, `Skill`, `AskUserQuestion`, `Agent`, `TodoWrite`, and the task tools `TaskCreate`, `TaskGet`, `TaskList`, `TaskUpdate`, and `TaskStop`, plus whatever you grant with `--allow-tools`. That grant applies to every case in the run.
344344 
345To let cases use `Bash`, `Write`, `Edit`, `WebFetch`, or `WebSearch`, grant them with `--allow-tools`:
346 
345347```bash theme={null}
346348claude plugin eval . --allow-tools Write Edit "Bash(npm test *)"
347349```
from line 350
348350 
349351When a case asked for a tool you didn't grant, the progress output lists it as `not granted`. Tools on a [mocked](#mock-mcp-servers) MCP server need no grant. Tools on a real plugin MCP server need both the server started, with `--allow-real-servers` or `--mocks off`, and a grant by name, such as `--allow-tools "mcp__plugin_my-plugin_github__*"`; a plugin's MCP tools are named `mcp__plugin_<plugin>_<server>__<tool>`.
350352 
353#### Pre-approve reads from another path
354 
355To pre-approve reads under a folder such as `/data`, grant a [`Read` rule](https://code.claude.com/docs/en/permissions#read-and-edit) with a leading `//`, as in `--allow-tools "Read(//data/**)"`. On native Windows, the same grant for `C:\data` is `Read(//c/data/**)`. Listing `Read`, `Glob`, or `Grep` alone doesn't pre-approve every path on your machine.
356 
351357#### Shell grants need a sandbox
352358 
353359When you grant `Bash` in any form, every command runs under Claude Code's [OS-level sandbox](https://code.claude.com/docs/en/sandboxing.md). Writes are confined to the run's workspace, your home directory and Claude Code configuration are unreadable, and network access is limited to domains you grant with `--allow-tools "WebFetch(domain:example.com)"`. If you grant Bash or PowerShell on a machine with no sandbox backend, Claude Code refuses each run rather than running it unconfined, and the case shows a run error and usually scores 0. Native Windows has no backend, so run shell-granting suites under WSL2; on Linux, install `bubblewrap` and `socat` first. See the [sandboxing prerequisites](https://code.claude.com/docs/en/sandboxing.md).
from line 369
363369 
364370Ask your administrator whether that setting can change for your machine, or drop the shell grant from that run.
365371 
372### Remove a built-in tool from runs
373 
374To remove a built-in tool from every case, pass its [exact name](https://code.claude.com/docs/en/tools-reference.md) to `--disallow-tools`. For one case, list the name in that case's [`disallowed_tools`](#prompt-md-fields) field. Requires Claude Code v2.1.299 or later.
375 
376If you only omit `Agent` from `allowed_tools`, Claude can still call it.
377 
378To remove `Agent` and `TaskStop` from every case, run this in your shell:
379 
380```bash theme={null}
381claude plugin eval . --disallow-tools Agent TaskStop
382```
383 
384The output lists both tools after `Removed from Claude's tools in every case`.
385 
366386### Command options
367387 
368388This table covers the options for run count, models, scoring, cost, tool grants, mocks, and output. Run `claude plugin eval --help` for the complete list, which also includes `--case`, `--tag`, `--eval-dir`, `--no-scaffold`, `--report`, and `--verbose`.
from line 397
377397| `--threshold <0..1>` | `1.0` | A case passes when its with-arm score is at least this. Any case below it makes the command exit 1 |
378398| `--max-cost-usd <usd>` | No ceiling | A ceiling on the run's list-price cost estimate, not on plan usage. Checked before each run starts. Once spent, nothing further starts; runs that already started finish, so spend can pass the ceiling by those runs. If any run is left unstarted, the command exits 2 with partial results |
379399| `--allow-tools <tools...>` | None | Grant tools beyond the read-only set. See [Grant tools](#grant-tools) |
400| `--disallow-tools <tools...>` | None | Remove built-in tools from every case. See [Remove a built-in tool from runs](#disallow-tools) |
380401| `--scaffold` | Off | Run each case's [`scaffold_script`](#add-setup-or-history-with-case-yaml) |
381402| `--trust-plugin` | Off | Skip the first-run trust prompt for a plugin whose code and suite you'd run yourself. Pass it in CI so the job is never refused by or left waiting at the prompt. See [What a run can access](#security) |
382403| `--mocks <mode>` | `record` | `record` answers MCP tool calls from [mocks](#mock-mcp-servers), doesn't start the plugin's real servers, and saves agent-mock answers for replay. `off` ignores mocks and starts the plugin's real MCP servers |
from line 558
537558| `model` | The child session's default | Model for the agent under test. `--model` overrides it |
538559| `max_turns` | `10` | Turn cap, up to 200. Hitting it is recorded as a run error and usually lowers the score, so set it generously |
539560| `timeout_seconds` | `300` | Wall-clock cap per run, up to 3600 |
540| `allowed_tools` | `[]` | Tools the case wants, such as `[Read, Glob, Grep, Skill]`. Read-only tools are granted when listed here; for anything else, see [Grant tools](#grant-tools) |
561| `allowed_tools` | `[]` | Tools the case wants, such as `[Read, Glob, Grep, Skill]`. See [Grant tools](#grant-tools) |
562| `disallowed_tools` | | Exact built-in tool names to [remove from this case](#disallow-tools), such as `[Agent, TaskStop]` |
541563| `append_system_prompt` | | Text appended to the child session's system prompt |
542564| `env` | `{}` | Extra environment variables for the child session. Keys must match `EVAL_[A-Z0-9_]*`; any other key fails the run. The run inherits only an allowlist from your shell: basics such as `PATH` and locale, proxy and certificate settings, the variables that select and authenticate your model provider, most `ANTHROPIC_*` and `CLAUDE_CODE_*` configuration, and `EVAL_*`. To pass the plugin anything else, such as a toolchain setting, export it as an `EVAL_*` variable |
543565 
544566### case.yaml fields
545567 
546`case.yaml` is an alternative or companion to `prompt.md`: it describes a case in YAML and adds the fields that point at other files. It requires `schema_version: "1.1"` and `name`. The `prompt.md` fields `description`, `tags`, `plugins`, `runs`, and `expected_outcome` go at the top level; `model`, `max_turns`, `timeout_seconds`, `allowed_tools`, `append_system_prompt`, and `env` go under `execution:`. When both files exist, `prompt.md` frontmatter overrides the matching `case.yaml` fields, the `prompt.md` body is the prompt, and `graders/*.md` are added after any graders listed in `case.yaml`.
568`case.yaml` is an alternative or companion to `prompt.md`: it describes a case in YAML and adds the fields that point at other files. It requires `schema_version: "1.1"` and `name`. The `prompt.md` fields `description`, `tags`, `plugins`, `runs`, and `expected_outcome` go at the top level; `model`, `max_turns`, `timeout_seconds`, `allowed_tools`, `disallowed_tools`, `append_system_prompt`, and `env` go under `execution:`.
547569 
570When both files exist, `prompt.md` frontmatter overrides the matching `case.yaml` fields other than `disallowed_tools`, where the two lists combine. The `prompt.md` body is the prompt, and `graders/*.md` are added after any graders listed in `case.yaml`.
571 
548572These fields exist only in `case.yaml`:
549573 
550574| Field | Purpose |
from line 701
677701 
678702The error is expected, since `Δ` compares your plugin's runs against the baseline. In the JSON result, the baseline runs are under `cases[].arms.without`.
679703 
680In runs with your plugin loaded, a case that lists `Agent` in `allowed_tools` can dispatch one of your plugin's agents by its namespaced name, such as `my-plugin:code-reviewer` for the `code-reviewer` agent in a plugin named `my-plugin`. To skip the baseline runs, pass `--ablation none`.
704> [!NOTE]
705>
706> In runs with your plugin loaded, Claude can dispatch one of your plugin's agents by its namespaced name, such as `my-plugin:code-reviewer` for the `code-reviewer` agent in a plugin named `my-plugin`. To skip the baseline runs, pass `--ablation none`.
681707 
682708### Everything scores zero although the right files were produced
683709 

plugins/mods/create Changed · +9 / -3 lines

#### Pass `$` to your functions

from line 294
294294 
295295Check the `hooks:` line for the events your module hooks, each with its filter in braces, and `calls:` for every mods API method it calls. If your module reads or sets environment variables, look for `env reads:` and `env writes:` lines too, and `state reads:` and `state writes:` if it uses [`$.state`](https://code.claude.com/docs/en/plugins/mods/interface#keep-state). You also see one line for each hook that can refuse an action, such as `gating hook without .catch: tool.call`, which says whether that hook has a [`.catch` handler](https://code.claude.com/docs/en/plugins/mods/events#handle-a-hook-that-fails).
296296 
297If an event you meant to handle is missing from the `hooks:` lines, Claude Code won't call that hook either. The usual cause is a misspelled event name, which the command reports as an error such as `"tool.calls" is not an event`.
297If an event you meant to handle is missing from the `hooks:` lines, Claude Code won't call that hook either. Check each event name against [the types for your build](#get-the-types-for-your-build), because validation doesn't catch every typo. For example, `tool.calls` fails with `"tool.calls" is not an event`, but `tol.call` passes validation and the mod then doesn't load.
298298 
299299Follow these rules so that static analysis can find every hook and call:
300300 
301* Write each mods API call in full: `$`, the namespace, then the method, as in `$.store.get('notes')`. You can pass `$` to a function declared at the top level of the same file, and for a function of yours named `loadNotes`, the `calls:` line then reads `$.store.get (via loadNotes)`. Passing `$` to a method, a function defined inside the hook, or a function you import from another of your files fails validation. The `read` and `update` functions that [`$.state`](https://code.claude.com/docs/en/plugins/mods/interface#keep-state) uses are the imports that can take it. Don't assign `$` or one of its namespaces to a variable, destructure it, or index it with a computed name. `const ui = $.ui` fails with `$.ui is used as a value`.
301* Write each mods API call in full: `$`, the namespace, then the method, as in `$.store.get('notes')`. Don't assign `$` or one of its namespaces to a variable, destructure it, or index it with a computed name. `const ui = $.ui` fails with `$.ui is used as a value`.
302302* Write the event name in each `on` call as a string literal, such as `'tool.call'`. A variable, or a loop over a list of names, fails with `the event name passed to on() is not a string literal`.
303303* Inside `register`, don't declare a second variable or parameter named `on`. Validation fails with `"on" is declared again (shadowed)`.
304304* Import only from files inside the plugin directory, by relative path. The one bare import allowed is `claude-code`, for types and a few helpers.
from line 305
305305* Use `import` declarations at the top of the file, as in `import { name } from './file.js'`. A dynamic `import()` fails with `a dynamic import(); a hooks module imports its own files with an import declaration`.
306306* Write every file as an ES module, with `import` and not `require`. The [reference](https://code.claude.com/docs/en/plugins/mods/reference.md#files) lists the file extensions Claude Code loads.
307307 
308#### Pass `$` to your functions
309 
310You can pass `$` to a function declared at the top level of your hook's file, and to the `read` and `update` functions that [`$.state`](https://code.claude.com/docs/en/plugins/mods/interface#keep-state) uses. For a function named `loadNotes` that calls `$.store.get`, the `calls:` line reads `$.store.get (via loadNotes)`. Passing `$` to a method or to a function defined inside the hook fails validation.
311 
312On Claude Code v2.1.299 or later, you can also pass `$` to a function you import from another of your files. Declare it there with the `function` keyword, as in `export function loadNotes($) { ... }`. An imported arrow function fails with `a name bound to a function expression, outside the hook's own file`.
313 
308314### Test the mod
309315 
310316You can write automated tests for a mod and run them from your shell with `claude plugin test`, with no session, sign-in, or network. A test fires the events your hooks handle and checks what the hooks did.
from line 364
358364 
359365Before you do, check the plugin's `name`: `claude plugin validate` fails a name that [looks like one of Anthropic's own](https://code.claude.com/docs/en/plugins/manifest-reference.md#name), such as one that starts with `claude-`. The events and methods can change between releases, so your README is the place to say which Claude Code version you tested with.
360366 
361Keep developing against the directory with `--plugin-dir`, not against an installed copy. Claude Code caches an installed plugin by version, so your edits don't reach the installed copy until you increment the version and install again.
367Keep developing against the directory with `--plugin-dir`, not against an [installed copy](https://code.claude.com/docs/en/plugins/loading.md#in-place-and-copied-plugins).
362368 
363369## Next steps
364370 

plugins/mods/events Changed · +11 / -8 lines

from line 42
4242 
4343### Rewrite an event
4444 
45To change what Claude Code acts on, such as the text of a prompt, call `next` with a modified copy of the event. The event itself is immutable: it's deeply frozen, and assigning to a field throws. This hook trims each prompt before it's sent:
45To change what Claude Code acts on, call `next` with a modified copy of the event.
4646 
47This hook trims a prompt before it's sent:
48 
4749```javascript theme={null}
4850on('prompt.submit', async ($, e, next) => {
4951 // Pass on a copy of the event with its text changed
from line 53
5153})
5254```
5355 
54Later handlers and Claude Code receive the trimmed prompt and never see the original. You can also change the result: `await next(e)`, then return a copy of the result with a field replaced.
56For a prompt typed as plain text, later handlers and Claude receive the trimmed prompt.
5557 
5658### Answer an event
5759 
from line 258
256258 
257259### Rewrite or add to a prompt
258260 
259A `prompt.submit` hook sees each prompt before the turn starts, so it can rewrite the text or add to it. `e.text` is what was typed.
261To rewrite a prompt or add to it, handle `prompt.submit`, read the prompt from `e.text`, and return a value from this table:
260262 
261263| To do this | Return this |
262264| :- | :- |
263| Rewrite the prompt. The transcript and your [prompt history](https://code.claude.com/docs/en/interactive-mode.md#command-history) show the new text. | `next({ ...e, text: newText })` |
265| Rewrite a prompt typed as plain text. The transcript and your [prompt history](https://code.claude.com/docs/en/interactive-mode.md#command-history) show the new text. | `next({ ...e, text: newText })` |
264266| Add text only Claude reads, after the prompt | `next({ ...e, context: [...(e.context ?? []), extraText] })` |
265267| Stop the prompt from being sent | `{ drop: 'the reason' }` |
266268 
267This hook adds the current branch name for Claude whenever a prompt mentions a pull request:
269This hook adds the current branch name for Claude when a prompt mentions a pull request:
268270 
269271```javascript theme={null}
270272on('prompt.submit', async ($, e, next) => {
from line 282
280282 
281283When you send a prompt such as `open a PR for this change`, your message looks the same in the transcript, and Claude also reads a line such as `Current branch: feature/auth` after it. A prompt that doesn't mention a pull request goes through unchanged, and `git` doesn't run.
282284 
283To stop a prompt, return `{ drop: 'the reason' }` without calling `next`. The text goes back into the user's prompt input, and they see `Prompt dropped by a hook:` followed by your reason, so address the reason to them. The prompt still goes through in these cases:
285To stop a prompt, return `{ drop: 'the reason' }` without calling `next`. The text goes back into the user's prompt input, and they see `Prompt dropped by a hook:` followed by your reason, so address the reason to them. Don't rely on `drop` to stop every prompt. For example, a prompt goes through in these cases:
284286 
285287* **Your hook returns a `drop` after its `next(e)` call let the prompt through**: the turn still runs, and the hook [fails](#handle-a-hook-that-fails) with a message that includes `a drop after its next() was answered`
286288* **Your hook throws or times out**: Claude Code skips it and sends the prompt. [Add a `.catch` handler](#handle-a-hook-that-fails) so that a failure doesn't send a prompt the hook would have stopped.
289* **The prompt is the `/command` for a [skill with `context: fork`](https://code.claude.com/docs/en/skills#run-skills-in-a-subagent)**: your hook doesn't run. To stop the command, return `{ text: 'the reason' }` from a [`command.run`](https://code.claude.com/docs/en/plugins/mods/api#add-a-command) hook without calling `next`.
287290 
288291[Other events](https://code.claude.com/docs/en/plugins/mods/reference.md#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](https://code.claude.com/docs/en/plugins/mods/reference.md#break-prompt-cache). In a `skill.prompt` hook, you can also read [which plugin or file the skill came from](https://code.claude.com/docs/en/plugins/mods/reference.md#skill-prompt-fields).
289292 
from line 296
293296 
294297| Event | When it fires | What a hook can do |
295298| :- | :- | :- |
296| `turn.start` | A turn begins | Observe. `e.turnId` identifies the turn in the other two events. |
299| `turn.start` | A turn begins. A subagent's turn fires it with `e.agentId` set, which requires Claude Code v2.1.299 or later. | Observe. `e.turnId` identifies the turn in the other two events. |
297300| `turn.step` | Claude Code is about to send one request to the model. A turn with tool calls has several. `e.agentId` is set for a subagent's request. | Read each request's token usage, send it to a different model with `next({ ...e, model })`, or answer without calling the model |
298| `turn.complete` | The turn ended, including a turn the user interrupted, where `e.isAborted` is `true`. `e.answer` is Claude's final text, `e.durationMs` how long it took, and `e.usage` the turn's token totals. A subagent's turn fires it with `e.agentId` set. | Observe, or return an object with a `text` field, such as `{ text: 'Done in 12 seconds' }`, to show a line under the answer |
301| `turn.complete` | The turn ended, including a turn the user interrupted, where `e.isAborted` is `true`. `e.answer` is Claude's final text, `e.durationMs` how long it took, and `e.usage` the turn's token totals. A subagent's turn fires it with `e.agentId` set. | Observe. In the main conversation, return an object with a `text` field, such as `{ text: 'Done in 12 seconds' }`, to show a line under the answer. |
299302 
300303Write a `turn.step` hook as an async generator, because the event streams. `yield* next(e)` forwards the response as it streams and evaluates to the finished result. This hook logs how much of each request the Claude API served from the [prompt cache](https://code.claude.com/docs/en/prompt-caching.md):
301304 

plugins/mods/interface Changed · +3 / -3 lines

from line 197
197197 
198198### Change what Claude Code already draws
199199 
200Claude Code draws most of its interface itself: messages, tool call rows, the spinner, and more. Each of those parts is a render site too, so a mod can restyle or replace it. To change one, filter your `ui.render` hook on its name from this table:
200To change a part Claude Code draws, filter your `ui.render` hook on a render site from this table:
201201 
202202| Site | What it is |
203203| :- | :- |
from line 204
204204| `UserMessage`, `AssistantMessage` | A message in the transcript |
205205| `ToolUse`, `ToolResult`, `ToolGroup` | A tool call's row, its result, and a collapsed group of calls |
206206| `CommandOutput` | The row a command printed |
207| `AskUserQuestion` | The dialog Claude opens to ask you a question |
207| `AskUserQuestion` | The dialog Claude opens to ask you a question. A `ui.render` hook can't replace it. |
208208| `Spinner`, `ToolProgress`, `TurnDuration` | Status lines for a turn: the line that animates while Claude works, a running tool's live progress line, and the line that closes a turn |
209209| `InfoNotice`, `SessionMode`, `PromptHint` | Status lines under the logo, the mode labels in the footer, and the hint line under the prompt |
210210| `AgentRow` | A subagent's or teammate's row in the agent panel |
from line 211
211211 
212212`Pane`, `AbovePrompt`, `AskUserQuestion`, `Spinner`, `UserMessage`, `AssistantMessage`, and the tool call sites work in the terminal, the Desktop app, and the VS Code extension. The [render sites table](https://code.claude.com/docs/en/plugins/mods/reference.md#render-sites) lists where each of the others is raised.
213213 
214At a site Claude Code already draws, your hook can change a detail, replace the drawing, or leave it alone. Select a tab to see each one applied to the spinner. The examples read a `calls` variable that another hook counts, as in the [tutorial mod](https://code.claude.com/docs/en/plugins/mods/create.md#write-a-mod-yourself).
214Select a tab to see a hook change a spinner detail, replace the spinner, or leave it alone. The examples read a `calls` variable that another hook counts, as in the [tutorial mod](https://code.claude.com/docs/en/plugins/mods/create.md#write-a-mod-yourself).
215215 
216216> [tab] Change a detail
217217>

plugins/mods/reference Changed · +9 / -5 lines

from line 29
2929| Argument | What it is |
3030| :- | :- |
3131| [`$`](https://code.claude.com/docs/en/plugins/mods/events#how-a-hook-handles-an-event) | The mods API: every method in [mods API methods](#mods-api-methods). Write each call in full, namespace then method, as in `$.fs.read('notes.md')`. |
32| [`e`](https://code.claude.com/docs/en/plugins/mods/events#how-a-hook-handles-an-event) | The event's input, as deeply frozen plain data. To change it, pass a copy to `next`. |
32| [`e`](https://code.claude.com/docs/en/plugins/mods/events#how-a-hook-handles-an-event) | The event's input. To change it, pass a copy to `next`. |
3333| [`next(e)`](https://code.claude.com/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. |
3434| [`next.signal`](https://code.claude.com/docs/en/plugins/mods/api#stop-background-work) | An `AbortSignal` that aborts when the event is abandoned |
3535| `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](https://code.claude.com/docs/en/plugins/mods/events.md#the-order-mods-run-in): `prepend`, `user`, `append`, or `builtin`. |
from line 139
139139| :- | :- | :- |
140140| [`turn.start`](https://code.claude.com/docs/en/plugins/mods/events#follow-a-turn) | A turn begins | `next(e)` |
141141| [`turn.step`](https://code.claude.com/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 })` |
142| [`turn.complete`](https://code.claude.com/docs/en/plugins/mods/events#follow-a-turn) | A turn ended | `next(e)`, or `{ text }` to show a line under the answer |
142| [`turn.complete`](https://code.claude.com/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 |
143143 
144144### Session
145145 
from line 247
247247| [`$.session`](https://code.claude.com/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 }`. |
248248| `$.config` | `list`, `set` |
249249| [`$.settings`](https://code.claude.com/docs/en/plugins/mods/api#reach-files-processes-and-the-network) | `read` |
250| [`$.env`](https://code.claude.com/docs/en/plugins/mods/api#reach-files-processes-and-the-network) | `get`, `set` |
250| [`$.env`](https://code.claude.com/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. |
251251| [`$.fs`](https://code.claude.com/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`. |
252252| [`$.store`](https://code.claude.com/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](https://code.claude.com/docs/en/plugins/mods/interface.md#save-from-more-than-one-session). |
253253| [`$.state`](https://code.claude.com/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` |
from line 259
259259| `$.audio` | `play`, `speak` |
260260| `$.telemetry` | `log`, `mark`. A record is sent only when Claude Code or a built-in mod makes the call. |
261261 
262In 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' }`.
263 
262264## Render sites
263265 
264266A 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](https://code.claude.com/docs/en/plugins/mods/interface.md#change-what-claude-code-already-draws) shows what a hook can do at a site, with an example of each choice.
from line 419
417419| `$.model.complete` `maxTokens` | 1024 by default, up to 64,000 or the model's output limit |
418420| `$.fs.read` and `$.fs.write` | 4 MiB for one file. On v2.1.326 or later, read a larger file in parts with `$.fs.read(path, { offset, length })`, both in bytes. |
419421| A `$.http.fetch` request body | 4 MiB, counted in characters. A call with a larger body rejects. |
420| A `$.http.fetch` response body | 4 MiB. `text` holds the first 4 MiB and the rest isn't read. When the `Content-Length` header declares more, the call rejects instead, with a reason that ends `is over the 4194304-byte limit`, except when the last request after any redirects uses the `HEAD` method. The `HEAD` exemption requires Claude Code v2.1.296 or later. |
422| A `$.http.fetch` response body | 4 MiB. `text` holds the first 4 MiB and the rest isn't read. When the `Content-Length` header declares more, the call rejects instead, with a reason that ends `is over the 4194304-byte limit`. The call ignores that header on a 204, 205, or 304 response, and when its last request after any redirects uses `HEAD`. The `HEAD` case requires Claude Code v2.1.296 or later, and the others v2.1.299 or later. |
421423| One `$.http.fetch` call, redirects and body included | 30 seconds |
422424| Redirects one `$.http.fetch` call follows | 5 |
423425| A hook's `drop` reason or `config.set` `deny` reason | 4,096 characters. The end of a longer reason is cut, and the drop or deny still applies. The cut requires Claude Code v2.1.292 or later, and on earlier versions the hook [fails](https://code.claude.com/docs/en/plugins/mods/events.md#handle-a-hook-that-fails) instead. |
426| All mods' elements [above the question dialog](https://code.claude.com/docs/en/plugins/mods/interface.md#change-what-claude-code-already-draws) | 12 rows in the terminal and 48 in the Desktop app or the VS Code extension, counted at a 40-column width. Over the limit, the dialog appears without your elements. |
427| A call to a method another mod added in [`engine.create`](#other-mods) | 10 seconds. After that, the call rejects with a reason that ends `did not answer within 10000ms`. |
424428| Text in one tree | The first 100,000 characters are drawn |
425429| A `Code`'s `language` or `path`, a `Select` option's `value`, or a `Client`'s `module` | 10,000 characters. If one is longer, the `ui.render` hook that returned it [fails](https://code.claude.com/docs/en/plugins/mods/events.md#handle-a-hook-that-fails). |
426430| A `Link`'s `href` | 2,048 characters. If it's longer, the `ui.render` hook that returned it [fails](https://code.claude.com/docs/en/plugins/mods/events.md#handle-a-hook-that-fails). |
from line 477
473477| [`/plugin`](https://code.claude.com/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 |
474478| [`claude plugin validate <directory>`](https://code.claude.com/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. |
475479| [`claude plugin test [directory]`](https://code.claude.com/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. |
476| [`claude --plugin-dir <directory>`](https://code.claude.com/docs/en/plugins/mods/create#write-a-mod-yourself) | Loads a plugin directory for one session and reloads its hooks module when you save. Repeat the flag to load several. |
480| [`claude --plugin-dir <directory>`](https://code.claude.com/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. |
477481| `/reload-plugins` | Reloads plugins when you run it |
478482 

plugins/mods/test Changed · +3 / -2 lines

from line 159
159159 
160160### Look up what a stub returns
161161 
162Every mods API call your mod makes in a test needs a stub that answers in Claude Code's place, except the few the kit answers itself: [`$.ui.invalidate`](https://code.claude.com/docs/en/plugins/mods/interface#redraw-when-something-changes), [`$.state`](https://code.claude.com/docs/en/plugins/mods/interface#keep-state), and `$.session.append` calls. For `$.clock` calls, use `mock.clock(on)`, or your mod's `$.clock.now()` fails with `no implementation for clock.now`.
162[`$.ui.invalidate`](https://code.claude.com/docs/en/plugins/mods/interface#redraw-when-something-changes), [`$.state`](https://code.claude.com/docs/en/plugins/mods/interface#keep-state), and `$.session.append` calls need no stub. For `$.clock` calls, use `mock.clock(on)`, or your mod's `$.clock.now()` fails with `no implementation for clock.now`. A passing test [can hide](#follow-the-test-kit’s-rules) a `no implementation for` error, and each call that fails with it needs a stub.
163163 
164164This table lists the ones mods use most. The first column is the call your mod makes or the event it passes on with `next(e)`. The second is the function to pass to `on` under that name, so the `$.store.get` row becomes `on('store.get', ($, e) => ({ value: saved.get(e.key) }))`. A `'...'` in a stub marks text for you to fill in:
165165 
from line 172
172172| `$.ui.ask` | A `tool.call` stub, because the question reaches it as a call to the `AskUserQuestion` tool: `($, e) => ({ result: { answers: { [e.questions[0].question]: 'Run it' } } })`. Check `e.tool` first if your mod passes on other tool calls. |
173173| `$.model.complete` | `() => ({ value: { isAnswered: true, text: '...', usage } })` |
174174| `$.process.run` | `($, e) => ({ value: { exitCode: 0, stdout: '...', stderr: '' } })`. `e.argv` is the argument list and `e.init` holds `cwd` and `timeoutMs`. |
175| Any mods API call that should fail | `() => ({ deny: 'the reason' })`, which makes the call reject in your mod. A stub that throws is skipped instead. |
175| To fail a call whose stub returns `{ value }` | `() => ({ deny: 'the reason' })`, which makes the call reject in your mod. `ui.toast`, `ui.log`, and `ui.status` don't reject. A stub that throws is skipped. |
176176| `session.start` | `() => ({ cwd: '/work' })` |
177177| `turn.start` | `($, e) => ({ turnId: e.turnId })` |
178178| `tool.call` | `() => ({ result: '...' })` |
from line 312
312312| `select({ key: 'size', value: 'large' })` | Picks the option with that value in the `Select` with that key |
313313| `keepsBeneath()` | In a test with no `ui.render` stub, it resolves to `true` when the drawing includes what `next(e)` returned, and `false` when your hook left it out. In a test that registers one, use `find` to look for what the stub drew. Requires Claude Code v2.1.321 or later. |
314314| `find({ key: 'more' })` or `find({ type: 'Text', text: 'Count: 2' })` | Returns the first matching element as `{ type, props, children }`, or `undefined`. `text` can be a string or a regular expression. |
315| `drawn()` | Returns the whole tree as last drawn |
315316| `unmount()` | Removes the drawing |
316317 
317318Each 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](https://code.claude.com/docs/en/plugins/mods/reference.md#render-sites) lists each site's props, and [the types for your build](https://code.claude.com/docs/en/plugins/mods/create.md#get-the-types-for-your-build) have their types.

plugins/mods/troubleshoot Changed · +18 / -5 lines

### `call refused` or `result withheld`

from line 6
66 
77## Find out why a mod does nothing
88 
9When a mod does nothing, check what Claude Code reads from the mod's files, and the line it writes when it skips something. For the first, in your shell run [`claude plugin validate`](https://code.claude.com/docs/en/plugins/mods/create#check-what-claude-code-reads-from-your-mod) with the mod's directory, as in `claude plugin validate ./first-mod`. It catches a misspelled event, a bad manifest, and a module Claude Code can't read, without starting a session.
9When a mod does nothing, check what Claude Code reads from the mod's files, and the line it writes when it skips something. To check the files, in your shell run [`claude plugin validate`](https://code.claude.com/docs/en/plugins/mods/create#check-what-claude-code-reads-from-your-mod) with the mod's directory, as in `claude plugin validate ./first-mod`. It catches a bad manifest and a module Claude Code can't read, without starting a session.
1010 
1111Claude Code writes one line naming your mod in cases such as a code error that stops it from loading, a skipped hook, or a refusal by another mod. Look for that line in the transcript, the debug log, or stderr, by session type:
1212 
from line 57
5757| :- | :- |
5858| `hooks modules are turned off for installed plugins in this process: the rollout switch served off` | Anthropic has turned installed mods off remotely. |
5959| `hooks modules are turned off for installed plugins in this process: the rollout switch was saved off by an earlier session` | The session used a value an earlier session saved, which may be out of date. Start Claude Code again to refresh it. |
60| `hooks modules a person installed wait for the rollout switch in this process` | In a [cloud session](https://code.claude.com/docs/en/claude-code-on-the-web.md), your mods are waiting to load, so send another message. If the line includes `could not be read`, or you see `Mods you installed aren't running in this session`, start a new session instead. |
6061| `disableAllHooks in managed settings` | Your organization turned off hooks from installed plugins |
6162| `only managed plugins and built-in plugins run` | `allowManagedHooksOnly` is set, or `disableAllHooks` is set in a settings file other than managed settings |
6263| `installed plugins that are not managed load no hooks module in this mode (--bare)` | You started Claude Code with `--bare` |
from line 142
141142 
142143Fix the error. The debug log has a line for every occurrence.
143144 
145### `call refused` or `result withheld`
146 
147Either line means Claude Code couldn't copy a value to or from a hook that checks an action, such as a `tool.call` hook. Match the [transcript or debug log line](#find-out-why-a-mod-does-nothing) to see whether the action ran:
148 
149* `call refused`: Claude Code refused the action in your hook's place
150* `result withheld`: what the tool did stays done, and Claude reads a note in place of its result
151 
152What Claude gets back can include `could not be given to a hook that checks it` or `a hook that checks this result could not hand back its answer`.
153 
154If the line includes `could not be given its argument`, your hook didn't run, so leave it as it is. If it includes `is not plain data: nesting deeper than 28000 levels`, reduce the nesting in the values your hook returns or passes on.
155 
144156### `no command.run hook answered it`
145157 
146158You run a command your mod added, and the reply names the mod and the command, as in `first-mod registered /tally but no command.run hook answered it`, then tells you to add a hook. Claude Code prints that reply when the command reaches the end of the chain with no answer, which happens in two cases:
from line 304
292304 
293305### `$.ui.open` runs and no pane appears
294306 
295The call didn't come from something the user did, and the terminal is narrower than [the width that pane needs](https://code.claude.com/docs/en/plugins/mods/interface.md#when-a-pane-waits-for-a-wider-terminal).
307Check the call's result. When `isPlaced` is `false`, the start of `reason` says why, as in these cases:
296308 
297Open the pane from a command or a button, or check the call's `isPlaced` result. See [Open a pane at the right time](https://code.claude.com/docs/en/plugins/mods/interface.md#open-a-pane-at-the-right-time).
309* **`unasked below`**: open the pane from a command or a button, or use [a wider terminal](https://code.claude.com/docs/en/plugins/mods/interface.md#when-a-pane-waits-for-a-wider-terminal).
310* **`no-surface`**: nothing is attached to draw on, as in a `claude -p` or Agent SDK run. From a `command.run` hook, return `{ text }` instead.
298311 
299312### A toast doesn't appear
300313 
from line 350
337350 
338351### Your edits don't take effect
339352 
340You're editing a plugin you installed. Claude Code runs the cached copy for the installed version.
353If your plugin was [copied at install](https://code.claude.com/docs/en/plugins/loading.md#in-place-and-copied-plugins), Claude Code runs that copy.
341354 
342355Develop with `--plugin-dir` pointed at your working copy, as in `claude --plugin-dir ./first-mod`, which reloads when you save.
343356 

plugins/cli-reference Changed · +1 / -1 lines

from line 489
489489* An installed plugin as `name` or `name@marketplace`
490490* `name@skills-dir`
491491 
492Put the target before `--tag`, `--allow-tools`, and `--json`. Each of these options takes the words that follow it as its value, so a target written after one of them is read as a tag, a tool name, or the JSON output path instead of as the target.
492Put the target before `--tag`, `--allow-tools`, [`--disallow-tools`](https://code.claude.com/docs/en/plugin-evals#disallow-tools), and `--json`. A target written after one of them can be read as a tag, a tool name, or the JSON output path.
493493 
494494This table lists the options most runs use. Run `claude plugin eval --help` for the complete set, including `--case`, `--tag`, `--output-dir`, `--report`, `--allow-real-servers`, `--keep-temp`, and `--verbose`.
495495 

plugins/mods/overview Changed · +1 / -1 lines

from line 13
1313Settings hooks, skills, status lines, and MCP servers work from outside Claude Code: each one runs a script, or gives Claude text or tools. A mod runs inside Claude Code, so it can do things they can't:
1414 
1515* **Draw an interface you can use**: a pane beside the transcript or a band above the prompt, with tabs, buttons, and text fields. See [Draw in the interface](https://code.claude.com/docs/en/plugins/mods/interface.md).
16* **Redraw Claude Code's own interface**: replace or restyle parts Claude Code draws itself, such as a tool call's row, the spinner, or the dialog Claude asks questions in. See [Change what Claude Code already draws](https://code.claude.com/docs/en/plugins/mods/interface.md#change-what-claude-code-already-draws).
16* **Redraw Claude Code's interface**: replace or restyle parts Claude Code draws itself, such as a tool call's row or the spinner. See [Change what Claude Code already draws](https://code.claude.com/docs/en/plugins/mods/interface.md#change-what-claude-code-already-draws).
1717* **Step into a tool call or a request**: for example, hold a tool call while you ask the user a question, answer it without running the tool, or send one request to a different model. See [Guard or change a tool call](https://code.claude.com/docs/en/plugins/mods/events.md#guard-or-change-a-tool-call) and [Follow a turn](https://code.claude.com/docs/en/plugins/mods/events.md#follow-a-turn).
1818* **Run your own code on a command**: a `/command` that runs your function at once, with no Claude turn, even while Claude is working. See [Add a command or a tool](https://code.claude.com/docs/en/plugins/mods/api.md#add-a-command-or-a-tool).
1919* **Share data between hooks**: a mod's hooks share the variables in its file, so what one hook records, another can show. For example, one hook can count tool calls while another shows the count beside the spinner, or one can read each request's token usage while another charts it in a pane. See [React to events](https://code.claude.com/docs/en/plugins/mods/events.md).
Feedback