Skip to content

Let an agent's thread message hold HTML in its Markdown, and drop --markup - #6208

Merged
max-sixty merged 9 commits into
mainfrom
agent-message-html
Nov 16, 2026
Merged

max-sixty merged 9 commits into
mainfrom
agent-message-html

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

An agent's thread message is now one Markdown body, and HTML anywhere in it draws where it is written, as in a GitHub comment: a <code class="language-math"> formula mid-sentence, a table between two paragraphs, an lf-options choice. --markup is gone from leaf thread create and leaf thread reply, along with the event field it filled and its consumers. Copy as Markdown copies the message's text, HTML included.

Max asked for this after #6165 left an inline formula needing --markup.

What to weigh:

  • Who reads HTML. Only text the agent writes with a leaf thread command draws its HTML. A Codex turn's final text, progress lines, failure receipts and the clerk's messages keep tags as words, since they are written for a terminal or streamed, and a stray Option<String> would otherwise vanish or refuse the answer. So the log marks a message whose text holds HTML with html: true, set only where keeping HTML changes what it draws. What the user types stays text.
  • One body, two parsers. Python renders the message (markdown-it-py) to check and read it, and the browser renders the same text (markdown-it) into the authored island. tests/message_html_cases.json holds both to the same elements and words. Two dialect rules make agents' HTML land where they mean it, both in each runtime: a custom element opening a line runs to its closing tag, blank lines included, as <pre> does (otherwise a blank line in an lf-code body ended the block), and a <code> element's content is literal, so LaTeX keeps its backslashes and asterisks. A block widget written after words on its line is refused with advice to start it on its own line. Since the log keeps only the text, a later change to that reading bumps the protocol (layer-registry.md, "Page protocol"); logging the rendered markup beside the text instead would bring back a second copy of each message and draw these messages through a renderer no other message uses.
  • A message holding HTML is frozen whole. leaf thread edit refuses it, where before only its markup was frozen; the agent posts a correction instead.
  • Hosted pages. The browser now addresses the media an HTML message names, as it already did for Markdown images; the server no longer rewrites message text, which had altered code examples.
  • Protocol 46, and deliveries at format 46, since the event and delivery shapes changed.

threads.md and the delivery clauses now teach the one-body form. Scored on Claude Code with the changed text: thread-choice-takes-a-press, answer-quotes-what-it-cites and answer-hands-back-the-next-move/turn-writer passed all 16 runs, and the choices and <details> quotes the agents wrote post through leaf thread. Reviewed by Codex, whose six findings are fixed here, and by the PR's auto-reviewer, whose design point the protocol note above answers.

Ran uv run pytest tests/model tests/process, pnpm run test:runtime, pnpm run check, and the browser and journey tests whose fixtures changed most (11 ids).

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

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

Each reading rebuilds the drawn markup, in two runtimes, instead of reading what admission checked. The event now stores text plus html: true. Every later reader renders the text again: Python through message_markup (thread_context._fragment, sample_content, data_contracts), and the browser through its own copy of the dialect (elementBlock, codeElement, renderAuthoredMarkdown). Admission checks Python's rendering at the time the message is posted. What the user sees is the browser's rendering, done again on every load. The two agree only on the cases in tests/message_html_cases.json. Nothing ties a past message to the dialect it was checked under, and markdown-it-py and the vendored markdown-it are upgraded separately. So the widget ids, holds targets and obligations a logged message declares can move when a dialect rule or a parser version changes. The protocol rule would cover that change only if its author knew the dialect had become part of the log's meaning. That works against root AGENTS.md, "Validate once and share readings": "Admission writes the event's declared meaning into it, so later readers use those fields directly", and "Each fact Leaf derives about the page is derived once".

A cheaper change keeps every user-visible part of this PR: render once at admission, as drawn_markup already does, and log that markup beside the text. The browser would insert it as it inserted markup before, still scoping media addresses client-side as this PR does. Copy would still copy text, and leaf thread edit would still refuse the message. That drops the JS dialect port, its parity fixture, and the markdownReady precondition in prepareAuthoredMessage. The cost is a second copy of each HTML message's text in the log. If re-rendering at every read is meant to be the design, because a message's HTML should version with the serving runtime as plain Markdown does, then events.md or layer-registry.md ("Page protocol") should say that a change to the message dialect is a protocol bump.

