Follow Discord
Sweep 03 Dec 2026 · 19:13Z Build v2.1.336 553 read Stable v2.1.332 Latest v2.1.336 Next v2.1.336 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · claude-code

Use the mods API changedplugins/mods/api

Nearest release: v2.1.333, published an hour after upstream edited the page. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.

Upstream edited this page at 30 Nov 2026 17:58 UTC, give or take a minute or two: the time comes from Anthropic’s own sitemap rather than from a commit. This site recorded the change at 30 Nov 2026 18:07 UTC.

Upstream edited
Recorded here
Lines+4added
Lines−4removed
From line 4 where the diff opens
First seen 1 Oct 2026 this site's first read of the page
Recorded edits25to this page, all time

The whole hunk

from line 4, old and new numbered
/
lines
from line 4
44 
55The mods API is the set of methods a mod calls to act: add commands and tools, call a model, run work between events, and reach the file system, processes, and the network. Every hook receives it as its first argument, `$`, with the methods grouped in namespaces such as `$.ui` and `$.fs`. [Events](https://code.claude.com/docs/en/plugins/mods/events.md) decide when a hook runs, and the mods API is what the hook calls once it does.
66 
7Build your [first mod](https://code.claude.com/docs/en/plugins/mods/create.md) before you start here. For every method, see [mods API methods](https://code.claude.com/docs/en/plugins/mods/reference.md#mods-api-methods) or read [the types for your build](https://code.claude.com/docs/en/plugins/mods/create.md#get-the-types-for-your-build).
7Build your [first mod](https://code.claude.com/docs/en/plugins/mods/create.md) before you start here. For every method, see the [type declarations](https://code.claude.com/docs/en/plugins/mods/reference.md#look-up).
88 
99## Add a command or a tool
1010 
11A mod can add a command for the user to run and a tool for Claude to call. Register both in a [`session.start`](https://code.claude.com/docs/en/plugins/mods/reference#session) hook. Claude Code waits for that hook before the first prompt, so what you register is available from the first turn.
11A mod can add a command for the user to run and a tool for Claude to call. Register both in a `session.start` hook. Claude Code waits for that hook before the first prompt, so what you register is available from the first turn.
1212 
1313### Add a command
1414 
from line 258
258258 
259259### Stop background work
260260 
261Timers stop after the module reloads. For long-running work inside a hook, [`next.signal`](https://code.claude.com/docs/en/plugins/mods/reference#the-hook-function) is an `AbortSignal` that aborts when the event your hook is handling is abandoned, for example when the user interrupts. Pass it to anything long-running.
261Timers stop after the module reloads. For long-running work inside a hook, `next.signal` is an `AbortSignal` that aborts when the event your hook is handling is abandoned, for example when the user interrupts. Pass it to anything long-running.
262262 
263263### Calls and background work after the user interrupts a turn
264264 
from line 461
461461* [React to events](https://code.claude.com/docs/en/plugins/mods/events.md): hook tool calls, prompts, and turns
462462* [Draw in the interface](https://code.claude.com/docs/en/plugins/mods/interface.md): show what your mod collects in a pane or above the prompt
463463* [Test a mod](https://code.claude.com/docs/en/plugins/mods/test.md): stub any of these calls in a test
464* [Mods reference](https://code.claude.com/docs/en/plugins/mods/reference.md): events, mods API methods, and limits
464* [Mods reference](https://code.claude.com/docs/en/plugins/mods/reference.md): where to look up a method, and the limits
465465 
Feedback