Repository navigation
Show each prompt Leaf sends a model on How it works, rendered from the code - #6459
Merged
Merged
Conversation
…e code Max asked for the prompts Leaf passes to its forks to be on How it works, in collapsed Markdown sections he can read and comment on with their source. Beside the prose that describes each, a collapsed section shows the prompt in `lf-text-document preview="markdown"`: the line fork, the summary fork, the working fork and the message that resumes it on the Forks tab; the turn-end check in the Workflow tab's Claude Code section; and the thread title request, Leaf's other model call in Claude Code, on the Threads tab. Each section says which parts Leaf fills in per message. The page holds no copy of the text. `leaf_dev.docs` fills each empty `lf-text-document[data-prompt]` slot as the site build or a preview composes the page, by calling the function that writes the prompt on an illustrative thread, turn and page facts (`leaf_dev.prompts`). To do that without copying Leaf's mechanisms, `delivery.handled` takes its registry from the caller, `envelope` assembles what `freeze_delivery` stores, and `thread_titles.title_text` formats the title request apart from reading the page. Behaviour is unchanged. The new test protects that every prompt in `prompts.PROMPTS` has a slot on the page showing its exact text, and that the illustrative deliveries meet the delivery schema.
leaf-agent
approved these changes
Nov 19, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 19, 2026
How it works quotes each prompt Leaf sends a model (#6459), and every box opened on a Markdown preview. Only the turn-end check is written in Markdown. The line fork, summary fork, working fork, resume and thread-title prompts are plain text holding JSON and tags, which the preview ran into one paragraph, so their exact text showed only under Source. This drops `preview="markdown"` from those six boxes, so they open on the numbered text as Leaf sends it; the turn-end check keeps its preview. Max chose this after comparing stills of the line fork's box both ways. `dev/tests/model/test_product_page.py` passes. > _This was written by Claude Code on behalf of max-sixty_
leaf-agent
added a commit
that referenced
this pull request
Nov 19, 2026
… the page (#6525) `test_every_product_route_is_a_live_leaf_page` now reads each product page's heading from the page's own header (`#top h1`) instead of asserting that the page holds a single `h1`. Since #6459, How it works shows each prompt Leaf sends a model in an `lf-text-document preview="markdown"`, and the turn-end check's prompt (`skills/leaf/references/turn-end-check.md`) opens with `# Turn-end check`, which the preview draws as a second `h1`. That made the strict `page.locator("h1")` match two elements. The repair keeps both #6459's intent and the preview's behavior: a Markdown preview draws a file's headings at the levels the file wrote, as GitHub draws a file, and Leaf's other embedded documents (a thread message's Markdown, an `lf-sample`'s page) keep their own headings too. Shifting the preview's heading levels would add a rewrite pass over rendered Markdown to satisfy a test. Every file in `docs/` carries its `h1` in `header#top`, so the assertion still protects what it did: each route draws its authored title heading. Verification: the test failed on `dd38dcb16` with the strict-mode violation the issue quotes, and passes with this change (`uv run pytest "tests/journeys/test_site.py::test_every_product_route_is_a_live_leaf_page"`). Closes #6519 — automated triage Co-authored-by: leaf-agent <[email protected]>
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.
Max asked for the prompts Leaf passes to its forks to be on How it works, in collapsed Markdown sections he can read and comment on with their source.
Beside the prose that describes each, a collapsed section now shows the prompt Leaf sends, in
lf-text-document preview="markdown": the line fork, the summary fork, the working fork and the message that resumes it on the Forks tab; the turn-end check in the Workflow tab's Claude Code section; and the thread title request, Leaf's one other model call in Claude Code, on the Threads tab. Each section says which parts Leaf fills in per message.The page holds no copy of the text.
leaf_dev/docs.pyfills each emptylf-text-document[data-prompt]slot when the site build or a preview composes the page, as it already does the verb table, by calling the function that writes the prompt on an illustrative thread, turn and page facts (dev/leaf_dev/prompts.py). To do that without copying Leaf's mechanisms,delivery.handledtakes its registry from the caller,delivery.envelopeassembles whatfreeze_deliverystores, andthread_titles.title_textformats the title request apart from reading the page; stored deliveries and title requests are unchanged.To weigh: the Preview tab renders the plain-text prompts as Markdown, so the thread JSON runs together and the turn-end check's page-state labels fold into the bullets above them; the Source tab shows the exact text. Max asked for Markdown sections, so every prompt keeps
preview="markdown".A new test checks that the page shows each prompt exactly as its function writes it, and that the illustrative deliveries meet the delivery schema.
leaf page checkand--renderpass, andleaf-dev site buildbuilds the page.