Trim an OpenCode session to a token budget and restart with condensed context.
./cullto # interactive picker, default 20k budget
./cullto 8k # custom budget
./cullto --all # show sessions from all projects
./cullto --no-restart # just write cull file, don't restartThe cullto tool can be called directly from within OpenCode:
cullto 4k
- Copy
culltoto your project or somewhere on your PATH - Make it executable:
chmod +x cullto - (Optional) Copy
.opencode/tools/cullto.tsto your project's.opencode/tools/directory for tool integration
- Reads the OpenCode session from SQLite database (
~/.local/share/opencode/opencode.db) - Trims the transcript to keep only the newest messages fitting within the token budget
- Writes a condensed transcript to
.opencode/cull/session_<sid>.txt - Restarts OpenCode with
--promptpointing to the cull file
- Python 3.8+
- OpenCode CLI
MIT