Model or dataset
Compresr-ai/Context-Gateway avatar
Compresr-ai/Context-Gateway

Context Gateway: a Go proxy that precomputes agent history compaction

Context Gateway is an agentic proxy that enhances any AI agent workflow with instant history compaction and context optimization tools

642 stars51 forksGoApache-2.0

At a glance

What is it?
Compresr's Context Gateway is an Apache-2.0 Go proxy that sits between an agent such as Claude Code or Cursor and the LLM API, compressing conversation history in the background before the context limit is reached. The design bet is latency, and most of what matters is in how the trigger and the summarizer credentials are configured.
Who is it for?
Adopt Context Gateway if you run an agent that stalls on context limits and you are willing to route traffic through a local proxy and pay a separate summarizer model for background summaries. Do not adopt it if your conversations are short, if your prompts cannot leave your infrastructure for a third-party summarizer, or if you need a stable interface rather than a v0.5.x one.
Can I use it commercially?
Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 45 days ago.
What is it written in?
Mainly Go, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 15, 2026, and from our analysis. They are not legal advice.

DEEP OPEN-SOURCE ANALYSIS

The wait that Context Gateway is built to remove

Every long agent session hits the same wall. The conversation approaches the model's context limit, the agent has to summarize or truncate what came before, and the user sits there while that summary is produced. In a tool like Claude Code or Cursor, that pause lands in the middle of the work, and it happens again on the next long session because the compaction is computed on demand.

Context Gateway targets that specific pause. The README states the proxy sits between the agent and the LLM API and compresses history in the background, so the summary already exists when the limit is reached. The claim to check is not that compaction happens, but that it happens ahead of the trigger rather than at it. The intended audience is narrow: people running an agent against a long-lived conversation, on a machine where a local Go binary can intercept API traffic, and who are comfortable pointing a summarizer at a second model endpoint. If your sessions are short enough that the limit never arrives, the proxy adds a hop and buys nothing.

Architecture: a proxy, a threshold, and a precomputed summary

The mechanism described in the README is a man-in-the-middle proxy with a threshold. Traffic from the agent passes through the gateway on its way to the LLM API. The gateway tracks how full the conversation is, and when it crosses a configured trigger threshold, the default being 75 percent, it compresses history. The compression is done by a summarizer model that the user configures with its own API key. Because the summarizer runs in the background, the summary is ready before the agent needs it, which is where the latency saving comes from.

The README does not document the wire protocol, the request rewriting, or how the gateway decides what counts as history, so those parts cannot be confirmed from the supplied material. What is documented is the observable surface: a configuration file created through the wizard, a summarizer model and key, an optional Slack notification path, and a log at logs/history_compaction.jsonl. That log is the only stated way to see what the gateway is doing, which is thin for a component sitting in the request path of your agent.

Installing the binary and running the wizard

Installation is a single shell command from the vendor's domain:

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

Running context-gateway with no arguments opens an interactive TUI wizard. The wizard asks you to choose an agent from claude_code, cursor, openclaw, or custom, and then walks through configuration: the summarizer model and its API key, optional Slack notifications, and the trigger threshold for compression, which defaults to 75 percent.

Two things stand out. First, the install is a pipe from curl to sh, which means the binary you get is whatever the endpoint serves at that moment, with no checksum or version pin mentioned in the README. Second, the wizard is the documented configuration path; the README does not list the config file name, its location, or the key names inside it. That matters if you want to manage the gateway from a dotfiles repository or a container image rather than by answering prompts. For a proxy that will hold a summarizer API key, the absence of a documented config schema is the weakest part of the setup story.

Where the design gets uncomfortable

The summarizer is a second model with its own API key, and the README does not say where it runs. If the summarizer is a hosted endpoint, then conversation history leaves your machine twice: once to the primary LLM API, and once to whatever model produces the compaction summary. For teams working under data handling constraints, that is a decision to make before install, not after. The README gives no indication that a local summarizer is supported.

The background model also has a failure mode that the README does not address. If the summarizer key is invalid or the summarizer is unreachable, the precomputed summary will not exist, and the proxy is now in the request path of an agent that is about to hit its context limit. Whether it falls back to the agent's own compaction, passes the full history through, or errors out is not stated. The only diagnostic named is logs/history_compaction.jsonl, which tells you what happened after the fact. A component with this much authority over a session should document its degraded path.

The alternative: let the agent compact on demand

The obvious alternative is doing nothing. Claude Code and Cursor already compact history when they approach the context limit, and that path requires no proxy, no second API key, and no extra process. The difference is timing. The agent's built-in compaction runs when the limit is reached, so the user absorbs the wait. Context Gateway moves that work earlier and pays for it with a background summarizer call on every session that crosses the threshold. If your sessions rarely reach 75 percent, the built-in path is strictly cheaper.

A second alternative is running a smaller local model as the summarizer and wiring it in yourself, which keeps history on your hardware. That is more work than the wizard, and the README does not describe whether a custom summarizer endpoint can be pointed at a local server. The trade is control over data leaving the machine against setup effort, and the README does not resolve which side the gateway supports.

Version cadence and what it costs to keep up

The release history shows v0.5.1 on 2026-03-06, v0.5.2 on 2026-03-12, and v0.5.3 on 2026-03-18, three patch releases in under two weeks, with the last push to main on 2026-08-02. A 0.5.x line moving that fast means the configuration surface and the proxy behaviour can change between minor releases, and the README does not describe a config migration path. If you pin the gateway in a container, you will be pinning a version whose config schema is not documented in the repository's README.

The licence is Apache-2.0, which permits commercial use and modification and includes an explicit patent grant, but it also requires that you preserve copyright and licence notices and state significant changes if you redistribute. That is a summary of the licence text, not legal advice; read the LICENSE file in the repository before you ship a modified binary. The larger cost is operational: the gateway sits in the request path, so it is one more process to monitor, and the only monitor the README names is a jsonl file.

Editorial conclusion

Adopt Context Gateway if you run an agent that stalls on context limits and you are willing to route traffic through a local proxy and pay a separate summarizer model for background summaries. Do not adopt it if your conversations are short, if your prompts cannot leave your infrastructure for a third-party summarizer, or if you need a stable interface rather than a v0.5.x one. Verify first that the agent you use appears in the supported list (claude_code, cursor, openclaw, custom), that your summarizer API key is valid before the first long session, and that logs/history_compaction.jsonl is actually being written, since that file is the only observable evidence the README offers that compaction is happening.

Official sources

  1. Compresr-ai/Context-Gateway on GitHub
  2. Issues
  3. License: Apache-2.0
  4. README
  5. Releases
Community notes

Community notes