Follow Discord
Sweep 06 Nov 2026 · 01:32Z Build v2.1.319 537 read Stable v2.1.311 Latest v2.1.318 Next v2.1.319 Feeds RSS JSON llms.txt llms-full.txt Unofficial
Mods API

The whole surface.

Every noun, verb, event and type a Claude Code mod can reach, with the signature and the doc comment Claude Code wrote for it. Anthropic's Mods reference covers the same surface a table at a time. This is every declaration in full, and none of it is written by hand here: the release pipeline pulls the declarations out of the shipped binary and this section renders what it found.

Search to find a name. The three pages under it are the same symbols in full, with the source text.

Symbols866every one, in the index below
Mined from2.1.319the shipped binary
Machine readableapi.jsonin pages, sized for an agent's fetch; api-full.json is the whole document
What changed

v2.1.319

+9 added · 4 removed · 3 changed · 3 docs only 5 may break Every release since v2.1.259
  1. The engineEvery noun and verb on $, with its signature, its parameters and the example the declarations carry.
  2. $.plugin noun This plugin, as loaded: its manifest name and its directory.
  3. $.plugin.name verb From plugin.json; debug-log and $.ui.log lines carry it.
  4. $.plugin.root verb The plugin's directory (the one holding plugin.json), absolute.
  5. $.ui noun Display: a line under an open dialog, a redraw or a repaint, a log line, panes the surface places, a window or ring, a surface's clipboard.
  6. $.ui.notice verb Shows text as one line under the dialog open for tool_use_id, or removes the line when text is undefined.
  7. $.ui.invalidate verb Re-runs an event whose results the engine caches: ui.render draws the instances this plugin may draw again; the others drop the cached answers.
  8. $.ui.blit verb Repaints a mounted Raster this plugin's own render hook drew with new cells, or swaps a keyed Image it drew to a new source; no redraw.
  9. $.ui.resolve verb The elements of the surface e is drawn on (Elements[e.surface]): a frozen table of constructors, the JSX tags a render hook draws with.
  10. $.ui.log verb Appends one line to the transcript, drawn like a system notice (dim; not sent to the model), or with { to: "debug" } to the debug log alone.
  11. $.ui.ask verb Asks the user question in the engine's own AskUserQuestion dialog and resolves to the label they chose, or the text typed under "Other".
  12. $.ui.toast verb Shows text for a few seconds under the plugin's name: a small box on the stack of plugin toasts over the transcript's top right corner.
  13. $.ui.notify verb Raises a native notification of text through the person's own notification channel, the one their preferredNotifChannel names.
  14. $.ui.status verb Pins text as this plugin's status line under the prompt, beside the engine's own pinned notices, until the next call replaces it.
  15. $.ui.open verb Opens a pane, a framed region the surface places and this plugin draws by hooking ui.render for { component: "Pane" }; says if it is drawn.
  16. $.ui.close verb Closes one of the open panes; an id that is not open is left alone.
  17. $.ui.panes verb Lists this plugin's own open panes (UiPane): each one's id and title, and whether it is shown, holds the keyboard, and is placed.
  18. $.ui.place verb Places one row at the transcript's end, which scrolls with the conversation and draws what ui.render answers for Placed.
  19. $.ui.scroll verb Scrolls something into view as the DOM's scrollIntoView would: a render instance by requestId, an element by key, a site's edge.
  20. $.ui.focus verb Moves the focus ring of one of this plugin's sites onto an element it drew there, as the DOM's element.focus(), while it holds the keys.
  21. $.ui.copy verb Puts text on the clipboard of a surface the session draws on, as the DOM's navigator.clipboard.writeText, and says whether it took.
  22. $.ui.selection verb Returns what the person last selected with the mouse: the text as a copy would take it, and the transcript row it lies in.
  23. $.ui.view verb Puts an agent's transcript in the main view, as the person's own switch from the tasks list does; {} goes back to the main one.
  24. $.theme noun The session's one theme: how the app looks behind and around the conversation. One theme stands at a time, the latest set, whichever plugin set it; there is no stack.
  25. $.theme.set verb Sets the session's theme from one object of named top-level attributes. backdrop is drawn behind the conversation by what ui.render answers for Backdrop: full window on desktop under its frosted panels, full screen on mobile under one veil (tint and opacity, not yet blur). Display only: --resume brings none back and a plugin that unloads takes its own with it, so set it at session.start.
  26. $.theme.clear verb Clears the session's theme, back to the app's own look.
  27. $.model noun Completions through the session's own client and credentials.
  28. $.model.complete verb Runs one text completion through the session's own API client and resolves a result: the reply's text and cost, or why there is no text.
  29. $.model.fork verb Runs one tool-less completion over the session's OWN transcript as the main thread last sent it, so the API serves that prefix from its cache.
  30. $.model.classify verb Picks one of labels for text with one completion over $.model.complete and a fixed classifier prompt.
  31. $.audio noun Sound: clip playback and platform speech.
  32. $.audio.play verb Plays one audio clip, starting now; clips are not queued, so two calls play together (a bed under speech).
  33. $.audio.speak verb Speaks text with the platform's own synthesizer (say on macOS). Plain text.
  34. $.mcp noun The engine's MCP servers: calling a connected one's tools, and connecting one the plugin lists itself.
  35. $.mcp.call verb Calls tool on one of the engine's connected MCP servers with the engine's own connection and credentials.
  36. $.mcp.connect verb Connects one of the MCP servers this plugin's own manifest lists, if the session has not already: a listed server joins it at its start.
  37. $.session noun The running session, read as plain data; compacting it; and sending a message from it to another agent or session.
  38. $.session.messages verb Returns the transcript so far, one SessionMessage per user or assistant message; progress rows, $.ui.log lines and notices are not messages.
  39. $.session.cwd verb Returns the directory the session runs in, absolute.
  40. $.session.root verb Returns the session's project root, absolute: where it started, or where /cd, a host's directory change or a worktree move took it.
  41. $.session.model verb Returns the main loop's model, as /model shows it.
  42. $.session.turns verb Returns how many prompts the user has sent this session (user turns in the transcript).
  43. $.session.id verb Returns the session's id (the transcript file's name).
  44. $.session.repo verb Returns the git repository the session runs in, read from the working copy on each call; null when the directory is not inside one.
  45. $.session.surfaces verb Returns every surface the session draws on, each once: terminal under the REPL first, then the remote ones in the order they attached.
  46. $.session.surface verb Returns the first of $.session.surfaces(), or null where nothing draws.
  47. $.session.usage verb Returns when the session began, and the context window's fill, the rate-limit windows and the cost as the status line has them, itemized.
  48. $.session.version verb Returns the version of the engine the session runs on, the release it is built from, and when it was built.
  49. $.session.compact verb Compacts the conversation: the event session.compact with trigger plugin, the same call /compact makes, between turns.
  50. $.session.send verb Sends a plain-text message to another agent or session: the event session.send, the model's SendMessage tool's own call and delivery.
  51. $.session.append verb Appends a row to a conversation of the session: the event session.append, the engine's own call for every row it keeps.
  52. $.session.authorize verb Holds the session's Anthropic credential on the host and answers an opaque handle and its kind; the secret never reaches the plugin.
  53. $.session.identity verb Returns how the session is signed in, to a mod the organization's managed settings install; { deny } to any other. No request is made.
  54. $.turn noun The running model turn: ending it.
  55. $.turn.abort verb Cancels the main loop's running model turn (the id its turn.start handed this plugin), its running tools stopped, no interruption marker.
  56. $.prompt noun Submitting a prompt the model reads as a user turn, and the person's prompt box: read as it stands, written, or proposed into.
  57. $.prompt.submit verb Submits a prompt: the event prompt.submit, the same call the engine makes for a typed prompt; a turn of its own, once the session is idle.
  58. $.prompt.read verb Returns the prompt box as it stands, the draft typed so far and the cursor's offset into it, so a fill can keep what the person typed.
  59. $.prompt.media verb Returns one image or document of the prompt being submitted, by the id e.attachments lists it under: its bytes, base64, 4 MiB a call.
  60. $.prompt.fill verb Puts input.text in the prompt box as the draft, by mode: replace (the default) over it, append after it, insert at the cursor.
  61. $.prompt.paint verb Sets this plugin's own decorations over the draft and nothing else.
  62. $.prompt.suggest verb Proposes input.text as the prompt box's dim suggestion, Tab to take: the event prompt.suggest, as the engine's own guess after a turn.
  63. $.prompt.compose verb Returns the system prompt's sections for facts: the event prompt.compose, the call the engine makes for every prompt it sends.
  64. $.tool noun The tools the model has in this session, and running one.
  65. $.tool.list verb Returns the tools the model can call now, built-in and MCP alike, in the order the model sees them.
  66. $.tool.call verb Calls a tool: the event tool.call, the same call the engine makes for the model's tool calls, under a tool_use_id of its own.
  67. $.tool.check verb Asks the engine's permission decision for a tool call now: the event tool.check, resolved to its verdict ({ decision, reason?, ... }).
  68. $.tool.register verb Declares a tool the model can call from the next prompt on: the name, description and input schema of mcp__<plugin>__<name>.
  69. $.command noun The slash commands the person can run in this session, and running one.
  70. $.command.list verb Returns the slash commands the person can run now, built-in, plugin and MCP alike, in the order the typeahead lists them.
  71. $.command.run verb Runs a slash command as if the person typed /command args: the event command.run, queued and run once the session is idle.
  72. $.command.register verb Declares the slash command /<name> for this session, listed in the typeahead from the next keystroke on.
  73. $.config noun Every row of the settings menu (/config), the panel's own and each enabled plugin's userConfig fields alike: listing and changing them.
  74. $.config.list verb Returns the rows the /config menu would draw now, in its order, each with its current value, its kind, its owner and its lock.
  75. $.config.set verb Changes one row as if the person did in the menu: the event config.set with origin { kind: 'plugin', name }, then the writer.
  76. $.telemetry noun Analytics: first-party rows and feature marks for Anthropic, and records for the telemetry collector the session's operator configured.
  77. $.telemetry.log verb Logs one record to the destination entry.to names, the event telemetry.log; e.to is pinned, and anthropic when left out.
  78. $.telemetry.mark verb Marks one use of a feature as the CLI's own feature events do, the event telemetry.mark; it takes no to and always means anthropic.
  79. $.agent noun Subagents.
  80. $.agent.spawn verb Spawns a subagent: the event agent.spawn, the same call the engine makes when the Agent tool starts one; the engine fills the rest.
  81. $.agent.list verb Returns the session's agents so far, subagents and teammates: the ones the model spawned and the ones plugins did alike.
  82. $.agent.register verb Defines an agent type the Agent tool dispatches from the next turn on, named <plugin>:<name>: the event agent.register.
  83. $.fs noun The file system as the engine's own process reaches it; a relative path is under the session's working directory, and text is UTF-8.
  84. $.fs.read verb Reads a file and returns its text, or with { as: "bytes" } its bytes as { base64 }.
  85. $.fs.write verb Writes text to a file, creating it and its directories as needed.
  86. $.fs.list verb Lists a directory by name: { name, kind, size, mtimeMs, isLink } per entry, each entry as it stands.
  87. $.fs.exists verb Returns whether the path exists; rejects only a network location, which the implementation beneath the hooks never touches.
  88. $.fs.stat verb Returns { kind, size, mtimeMs, isLink } of the path: what it leads to, and whether it is itself a symbolic link. Rejects when missing.
  89. $.fs.ancestors verb Reads the named instruction files in every directory above the session's original working directory, the way the engine reads CLAUDE.md.
  90. $.store noun This plugin's own key-value store, kept between sessions and hot reloads; values are JSON data.
  91. $.store.get verb Returns the value under key, or undefined when unset.
  92. $.store.set verb Sets key to value, which must be JSON data.
  93. $.store.delete verb Removes key from the store.
  94. $.store.keys verb Returns every key set, in insertion order.
  95. $.state noun Named values held by the host for the session, each with a version: plain data that survives a hot reload of the plugin's code.
  96. $.state.get verb Resolves the value under ref and the version it stands at; a value never written is undefined at version 0.
  97. $.state.set verb Writes value under ref, which must be this plugin's own; the sites that read it while drawing are drawn again, at the redraw rate.
  98. $.clock noun The time and timers, each an event through the host: clock.now reads the time; clock.sleep, after and every wait until it has passed.
  99. $.clock.now verb Resolves milliseconds since the epoch, now.
  100. $.clock.sleep verb Resolves after ms milliseconds; rejects at once when signal aborts.
  101. $.clock.after verb Calls fn once after ms milliseconds; cancel() before then stops it.

