Repository navigation
Simplify the leaf CLI surface and bump protocol to 24 - #3850
Merged
Merged
Conversation
Behavior changes: - `thread reply --attempt` is gone. Nothing outside tests passed it, and the answer reference is already the retry key; only a provider's reservation brings a key of its own (`thread.post_response`). - `leaf wait --ack` acknowledges through `delivery.cmd_delivery_ack`, so it gives the same repeat note and refusals as `leaf delivery ack`. - `page state --after/--limit` without an ID is refused by `agent_state`, beside the widget case, rather than by a second check in the CLI. - `page open`'s note about answers still owed is `session.cmd_waiting`'s. - Options that had no help get it (`--use`, `--contract`, `--from`, `--through`, `connection bind`'s), `connection unbind` gets a docstring, and option help keeps one style. `page events --after` and `page export --version` take ranges. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`thread reply <ref>` refused an answer with no --done, --todo, --obligation or markup twice: as a CLI usage error and as `post_reply`'s `undeclared-answer`, which also covers markup with no asking widget. The CLI copy is gone, so the refusal now arrives as the finding, exit 1, without a usage line. No test held either; one now does, for both cases. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A refused `page state PAGE --limit N` with no ID published the saved source as a revision first, since the refusal sat after activation. It now comes before the transaction; the widget case stays where the subject is known. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Nothing taught it, agents ran it once in three days of command logs, and it was one of the CLI's exceptions to JSON output. `page state` and `page events` read the exchange. Tests that read the transcript as a stand-in now assert the behavior it showed through those readings or the log: an edited message reads in its latest words, a reply survives re-vendoring, a quoted design comment keeps its part. The test of the transcript's own format goes with it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
"Open" now means only `page open`, so the commands that make a thread or a to-do say create: - `leaf thread open` is `leaf thread create`. - `leaf task open PAGE SUBJECT TITLE` is `leaf task create PAGE SUBJECT --title TITLE` (`todos.cmd_open` is `cmd_create`). Ids and choices stay positional and every free text is an option, so an agent never has to guess where a sentence goes: - `leaf task start PAGE ID LINE` is `leaf task start PAGE ID --text LINE`. - `leaf task end PAGE ID OUTCOME [DETAIL]` is `leaf task end PAGE ID OUTCOME [--text DETAIL]`. These are plain options, not bodies: a one-line status or detail takes no `--file` or piped stdin, and their destinations (`line`, `detail`) keep the body convention's check (`test_every_body_takes_text_and_file`) to bodies. Every consumer moves with them, with no alias: findings and refusal text, the registry's handling text, the shipped references, docs, examples, evals, leaf-dev and the tests. The help snapshots and the event-contract snapshot change only in the command names and shapes. Handling text naming a command is an annotation, so the page protocol stays where it was; the kernel's hash of `runtime/passages.js` moves with a comment there. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A delivery `leaf wait` prints now tells its reader to run `leaf delivery ack <id> && leaf wait` in the one background task or unified-exec session its harness runs a wait in. `&&` keeps the guarantee `--ack` gave: a refused acknowledgement starts no wait. `leaf wait` loses `--ack`, its PAGE/--ack exclusivity check, and the hand-off that let a consumer with no harness session watch the pages its acknowledged delivery named. Such a consumer now names its page: the instruction reads `leaf delivery ack <id> && leaf wait <page>`. Its wait always named one page, and `delivery_json` freezes exactly one batch, so a wait delivery never spans several pages. `Harness.run_ack` takes the whole command, and `wait_acknowledgement` takes the delivery's page to build it. Codex's Stop-hook remedy names the shell session running `leaf wait`, alone or after `leaf delivery ack`. `cmd_delivery_ack` returns nothing, since no caller read its pages. Behaviour beyond the spelling: the acknowledgement records its own `delivery ack` command timing in the page's interaction log, where `wait --ack` recorded one `wait` entry. Tests: the acknowledgement-then-wait tests acknowledge through `cmd_delivery_ack` or `delivery ack` and then run `leaf wait`, keeping what each asserted. Deleted, because they protected `--ack` itself: the PAGE/--ack exclusivity assertion in test_receipt_uses_an_immutable_delivery_and_advances_monotonically, and test_a_bare_shell_receipt_rearms_every_page_in_its_delivery, which covered the receipt-to-pages hand-off. test_the_page_reports_its_own_errors_to_the_watcher and the stop-guard report test now assert the acknowledgement's exit 0 rather than the rearmed wait's 2. Help, delivery and Stop-hook snapshots are re-recorded for the new wording. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`page stamp --from-directory DIR --if-source DIGEST` becomes `page stamp --replace DIR DIGEST`, one two-valued option, so Click itself refuses half of the pair and `publishing.cmd_stamp` drops its paired-option refusal; `cmd_stamp` takes `replace=(dir, digest)`. `server run --temporary` / `--persistent` become `--lifetime session|persistent|temporary` (default session), with the values the started server prints as `lifetime`. `server start` and the hidden `server _serve` take `--lifetime session|persistent`, so a temporary start is refused by the choice set rather than at run time, and the `--temporary`/`--persistent` conflict refusal is gone. `--host` with a temporary serve is now refused by `hosting.cmd_serve_temporary`, the owner of that loopback-only server, instead of in the CLI. Prose, dev callers (eval arms, preview), the site page and tests move over. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Arguments that name any message in a thread now read MESSAGE: `thread reply PAGE [MESSAGE]` (was THREAD), `thread resolve PAGE MESSAGE` (was THREAD), `page picture PAGE MESSAGE` (was ID). `page state`'s argument names a message or a widget, so it reads `[MESSAGE_OR_WIDGET]` (was ID). Shipped prose, the kernel registry's handling text and the developer glossary use one placeholder, `<message>`, where they meant a message: `<thread-id>`, `<message-id>`, `<comment-or-reply-id>`, and `<event-id>` where the event was a message (`message:<message>` obligation ids, a reaction's `thread resolve`). `<event-id>` that names an update, which need not be a message, stays. The unknown-thread refusal now says "unknown message id" rather than "unknown comment id", since any message names a thread. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`thread reply --help` no longer restates threads.md's "Every answer declares" and "Successful answers check" paragraphs: it says what each form does, what an answer must declare, that the reply publishes checked page edits, and points at references/threads.md. The `task` group's help keeps what the list holds and what a write prints, and points at conversation-loop.md's "Long-running work" and "The On lists" for the rest. `page check --help` names the browser variables from `render_gate.browser.VARIABLES`, their owner, rather than a copied list. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`file_bindings.bind_file` now returns the grant `file bind` prints
(`binding`, `path`, `bytes`), with the size of the bytes it read under the
page lock, so the CLI no longer re-reads `bound_paths` and stats the file
afterwards. It used to return the browser's snapshot of the file, which only
tests read; they now read it with `read_file`. `media.cmd_media` returns each
file's `{"path", "source"}` record rather than tuples the CLI reshaped.
`leaf file bind` and `leaf page media` print what they printed before.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`thread.post_response` no longer accepts an `attempt`: it derives every write's retry key itself. Without a reservation, an answer or failure receipt keys on its reference, as before, and progress takes none. With a provider reservation, the answer keys on the reservation and progress on `<reservation>-progress`. Codex's turn passed exactly these (`<attempt>-opening` for its opening progress, the attempt for its final), so it now passes only `reservation`, and a caller passing `attempt` fails loudly instead of having it silently overwritten. Codex's opening progress records `-progress` rather than `-opening` as its key's suffix. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`page report` is a worker's write of widget state, which belongs to no thread, so `cmd_report` leaves `thread.py` for a new `reports.py` whose header states what a report is, how it is admitted and when it stops standing. No module owned writing reports before; `projection` and `publishing` read and settle them. Behavior is unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Every writer of a `status` event (`leaf page open`, `leaf page close`, the
website harness) passed `detail: ""`, so `PageTransaction.set_status`,
`session.cmd_waiting` and `session.cmd_idle` lose the parameter, and the
kernel registry's status record loses the field. The served `status`
(`activity.declaration`, `state.schema.json`) is now `{state, ts}`.
The one reader of those words was the `listening` activity, which carried
them as its `detail` for the panel ("Claude awaits — <request>", "It asked:
..."), the All pages row ("Awaits — <request>") and Claude Code's band. No
writer has supplied them since `page open` stopped taking words, so those
branches were unreachable; they are deleted with the tests that seeded words
by hand, and how-it-works.html's examples now show the stock "Claude awaits —
select text to comment". A listening page reads exactly as it did in
production.
A Leaf at protocol 22 requires `detail` on every status record, so it would
refuse the records this Leaf now writes into a shared log:
`$events.protocol` moves to 23, and the build moved `protocol-baseline.json`,
`contract.d.ts` and the kernel with it.
Tests that passed declaration words now call the new signatures; the ones
that asserted those words came back (`test_activity`, `test_codex_adapter`,
`test_session_lifecycle`, the band test) now assert the declared state,
which is the behavior they protected.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
main moved `$events.protocol` to 23 while this branch also bumped 22 to 23 for dropping the status event's `detail`. The merged tree takes main's baseline and renumbers this branch's bump to 24, rebuilt with `pnpm run build:browser`. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A survey of seven days of transcripts found agents reaching for a `leaf status` command (15 of 36 CLI-form failures) and passing a zsh `$files` variable to `page media` as one argument (3). `harness-codex.md` no longer calls the started line "the status's sentence", and the media instruction shows each file as its own argument through a glob. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The help said a post into PAGE MESSAGE "never stands in for an answer you owe"; post_reply refuses it while the thread owes one. threads.md now carries the two facts the trimmed help dropped: the first answer on a revision notes page check's advice, and a progress line leaves the turn's final answer to post. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
No agent used it in three weeks of transcripts. A harness that gives up on an update still posts the failure receipt through `thread.fail_answer`, and the domain's `failure` option stays for it. The reply command loses the flag and its two checks, and `threads.md` stops teaching it. The receipt test now calls the domain directly. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
reviewed
Oct 25, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
A standalone wait’s acknowledgement instruction breaks when the page directory contains spaces. The generated command treats one page path as multiple arguments, so acknowledgement succeeds but the next wait does not start on that page.
# Conflicts: # browser/framework/contract.d.ts # src/leaf/transcript.py
A reader with no harness session is told to run `leaf delivery ack <id> && leaf wait <page>`. A page directory with a space split into two arguments, so the acknowledgement succeeded and the wait was refused. The page path is now shell-quoted. Co-Authored-By: Claude Opus 5.5 <[email protected]>
leaf-agent
previously approved these changes
Oct 25, 2026
The status event's `detail` and export's `--version 0` left this branch earlier, but a process test still passed `declare` a detail, and the unstamped-export test asked for v0, which Click's range now refuses before export reads it. The export test asks for v9 instead. Co-Authored-By: Claude Opus 5.5 <[email protected]>
leaf-agent
approved these changes
Oct 25, 2026
max-sixty
added a commit
that referenced
this pull request
Oct 25, 2026
main's #3850 renamed `leaf task open` to `create` with `--title`, and `start` now takes its status line as `--text`, so the On Claude test creates its to-dos that way. main's #3880 test pressed Show on a folded On me card; it now opens the card first. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
added a commit
that referenced
this pull request
Oct 25, 2026
The thread-head to-do test added in #3880 called `todos.cmd_open`, which #3850 had renamed to `cmd_create`. It failed during setup before exercising the title and Done control in [main CI](https://github.com/max-sixty/leaf/actions/runs/40161766827). Use the current creation API, as the adjacent thread-task test already does. The focused test fails with `AttributeError` before this change and passes afterward, including immediate removal of the to-do line while delivery is held. Product behavior is unchanged. Co-authored-by: leaf-agent <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Oct 25, 2026
Takes main's TODO.md, whose backlog moved to GitHub issues in #4090. The new Codex delegation test called interact_support.declare with a status detail, which main dropped in #3850; it now declares the bare state. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Oct 27, 2026
Main's #3942 holds a stamp's publication as the next activation's answer, keyed on the source reading taken before the check, and #3850 renamed --from-directory/--if-source to --replace. The stamp in place already takes those readings before its unlocked check, so _stamp_locked now receives them and holds the publication; the replace path takes them before its locked check. The note names --replace. Co-Authored-By: Claude Opus 5.5 <[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.
Trims the
leafCLI to one spelling per operation and moves the rules the CLI enforced to the modules that own them. Every caller (shipped references, registry handling text, evals, leaf-dev, docs, examples, tests) moves with each rename; there are no aliases.Commands and options agents call
thread open→thread create;task open PAGE SUBJECT TITLE→task create PAGE SUBJECT --title TITLE.task startandtask endtake their words as--text. Ids and choices stay positional, and free text is always an option.page stamp --replace DIR DIGEST, andserver run|start --lifetime session|persistent|temporary.leaf wait --ack(deliveries now sayleaf delivery ack <id> && leaf wait <page>),page transcript,thread reply --attempt,thread reply --failure. A harness that gives up still posts the failure receipt throughthread.fail_answer.MESSAGEeverywhere.Rules moved to their owners
post_reply's alone; threadlesspage state --limitis refused before the page is read (it used to publish a revision first).post_responsederives its own retry key and takes noattempt.file bindandpage mediaprint records their owning modules return;cmd_reportmoves to a newreports.py.Protocol bump to 24. Every writer of a
statusevent passeddetail: "", so the field is gone from the kernel registry's status record and the served status is{state, ts}. A Leaf at the previous protocol requiresdetailon every status record, so$events.protocolmoves from 23 to 24 (main took 23 while this branch was open).Each commit message carries the detail for its change.