Hacker News new | ask | show | jobs
by planckscnst 91 days ago
I love OpenCode! I wrote a plugin that adds two tools: prune and retrieve. Prune lets the LLM select messages to remove from the conversation and replace with a summary and key terms. The retrieve tool lets it get those original messages back in case they're needed. I've been livestreaming the development and using it on side projects to make sure it's actually effective... And it turns out it really is! It feels like working with an infinite context window.

https://www.youtube.com/live/z0JYVTAqeQM?si=oLvyLlZiFLTxL7p0

6 comments

Hey I built that into my harness! http://github.com/computerex/z

Long tool outputs/command outputs everything in my harness is spilled over to the filesystem. Context messages are truncated and split to filesystem with a breadcrumb for retrieving the full message.

Works really well.

That doesn't sound all that useful to be honest and would likely increase costs overall due to the hit to prompt caching by removing messages
> would likely increase costs overall

Assuming you pay per token, which seems like a really strange workflow to lock yourself into at this point. Neither paid monthly plans nor local models suffer from that issue.

I tried once to use APIs for agents but seeing a counter of money go up and eventually landing at like $20 for one change, made it really hard to justify. I'd rather pay $200/month before I'd be OK with that sort of experience.

The $20-per-change problem is a workflow problem, not a pricing problem. Batching work into larger well-scoped sessions rather than interactive back-and-forth changes the unit economics significantly. Most people use these tools like a terminal — one command at a time — which is the worst possible cost profile.
It's absolutely a pricing problem. I use claude code in both of those ways and neither is more valid than the other it just depends what you are working on. You should not avoid back and forth with the agent just because you think it might cost more. Also due to prompt caching it doesn't even cost that much compared to large changes like you are talking about.
Yes I use the $200 per month plan for Claude Code and it's amazing

I assume the usage varies based on prompt caching, but I could be wrong. Why would you assume prompt caching would have zero effect on the subscription usage?

The infinite context window framing is the right way to think about it. Running inside Claude Code continuously, the prune step matters more than retrieve in practice — most of what gets dropped stays dropped. More useful is being deliberate about what goes in at the start of each loop iteration rather than managing what comes out at the end.
Have a look how pi.dev implements /tree. Super useful
Seems interesting, but at a glance I can't find a repo or a package manager download for this. Have you made it available anywhere?
I found the opencode fork repo, but no plugin seems available so far

https://github.com/Vibecodelicious/opencode

That borks the cache and costs you more.