Here is the uncomfortable truth about AI agents: most of the tokens they burn are waste. Tool outputs spew thousands of lines of logs. RAG pipelines dump entire documents into context. Every file read, every shell command, every API response adds tokens that the model has to chew through before it can do its actual job.
Three projects trending this week on GitHub are tackling this problem from different angles, and together they sketch a picture of where agent infrastructure is headed: fewer tokens, smarter memory, longer attention spans.
Headroom: compress before you send
Headroom picked up 2,617 stars today, and the pitch is blunt: compress tool outputs, logs, files, and RAG chunks before they reach the LLM. The claim is 60 to 95% fewer tokens with the same answers.
It works as a library, a proxy, or an MCP server, which means you can drop it into existing agent setups without rewriting anything. Pipe your tool output through headroom, get a compressed version, send that to the model instead.
Why does this matter? Because tokens are not just a cost issue. They are a latency issue and a context window issue. If you are running a local model with an 8K or 32K context window, every wasted token on verbose diff output or log spam is a token you cannot use for actual reasoning. And if you are paying per token at an API provider, compression directly translates to money saved.
The proxy approach is clever. You do not have to change your agent code. The proxy sits between your agent and the model, compresses what it can, and passes the rest through untouched. For teams already running agents in production, that is the difference between "we should optimize this" and "we optimized this in ten minutes."
Codebase-memory-mcp: index once, query forever
Codebase-memory-mcp approaches the same problem from a different angle. Instead of compressing output on the fly, it indexes your entire codebase into a persistent knowledge graph. Average repo indexed in milliseconds. Sub-millisecond queries. 99% fewer tokens. 158 languages supported. Single static binary, zero dependencies.
The key insight: most of what an agent "reads" when exploring a codebase is redundant. It reads the same files over and over. It reads imports that lead nowhere. It reads test fixtures and generated code that are irrelevant to the task. A knowledge graph lets the agent ask precise questions, "which function handles auth token refresh?" instead of "read every file in src/ and figure it out."
MCP (the Model Context Protocol) is becoming the connective tissue for these tools. An MCP server exposes a standard interface that any compatible agent can query. Codebase-memory-mcp is one. Headroom is another. Cognee, the open-source AI memory platform that also trended this week, provides a knowledge graph engine for persistent agent memory across sessions, and it speaks MCP too.
This is the pattern. The agent does not need to see everything. It needs to see the right thing, and MCP servers are becoming the librarians that hand it the right page.
Deer-flow: thinking long, running long
If headroom and codebase-memory-mcp are about spending fewer tokens per thought, ByteDance's deer-flow is about having more thoughts. It is a long-horizon agent framework that can handle tasks taking minutes to hours. Sandboxes, memory, tools, skills, subagents, and a message gateway.
72,414 stars. That is not a typo. ByteDance open-sourced this and the developer community jumped on it.
What makes deer-flow interesting in this context is the subagent architecture. A single task gets decomposed into smaller tasks, each handled by a scoped agent with its own context. The parent agent does not have to carry the full context of every subtask. That is compression by design. Instead of one giant context window, you get many small ones.
The practical upshot: an agent can work on something for an hour without running out of context. Each subagent does its piece, reports back a summary, and the parent agent moves on. It is how human teams work. You do not put every engineer in the same room and have them listen to every conversation. You let people specialize, sync on results, and keep going.
Where this is going
These three projects form a triangle. Headroom compresses at the input boundary. Codebase-memory-mcp compresses at the knowledge boundary. Deer-flow compresses at the task boundary. Together, they point toward agents that are cheap to run, fast to respond, and capable of sustained work over long periods.
The bottleneck has never been model intelligence. The bottleneck is context management. Models are plenty smart. They just get dumb when you bury them in noise. The wave of tooling we are seeing now, token compressors, knowledge graph servers, hierarchical agent architectures, all address the same root cause: get the right information into the model's attention window, and only the right information.
For anyone running local models on budget hardware, this trend is especially relevant. An 8K context window is plenty if you are not wasting half of it on log lines and debug spew. Compression and smart retrieval may matter more than raw model size for practical agent work.
I started benchmarking llama.cpp performance across model sizes and quantization levels because I wanted to know where the real constraints are for local inference. The answer keeps coming back the same: it is not compute. It is context. The model can think fast. It just cannot think well when you hand it a garbage dump of tokens and say "find the important part."
That problem is getting solved, right now, by open source projects that anyone can run. That is worth paying attention to.
- Headroom on GitHub (2,617 stars today)
- Codebase-memory-mcp on GitHub (1,029 stars today)
- Deer-flow on GitHub (72,414 stars total)
- Cognee on GitHub (AI memory platform, also trending)