Source Intelligence

DisclaimerUnofficial, and not affiliated with Anthropic. Nearly all of this is read straight out of what ships: npm bundles, captured prompts, published docs. Anthropic's own notes go in verbatim, marked as theirs. The rest is my reading, and every entry carries the strings behind it. If one looks wrong, vote it down and say why.

All of v2.1.242 Home All releases olderv2.1.241 v2.1.243newer
Claude Code v2.1.242

Plugin modules with a $ API that can hook events and redraw the terminal UI

Not switched on
Useful3 Signal5
Plugins Notable

Plugins can install code that intercepts tool calls and repaints parts of the terminal interface.

A full plugin hook API that can substitute terminal rendering is present; nothing overrides anything unless a loaded module declares a handler.

What

A plugin can load a hook module that receives a $ object exposing event chains and host capabilities, letting it intercept tool calls, prompts and agent turns, and substitute the props Claude Code uses to draw its own interface. Message rendering was rewritten so that named draw sites can be targeted individually, and modules run inside their own sandboxed globals so host objects and host stack frames never reach plugin code. Nothing switches this on or off, and a site is only overridden when a loaded module declares a handler for it, so a stock install behaves and renders exactly as before.

Details
  • Event chains available on $ are tool.call, tool.describe, prompt.submit, prompt.section, agent.spawn, turn.start, turn.step, turn.complete and ui.render, with PreToolUse also carried by the same dispatch layer.
  • Capabilities on $ are model.complete, mcp.call, audio.play and audio.speak, the session.* group, tool.list and tool.register, ui.toast, ui.status, ui.log and ui.notice, fs.readFile, fs.writeFile, fs.listDir, fs.exists and fs.stat, store.get, store.set, store.delete and store.keys, and http.fetch.
  • Each capability enforces its own policy check rather than deferring to one shared permission switch.
  • Every call runs its handler chain and fails if nothing at the bottom of the chain terminates it, reporting no core at the bottom of the chain (the site did not install one and the call supplied none).
  • The draw sites a ui.render handler can target are UserMessage, AssistantMessage, ToolUse, ToolResult, TurnDuration, Spinner, InfoNotice, SessionMode and AskUserQuestion.
  • Modules execute against a replacement set of globals: AbortController and AbortSignal, TextEncoder and TextDecoder limited to UTF-8, URL and URLSearchParams, atob and btoa, a hand-written structuredClone, crypto.subtle.digest, randomUUID and getRandomValues, performance.now, and classic-runtime JSX helpers that emit JSX element < markers.
  • Errors thrown by the host are re-thrown as errors belonging to the plugin's own environment, with stack frames outside the plugin directory trimmed away.
  • The hook runtime ships as a bundled worker whose path now appears in build metadata alongside version, build time and git sha.
  • A module that fails to load is reported as plugin_function_hooks_load with a declaration-failed reason.
Evidence

/$bunfs/root/src/plugins/functionHooks/hooks-worker/hooks-worker.js, no core at the bottom of the chain (the site did not install one and the call supplied none), JSX element <

Strings lifted out of the shipped bundle, so the claim above can be checked against them.

See this entry in the whole of v2.1.242 →