Claude Code Mods expose the agent loop to plugin code
Claude Code now lets you write JS/TS that changes how the agent works. Prompts, tool arguments, retries, results, commands, shared state, even the terminal UI.
These are called Mods, shipped inside plugins, available in CLI v2.1.287. Lots of room to build workflows around how you actually work. Overview
The part I’m most interested in is how they compose.
Handlers form a middleware chain. Your mod can change an event and pass it along with next, or answer it directly and stop everything downstream. Once you have a few mods installed, their order starts to matter.
There’s also a detail I’d check before relying on one as a guardrail: if a hook throws before calling next, Claude Code normally skips it and keeps going. You can attach an error handler that denies the action instead. So “this mod blocks a command” and “this mod still blocks it when its guard breaks” are separate things to verify. Events and failure handling
And these run with your machine permissions: files, processes, network access.
I’m curious what people build with this. Being able to shape the agent’s behavior and interface together opens up a lot. The composition and failure behavior are where I’d start reading.
Sponsored
ChatGPT Codex
OpenAI's agentic coding tool that runs in ChatGPT, your IDE, and the terminal to handle complex engineering tasks like bug fixes, refactors, and PR reviews.
View tool
Comments
No comments yet
Be the first to share your thoughts