Straitjacket compresses 302K-token tool output to a 531-token digest with exact line retrieval

FantasticYoung3109 · reddit · 2026-11-28

The maintainer of Straitjacket, an Apache-2.0 CLI/MCP sidecar for coding agents, details its context-management design for tool outputs that execute correctly but return far more text than the agent needs.

The contract has four steps: capture the original output locally, return a bounded digest with retrieval addresses, let the agent search the stored output, and retrieve exact line ranges when more evidence is needed. A summary alone can lose a quiet error buried in a large result — retaining the artifact gives the agent a way to verify.

Measured on a local fixture: 20,001 lines / 302,628 o200kbase tokens compressed to a 531-token canonical digest, with the quiet anomaly preserved and an omitted line retrieved exactly — no model calls involved. Captures are local plaintext with a 64 MiB per-stream default cap.

Try it via pip install 'ctx-harness==0.5.0' then ctx run / ctx search / ctx get --lines. The author asks MCP implementers what must remain in the initial result so the agent knows what to fetch next.

Original post →

More from coding & agent

coding & agent channel →