Skip to content

Serve each to-do once under page protocol 12 - #3210

Merged
max-sixty merged 4 commits into
mainfrom
shrink-todo-copies
Oct 20, 2026
Merged

max-sixty merged 4 commits into
mainfrom
shrink-todo-copies

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

A to-do still reached page state and the browser three ways: its record in todos, a copy of its title, start and voice in its On me or On row, and a copy of its title and start line in its thread's attention.todo. #3101 kept the row and attention copies because the banner's side panel read them. The banner is gone (#3100), so this change shrinks both to ids, as #3184 did for item rows (now obligation rows, #3196).

Served state. A to-do row now carries what an obligation row does (kind, id, owner, subject, thread, live), and a thread waiting on a to-do names it by id in attention.todo (served_state/queues.py, served_state/browser.py, state.schema.json).

Browser. The publisher (localQueues in application.ts) joins each to-do row to its current record as todo, as it joins an obligation row as obligation. queueTitle, the panel's On card and the status explanation read the title and start line from that record. module-reading.md says a readQueues() to-do row carries todo.

Agent instruction. conversation-loop.md now says a row names its obligation or to-do by id, and that a to-do's record in todos holds its title and the start running on it. The new eval case on-lists-read-todo-records gives the agent a shrunk reading whose todos are listed in a different order from the rows, then asks what waits on each side. On Claude Code the merge base passed 2 of 2 and the change 2 of 2, both before and after merging #3196's rename. Agents already joined the rows to their records; the new line keeps the reference accurate.

Protocol 11 → 12, since a page vendored at 11 reads a to-do row's title from the row. The delivery-format snapshots move with it.

Tests: pnpm run check:framework, pnpm run test:runtime, the model todo, workflow, obligation, activity and fold tests, the interact-contract snapshots, the served-state schema test, and two browser tests (a to-do on the user ending from the panel, and the Plan tab's place line).

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

max-sixty and others added 2 commits October 19, 2026 18:58
A to-do still reached `page state` and the browser three ways: its record in
`todos`, a copy of its title, start and voice in its On me or On <agent> row,
and a copy of its title and start line in its thread's `attention.todo`. #3101
kept the row and attention copies because the banner's side panel read them;
the banner is gone (#3100), so they now shrink to ids.

A to-do row now carries what an item row does (`kind`, `id`, `owner`,
`subject`, `thread`, `live`), and a thread waiting on a to-do names it by id
in `attention.todo`. The browser's publisher joins each to-do row to its
current record as `todo`, as it joins an item row as `item`, so
`queueTitle`, the panel's On card and the status explanation read the
to-do's title and start from that record. `module-reading.md` says a
`readQueues()` to-do row carries `todo`.

`conversation-loop.md` now says a row names its item or to-do by `id`, and a
to-do's record in `todos` holds its `title` and the start `running` on it. The
new eval case `on-lists-read-todo-records` hands the agent a shrunk reading
whose `todos` are listed in another order than the rows; on Claude Code the
merge base passed 2 of 2 and the change 2 of 2, so agents already join the
rows to their records, and the line keeps the reference accurate.

The protocol moves from 10 to 11, since a page vendored at 10 reads a row's
title from the row.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
leaf-agent previously approved these changes Oct 20, 2026
max-sixty and others added 2 commits October 19, 2026 19:09
# Conflicts:
#	build/browser/application.ts
#	build/browser/contract.d.ts
#	build/browser/protocol-contract.d.ts
#	build/browser/queues.test.mjs
#	skills/leaf/assets/runtime/queue-title.js
#	skills/leaf/assets/vendor/browser-runtime/application.js
#	skills/leaf/kernel/kernel.json
#	skills/leaf/kernel/runtime/bundle-document-identity.js
#	skills/leaf/kernel/runtime/bundle-queued-work.js
#	skills/leaf/references/conversation-loop.md
#	skills/leaf/references/module-reading.md
#	skills/leaf/scripts/leaf/served_state/queues.py
#	skills/leaf/scripts/leaf/served_state/state.schema.json
@max-sixty max-sixty changed the title Serve each to-do once under page protocol 11 Serve each to-do once under page protocol 12 Oct 20, 2026
@max-sixty
max-sixty merged commit 0ad5d52 into main Oct 20, 2026
3 checks passed
@max-sixty
max-sixty deleted the shrink-todo-copies branch October 20, 2026 02:26
max-sixty added a commit that referenced this pull request Oct 20, 2026
…3229)

An update the user hands over now publishes an obligation record beside
the ones widgets and sign-off make: `update:<event-id>`, with `source:
{kind: "update", id, subject}` naming the input and the thread or widget
it stands on, plus the usual `thread`, `message`, `prompt` (no words of
its own), `answer`, `status`, `end` and `next_actor`. The agent is its
next actor while it owes the update a reply or a version, the user once
a harness hands it back to send again, and nobody once a reply answers
it, which `answer.event` names. `obligations.response_address` derives
the operation that answers a record; nothing stores it.

What publishes one: the newest unanswered turn in an open thread, the
newest unsettled owed action on a widget's unit (a frozen widget's owes
a reply, a page widget's a version that writes it in), an update a
harness handed back, and every input a reply answered (answered by the
first such reply in the log). Of turns the user sent in a row only the
newest publishes a record, and every workflow in the run names it. An
action that owes nothing, an unanswered turn in a thread resolved first
and a superseded failure publish none; a settled page action leaves the
inventory, since its widget's record carries the ending.

One fold, `workflows.handed_over`, emits the records and the workflows
together, so the run-of-turns, newest-per-unit and failure rules are
written once. `WorkReading.updates` serves the records beside
`.workflows`; each view serves them in its `obligations` after the
widgets' and sign-off's, which they depend on.

The On lists are one selection by next actor (`served_state.queues`): On
me is the open records on the user (what the page asks, then updates to
send again) plus the user's to-dos; On <agent> is the open update
records on the agent, in the order of their strongest workflow, plus the
agent's to-dos; Done is every closed record plus the ended to-dos. The
`resend`, `answer` and `work` row kinds are gone: every row but a
to-do's names a record by id, its kind the record's `source.kind`. A
widget's record turns the agent's only while a thread about it awaits
the agent's word, whose newest turn already publishes an update record,
so On <agent> lists update records alone and the widget is listed once,
through the comment.

Thread attention reads the open records in the thread: a widget's on the
user is `needs_user/widget`, an update handed back `needs_user/resend`,
any on the agent `waiting` (`workflow` or `uncertain`), naming the
strongest workflow serving it, else an agent to-do. No reason changed
name.

The workflow keeps its delivery stages and evidence and names the record
it serves (`obligation`); it no longer carries `answer`, `next_actor` or
`holds_thread`. `activity.obligations`, the answers the agent owes, is
now built from the agent's update records: each the workflow of the
record's input with the record's id as `obligation` and the owed
`answer` (address plus the delivery's ref, received mark or turn
reservation). The Stop hook, `leaf status idle`, `current_responses` and
the deliveries read it unchanged in shape. The served state lists it as
record ids, which the Worker's agent dispatch and `leaf-dev journey`
read; `page state` prints each as `{id, answer}`, so an agent recovers
what it owes, and the ref to answer it with, without a delivery
(conversation-loop.md says where).

In the browser, a send publishes its own local update record (the answer
it is owed, one per thread for the newest), which hides the server's
update records in that thread until the server reads the send, and a
refused send or move publishes the resend it leaves; `localQueues` lists
those records like the server's.

What the user sees change, each rare:
- A. The agent working on the older of two messages in a row showed two
On <agent> rows (an answer row and a work row); it shows one, labelled
Working.
- B. A widget action held by a to-do's start showed a work row beside
the to-do's row; it shows the to-do's alone.
- C. A start on an action that owes nothing (a card move with no
question) loses its On <agent> row and its thread's Working attention;
the status line and the receipt still show the work.
- D. A second reply to an already answered input adds no Done row of its
own.
- E. A thread holding two handed-back updates, or a handed-back message
and a question the agent asked after it, shows a row for each on On me
instead of one; the thread reads as the question and `m` stops at it
once.
- F. "update(s) with work started" leaves the status's "Waiting on
<agent>" words. Every other row word, count and label ("Waiting on me",
"My turn to resend/answer/retry", "N updates to send again", "N
replies", "Sent 3m ago") is unchanged.

The served state drops row kinds and workflow fields a page vendored at
11 reads, so the page protocol moves to 13 (main reached 12 with #3210).

Measured on the served state (`full_state`) of the largest example,
corpus.html (one view): 1,297,561 bytes before, 1,300,953 after (+3,392,
+0.26%). Its view's `obligations` grew from 12,460 to 16,667 bytes (45
to 53 records, about 525 bytes per update record) and its `queues`
shrank from 9,401 to 8,587 bytes; Done holds 9 rows either way.
ship-review.html: 20,080 to 21,325 bytes.

Tests: `test_update_obligations.py` holds the new contracts: two
messages in a row publish one record that both workflows name; a
discussed widget is listed once, through the comment's record (page and
frozen); and the answers that hold the Stop hook and refuse `idle` on a
page with a run of two messages, a finished frozen queue, a page pick, a
draft edit and a handed-back message are exactly the ones the previous
code owed, which the same test passed against that tree.

> _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