Skip to content

Add lf-deck: work through decisions one card at a time - #4331

Merged
max-sixty merged 32 commits into
mainfrom
catch-up
Oct 27, 2026
Merged

max-sixty merged 32 commits into
mainfrom
catch-up

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Adds lf-deck, an optional bundled package that works through a pile of decisions one card at a time, like Slack's Catch up. An agent puts it on the page like any widget; each element child is a card holding its own widgets and obligations.

A card waits while it holds an obligation open on the user. Once the user answers every obligation on the card they are on, the deck moves on by itself to the next waiting card; Later (or a swipe left) leaves a card waiting for the end of the pass and records nothing, and Back returns to the previous card. At the end of the pass a frame says how many still wait and offers to go through them again, or to review from the start. Arrow keys and the deck's command row give the keyboard route; a keyboard user lands on the next card's first question. A new tab opens on the first waiting card. Cards move as a stack: the open card accelerates off the side it was sent, the one behind rises into place, and the deck's height eases between cards; under reduced motion they just change places.

The old swipe package was retired in #2157. The deck keeps its one-at-a-time pile but generalizes it to any card, with swipe as navigation rather than as the answer.

Shared changes outside the package

  • browser/runtime/obligations/tally.js: the count of a region's open obligations moves out of lf-tally so the deck and lf-tally share it; exported as tally/tallyWords.
  • widget-api.js now also exports placeOf and executeCommand. Rolldown regrouping the kernel's chunks around executeCommand accounts for most of the dist/kernel churn; no runtime code moved.
  • openingView takes an optional fallback, so a views widget can open on a card of its own choosing (prepaint.js, storage.js, documented in module-authoring.md).
  • lf-draft: a draft the user needs to act on ([needed]) shows its Edit control at rest instead of on hover only.
  • heading-links.js: Enter on a section link waits for its control to upgrade before pressing it, which threw on a freshly drawn control.
  • AGENTS.md: notes/ holds research and plans for work not yet built; a branch's design lives in its code.

Docs: packages/deck/instructions/author.md, the package card in docs/extending.html, examples/developer/deck.html, the glossary, and the module references for the new exports.

Tests: tests/browser/widgets/test_deck.py covers a full pass (answer, Later, the end frame, Back, Review), opening a new tab on the first waiting card, an answer from another window not moving the deck, an open draft saved before moving on, and the keyboard pass.

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

max-sixty and others added 30 commits October 23, 2026 16:19
A pass over On me, one item at a time with Later, compared in place and as
a card. The page holds today's On view and both prototypes over the same
eight items; it asks which to build and whether to walk unread replies.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Each item on On me becomes a card in a deck over the page: Later sends it
left and keeps it on On me, an answered card goes right. The page now
compares a card holding the item itself with a summary card.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The user turned down the panel-level Catch up: it was a button at the
window's foot and slow, waiting a fixed 700 ms after each answer's
reading before a 240 ms flight. Catch up is now `lf-deck` in a new
optional `deck` package. The agent writes it around the asks it is
waiting on; each child is a card, answered with its own controls where
the agent wrote it, so nothing is moved or copied.

The deck is an `x-views` holder like `lf-tabs`: the runtime picks the
opening card, the deck records each card it shows, so a reload comes
back to it, and inactive cards are `hidden="until-found"`, so
find-in-page, fragments and the `m` walk open the card holding what they
reach. A card waits while `obligationsIn` finds an obligation open on
the user. When the server's reading ends the open card's wait after the
user answered it there, the next waiting card comes up at once (34-56 ms
from the click in Chrome and Firefox); a wait that ends any other way,
such as a comment, leaves the card in place with Next. Later records
nothing and the pass ends with the kept cards still waiting. Touch drags
swipe; a mouse drag stays text selection.

The bar counts in the tally's words, so the tally's count and words move
from `lf-tally` into `runtime/obligations/tally.js`, exported to bundled
packages, and both widgets read them.

