# CTXFW - Context Firewall

An in-memory, tree-sitter-based context firewall and Model Context Protocol server for coding agents that compacts peripheral code into interface signatures and stubs, reporting a 72 percent reduction in token usage in its own benchmark.

CTXFW is a context firewall and Model Context Protocol server that sits between a coding agent and its codebase, aiming to reduce the token cost and context drift that come from feeding large, only loosely relevant files into a large-language-model context window. It parses source files with native, polyglot tree-sitter grammars in memory and replaces the implementation of code that is one or two steps away from what the agent is working on with clean interface signatures, type definitions and functional stubs, rather than sending the full implementation.

The project also describes an integrity check that rejects an architecture brief it judges as ungrounded or deficient, for example one missing a minimum number of stated negative invariants, bounded variable domains, deterministic state machines or a formal error taxonomy, and states that it runs locally with no network telemetry in its standard operating mode. Its published benchmark reports a 72.4 percent reduction in token consumption compared with sending raw files.

Website: https://glama.ai/mcp/servers/heuristicolab/ctxfw
