Claude Code 2.1.333 widens its mod API with session, model and file hooks
Anthropic's changelog for Claude Code 2.1.333 adds mod features for session loading, streamed model calls and compare-and-set file writes.
Anthropic's changelog for Claude Code 2.1.333, dated November 30, 2026, expands the mod API, the extension mechanism that lets plugins hook into the terminal session. A mod can now resume, clear, branch or rewind a conversation between turns with $.session.load. It can also receive a session.state event that reports whether the session is busy, waiting or idle. Model completions and HTTP response bodies can be streamed as they arrive through $.model.stream and $.http.stream.
The file and storage changes add compare-and-set. $.fs.stat now returns a version for a file, and $.fs.write and $.fs.remove accept an ifVersion argument. A write goes through only if the file still has the version the mod last read. The mod's $.store follows the same pattern: a key is read with its version and then set or deleted only if that version still holds. A mod author who reads a file, computes a change and writes back can therefore detect that the file changed in between.
Tools registered through $.tool.register can now carry traits such as read-only, concurrency-safe, destructive and runs-code, plus a search hint, a when-to-use line and a display title. The changelog does not say how Claude Code acts on these traits. They are declarations from the mod author, and the changelog describes no enforcement beyond them. The tool.run answer can also return content and isEnd. Content gives Claude text and image blocks for a tool call, and isEnd ends the turn after it.
Several narrower entries matter to anyone building on the API. $.session.load and the session.load event cover /resume, /clear, /branch and /rewind, and a mod can veto the session.load event. The $.state.set option gets a persistence setting: "transcript" keeps a mod's value through resume and fork, through a rewind, and through compaction. $.prompt.submit gains a wait: false option that lets a prompt enter a running turn at its next step rather than waiting for the turn to end. The model call $.model.complete gains schema and thinking options and now names the model that answered. The changelog also lists a fix for mods whose matchers were slowing down unrelated calls. It notes one consequence of a changed contract: mod tests that compare next.origin exactly will need the new pluginId field and, where it applies, isOfficial.
The rest of the entry is mostly interface work and fixes. It adds an $.ui.render call, a CommandRow, toast placement and keys, and a ui.key event that lets a hook take or pass on keystrokes at the prompt. It also covers changes to Claude Code itself. These include a wait of up to 30 seconds at exit for claude -p and SDK runs, so work a mod registers with $.session.waitUntil can finish, and a change that stops re-attaching uploaded files and tool results after compaction.
The changelog is the source for these claims, and it describes features rather than demonstrating them. Its entries state what the new functions do. They include no example code or benchmarks, beyond the note about mod tests.
What changed
The Claude Code mod API gains session load, session state events, streamed model and HTTP calls, compare-and-set file and store writes, extra tool traits and tool.run content and isEnd fields, and mod tests comparing next.origin exactly now need the pluginId field.
Type: New capability · Takes effect: Monday, November 30, 2026 · Applies to: Claude Code 2.1.333, $.session.load, session.state, $.model.stream, $.http.stream, $.fs.stat, $.fs.write, $.fs.remove, ifVersion, $.store
Why it matters
Teams that build internal Claude Code extensions get more control over sessions, tool calls and file writes, but mod tests that compare origins exactly will need the new fields.
What you can do
Teams with Claude Code mods should rerun their tests against 2.1.333, since origin fields changed.
Original source
Where we saw it
Claude Code changelog
AI wrote this summary from the sources listed, and nobody reviewed it individually before publication. Check the original source before you rely on it. How it works