CTXFW
High-assurance Context Firewall & MCP server for coding agents. Reduces token consumption by 72% via deterministic in-memory AST pruning, enforces axiomatic architectural integrity, and guarantees zero telemetry egress for local code execution.
### What is CTXFW? CTXFW (Context Firewall) is an in-memory, deterministic context firewall and Model Context Protocol (MCP) server designed to sit between autonomous coding agents (Cursor, Windsurf, Claude Code, Cline) and enterprise codebases. It eliminates token exhaustion, context drift, and non-deterministic agent hallucinations by replacing loosely coupled peripheral code with clean AST interface signatures and stubs. ### Key Capabilities - **Topological AST Pruning:** Compiles distance-based dependency subgraphs using native Tree-Sitter grammars. Retains target files ($D_0$) at 100% implementation while eliding transitive dependencies ($D_1 \to D_3$) down to type signatures and public APIs. - **72.4% Token Reduction:** Empirically validated across massive monorepos (Zulip, Apache Airflow, PostHog) with zero loss of semantic intent. - **Axiomatic Integrity Sieve:** Deterministically validates architecture briefs against negative invariants, bounded domains, state machines, and formal error taxonomies before permitting LLM execution. - **Zero Telemetry Egress:** Operates 100% locally on your machine. Zero network requests, zero telemetry, zero risk of codebase leakage. - **High-Concurrency SQLite WAL Engine:** Sub-millisecond warm hits and tamper-evident local logging. ### Quickstart (Installation) ```bash pip install ctxfw Running as an MCP Server (Cursor / Claude Desktop / Windsurf) Add the following to your MCP client configuration (claude_desktop_config.json or Cursor settings): JSON { "mcpServers": { "ctxfw": { "command": "ctxfw", "args": ["mcp"] } } } Verified with Grade A compliance in the official Model Context Protocol ecosystem.