Repository navigation
Show the agent's working line from a fork at once, and read On it from the fork's start - #5552
Merged
Merged
Conversation
…imes The benchmark now carries the fork that decided each input (`fork`: its outcome and seconds) and adds three summary rows: `delivered`, from the opened pickup to the agent's first words over inputs no fork answered, and `fork_reply` / `fork_hand_over`, the first reply's time over inputs a fork answered or handed to the session. On 58 thread messages across 26 pages since 1 November: delivered p50 14.1 s, p90 40.5 s; a fork answered 6 (first words p50 10.6 s) and handed over 33, failures included (first words p50 34.9 s, p90 117 s).
From 1 to 5 November forks answered 6 of 40 thread messages, handed 27 to the session in a median 3.2 s, and failed on 7 with nothing-to-fork after a compaction, an away summary or a restart. Handed-over messages showed nothing from the agent for a median 35 s, the session's first model call thinking before its one-line reply, though each fork's hand-over reason already named the work the session's line later named.
A fork that hands a thread message to the session now answers with the line the agent would say before starting, and Leaf posts it as the agent's progress at the message's response address before the hand-over. The thread reads Working with that line about 3 s after sending, instead of showing nothing from the agent until the session's first model call ends (a median 35 s on real pages since 1 November). The session's own next words replace it, and it still owes the answer: the line's start comes before the pickup, so it lets no turn end over the message. This reverses the user's 2026-10-31 choice against a fork that says the work will follow; `forks.py`'s header records both. A hand-over's `hand_over` is now that line rather than a reason for Leaf, and its diagnostics record the line (`text`, `line`) in place of `why`. Evidence: the fork-reply eval on head passed 12 of 12 runs, every hand-over case with a line its judge accepted, against 0 of 10 lines on the base; the reply case passed 2 of 2 on both arms. The claude-code journey with --forks passed, with the hand-over's line as the comment's first reply 3.0 s after sending, against 25 s to pickup.
…turn notes/fork-replies.md: why `$.model.fork` had nothing to fork, and a design not yet built for a fork that does a self-contained request itself: which recorded hand-overs it could take, what keeps it coherent with the session, and how evals could score it. notes/user-feedback-responsiveness.md: a probe of the module's turn.step stream and $.http.fetch, for streaming the model's own progress into an update's working line.
A fork's line was progress at the message's response address, so it took the message in hand as a start naming the session's turn. Every reader of starts then took it for the session's own: the line renewed an interrupted turn, so a session with no watch was never nudged; it held the message at Working, so a stalled one never counted as overdue; and the Stop hook offered the session a start it never made. A review confirmed each against a failed fork, which posts no line. A receipt's progress (`thread.Receipt`, the writer a fork posts through) now takes nothing in hand. The thread shows the agent's line as its progress message at once, and the message reads Queued for Claude or Delivered, as its delivery stands, until the session starts it. leaf-dev response-times credits a fork's line as the first reply of its thread's newest waiting message, and `delivered` now runs from the pickup to the session's start or answer, the time the label reads Delivered. The claude-code journey with --forks passed: the line was the comment's first reply 2.4 s after sending, against 24.9 s to pickup.
…he wait
The fork's line no longer opens with the session's running command ("once this
command finishes, …"); the prompt asks what the agent will do about the message
and leaves the order of the session's steps to the fork. The line rubric drops its
demand for that wait and fails a line that speaks of a fork, a main session or a
hand-over, which the user never sees: a prompt asking only "what will happen with
the message" drew "Passing this to the main session…" in 7 of 10 lines.
fork-reply/* passes 12/12 on this commit.
A TODO in forks.take marks where a fork could do self-contained work itself.
…he fork's start A Claude Code fork made with `$.model.fork` can't call tools, so it no longer answers held thread messages: it writes the agent's one-line working message, which Leaf posts as before, and hands every message to the session. A failed or blank fork hands over with no line. The user chose this on 2026-11-05, reversing the 2026-10-31 fork that answered from the conversation; answering moves to a fork that can act, marked by a TODO in `forks.take`. The user's message now reads On it from the moment Leaf holds its thread for a fork, and while the fork's line stands, until the session answers. `forks.forked` lists those messages in the presence reading, and `served_state.work` serves them as at work: a workflow's `at_work` is now its session's working or replying stage or a fork's taking its input on. Every surface that shows whether the agent is at work reads that one stamp, so the message's word and face, the thread card's live working line, the On panel's row and the margin agree; the card and the face read it in place of restating the stage set. Every reader that ages, nudges or holds a turn keeps reading the delivery stage, so a fork's line still renews no turn, hides no overdue message and gives the Stop hook no start to offer, the three faults a start from the line caused. The lane going down writes nothing to the page, so the presence reading now names it (`fork_lane`, a live fact): a tab showing On it for a held message re-reads within the presence cache interval and shows Queued for Claude. The fork-reply eval now scores the line on every case, including two the fork used to answer (12/12); the claude-code journey's fork steps check that the line is each comment's first reply and that the session then answers it.
leaf-agent
previously approved these changes
Nov 5, 2026
leaf-agent
approved these changes
Nov 5, 2026
max-sixty
pushed a commit
that referenced
this pull request
Nov 6, 2026
…' fork_reply row (#5599) Since #5552, a fork of a Claude Code session posts only the agent's working line and always hands the thread over (`forks.py` header). No fork answers a message any more, and none queues a line for the session. This PR removes the code and prose that still assumed one could. Users see no change. The one tool whose output changes is `leaf-dev response-times`: its summary loses the `fork_reply` row, which could never fill. - **Dead code.** `clerk.queue` had no caller left. `_append` is now the clerk's only way to queue a line. - **`leaf-dev response-times`.** It left out the reply breakdown, pickup wait and command time of any input "a fork answered", detected by a `reply` field that no fork record has carried since #5552. The summary's `fork_reply` row is gone, and `delivered` now covers every opened input. Root `AGENTS.md`, "Stage", treats records from earlier runtimes as disposable, so nothing is kept for them. - **Prose.** The `hook_transport` header and composer comment, `delivery.deliverable`, `src/leaf/session-lifetime.md`, the `leaf-dev journey` header and the `--forks` help all said a fork may answer or post a reply through the clerk's queue. They now describe the hand-over. `dev/tests/model/test_journey.py::test_a_comment_a_fork_decided_on_keeps_the_forks_record` now builds its first fork record the way `forks.take` writes one: a hand-over with its working line. Its comment keeps the session's reply breakdown. `dev/tests/model/test_journey.py`, `dev/tests/model/test_response_times.py`, `tests/model/test_clerk.py` and `tests/model/test_forks.py` pass locally. There is no regression test, because no behavior a user depends on changed. Co-authored-by: leaf-agent <[email protected]>
leaf-agent
added a commit
that referenced
this pull request
Nov 7, 2026
Comments, docstrings and one note that point at names the code no longer has. Each now names the rule or function it means. Nothing that runs changes. - **Renamed `browser/AGENTS.md` sections.** `floating-panel.js` cited "News never moves what the reader is reading", and `composing/text-field.js` cited "Editing in place" and "Stability". None of these is a heading or rule any more. They now name "News moves what the reader reads only in the thread they are in", "Editing something keeps it where it stood and as it read" and "The page holds still under the user's aim". - **`keyboard/layer-stack.js`, `nativeModes`.** The comment counted hint popovers among the modes, but since #5614 `pushNativeLayer` returns `null` for `popover="hint"`, so no hint popover ever joins the stack. The module header already says so. - **Functions that were removed or never existed:** - `floating-panel.css` cited `rowNotice`, which #5613 deleted. It now cites `rowNoticeTemplate`. - `thread/messages.js` cited `preview.js`'s `fitList`, which has never existed. The fitter is `fit`. - **`packages/diff/widget-shadow.css`.** Two z-index comments gave the full-name path box as their reason, and #5614 removed that box. The values stay. The comments now give the stacking they keep: the line numbers sit at 2, the pinned name at 3 and the file's actions at 4. - **`notes/fork-replies.md`.** It said a `forked-replies` branch builds the design, and that the fork posts "the reply". `forks.py` has been on main since #4892, and since #5552 the fork posts only the working line. The rest of the note, the research and the unbuilt "fork that takes the work", stays. - **Smaller fixes:** - The `plans.py` docstrings now name the `items` parameter. - The `structure.py` allocation comment now points at `AUTHORED_ALLOCATIONS`, which also holds `data-height` and the page-wide allocations. - A runtime test now names `tokens.css`, where the card widths live. - A test comment now names `test_admission.py`, where #3089 moved the named-dependency test. - **`packages/default/styles/sample.css`.** A trailing comment governing no rule repeated the exhibit rule that `options.css` states and applies, so it is deleted. Verification: pre-commit (ruff, prettier, eslint, ty, knip, typos) passes on the changed files, and `tests/runtime/comment-placement.test.mjs` passes. No test is added, since nothing that runs changes. Co-authored-by: leaf-agent <[email protected]>
This was referenced Nov 7, 2026
Closed
leaf-agent
added a commit
that referenced
this pull request
Nov 7, 2026
…#5551, #5552 and #5566 chose (#5685) Ten of #5658's nightly journey cases still expected behavior that a recent change replaced on purpose. This PR updates those tests to what each change intended. One example page also changes: the feature gallery had lost a face that the server would draw. Each case was bisected locally to the first commit where it fails and checked against that commit's parent, which passes. Each fails on main `02a1e05cb` and passes on this branch. | Case | Since | What changed | | --- | --- | --- | | `test_render_widgets.py::test_notification_configuration_becomes_a_commentable_local_artifact` | #5508 | Every playground choice now has its own id. The receipt's comment anchors on the Banner choice that holds it (`format-banner`), not on `notification-simulator`. | | `test_render_gate.py::test_every_table_the_theme_sets_honestly_passes_the_gate` | #5566 | The fixture's available `<figure>` holds a question whose words start at the figure's edge, and #5566's new `words-off-column` advice flags exactly that. The journey checks tables, so it now leaves that question out. The browser test that measures the question's table inside the figure keeps it. | | `test_render_margin.py::test_margin_card_holds_its_top_as_a_turn_arrives_and_as_a_reply_wraps` | #5537 | Beside its passage, a card now holds its reply's foot while the user writes in it. The test now steps onto the thread with Escape before reading, as #5537's own tests do. It checks that each wrap, a long draft and the answer after a send grow the card upward. It is renamed `…holds_its_top_while_read_and_its_reply_while_written`. | | `test_thread_response_continuity.py::…keep_the_first_line[margin-delete-desktop]` | #5537 | Same rule: Backspace in a margin card's reply keeps the reply's foot still, so the margin case reads the foot. The seat cases are unchanged. | | `navigation/test_key_surfaces.py::test_user_news_interrupts_and_then_restores_background_news` | #5448 | The panel's key now stands with Comment after the field's words, so a notice reads `Agent replied — open Threads · Comment… c`. | | `test_page_holds_still.py::…[message-reply-below-chromium]`, `[…-firefox]` | #5551 | A thread's reply box under the floating panel now counts as unseen. A clicked message therefore stays still as an answer joins below it, the strict xfail passed, and its entries leave `MOVES_ON_MAIN`. | | `test_render_navigation.py::test_the_feature_gallery_exercises_its_core_journeys` | #5552 | `progressFace` reads a workflow's `at_work`, which the server stamps on every served workflow. The gallery's margin atlas builds its sample workflows from a stage alone, so its Working samples had lost the working face. The sample now carries `at_work` as the server would stamp it (`examples/developer/feature-gallery.page/widgets/lf-margin-entry-gallery.js`). | The other #5658 cases are handled elsewhere. #5684 (merged) fixed the fixture-resource case. A separate PR widens `--wide` for #5611's diff gutter. The `message-edit-above` cases of `test_page_holds_still.py` come from a runtime regression in #5551, which has its own cause issue. Refs #5658 — automated triage --------- Co-authored-by: leaf-agent <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Nov 8, 2026
…fort has lapsed The header kept the working-line fork at the session's effort because low changed whether the fork answered or handed over. Since #5552 the fork writes only the line and always hands over, so that choice no longer exists. The header now gives the 2026-11-04 measurement as taken on the earlier prompt, and says low is unmeasured on the prompt that asks only for the line. No code changes; the fork still names no effort and thinks at the session's.
max-sixty
added a commit
that referenced
this pull request
Nov 9, 2026
…ne fork at the session's (#5440) Claude Code 2.1.318 lets `$.model.fork` take an `effort`. Leaf's turn-end check (the clerk) now forks at `low`. The fork that writes the agent's working line on a thread message names no effort, so it runs at the session's. ## What changed - `src/leaf/clerk.py`: a new `EFFORT = "low"`. The clerk's question (`leaf hook --fork`) now carries it, and the header records the measurement and the risk below. The header's claim that the cache needs the fork's effort to match the session's is gone, since the measurement refutes it. - `hooks/claude-code.ts`: the clerk calls `$.model.fork({ prompt, effort })` with Leaf's effort. The header no longer says the fork resends the session's effort for the cache's sake, and now gives this run's cost and time. An older Claude Code ignores the field (its check in 2.1.317 reads only `prompt`) and runs the fork at the session's effort, as before. - Diagnostics: a `turn_end_check` note now carries `effort`, the effort Claude Code reports it sent the fork at. The note's `request` is the main thread's request, so its `effort` is the session's, and the headers in `clerk.py` and `hooks/claude-code.ts` now say so. Before this, a reader of `request.effort` would log every low fork at the session's xhigh. - `src/leaf/forks.py`: the header says the working-line fork names no effort and runs at the session's, that low's 2026-11-04 measurement below was taken when the fork still chose whether to answer, and that low is unmeasured on the prompt that asks only for the line. The code is unchanged. - `dev/leaf_dev/fork_eval.py`: the replay runs at the effort the arm's Leaf names, so `leaf-dev eval 'turn-end-check*' --harness claude-code --base` now scores this change. Reply cases, and base arms that name no effort, run at `medium` as before. - `notes/fork-replies.md`: corrects the note's claim that a different effort misses the cache. - Test: the module test now checks that the clerk's fork is asked at `clerk.EFFORT` and that its note gives that effort rather than the session's. Each check fails without its half of the change, the second with `KeyError: 'effort'`, and passes with it. ## Both arms `uv run leaf-dev journey claude-code --forks`, on 2026-11-04 and 05, Opus 5.5 with the session pinned at xhigh: seven runs at the session's effort and seven with both forks at `low`. Six runs per arm added scratch steps after the fork steps. These were turns and thread messages with known right answers, sent in the same order to every arm, and they are not committed (below). Medians, with interquartile ranges: | Fork | Effort | Forks | Output tokens | Fork time | Cache read | Cache written | Uncached input | List price | | --- | --- | --: | --: | --: | --: | --: | --: | --: | | clerk | session (xhigh) | 106 | 266 (15–508) | 3.6 s (1.0–5.8) | 138k | 0 (0–67) | 2.8k | $0.097 | | clerk | low | 102 | 15 (15–215) | 1.1 s (0.9–3.2) | 126k | 0 (0–270) | 2.7k | $0.085 | | reply, answered | session (xhigh) | 34 | 166 (125–411) | 2.4 s (1.8–4.4) | 140k | 0 | 950 | $0.085 | | reply, answered | low | 30 | 136 (88–202) | 2.0 s (1.7–2.9) | 120k | 0 | 950 | $0.072 | | reply, handed over | session (xhigh) | 53 | 62 (49–229) | 1.7 s (1.1–3.0) | 149k | 0 | 956 | $0.083 | | reply, handed over | low | 50 | 50 (42–60) | 1.4 s (1.1–1.7) | 148k | 0 | 958 | $0.080 | Paired on the same planted turn or message in the same run, low against the session's effort, as geometric means with 95% bootstrap intervals: - Clerk: output 0.45× (0.31–0.63), time 0.62× (0.53–0.73), over 32 turns. - Reply: output 0.45× (0.35–0.57), time 0.66× (0.55–0.78), over 52 messages. **Cache.** The issue's risk doesn't occur. A low fork read 98% of the conversation from the cache, and its cache writes were the new tail alone, a median of none, as at the session's effort. Claude Code's debug log confirms the effort it sent (`effort low asked, low sent`). **What the clerk caught.** The planted turns left an ask in the chat, answered it there, made the page stale, or set work running in the background that no page showed. The quiet turns asked arithmetic, put the ask on the page itself, or read code. Over five scored runs, low named 19 of 19 planted items and nothing at any of 13 quiet turns. The session's effort did the same, 19 of 19 and 13 of 13. Beyond them, low once also named an On me item the merged migration fix had made moot, a fair find, and the session's effort once split its stale finding into three. **What the reply fork decided.** These runs predate #5552, when the fork still chose whether to answer a thread message or hand it to the session. It now writes only the agent's working line and always hands over, so the choices below no longer arise. It names no effort and runs at the session's, and low is unmeasured on the prompt that asks only for the line. Both arms decided at the same rate on 10 of the 12 kinds of message. They differed on two: - "explain more about what happens to a fork's answer if the lane goes down?", asked after the session had read `forks.py`, whose header states the answer: low handed it over 3 of 3 times. The session's effort answered it correctly 3 of 3 times, each in 13 to 16 s. - "which card has the narrowest impact?": low answered 1 of 5 times, with a hedged ranking. The shipped prompt hands such judgments over, as the session's effort did 6 of 6 times. Each fork's own replies were faster at low. On "explain more?", low took 3.7 to 4.0 s against 3.8 to 17.7 s at the session's effort. A hand-over waits for the session, though, so the user's median wait from message to answer barely moved: 25.5 s at the session's effort and 24.8 s at low, over 59 and 51 messages. On that prompt, the trade didn't clearly favour low. **Medium.** Two runs also used `medium`. Output was about half the session's, but its forks were the slowest of the three arms in wall time. Hand-overs, for example, took a median 3.8 s for 67 tokens, during the machine's heaviest load (load average up to 250). Medium kept the hand-overs low made on the lane-down question, so it doesn't fix the reply trade. ## Risk: what the clerk catches The planted asks and stale passages are explicit; in real sessions they are subtler and come late in long sessions, which is the case the clerk exists for. So the 18 real clerk forks at xhigh that named items on this machine's pages on 2026-11-04 were replayed at `low`, three times each. Each replay resumed the session's transcript cut at the fork's last row, asked the question rebuilt from the page wound back to that time, and ran with tools refused in a throwaway home. Two checks were also replayed at xhigh as a control. | What the xhigh fork named | Items | Low's replays matched | | --- | --- | --- | | Work under way that no page shows | 7 | 21/21 | | Decisions left in chat | 2 | 6/6 | | Stale passages on the page | 19 | 31/57 (54%) | | Offers of bolder work, asked as questions | 5 | 0/15 | Low's 25 additions over 54 replays held no real ask the original missed. Replays are noisy even at xhigh: the controls matched 7 of 14 of the original's item-tries, and on the longest page (c09) the xhigh and low replays caught the same share of its stale passages. The offers separate cleanly, though: on the same two checks xhigh asked them 5 of 6 times and low 0 of 9. An offer isn't a decision put to the user, so low leaving it out of On me matches how replies treat offers. Low wrote a median 283 output tokens in 5.6 s against 1,140 in 11.5 s. The clerk runs off the turn's path, so this saves no wait the user sees; it buys about $0.02 a fork and a shorter window in which a newly opened turn drops the clerk's asks (`basis`). ## What I ran - `uv run pytest tests/model/test_clerk.py tests/model/test_forks.py tests/process/test_interact_claude_code_module.py -n 4` (67 passed), and `dev/tests/test_evals.py::test_fork_replay_hands_the_answer_through_the_arms_leaf` (1 passed). - A control: the clerk module test fails with `effort` dropped from the module's call and passes with it. - `uv run pre-commit run --files` on every changed file. - The journeys above. The scratch steps, the session-effort switch and the module's environment switch for each fork's effort are not in this diff. One low run stopped at a scratch reply step, when its session started a subagent instead of answering. Its clerk turns before that point are counted. ## Not verified - The fork-reply eval at `low`. The turn-end-check eval ran in review, as above. - A replay of recorded real thread messages at `low` (the set in `notes/fork-replies.md`). That replay would settle the reply fork's effort. - Fork time on an unloaded machine. The load average ran from 18 to 250, so compare tokens and the paired ratios rather than absolute seconds. Calls Max may reverse: the clerk at `low` rather than `medium` or the session's effort; replies left at the session's effort. Closes #5302 > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Nov 9, 2026
Each case's purpose and the file's header still described the fork that chose between answering and handing over, which #5552 removed. They now say what the working line must do in each case. No case's checks change.
max-sixty
added a commit
that referenced
this pull request
Nov 9, 2026
…#5776) The fork that writes the agent's working line on a held thread message now thinks at `low` (`forks.EFFORT`), whatever the session's effort. Leaf holds the thread's messages from the session until that line is posted, so the fork's time sits on the path to the session's answer. #5440 left this fork at the session's effort because low changed its choices between answering and handing over. Since #5552 the fork writes only the line and makes no such choice, and on that prompt low writes lines as good as xhigh's. ## What changed - `src/leaf/forks.py`: `EFFORT = "low"`, which `ask` sends with the prompt, as the clerk's question carries `clerk.EFFORT`. The header records the measurements below in place of the 2026-11-04 one, whose premise #5552 removed. The two forks keep separate constants because each effort was chosen on its own fork's work (the clerk's on asks and stale passages, this one on the line), and either may change without the other. - `hooks/claude-code.ts`: both forks now go through one helper, `runFork`, which makes the fork at the effort Leaf names and hands back its answer or failure, usage, time, the effort Claude Code reports it sent, and the resent request. The clerk's and `forkReply`'s copies of that bookkeeping are gone. One behavior changes: a clerk fork that throws now reaches Leaf as a failure, noted in each page's diagnostics with its reason (as `forkReply`'s already was), and the debug log says `the clerk's fork gave no answer (…)` rather than `the clerk wrote nothing: …`. - Diagnostics: a `fork_reply` note now carries `effort`, the effort the fork was sent at. Its `request.effort` stays the session's. - `tests/process/test_interact_claude_code_module.py`: the working-line test checks that the fork is asked at `forks.EFFORT` and that its note gives that effort rather than the session's. The first check fails with `effort` dropped from the module's call. The failed-clerk-fork test now expects the new debug line and a diagnostics note for each refused fork. The clerk and working-line tests also check that each fork's note carries its usage and time, which `runFork` now hands Leaf for both forks, and which `journey.fork_summary` and `response-times` read; each check fails with its field dropped from `runFork`. - Types: `runFork` declares its effort as Claude Code's `ModelEffort`. `pnpm run check:hooks` doesn't reach `claude-code.ts` (`hooks/tsconfig.json` includes only `pi.ts` and `watch.ts`, since Claude Code's declarations are generated when it loads the plugin and aren't in npm), so I type-checked it against the declarations Claude Code 2.1.319 generated: `main` and this head pass, and the previous head's string effort failed with TS2322. - `dev/leaf_dev/fork_eval.py`: the replay reads the effort the arm's Leaf names for every fork (`asked["effort"]`). The medium it took for a fork that named none is gone, with its header sentence, so a `--base` older than this PR fails on reply cases rather than running that arm at an effort no live fork takes. - `notes/fork-replies.md`: prose that said this fork runs at the session's effort. - `evals/fork-reply/case.yaml`: each case's `purpose`, and the file's header, still described the fork that chose between answering and handing over; they now say what the working line must do in each case. No case's checks change. ## Measurements Opus 5.5 on Claude Code 2.1.319, 2026-11-09. Ratios are low over xhigh, paired on the same message, as geometric means with 95% bootstrap intervals. **Recorded thread messages.** These are the 40 messages of `notes/fork-replies.md` ("How well the fork judges"), from 30 sessions, idle and mid-turn; their transcripts and page copies are still on this machine. Each was replayed from its session's transcript cut where the message arrived, with today's `reply_prompt` built over the thread and running tool call the original replay recorded. Each ran once at low and once at xhigh, in a seeded random order, with `claude -p --resume --effort E --max-turns 1` on the session's model and 1M window, tools refused, in a fresh home. | | low | xhigh | | --- | --: | --: | | Lines passing a blind judge | 35 of 40 | 35 of 40 | | Lines the judge preferred | 19 | 16 (5 ties) | | Median output tokens | 25.5 | 24 | | Runs with any thinking | 0 | 0 | | Median generation time | 0.28 s | 0.31 s | - Output 1.03× (0.97–1.10), generation time (first to last streamed event) 0.93× (0.83–1.05), time to the reply's end 1.07× (0.98–1.16); n = 40. - The judge, Opus 5.5 shown the two lines as A and B in a seeded order, read each pair beside the user's message, the running tool call and what the session did next: its own working line where it posted one (31 of 40), its first steps and its reply. Each effort failed three lines the other passed. Low's named the user's skill "this sweep", called the session's "seats" "labels", and gave away part of an answer; xhigh's gave away the fix, left out the user's question, and garbled the user's words. Both failed the same two, by promising page edits the session didn't make. **The fork-reply eval at low and at xhigh.** `uv run leaf-dev eval 'fork-reply*' --harness claude-code --base 4092d17dd --repeat 5 -j 4`. The head arm is this branch, at low; the base arm, `4092d17dd`, is this branch with `EFFORT = "xhigh"`. A base at `main` would have compared low with the medium the replay takes for a fork that names no effort. - 35 of 35 passed in each arm. - xhigh thought over 5 of its 35 lines (54–219 thinking tokens, 1.3–3.5 s); low over none. - Output 0.81× (0.63–1.01), the fork's time 0.85× (0.75–0.95), wall time 0.90× (0.84–0.96); n = 35. Median output 24 tokens at low and 22 at xhigh, median time 0.93 s and 0.99 s. **Live forks at the session's effort.** Since #5552 this machine's pages hold five working lines written on the current prompt at xhigh, with 25–71 output tokens in 1.0–4.4 s. **The live path.** `uv run leaf-dev journey claude-code --forks` passed on this branch before and after `runFork`, with the journey's session at its default, medium. On the later head, Claude Code's debug log shows all seven forks (three working lines, four turn-end checks) sent at low (`effort low asked, low sent`), and each fork's note gives `effort: "low"` beside `request.effort: "medium"`. The working-line forks took 627–661 ms for 15–26 output tokens, reading 59–95k tokens from the session's cache and writing none. Load averages ran 2.4–4.5 during the eval and 3.6–10.5 during the replay, so compare the ratios rather than the seconds. ## What this buys On real messages neither effort thinks, so low and xhigh take the same time there. Low removes the occasional line xhigh stops to think over, which took up to 3.5 s on the eval where a line took a median 1 s, and the line's time no longer depends on the effort the session runs at. ## Not verified - A session above xhigh, at `max`. - The replay resumes a transcript copy under `claude -p` rather than resending the session's own request through `$.model.fork`, so its runs don't share the session's cache: each read at most 35k tokens from the cache and wrote the rest of the context. The paired ratios share that cost; the absolute times don't match a live fork's. - Each replayed message ran once per effort and was judged once. - The replay and judge scripts sit in this branch's worktree under `.tmp/effort/` and leave with it. > _This was written by Claude Code on behalf of max-sixty_
max-sixty
added a commit
that referenced
this pull request
Nov 14, 2026
…hind LEAF_FORK_WORK (#5961) When the user writes in a thread while the agent is busy, Leaf already forks the conversation to post the agent's working line at once (#5552). This lets that fork go on to do the thread's work itself, in a turn of its own, while the main thread stays in charge: the main thread's pickup or answer takes any thread back, and a thread never has two forks. Forks that do the work run only with `LEAF_FORK_WORK=on`. The line fork stays on by default, and now also judges whether a fork could take the message. The design's home is the new Forks guide, `docs/forks.html`, linked from How it works. `notes/fork-replies.md` keeps the research and the steps still to come. ### How it works - **One turn per agent.** `src/leaf/holding.py` is the one rule for which turn of a session holds each thread message. Pickups and replies name their turn; a fork's take is recorded as its turn's pickup, so a message goes from kept back to held with no gap. A session's agent turns live in a new state-home record, `agent-turns` (`state.py`). - **Marking a fork's commands.** Claude Code runs no plugin module hooks for agents a plugin spawned, so Leaf's `hooks.json` PreToolUse hook marks a known fork's `leaf` commands with `leaf --agent-id <id>` (`hooks.agent_command`). Its call may contain `leaf` only as its first word; anything else is denied with how to rerun it. Every command of a fork whose turn has ended is refused. - **Working forks** (`forks.py`, `hooks/claude-code.ts`). On `take`, the module spawns a fork of the conversation (`$.agent.spawn`, subagentType fork). It answers in the thread, answers and opens a to-do the main thread owes, or hands the thread back with `HAND BACK:`. A later message in the thread resumes the same fork (`$.session.send`), which is told to read `leaf page state`. A resume that fails, a fork that hands back, or one that ends unanswered gives the thread to the main thread, whose next tool boundary or prompt receives the user's message. Follow-ups reach a running fork at its tool boundaries, by pointer when too large for the hook. - **Who has what.** `leaf page state` names a `holder` on each obligation record the agent owes, who owes it now: the fork that took the thread while its turn runs, by the name the main thread reaches it by, and otherwise the main thread. Each thread names the turn that last took it, with whether a fork's turn is running, closed or lapsed (`holding.holder`). The Stop hook and the watch read the same field to leave a running fork's work alone. The new `recovery-leaves-a-forks-answer` eval case gives a compacted main thread the reference's own `page state` selection: with `holder` it left the fork's answer 3/3; without, 0/3. - **Telling the main thread.** Leaf's clerk queues a line as a fork takes a thread and as its run ends, and wakes an idle session for a thread handed back or a to-do a fork opened. - **Module identity.** A session keeps the hooks module it loaded until `/reload-plugins`. The module names its source's digest to the pages follower, which keeps nothing back for a module older than its Leaf. ### Protocol 44 A Leaf at 43 doesn't know that a fork's pickup holds a message, so it would pick the message up again for the main thread, and it reads a reply's turn from `start.turn`, which moves to the reply itself. Pages go to 44 as each session's Leaf takes them; `clerk`, `pointed` and the new `agent-turns` records start at 44. ### Seeing what happened - `leaf-dev timeline PAGE --message ID` lays a page's log and diagnostics beside the session's transcript and debug log: whether a message was kept back, what the line fork judged, the fork's turn, its commands (refused or denied ones included), how its run ended, why no fork lane was up, and each agent turn running, closed or lapsed now. - `leaf-dev response-times` counts line-fork decisions and working-fork endings across pages. - The claude-code journey gains `--forks` and `--fork-work` steps: idle session, follow-up, resume, to-do and the work itself. The `line-fork` eval case replaces `fork-reply`. ### Review An independent reviewer's first pass found 14 issues, and its passes over the fixes found 5, then 3, then none; its review of the holder change found no defect in what the hooks decide and two gaps in what page state showed, both fixed. Each behavior fix has a test that fails without it. Two stay as they are: a fork inside one long tool call loses its thread, as the design has it (listed below); and a simplification that would have Leaf's hooks read Claude Code's internal files about each subagent is left out, to keep Leaf off them. The live claude-code journey with `--fork-work` passes every step: setup, release, idle session, follow-up, resume, to-do, the work itself and quit. ### Left open - A `leaf` command no agent id marks acts as the main thread, whoever ran it: a script a fork runs, a worker subagent, or the user's terminal. The hook reads the call's words, so a fork's script gets past it. The TODO in `state.acting_turn` has the next step: mark every caller the hook sees. - What Claude Code does with a second spawn under the same fork name is untested. - `holding.rounds` settles a round at any agent message, so the main thread answering an older choice refuses a fork's newer answer. - A fork that spends more than 15 minutes inside one tool call lapses, and the main thread's next hook takes its thread; the fork's later answer is refused. - CI catches a module Claude Code would refuse (`claude plugin validate`, from main), but doesn't type-check `hooks/claude-code.ts`, whose types Claude Code's npm package lacks. > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Nov 16, 2026
Max chose to let the resting comment box cover a margin entry (#5663). Beside one-line rows the box rests level with the next row's entry and takes the pointer there, so the margin-tone test releases focus before hovering each entry. Its fixture receipt also gains the `at_work` field #5552's `progressFace` reads, which the test lacked since then. > _This was written by Claude Code on behalf of max-sixty_
max-sixty
added a commit
that referenced
this pull request
Nov 16, 2026
Two tests have failed on main since #5428 put a resting comment box beside a focused target. Max decided both questions #5663 put to him, and both answers leave the product as it is: - **The box keeps its field's text cursor.** `test_a_control_a_widget_built_is_told_from_a_label_it_wrote` holds that every live press shows the hand. The resting box (`.lf-fab-rest`) is a press that stands in for the field it opens, so the test now leaves it out. - **The box may cover a margin entry.** Beside one-line rows the box rests level with the next row's margin entry and takes the pointer there. `test_margin_entry_tone_stays_distinct_from_control_and_agent_state` now releases focus before hovering each entry. Its fixture receipt also gains the `at_work` field that #5552's `progressFace` reads. No product change. Both cases pass locally. Closes #5663 > _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.
A thread message to a busy or idle Claude Code session now shows the agent's working line about 3 s after sending, and reads On it from the moment Leaf holds it for a fork, instead of showing nothing from the agent and sitting at "Queued for Claude" / "Delivered" until the session's first model call ends (a median 35 s on real pages since 1 November).
What changes
The fork posts only the agent's working line. A
$.model.forkcan't call tools, so it no longer answers held messages. It writes the one line the agent would say before starting ("Renaming the "Cause" section to "Root cause""), Leaf posts it as the agent's progress, and every message goes to the session, which answers it. A failed or blank fork hands over with no line. This reverses the user's 2026-10-31 fork that answered from the conversation (the user chose it on 2026-11-05);forks.py's header records both, and a TODO inforks.takemarks where a fork that can act could do self-contained work itself.The line takes nothing in hand. A receipt's progress (
thread.Receipt) carries no start, so every reader that ages, nudges or holds a turn still reads the message's delivery: the line renews no interrupted turn, hides no overdue message, and gives the Stop hook no start to offer.On it from the fork's start.
forks.forkedlists the messages a fork holds or whose line stands, in the presence reading, andserved_state.workserves them asat_work, which is now the session's working or replying stage or a fork's taking the input on. The message's word and face, the thread card's live working line, the On panel's row and the margin all read that one stamp. The fork's lane going down writes nothing to the page, so presence names the lane (fork_lane, a live fact) and a tab re-reads within the presence cache interval.Measurement.
leaf-dev response-timestimes the Delivered stage and each fork outcome;notes/fork-replies.mdrecords how forks fared on real pages (1–5 Nov: 27 of 40 handed over in a median 3.2 s, 7 failed with nothing to fork) and a design for a fork that takes the work.Evidence
fork-reply/*eval: 12/12, every case's line accepted by the judge, including two cases the fork used to answer; the rubric fails a line that answers or names a fork or hand-over.leaf-dev journey claude-code --forks: the fork's line was the comment's first reply at 2.6 s on an idle session and 3.5 s on a busy one, against 25 s to pickup, and the session then answered.