Repository navigation
Read every plan step's state from its records, and head On <agent> with the plan - #6707
Merged
Merged
Conversation
…th the plan
The plan outline could say what the work no longer did. A plain step carried a
state the agent set, held until the next rewrite: in the plans on this machine
(11 pages, 51 plan events since 20 October), 73 of 208 plain steps were set
`working`, and on 6 of the 11 pages the last plan still said a goal was under way
hours or days after the agent's last event. A finished plain step had no end to say
where its result was, so 68 of 208 titles carried it themselves ("Build it and open
pull request #6121"). And the plan drew only behind a press at On <agent>'s foot,
two presses from the page, which is one reason the user says they have seldom used
it.
Every step's state now comes from a record Leaf already keeps:
- A step is a heading (`title`, no state) or names an `item`, a to-do or an
obligation. A heading reads its state from its steps: done once each step not
dropped is done, under way while one is, open otherwise. A heading with no step
under it is refused (`plan-empty-heading`), since nothing would decide its state.
- `leaf task plan` takes `{"todo": "<title>"}` for a new step: it opens a to-do on
the page and writes the plan naming it by id, admitting the to-dos and the plan
before appending any, so a refused plan opens nothing. The agent starts and ends
a step's to-do as any other, so the plan follows the work without a rewrite, and
a start lapses with its turn instead of reading `working` for days.
- A finished to-do's end detail is served on its step (`detail`), and the panel
draws it under the step, where a running step draws its running line.
- The `plan` event's plain-step `state` is gone, so the page protocol moves from 53
to 54.
On <agent> now opens with the plan's goals over its list whenever a plan stands,
and the list under them holds only what no step names, so each item stands once.
The `Plan n of m` disclosure at the view's foot, its bar and `planShown` are
removed. This reverses the user's earlier pick of that disclosure; it is put back
to them with before and after stills.
`schema_complaint` now goes inside a `oneOf` where one branch has strictly fewer
errors than every other, so a plan step with a `state` it no longer takes is
refused with "('state' was unexpected)" rather than "not valid under any of the
given schemas". Where branches tie, as a comment with neither text nor token does,
the complaint stays on the `oneOf`.
`conversation-loop.md`, "When to write", asks for a plan when work runs to several
steps and past the turn the agent is in, with user steps as an example rather than
the condition, and gives the new step shapes. `plan-shows-multi-step-work` gains
an `agent-only` variant for that broader trigger. The `plan` usability case's
rubrics and its resume fixture follow the new shapes.
Tests: `test_a_plan_reads_each_steps_state_from_the_records_it_arranges` replaces
the plain-step test and covers headings deriving their state, a `todo` step opening
its to-do, a lapsed start, end details, the empty-heading refusal and a refused plan
opening no to-do. The panel test checks the plan heading On Claude without a press,
a finished step's detail, and the named to-do left out of the list below. The
phone tabs test loses its plan-head exception. The `plan-head` still becomes
`on-agent-plan`.
> _This was written by Claude Code on behalf of max-sixty_
… step, and land several events through one door Codex's review of the first commit found three defects, each reproduced: - A plan step read its to-do's raw start, so a start activity had aged out still drew the step and its goal as under way. WorkReading.plan now takes the to-dos as the page serves them. The model test seeds a start from January and checks its step reads open; it failed before. - A finished step's detail was cut to one line with no card to open it whole. It now wraps. - A to-do or obligation at depth 0 drew as a bare heading with no mark or result. It now draws as a step. The panel test adds one, ended with a long result. The review also found that plans.py's dry-run admission repeated the preflight thread.py's edit already did for a rename. event_contracts.append_all_admitted now admits several events in order and appends them only once all pass; cmd_plan and cmd_edit both use it, and cmd_plan names its new to-dos by ids it allocates, so the plan can name them before they are written. The plan eval found Claude Code leaving a later step of the user's, a laptop test only they can run once the patch exists, out of the plan in 3 of 3 runs, since such a step is neither the agent's to-do nor an obligation yet. conversation-loop.md now says such a step is the agent's to-do to have it done, with the question's obligation put under it once asked. The body-route test in test_interact_product.py writes its plan in the new shape. > _This was written by Claude Code on behalf of max-sixty_
…f it Codex's second review confirmed the first round's three findings fixed and found that append_all_admitted's preflight skipped attempt matching: two events sharing an attempt with different payloads passed it, and the first was written before the second raised AttemptConflict. No caller writes such a batch, but the helper promises all or none, so the preflight now matches attempts against the trial log too. A test in test_admission.py fails without the change. > _This was written by Claude Code on behalf of max-sixty_
max-sixty
added a commit
that referenced
this pull request
Nov 23, 2026
…6710) The served state named where work stands in thirteen enumerations: a delivery stage, a failure condition and its operation, a to-do's state, a plan step's, an obligation's status, a thread's attention, the page's activity kind and seven counts. `waiting` meant the user's turn on the page and the agent's in a thread. Every obligation record, every update's delivery, every to-do, every plan step, each thread and the page now say it in the same fields: `next_actor`, `state` (`waiting`, `running`, `blocked`, `done`), the `reason` a state leaves out, and how a done one ended (`outcome`). This answers the entry "Make tasks and work in progress clear" in `notes/TODO.md`. This is the first of two pull requests, split at Max's request. Here a to-do keeps its own served list and takes the new fields; #5979, on top of this one, makes a to-do an obligation record and deletes that list. ## Where to look - `src/leaf/standing.py` is the contract: the vocabulary, which record speaks for a place, and what a job that outlives a turn is (whatever holds an item's start other than the turn that wrote it). - `src/leaf/activity.py` is the one producer of `running` and `blocked`, for each delivery, each update's record, each to-do and the page. The page reads the agent's side of all of it beside `presence` (here, away, gone, closed). - `src/leaf/served_state/state.schema.json` loses `Stage`, `Attention`, a workflow's `condition` and `at_work`, `Obligation.status`, `Activity.kind` and a plan step's `owner`, and gains `WorkState`, `WorkReason` and `Outcome`. - In the browser, `thread/workflow.js` words every standing and `activity-words.js` the page's. ## A thread the user resolves Two rules, both from a week of Max's own use: on the 13 pages he used that week, 63 threads were resolved over a message the agent had not answered, 50 of them within four seconds of sending. By my reading 39 ask for work or an answer and 24 close the exchange. - The request stays owed (`events.owed_turns`). The user's resolve takes a thread off their list and settles nothing the agent owes in it: the message keeps its record and its place on the agent's list and holds the Stop hook. The agent's own resolve still answers for a thread. This stands beside #6106, under which either side's resolve ends the questions the agent asked there. - The thread stays closed until someone reopens it (`thread.post_reply`, a reply's `unannounced`). What the agent says in a thread the user resolved goes into it without reopening it, the status line announces none of it (`announces` in `thread/model.js`, which `isNews` reads too), and the reply's record says so (`stays-closed`), since the user's resolve reaches the agent only where it retires a question the agent asked. `leaf thread reopen` is the agent's choice to bring the thread back, with the `unresolve` event the user's Reopen writes. `threads.md` gives the goal and no rule: the user closed the thread, so it returns only for news they would want to stop and read, such as that the agent could not do what they asked. A question to the user there reopens it by itself. A Codex turn's final message prints its agent nothing, so the turn's handling has it post such news by command. Max picked both halves: the answer leaves the thread closed, and bringing it back is the agent's call (root `AGENTS.md`, "Leaf's role"). What follows: when this lands, each session still holding a page is asked to answer the old messages its user resolved this way, among them `/gpk` and `/dispatch` commands. A logged user `resolve` takes a new meaning, a `reply` gains a field and an `unresolve` may be the agent's, so the page protocol moves from 53 to 54; the plan-outline work in #6707 also takes 54, so whichever lands second moves to 55. ## What users see differently The research note's scenarios S1–S15, built as real logs with 62 checkpoints, ran on `main` and here; their builders have left the tree since and are at d986f9c. The words on every surface are identical at 40. At 11 the live words change: the 5 where the panel and the thread contradict each other about the same work, an update the agent started whose turn then ended with nothing watching (the panel now asks for a nudge), a dialog open in the agent's own window (the thread says Waiting in the terminal), and the 4 where the user resolved a thread before the agent answered. At 11 only the Done list changes: at 10 a request answered with a promise no longer reads Answered while its to-do is open, and at 1 the request the user resolved is listed as Answered once the agent answers it in the closed thread. A to-do whose start stopped or went quiet keeps the line it last said under Stopped or Gone quiet, and the receipt word Up next is gone. ## A preview fix that rides along A pointer moved onto a control whose face redraws within the preview's 200 ms dwell got no preview until it left and came back: the `pointerover` the browser sends for the new node under the resting pointer cancelled the dwell, whatever had arrived (`preview.js`). The dwell now ends only when another target arrives under the pointer, or the pointer carries a press. This pull request's `test` job met it in the feature gallery's journey, which the change edits. On Linux a margin entry's centre lies on the edge of its icon's stroke, and the innermost node there flips between the icon's `svg` and its `path` as the entry repaints. The journey failed in 5 of 13 Linux runs of this branch and in none of 15 of `main` and #6762. Six traced copies of the step in the Linux job, [on this branch](https://github.com/max-sixty/leaf/actions/runs/45268635289) and [on `main`](https://github.com/max-sixty/leaf/actions/runs/45268643151), showed the dwell armed on the `svg` and cleared 6 and 9 ms later in the two that failed; they did not show why the `svg` comes first more often on this branch. [With the fix](https://github.com/max-sixty/leaf/actions/runs/45273513465) all six show the preview, four of them through a redraw that cancelled it before. `test_a_target_redrawn_under_the_pointer_that_came_to_it_still_previews` holds the fix in Chromium and Firefox and fails in both without it. ## What it costs - The public package API changes: an obligation record has `state`, `reason`, `outcome` and `answered` in place of `status`, and a thread's `attention` is a record or a to-do. `lf-deck`, `lf-tabs` and the feature gallery are updated. - A to-do in `leaf page state` says where it stands in the new fields, and `conversation-loop.md` teaches that reading. - The row record moves to format 54 with the protocol, so a page served by an older Leaf and one served by this do not list each other. - 133 files, +4,989 −2,732, and the code is no smaller. Python and JavaScript outside tests gain 125 lines of code, of which #5979 removes 76, and 92 decision points, 56 of them in `activity.py` and `activity-words.js`, which decide and word the liveness cases above. `canonical_activity` goes from 278 lines and 61 decision points to 298 and 82. Tests are +2,189 −1,212, and the new eval case is 709 lines. What shrinks is the contract: across the stack the schema's enumerations for where work stands go from 12, with 43 values, to 6 with 22. ## Checks - Evals, Claude Code against `main`'s instructions, three samples a case on the 22 cases whose tags cover the changed passages: 55 of 66 pass on the stack's text and 54 of 66 on `main`'s, and no case differs by more than one sample. `resolved-request-stays-owed`, new here, passes 10 of 10. After Max's call that the agent decides when a resolved thread comes back, that case ran again, five samples a variant: given a request it cannot carry out, 5 of 5 agents reopen the thread, both where the delivery shows it resolved and where only the reply's record does, against 0 of 5 under the rule before, where only a question reopened it; an answer that delivers what was asked leaves it closed 5 of 5 in each. On Codex, 5 of 5 turns post such a request by command, against 0 of 5 with the rule only in `harness-codex.md`, and 5 of 5 leave an ordinary answer to the final message. The suite read the stack's final wording; the wording of the to-do reading that only this pull request carries has no score of its own. - The Claude Code agent journey, which the change to `hooks/claude-code.ts` calls for, passes every step. Its `withdrawn` step changed: a resolve that changes nothing the agent owes reaches no hook here, so the step takes the comment back. - `tests/model`, `dev/tests/model`, `tests/smoke`, the runtime's Node tests and `pnpm run check` pass here. [A manual dispatch](https://github.com/max-sixty/leaf/actions/runs/44976806053) of every product test, on Linux and macOS, ran on the unsplit branch as it stood before the closed-thread rule was widened. 25 tests failed, 2 because of this change, and both are fixed: one passes under the rule as it now stands, and the other, the Undo row's age, assumed the user's resolve leaves nothing owed, so its fixture now has the agent answer first. The other 23 fail without this change: in `main`'s nightly run or another branch's full run on 21 November (9), on `main` until #6713 and #6717 (5), on `main` today, run there by name (7), or on macOS only (2). [A second dispatch](https://github.com/max-sixty/leaf/actions/runs/44996782669), of this branch beside [`main`'s own](https://github.com/max-sixty/leaf/actions/runs/44989336653), failed no test on Linux that `main`'s run passed. On macOS it failed six that `main`'s run passed, and none of the six fails in six runs by name on this tree on a Mac; `main`'s macOS job failed four that this branch's passed. - `test_an_exact_workflow_reports_stale_work_beside_a_live_page_claim`, a journey test this change edits, has failed on `main` since #6796, whose checks never ran it: its helper now opens threads in the panel, and the test goes on to read a card. Here it chooses cards again first. Max asked for this as one of the long-stuck design questions. No person has read it. Codex reviewed the model and the first resolve rule, the review bot the unsplit pull request and this one, and fresh agents the 21 November merge with `main`, the closed-thread rule and the agent's reopen; their findings are fixed. > _This was written by Claude Code on behalf of max-sixty_
Main's work-state vocabulary (#6710) and to-dos as obligation records (#5979) meet this branch's plan. A heading now reads the standing of the records its steps name as any place holding several does (standing.leading), and once none is open, done or failed; a to-do step's detail is its record's end. Main took the protocol to 54, so this branch's change to the plan event takes 55.
leaf-agent
reviewed
Nov 24, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
The description says the page protocol moves from 53 to 54 and that whichever of this and #5979 lands second takes 55. #5979 has merged, and this head already moves $events.protocol from 54 to 55 in browser/runtime/kernel-registry.json. Since the description becomes main's commit message on the squash, the protocol sentence and the #5979 bullet should say 54 → 55.
A goal over Publish (done) with Verify (failed) under Publish read done, while Verify beside Publish made it failed. A heading now reads both its open standing and its end from the records its steps name at any depth; done of total still counts its own steps.
Main took protocol 55 for the layer record's format (#6954), so the plan event's schema change here moves the page protocol to 56.
max-sixty
marked this pull request as ready for review
November 24, 2026 18:31
leaf-agent
approved these changes
Nov 24, 2026
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.
Leaf's plan outline now reads every step's state from a record Leaf already keeps, shows where each finished step's result is, and heads On rather than hiding behind a press at its foot. Max asked for the outline to be made much better rather than removed, having seldom used it.
A step is a heading (
title), whose standing comes from the records its steps name (standing.leading, as for any place holding several), or names anitem, a to-do or a question on the user's list;leaf task planopens a to-do for each{"todo": "…"}step. Progress isleaf task start/endon the step's to-do, not a rewrite, and a start lapses with its turn. The typedstateof a plain step is gone, so the page protocol moves from 55 to 56.To weigh:
Plan n of mdisclosure; Max chose it on the review page.leaf page closerefuses until each is done or dropped, as for any to-do.event_contracts.append_all_admittedlands several events together or not at all;task planandthread edituse it.schema_complaintnow names the field an old-style step gets wrong.Evidence: 11 of 216 pages since 20 October held a plan, and 68 of 208 plain-step titles carried their own result. The plan evals pass 18 of 18 on both arms (three runs per harness and case), and the live
plantask and its resume variant pass on Claude Code: the agent planned withtodosteps, ended each as it finished, and dropped the step the user cut, with a reason.Codex reviewed twice; its four findings are fixed, each with a test that fails without the fix. Tests: the plan model tests, the On Claude panel test, the phone tabs test, a batch-admission test.