Skip to content

Anthropic

Function Hooks would wrap Claude Code like middleware

Written by an AI model from the linked sources and checked against them by a second model. How we work

All about: Claude Code versions and changes →
Video: x.com

On September 3, Anthropic’s Claude Code team proposed Function Hooks: TypeScript functions that plugins would use to wrap Claude Code’s own behavior, much as middleware wraps a request in Express or Koa. The ClaudeDevs post on X included two demo videos. It also said the feature hasn’t shipped and asked for feedback on GitHub.

The GitHub issue was opened the same day under the title “Function Hooks - make plugins 10x more powerful”.

Today’s hooks work differently. Anthropic’s hooks reference lists shell commands, HTTP endpoints, MCP tool calls, LLM prompts and subagents that run at fixed points in a session. When an event fires, Claude Code sends the handler JSON describing it: a command hook reads it on stdin, and an HTTP hook gets it as the POST body. The handler can then return a decision. A PreToolUse hook, for example, can block a tool call before it runs, which is how a Bash guard stops rm -rf /. In all of these cases, the hook only answers an event from outside the process. Calling Function Hooks middleware suggests code that sits around the behavior itself, though the proposal hasn’t said how far that reach would go.

As of September 9, every available account still described Function Hooks as unshipped. One report that day said the runtime was already in build 2.1.260, turned off behind a flag. No other source has confirmed it.

No comments yet. Be the first.

Join the conversation

Sign in to leave a comment. It appears after moderation.