| ▲ | Show HN: Context Gateway – Compress agent context before it hits the LLM(github.com) | ||||||||||||||||||||||
| 25 points by ivzak 2 hours ago | 14 comments | |||||||||||||||||||||||
We built an open-source proxy that sits between coding agents (Claude Code, OpenClaw, etc.) and the LLM, compressing tool outputs before they enter the context window. Demo: https://www.youtube.com/watch?v=-vFZ6MPrwjw#t=9s. Motivation: Agents are terrible at managing context. A single file read or grep can dump thousands of tokens into the window, most of it noise. This isn't just expensive — it actively degrades quality. Long-context benchmarks consistently show steep accuracy drops as context grows (OpenAI's GPT-5.4 eval goes from 97.2% at 32k to 36.6% at 1M https://openai.com/index/introducing-gpt-5-4/). Our solution uses small language models (SLMs): we look at model internals and train classifiers to detect which parts of the context carry the most signal. When a tool returns output, we compress it conditioned on the intent of the tool call—so if the agent called grep looking for error handling patterns, the SLM keeps the relevant matches and strips the rest. If the model later needs something we removed, it calls expand() to fetch the original output. We also do background compaction at 85% window capacity and lazy-load tool descriptions so the model only sees tools relevant to the current step. The proxy also gives you spending caps, a dashboard for tracking running and past sessions, and Slack pings when an agent is sitting there waiting on you. Repo is here: https://github.com/Compresr-ai/Context-Gateway. You can try it with:
Happy to go deep on any of it: the compression model, how the lazy tool loading works, or anything else about the gateway. Try it out and let us know how you like it! | |||||||||||||||||||||||
| ▲ | tontinton 8 minutes ago | parent | next [-] | ||||||||||||||||||||||
Is it similar to rtk? Where the output of tool calls is compressed? Or does it actively compress your history once in a while? If it's the latter, then users will pay for the entire history of tokens since the change uncached: https://platform.claude.com/docs/en/build-with-claude/prompt... How is this better? | |||||||||||||||||||||||
| ▲ | kuboble 14 minutes ago | parent | prev | next [-] | ||||||||||||||||||||||
I wonder what is the business model. It seems like the tool to solve the problem that won't last longer than couple of months and is something that e.g. claude code can and probably will tackle themselves soon. | |||||||||||||||||||||||
| ▲ | root_axis 20 minutes ago | parent | prev | next [-] | ||||||||||||||||||||||
Funny enough, Anthropic just went GA with 1m context claude that has supposedly solved the lost-in-the-middle problem. | |||||||||||||||||||||||
| ▲ | jameschaearley an hour ago | parent | prev | next [-] | ||||||||||||||||||||||
| |||||||||||||||||||||||
| |||||||||||||||||||||||
| ▲ | thesiti92 2 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
do you guys have any stats on how much faster this is than claude or codex's compression? claudes is super super slow, but codex feels like an acceptable amount of time? looks cool tho, ill have to try it out and see if it messes with outputs or not. | |||||||||||||||||||||||
| ▲ | esafak an hour ago | parent | prev | next [-] | ||||||||||||||||||||||
I can already prevent context pollution with subagents. How is this better? | |||||||||||||||||||||||
| ▲ | uaghazade an hour ago | parent | prev | next [-] | ||||||||||||||||||||||
ok, its great | |||||||||||||||||||||||
| ▲ | verdverm 2 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
I don't want some other tooling messing with my context. It's too important to leave to something that needs to optimize across many users, there by not being the best for my specifics. The framework I use (ADK) already handles this, very low hanging fruit that should be a part of any framework, not something external. In ADK, this is a boolean you can turn on per tool or subagent, you can even decide turn by turn or based on any context you see fit by supplying a function. YC over indexed on AI startups too early, not realizing how trivial these startup "products" are, more of a line item in the feature list of a mature agent framework. I've also seen dozens of this same project submitted by the claws the led to our new rule addition this week. If your project can be vibe coded by dozens of people in mere hours... | |||||||||||||||||||||||
| ▲ | eegG0D 35 minutes ago | parent | prev [-] | ||||||||||||||||||||||
This is a massive win for anyone serious about "Signal over Noise." I’ve been using Claude Code on the Max plan for months, and while it’s the best tool for actually getting work done, the "all-you-can-eat" token arbitrage is a trap. Agents are notoriously sloppy with context; a single misaligned grep can dump thousands of tokens of pure noise into your window, leading to what I call "contextual brain rot" where the model’s accuracy just falls off a cliff. By sitting in the middle and ruthlessly prioritizing signal, you’re providing the exact kind of "ruthless prioritization" that separates a hobbyist from a profitable AI solopreneur. The fact that you’re using Small Language Models (SLMs) to detect signal matches my philosophy of using AI as a sparring partner to check its own work. Most developers spend 30% of their day context switching or debugging "hallucinations" that only happen because the model got lost in its own bloated history. The expand() feature is the "trust but verify" layer that every production-ready AI system needs. You’re effectively treating the LLM like a senior architect who doesn't need to see every line of a dependency file unless they specifically ask for it, which is the only way we scale these systems to 10M+ users solo. Finally, those spending caps and Slack pings are the ultimate "millionaire cheat codes" for leverage. I tell founders all the time that running a business is boring drudgery—it's about fixing bugs and managing resources—and this proxy handles the resource management part on autopilot. If this saves an indie hacker $500/month in token waste while keeping their agent from rage-quitting due to context limits, you’ve built a high-leverage asset. I’m definitely adding this to my links database; it removes a huge excuse for why people "can't afford" to build complex apps. | |||||||||||||||||||||||
| |||||||||||||||||||||||