What the file says about itself

Claude Code writes the declarations with an introduction at the top, and this is it, reproduced as it ships. Until Anthropic published their mods docs with 2.1.287, it was the only guidance that came with the surface.

EARLY ACCESS: this surface may change between releases without notice. Written by the engine each time it loads a mod from a folder the person owns, beside that mod as .claude-plugin/types/claude-code/index.d.ts; written again after an update rather than edited. The first line names the Claude Code version that wrote it. TypeScript 5.4 or newer reads it. `claude plugin validate <dir>` is the other half: it reads a plugin's manifest and its hooks module's source the way the engine will and reports what the module hooks and calls and everything the engine would refuse, before any session loads it.

What is here: the module a hooks module may import types from,

import type { Register, On, EngineInterface } from 'claude-code'

(at run time the import is empty), and the globals a hooks module has: `h` and `Fragment` (what JSX compiles against), the JSX namespace, and the environment's web APIs (URL, TextEncoder, AbortController, crypto.subtle, ...). A hooks module runs in an environment of its own: no DOM, no Node. The module, and every file it imports from the plugin, is named .ts, .tsx, .jsx, .js, .mjs, .cjs, .mts or .cts (a file named otherwise is not loaded) and is an ES module whatever its suffix: there is no `require`. A file of the plugin is imported with an `import` declaration. A module holding `import()` does not load. The elements a render hook draws with (`Box`, `Text`, `Button`, ...) are not globals: they come from the surface's table,

