Expand description
Content-addressed recovery (CCR) for the proxy’s lossy rewrites (#482).
When the proxy prunes an old tool_result from conversation history, the
lossy stub used to say “re-read the file” — which is stale-unsafe by
construction: in an agent session files are edited or deleted between turns,
so a re-read returns the current bytes (or fails), not the historical
version the conversation actually showed. The model could then silently
reason about the wrong content.
CCR fixes this by persisting the verbatim original to the shared,
content-addressed tee store ({state}/tee/, reused from the shell path) and
embedding a retrieval handle — the absolute path of that file — in the
stub. Retrieval is MCP-independent: the agent reads the path with its native
file read; no lean-ctx tool has to be attached.
§Cache-safety (#448)
The handle is the file path, and the path is a pure function of the content
hash (crate::core::hasher::hash_short). For a fixed pruned message the
handle is therefore byte-identical on every later turn, so the provider
prompt-cache prefix is never invalidated. The on-disk write is best-effort
and never affects the returned handle — only retrievability degrades if the
write (or the 24h TTL cleanup) loses the file, so a stub can never become
non-deterministic based on filesystem state.