Skip to content

Mark what changed since the user last looked, and where the agent is at work - #4809

Merged
max-sixty merged 17 commits into
mainfrom
agent-ac74926cd7c8b0bdc
Oct 31, 2026
Merged

max-sixty merged 17 commits into
mainfrom
agent-ac74926cd7c8b0bdc

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Coming back to a page, the blocks the agent changed since the user last saw it are marked where they stand, and h / Shift+h walks them. While the agent is at work on a comment, or running a to-do on an element, a bar in the margin stands beside that block.

  • Seen is a bookkeeping event, seen {revision}, that the tab posts as the user leaves (blur to another application, hide, close). It names the newest revision the tab showed while visible and focused. Python serves the newest one as the state's seen, none on a hosted copy, and leaf page state carries it, so the agent knows what the user's page already marks.
  • Marks (since-seen.js) reuse the Versions comparison in version.js, whose base is now any earlier revision, so a Compare and the arrival marks share the tint, margin entries, walk and inline diff. A revision that lands while the user is there flashes as before; one that lands while they are away, or that reloads the tab, is marked. Marks stand until Escape or Stop marking changes in the leaf's menu.
  • Walk (change-walk.js): h steps through the marked changes in page order, and the shortcut bar offers it only while something is marked.
  • At-work bar (at-work.js) draws the annotation inventory's atWork per target, over the page, so the block keeps its own borders.
  • Protocol stays at 36. seen declares skippable in the kernel registry: an older Leaf skips a kind it doesn't know, and on a page holding a seen main's Leaf read the rest of the log rightly. protocol.mjs lets a skippable new kind in at the same number and still refuses any other, and layer-registry.md, "Page protocol", says when a new kind may declare it.

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

…at work

Coming back to a page now marks, in place, the blocks the agent changed since
the revision the user was last shown, and `h` / Shift+`h` walk them. While the
agent is at work on a comment, the block holding its passage carries a bar in
the margin until the work is answered.

What the user sees:

- On arriving at a page, or returning to a tab that was hidden, the version
  comparison runs against the revision the user last saw: changed blocks take
  the comparison's tint and a Change margin entry (whose inline diff still
  opens), and the panel says "N changed passages since v3" or, for an unstamped
  draft, "since 2:49 PM". A revision landing while the user watches still only
  flashes. A comparison Leaf offers that finds nothing says nothing.
- `h` / Shift+`h` step through the marked changes of any comparison in page
  order. Escape (once nothing nearer is open) and a new "Stop marking changes"
  row in the leaf's menu end any comparison; before, an unstamped base had no
  way out but a reload.
- A block whose thread, widget or to-do the agent is at work on (workflow
  `at_work`, or a running to-do on an element) shows a static accent bar 10px
  into the margin, drawn with border-image so nothing moves.

How:

- The comparison's base is now any earlier revision (`revisionBase`), not only
  a stamped version, so Versions' Compare and the arrival marks share one
  implementation: marks, entries, Page Map rows, inline diff, walk.
- A new bookkeeping event `seen {revision}` records the live revision a tab
  showed while visible, posted with `keepalive` as the tab goes hidden or
  closes. `read_state.seen_revision` reads the newest, served as the state's
  `seen` revision descriptor. It is logged rather than kept in browser storage
  because the page has one user across browsers and tabs, as `read` is.
- `at-work.js` reads places the annotation inventory already computes from the
  server's workflows; it adds no signal of its own.
- Protocol 34 -> 35: build/browser/protocol.mjs treats a new event kind as a
  break, so pages vendored at 34 are re-vendored by their session.
# Conflicts:
#	dist/kernel/kernel.json
#	dist/kernel/leaf.js
#	dist/kernel/runtime/bundle-data.js
#	dist/kernel/runtime/bundle-page-layout.js
…bar over the page

Review fixes to changes in place.

Seen now means on the page while the user is there: the tab visible and the
window focused, the evidence a message's read already waits for. A browser
beside the terminal the user types in is visible but unattended, so revisions
landing then are marked when focus returns rather than counted seen. The tab
posts `seen` as the user leaves: blur to another application, hide, close.

- A revision installed into a fresh document (its code changed) never flashed,
  so the new document marks it; F5 hands the revision the tab saw to the new
  document (tab storage, read once), so a reload does not mark what the user
  watched land when its first reading beats the departing send.
- An offered comparison follows a later `seen` another tab posts: it re-bases
  while the newer revision is still behind the page and stops once it is
  current. A comparison the reader chose in Versions is left alone.
- Only the top window takes part (no sample or frame posts), and only with an
  active session; the server serves no `seen` on a hosted copy, whose reader is
  not the page's user (a publication freezes the author's whole log).
- The at-work bar is target paint (`paintSet`) rather than a border image, so
  a block keeps its own borders and shadow, a table cell's bar stands at the
  table's edge, and a `display: contents` target stands where its parts do.
  The annotation inventory now owns whether the agent is at work on a target
  (`atWork`: a workflow whose progress face is working, so stalled work shows
  no bar, or a running to-do), and at-work.js only draws it, keeping the
  inventory's guard against a to-do from a newer revision.

Behaviour change carried from the previous commit and now stated: Escape, once
nothing nearer is open, ends any comparison, including a Compare the reader
chose in Versions.

