A large tool result a compaction left behind is sent from then on as one line naming the read_output call that returns it, not again in full on every call¶
Decision 771 · accepted · 2026-10-04 · issue #389
Superseded in part
In part by 1024.
A compaction summarises the older part of the conversation and keeps the last few messages
as they were, so a 60 kB grep the model read just before it went out again with every
call after it, until a later compaction summarised it away.
- What is behind. The messages a compaction kept, up to the model's last reply
among them: State.compacted_through, set by the compaction and folded from its
compacted event. A result after that reply is the one a compaction in the middle
of a turn was about to send; the model has not read it, so it goes whole until the
next compaction. Results since the compaction are never touched.
- Which results. Those over the blob inline limit, 16 KiB: the log already keeps
them as blobs, so the stub's id names one without a new write (Output.keep/2
makes sure). Below that a stub saves less than the read_output round trip it may
cost, which sends the whole prompt again, and a floor of its own would be one more
number to guess before slice 1 measures.
- An error result by the same rule. The block keeps its error flag, so the model
still knows the call failed. Most failures are a short message, under the floor; a
large one is a failing command's output, the same bulk as any other.
- The stub. [output of grep (48213 bytes) left out since a compaction. Call
read_output(id: "sha256:…", offset: 1, limit: 200) to see it again.], the call a
truncation marker names (650). The tool is named by the call just before the
result, not by id across the conversation: a gateway that numbers its calls gives
every response a call_0.
- Only in what is sent. build_request stubs; the conversation in memory, the
snapshot and the log keep the result whole, so a replay rebuilds the same
conversation and the same boundary, and an audit sees everything. The summariser
still reads what it summarises whole: it condenses those results rather than
sending them again.
- Only where read_output is offered. A profile without it (explore, answer,
ask, librarian) keeps its results whole: a stub it cannot expand is a result
lost.
- A summary that fails leaves the conversation, and the boundary with it, as
they were (774).
- The prefix stays put. What is behind changes only when a compaction rewrites the
head of the conversation anyway, so from one call to the next the prompt starts the
same, which a prompt cache (slice 2) needs.
Governs: apps/troupe_core/lib/troupe/agent/server.ex, apps/troupe_core/lib/troupe/agent/state.ex, apps/troupe_core/lib/troupe/tools/output.ex, apps/troupe_core/lib/troupe/tools/read_output.ex