/prune — zero-LLM-cost context pruning for agentic sessions #3127
Replies: 2 comments 3 replies
-
|
Appreciate the share, this looks fantastic. I will be merging #3083 this coming week which will include context editing and compaction for all http adapters. |
Beta Was this translation helpful? Give feedback.
-
|
Great lever — the transcript-accumulation side (duplicate reads, superseded writes, dead error payloads) is real, and Worth pairing with the fixed half So they're complementary: prune the transcript (yours) + trim the schemas (one-time). Data/method if useful: https://mnifzied-create.github.io/agentloop/token-tax/ |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Long tool-heavy chats accumulate a lot of redundant payload: the same file read three times, a failed command that was fixed two turns ago, reads that were immediately superseded by a write to the same path.
/compacthandles this well, but it costs an LLM call and rewrites everything. Sometimes you just want to surgically cut the junk.I wrote a small slash command called
cc_dcp(Dynamic Context Pruning) that runs entirely on the Lua side — no LLM call, no HTTP round-trip.Three strategies:
iwe_treecalled 4× with the same args)A
PROTECT_TURNSguard keeps the most recent N cycles untouched so you never prune something still in play.Works with both adapter formats — Claude (
call.name/call.input) and OpenAI/DeepSeek (call["function"].name/call["function"].argumentsas JSON string).In practice on a 35k-token Godot session: 10k tokens removed in one run, instant.
Repo + install instructions: https://github.com/jamesonBradfield/codecompanion-dcp
Beta Was this translation helpful? Give feedback.
All reactions