Skip to content

Make a page's theme one of the packages it lists, and remove the theme slot - #6900

Merged
max-sixty merged 5 commits into
mainfrom
agent-a535b4d8a5cbab1c5
Nov 23, 2026
Merged

max-sixty merged 5 commits into
mainfrom
agent-a535b4d8a5cbab1c5

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

A page's look was a slot of its own beside its packages: page init --theme / --no-theme, a theme field in the layer record, a ~/.config/leaf/themes.toml catalogue with a default, a $theme.base registry key and leaf theme list. This removes all of it. A page composes the mandatory layer and then the packages it lists, in that order. reading is an ordinary bundled package that leaf package list shows, and a theme builds on it where the page lists the theme after reading, or replaces it where the page lists the theme alone. page init returns the packages it recorded.

What the diff doesn't show: a page that lists no theme draws in the browser's defaults, and no check reports that. So a new page's look now rests on the shipped instructions (SKILL.md, "Author the page"), which tell an author to list reading first. The authoring eval no longer initializes the page for its agent, so its cases score whether the agent does. Five of those cases ran three times each on Claude Code beside the merge base: all 15 agents on these instructions listed reading first, and 9 of 15 runs passed their rubrics on each side, with no failure about the page's look. The same five cases ran once each on Codex, and all 5 agents listed reading first. playwright-recording-shows-its-trace adds a package to an existing page, which replaces the page's packages; it gains a rubric for keeping reading, and 6 of 6 agents kept it.

The layer record drops theme, and its since moves to the current page protocol with no bump, as layer-registry.md, "Page protocol", prescribes.

Closes #6820: $theme.base is gone, so package check and page init no longer disagree about a base, and a theme builds on reading by being listed after it.

Max chose this on the design page for the CSS and theme structure, over keeping reading composed by Leaf's code. The test job covers the model tier and the browser and journey tests in files this change edits. Locally, the other browser and journey tests that name reading pass too, 27 of them; the rest of those two tiers run on main and daily, not on a pull request.

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

…e slot

A page's look was a slot of its own: `page init --theme` / `--no-theme`, a
`theme` field in the layer record, a `~/.config/leaf/themes.toml` catalogue with a
default, a `$theme.base` registry key, and `leaf theme list`. Leaf composed the
slot's theme, after its bases, under every page, so a new page took `reading`
without naming it.

Now nothing in Leaf's code knows a theme. A page composes the mandatory layer and
then the packages it lists, in that order, and `reading` is an ordinary bundled
package that `leaf package list` shows. A theme builds on `reading` where the page
lists `reading` before it and replaces it where the page lists the theme alone. A
page that lists none draws in the browser's defaults, so whoever initializes a
page names its theme.

Behavior that changed:

- `leaf page init <page>` with no `--package` records no packages, where it
  recorded the default theme. `--theme`, `--no-theme` and `leaf theme` are gone.
- `page init` returns the selection it recorded, `"packages": [...]` beside
  `"page"`, so an author sees what a re-init replaced.
- `leaf package list` lists `reading`, described by a new
  `packages/reading/instructions/author.md`.
- The layer record is `{packages, generation, protocol}`. Its `since` moves to
  the current page protocol, 53, and the protocol baseline follows; the served
  state's `layer` drops `theme`.
- `package check --render` composes the mandatory layer and the package, without
  the themes a `$theme.base` named.

The shipped instructions tell an author to list `reading` first unless the page
takes another theme or carries a design of its own (`SKILL.md`, "Author the
page"; `package-themes.md`, "A page's theme", which replaces "Personal themes").

Whoever initializes a page for an author now names `reading`: the example and
docs manifests, the test fixtures (`reading=False` where they took
`theme=False`), the site demo, the usability, review and fork eval scenarios, the
eval probes' pages and the eval report. The authoring eval no longer initializes
the page for its agent, so a case scores whether the agent lists a theme; two
authoring prompts that called the directory initialized say so no longer.
`fixture_environment`, which hid the developer's theme catalogue from fixture
builds, goes with the catalogue.

Tests for the removed slot went with it: `tests/model/test_themes.py`,
`tests/journeys/test_themes.py` and the personal-theme test in
`dev/tests/model/test_interact_preview.py`. One model test covers the new
composition: themes compose in listed order with `reading` as an ordinary
package, and a page listing none composes none.
A page command on a directory that isn't a page said "run `leaf page init
<dir>`", a whole command an agent pastes. With no theme composed by default,
that command records no packages, so the page draws in the browser's defaults.
The message now says "run `leaf page init` first", as the other messages about
a missing layer do, and the author chooses the packages as `SKILL.md`, "Author
the page", says.
…efault

`docs/extending.html` listed "named personal themes with a default" as the
user's interface, `docs/how-it-works.html` said a page selects "packages and a
theme", and `browser/base.css`'s header said a page takes `reading` by default.

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests/model/test_interact_layer.py::test_page_commands_do_not_mint_the_successful_init_marker fails on this head. It still asserts f"leaf page init '{page}'" in ...["error"]. Commit 39c6417 changed resolve_dir's refusal to "run leaf page init first", so that a bare page init is no longer handed out without reading. The test exists to check that a page command doesn't create the init marker, and the exact wording of the command is incidental to it. Matching on "is not an initialized page" would keep what it protects. The line is outside the diff, so there's no inline suggestion. The other 227 tests in test_interact_layer.py and test_interact_product.py pass.

I'm leaving the verdict open for the eval count the description says is still to come. That count is the only evidence for the new risk, which is pages left in the browser's defaults now that a page's look depends on SKILL.md. It's also the score that root AGENTS.md ("Score both versions of a change to agent instructions") asks for on this instruction change.

Removing $theme.base and with_theme takes away what #6820 is about: a selected theme package whose base is never composed. If you agree that settles it, adding Closes #6820 to the description would close it on merge.

…keeping the theme

Two tests asserted the complete `leaf page init <path>` command that
`resolve_dir` printed for a directory that isn't a page. The message stopped
printing it, since that command records no packages and so no theme. The tests
protect the refusal and that it creates nothing, so they now match "is not an
initialized page".

`playwright-recording-shows-its-trace` adds a package to an existing page, which
runs `page init` again and replaces the page's packages. Its page now selects
`reading`, and a `keeps-the-page-theme` rubric fails a command that names only
`playwright`. Six fresh Claude Code agents on these instructions all named
`reading` beside it.
leaf-agent
leaf-agent previously approved these changes Nov 23, 2026
The sentence above the `page init` example said every package "beyond the
bundled default" joins with `--package`, which left the example's
`--package reading` unexplained. The catalogue's introduction called every card
an optional package while its first card is the reading theme. The new card
spelled "colour" on a page that writes "color", and the diagram set the
package's name in lower case beside two capitalised theme names.
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.

leaf page init --package ./theme composes a theme without the base it names, which leaf package check enforces

2 participants