anomalyco / anomalyco/opencode
fix(opencode): DCP compress cosmetic on ≥1.18.15 — model-visible context never shrinks
@nexxeln is already working on this.
Since Aug 21, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
DCP compress (@tarquinen/opencode-dcp@3.1.15) is cosmetic on opencode ≥1.18.15 — the compress tool executes, blocks are recorded in plugin state, success text is returned, but the model-visible context never shrinks. This causes an infinite nudge loop: DCP nudges every turn because getCurrentTokenUsage > maxContextLimit, the model calls compress, context stays the same, repeat.
Regression
db581e47a ("fix(opencode): order legacy message loop by time (#40990)"), merged into v1.18.15, changed latest() in message-v2.ts from pure monotonic MessageID comparison to isAfter() = time.created first, ID as tie-breaker. This breaks DCP's block-range alignment with what opencode treats as the latest turn — blocks get recorded but the filterCompressedRanges removal step no longer reduces what the model sees.
Verified
Same byte-identical DCP 3.1.15 plugin on two machines:
| Machine | opencode | DCP compress | Model-visible context |
|---|---|---|---|
| local | 1.18.13 | Works | Drops 130K→80K, block hierarchy forms |
| minipc | 1.18.18 | Cosmetic | Stays ~135K despite 21 blocks covering ~100% of messages |
Native compaction (compaction: {auto: true}) is inert on both (session_context_epoch rows = 0). The context drop on 1.18.13 is confirmed to be DCP's messages.transform removal, not core compaction.
Steps to reproduce
- Install opencode ≥1.18.15
- Install
@tarquinen/opencode-dcp@3.1.15withcompress.mode: "range" - Start a long session that triggers DCP nudges
- Observe: compress tool returns success, blocks recorded in DCP state, but
tokens.inputon subsequent turns never drops below pre-compress levels
Related issues
- DCP #572 — compression doesn't shrink (OPEN, no fix)
- DCP #573 — compress feedback loop burns tokens (OPEN, no fix)
- opencode #31731 — hooks not firing in v1.17.1 (CLOSED by bot, no fix)
Workaround
Pin opencode to ≤1.18.14: opencode upgrade 1.18.13 -m curl
Environment
- Plugins: @tarquinen/opencode-dcp@3.1.15
- OpenCode version: 1.18.18 (broken), 1.18.13 (works)
- OS: Linux (Debian, x86-64)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.