Claude Lessons / Guides
Claude Code Mods: Change How Claude Code Looks and Behaves
Every other extension point in Claude Code works from the outside. A settings hook shells out. A skill
hands Claude more text. An MCP server exposes tools over a wire. Each one asks Claude Code to do
something on your behalf and then waits. A mod is different in a way that matters more than it sounds:
it runs inside Claude Code, in the same process, on the same events Claude Code uses itself.
That is why a mod can draw a pane beside your transcript, replace the spinner, hold a risky command while
it asks you a question, or add a slash command that runs your function immediately with no model turn at
all. Several features you already use — /diff, AGENTS.md loading, the chart
tool — are mods. This guide covers what a mod is, when it beats the alternatives, the three files it
takes, the event and API surface you actually get, and the security model you should understand before
installing one.
What a mod actually is
A mod is a plugin that changes how Claude Code looks and behaves. It is made of JavaScript or TypeScript event handlers. Claude Code calls one when an event happens — a tool call, a submitted prompt, a part of the interface being drawn — and the handler can watch the event, change it, or take it over entirely.
Because it runs in-process, a mod can do five things nothing else in Claude Code can:
- Draw an interface you can use. A pane beside the transcript or a band above the prompt, with tabs, buttons and text fields.
- Redraw Claude Code's own interface. Replace or restyle parts Claude Code draws itself — a tool call's row, the spinner, the dialog Claude asks questions in.
- Step into a tool call or a request. 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.
-
Run your own code on a command. A
/commandthat runs your function at once, with no Claude turn, even while Claude is working. - Share data between hooks. A mod's hooks share the variables in its file, so one hook can count tool calls while another shows the count beside the spinner.
That last one is quietly the most useful. Settings hooks are stateless shell invocations; a mod is a living module with memory for the length of a session.
The naming problem: mods, hooks and settings hooks
You will trip on this within ten minutes, so take it up front. Claude Code calls two different things hooks:
- A settings hook is the kind covered in the hooks guide: a shell command, HTTP request, or prompt you configure in a settings file, running as its own process on a lifecycle event.
- A mod's hook is a function registered from your module that runs inside Claude Code.
In the mods documentation, "hook" means the second and the first is called a "settings hook." This guide
follows the same convention. The module that registers them is called the hooks module, and —
confusingly but usefully — a plugin becomes a mod precisely because its hooks/hooks.json has
a modules key pointing at one.
Mod vs. settings hook vs. skill vs. MCP server
| Mod | Settings hook | Skill | MCP server | |
|---|---|---|---|---|
| What it is | Functions in a plugin that Claude Code calls in its own process | A shell command, HTTP request or prompt run on a lifecycle event | A SKILL.md file of instructions Claude reads |
An external process or service that gives Claude tools |
| What it can change | Tool calls, prompts, commands, turns, and what the interface draws | Whether a tool call or prompt proceeds, a call's arguments and result, context added for Claude | What Claude knows and does | Which tools Claude has |
| Can it draw? | Yes | No | No | No |
| What you write | JavaScript or TypeScript | A script and a settings.json entry |
Markdown | A server in any language |
| Pick it when | You want a pane, a band above the prompt, a custom command, or to rewrite an event | You want to block, allow or log an event with a script you already have | You keep pasting the same instructions into chat | Claude needs to reach an external system |
These are not exclusive. A single plugin can hold a mod, a skill, settings hooks and an MCP server, so shipping a mod alongside the skill that explains it is normal. If a settings hook already does what you need, do not write a mod — a shell script is less code you own.
Version gates and where mods run
Mods are on by default. The floors differ by surface, and they differ again per feature, which is where most "it works on my machine" reports come from.
| Surface | Minimum version |
|---|---|
| Claude Code CLI in a terminal | v2.1.287 |
| The Code tab of the Desktop app (bundles its own copy) | v2.1.286 |
| Drawing in the VS Code extension's chat panel | extension 2.1.299, or 2.1.304 in a session that does not fetch feature flags |
Check yours with claude --version in a terminal, or /status in a Desktop session and read the Claude Code row.
Where a mod's hooks run, and where what it draws appears:
| Where you run Claude Code | Hooks run | What it draws appears |
|---|---|---|
claude in a terminal, including a JetBrains or integrated terminal | Yes | Yes |
| The Code tab of the Desktop app | Yes | Yes, except terminal-only elements |
| A WSL session in the Desktop app | No — plugins are unavailable there | No |
| An SSH session in the Desktop app, for a locally installed mod | No — Desktop does not copy hooks to the remote machine | No |
| The VS Code extension's chat panel | Yes | Yes, from extension 2.1.299 |
claude -p and the Agent SDK | Yes | No |
| Remote Control from claude.ai or mobile | Yes, in the session on your machine | In the terminal on your machine |
| A cloud session | Yes, for a plugin that reaches the cloud session | Not in every session |
The claude -p row is the one to design around: hooks run, nothing draws. A mod meant to work
in automation should check which app it is running in and fall back to a transcript line or a command's
text reply where nothing draws. Note also that hooks run whichever provider serves the model, including
Amazon Bedrock, Google Cloud's Agent Platform and Microsoft Foundry.
One legacy footgun: if you set CLAUDE_CODE_ENABLE_FUNCTION_HOOKS during early access, remove
it. v2.1.287 and later ignores it, so setting it to 0 does not keep mods off.
The fastest path: ask Claude for one
You do not have to learn the API to get a mod. Describe what you want in an interactive session and
Claude writes it, working from a built-in skill named plugin-authoring that tells it which
events and methods your version offers. Claude can load that skill on its own, or you can load
it by running /plugin-authoring.
Say something like make a mod that shows the current git branch above the prompt. Then:
-
Claude writes the mod into its own directory inside the session's mods folder, which is
~/.claude/dev-mods/followed by the session ID. IndefaultandacceptEditsmodes Claude Code asks you to approve each file, because the mods folder is a protected path. - When the first file is saved, Claude Code asks once whether to turn on hot reloading for the session. Choosing to turn it on loads the session's mods when the turn ends and reloads them at the end of each turn that changes them. The answer lasts for the session, including after you resume it.
- Run
/pluginand press Tab to the Installed tab to confirm it loaded. - Use it. If it is wrong, tell Claude what to change and try again as soon as the turn finishes.
In auto and bypassPermissions modes Claude Code can enable hot reloading
without asking you. If you want to be asked, start in default or
acceptEdits, or switch before the session's first mod.
The catch worth knowing up front: a mod Claude wrote loads only in the session that made
it, and Claude Code deletes that session's mods folder once it is older than
cleanupPeriodDays. To keep a mod, copy its directory somewhere of your own, such as
~/mods/git-branch, then load it with claude --plugin-dir ~/mods/git-branch or
publish it to a marketplace.
Anatomy: the three files
first-mod/
├── .claude-plugin/
│ └── plugin.json
└── hooks/
├── hooks.json
└── register.js
plugin.json— the plugin manifest. A plain mod needs no special fields.-
hooks.json— itsmoduleskey points at your code file, relative tohooks.json. Having that key is what makes the plugin a mod. register.js— your code, the hooks module.
// .claude-plugin/plugin.json
{
"name": "first-mod",
"version": "0.1.0",
"description": "Counts Claude's tool calls and adds a /tally command",
"author": { "name": "Your Name" }
}
// hooks/hooks.json
{
"description": "The first-mod hooks module",
"modules": ["./register.js"]
}
Write one yourself
This is a complete mod. It counts the tool calls Claude makes, shows the count beside the spinner while
Claude works, and adds a /tally command that prints it.
// hooks/register.js
// The count, shared by the hooks below
let calls = 0
// Claude Code calls this once when the mod loads
export function register(on) {
// Runs when the session starts, before your first prompt
on('session.start', async ($, e, next) => {
await $.command.register({
name: 'tally',
description: 'Show how many tool calls Claude has made',
})
return next(e)
})
// Runs each time Claude is about to use a tool
on('tool.call', async ($, e, next) => {
calls += 1
// Ask Claude Code to draw the interface again, so the new count shows
$.ui.invalidate('ui.render')
return next(e)
})
// Runs when you type /tally, and only then, because of the matcher
on('command.run', { command: 'tally' }, async () => {
return { text: 'Claude has made ' + calls + ' tool calls since this mod loaded' }
})
// Runs each time Claude Code draws the spinner
on('ui.render', { component: 'Spinner' }, async ($, e, next) => {
return next({ ...e, props: { ...e.props, suffix: ' · tool calls: ' + calls + '…' } })
})
}
Load it for one session without installing anything:
claude --plugin-dir ./first-mod
Ask Claude to do something that takes a few tool calls. The spinner reads
Thinking · tool calls: 2… and climbs. Type /tally and the transcript shows
first-mod: Claude has made 2 tool calls since this mod loaded — Claude Code prefixes the
plugin's name. You can check a command without an interactive session too:
claude -p "/tally" --plugin-dir ./first-mod
Now leave the session open and edit the file. Change
' · tool calls: ' to ' · tools used: ' and save. A transcript line says
first-mod reloaded and lists its hooks, and the next spinner uses the new text. That
edit-and-see loop, with no restart, is the single biggest reason writing a mod feels different from
writing a settings hook.
The three things a hook can do
Every hook receives the same three arguments:
-
$— the mods API. Every method a mod can call to reach outside itself, grouped in namespaces such as$.uiand$.command. -
e— the event. The event's input as plain data, such as a tool call's name and arguments. -
next— the next handler. Passes the event on to the other mods and then to Claude Code's own behavior, and returns the result.
From those three, exactly three strategies fall out:
| Strategy | What you do | Example from the mod above |
|---|---|---|
| Observe | Note what is happening and return next(e) unchanged |
tool.call counts and lets the tool run |
| Rewrite | Call next with a modified copy of the event |
ui.render adds a suffix to Claude Code's spinner |
| Answer | Return your own result and never call next |
command.run returns the text to print |
The second argument to on is optional and is a matcher — a filter for which events
the hook handles, like { command: 'tally' } or { component: 'Spinner' }. Use
one wherever you can; a hook that runs on every event and returns early is a hook you pay for on every
event.
A hook that needs to do anything outside its own code — draw, add a command, call a model, read a file, start a process, make a network request — must go through the mods API. That is deliberate: it is precisely why Claude Code can list what a mod does before you install it.
The event surface
Events are grouped by what they concern. Most hooks are async functions; hooks on
turn.step and process.spawn are async generators.
| Group | Events include |
|---|---|
| Tools | tool.call, tool.run, tool.check, tool.describe, tool.judge |
| Prompts and what Claude reads | prompt.submit, prompt.edit, prompt.compose, prompt.context, prompt.section, prompt.attachment, prompt.mention, prompt.autocomplete, prompt.suggest, skill.prompt |
| Commands and configuration | command.run, command.describe, config.describe, config.set, settings.read |
| Turns | turn.start, turn.step, turn.complete |
| Session | session.start, session.end, session.stop, session.compact, session.send, session.receive, session.attach, session.detach, session.append, session.measure |
| Subagents | agent.spawn, agent.offer |
| Interface | ui.render, ui.press, ui.input, ui.select, ui.focus, ui.scroll, ui.open, ui.close, ui.message, ui.resolve, ui.fault |
| Other mods | plugin.register |
| Telemetry | telemetry.log, telemetry.mark |
| Settings hook events | classic.PreToolUse-style bridges such as classic.PostToolUse and classic.Stop |
| Mods API calls | fs.read, http.fetch, model.complete, process.spawn, engine.create — a mod can intercept another mod's API calls |
That last group is the basis of a policy mod: an organization can ship a mod that handles the
fs.read, http.fetch and process.spawn events of every other mod,
which is the only real way to constrain what user-installed mods do.
The classic. bridge events are also worth knowing if you are
already running settings hooks: they let a mod handle
the same lifecycle events a settings hook would, in-process, without a shell round trip.
The mods API
$ is grouped into namespaces. These are the ones you will use, with the version floors where
they exist:
| Namespace | What it does |
|---|---|
$.ui |
open, close, panes, invalidate,
resolve, focus, scroll, toast,
notify, status, log, notice,
ask, copy, selection, blit,
view (v2.1.300+), place (v2.1.314+)
|
$.theme | set, clear — a backdrop for the Desktop or mobile app to draw (v2.1.319+) |
$.command | register, run, list |
$.tool | register, call, check, list |
$.agent |
register, spawn, list, plus call and
limits (v2.1.326+). list() returns this session's
subagents and teammates with a status of
pending, running, waiting, idle,
completed, failed or killed
|
$.model | complete, fork, classify — call a model directly from a hook |
$.prompt |
submit, read, fill, suggest,
compose. Text from submit({ text }) reaches Claude after a sentence
naming your mod as the sender; submit({ text, asUser: true }) sends it as the user's
own words
|
$.session |
messages, cwd, root, model,
turns, id, repo, usage,
compact, send, append, authorize.
usage() returns { startedAt, context, rateLimits, cost }, where
context carries tokens, window and percent
|
$.fs | read, write, list, exists, stat, ancestors. write is not atomic |
$.store | get, set, delete, keys — a key-value store every session on the machine shares |
$.state | Reactive state: get, set, with atom, read, update, derive and memberOf imported from claude-code |
$.clock | now, sleep, after, every — background work on a timer |
$.http | fetch |
$.process | Start and manage programs |
$.settings, $.env, $.config, $.turn, $.plugin | Read settings, read and set environment variables, list and set config, abort a turn, and this plugin's own name and directory |
Two practical notes. $.fs.write replaces a file's content in place and is not atomic, so
another process can read a partly written file — keep data that several sessions change in
$.store. And $.session.usage() is the key to the whole genre of context-meter
mods: it hands you tokens, window size and percent after each request, which is everything a
context gauge needs.
Drawing: render sites and elements
A render site is an extension point in Claude Code's interface. Each is a value of
e.component in a ui.render hook, and e.surface tells you which app
is drawing — terminal, desktop, vscode or mobile.
| Site | What it is | Rendered on |
|---|---|---|
Pane | A panel beside the transcript, with title, placement, scroll and focus state | Terminal, Desktop, VS Code |
AbovePrompt | A band above the prompt box | Terminal, Desktop |
AbovePromptList | The stack of all mods' bands, so one mod can arrange them (v2.1.323+) | Terminal, Desktop |
Placed | A row you place in the transcript with $.ui.place | Terminal |
Backdrop | A scene drawn behind the conversation | Desktop and mobile |
UserMessage, AssistantMessage | The message rows themselves | Terminal, Desktop, VS Code |
ToolUse, ToolResult, ToolGroup | A tool call's name, input and result | Terminal, Desktop, VS Code |
AskUserQuestion | The dialog Claude asks questions in | Terminal, Desktop, VS Code |
CommandOutput | A command's output row | Terminal, Desktop |
Spinner, ToolProgress | The working indicator | Terminal (Spinner more widely) |
You build what you draw from elements — Box, Text, Code,
Select, Link, Raster, Image and friends — and the
elements table marks which ones are terminal-only, which matters if your mod should also work in the
Desktop app. The honest advice: start by rewriting an existing site such as
Spinner, which is four lines, before you try to own a Pane, which is a small
application with scroll and focus handling.
Mods you already have
Some of Claude Code's own features are mods. Run /plugin and open the
Installed tab to see yours, listed under Built-in. The
mods active line omits them, and you cannot update or uninstall one.
Name in /plugin | What it does |
|---|---|
cc-plugin-diff | Takes over /diff and draws its pane. Disable it and /diff still works, answered by Claude Code's built-in version |
cc-plugin-agents-md | Loads AGENTS.md as project instructions — see the CLAUDE.md guide |
cc-plugin-sec-default | The guard that protects managed configuration from user-installed mods. You cannot disable it |
cc-plugin-plugin-authoring | Ships the plugin-authoring skill Claude uses to write mods. Holds a skill and no mod code |
cc-plugin-telemetry | Sends the analytics records Claude Code and its built-in mods log |
cc-plugin-you-should-know | A side agent that posts a note above the prompt when it spots something you missed. Off until you turn it on |
cc-plugin-easel | Gives Claude a chart-drawing tool and auto-charts supported time-series MCP results. Needs a claude.ai subscription, v2.1.321+ (Team and Enterprise v2.1.326+), and macOS or Linux outside WSL |
The source of several is public in the mods directory of the Claude Code repository — the
diff pane with its keyboard-bound buttons and self-handled scrolling, the
agents-md loader with a userConfig option, the sec-default guard
as a model policy mod, and telemetry, which adds methods other mods can call and ships their
types. If you are learning the API, read those before you read anything else.
Anthropic also publishes sample mods in the claude-code-playground repository, shared as-is:
token-weather (a context-window forecast above the prompt), blast-radius (holds
a risky shell command such as rm -rf or a force push and shows what it would change, with
proceed and cancel buttons), and replay-theater (a /replay command that steps
through the last turn's file edits).
What a mod can reach
A mod is code that runs with your permissions, inside Claude Code. Install mods only from authors and marketplaces you trust. Specifically, once a mod loads it can:
- Act on your machine as you — read and write files anywhere your account can, start programs, make network requests
- Read your secrets — environment variables and settings files, including an API key kept in either
- See your session — every prompt you send and every tool call Claude makes
- Change your session — rewrite a prompt or a tool call, submit a prompt as if you typed it, message another of your sessions
- Act without asking you — approve a tool call before you are asked
- Spend your usage — call a model on your plan or API key
Mods are not sandboxed. If you turn on sandboxing, the sandbox isolates the Bash commands Claude runs; a process a mod starts runs outside it. The one thing a mod cannot restyle is the permission prompt — it can redraw most of the interface, but not the dialog that asks for your consent.
Inspect a mod before you install it
You can list which events a mod handles and what it asks Claude Code to do — read a file, make a network request — without running it. Get the plugin's files, for example by cloning its repository, then:
claude plugin validate ./some-mod
The hooks: and calls: lines in the output are the whole point. Because a hook
cannot touch the outside world except through the mods API, those lines are a reliable inventory rather
than a best guess. A mod that declares http.fetch and process.spawn for a
feature that should only draw a pane deserves a second look.
Turning mods off
| Scope | How |
|---|---|
| One mod | Disable or uninstall its plugin from the Installed tab in /plugin |
| Every installed mod, one session | claude --safe-mode, which also disables your other customizations |
| Every mod you installed, always | "disableAllHooks": true in ~/.claude/settings.json. Your settings hooks and custom status line stop too; what your organization manages keeps running |
disableAllHooks stops the mod but leaves the rest of its plugin in place — the plugin stays
installed and its skills, commands, agents and MCP servers still load. None of these stop
built-in mods.
Organization controls
With no mod settings of your own, mods are on, and a user can install one from any marketplace your
plugin settings allow or load one with --plugin-dir. A built-in guard named
sec-default@builtin loads ahead of every user-installed mod, shown as
cc-plugin-sec-default. Users cannot turn it off. It loads when either:
- The machine has managed settings or a
managed-mcp.jsonfile, or - The session runs on
/logincredentials for a Team or Enterprise plan
A user on an API key, or on Amazon Bedrock, Google Cloud's Agent Platform or Microsoft Foundry, gets the
guard only on a machine with managed settings or managed-mcp.json. A session running on a
long-lived CLAUDE_CODE_OAUTH_TOKEN does not count as a Team or Enterprise login either, even
when one is stored on the machine. That is a real gap to check in a rollout.
When it loads, the guard blocks a user's mod from rewriting:
- The system prompt
- Your managed
CLAUDE.mdand other managed instructions - The answer a mod gets when it reads settings
- The tool list and tool descriptions of a managed MCP server that has connected
And when a user's mod approves one of Claude's calls, these hold by default:
- A call a
denyrule refuses stays refused - A call an
askrule would prompt for still prompts - A call a
PreToolUsehook blocked stays blocked
What the guard does not cover is the more important half. A mod's own calls can
skip your checks. $.fs and $.process calls can bypass permission rules and
PreToolUse hooks entirely: with Read(.env) denied, a mod can still read that
file with $.fs.read or start a program that does. $.tool.call and
$.mcp.call can skip permission rules, prompts, a hook's ask, and auto mode's
classifier. And on v2.1.323 or later, a user's mod can keep a managed MCP server from connecting at all,
with /mcp showing it as held by that mod.
If that is unacceptable in your environment, there are exactly two real answers: stop user-installed mods from loading, or ship a policy mod of your own that handles the other mods' API-call events. See the teams guide for how managed settings get delivered in the first place.
Limits that bite
Hooks and API calls run under time and size limits. Claude Code skips a hook that exceeds a time limit, and a tree over a drawing limit simply is not drawn — both fail quietly, which is why people lose an hour to them.
| Limit | Value |
|---|---|
| A hook's own execution time for one event | 10 seconds — but only 50 milliseconds for a prompt.edit hook |
A .catch handler | 1 second |
Time a ui.render hook waits on API calls | 30 seconds (v2.1.326+); plugin.register gets 10 seconds, not counting $.ui.ask |
All session.end hooks together | 1.5 seconds unless you change the SessionEnd budget |
$.process.run timeout | 30 seconds by default, 10 minutes at most |
$.process.run stdout and stderr | 4 MiB each, with a truncation flag |
$.model.complete maxTokens | 1024 by default, up to 64,000 or the model's output limit |
$.fs.read and $.fs.write | 4 MiB per file; read larger files in parts with offset and length on v2.1.326+ |
$.http.fetch request and response body | 4 MiB each; one call including redirects gets 30 seconds and follows at most 5 redirects |
| Text in one tree | First 100,000 characters drawn |
| Nesting depth of one tree | 32 levels below the root |
| Elements and text children in one tree | 20,000 |
The 50-millisecond prompt.edit budget is the one that catches people. Anything that touches
the filesystem or the network in that hook will be skipped. Do the work elsewhere — on a
$.clock.every timer or at session.start — and have prompt.edit
read a variable.
When a mod does nothing
Work the list in order:
-
Did it load at all? Run
/plugin. A dim line under the tabs gives the count and names, such as1 mod active · first-mod. If your mod is not named there, nothing else matters yet. -
Are you on a surface where hooks run? Desktop WSL and Desktop SSH sessions run no
hooks at all.
claude -pruns hooks but draws nothing. - Is your version high enough? v2.1.287 in the terminal, v2.1.286 on Desktop, and check the per-feature floors above for whatever you are calling.
- Did an edit actually reload? A transcript line starting with the mod's name tells you when a change did not load. Claude does not see that line unless you paste it, so paste it when you ask for a fix.
- Is a limit silently eating it? Over a time limit the hook is skipped; over a drawing limit the tree is not drawn. Neither throws at you.
-
Is something turning mods off?
disableAllHooks,--safe-mode,--bare, or your organization'sallowManagedModsOnly.
Common mistakes
-
Writing a mod when a settings hook would do. If you already have a script that blocks
or logs an event, a
settings.jsonentry is less code to maintain. -
Forgetting the
moduleskey. Without it inhooks/hooks.json, your plugin is just a plugin and none of your code runs. -
Not calling
next. Returning nothing from an observing hook answers the event instead of passing it on, which silently removes Claude Code's own behavior. -
Registering a hook with no matcher. A
ui.renderhook with no{ component: ... }filter runs on every render site in the app. -
Leaving a mod in the session mods folder. It loads only in that session and gets
deleted after
cleanupPeriodDays. Copy it out. -
Doing I/O in
prompt.edit. 50 milliseconds. It will be skipped. -
Using
$.fs.writefor shared state. It is not atomic. Use$.store, which every session on the machine shares. -
Installing a mod without running
claude plugin validate. It takes five seconds and tells you exactly what the mod asks for.
FAQ
What is a Claude Code mod?
A mod is a plugin that changes how Claude Code looks and behaves. It is made of JavaScript or TypeScript event handlers that run inside the Claude Code process: Claude Code calls one when an event happens, such as a tool call, a submitted prompt, or a part of the interface being drawn, and the handler can watch the event, rewrite it, or answer it itself. That in-process position is what lets a mod do things a settings hook cannot, including drawing a pane beside the transcript or a band above the prompt, restyling parts of the interface Claude Code draws itself, and adding a slash command that runs your own function with no Claude turn at all.
What is the difference between a mod and a hook in Claude Code?
Claude Code calls both kinds hooks, which is a genuine source of confusion. A settings hook is a shell command, HTTP request, or prompt you configure in a settings file, and it runs as a separate process outside Claude Code on a lifecycle event. A mod's hook is a function that runs inside Claude Code, registered from a JavaScript or TypeScript module. A settings hook can block, allow or log an event with a script you already have. A mod can do that and also draw in the interface, add a command, call a model, keep state across hooks, and rewrite what Claude Code itself renders. Pick a settings hook when you have a script; pick a mod when you want a pane, a band, a custom command, or to rewrite an event.
What version of Claude Code do I need for mods?
Mods are on by default. In the terminal you need Claude Code v2.1.287 or later. The Desktop app bundles its own copy of Claude Code and mods work there from v2.1.286. Drawing in the VS Code extension needs extension version 2.1.299 or later, or 2.1.304 or later in a session that does not fetch feature flags, such as one on Amazon Bedrock. Individual features have their own floors on top of that: the ui.view method needs v2.1.300, ui.place needs v2.1.314, the theme namespace for backdrops needs v2.1.319, and the AbovePromptList render site needs v2.1.323. If you set CLAUDE_CODE_ENABLE_FUNCTION_HOOKS during early access, remove it — v2.1.287 and later ignores it, so setting it to zero does not keep mods off.
Are Claude Code mods sandboxed?
No. A mod runs with your permissions inside Claude Code. It can read and write files anywhere your user account can, start programs, make network requests, read your environment variables and settings files including an API key, see every prompt you send and every tool call Claude makes, rewrite prompts and tool calls, submit a prompt as if you had typed it, approve a tool call before you are asked, and spend your usage by calling a model on your plan. If you turn on sandboxing, the sandbox isolates the Bash commands Claude runs, and a process a mod starts runs outside it. The one thing a mod cannot restyle is the permission prompt itself.
How do I write a Claude Code mod?
The fastest route is to describe what you want in an interactive session and let Claude write it, working from a built-in skill named plugin-authoring that you can also load yourself with the slash command of the same name. Claude writes the mod into a per-session folder under the dev-mods directory in your home Claude folder, and asks once whether to turn on hot reloading for the session. To write one yourself it takes three files: a plugin manifest at plugin.json inside a .claude-plugin directory, a hooks.json whose modules key points at your code file, and the code file itself, which exports a register function that receives an on function for registering handlers. Load it for one session with the plugin-dir flag.
Do mods reload while a session is running?
Yes, and it is the main reason writing one feels fast. Edit your code file and save, and a line in the transcript says the mod reloaded and lists its hooks; the next render uses your new code. For a mod Claude writes in a session, the mods in that session's folder reload at the end of each turn that changes them, so you can try a change as soon as Claude finishes. If a transcript line starting with the mod's name says the change did not load, paste that line into your next message when you ask for a fix — Claude does not see that line unless you paste it.
Can a mod bypass my permission rules?
A mod's own calls can. The file and process namespaces of the mods API can skip permission rules and PreToolUse hooks entirely: with Read of a dotenv file denied, a mod can still read that file with the filesystem read method or start a program that does. Tool-calling methods can likewise skip permission rules, prompts, a hook's ask, and auto mode's classifier. Separately, a mod can approve tool calls your deny or ask rules would stop, unless Claude Code's built-in guard is loaded. The guard, shown as cc-plugin-sec-default on the Installed tab of the plugin command, loads on machines with managed settings or a managed MCP file, or in sessions logged in on a Team or Enterprise plan, and by default it keeps a denied call denied, an ask rule prompting, and a PreToolUse block in force.
Which Claude Code features are already mods?
Several. Run the plugin command and open the Installed tab to see yours listed under Built-in. They include cc-plugin-diff, which takes over the diff command and draws its pane; cc-plugin-agents-md, which loads AGENTS.md as project instructions; cc-plugin-sec-default, the guard that protects managed configuration from user mods; cc-plugin-telemetry; cc-plugin-you-should-know, the side agent that posts a note above the prompt; and cc-plugin-easel, which gives Claude a chart-drawing tool. You cannot update or uninstall a built-in mod, and the settings and flags that stop installed mods do not stop built-in ones. The source of several is public in the mods directory of the Claude Code repository, which is the best reading material there is for learning the API.
Shaping the tool is the easy half
A mod can put your context usage above the prompt and hold a risky command before it runs. It cannot tell you what to delegate, how to frame a task, or when to stop and check. That is the part the lessons drill.
Start the free lessons