Long-horizon agentic tasks are pushing LLM agents past their context window, so the scaffold has to compact the context, which is usually a lossy process. This repository contains the code for our paper Benchmarks Are Surprisingly Compaction-Friendly: a copy of OpenCode with extra compaction controls.
This is research code, not an official OpenCode release, and it is not affiliated with the OpenCode team.
| Path | Contents |
|---|---|
packages/opencode/ |
OpenCode, with the compaction changes (see docs/COMPACTION.md) |
agents/ |
Launchers used by the benchmark runners; they translate env vars into opencode.json |
tools/compact/ |
MCP server for the compact tool strategy (the model writes its own summary, then the session is restarted) |
scripts/prepare_local_opencode.sh |
Builds the standalone binary |
docs/diff-vs-upstream.patch |
Exact diff against upstream |
docs/OPENCODE.md |
Auth setup and troubleshooting for the agent launchers |
Everything else is upstream OpenCode, except that upstream's .github/ directory (CI workflows, templates, maintainer lists) was removed. Upstream's original README is kept in README.upstream.md, and its CONTRIBUTING.md and SECURITY.md are in docs/upstream/.
bash scripts/prepare_local_opencode.sh
export OPENCODE_BIN=$PWD/.opencode-local/bin/opencodeAlways use this binary. An opencode on your $PATH is the upstream release and silently ignores the new compaction.* keys.
Example opencode.json:
{
"compaction": {
"auto": true,
"reserved": 100000,
"prune": true,
"clearThinking": true,
"keepThinkingTurns": 1
}
}- Jeanne Salle - jeanne.salle@tue.ellis.eu
@misc{salle2026benchmarks,
title = {Benchmarks Are Surprisingly Compaction-Friendly},
author = {Salle, Jeanne and Bhatnagar, Hardik and Bethge, Matthias and Abdelnabi, Sahar and Andriushchenko, Maksym},
year = {2026},
eprint = {2610.31778},
archivePrefix = {arXiv},
primaryClass = {cs.LG},
doi = {10.48550/arXiv.2610.31778}
}