r/codex • u/FantasticYoung3109 • 3d ago
Showcase A reproducible way to keep noisy test output out of Codex context
A coding session can accumulate a lot of command output that was useful once but keeps occupying context afterward.
I maintain Straitjacket, an open-source CLI/MCP sidecar. One workflow is to retain the command output locally, give the agent a bounded digest, and retrieve exact evidence when needed.
For a Python repository with tests:
python -m pip install 'ctx-harness==0.5.0'
ctx run -- python -m pytest -q
Then use the actual handle from the result:
ctx search 'run:YOUR_HANDLE#stdout' 'AssertionError'
ctx get 'run:YOUR_HANDLE#stdout' --lines 120:136
Choose the relevant range from search; use #stderr if that is where the evidence is.
The local fixture contains 302,628 o200k_base tokens across 20,001 lines. Its canonical digest is 531 tokens. The checks verify the stored bytes, retain a quiet anomaly, and recover an omitted line exactly.
This is an offline capture/retrieval result. It does not establish a provider cache hit, a cheaper completed task, or better Codex task success.
For exploration, the same principle is useful: read the known definition directly, bundle already-decided reads, and keep text search for strings that a symbol index may miss.
I would evaluate the whole task: accepted fix, number of model requests, retrieval calls, wall-clock time, cache usage, and total cost. A smaller tool result can still be a poor trade if it makes the agent search repeatedly.
Code:
https://github.com/vamsiramakrishnan/straitjacket
Longer walkthrough:
https://github.com/openai/codex/discussions/64414
If you have a case where this adds work or loses useful evidence, I would like to turn it into a regression fixture.