Overlap: #6202 passes markup into open_thread/_put and documents --markup in threads.md. Both are removed here, so whichever lands second needs reworking against the other.

…ake a change to that reading a protocol bump
@max-sixty

Copy link
Copy Markdown
Owner Author

Thanks for the review. I kept the text as the one logged body and took your second option: src/leaf/layer-registry.md ("Page protocol") now says that a change to how an agent's message holding HTML reads, its parsers' versions included, that places an element differently bumps the protocol, with tests/message_html_cases.json holding the two parsers together meanwhile (8bf3d3d).

Logging the rendered markup beside the text would bring back the second field this change removes, and these messages would then draw through Python's renderer while every other message draws through the browser's, losing the blank-line spacing and the image viewer or porting them to Python. The two parsers are pinned, in uv.lock and the vendored bundle, so a reading changes only with a Leaf commit the note now governs.

On #6202: open_thread and _compose_and_append now take html and read the markup from the text, so a caller that passes markup= fails loudly rather than logging html: true beside text that lacks the HTML. #6202's clerk choice goes in the message text with html=True once this lands.

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

leaf-agent
leaf-agent previously approved these changes Nov 16, 2026
@max-sixty
max-sixty merged commit ed71a3c into main Nov 16, 2026
5 checks passed
@max-sixty
max-sixty deleted the agent-message-html branch November 16, 2026 20:26
max-sixty added a commit that referenced this pull request Nov 16, 2026
Merges main, where #6208 made an agent's thread message one Markdown body
whose HTML draws, and moves the turn-end check's choice onto it, as Tend's
review of #6202 asked.

Core no longer authors the `default` package's `lf-options` markup:
`clerk._choice` and the answer's `options` field are gone. The fork writes the
group in its ask's text, as `threads.md` ("Ask for a pick") has the agent
write one, and reads that paragraph and #6208's paragraph on HTML in a
message with the rest of the agent's guidance (`GUIDANCE`). "Ask for a pick"
now names the group's elements in its own sentence, since the fork reads the
paragraph without the example below it.

Leaf posts the text as the agent's `leaf thread` command does (`html` on
`open_thread` and `ask_again`). A widget in it that asks takes the question
(`thread.markup_asks`), and otherwise the message carries an obligation. Where
Leaf refuses the HTML, the fork has no next attempt, so the ask is posted again
in words, its HTML shown as text, and the agent's line says why; before, a
refused choice reached `apply_answer`'s re-raise and the ask was lost.

