Repository navigation
Show one recorded fork journey, message by message, in How it works' Forks topic - #6489
Merged
Merged
Conversation
…Forks topic The Forks topic gains "Anatomy of a fork journey". It follows one thread through every message Leaf, Claude Code and the forks exchanged in the 19:38 PT run of the claude-code agent journey on 18 November 2026, under Claude Code 2.1.328: a timeline of the run with a lane each for the user, Leaf, the line fork, the working fork and the main thread, then each message in order. Those are the line fork's prompt and JSON answer, the working fork's first request (Claude Code's Agent call and result, its fork rules, Leaf's task), the follow-up the PostToolBatch hook hands the fork, the resume message inside Claude Code's coordinator wrapper, and what reaches the main thread when Claude Code's task notification wakes it. A rule beside each message, and a tint on each quoted piece, says who wrote it: Claude Code, Leaf, a model or the user. Leaf's own messages are written by the docs build from the current code, using the run's recorded batches (`dev/leaf_dev/fork-journey.json`), so they show what Leaf writes now. Before recording, the current code was checked against the run: it re-derives the three deliveries exactly, apart from `created_at`, and the line prompt exactly. Only the timings, Claude Code's text and the models' answers stay as recorded. The line, work and resume prompt slots moved into the section, so each prompt shows once, with the recorded run in place of the illustrative scenario. "Where a thread message goes", "A working fork takes a message" and "Further messages in a thread" now link to them. The take's sequence diagram stays, and its caption's live-run timing gives way to a link to the section. Two Leaf strings gained a function so the docs can write them from code: `hook_transport.inline_context`, now the one place a hook's inline delivery is composed, and `forks._given_line`, the line telling the main session a fork took its thread. Max asked for this after reading the same messages, gathered from the run's source records, on a Leaf page: "a really really useful way to see the messages, bravo for producing actual source records ... can we consider having this as a part of How It Works on the Fork page with 'Anatomy of a Fork Journey'". Checks: `dev/tests/model/test_product_page.py` (the slots against `prompts.PROMPTS`, and every recorded delivery against the stored-delivery schema) and `tests/model/test_product_page.py` pass. So do `tests/model/test_forks.py`, `test_hooks.py` and `test_session_lifecycle.py`. `page check` on a preview of the page found nothing. The section adds 732 words of prose, about 120 of them moved from the prompt slots, and 442 of recorded text in collapsed blocks.
… timeline's unit as seconds The listing of Leaf's two queued lines kept the 80vh bound every prompt slot takes, which left most of a window empty under them. It now takes 14rem, and 34rem below 40rem wide, where the lines wrap to about 25 rows. The rule sits in the page's own style beside the 80vh one, since the package's overrides lose to it. The timeline's caption said milliseconds where its list counts seconds.
leaf-agent
previously approved these changes
Nov 19, 2026
# Conflicts: # docs/how-it-works.html
leaf-agent
previously approved these changes
Nov 19, 2026
Main's #6504 opened the line, working and resumed forks' prompt boxes on their exact text. This branch moved those boxes into Anatomy of a fork journey, so the merge keeps the move and drops the Markdown preview there too.
leaf-agent
previously approved these changes
Nov 19, 2026
# Conflicts: # docs/how-it-works.html
# Conflicts: # src/leaf/hook_transport.py
leaf-agent
approved these changes
Nov 19, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 20, 2026
… material (#6548) How it works drew Leaf as one participant in its fork sequences, so the round trips between Leaf's Python and Leaf's Claude Code hooks module showed nowhere. This draws them apart: - **Take sequence** (Forks tab, `#take-sequence`): the page server and `leaf hook` (Leaf's Python) and the hooks module, line fork, working fork and main thread (in Claude Code), each arrow labelled with what crosses. Its caption says which half writes what. - **Turn-end check** (Workflow tab, `#turn-end-sequence`): a sequence of its own, drawn the same way. - **`#forks-carrier`**, after the forks map: the module only carries out Python's instructions (`carrier.py`), so a change to a fork changes only the Python. `carrier.py` joins the sources. - **Anatomy timeline**: the Leaf lane splits into Leaf's Python and the hooks module, whose lane holds its fork calls and run-end reports at the times the 19:38 run's Claude Code debug log recorded. The line and working fork lanes now use the forks' own times from that log rather than when Python noted them, which had put a run's end after the module reported it; two prose figures follow (15.6 s, 1.5 s). The forks map is unchanged. **To check:** the take sequence is now about 1,020 px tall at the column's width, against 520 before, and scrolls sideways in its box on a phone. The module's times, like the timeline's other times since #6489, come from the run's recording rather than checked-in data. From open item `#30` on the fork-messages page, where Max picked building it. Tests: `tests/model/test_product_page.py`, `dev/tests/model/test_product_page.py`, the product-preview test in `dev/tests/model/test_interact_preview.py`; `leaf page check --render` on the docs preview is clean apart from advice it already gave. Each diagram was looked at as Firefox draws it, light and dark, at desktop and phone widths. > _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.
How it works' Forks topic gains "Anatomy of a fork journey". It follows one thread through every message Leaf, Claude Code and the forks exchanged in a recorded run of the Claude Code agent journey (18 Nov, Claude Code 2.1.328). The section has a timeline with a lane for each of the user, Leaf, the line fork, the working fork and the main thread, followed by each message in order. A coloured rule and tint on each message say who wrote it: Claude Code, Leaf, a model or the user.
Leaf's own messages are written from the current code with the run's recorded batches (
dev/leaf_dev/fork-journey.json), so they stay current. The current code reproduces the run's three deliveries and its line prompt exactly. Only the timings, Claude Code's text and the models' answers are as recorded. The line, work and resume prompt slots moved into the section, so each prompt shows once. The take's sequence diagram stays. Two strings gained a function so the docs can render them:hook_transport.inline_context, now the one place a hook's inline delivery is composed, andforks._given_line.To weigh: the recorded paths are the journey's
/private/var/folders/…scratch page, which the lede says. The timings are one run on your machine.AGENTS.md's rule fordocs/(#6487) admits a figure from checked-in data, whichfork-journey.jsonis, and here the seconds place one run's events rather than state how fast Leaf is. With #6497 merged, the work and resume previews show the delivery as the fenced block the fork reads, andinline_contextwrites it withjson_block.Max asked for this after reading the same messages on a Leaf page: "a really really useful way to see the messages … can we consider having this as a part of How It Works on the Fork page with 'Anatomy of a Fork Journey'". Reviewed from light, dark and phone captures, which led to fitting the queued-lines box to its text, and by a reviewer who hadn't seen the work.
Tests: both
test_product_page.pyfiles,tests/model/test_forks.py,test_hooks.py,test_session_lifecycle.py.page checkis clean.