Skip to main content
Look up any event a mod can hook, mods API method it can call, or render site it can draw in, for the Claude Code CLI and the Desktop app as of v2.1.287. Each entry gives the name and a one-line description, and links to the guide section that explains it where there is one.
The complete reference is Claude Code’s TypeScript declarations for mods, which describe every event, method, and element, with examples. The copy on GitHub can be older than the Claude Code version you have installed. When the two disagree, trust the copy Claude Code writes for your version.

Files

A mod is a plugin directory with these files: register receives on and options. options holds the values of the userConfig fields the manifest declares, with defaults filled in.

The hook function

A mod registers each of its hooks, which are event handlers, by calling on inside register. on takes the event’s name, an optional matcher, which is a filter on the event’s fields, and the hook, as in on('tool.call', { tool: 'Bash' }, async ($, e, next) => next(e)). on returns a registration with one method, .catch(handler), which sets the hook’s error handler.

Events

Every event a mod can hook is listed here, grouped by what it concerns, with when it fires and what a hook on it can return. Hooks on turn.step and process.spawn are async generators, and every other hook is an async function. The last column of each table uses shorthand. next(e) passes the event on unchanged. next({ ...e, text }) passes on a copy with the named field changed, as in next({ ...e, text: e.text.trim() }). An object answers the event without calling next, and a word such as reason stands for a string you write, as in { deny: 'Use the file tools.' }.

Tools

Tool events fire around each tool call Claude makes, from the description Claude reads to the decision on whether the call runs:

Prompts and what Claude reads

Prompt events cover the text the user types and the text Claude Code sends to Claude on its own, such as the system prompt and reminders:

Commands and configuration

Command and configuration events fire when a command runs or is listed, and when a /config row is shown or changed:

Turns

Turn events follow one answer from start to finish, including each request to the model within it:

Session

Session events mark the session starting, ending, compacting, and exchanging messages with other sessions:

Subagents

Subagent events fire when a subagent type is offered to Claude and when one is about to start:

Interface

Interface events fire when Claude Code draws a render site and when the user uses a control a mod drew. Draw in the interface shows what a ui.render hook returns:

Other mods

Two events let a mod act on other mods as they load, to refuse one or change the mods API it receives:

Telemetry

Telemetry events fire for the usage records Claude Code logs:

Settings hook events

Each settings hook event is an event named classic.<Event>, such as classic.Stop or classic.PostToolUse. e is the hook’s stdin JSON.

Mods API calls

Every mods API method is also an event, named for its namespace and method, such as fs.read, model.complete, or ui.open. A hook on one intercepts calls from the mods that run after it, and can return next(e), { deny: reason }, or { value }.

Mods API methods

The mods API is the $ argument every hook receives. Its methods are grouped in namespaces, such as $.ui. This table lists each namespace’s methods by name, so open in the $.ui row is the call $.ui.open(...). The guides show the common ones in use, and the types for your build document every method with an example.

Render sites

A render site is an extension point in Claude Code’s interface. Each row is a value of e.component in a ui.render hook, with the fields of e.props and the apps that raise it. e.surface is terminal or desktop. Change what Claude Code already draws shows what a hook can do at a site, with an example of each choice. e.viewport holds columns, rows, and isFullscreen. It’s absent until the app has measured its window. Its rows is the height of the whole window, not of your pane. To fit a tree to its site, read these props in the hook:
  • Width of a Pane or the band: draw to e.props.bodyColumns
  • Height of a Pane beside the transcript: where e.props.placement is 'dock', e.props.scroll.bodyRows is the number of rows the pane has
  • Height of a Pane above the prompt: where e.props.placement is 'inline', the pane grows with your tree up to a limit, and bodyRows counts only the rows showing now. The rows field of $.ui.open asks for a different limit.
A tree taller than the pane scrolls as a whole.

Elements

Elements are the building blocks of a tree a ui.render hook returns, and you get them from $.ui.resolve(e). Build a tree from elements shows the common ones with how the terminal draws them. A check mark means the app can draw the element. Three more Button rules: action names one of Claude Code’s own keybinding actions, and the user’s binding for it presses the button when that binding is a chord or a modified key. A digit hotkey on a button in the band also fires when the user types that digit alone into an empty prompt and pauses. When two buttons in one drawing name the same hotkey, the later one gets it. Claude Code refuses autoFocus: false on any control, so leave the prop off instead.

Limits

Hooks and mods API calls run under time and size limits. Claude Code skips a hook that runs past a time limit and rejects a call that passes a size limit.

Settings and environment variables

These are the settings and environment variables that affect mods. The Where column says which settings file or environment each one is read from: sec-default@builtin is a guard built into Claude Code, listed as cc-plugin-sec-default in /plugin and the debug log. It loads ahead of every mod a person installs on a machine with managed settings, or for a user signed in with a Team or Enterprise plan. If managed prependPlugins is set, the guard loads only when that list names it, at the position listed. Its source is in the mods/sec-default directory of the Claude Code repository.

Commands

These commands and flags load, inspect, and test a mod. The claude commands run in your shell and the / commands at the Claude Code prompt. In the table, <directory> stands for a path you type, as in claude plugin validate ./first-mod. Square brackets mark an argument you can leave out.