Admission's `_named_question_error` and `thread.thread_questions` now read a
thread's questions asked in words through one helper,
`obligations.questions_in_words`, so `leaf thread reply --obligation <id>` and
the fork's `again` agree on what a thread asks.
max-sixty added a commit that referenced this pull request Nov 16, 2026
…esses (#6202)

When an agent's reply leaves the user a question with a short, fixed set
of answers and puts nothing On Me, the turn-end check now opens the
thread with those answers as an `lf-options choose` group, the way
`threads.md` ("Ask for a pick") tells the agent to ask. Before, it asked
in words with an obligation. A clarifying reply such as "how stale can a
result get?" then answered the question, On Me moved it to Done while
the decision was still open, and `1`–`9` couldn't answer it. Part 2 of
the issue (On Me answering a thread's choice) landed in #6056.

## What changes

- **The fork writes the choice in its message.** The fork already writes
each ask's `text` as the agent's guidance has the agent write a message.
It now also reads `threads.md`'s "Ask for a pick" and #6208's paragraph
on HTML in a message (`clerk.GUIDANCE`), so where the agent offered
answers the user picks among, the text holds the `lf-options` group, as
an agent's own `leaf thread` message would. Nothing in core names the
widget, and the fork's answer schema is unchanged. "Ask for a pick" now
names the group's elements in its own sentence (`<lf-options id="…"
choose>` holding an `<lf-option id="…">` for each answer), since the
fork reads the paragraph without the example below it.
- **Leaf posts the text as the agent's command does.** `_ask` checks the
text as an agent's (`checked_text(..., html=True)`) and draws its HTML
(`thread.drawn_markup`), and `open_thread` validates that with
`check_markup` and marks the message `html`. A widget in it that asks
(`thread.markup_asks`) asks the question, and otherwise the message
carries an obligation, so HTML that asks nothing, such as a `<details>`
quote, still leaves the question On Me.
- **A refused choice is still asked.** The fork has no next attempt, so
where Leaf refuses the HTML, the ask is posted again in words with
`--obligation`, showing the HTML as text, and the agent's line says why.
Before, a refusal reached `apply_answer`'s re-raise and the ask was
lost.
- **Asking again.** The fork's page facts now list every question a
thread message asked and On Me no longer holds, choices included. A
choice is named by the message holding it (`thread.widget_question`),
the id `thread.ask_again` takes. An `again` ask goes into that
question's thread and reopens it: with its choice where the text holds
one, under its own id where it was first asked in words, and as a new
question in words otherwise. `thread_questions` reads what a thread
asks. Its words part is `obligations.questions_in_words`, which
admission's `_named_question_error` now reads too, so `leaf thread reply
--obligation <id>` and the fork agree on which questions a thread asks.
An `again` naming anything else is refused with `unasked-obligation`, so
the ask opens its own thread.
- **Dedupe.** `_ask` already skipped an ask whose title matched a thread
the agent opened to ask something. It now also counts a thread opened
with a widget that asks (`thread.widget_asks`, through the cached
`thread_context.logged_fragment`).
- **The agent's line** names the question's id: the reply's own where a
closed choice is asked anew in words.
- **The fork's view of On Me** for a widget in a thread message used to
read `decision: ` with no words. It now reads `decision in the agent's
message in "<thread>": <words>`: the widget's own prompt where it has
one, such as an `lf-ask` heading, and otherwise the message's text.

## Evidence

`leaf-dev eval run 'turn-end-check/ask-*' --harness claude-code --repeat
3 --base`, on this branch against main with #6208 (`ed71a3cc9a`). A
question label's `choice` (`fork_eval.py`, check `choices-right`) says
whether the ask must be asked by a widget in its text or in words.
`ask-question`, whose reply offers "the LRU cache … or the TTL cache",
now expects a choice. The new `ask-choice` leaves a three-way timing
question with the agent's advice ("I'd go tonight"). `ask-step` and
`ask-follow-up` expect words.

| case | main | this branch |
|---|---|---|
| ask-question (two answers, `choice: true`) | 0/3 | 3/3 |
| ask-choice (three answers and advice, new) | 0/3 | 3/3 |
| ask-step (a command to run, `choice: false`) | 3/3 | 3/3 |
| ask-follow-up (`choice: false`) | 2/3 | 2/3 |
| ask-on-me, ask-answered, ask-step-done | 3/3 each | 3/3 each |

- Main's failures on `ask-question` and `ask-choice` are all
`choices-right`: it asked in words, and the judge passed its wording.
- Every head run of those two cases wrote a valid `lf-options choose`
group with new ids, so none fell back to words. Every `ask-choice` run
marked "tonight" as recommended, in the option's words rather than the
tag.
- No step became a choice: all six head runs of `ask-step` and
`ask-follow-up` asked in words.
- `ask-follow-up` fails once on each arm, on the wording faults #6079
described: a reply asked for that the agent could check itself, and the
agent's inference that the flag "went to dev".
- Head over main, paired by case, with 95% bootstrap intervals: fork
cost 1.07× (1.03–1.11), wall time 1.14× (0.95–1.33), output 1.19×
(0.91–1.46).
- The prompt gains about 515 tokens (9,281 → 9,795 on `ask-answered`),
the two paragraphs of `threads.md` the fork now reads. A live fork reads
the conversation from the cache: over 325 live forks in 10 days, a
median of 17,500 input tokens were uncached beside 257,000 cache reads.
So the added prompt is about 1% of a fork's cost.
- A fork that asks with a choice writes the group, about 400 more output
tokens, about $0.01. It often also lists each option's case in words
above the group, which the judge passed and "Ask for a pick" advises
against.
- This round's paid runs cost about $9: $4.90 for the forks at list
price, about $3.10 for the Opus judge, and a one-run sanity check before
#6208 landed.

Rendered with `leaf-dev probe
evals/turn-end-check/pages/reindex-staged.html --log <the fork's ask
from a run> --do press:m --shot`, the thread card shows the message,
then the three options with digits 1–3, and the footer reads "Your turn
· 1 of 1 waiting on me · Options".

## Tests

- `tests/model/test_clerk.py`:
- `test_an_ask_with_listable_answers_is_a_choice_the_user_presses`: the
message is `html` with no obligation, the choice is On Me, a reply in
words leaves it open, and the agent's line, the next fork's On Me line
and the title dedupe all hold.
- `test_a_choice_leaf_refuses_is_asked_in_words`: a choice reusing a
taken id is asked in words with an obligation, and the agent hears why.
-
`test_a_closed_choice_asked_again_with_html_leaf_refuses_is_asked_in_words`:
the same refusal on a re-ask lands in words in the earlier question's
thread. `ask_again` returns None where the thread can't take the
question and lets an HTML refusal through, so the title check can't drop
the ask.
-
`test_a_question_asked_again_with_listable_answers_is_a_choice_in_its_thread`,
`test_a_choice_the_user_closed_is_asked_again_in_its_thread` (as a
choice and in words),
`test_an_ask_again_naming_a_message_that_asks_nothing_opens_its_own_thread`,
`test_a_widget_in_a_message_reads_as_its_own_question`.
- `dev/tests/test_evals.py`: the replay test hands an ask whose text
holds a choice through the arm's Leaf and checks `choices-right`.
- Ran `tests/model/test_clerk.py`, `test_thread_titles.py`,
`test_thread_reading.py`, `test_obligations.py`,
`interact_contract/test_admission.py`, the `unasked-obligation` cases of
`test_todos.py`, and `dev/tests/test_evals.py`.

## Not verified

- A live Claude Code session's fork. The evals replay constructed
conversations through the real fork path.

## Calls to reverse

- A refused choice is posted in words with its HTML shown as text,
rather than with the HTML removed.
- An `again` ask with a choice is posted as a choice in the earlier
question's thread, rather than in words under the question's id. A
closed choice re-asked without one becomes a new question in words in
its thread.
- `ask-question` now requires a choice, so base fails it by design.

Closes #5404
leaf-agent added a commit that referenced this pull request Nov 16, 2026
…tests #6208 missed (#6225)

#6208 removed the separate `markup` argument from `post_reply` and
`cmd_comment`, so an agent message is now one Markdown body that holds
its HTML. Seventeen callers in `tests/browser/` and `tests/journeys/`
still passed markup positionally. A pull request runs only the
later-tier tests it edits, so they first failed on main: push run
[43956121090](https://github.com/max-sixty/leaf/actions/runs/43956121090)
failed 15 browser tests with `TypeError: post_reply() takes 3 positional
arguments but 4 were given` (or the `cmd_comment` equivalent). Each
caller now writes the HTML into the text after a blank line, with
`html=True` on `post_reply`, the same form #6208 gave the callers it
updated. The three that passed `None` as markup now drop that argument.

One test changes what it covers.
`test_a_durable_reply_completes_its_stream_placeholder_in_place` used to
end by editing the completed reply and checking that its widget
survived. That reply holds HTML, and #6208 freezes such a message whole
(`leaf thread edit` refuses it with `edit-holds-html`), so the agent can
no longer send that edit. The test still checks that the durable reply
completes the stream placeholder in place and draws its widget.

Verification: before this change, the 15 browser tests named in that run
failed with the TypeError. With it, they pass locally, along with the
three journey-tier tests that make the same calls (28 passed, `-n 4`).
An AST scan of the tree finds no remaining call that passes markup.

This leaves two other failures from that run, both with owners: #6139
(`test_a_root_summary_keeps_thread_actions_outside_its_fold`), and the
−54 px `lf-compose-placeholder-enters` shift in
`test_an_arrival_the_opening_view_will_cover_puts_it_away`. That shift
still reproduces on main after #6153, so it goes back to #5642.

Refs #3985 — automated triage

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Nov 17, 2026
…otices (#6215)

The page protocol marks which Leafs can serve and write a page, so it
moves only when a Leaf at the current number would misread an event or
record another Leaf at that number wrote. Root `AGENTS.md`, "Pages
across Leaf updates", now states that once, with what keeps the number:
anything the serving Leaf supplies, including how it parses and draws
what the page keeps, even where a logged message or a comment's quote
then draws or resolves differently. `layer-registry.md`, "Page
protocol", keeps only how the number is enforced and how records carry
it (834 → 393 words).

Gone: #6208's notice that a message Markdown dialect change bumps the
protocol, the same notices on the kernel registry's `$passages`
(including the `closing`/`opening` lists #6216 just added) and `$names`
(the latter about vendored registries pages no longer keep),
`$events.description`'s claim that the protocol covers the served state,
and the layer-registry paragraphs that copied `session_runtime.py`'s
header or described superseded behavior.

**To weigh:** the policy accepts that a passage-reading change can move
an old comment onto another occurrence of its quote, and a dialect
change can drop a logged widget's action from its thread's history.
Codex found both cases; a bump prevents neither, since renewing a page
keeps its log for the new Leaf to read by its own rules.

Max asked for this after #6208. Reviewed by Codex, whose two findings
are fixed. On eight bump questions, six Sonnet runs of the new text
answered all 48 as intended, keeping bumps for a renamed field, a
non-skippable kind and a changed token meaning. #6023 (draft) rewrites
the same `AGENTS.md` section, so whichever lands second resolves a
conflict. `pre-commit`, the registry and protocol build tests, and the
`AGENTS.md` tests pass.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 17, 2026
…#6218)

Every message an agent posts now reads as Markdown with HTML, whichever
way it reaches the page, so the log drops the `html` field #6208 added.
Before, only text the agent wrote with a `leaf thread` command, and the
turn-end check's asks, drew its HTML, and the field marked those
messages; a Codex turn's final message, progress lines and failure
receipts kept their tags as words. Readers that need to know whether a
message holds HTML now derive it from the text
(`thread_context.logged_fragment`, cached), and the server adds it to
each served thread message, so the browser runtime is unchanged. A
user's message still shows tags as words.

Max asked why the field existed at all. It existed so Leaf could post
agent text without reading its HTML. Reading every agent message the
same way keeps one rule, and each path that posts agent text now meets a
refusal the way the agent's own command does:

- **A Codex final message** with a stray tag, such as `Vec<String>`
outside backticks, is refused (`unclosed tags: <string>`), and the
existing correction delivery asks the agent to fix it and answer again.
In exchange, a final message can hold HTML: a `<details>` quote, a table
or a choice draws. The turn writer's delivery clause drops "Reply
explicitly too for other HTML, which your final message shows as text",
which is no longer true.
- **Progress lines** (a Codex opening, a fork's working line,
`--ephemeral`) may now carry formatting HTML such as `<em>`; they still
refuse a widget, since the answer replaces the line. Before,
`--ephemeral` refused any HTML.
- **The turn-end check's asks** (#6202): where Leaf refused an ask's
HTML, it posted the ask again with the HTML shown as raw text. That
fallback needed the field. Now any ask Leaf refuses, for HTML or for a
picture the page hasn't got, is not posted, and the agent gets the
message and the refusal as a line it owes, which wakes it to ask the
user itself; the fork's other asks are still posted. Before, a missing
picture in one ask dropped the whole answer without telling the agent.
- **Edits**: the rules that a message drawing HTML keeps its words and
that an edit adds no HTML move from `leaf thread edit` into the append
door, so an edit a sample's fixture carries meets them too.
- **Protocol 48** (#6216 took 47): a Leaf at 47 would draw a new log's
HTML messages as text and miss their widgets. Delivery records are
unchanged.

The `html` parameter that ran through `open_thread`, `post_reply`,
`post_response`, `_compose_and_append`, `ask_again` and the clerk is
gone with the field.

Reviewed by Codex; its three findings (progress lines refusing
formatting, edits bypassing the rule through fixtures, clerk refusals
not reaching the agent) are fixed here. Ran `uv run pytest tests/model
tests/process`, `pnpm run test:runtime`, `pnpm run check`, and nine
browser and journey tests covering a choice in a thread, an export, a
reply's widget and the shipped logs.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 17, 2026
…ceptions (#6247)

An agent's thread message now reads its HTML exactly as CommonMark does,
as GitHub reads a comment. Max asked whether messages could hold HTML
following Markdown's standards, with no special exceptions; this drops
the three #6208 added (a custom element running to its closing tag
across blank lines, a literal `<code>`, and the `widget-in-paragraph`
refusal).

What changes for an agent writing a message:

| Writing | Before | Now |
|---|---|---|
| A choice whole on one line | its own block | drawn the same, inside
the paragraph Markdown puts around it |
| An `lf-ask` or data widget whole on one line | its own block |
refused: its heading or `<pre>` closes that paragraph early |
| A widget's opening tag alone on its line, after a blank line | its own
block | the same |
| A blank line inside a widget or `<details>` | kept | ends the block; a
split `<pre>` is refused (`split-pre`) |
| `<code class="language-math">\{x\}</code>` | kept as written |
Markdown reads the escapes, so it takes `\\{x\\}` |

Worth weighing: `split-pre` is the one new check. A blank line inside a
nested `<pre>` leaves well-formed HTML whose code silently lost its
blank lines and indents, which nothing else reports; it refuses a
`<pre>` holding any block, such as the `<p>` or `<ul>` Markdown draws
there. A refusal also now prints the drawn HTML lines its findings name.
Of 50 widget messages agents sent on local pages, 46 draw as before and
4 (one-line `lf-ask`s) would be refused. Python's message reading also
stops starting blocks on lines indented four spaces, matching the
browser. It also fixes a regression from #6218: a reply that moves its
thread checked the page against a stand-in event carrying the reply's
text, so a widget id clashing with the page was refused as an invalid
page rather than by the reply's own check.

Scored `thread-choice-takes-a-press` and `answer-quotes-what-it-cites`
on Claude Code (12/12, base and head), reviewed by a fresh subagent,
whose findings are fixed here. Ran model and process tests, `pnpm run
test:runtime`, `pnpm run check`, and the 22 browser and journey tests
holding edited messages.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 17, 2026
…ol 49 (#6246)

An agent can now edit the HTML in its own thread message, as it edits
its words. #6208 froze any message holding HTML (`edit-holds-html`,
`edit-adds-html`) in case the user had acted on a widget in it; Max
asked to drop the freeze and at most warn about changing what the user
already picked. #6218 moved that refusal into the append door; this PR
removes it.

Every reading of a message's elements now follows its latest wording
(`thread_context.thread_structure`): widget index, On Me questions, data
bindings, deliveries, the browser's drawing. An edit's HTML meets the
gates a new message's does, under the newest revision, which the edit
now records — the reason for page protocol 49. Ids any wording held stay
reserved to that message, as revision ids are, so a recorded answer
can't attach to another message's widget. Where the message holds a
widget the user acted on, the edit goes in with advice saying whether
their answer still shows, judged by the ids it rests on
(`edit-answered-widget`). A gesture's words read the wording the user
saw, so a relabel doesn't rewrite their history row. The browser keeps
an island per wording and retires the old one's widget ids when the page
adopts the new reading (`islandChange`).

Calls to weigh: an edit redraws its island, so typed values or focus
inside it are lost, and a gesture made in a tab the edit hadn't reached
yet reads in the new wording; both rare paths, left without a mechanism.

AGENTS.md "Leaf's role" gains the principle. Scored on six design
questions, 3 runs each: the freeze went from refused 3/3 to accepted
3/3; both guarantee-breaking guardrails stayed refused 6/6.

Tests: model edit/obligation tests, the runtime island test, the
stream-placeholder browser test; focused model files and `pnpm run
check` pass. Codex reviewed twice; its findings are fixed or noted
above.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 20, 2026
… copy installed since

A session's hooks, watch and bare `leaf` commands now run the plugin copy the
session loaded, as Claude Code intends: it puts that copy's `bin/` on the Bash
tool's PATH and names it in each hook. They still hand themselves to a checkout
the session selected. This reverses #4557, which handed every session to the
copy `installed_plugins.json` records, and deletes that hop from the launcher
(`bin/leaf`) and `session_runtime`, with the pages follower's restart on it.

The hop stopped buying what it was added for a day after it landed. #4557 fixed
idle sessions refusing pages a newer Leaf had re-vendored (94% of pickup wait,
20-27 Oct). #4551 then stopped copying the layer into pages, so the protocol
covers only the log and records, and only the session holding a page renews it
(`vendoring.renew_layer`), so a session's pages stay at its own copy's protocol.
Of 36 live sessions on 2026-11-19, 34 ran a replaced copy, and 33 were at the
installed copy's protocol (51) anyway; the protocol moved 15 times in the last
1,318 commits.

The hop also ran code the session's instructions didn't describe: two live
sessions loaded a copy at protocol 44 whose references tell the agent to pass
`--markup` to a thread message, a flag the installed Leaf dropped (#6208). With
it gone, a session's instructions, hooks module and Python are one copy, except
under a selected checkout, and Leaf no longer reads Claude Code's undocumented
install record or cache marks. An update now reaches a running session when it
runs /reload-plugins or starts anew. A copy that has lost its project still
refuses, naming /reload-plugins, rather than leave uv to run the caller's
`python`.
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