#1716 chunked only the history: the messages before historyEnd's split.
A conversation with no reply that calls no tool, as a sub-agent's loop of
tool calls that Claude Code's AgentSummary asks a summary of with its last
results (JinJieBeWater on #1716), has split 0, so it was told in one block
and its one mark stayed on the instructions: every such request wrote the
whole loop again. Such a conversation now has its every message but the
last chunked. A later request with a history is told it wrapped from its
first message, so it never matched past the instructions before either.
What was run:
- TestClaudeToolLoopCachedAcrossNewRuns (new), TestClaudeHistoryCachedAcrossNewRuns,
ClaudePrompt*, ClaudeInstructions*: pass.
- Broken by hand, each seen red: no split-0 chunking; the last message
chunked when it ends a chunk (a 32-message loop); boundaries counted
from the end; the mark left on the instructions too; no chunk mark.
- Real Max account, claude-haiku-5-5, Claude Code 2.1.296 through a
recording proxy, each run started anew with magpie's rendered prompt,
a loop of 20 then 24 tool rounds (42 then 50 messages):
origin/main: second run read 3,790, wrote 70,764
#1716 alone: second run read 3,791, wrote 70,813
with this: second run read 48,661, wrote 25,993
Grown history (21 then 41 messages) and same history with a new ask
are unchanged from #1716 alone (22,348/28,178 and 40,848/9,678).
Every request kept to four marks, all 1h.
- Not tried: a long turn to answer after a history is still one block,
and images count toward Anthropic's 20-block lookback.
Co-authored-by: deephbz <13776377+deephbz@users.noreply.github.com>