Is pi a drop in replacement for OpenCode / Claude Code? I cannot be bothered installing 50 million plugins.
How Compaction Works in Pi
41–50 of 100 posts
Re: How Compaction Works in Pi
#42Opencodes dynamic context pruning works by labeling tools and chat and the rest and the agent can collapse and expand summaries. I get it into 1M+ routinely on local models with operations between 50k-85k
That dynamic pruning sounds bad for prompt caching though.
The pruning does evict cache but not from the start, and only up till the last time you pruned it, as it's just adding messages on top.
but yes, it takes some additional tests and docs to keep it from just becoming hollowed out on tasks; I'd say about 10-20% of the time is just horribly loses what it's doing.
Re: How Compaction Works in Pi
#43I don't like any of current solutions when it comes to compaction. I'd love to have a way to say what exactly should be summarized, because most of the time I just need to compact some noisy MCP tool calls, test runs and things like that. Just let me pick what should be summarized and keep the rest as is.
Re: How Compaction Works in Pi
#44Instead of compaction, has anyone seen a successful implementation of pruning? That is, the agent looks at the conversation history and removes any low-value messages. For example, sometimes context will be taken up by a side tangent, tool call outputs, or low-value codebase exploration. Much of the time, I prefer to preserve the history of my conversation instead of summarizing it. I find summarized conversations le…
https://pchalasani.github.io/claude-code-tools/tools/aichat/...
Re: How Compaction Works in Pi
#45Re: How Compaction Works in Pi
#46Instead of compaction, has anyone seen a successful implementation of pruning? That is, the agent looks at the conversation history and removes any low-value messages. For example, sometimes context will be taken up by a side tangent, tool call outputs, or low-value codebase exploration. Much of the time, I prefer to preserve the history of my conversation instead of summarizing it. I find summarized conversations le…
Sounds cool and it does make sensible decisions optically but I haven’t been able to prove that it is meaningfully better than normal compaction. Building harnesses that do interesting things is a lot easier than building more effective harnesses, I guess.
Re: How Compaction Works in Pi
#47OMP changed the default compaction to images ! Kinda nuts to read about. Saves the generation cost of the traditional compaction step and writes the context as tiny text to an image, if I was following correctly.
Re: How Compaction Works in Pi
#48Earlier quoted context omitted.
It is not. Their approach is minimalism. If you need something pi doesn’t have, the recommendation is to ask pi about it and have it build an extension for you, or look for a plugin. That said, try it. You may find you didn’t need everything in those ecosystems.
I also find the SDK really valuable. Being able embed a truly minimal agent wherever you can run node/typescript is very powerful. Any model, any provider, full control over what it’s doing. Not a shill.. I just really like pi.
Re: How Compaction Works in Pi
#49Instead of compaction, has anyone seen a successful implementation of pruning? That is, the agent looks at the conversation history and removes any low-value messages. For example, sometimes context will be taken up by a side tangent, tool call outputs, or low-value codebase exploration. Much of the time, I prefer to preserve the history of my conversation instead of summarizing it. I find summarized conversations le…
There are other pruning or compaction strategies you can configure too.
You can also use "/btw" to have side tangent conversations with the current context but with the benefit that it will not bloat your current context after the tangent is done.
I wish other harnesses were prioritising this sort of flexibility with context management, but they're likely more incentivised on optimising their cache rates
Re: How Compaction Works in Pi
#50Here's what I do for each of my sessions:
1. For asides, off-topic work, or repetitive work that has already been done in the session, branch backwards (with /tree) and summarize.
2. If I've exceeded 30% or the 'price-doubling' multi-tier pricing, prune (my custom extension).
3. If I've already pruned and I'm still close to 30%, 'prune all' (more extensive prune).
Definition:
'/prune': Removes ~50% context on a fresh session (not previously pruned)
- Keeps: User messages, normal assistant prose, commands/status markers, extension receipts, model settings, and a plain-text receipt for each tool call.
- Removes: Thinking, signatures, actual tool calls/results, tool output, images, compaction summaries, and other extensions’ state.
'/prune-extended': Removes ~80% context on a fresh session - Keeps: User messages, normal assistant prose and conclusions, commands/status markers, extension receipts, and model settings.
- Removes: Thinking, signatures, all tool calls/results and output, images, compaction summaries, other extensions’ state, and any tool-activity receipts created by /prune.
Both create a new session and delete the old one after a successful switch.Using these I can keep a session going for weeks (or longer), even with extensive use and almost all the important context is preserved while dumping the less important context. Neither command requires an LLM summarization so they execute quickly.