Stop reading whole files; compress what you read

Crush log noise, park bulky output on disk behind a stub, and read one function body instead of a file.

Prompt#

That build log is enormous — compress it and keep working. And stop reading whole files.

What the Chair does#

Crushes repetitive noise in place, or parks the blob in .orch/context/ and keeps only a stub plus an id in the conversation.

MCP calls#

context_crush({ "text": "<the 4k-line build log>" })

When you may need the original later:

context_externalize({ "text": "<the 4k-line build log>" })

Retrieve it by the id the stub carries, or search across everything parked:

context_retrieve({ "id": "ctx-7f31a2" })
context_search({ "query": "undefined reference", "limit": 20 })

And for source, replace the file read entirely:

code_snippet({ "symbol": "RotateOn429", "max_lines": 120 })

Inspect or change the flags: orch context show, orch context setup.

Expected response#

context_crush returns the crushed text. context_externalize returns a stub plus the id to fetch it with. context_retrieve returns the full blob. context_search returns ranked chunks. code_snippet returns {symbol, start_line, end_line, body, file_bytes} — and records the bytes it saved against the size of the file it stood in for.

Gotchas#

  • The four context_* tools are behind a flag. context.guidance.mcp_tools (on by default) exposes them; turn it off and they are not in the tool list at all. Confirm with orch context show.
  • Crush is lossy on purpose; externalize is not. Crush collapses repeated success/log lines and you cannot get them back. Externalize keeps the original on disk under .orch/context and hands you a stub.
  • Externalized blobs expire. context.ttl_minutes (default 30) is how long context_retrieve is guaranteed to answer. Bulky output you need tomorrow belongs in a file you own, not in the context store.
  • Protected tool results are never crushed. Anything on context.guidance.protect_tools passes through whole — that is the escape hatch for output where a dropped line is a bug.
  • Hooks do this without you asking. hooks.post_tool compresses tool results as they arrive (harness PostToolUse plus the OpenCode plugin) and hooks.pre_compact fires before the harness compacts. orch guard wire installs them; both are opt-in.
  • auto_gateway applies the same compression to /v1/chat/completions through the local gateway, so BYO CLIs get it without calling any tool.
  • The real win is not reading the file. code_snippet / trace_path / impact / architecture answer most "how does X work" questions for a fraction of the tokens; a whole-file read is the last resort.