[FEATURE] Let a tool result declare itself single-turn, so it leaves the transcript after the model reads it

Status Open
Maintainer reply None cached
Activity 0 comments · opened Aug 4, 2026

A lot of what a tool returns is only useful to the turn that asked for it. A full test run, a file listing I grepped once, a linter dump the model reads and fixes. It gets read once and then it sits in the transcript for the rest of the session, re-sent and re-attended on every request after that.

What I want is a way for the producer to say "this is for this turn only" at the moment it writes the output, rather than something deciding later that it's safe to throw away.

Concretely: a tool result or a hook injection carries a flag, the model sees it on the request that follows, and the next turn's transcript doesn't have it. What's left behind is a one-line placeholder saying the tool ran and its output was single-turn, so the model knows it happened and can run it again if it needs to.

The reason to decide at write time is cache cost. Dropping something from the middle of the prompt invalidates everything below the cut, so eviction has to earn its keep with arithmetic. A result dropped at the very next turn boundary was never carried past the tail, so the only thing that reprocesses is the result itself, and nothing else had been cached after it yet. That is about as cheap as a removal gets, and it needs no cost model or eviction policy to decide.

https://github.com/anthropics/claude-code/issues/69627 asks for the general eviction version of this, cache-aware and opt-in per item. I think the write-time flag is worth having alongside it and is a lot smaller, because the producer already knows whether its output has a life beyond this turn and nothing else does.

Where I hit it: I'm building an app with an AI narrator that runs through a tool-use loop, and I ended up building this inside my own loop. The corrective text a failed tool call hands the model was being re-read on every call for the rest of the session, so the model kept acting on instructions about moments that were already over. Routing it to a per-request overlay that reaches one request and is stored nowhere fixed that and cut real tokens. I'd rather not build the same thing twice, once in my app and once around Claude Code.

View original on GitHub ↗