Skip to content

Explain Leaf's architecture and runtime in How it works - #2288

Merged
max-sixty merged 8 commits into
mainfrom
how-it-works-prose-review
Oct 10, 2026
Merged

max-sixty merged 8 commits into
mainfrom
how-it-works-prose-review

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

"How it works" becomes the place that explains Leaf's high-level design: how the harness, the leaf CLI and page server, the page directory and the browser runtime fit together, and how a move travels between them.

How it works (docs/how-it-works.html)

  • Loop opens with an Architecture section: one diagram of harness, Leaf and browser, then short entries for the one validated path into the event log, the one server reading of the page, the browser runtime, delivery to the agent, registry declarations and the state home. Pi joins the harness rows, marked experimental. What the agent reads is folded into the typical flows; the transport detail and channel table move out. The Stop hook's checks sit in a disclosure under page ending.
  • Updates now holds Stages of a move, so it no longer overlaps Loop.
  • Runtime (formerly Serving) keeps the server sections and adds the browser runtime: its three inputs (authored document, server reading, moves awaiting an answer), freshness checks and state reads, drawing and presentation proof, live revisions, and startup phases. It uses the Questions vocabulary from Unify Questions and their typed answers #2240.
  • Phone is a new tab: Leaf stays desktop-first, and the tab says what touch reaches today and what it lacks.
  • Headings name topics rather than slogans throughout.

Other pages

  • docs/threads.html gains anchoring, revisions, drawings, widgets in messages, titles, summaries and resolving.
  • docs/website.html is a new short page at /website/ on how leaf.page serves Leaf; dev/leaf_dev/site.py routes it and tests/test_product_page.py lists it.
  • worker/README.md points at max_instances instead of a hardcoded container count; TODO.md drops a stale clause asking for visible passage threads on touch.

how-it-works, threads and event-log carry a TODO comment for a third-person pass, which follows in the next change.

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

max-sixty and others added 8 commits October 6, 2026 17:31
How it works now opens with Leaf's architecture: the harness, the leaf
commands and page server, and the browser runtime, and what each owns (the
page directory, one validated path into the log, one reading of the page,
delivery to the agent, the registry, the state home). The channel table and
the transport disclosure (App Server wire parameters, private child
invocations, hook stdin) leave the Loop tab; session-lifetime.md and the
harness references own them, and Owning contracts links there.

The Typical flows now say what the agent reads: the Leaf skill routing to one
reference per workflow, package instructions by audience, the handling
clauses each delivery assembles from the registry, the check and the Stop
hook as feedback to the agent, and evals scoring instruction changes. What the Stop
hook checks becomes a disclosure in that flow's Wait for feedback or finish
step rather than a section of its own.

Every heading on the page now names its topic (Progress updates, Banner
readings, Current state, Data lifetime, ...) rather than stating a thesis.

Stages of a move moves from Loop to Updates, so Loop covers how a move
travels and Updates covers what the user reads about the agent's work.

Harness differences gains an experimental Pi row. A new Runtime tab takes the
Serving tab's server lifetime and addresses, then explains the browser runtime: its three inputs, freshness checks and state reads,
moves awaiting an answer, presentation proof, browser-owned state, live
revisions and startup phases; the Loop, Revisions and Data paragraphs that
overlapped it now link to it. A short Phone tab says Leaf is desktop-first
and lists what works by touch and the known gaps; the Layout tab's touch
sentences move there.

The Threads page explains anchors: the kinds of anchor, how a passage is
found (segments in the browser, quote and context in the log, says vs
wrote), what a revision does to a thread (stay, move to its element, or a
refused revision until the agent moves or detaches it), drawings, widgets in
messages, titles, summaries and resolving.

A new page, /website/, explains how leaf.page serves Leaf: published pages
at the edge, per-visitor per-release containers running the canonical
server, the hosted Codex agent, release addressing and why a mixed-release
response is refused, and how long private state lives.

how-it-works, threads and event-log carry a source TODO to move their
prose to the third person, a pass planned after this lands.

docs/layer.json now names the docs pages' package selection (the examples'
packages plus ./docs/package). The site build reads it instead of appending
the site package itself, and `leaf-dev preview --source docs/...` picks it up
like any layer.json beside a source, so a docs preview styles its site nav as
leaf.page does rather than falling back to the examples' selection.

worker/README.md points at wrangler.toml's max_instances rather than
repeating a count that had gone stale (5,990 vs 5,900). TODO.md drops "give
touch users visible passage threads": pins show on phones and tapping one
opens its thread (checked with leaf-dev probe --touch at 390x844).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	docs/how-it-works.html
#	tests/test_site.py
main's diagram-width test now waits for the rendered diagram, and the
left-to-right layout measured 1308px in a 1152px content box.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	docs/how-it-works.html
#	worker/README.md
Main's Questions cutover (#2240) renamed Asks across the sections it
already held; this carries the rename into the Architecture and Runtime
sections this branch added. It follows the shipped split: the server
decides which widget Questions are open, the panel shows an answer at
once, and the presentation order is marks, threads, Question view, then
Questions panel (semantic-state.js PRESENTATION_ORDER).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	docs/how-it-works.html
@max-sixty
max-sixty merged commit e8f558e into main Oct 10, 2026
6 checks passed
@max-sixty
max-sixty deleted the how-it-works-prose-review branch October 10, 2026 21:11
max-sixty added a commit that referenced this pull request Oct 10, 2026
How it works, Threads and The event log explain how Leaf behaves rather
than instructing the reader, so their prose now names the user and the
page instead of addressing "you". Interface strings quoted verbatim,
such as "picked up your comment" and "On you to answer", keep their
wording, and the event log's live sample keeps its imperative steps.
This drops the TODO comments that asked for the pass after #2288.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[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