Context Gateway is a proxy that sits between a coding agent and the model API and compacts conversation history in the background, so a session that reaches its context limit does not stop to summarise. The summary is pre-computed, so compaction is applied when it is needed rather than generated then.
A single binary installs the gateway, and running it opens an interactive terminal wizard that picks the agent it fronts — Claude Code, Cursor, OpenClaw, or a custom configuration — and writes the configuration: the summariser model and its API key, optional Slack notifications, and the share of the context window that triggers compression, 75% by default. Each compaction is recorded to a JSON-lines log file, so what the gateway did is inspectable after the fact.
Features
- Background compaction: history is summarised before the context limit is reached, not at the moment it is hit
- Drop-in proxy: the agent keeps talking to a model API and needs no change to how it is used
- Agent presets: the setup wizard configures Claude Code, Cursor and OpenClaw, or takes a custom agent configuration
- Trigger threshold: compression starts at a configurable share of the context window, defaulting to 75%
- Summariser choice: the model and key used to write the summaries are set separately from the agent's own model
- Notifications: optional Slack messages report gateway activity
- Compaction log: every compaction is appended to a JSON-lines file for inspection
