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. TypesEvery declaration in the file, verbatim, with the doc comment above it.
  2. PromptComposeResult type What a prompt.compose hook returns: the sections of the system prompt, in order, every shared one ahead of every session one.
  3. PromptComposeScope type Which side of the prompt cache's boundary a section of the system prompt sits on: shared before it, session after it.
  4. PromptComposeSection type One section of the system prompt as prompt.compose answers it: a stable id, the text the model reads, and the side of the cache boundary it is on.
  5. PromptComposeTrait type One branch the engine's own composition of the system prompt takes on the request or the session before it computes any section: a closed set.
  6. PromptContextBlock type One block of the context the first user message carries: a name the engine keys it by and the text under it.
  7. PromptContextBlocks type The context blocks of a conversation's first user message, in the order the engine renders them: what prompt.context takes and answers alike.
  8. PromptContextInput type The input of prompt.context: the context blocks the engine prepends to a conversation's first user message, and the files behind claudeMd.
  9. PromptContextResult type What a prompt.context hook returns: the blocks the conversation carries, in order; one left out is not sent.
  10. PromptDecoration type One styled run a surface paints over the prompt draft: [start, end) of a text, in UTF-16 code units like PromptBox cursor. Paint only.
  11. PromptEditInput type The input of prompt.edit (prompt-edit/): one edit the person makes in the prompt box, as the draft before it and the splice the editor made of it.
  12. PromptEditOrigin type Who edits the prompt box at prompt.edit, as the engine stamps it where the edit starts; a closed set a matcher narrows on.
  13. PromptEditResult type What a prompt.edit hook returns and what next(e) resolves to: the box after the edit (PromptBox), which the editor then shows.
  14. PromptFillArgs type prompt.fill's input as a plugin's $.prompt.fill(args) takes it: no origin (the engine sets the calling plugin's), mode optional.
  15. PromptFilled type What $.prompt.fill resolves to: whether the box took the text, and the box afterwards (PromptBox) as the caller's own $.prompt.read() reads it.
  16. PromptFillInput type The input of prompt.fill (prompt-fill/): a text about to be put in the prompt box as the person's draft, over it, after it, or at the cursor.
  17. PromptFillMode type Where a prompt.fill puts its text: over the whole draft, after it, or into it at the cursor.
  18. PromptFillOrigin type Who writes the prompt box at prompt.fill, as the engine stamps it where the write starts; a closed set a matcher narrows on.
  19. PromptFillResult type What a prompt.fill hook returns and what next(e) resolves to: whether the text went into the prompt box.
  20. PromptMedia type What $.prompt.media({ id }) answers: one attached item's bytes as the engine would send them now, or why there are none to read.
  21. PromptMediaArgs type What $.prompt.media(args) takes: which attached item of the prompt being submitted to read, and from where in it.
  22. PromptMentionAttached type How the engine attached a mentioned file, in the names prompt.attachment gives its type.
  23. PromptMentionInput type The input of prompt.mention: one file a prompt names after an @, as the engine resolved it and before it is read for the model.
  24. PromptMentionResult type What a prompt.mention hook returns and what next(e) resolves to: how the file was attached ({ type, context? }), or { deny: reason }.
  25. PromptOrigin type Where a prompt.submit submission came from, as the engine knows it at the site it was queued from; a closed set, never a text prefix.
  26. PromptPaintArgs type What a plugin's $.prompt.paint(args) takes, and a hook on prompt.paint sees as e and may rewrite.
  27. PromptPainted type What $.prompt.paint resolves to: whether the runs were painted, and the box as it stands (PromptBox).
  28. PromptSectionInput type The input of prompt.section: one named section of the system prompt, at the moment the engine assembles it.
  29. PromptSectionResult type What a prompt.section hook returns: the text the prompt carries for that section, or null to leave it out.
  30. PromptSubmitArgs type prompt.submit's input as a plugin's call takes it: origin, turnId and wait are the engine's to set, context the hooks' to attach.
  31. PromptSubmitAttachment type A pasted or attached non-text item of a submitted prompt; its kind, never its bytes, which $.prompt.media reads by the item's id.
  32. PromptSubmitCommand type The slash command a submission runs, as the engine tells prompt.submit: the command as command.run's hooks left it, their change of arguments included.
  33. PromptSubmitInput type The input of prompt.submit: the prompt as typed, after the input became a user message and before it enters the session.
  34. PromptSubmitResult type What a prompt.submit hook returns and what next(e) resolves to: the prompt that entered, { text, context?, origin? }, or { drop: reason }.
  35. PromptSuggestArgs type prompt.suggest's input as a plugin's $.prompt.suggest(args) takes it: origin is the engine's to set (the calling plugin's name).
  36. PromptSuggestInput type The input of prompt.suggest (prompt-suggest/): a text about to be shown dim in the empty prompt box, for Tab (or the right arrow) to take.
  37. PromptSuggestOrigin type Who proposes the text at prompt.suggest, as the engine stamps it where the proposal starts; a closed set a matcher narrows on.
  38. PromptSuggestResult type What a prompt.suggest hook returns and what next(e) resolves to: whether the text is now the box's dim suggestion.
  39. RasterBlitArgs type A $.ui.blit argument repainting one of the caller's mounted Rasters.
  40. RasterProps type The props of Raster, the terminal surface's cell-grid leaf: a fixed box of cells, each a glyph, a foreground and a background, packed in cells.
  41. ReadFunction type read($, source): the value of an atom (its initial while absent), of a derived value, or under a plain reference; one $.state.get per value.
  42. Register type The hooks module's entry: export function register(on, options). on registers hooks; options is the plugin's configuration (PluginOptions).
  43. RegisteredToolSpec type A ToolSpec as $.tool.register hands it on: the input schema filled in, isDeferred as the plugin gave it.
  44. Registration type What on(...) returns for a hook of type F: the registration, which takes one .catch (CatchHandler); without it a failed hook is absent.
  45. RenderChildren type What an element takes as children, as JSX passes them: a node, a number (drawn as its string), a value the factory drops, or a list that may nest.
  46. RenderComponent type Everything ui.render can draw: one name per component that has a render site; a matcher narrows on it.
  47. RenderElement type What a render hook returns, and what next(e) resolves to: a plain-data tree of elements (a Box or Text is a StyledElement), strings as children.
  48. RenderEventName type The render event: ui.render, one event for every component that has a render site.
  49. RenderInput type The input of ui.render: a union discriminated by component, one member per RenderComponent and per RenderSurface.
  50. RenderInputOf type One ui.render input, for a component narrowed to one surface.
  51. RenderNode type A node of a render tree: an element, or a string (text).
  52. RenderPropsOf type The plain-data props of each renderable component, as ui.render sees them under e.props; a hook rewrites them with next({ ...e, props }).
  53. RenderResultOf type What a ui.render hook returns and what next(e) resolves to: a RenderElement tree, the same for every component.
  54. RenderSurface type The surface a render event's component is drawn on, by name. Plugins draw into surfaces; they do not provide them.
  55. RenderViewport type The size of what a surface draws into, in character cells of the surface's monospace metric, and whether its layout docks a pane.
  56. ResolveInput type The input of ui.resolve: which surface's elements, for which component; a union with one member per surface (ResolveInputOf).
  57. ResolveInputOf type One ui.resolve input, for a component on one surface.
  58. ResultOf type What each event's hook returns, and what its next(e) resolves to, by event name.
  59. SDKAssistantMessageError type
  60. Select type The members of T assignable to S; all of T when none is.
  61. Selected type The events a pattern selects, as a union of names: the one named, every one under a glob's namespace, or every one a negation does not exclude.
  62. Selection type The literal each tag key of I is held to by matcher M: one-of arrays flattened, RegExps widened to unknown.
  63. SelectOption type One option of a Select: the value onSelect and ui.select carry, and the text drawn for it (the value when absent).
  64. SelectProps type The props of Select, every surface's one-of-several picker: an address, a label, the options, the one selected, the closure a pick runs. A leaf.
  65. SessionAppendArgs type session.append's input as a plugin's $.session.append(args) takes it: the row's kind and text, and the loop it joins.
  66. SessionAppendDoor type Which door a row came in by, decided from the row alone; a closed set, pinned on the event and the key a matcher narrows on.
  67. SessionAppendInput type The input of session.append: one row being appended to a conversation of this session, by the engine site that originates it or by a plugin's call.
  68. SessionAppendMessage type One row of a conversation as session.append hands it: how the transcript files it, under which role a request carries it, and its blocks.
  69. SessionAppendOrigin type Who caused a row, as the engine knows it from the row itself: a submission's sender, an injected row's author, the model, or the tool that was called.
  70. SessionAppendResult type What a session.append hook returns and what next(e) resolves to: the row as the session stored it, or { deny: reason } for a plugin's own call.
  71. SessionAttachInput type The input of session.attach: a surface joined the session's roster of attached clients (a phone opened the session; the desktop app connected).
  72. SessionAttachResult type What a session.attach hook returns and what next(e) resolves to: { clientId }, echoed by core; a hook's own value changes nothing.
  73. SessionAuthorization type What $.session.authorize() answers: an opaque handle for the session's Anthropic credential and its kind, or null when there is none to hold.
  74. SessionCompactArgs type session.compact's input as a plugin's $.session.compact(args) takes it: trigger (plugin), messages and agentId are the engine's.
  75. SessionCompacted type A compaction that stands: the conversation as it reads afterwards, and the counts and request usage the engine recorded when it was the one compacting.
  76. SessionCompactInput type The input of session.compact: one compaction of the conversation, about to run; messages is the transcript it runs over.
  77. SessionCompactResult type What a session.compact hook returns and what next(e) resolves to: the compaction ({ messages, tokensBefore?, tokensAfter?, usage? }) or a skip.
  78. SessionCompactSkipped type A compaction vetoed: on precompute nothing is computed or kept; on any other trigger the conversation stays as it is and one line says why.
  79. SessionCompactTrigger type Who compacts: the person's /compact (manual), the engine at its threshold or on a prompt too long (auto), a plugin, or a precompute.
  80. SessionContextBreakdown type The context window broken down as /context breaks it down: the rows, the grid and the lists beneath it, in the SDK's get_context_usage shape.
  81. SessionContextUsage type The live context window as the status line reads it, and by category as /context breaks it down when the call asked ({ breakdown }).
  82. SessionCost type What the session has cost, as /cost and the status line total it.
  83. SessionCronSummary type
  84. SessionDetachInput type The input of session.detach: a client left the session's roster. Every field is the engine's: a hook observes, and next(e) passes them on.
  85. SessionDetachReason type Why a client left the roster: detach, it said so (ui_detach); end, the session ended with it still attached.
  86. SessionDetachResult type What a session.detach hook returns and what next(e) resolves to: { clientId }, echoed by core; a hook's own value changes nothing.
  87. SessionEndHookInput type
  88. SessionEndInput type The input of session.end: the session is ending, why, and how to come back to it; every field is the engine's: a hook observes, next(e) passes it on.
  89. SessionEndReason type Why the session ended: the classic SessionEnd hook's own reason, word for word.
  90. SessionEndResult type What a session.end hook returns and what next(e) resolves to: { sessionId }, echoed by core; a hook's own value changes nothing.
  91. SessionIdentity type What $.session.identity() answers: how the session is signed in and, under a managed pin of its organization, the account the session holds.
  92. SessionMeasureInput type The input of session.measure: what $.session.usage() answers at this moment, and which of its units moved since the last measurement a hook saw.
  93. SessionMeasureResult type What a session.measure hook returns and what next(e) resolves to: { changed }, echoed by core; a hook's own value changes nothing.
  94. SessionMessage type One message of the transcript as $.session.messages() returns it.
  95. SessionMessagesAgentArgs type A $.session.messages call for the rows (SessionMessage) of the main conversation or of one agent's: agentId alone, no as.
  96. SessionMessagesApiArgs type A $.session.messages call for the Messages API form (ApiMessage) of the main conversation or, with agentId, of one of this session's agents'.
  97. SessionMessagesApiResult type What $.session.messages({ as: "api", agentId }) resolves to: the agent's conversation as ApiMessage, or { deny } (SessionMessagesDeny).
  98. SessionMessagesArgs type What $.session.messages(args) takes and a session.messages hook reads on e: whose conversation (agentId) and in which form (as).
  99. SessionMessagesCall type $.session.messages: the main conversation's rows with no argument, with { as: "api" } its Messages API form; with agentId an agent's, or deny.
  100. SessionMessagesDeny type What $.session.messages({ agentId }) resolves to when the id names no conversation this session can read: why not, in deny.
  101. SessionMessagesMainApiArgs type A $.session.messages({ as: "api" }) call naming no agent: the main conversation, whose answer is always the messages (ApiMessage).

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