Show HN: Context Gateway – Compress agent context before it hits the LLM

Introduction to Context Gateway

As developers, we're no strangers to the power of large language models (LLMs). However, when it comes to coding agents like Claude Code or OpenClaw, managing context can be a significant challenge. A single file read or grep can dump thousands of tokens into the context window, most of which are noise. This not only increases costs but also degrades the quality of the output.

Why this matters

The impact of context size on LLM performance is well-documented. For instance, OpenAI's GPT-5.4 eval shows a steep accuracy drop from 97.2% at 32k tokens to 36.6% at 1M tokens. This highlights the need for an efficient context management solution.

How Context Gateway Works

The Context Gateway is an open-source proxy that sits between coding agents and LLMs, compressing tool outputs before they enter the context window. It uses small language models (SLMs) to detect which parts of the context carry the most signal. When a tool returns output, the SLM compresses it based on the intent of the tool call. For example, if the agent called grep looking for error handling patterns, the SLM keeps the relevant matches and strips the rest.

Here's a simulated example of how this might work in code:

# Tool output
grep -r "error handling" /path/to/code

# Compressed output ( Conditioned on the intent of the tool call)
error handling patterns: 
  - try-except block
  - error logging

If the model later needs something that was removed, it can call expand() to fetch the original output.

Features and Benefits

The Context Gateway offers several features that make it an attractive solution for managing context:

  • Compression: Compress tool outputs based on the intent of the tool call
  • Background Compaction: Compact the context window at 85% capacity to prevent overflow
  • Lazy-Loading: Load tool descriptions only when necessary to reduce noise
  • Spending Caps: Set limits on the amount of context used to prevent excessive costs
  • Dashboard: Track running and past sessions to monitor performance
  • Slack Pings: Receive notifications when an agent is waiting for user input

How to Install

To try out the Context Gateway, you can install it using the following command:

curl -fsSL https://compresr.ai/api/install | sh

The repository is available on GitHub at https://github.com/Compresr-ai/Context-Gateway.

Who is this for?

The Context Gateway is ideal for developers and teams working with coding agents and LLMs. If you're struggling with context management and want to improve the performance of your LLMs, this solution is worth exploring. With its ability to compress tool outputs, set spending caps, and provide a dashboard for tracking sessions, the Context Gateway can help you optimize your workflow and reduce costs.

What are your thoughts on the Context Gateway? Do you have any experience with context management solutions? Share your thoughts and questions in the comments below!

🚀 Global, automated cloud infrastructure

Oracle Cloud is hard to get. I recommend Vultr for instant setup.

Get $100 in free server credit on Vultr →