Skip to content

Give the line fork the whole thread - #6316

Merged
max-sixty merged 1 commit into
mainfrom
line-fork-whole-thread
Nov 17, 2026
Merged

max-sixty merged 1 commit into
mainfrom
line-fork-whole-thread

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

The line fork's prompt now carries every message of the thread. Before, it got the thread as a delivery to the session does: the opening message and the latest seven, with the middle left to leaf page state, which the fork can't run. The conversation it inherits may also have lost the middle to a compaction.

  • delivery.batch_data(..., whole=True) passes through thread_context.batch_threads and thread_digest to drop the bound on messages and gestures. Only forks._thread_data sets it; the session's deliveries keep the bound.
  • forks.py's header states the decision and its cost.
  • test_a_line_fork_reads_the_whole_of_a_long_thread builds a 13-message thread and checks that the fork's prompt holds a message the session's delivery elides. It fails with whole=False.

Cost. On this machine's pages, 8 of 118 line forks had a thread long enough to elide anything. The longest a fork saw was 25 messages and 9.5k characters (about 2.4k uncached tokens), against each fork's 400–600k tokens read from cache. Each fork's prompt grows with its thread, so a thread's forks together grow with its square; at these sizes that stays at a few thousand tokens per fork.

The line-fork eval's threads are all shorter than the bound, and the prompt's wording changes by one word, so no score was run.

This was written by Claude Code on behalf of max-sixty

The line fork's prompt carried the thread as a delivery to the session does: the
opening message and the latest seven, with the middle left to `leaf page state`.
The fork can't run that command, and the conversation it inherits may have lost
the middle to a compaction, so on a long thread it wrote the agent's working line
without the discussion the newest message continues. Max asked that the fork get
the whole thread.

`delivery.batch_data` takes `whole`, which `thread_context.batch_threads` and
`thread_digest` pass through to drop the bound on messages and gestures; only
`forks._thread_data` sets it. The session's deliveries keep the bound, which
exists so a long thread's digest can't outgrow the output it prints into.

Cost, measured on this machine's 429 pages: of the 118 line forks Leaf asked,
8 had a thread long enough for the bound to elide anything. The longest thread
a line fork saw had 25 messages and 9.5k characters of text, about 2.4k tokens
of uncached input, against each fork's ~400-600k tokens read from cache. Across
all 1,050 threads with more than one message, the 99th percentile is 12
messages and 4.9k characters, the longest 28 messages and 11k characters. Each
fork's prompt grows with its thread, so a thread's forks together grow with its
square, which at these sizes stays a few thousand tokens per fork.

The line-fork eval's threads are all shorter than the bound, so the change
doesn't reach them, and the prompt's wording changes by one word ("The whole
thread, as Leaf delivers it"); no score was run.

Co-Authored-By: Claude Code <[email protected]>
@max-sixty
max-sixty merged commit 0e601dd into main Nov 17, 2026
5 checks passed
@max-sixty
max-sixty deleted the line-fork-whole-thread branch November 17, 2026 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants