Skip to content

Show each prompt Leaf sends a model on How it works, rendered from the code - #6459

Merged
max-sixty merged 2 commits into
mainfrom
agent-a125bc3a79e2dc8f6
Nov 19, 2026
Merged

max-sixty merged 2 commits into
mainfrom
agent-a125bc3a79e2dc8f6

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

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.py fills each empty lf-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.handled takes its registry from the caller, delivery.envelope assembles what freeze_delivery stores, and thread_titles.title_text formats 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 check and --render pass, and leaf-dev site build builds the page.

This was written by Claude Code on behalf of max-sixty

…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.
@max-sixty
max-sixty merged commit 4c0dc2b into main Nov 19, 2026
5 checks passed
@max-sixty
max-sixty deleted the agent-a125bc3a79e2dc8f6 branch November 19, 2026 02:23
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants