TL;DR
- History reads included every tool result in full. In a large conversation the latest 500 items were 19MB.
- The relay allows 8MB per response. The client halved the item count after each failure and tried again.
- List reads now send the result as
null, and opening a row fetches that one item whole. The same conversation is estimated at 0.79MB or less.
Opening a long conversation on the phone showed nothing for a while. Short conversations opened at once.
The phone reads history from the user’s machine through a relay
I run a daemon on the user’s own machine, and agents run there. Every conversation is recorded item by item in the daemon’s journal: user messages, agent replies, tool calls and their results.
The phone does not connect to the daemon directly. The daemon keeps an outbound connection to a relay, and the phone’s HTTP requests reach the daemon through it.
The daemon’s relay connection writes the handler’s output into a bounded buffer. Past 8MB it returns 502 response_too_large.
Failing at 500 items, then retrying at 250 and 125
When a conversation opens, the phone reads the latest 500 items. On a 502 it halves the count and repeats the read.
for (;;) {
try {
window = await fetchJournalWindow(transport, sessionId, limit);
break;
} catch (error) {
if (!responseTooLarge(error) || limit === 1) throw error;
limit = Math.max(1, Math.floor(limit / 2));
}
}
This retry exists to get a page with large items through by making it smaller. But the slow conversation’s latest 500 items were 19.3MB. Almost all of it was tool results and arguments: whole files that were read, test logs.
Each failure means the daemon builds 8MB of response and throws it away, and the phone wastes a round trip. Once the count is small enough, the phone still reads all 500 items in small pages and receives 19MB in total.
Yet the screen shows only the tool name and a summary of its arguments. A result is displayed only when the user taps a row to open it.
A higher limit, compression, or truncation
I compared a few options.
Raise the relay limit. Fewer failures. But the phone still receives 19MB and still parses and holds it. The daemon also buffers a larger response in memory.
Compress. Less on the wire. But the phone still decompresses, parses and holds 19MB. It is still data the screen doesn’t show.
Truncate each item. The daemon already had preview=true, which truncates each item to 64KB, and the desktop app read with it. Results still arrived at up to 64KB each, and the desktop app threw them away after receiving them. Receiving them at all is the waste.
Leave results out of the list. Letting the caller choose which fields an API returns is familiar from the fields parameter in Google APIs and sparse fieldsets in JSON:API. Here there is no need to pick arbitrary fields. Only tool results need to go. So it is a single option: tool_results=omit.
Results as null in the list, one item fetched on open
With tool_results=omit, the daemon sets a tool call’s result to null. The live stream accepts the same option. Other large fields such as arguments are still truncated to 64KB by preview=true. The phone now sends both.
func OmitToolResult(e Envelope) Envelope {
if e.Frame.Kind != "event" || e.Frame.Item["kind"] != "tool_call" {
return e
}
result, ok := e.Frame.Item["result"]
if !ok || result == nil || result == "" {
return e
}
item := maps.Clone(e.Frame.Item)
item["result"] = nil
if _, text := result.(string); text {
item["result_omitted"] = true // can be read by opening the row
}
e.Frame.Item = item
return e
}
It changes a copy, not the original map.
Text results get an “omitted” mark. When a row has that mark, opening it fetches the result. Results the row never draws, such as structured results returned by MCP, are dropped without a mark.
When a row is opened, the phone reads just that item without the option. With since=seq-1&limit=1, the response is that whole item.
The latest 500 items of the 19.3MB conversation are estimated at 0.79MB or less.
Sending the same option to old daemons, with no extra request
The phone app and the daemon update separately. A new app can talk to an old daemon.
The daemon has an API that lists the features it supports. But asking it every time a conversation opens adds a round trip before anything shows.
The daemon ignores query parameters it doesn’t know. So the phone always sends tool_results=omit. An old daemon returns results truncated to 64KB each, and the phone removes them after receiving. Transfer doesn’t shrink, but the screen looks the same as with a new daemon.
The desktop app already fetches the feature list. It adds the option only when the list includes journal_result_omit_v1.