r/opencodeCLI • u/polypancake • Oct 11 '26
Why is compaction still a default in opencode? Also why did they remove todowrite?
For the first item, I am just curious since compaction is lossy. I ended up adapting a custom plugin where an agent autonomously checkpoints at a major milestone completion, writes to a memory and also updates a todo list which survives context clearing, then clears the context, then loads the external memory file directly instead of wasting time and tokens compacting the entire conversation. I don't have any extensive testing, but this seems to work just as well if not better than regular compaction and I don't have to waste time having my local LLM (or external cloud LLM) load the entire conversation and summarize. Anthropic and others also seem to recommend against using compaction. So why is opencode providing users an inferior context management experience? Why is this not an option that can be changed in opencode? Are there some drawbacks I am not aware of? To me it seems to give all the benefits of compaction without wasting time and tokens. Other annoying thing is that the opencode team seems to have removed todowrite in v2 for some arbitrary reason saying it was useless. To be honest I still found it useful to know what the agent is actually doing and is a good system to keep track of work for both myself and the agent. I am debating to just move to Pi since any issues or PRs just die and are never addressed by the opencode developers, and the migration from V1 to V2 was incredibly painful. I had to rewrite all of my plugins :/.
13
u/lincolnthalles Oct 11 '26
Compaction and agent memory are far from solved, and there are many, many attempts out there.
Results are subjective and mixed, and OpenCode has stuck to the simplest approach with the fewest implications.
I rarely get compactions, as I start new threads relentlessly. New issue, new thread. This shouldn't be a problem for well-structured projects, and that's still the best way to avoid compactions.
From what I read, your plug-in is likely needlessly busting the cache, and that can be a real issue with expensive models.
I do miss todoread and todowrite, though. It gave a nice user feedback and helped the agent to stay on track on longer tasks.
2
u/Fresh_Sock8660 Oct 11 '26
That's basically more of my normal flow. Break it down into slices and just clear context in between. Compaction can still be useful if context is running high. I don't mind compaction with cheap models like ds4.1f though and from what I've noticed, at 150k it runs fairly quickly.
3
u/Ariquitaun Oct 11 '26
Bravo, you invented compaction with extra steps.
1
u/polypancake Oct 11 '26
I already got it back. I wrote a PR for this guy's plugin that fixed a pretty serious cache busting issue and now in my hands it works fine. He merged it now. https://github.com/aiev/opencode-todolist it's just sad that opencode just arbitrarily decided to remove this useful feature.
2
u/xmnstr Oct 12 '26
https://github.com/ranxianglei/billion-context
Thank me later.
1
u/plmtr Oct 12 '26
Have you explored the docs recently? Seems completely customisable: https://opencode.ai/v2/docs/config#compaction
0
u/CourageousCreature Oct 11 '26
Not sure about the compaction, but if you get todotasks back you'll be a legend.
0
u/[deleted] Oct 11 '26
[removed] — view removed comment