neuralmind.uk / NeuralMind vs. Headroom — context compression layer or persistent codebase memory? Edit this page on GitHub ↗

NeuralMind vs. Headroom

TL;DR — Both tools cut tokens; they cut them at different points in the pipeline. Headroom compresses everything that flows between your agent and the model (60–95%, their measurement). NeuralMind stops most of those tokens from being fetched in the first place — semantic retrieval answers code questions in ~800 tokens instead of 50,000+ (12-50× on the retrieval side in real-repo field reports) — and remembers your codebase across sessions. NeuralMind does not compress tool output: its PostToolUse hooks used to, and measured, that added tokens, so they now inject nothing. Headroom is the compression layer, NeuralMind is retrieval and memory, and they compose. If you only want compression, use Headroom. Assessed June 2026; both projects move fast, so re-check their READMEs.

What Headroom is

Headroom (Apache 2.0) is a context-optimization layer that compresses content before it reaches the LLM: tool outputs, logs, RAG chunks, whole files, conversation history, and images. It claims 60–95% fewer tokens with the same answers, validated by its own eval suite. It deploys three ways — a Python/TypeScript library (compress(messages)), a drop-in HTTP proxy for any OpenAI-compatible client, and an MCP server — and integrates with Claude Code, Codex, Cursor, Aider, Copilot CLI, LiteLLM, LangChain, and the Vercel AI SDK.

Under the hood it stacks several compressors: an AST-aware code compressor (Python, JS, Go, Rust, Java, C++), a structural JSON compressor, a trained HuggingFace model for prose, and an ML router for images. Two features are genuinely distinctive: CacheAligner stabilizes prompt prefixes so Anthropic/OpenAI prompt caches actually hit, and CCR makes compression reversible — originals are stored locally with a TTL and the model can call a retrieve tool when it needs the uncompressed version.

How NeuralMind differs

The two products answer different questions:

NeuralMind’s core is a semantic index of your codebase (a code graph with 4-layer progressive disclosure) plus a Hebbian synapse layer that learns which files go together from how you actually work. A code question is answered in ~800 tokens of retrieved context instead of the agent reading whole files; next session the agent boots already knowing the shape of your code. NeuralMind does not compress tool output, so the two don’t overlap. Its Claude Code PostToolUse hooks used to hand the model compressed copies of Read/Bash/Grep output, but Claude Code adds a hook’s output next to the tool result rather than replacing it, so measured, that added tokens. The hooks now inject nothing; compressing what reaches the model is Headroom’s job.

Dimension Headroom NeuralMind
Core mechanism Compress assembled context in flight Retrieve less context from a semantic index; remember it across sessions
Compression surface Tool outputs, logs, RAG chunks, files, conversation history, images — any provider None (its PostToolUse hooks on Read/Bash/Grep used to compress; measured, that added tokens — benchmark)
Conversation-history compression Yes No
KV-cache alignment Yes (CacheAligner) No
Reversible compression Yes, generalized (CCR + retrieve tool) No — nothing is compressed to reverse
Semantic codebase index No Yes — code graph, communities, 4-layer disclosure
Persistent memory Failure post-mortems written to CLAUDE.md (headroom learn) Learned co-activation graph with decay, branch-isolated namespaces, team memory bundles, next-file prediction
Learning style Mines failed sessions into instructions Continuous Hebbian learning from queries, prompts, and edits
Deployment Library, HTTP proxy, MCP server MCP server, Claude Code hooks, CLI
AST code compression Python, JS, Go, Rust, Java, C++ None applied to tool output; neuralmind skeleton gives a graph-backed outline of a file on request
Claim validation Own eval suite (GSM8K parity, TruthfulQA) CI gates on every commit: reduction floor, retrieval quality (MRR/recall), synapse A/B
License Apache 2.0 MIT

When to pick which

Pick Headroom if:

Pick NeuralMind if:

Use both if you’re on Claude Code and optimizing hard: they compose. Headroom’s proxy compresses what still flows to the model (history, large outputs, cache alignment); NeuralMind’s MCP retrieval keeps most file reads from happening at all and carries the learned memory between sessions. Nothing in either tool conflicts with the other.

The honest caveats

See also