---
title: "Anthropic Wants Claude Code to Run TypeScript Middleware Like Express"
subtitle: "Anthropic is proposing TypeScript Function Hooks for Claude Code, letting plugins deeply customize behavior with Express-style middleware and admin-controlled side effects."
url: "https://alphasignal.ai/news/anthropic-wants-claude-code-to-run-typescript-middleware-like-express"
author: "AlphaSignal Newsroom"
author_url: "https://alphasignal.ai/editorial-team"
company: "ClaudeDevs"
company_url: "https://alphasignal.ai/company/claudedevs"
published: "2026-09-03T18:01:25.000Z"
updated: "2026-09-03T18:15:26.867Z"
type: "News"
topics:
  - "Development"
  - "Api"
subtopics:
  - "Code Generation"
upvotes: 3414
read_time: "3 min"
source_url: "https://github.com/anthropics/claude-code/issues/91870"
comments: 0
---

# 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 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](https://github.com/anthropics/claude-code/issues/91870) 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](https://github.com/user-attachments/files/31802150/EXTERNAL.Function.Hooks.Core.Architecture.pdf) 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](https://x.com/ClaudeDevs/status/2095572891941351550) 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.

## Sources

- [X post by @claudedevs](https://x.com/claudedevs/status/2095572891941351550)
- [Function Hooks - make plugins 10x more powerful](https://github.com/anthropics/claude-code/issues/91870)
- [ClaudeDevs announcement](https://x.com/ClaudeDevs/status/2095572891941351550)
- [Function Hooks Core Architecture (PDF)](https://github.com/user-attachments/files/31802150/EXTERNAL.Function.Hooks.Core.Architecture.pdf)
