Skip to content

Answer a work-asking message first with a line in its thread - #1926

Merged
max-sixty merged 4 commits into
mainfrom
agent-ac023ae03bfde1482
Oct 7, 2026
Merged

max-sixty merged 4 commits into
mainfrom
agent-ac023ae03bfde1482

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

When a message asks for work, the agent's first command is now a one-line ephemeral reply in its thread saying what it will do, and that reply also takes the move in hand. Before, the instructions had the agent start the move with leaf task start, which shows only a Working label, so the user read no words until the final answer.

In two leaf-dev journey cc runs, the first tool call was that reply, such as "Adding a card for release f5712f3's passed deployment checks to the board.", at 7.0 s. On main, nothing appeared in the thread until the answer at 21–26 s. Answers came at 18.6 and 23.1 s. Codex over App Server already opens each turn with a streamed message, so it uses none.

Leaf (thread.py, tasks.py). An ephemeral reply to a move the agent owes writes the same start a leaf task start does, in the same transaction, with its text as the Working line. That holds whether the move is named with --for, inferred from the delivery, or reached through a thread that owes a reply. tasks.take_in_hand is the one writer of a start. The update must be one line, since it is also the banner's line; longer text is refused with the reason. An update on a thread that owes nothing starts nothing. leaf task start stays for later phases, for tasks, and for moves on page widgets. The Stop hook is unchanged: a turn that took the move in hand may end before answering, as after task start.

Instructions. conversation-loop.md, "When to write", owns the rule. The comment's handling clause in registry.json now names the ephemeral reply instead of leaf task start. SKILL.md "Stay responsive", threads.md "Progress updates" and event-batches.md point to it. docs/how-it-works.html shows the same first command in its comment flow, and that flow now replies once page check passes, as #1884 settled, instead of rendering and stamping first.

Measurement. leaf-dev journey took the first reply as the answer, so it would have timed the update as replied. It now skips ephemeral replies and reports the update as sinceAdmissionMs.progress. The delivery and usability evals count the update as taking the move in hand, not as the answer.

Evals. New case first-command-says-what-comes: base 0/5, change 5/5 on both Claude Code and Codex. All 13 wait-loop and thread cases pass their judged checks; a few regex checks failed only on a command split across lines with \. work-names-its-item and claude-hook-delivery-needs-no-ack now accept the update where they required task start, and thread-named-in-its-reply accepts a title on the update, which names the thread sooner.

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

max-sixty and others added 4 commits October 6, 2026 10:03
Behaviour change: an ephemeral reply to a move the agent owes now also
takes that move in hand. `leaf thread reply --ephemeral` (by `--for`, by
the inferred obligation, or by naming a thread that owes one) appends the
progress reply and a `start` on the move in one transaction, with the
update's text as the Working line, so the user's first sign of the agent is
its words in the thread and the banner shows the same line. Such an update
must be one line, as a start's line is; an update on a thread that owes
nothing takes nothing in hand and may run long. `leaf task start` stays for
later phase changes, tasks, and page-widget moves, which have no thread.
`tasks.take_in_hand` is the one writer of a start for both commands.

Instructions: the delivered `answering.reply` clause and
conversation-loop.md "When to write" now make that one-line progress update
the first command after a delivery that asks for work, before reading or
editing anything; SKILL.md "Stay responsive", threads.md "Progress
updates" and event-batches.md point there. how-it-works.html describes it.

Tooling: the journey no longer takes a progress update for the answer, and
reports it as `sinceAdmissionMs.progress`; delivery and usability evals
count an ephemeral reply as a start and not as the answer. New eval
`first-command-says-what-comes`; three rubrics accept the progress update
where they required `task start` or a title on the answer.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	docs/how-it-works.html
The journey reports `sinceAdmissionMs.progress`, the agent's first ephemeral
update, and this sample has none.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty max-sixty closed this Oct 7, 2026
@max-sixty max-sixty reopened this Oct 7, 2026
@max-sixty
max-sixty merged commit 601f8e0 into main Oct 7, 2026
6 of 7 checks passed
@max-sixty
max-sixty deleted the agent-ac023ae03bfde1482 branch October 7, 2026 00:54
max-sixty added a commit that referenced this pull request Oct 7, 2026
`leaf-dev journey-chart` prints an `lf-chart` element from the journey
samples this machine kept (`$XDG_STATE_HOME/leaf-dev/journey.jsonl`,
#1881), so reading them no longer means copying numbers into a page by
hand.

The chart has one row per target at the latest code version that target
ran, and a dot for each sign the user saw: the thread's title, Working,
the agent's first words (the ephemeral reply from #1926), and the reply.
The x-axis is seconds after the comment, on a log scale. A step a run
never reached draws no dot. With no samples kept, the command says to
run `leaf-dev journey` first.

Each sample now also records `target`, which stays the same across runs:
`cc`, `codex`, `local`, `wrangler`, or the website's origin. The chart
groups by it, because a local or wrangler run's `origin` is a fresh port
each time. Samples kept before this change name their target by their
harness.

Its output on this machine's samples passes `leaf page check --render`,
light and dark.

`TODO.md` records this as an experiment: whether `leaf-dev` should draw
charts, or only print the rows and leave the chart to the agent writing
the page.

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

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 11, 2026
…behind "1 new reply" (#2294)

A Codex reply now streams into an open thread card as the agent writes
it, and the agent's answer completes that same message in place. Before,
an idle open card showed an empty agent bubble behind "1 new reply"
until the user pressed it, and held the answer again as an edit.

Since #1926 the agent's first move is a progress acknowledgement, so
nearly every answer folds progress or completes a streaming placeholder,
and the card's hold on changes to existing messages held almost all of
them. Journey runs (#2144) showed the notice on every Codex reply.

### What changes

- **One name for a reply and its answer.** The server adds a streaming
reply to its thread once it has words, and draws it and the input's
first answer under one key, `response:<input>`
(`served_state/thread.py`). The browser draws a message under that key
(`messageKey`, `thread/model.js`), so the answer completes the stream
rather than arriving as a second message. `thread.is_answer` is the one
rule for what counts as an answer, so a failure receipt keeps its own
name; a second answer in the log keeps its own id.
- **Held news reads a stream as arrival** (`thread/held-news.js`). Words
joining a streaming reply, and its answer completing it, are the reply
arriving, not an edit. An answer folding the progress run at the
thread's end shows at once in an idle open card (`footFold`), unless the
reader stands in that progress by focus or selection. Notices now say
"new reply", "new message" (the user's own, from another tab) or
"message edited".
- **Where the user stands is read once** (`focus.js`,
`standingNodes`/`standsOn`): focus, then the selection's ends.
`standingPlace` and the held-arrival lapse use it.
- **A message sent while the agent streams** goes above the streaming
reply, so its acceptance moves nothing.
- **An open progress group draws its border around its messages** rather
than padding them in (`styles/components/surfaces.css`). With #2219's
inset padding, the fold above moved the words the reader was on 13px
right and 11px down. Its messages now line up with the rest of the
transcript; the group otherwise looks as before.
- **Journey timing** records when the reply's own message came into view
(`responseMessageVisible`), apart from its row or notice.

### Testing

Eight new browser journeys in `tests/test_render_threads.py` cover
streaming into an open card, a held card counting the stream once, a
send during a stream, an answer completing its stream with the same
words, the foot fold under the shift watch, a selection holding the
fold, and no change above the fold. Runtime tests, the fold-related
render tests, and the thread appearance snapshots pass locally. Real
`codex-app-server --browser` and `claude-code --browser` journeys showed
no notice at any step, with the stream visible about 2.1–2.4 s after
send.

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