Anthropic Wants Claude Code to Run TypeScript Middleware Like Express
Anthropic is proposing TypeScript Function Hooks for Claude Code, letting plugins deeply customize behavior with Express-style middleware and admin-controlled side effects.

- Anthropic proposes Function Hooks, TypeScript middleware for deeply customizing Claude Code.
- Hooks compose Express-style, with registration order controlling wrapping and short-circuiting.
- A parameterized $ object tracks side effects and lets admins revoke capabilities from downstream plugins.
- Plugins can modify React component props, wrap render output, and intercept UI events across TUI and desktop.
- Case studies show secret redaction in tool output and hover-to-reveal masking for screen sharing.
- Not shipped yet, Anthropic is soliciting feedback before committing to build it.
Anthropic is floating a proposal that could turn Claude Code plugins from simple event listeners into full middleware layers. The team opened a public GitHub issue asking whether it should ship Function Hooks: a system that lets you rewrite nearly any part of the CLI and desktop app using TypeScript functions.
Instead of YAML or shell scripts that fire on preset events, you write a typed function that intercepts a call, decides what to do, and optionally passes control to the next hook in the chain. The proposal borrows explicitly from Express and Koa, where handlers compose in registration order and each one can short-circuit the pipeline.
Middleware for your coding agent
Every hook receives a $ capability object. Anything a plugin wants to do — reading files, hitting the network, drawing UI — goes through $, making side effects explicit and auditable. The issue author frames this formally as an effect-parameterized endomorphic continuation model, which means hooks take state in, can shrink the set of allowed effects, and return state of the same shape so they compose without surprises. Full design details are in the core architecture doc attached to the issue.
The demos in the issue walk through what this unlocks:
- Hooks defined as TypeScript functions with full type definitions and LSP support, so autocomplete works end to end.
- Conditional refusal: a hook can simply reject a call to restrict behavior.
- Component-level interception to modify React props or wrap returned render nodes.
- Admin hooks that strip methods from
$before downstream plugins see them, giving workplaces a real permission model. - A wildcard hook on
*that sees every event, including every plugin's own calls on$, making an audit log a single function.
Why the $ object does the heavy lifting
Because every capability flows through $, an admin hook registered first can delete methods before any downstream plugin runs. Plugins nest like middleware: the first registered wraps the rest, admins prepend for control and append for defaults. That gives a clean answer to the perennial plugin question of what happens when two extensions want to touch the same thing.
What it enables in practice
Two case study videos hint at the practical payoff. In one, Claude writes, validates, and loads a plugin — from a single-sentence prompt — that strips secrets from tool output before the model reads them. In another, a plugin hides sensitive values in Claude Code Desktop until you hover, so you can share your screen without exposing data.
A single hook on ui.press also sees the same button pressed in the terminal and in the desktop app, removing the need for separate integrations across the TUI and Electron surfaces.
Nothing has shipped yet
The announcement from ClaudeDevs is explicit that Function Hooks have not shipped, and the team wants community feedback on the GitHub issue before committing. The author goes further, saying the response likely determines whether the feature lands at all. There is no pricing story and no timeline for general availability, since Function Hooks would ship as part of Claude Code itself.
The current hooks system handles pre- and post-tool-call events well but breaks down when you want to conditionally rewrite a tool call, gate an action on org policy, or modify a component. Function Hooks are the team's answer to all three. If you are writing Claude Code plugins today, the issue thread is where the decision is being made.