Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

opencode-session-diff-spill

OpenCode plugin that bounds and spills oversized message.summary.diffs so long agent sessions do not blow up RSS / SQLite / Jetsam.

This is a local mitigation. The durable fix belongs in OpenCode core (packages/opencode session summary + event encode). See docs/UPSTREAM.md.

Problem

OpenCode re-embeds full-file patches into user message.summary.diffs on every step-finish, then appends full message.updated.1 snapshots to an event log. One session reached ~136MB/message and ~6.2GB of events → ~87GiB opencode RSS → macOS Jetsam.

Related upstream: anomalyco/opencode#32005.

Install (global OpenCode)

# clone
git clone https://github.com/KirillDeviatka/opencode-session-diff-spill.git
# link into global plugins (auto-loaded from ~/.config/opencode/plugins/)
ln -sf "$(pwd)/src/session-diff-spill.ts" ~/.config/opencode/plugins/session-diff-spill.ts

Or copy the file. Restart opencode / the desktop shell that hosts it.

Optional offline DB repair (quit OpenCode first):

node scripts/sanitize-session-diffs.mjs --dry-run --prune-events
node scripts/sanitize-session-diffs.mjs --apply --prune-events --session ses_...

What the plugin does

Hook Behavior
experimental.chat.messages.transform Deny vendor/.node-runtime/build paths; cap per-file (64KB) and total (512KB) patch bodies before LLM
event Detect fat message.updated; spill JSON under ~/.local/share/opencode/session-diff-spill/
experimental.chat.system.transform Short reminder + new-chat alert when spill volume is huge

What it cannot do

  • Stop SessionSummary.computeDiff write-path
  • Stop append-only full-info message.updated.1 rows in event

Those need an engine PR (see UPSTREAM.md).

Smoke

npm run smoke

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages