]> git.giacomolli.uk - onechat/commit
Send the compaction view in block messages
authorAnderson A. Giacomolli <agiacomolli@gmail.com>
Mon, 9 Nov 2026 13:02:40 +0000 (10:02 -0300)
committerAnderson A. Giacomolli <agiacomolli@gmail.com>
Mon, 9 Nov 2026 13:02:40 +0000 (10:02 -0300)
commit0a98ccb67c3df55c0fe6d76b45afcbaa58c2eda1
treed038a07e8f7334658565e163df4a37b3e5cfa1ed
parent49566fe4e40a18434320829c5cb6a6eff1b4ec78
Send the compaction view in block messages

A compaction sends each whole block of four view lines as its own user
message, the first one with the opening tag, and one last user message
with the rest of the lines, the closing tag, and the task. The note of a
retry is one more user message after them. The blocks count from the
first line of the view, so two compactions whose views begin with the
same lines send the same block messages. Joined, the messages are the
same bytes as the one message before.

The backend reads a cache entry only at a message end of a request. With
the view in one message, a compaction read only the shared prompt and
tools, about 1,920 of 10,000 tokens. The first request of a turn sends
its view as messages that only grow and reads 74% to 85% from the cache,
so the compactions get the same kind of split.

Issue: 72c95ad
compactor.go
compactor_test.go