Repository navigation
Judge a lookup in the page's source a fork's, and replay forks with their prompt last - #6477
Merged
Merged
Conversation
…heir prompt last
The claude-code journey's `fork-follow-up` failed whenever the line fork judged
`fork-lookup`'s question ("How many cards does this page's source hold? Count them
in the file.") `hand_over`: in 4 of the 10 journey runs on 18 November whose verdict
is known. The line-fork eval's `source-edited` case meanwhile passed 6/6. Two causes:
- The take criterion asked for work that "needs nothing the main session is
changing or about to change (its files and branch, the page's source, its pull
requests)". A Leaf session may always change its page's source again, so a line
fork that deliberated read any read of it as the session's, in its own words:
"The answer comes from the page's source, which the main session edits and may
change again". The criterion now separates changing from reading: take is work
that changes nothing the session works on, settles no question it is weighing,
and waits on nothing it has under way, such as a command it is running or a
change it has started and not finished; reading the session's files and the
page's source is such work. How it works says the same.
- The eval's replay couldn't show the miss. `claude -p --resume` reads its
environment afresh and puts every record the transcript lacks (working
directory, deferred tools, agent and skill listings, session context; some 3k
tokens) after the prompt. A live fork's request, captured from a journey, ends
with the prompt and otherwise matched the replay's message for message.
`fork_eval.fork` now resumes once against an address no API listens on, which
writes those records without a request, and carries them after the transcript's
first prompt, so the fork's request ends with its prompt and a line giving
today's date. A replay whose first resume writes none fails rather than
scoring the old order. The date stays out of the seed: a fork read a
session-start date of 18 November as the day of a case's 3 November
conversation (`turn-end-check/ask-step-done` 1/4 with it seeded, 4/4 without).
Skills are off, since a resume's skill listing differs offline and online.
`source-edited` now has the session add a card in a new column, as the journey's
session does, rather than a tile while "the cards and columns are unchanged".
`source-editing`, its `hand_over` control, now stops before the session's first
edit, the earlier point the old wording's "about to change" covered, with a Read of
the page's source running. A case's `{page}` and `{session}` are now replaced
throughout it, so that running call names the case's page.
Measured on the real conversations of three journey sessions at the lookup,
replayed with the prompt last, at the journey's effort (medium), 20 runs each:
| session | `hand_over`, old wording | new wording |
| ---------------------------------- | -----------------------: | ----------: |
| 15:12, fork steps after `release` | 12/20 | 0/20 |
| 18:27, the same order, sandboxed | 14/20 | 0/20 |
| 18:08, after the delivery steps | 3/20 | 0/20 |
The first at xhigh: 6/20 with the old wording. Replayed the old way, with the
environment after the prompt, the same sessions gave 1/60 at medium and 0/30 at
xhigh, and 12 live forks of a fourth session at the lookup all took it.
Eval, Opus 5.5 at xhigh, fixed harness: `source-edited` 4/10 `hand_over` on base,
0/10 on head (and 4/20 against 0/20 in two earlier rounds while the date was still
seeded); `source-editing` 5/5 `hand_over` on both. The other line-fork cases:
head 14/14, every `hand_over` case still handing over; base 13/14. Turn-end and
summary cases on head: 22/24, both failures the judge's "question on its own line"
(`ask-choice` failed it 2/4 under the old harness too).
`leaf-dev journey run claude-code` with the change passed all 17 steps twice.
> _This was written by Claude Code on behalf of max-sixty_
leaf-agent
previously approved these changes
Nov 19, 2026
…context and request The line fork's prompt now opens by saying what Leaf asks of the fork: the working line it posts at once, and who should do the work, a fork beside the main session or the main session itself. The order after that is the rule against tools and deliberation, the running call and the thread's JSON, then the line, the take criterion and the JSON answer. The prompt used to say "The main session takes the message from here and does what it asks", which was written before a fork could take work (#5961). It stood just above the question of whether a fork should take it. It is gone, and the line now stays "until the agent's answer replaces it", whoever answers. Max asked for the reorder after reading the prompt as a fork receives it: "at no point is it completely obvious ... that the goal is to give an ephemeral line and to decide whether a fork or the main thread should own the subsequent work". Scored with `leaf-dev eval run 'line-fork*' --harness claude-code --repeat 5 --base HEAD`: base 43/45, head 44/45 ($4.52). Every `work` judgment was right on both arms. All three misses were `line-right` on why-ci, where the line gave away the cause ("with the -n 8 vs serial runs"): two on base, one on head.
leaf-agent
previously approved these changes
Nov 19, 2026
Two line-fork cases: a message that changes how the session will do the work it said it does next (steer-plan), and one that changes a command the session is running (steer-running). Both belong with the session. The take rule doesn't name steering; the fork hands both over anyway, 10 of 10 runs across the two cases ($1.20), with the line judged right each time. They guard that behaviour against a later rewrite of the rule.
leaf-agent
approved these changes
Nov 19, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 19, 2026
…#6502) The turn-end check's fork often posts an ask with its question inside a paragraph of status and advice, copying the shape of the agent's chat reply. On real pages, 9 of the 29 asks it posted on 17–18 Nov kept the question in a paragraph with other sentences. The guidance it reads already says to give a question a line of its own (`threads.md`), so this states it beside the field the fork writes: `turn-end-check.md`'s `text` now says the question stands in a paragraph of its own. `threads.md` says "paragraph" in place of "line" too, since a Markdown line joins its paragraph. On `ask-choice` and `ask-permission`, the two cases the judge failed on this, base passed 15/24 runs and head 16/16. The seven other cases on asks, four of which should post none, passed 21/21 on base and 20/21 on head. The `threads.md` wording alone didn't help: 13/20 against 16/20 on base, across the five cases that post an ask. **To weigh:** this puts a second statement of the rule in the turn-end check's reference, beside the field it governs. The fork already reads the `threads.md` paragraph among its guidance excerpts (`clerk.GUIDANCE`), and that alone didn't change what it wrote. The runs used the fork eval's replay from #6477, now on `main`. From open item #22 on the fork-messages page. Max asked to merge the pull requests we're confident in. Tests: `test_clerk.py`, both `test_product_page.py` files. > _This was written by Claude Code on behalf of max-sixty_
max-sixty
added a commit
that referenced
this pull request
Nov 20, 2026
…#6570) The fork eval's module header said the replay keeps the tool definitions a live fork resends. It sends `claude -p`'s headless prefix instead: the Agent SDK identity line, a 4,300-character system prompt and 12 tools, where an interactive session's request carries the Claude Code CLI identity, 15,800 characters and 21 tools (captured `/v1/messages` bodies). The header now says so, and records why the replay resumes a transcript rather than asking the fork in one composed message: that route passes all 35 cases' deterministic checks for a quarter less, but on `source-edited` under the line fork prompt before #6477 it handed the source read over 0 times of 12, against the replay's 7 of 22 across this run and #6477's. Docstring only; no behavior changes. Max asked whether the fork evals could score a request we compose; the full comparison, with the terms on running the Agent SDK on a subscription login, is on a Leaf page in that thread. Fork replay smoke tests pass. > _This was written by Claude Code on behalf of max-sixty_
max-sixty
added a commit
that referenced
this pull request
Nov 20, 2026
The fork eval's replay now sends the request a live fork sends, apart from one date line: Claude Code's interactive identity line, system prompt and tools, then the case's turns and the fork's prompt. Before, `claude -p` sent its headless prefix (the Agent SDK identity line, a 4,300-character system prompt, 11 tools). Claude Code records a conversation's prefix as a `prompt_snapshot` and resends it verbatim on resume, so the replay copies the last snapshot of the newest interactive session on the machine into the case's transcript and pins it for the run, so every arm resends the same one. On `source-edited` under the line fork prompt before #6477, the one judgment where the replay and live forks disagreed, the live prefix hands the page-source read to the session 11 times of 24 against live forks' 29 of 60; the headless replay did 11 of 46 (p = 0.015 against live forks). Where today's date sits doesn't change it, and at the session's start it made two turn-end cases read their own dates as stale, so it stays after the prompt. To weigh: all 35 fork cases with judges pass 34 of 35 against 35 of 35 before. The miss is ask-question's judge on the form of the ask's text, which the live prefix failed 6 of 8 times against 2 of 7 (p = 0.13). The prefix comes from the user's own newest session, so a background job's prompt and a foreground session's differ between runs; each sample records which session it used. A case costs about 10% more. Max picked sending the live fork's request on his login; Claude Code sends it, so no other client reads the login's token. Codex reviewed it. Tests: the fork replay smoke tests. > _This was written by Claude Code on behalf of max-sixty_
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The claude-code journey's
fork-follow-upfailed whenever the line fork judgedfork-lookup's count of cards in the page's sourcehand_over(4 of 10 known runs), while the eval'ssource-editedcase passed. Two causes:hand_overfell from 12/20, 14/20 and 3/20 to 0/20 each.claude -p --resumeputs ~3k tokens of resume-time environment after the fork's prompt, where a live fork's captured request ends with the prompt (those sessions replayed that way: 1/60).fork_eval.forknow has an offline first resume write that environment and moves it to the transcript's start.The line fork's prompt now also opens with its two jobs, the working line and who does the work, followed by its constraints, the thread and the request. It drops "The main session takes the message from here and does what it asks", which predates forks taking work. On the nine line-fork cases, run five times each, that reorder scored 44/45 against 43/45 before it; every miss was the why-ci line hinting at the cause.
To weigh: the harness change reaches every fork eval. Turn-end and summary cases score 22/24 under it, both misses the judge's "question on its own line", which
ask-choicealso failed 2/4 before.source-editednow adds a card as the journey does (base 4/10hand_over, head 0/10);source-editingstops before the first edit (5/5hand_overon both arms). Two new cases,steer-planandsteer-running, score a message that steers the session's work: the rule doesn't name steering, and the fork hands both over, 10/10.Max asked for this fix and the reorder; Codex reviewed the fix. Tests: fork replay smoke tests,
test_forks.py,test_product_page.py; the journey passed all 17 steps twice.