The design note and its page now describe the widget and put one
decision to the user: whether the deck moves into the default package.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	.claude/skills/developing-leaf/references/glossary.md
#	dist/kernel/runtime/widget-api.js
#	skills/leaf/references/packages.md
A card that holds no question is passed over by Later and Next, so its
context belongs before the deck.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The pages' builder indented every line of the cards, the draft's text
inside its <pre> included, so the draft read as an indented Markdown
code block: a monospace box, its editor nested in another. A draft's
<pre> holds its source exactly, so the builder now leaves it as written.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A suggestion's Accept and Reject stand in the margin, outside the card,
so the deck read an accept there as news from elsewhere and left the
card in place. The deck now asks where the user is through `placeOf`,
which maps a margin entry or thread card to the page node it stands
for, exported to bundled packages. It also moves a card on only when
its obligations closed with an answer, so a comment, which leaves one
open with the agent, or the agent ending one, still leaves it in place.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Back was a quiet word and the forward control a bordered button with a
changing word, so the two read as different kinds of control. Both are
now chevrons of one size named by their titles (Back; Later or Next;
Go through the N left, or Review from the start, once the pass is
over), as a draft's actions are. The deck adds no Undo: Leaf's Undo
already travels to the answer it takes back, which opens its card.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	dist/kernel/kernel.json
main retired lf-approval (#3817); a permission is now an lf-options
decision. The deck's example and its pages ask whether to post the
release notes that way.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A press on the forward control once the pass was over gave it focus, and
a quiet action wears a frame while focused, so it kept a frame Back
lacked; Next also turned primary. Both controls now refuse focus from a
pointer and keep one style, so they look the same in every state.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	dist/kernel/kernel.json
#	dist/kernel/runtime/widget-api.js
A card asked in words had no visible way to answer it: the answer is a
comment, which only `c` or a selection starts. The deck's bar now shows
Reply on such a card, which puts the user on the question and runs the
comment command as `c` would, through `executeCommand`, exported to
bundled packages. Back, Reply and forward are command rows whose
controls they are, so the arrow keys toward and away from the text's
start are Back and forward anywhere in the deck, each with its key badge,
and Leaf keeps focus on Back where it is unavailable. A keyboard user on
a card the deck puts away goes to the card that comes up, by any route.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ck's reply

A draft that asks the user for an edit showed its Edit mark only under the
pointer or a key, so a pointer user looking at one saw no way to answer it. The
toolbar now shows at rest on a `needed` draft, as it already did for a finger.

The deck's sample card asked for an edit to a reply that goes out under the
user's name, so a user content with the words had no answer to give: saving
them unchanged records nothing. It now asks whether to send the reply, with the
draft optional, as lf-draft's instructions already direct.

Also commits the kernel chunk the committed kernel already imports.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A cold-use review of lf-deck found these still standing on catch-up:

- An answer made in another window moved a card the user had pressed in here.
  The deck now moves on only while its own window has focus, so that answer
  arrives as news and leaves the card with Next.
- Review, or any pass where nothing waits, showed only the first card: Next
  looked only for waiting cards. Stepping through a deck where nothing waits
  now goes card by card.
- A new tab opened on the first card even when it was answered. `openingView`
  takes a fallback, and the deck passes null, so where neither the address nor
  the tab names a card it opens on the first card that waits once the first
  reading is in. Tabs and other `x-views` holders are unchanged.
- A swipe snapped the card back to rest before it flew. It now flies on from
  where the finger let go.
- At phone width the marks shrank to nothing beside a long count. They now
  stand over the count, so the count neither moves nor squeezes them.
- author.md said a card moves on once it no longer waits; it moves on once the
  user answers it.

New browser tests cover a pass (answer, Later, the end of the pass, Back and
Review), a new tab's opening card, and an answer from another window; each
fails with its fix reverted.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	browser/runtime/widget-api.js
#	dist/kernel/kernel.json
#	dist/kernel/runtime/bundle-dispatch.js
#	dist/kernel/runtime/widget-api.js
#	docs/extending.html
#	examples/layer.json
# Conflicts:
#	dist/kernel/kernel.json
#	dist/kernel/runtime/bundle-answer.js
#	dist/kernel/runtime/bundle-version.js
#	dist/kernel/runtime/widget-api.js
notes/catch-up held the deck's design page and a pointer to lf-deck.js's
header, all of which the branch's code and a .tmp preview already carry. It
followed notes/feeds, a note for a design not yet built, and the notes/ line
in AGENTS.md read any "unresolved work" as a note's subject. That line now
says a note holds research and plans for large work in progress or a design
not yet built, and that built work keeps its contract in its code and its
review page in .tmp/. The rejected panel-foot design the note recorded moves
into lf-deck.js's header.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A reviewer used the deck in Firefox, by mouse, keyboard and touch, before
reading its code. Fixed here:

- An answer on a card whose draft editor was still open sent the card away
  and hid the unsaved words. A card holding a field with words in it now
  stays, with Next.
- A digit pressed twice answered two cards: the keyboard arrival on the next
  card came at once, ahead of the settle guard that only stopped presses.
  After an answer, the keyboard user now arrives once the card has settled.
- Keyboard focus landed on a card's wrapper, where its digits did nothing, or
  fell to the body after a margin entry or a reply in words. The deck now
  arrives as `m` would, on what waits on the next card, from the card itself
  or from a control standing for it; arriving there also puts away the reply
  thread the previous card's question had open.
- `m` could start from a caret left in a card the deck had hidden. The deck
  now clears a selection in a card it puts away.
- The end of the pass showed only the bar, its way back in a tooltip on a
  symbol. A quiet frame now stands where the cards stood, saying how many
  still wait, with "Go through the N left" or "Review from the start" in
  words; the bar's forward control steps aside for it.
- Enter on a decision `m` landed on threw: the heading-link command clicked a
  copy control it had just made, before the control drew its button. It now
  waits for the control to draw.

New browser tests cover the held card, the keyboard arrival and a double
digit, the end frame, and Enter on a fresh heading link; each fails with its
fix reverted.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	dist/kernel/runtime/bundle-answer.js
#	dist/kernel/runtime/bundle-dispatch.js
#	dist/kernel/runtime/bundle-version.js
# Conflicts:
#	dev/leaf_dev/commands/corpus.py
#	dist/kernel/kernel.json
#	dist/kernel/leaf.js
#	dist/kernel/runtime/bundle-data.js
#	dist/kernel/runtime/bundle-dispatch.js
#	dist/kernel/runtime/bundle-page-layout.js
#	dist/kernel/runtime/check-api.js
#	dist/kernel/runtime/widget-api.js
#	docs/extending.html
main now holds every widget-api export public, documented in a module reference,
and gives a package's widget defaults their own widgets.css. tally, tallyWords,
placeOf and executeCommand are documented beside the readings they extend, and
the deck's sheet moves to widgets.css, where its pre-upgrade rule again shows
only the opening card at first paint (it had stood every card while the sheet
was read as a page theme).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	dist/kernel/kernel.json
#	dist/kernel/runtime/bundle-data.js
#	dist/kernel/runtime/widget-api.js
#	skills/leaf/references/module-input.md
main now saves an open lf-draft editor when a press lands away from it, so an
answer pressed on a card with the editor open saves the edit first. The deck's
own hold on a card with words in a field went with it: nothing is hidden
unsaved, and the test now checks the edit is recorded and the deck moves on.
The keyboard test presses its second digit as the next card comes up, the case
the settle wait guards; pressed twice on one card, a choice toggles off, as it
does on any page.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	dist/kernel/kernel.json
#	dist/kernel/runtime/widget-api.js
# Conflicts:
#	dist/kernel/leaf.js
#	dist/kernel/runtime/check-api.js
The user asked to remove the bare lf-ask card: a question with no widget gives
the card nothing to answer with, and Leaf likely shouldn't encourage it. The
registry example and the developer page now hold only cards answered with their
own controls. The deck's Reply stays for a deck an agent writes with one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The user asked to remove the bare lf-ask card: a question with no widget gives
the card nothing to answer with, and Leaf likely shouldn't encourage it. The
registry example and the developer page now hold only cards answered with their
own controls. The deck's Reply stays for a deck an agent writes with one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
leaf-agent
leaf-agent previously approved these changes Oct 27, 2026
Main now builds every control by its role (#4323), so the deck's Back,
Reply and forward controls become `offerAction("symbol", …)` and the end
frame's step back in becomes a word, and the deck's own sizing of its
symbols goes: the face is the role's. The kernel is rebuilt from the
merged tree.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
leaf-agent
leaf-agent previously approved these changes Oct 27, 2026

@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.

The heading-links.js fix overlaps #4261, which also waits for the newly created copy control before clicking it. That PR can be reconciled once this one lands.

The end frame's keyboard check asked whether the frame contained focus,
which the lint rule reserves for the current location; its one control
is the only thing that can hold focus there, so it asks for that control.
The rest is what the pre-commit formatters write.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@max-sixty
max-sixty merged commit 57a2881 into main Oct 27, 2026
4 checks passed
@max-sixty
max-sixty deleted the catch-up branch October 27, 2026 04:22
max-sixty added a commit that referenced this pull request Oct 27, 2026
…ss lf-ask (#4366)

Leaf had two ways to ask the user a question answered in words: an agent
thread message with `--obligation`, and an `lf-ask` holding no answering
widget, which was itself an obligation answered by the user's next
message in its thread or a comment anchored inside it. The maintainer
asked that Leaf not encourage the second form and never require an
`lf-ask` to put a question on On me. This removes it, so `--obligation`
is the one way to ask in words. Follow-ups to lf-deck (#4331) ride
along.

## `lf-ask` frames, and never asks

- `lf-ask` declares a new registry key, `x-encloses: true`, instead of
`x-awaits: {reply, encloses}`. A frame gives the widgets inside it their
heading and arrival, and asks nothing itself. `x-awaits` now always
names `value` and `answered`; `reply` and `encloses` are gone from its
fields.
- `page check` and message markup refuse an `lf-ask` that holds no
asking widget (`empty-question`), and the finding now points to
`--obligation`. A widget counts inside every frame around it, so an
outer `lf-ask` holding only an inner one that asks is not empty; the
nearest frame still gives the obligation its prompt and arrival.
- Python: `obligations.replied`, `holds_obligations` and the page loop
that settled a bare ask from a comment are deleted;
`answered_in_words(record)` is true only for a message's obligation, and
the `registry` parameters that only fed it (`waiting_about`, `queues`)
are dropped. The runtime's `answeredInWords` matches.
- lf-deck's Reply control served only such cards, so it is removed,
along with the `executeCommand` export only it used.
- **Protocol 30 → 31**: vendored registries and the public package API
change, so older pages re-vendor.

## Shipped instructions

The `lf-ask` entry and `authoring-on-me.md` no longer teach the
widgetless form; the entry sends a question in words to `--obligation`.
A new eval case, `words-question-takes-a-thread`, scores it: at the
merge base, agents asked a free-text question as a bare `lf-ask` in 6/6
runs (3 Claude Code, 3 Codex); with the change, they used `--obligation`
in 6/6, and kept the accompanying choice a widget in every run. Two
rubric lines in `assessment-surfaces-pending-decisions` that said a
thread registers a question "only through an lf-ask" now accept
`--obligation`.

## Other changes

- **Tally wording**: `tallyWords` reads "4 left to answer" (and "· 1 on
Claude"), not "4 of 5 to answer", which beside lf-deck's cards read as
the fifth card's position. `lf-tally` shares it.
- **Status explanation**: kinds that share words now share a count, so a
widget question and a message question read "2 to answer", not "1 to
answer, 1 to answer".
- **lf-deck**: its controls take focus on a press like every other Leaf
control. #4323 draws a role control's frame only when reached by key, so
the mousedown handler that kept focus off them bought nothing.

## Tests

Three model tests that protected only the removed behavior are deleted
(a page question answered by commenting on it; a restated bare ask asked
again; a display-only widget beside one). Tests that used a bare
`lf-ask` as a convenient question now send an `obligation: true`
message, with `message:` ids, or give the ask an answering widget. Ran:
`tests/model` and `tests/process` (2132 passed), `pnpm run test:runtime`
(675 passed), `pnpm run check`, the deck tests, and 33 targeted
browser/journey tests covering each changed fixture.

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

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
max-sixty added a commit that referenced this pull request Nov 25, 2026
…ips, and hold the deck's height so m lands each card alike (#7150)

Fixes three faults in `lf-deck` that Max hit on leaf.page's catch-up
example.

**An answered card stayed put.** The deck moved a card on only if the
window had focus, and focus was on the card, when the server's reading
of the answer arrived. On leaf.page a new visitor's first answer reads
back after about 12 s, so turning to another window meanwhile left the
card open with the count already down. The deck now moves on when the
answer that closed the card, its latest, was sent from this page,
whatever route recorded it, and moves the page or focus with it only
while the user's latest press or key toward the card still stands, read
as each move lands.

**Two sets of arrows.** Back and forward asked for corner key chips
(since #4331), so a keycap ← / → stood beside each chevron. They no
longer ask; the chevron's preview still names the key.

**`m` jumped by each card's height.** Since #6688 took away the page's
foot room, a shorter card at the page's end shrank the deck and the
browser pulled the page down: the bar landed at 12px, then 49px, then
12px as `m` cycled two cards, and Back or Next by pointer moved the bar
under the pointer. The deck now holds the tallest height it has stood
at, and the open card fills it; the end of the pass keeps its own height
inside it.

To weigh:

- **A new package-API name, `sentHere(event)`**, which reads the event's
`attempt` against the attempts this page posted; the served
`EventReference` now carries `attempt`. No existing name says whether an
event came from this page, and every recording route (`lf-action`,
`widgetController.dispatch`, `record.property`) meets at the dispatcher
that keeps those attempts.
- **A short card after a taller one now stands as tall as the taller**,
its frame round empty room. A change of the deck's width lets the height
go. A first pass by `m` at the page's end, in a window taller than the
deck, can still land a newly tallest card lower than the last; page tabs
avoid that by standing at least a window tall, which on a deck would
push what follows a short deck a window down.

Max reported all three and hasn't read the diff. Codex reviewed the
first two commits; its findings and Tend's are folded in. Tests: the
page-end hold is a new `deck-back` row of the hold-still journey (fails
on main in both engines); the late-answer test checks the card moves and
the page doesn't; deck tests, model tier and runtime tests pass.

> _This was written by Claude Code on behalf of max-sixty_
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