context-mode sandboxes AI coding agent tool output, cutting context size by ~98%

lxfater · x · 2026-10-04

The problem

AI coding agents get dumber in long conversations largely because raw tool output from test runs and log lookups floods the context window, forcing frequent compression that loses earlier requirements.

How context-mode works

The open-source project keeps raw output in a sandbox, lets the agent filter and aggregate it, and only brings relevant results back into the conversation. In the project's example, 315 KB of raw output shrinks to 5.4 KB entering the context — a 98% reduction in tool output size (not total token or cost savings).

It also persists file changes, tasks, and user decisions for retrieval after context compression, helping long tasks continue smoothly. Routing across 17 platforms is enforced via MCP + hooks. The repo has 25.3k stars and is worth a look for anyone running long agent tasks.

Original post →

More from coding & agent

coding & agent channel →