"nd then it gets taken out of the conversation so that it doesn't get sent to the agent the next turn (no context bloat). "

Uh - dude - this means you're paying 10x in token costs because there's no caching.

If you 're-write token history' then you can't cache tokens.

It means for any reasonably long conversation, the llm has to reprocess the entire history as preflow on every prompt.

Are you sure you're really doing what you say you're dong, and how is it not blowing up your budget?

Nope, you gotta understand. This is the move. It is appended at the end of every single message. It is never saved in the conversation that get sent back for inference. So you send it. But when you go back for inference, it’s at the top of the stack so all of the cashing works you’re not pre-filling every time or anything like that. It burns plus N tokens, where N is my prompt stack. It is not really that expensive. I have measured it to within an inch of it its life. Think of it this way every bit of the prefix and the conversation stays exactly the same you’re only adding to the very end of the conversation. So after the first turn, it is basically always cashing within the KV cache for a given context. Sorry I am using voice dictation. My hands are tired this week. Basically you sculpt the conversation history to ensure prefix caching

Yes - with arbitrary prefix caching that might work. That's tricky though, not everyone is going to provide that.

Did you have to build your own harness for this? Or hack Claude Code or something?

I don’t use their CLIs. OMP/OpenCode. If you are stuck on them, you can do it in a proxy layer.