Skip to content

Read one thread or widget through page state, and print every write as JSON - #1374

Merged
max-sixty merged 4 commits into
mainfrom
cli-threads
Sep 28, 2026
Merged

max-sixty merged 4 commits into
mainfrom
cli-threads

Conversation

@max-sixty

@max-sixty max-sixty commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Five more CLI consolidations, following #1355.

  • One reader for a thread or widget: page state PAGE [ID]. thread read was page state narrowed to one thread plus a page of its messages; that is now the ID form of page state, with the same --after/--limit. An ID naming a widget on the page narrows the reading to what stands inside it: its element, the moves and reports on it or its parts, its Asks, workflows and updates, so narrowing to an Ask carries the pick on its choice. thread read and page events --thread are gone, and the delivery's note on an elided thread points at page state instead of the raw log.
  • One resolver for any id a command takes (work.page_subject). A message, a widget frozen into one, or any other event whose history a thread holds (an undo through the gesture it withdraws) names that thread; a page widget, or a move or report on it, names the widget. status --on, page state ID and every thread command read ids through it; a thread command refuses a page widget. page check and message markup now refuse an authored id in the log's event-id shape (eight hex digits), so a page id cannot name a message.
  • Thread commands: open, reply, edit, resolve, summarize. --title on open and reply names the thread in the same command, and the delivery clause for an untitled thread says to add it to the reply. Renaming is thread edit PAGE MESSAGE --title. thread title is gone. A title whose text admission would refuse refuses the whole command before anything is posted; the message prints before its title record.
  • page events is the one log follower. page interactions is gone; the diagnostic trace is PAGE/interactions.jsonl, read directly. page events takes --after and --follow only, and both paths exit quietly when the reader closes the pipe (page interactions | head used to end in a BrokenPipeError).
  • Output is JSON wherever it is a fact. Every write (thread open/reply/edit/resolve/summarize, page stamp, page report) prints the records it appended, one JSON line each, exactly as page events prints them, seq included. --json is gone from all eight. status prints the status it wrote (the unanswered-moves note goes to stderr), server start/run print {"url"}, server stop {"stopped"}, page init {"page"}, page media one {"path", "source"} line per image, page export {"file", "version", "bytes"}, data set the source's reading without the value, data clear {"source", "cleared"}, package init/install {"package"}, codex start {"task", "app_server", "started"}, and page guidance PAGE its audiences as an array. Documents (page transcript, page guidance PAGE AUDIENCE) and diagnostics (page check, package check, errors) stay text.

The appended record now carries its seq, which the log derives from the line number, and so does a retried append's, so a write's output and page events are the same record. The base-vs-candidate harnesses (dev/leaf_dev, the arrangement eval) find the server URL in either output shape, since an arm can be built from a revision before this change.

Guidance, docs, the site's how-it-works transcript, scripts that read the server URL, and the tests are updated together. evals/thread-named-in-its-reply is new: an untitled long thread, where the reply should carry --title and the elided messages be read with page state.

Tests:

  • Guidance evals, all 16 cases ×3 per arm run at once against main (69bee09): the new case went 0/3 → 3/3 (main's guidance ran a separate leaf thread title every time); no other case fell. Recorded in the case's header comment.
  • uv run pytest tests: 1428 passed on the merge with main. npm run test:runtime: 152 passed.
  • New: test_a_write_prints_the_records_it_appended, test_any_id_names_one_subject_for_every_command (page widget, Ask, move id, frozen widget and title-event ids across page state, status --on and thread resolve; the eight-hex id refusal), test_a_reader_that_closes_the_pipe_ends_page_events_quietly.

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

🤖 Generated with Claude Code

… as JSON

`page state PAGE ID` replaces `thread read` and `page events --thread`: an id
naming a message, a widget frozen into one, or another event a thread holds
reads that thread with a page of its history; a page widget narrows the reading
to what stands inside it. One resolver, `work.page_subject`, answers every
command that takes an id, so `status --on`, `page state` and the thread commands
agree; `page check` refuses an authored id in the log's event-id shape.

Thread commands are open, reply, edit, resolve and summarize: `--title` on open
and reply names the thread, `thread edit --title` renames it, and a refused
title refuses the command before anything is posted. `page interactions` is
gone (the trace file is read directly) and `page events` exits quietly when its
reader closes the pipe.

Every write prints the records it appended as `page events` prints them, `seq`
included (a retried append now keeps it too); `--json` is gone. Commands whose
output is a fact print JSON; documents and diagnostics stay text.

Tests that held the old sentences, `--json` and the removed filters now assert
the records, `page state` readings and the membership join directly.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

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

The new ID resolver drops undo events that belong to a thread. thread_memberships assigns an undo the thread membership of the gesture it withdraws, but id_subject asks event_threads, which returns no thread for undo. A frozen-widget action followed by its undo therefore yields a thread-owned undo in the log, yet page state PAGE <undo-id> and status --on <undo-id> reject the ID. I reproduced that mismatch with those three records. The shared resolver needs to account for indirect event membership too.

thread open --title and thread reply --title commit the message before attempting the title in a separate transaction (open, reply). If the title append fails, the command exits unsuccessfully even though it posted the message; argument evaluation also prevents _print_records from printing the successful write. A retry can post the same question or answer again. The preflight title check handles invalid text, but cannot make the two writes atomic. The message and title need one admitted write, or the CLI needs to report the committed message and stop promising an all-or-nothing command.

max-sixty and others added 3 commits September 27, 2026 16:56
…fore its title

An undo belongs to the thread of the gesture it withdraws (`thread_memberships`),
but the id resolver asked `event_threads`, which names no thread for one, so
`page state <undo-id>` and `status --on <undo-id>` refused an id the log puts in
a thread. `id_subject` now follows an undo to what it withdrew and reads every
other non-message event through the membership join.

`thread open --title` and `thread reply --title` print the posted message before
naming its thread. The title's text is checked before anything is posted, so the
second write can fail only with the page itself; the message it followed is then
already on screen rather than lost behind the refusal.

The new eval case carries its A/B result in its header comment, where main now
keeps each case's history.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 0dbbd2b into main Sep 28, 2026
5 checks passed
@max-sixty
max-sixty deleted the cli-threads branch September 28, 2026 00:37
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