Skip to content

About

OpenCode context culling tool

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

opencode-cullto

Trim an OpenCode session to a token budget and restart with condensed context.

Usage

Standalone script

./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 restart

OpenCode tool

The cullto tool can be called directly from within OpenCode:

cullto 4k

Installation

  1. Copy cullto to your project or somewhere on your PATH
  2. Make it executable: chmod +x cullto
  3. (Optional) Copy .opencode/tools/cullto.ts to your project's .opencode/tools/ directory for tool integration

How it works

  1. Reads the OpenCode session from SQLite database (~/.local/share/opencode/opencode.db)
  2. Trims the transcript to keep only the newest messages fitting within the token budget
  3. Writes a condensed transcript to .opencode/cull/session_<sid>.txt
  4. Restarts OpenCode with --prompt pointing to the cull file

Requirements

  • Python 3.8+
  • OpenCode CLI

License

MIT

About

OpenCode context culling tool

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages