I built optim-jev’s jev-compacter to save tokens in Claude Code. Now I mostly use it to keep as much of the important context as possible when compacting. My hunch was that in long sessions a big chunk of the context is tool output: files Claude read, test logs, grep results. I tried a bunch of ways to make it in a way to prompt caches get preserved (Since it was the only reason costs were up). /compact summarizes all of that together with the conversation, so the errors and decisions get shortened too. I’d rather keep the conversation and just drop the old tool output that isn’t useful anymore. So when it compacts, Jev goes through the older tool calls and decides for each one: keep it, cut it to the first few lines, or drop it. It only sees a short note per call (which tool, how big the output was), not the output itself. The conversation and the latest messages aren’t touched. Also I think its sane enough to also add a trigger hook with some threshold constraints like “only execute when the context prune reaches some thresholds (default: 40% of the context)”, with a fallback to legacy /compact on failed condition. I usually run it when the prompt cache has expired, after a break or a model switch. The next message re-reads the whole context anyway, so that’s a good time to prune. repo (MIT): https://github.com/Oqura-ai/optim-jev submitted by /u/Fit-Fail-3369
Originally posted by u/Fit-Fail-3369 on r/ClaudeCode
