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.
More from coding & agent
- Pi coding agent draft PR adds Google AI Ultra sign-in for terminal Gemini quota — rickasaurus · 2026-11-28
- Verity Lang debuts: a Lean-based smart contract language for formally verifying Ethereum — DavideCrapis · 2026-11-28
- A prompt to make Antigravity audit 40 days of Claude Opus damage to your codebase — op7418 · 2026-11-28
- Chinese AI observer: users are mass-switching to Google Neon, even to review Claude's code — op7418 · 2026-11-28
- Six Systematic DSA Resources Beyond Random LeetCode Sheet Lists — cneuralnetwork · 2026-11-28
- Student Builds FastAPI + pgvector Civic Complaint Platform with LLM Classifier, Asks If It's Good Enough — arfa71 · 2026-11-28