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.
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.
# 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.tsOr 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_...| 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 |
- Stop
SessionSummary.computeDiffwrite-path - Stop append-only full-info
message.updated.1rows inevent
Those need an engine PR (see UPSTREAM.md).
npm run smokeMIT