const { Box, Text } = $.ui.resolve(e)

Also here: 'claude-code/testing', the kit a plugin's *.test.ts and *.test.tsx files import under `claude plugin test <dir>`, which runs each in an environment like the one a plugin's hooks run in (no fs, network or process), the plugin loaded from the folder by the engine's own host: `test(name, async ($, on) => { ... })`, where `$` is the engine's own and the hooks `on` registers sit beneath every plugin; with describe, expect, tier, and `mock`, whose clock, store and env answer those nouns beneath the plugins from memory. `$.ui.mount` draws a component through the plugin on the surface the test names (terminal, desktop, vscode or mobile: never assumed) and hands back the drawing to read and act on by key: find an element, press a Button, type into an Input, drive a `Client`'s module (keys, pointer, posts, its frame clock), each act typed by that surface's element table, so one test body run over several surfaces covers the mod's hooks and description on each. It exercises the mod (its hooks, the tree they return under each surface's rules, its `Client` modules), never a surface's paint (Ink's, the desktop page's):

test('notes add up on every surface that takes input', async $ => {
  for (const surface of ['terminal', 'desktop'] as const) {
    const ui = await $.ui.mount({ plugin: 'notes', surface, ...BAND })
    await ui.input({ key: 'new', text: 'milk' })
    expect((await ui.find({ key: 'count' }))?.text).toBe('1 note')
    await ui.key({ key: 'down', in: 'list' })
    await ui.unmount()
  }
  for (const surface of ['terminal', 'desktop', 'vscode', 'mobile'] as const) {
    const ui = await $.ui.mount({ plugin: 'notes', surface, ...HINT })
    expect(await ui.find({ type: 'Text', text: /notes/ })).toBeDefined()
    await ui.press({ key: 'dismiss' })
  }
})

Typing a plugin against it:

export const register: Register = (on, options) => { ... }

or, in a .js module,

/** @type {import('claude-code').Register} */
export const register = (on, options) => { ... }

A tsconfig.json (or jsconfig.json) that fits a hooks module:

{
  "compilerOptions": {
    "target": "es2023", "lib": ["es2023"], "types": [],
    "module": "esnext", "moduleResolution": "bundler",
    "strict": true, "noUncheckedIndexedAccess": true,
    "noEmit": true, "skipLibCheck": true,
    "jsx": "react", "jsxFactory": "h", "jsxFragmentFactory": "Fragment"
  },
  "include": [".claude-plugin/types", "hooks", "types", "tests"]
}

".claude-plugin/types" is where the engine lays this file (claude-code/) and, beside it, this build's built-in tools (claude-code-tools/), the MCP tools connected when the mod last reloaded (claude-code-mcp/) and one entry per plugin the mod's plugin.json lists under "dependencies" (that plugin's own contract): what it adds to `$` in engine.create, so a plugin you depend on is typed with nothing copied (the include above takes the whole folder). "hooks" is the plugin's hooks/ folder, "types" its own contract and "tests" its test files. `lib` names no DOM: the environment has none, and its `Text` would shadow the element. A mod with no tsconfig of its own has these options without writing them: the engine gives it a tsconfig.json that extends .claude-plugin/types/tsconfig.json, which carries them with that folder as the one type root.

A plugin that adds a noun to `$` ships its own contract: a .d.ts its plugin.json names as "types", exporting the noun's types at its top level and declaring the noun on the engine's interface,

export type Topo = { ... }
declare module 'claude-code' {
  interface EngineInterface { topo: Topo }
}

with no import or reference, its exported names led by the noun's PascalCase name; the plugin's own hooks module imports them from it.

Where this comes from

Claude Code carries its own type declarations for the hooks runtime. From 2.1.287 it writes them into .claude-plugin/types/ each time it loads a mod from --plugin-dir, and before that /plugin-types wrote them on request. They are not in the npm package as a file and not in the JavaScript bundle either: Claude Code decompresses an asset embedded in the binary. So documenting the surface used to mean installing a build and running it by hand, which is why nobody did it twice.

The release pipeline reads that asset straight out of the binary it already downloads, parses it, and writes a JSON document beside the rest of the release data. This section renders that document. Which means it is never a release behind, and nobody has to remember anything.

The prose about how to use any of this, what the calls cost, and which ones do not behave the way their shape suggests is the Mods Guide. This section is the inventory.

Mined from build 2.1.319 on 6 Nov 2026 . The declarations are Claude Code's own writing about itself, reproduced here; everything around them is this site's.

Feedback