Tests: a watched revision is not marked and an unfocused one is (and the menu
row clears marks); a chosen Compare outranks the offer; an offer that finds
nothing says nothing; an offer follows another tab's `seen`; a reload into a
fresh document marks; the bar for a running to-do, and none for work gone
quiet; a hosted copy serves no `seen`.
# Conflicts:
#	dist/kernel/kernel.json
`leaf page state` now carries `seen`: the newest revision the user saw with the
page in front of them, as `{revision, label}`, or null before any (and on a hosted
copy). Beside `active`, an agent revising a page can tell whether the user has
seen its latest revisions, and the conversation loop's "What the user sees" says
their page marks each block changed since `seen`, so the agent points them at what
changed rather than restating it. The delivery envelope is unchanged: it carries
none of the other what-the-user-saw facts (`viewed`, `unread`, `user_views`),
which `page state` alone serves.
An agent could read "point them at what changed" as a note after every
revision. Stating that the page already marks the changes leaves the
agent nothing extra to post.
# Conflicts:
#	browser/AGENTS.md
#	browser/runtime/kernel-registry.json
#	browser/types/contract.d.ts
#	build/browser/protocol-baseline.json
#	dist/kernel/kernel.json
#	dist/kernel/leaf.js
#	dist/kernel/runtime/bundle-annotation-overlay.js
#	dist/kernel/runtime/bundle-box-motion.js
#	dist/kernel/runtime/bundle-data.js
#	dist/kernel/runtime/bundle-disclosure.js
#	dist/kernel/runtime/bundle-geometry.js
Main's Versions list now sets Showing and Compare in one column; the merge keeps
that layout and the branch's Compare pressed state, which compares by revision.
The gallery's Changes in place section takes main's layout-flow class.

Main's ty gate found that a seen revision's descriptor reads stored-revision
fields from a reading typed as any source reading; a check's unstored candidate
is never one the user was shown, so the descriptor narrows to RevisionReading.
Ruff's RUF043 took the alternation out of test_seen's match pattern.
# Conflicts:
#	dist/kernel/runtime/bundle-box-motion.js
# Conflicts:
#	dist/kernel/kernel.json
#	dist/kernel/runtime/bundle-data.js
#	dist/kernel/runtime/bundle-page-layout.js
# Conflicts:
#	dist/kernel/kernel.json
…s skippable

A Leaf skips an event kind it doesn't know. Main's Leaf at 36, run on a page
whose log holds a seen event, read its state, appended a thread, passed page
check and exported it; it only marks nothing. The protocol check refused every
new kind at the same number all the same, since the schema can't say whether an
earlier reading would miss the kind: one that sets an obligation aside would
leave it owed. The registry now says so per kind with skippable, the check lets
a skippable new kind in without a bump, and seen declares it, so this branch
returns to protocol 36.
The protocol check's refusal dates from pages running their vendored runtime; an
older Leaf now skips a kind it doesn't know, so the refusal says that and names
the two ways forward. Page protocol also says a new optional field, or a new
meaning for a known one, is bumped by hand where it changes what an older Leaf
reads as owed or decided, since the build can't see it (as #3666's optional
obligation needed).
# Conflicts:
#	dist/kernel/kernel.json
#	dist/kernel/leaf.js
#	dist/kernel/runtime/bundle-data.js
#	dist/kernel/runtime/bundle-page-layout.js
Max asked for one version number and a simple rule for when to bump. The
rule stays main's sentence; a new field or meaning already falls under
"misread", so the paragraph keeps only what an older Leaf does with an
unknown kind and when that kind declares skippable.

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

seen is a departure record, so it cannot establish that the user has not seen later revisions. The inline suggestion keeps the agent guidance within what that evidence supports.

The agent guidance read a seen behind active as revisions the user hasn't
seen, but a tab posts seen only on leaving, so a user still on the page has
seen revisions it doesn't name yet.
@max-sixty
max-sixty merged commit 06d5598 into main Oct 31, 2026
6 checks passed
@max-sixty
max-sixty deleted the agent-ac74926cd7c8b0bdc branch October 31, 2026 05:10
max-sixty added a commit that referenced this pull request Nov 1, 2026
… changed since the last visit (#4890)

Follows #4809 (changes in place). Three changes to how Leaf marks what
changed, and one switch-off.

**Marking what changed since the user last saw the page is turned off
for now.** A page that comes back mostly marked, with no easy way to
toggle the marks, is the wrong default while marks tied to Versions are
considered. `application.js` no longer mounts `since-seen.js` (the call
and its import are commented out, with a note on restoring them), so no
tab posts `seen`. The server's reading of `seen`, the event kind and
`leaf page state`'s field are unchanged. The agent reference no longer
tells agents that the user's page marks what changed since they last saw
it, and the contracts that described that marking say it is off. The six
arrival tests are skipped until it returns.

**A change is marked with a bar beside its block, not a wash over it.**
The wash painted the block's own background, so it covered whatever the
block shades itself: an option's card, the chosen option's green (the
tint's own hue, so every option read as chosen), a board card, a draft's
box, an aside. Each changed block now gets a 3px green bar in the
margin, drawn over the page by the same painter as the at-work bar, in a
lane of its own (4px from the block; the at-work bar stays at 10px).
`at-work.js` becomes `margin-bars.js`, the one owner of bars beside a
block. Compare in Versions uses it.

**The marks are annotations.** `o` hides them with the other
annotations, and the Escape step and "Stop marking changes" row are
gone; a Compare ends with its own button.

**A comparison's base is always a stamped version.** `revisionBase`
takes only a stamped entry, so the "since 3:58 PM" name for an unstamped
revision is gone. The dormant `since-seen.js` counts from the newest
version stamped at or before what the user saw.

Tests: a new browser test marks through Compare in Versions and checks
the bars, the block's background staying clear, `o` hiding a bar, the
`h` walk, and the change bar standing between the block and the at-work
bar.

> _This was written by Claude Code on behalf of max-sixty_
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