Skip to content

Declare agent-written state in x-state, and trim done and x-work to what is used - #1076

Merged
max-sixty merged 5 commits into
mainfrom
simplify-declarations
Sep 24, 2026
Merged

max-sixty merged 5 commits into
mainfrom
simplify-declarations

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

Three more places the event API said one thing twice. Net −76 lines.

x-report folds into x-state. An agent-written verb is now an x-state verb with "writer": "agent"; leaving writer out means the user writes it. No registry had a verb both sides wrote (lf-agent state and lf-task status were report-only, everything else user-only), so each verb has exactly one writer and a coordinate never holds both a user's action and an agent's report.

  • One schema: an agent verb needs a record that isn't body; only agent verbs may name update; only user verbs may declare creates.
  • One lookup, writer()/event_spec() in registry/contract.py, replaces the "x-state" if action else "x-report" branches in the fold, admission and meaning code.
  • Behavior moved:
    • The user-action-outranks-report precedence is gone from the Python fold, the browser fold and the version diff, since the two can't share a coordinate. A report is superseded only by a newer report.
    • x-awaits.answered and the deciding verb may name only user verbs.
    • Agent verbs leave a widget controller's actions.
    • A verb sent by the side that doesn't write it is refused as such ('status' is a verb the agent writes; this action came from the user), at both the browser door and leaf report.

done carries only version. revision was derivable and text was always "Looks good". Admission derives the revision from the version's note, reads that revision's registry, and refuses a version nothing stamped. A new shared reading, standing_approvals(), feeds the transcript and the browser conversation view. The transcript used to print "Approved" for a withdrawn approval; it now prints only approvals that still stand, with a test that undoes one.

x-work is true. Only lf-card's content seat was used; the conversation seat and when filter, their validation, docs and tests are deleted.

Contracts (packages.md, events.md, layer-registry.md), both registries, docs/registry.html and the browser bundle are updated.

Tests. Everyday suite: 1354 passed on the merged branch; the five interact files pass (857) after the review fixes. npm run test:runtime 84/84; check:browser clean and test:browser 64/64. A nightly subset over projection, gate, widgets and export passed 520 with one workspace-layout failure that passes alone. An independent review found no correctness bugs; its four smaller findings (sign-off registry, refusal wording, a stale docstring, missing door tests) are fixed here.

🤖 Generated with Claude Code

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

max-sixty and others added 5 commits September 23, 2026 19:30
x-work had one user, lf-card's {"seat": "content"}. Its conversation seat and
its replayed-attribute `when` filter had no declaration anywhere, yet carried
schema, validation, a projection read in `status --on`, and tests. The key is now
`true` and means the content seat; `status --on` reads the declaration directly
rather than folding the widget's replayed attributes first.

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

A `done` event carried `revision`, which the version's own note already maps,
and `text`, which the banner always wrote as "Looks good". It now carries only
`version`: the append door derives the revision from the stamp (refusing a
version nothing stamped), and the banner and the undo offer match an approval
on the stamp alone.

`leaf transcript` printed "Approved at …" for the first `done` in the log even
after the user withdrew it. Standing approvals are now one reading in events.py,
shared by the transcript and the browser's conversation view, and the
transcript names each approved version ("Approved v1 at …").

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
x-state and x-report were one schema read twice, with `"x-state" if action
else "x-report"` in every fold and a rule that a same-named verb in both must
agree on unit and record. No tag used that overlap: lf-agent's `state` and
lf-task's `status` were report-only, every other verb user-only. A verb now
lives once under x-state, and `"writer": "agent"` marks the ones the agent
reports through `leaf report`; absent, the user writes it.

What moved:
- Each verb has one writer, so a coordinate never holds both an action and a
  report. The action-outranks-report precedence is gone from the Python fold,
  the browser fold, and the version diff; a report is outranked only by a
  newer report at its coordinate.
- The agent/user differences are one conditional schema: an agent verb
  requires a record other than body, takes no `creates`; only an agent verb
  names `update`. `overruled` is required by any agent verb, `restated` by any
  user widget-unit verb.
- x-awaits may answer only with user verbs, and the deciding verb must be the
  user's.
- Agent verbs are not in a widget controller's `actions` reading.
- `$command.widgets.*.report` is gone: a role's report verb is its state verb
  when that verb is agent-written.

Tests that asserted the shared-coordinate rule and user-over-report
precedence are deleted or rewritten to a user verb and an agent verb
standing side by side.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	skills/leaf/references/packages.md
#	skills/leaf/scripts/leaf/transcript.py
A done event names its version rather than a revision, so admission fell back
to the newest revision's registry; it now reads the registry the version's own
revision captured. A verb sent by the side that does not write it is refused as
such rather than as undeclared, and both doors' tests hold that refusal.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 415eb13 into main Sep 24, 2026
5 checks passed
@max-sixty
max-sixty deleted the simplify-declarations branch September 24, 2026 03:37
max-sixty added a commit that referenced this pull request Sep 24, 2026
…rb's writer once (#1101)

This finishes cut-overs that #1076, #1082 and #1091 left half done, as
found in a review of those PRs.

**`meaning.scope` replaces `meaning.document`.**
- Before, "document" named two shapes: the stored `"page" | "thread"`
and the `{kind, revision}` identity that requests, lifecycle seats and
the runtime use.
- Admission now stores `meaning.scope`.
- One helper, `events.document_identity(scope, revision)`, builds the
identity. `event_document`, admission's request check and the served
request readings all use it. The two direct reads of
`meaning["document"]` now go through it too.
- *Contract:* the `$events` meaning schemas and `handling` `when`
clauses, `events.md`, the seed logs, three snapshots and the delivery
sample in `how-it-works.html` are updated. Each snapshot diff is only
the rename.

**One word for deferred payloads.** The contract already said
`records.deferred`. The door and the API now say it too:
- `data_fragment` → `deferred_value`;
- `/api/data` → `/api/deferred`;
- `loadDataFragment` → `loadDeferred`;
- the error strings;
- `packages.md` and `page-storage.md`.

**The writer is resolved once.**
- In Python, `state_specs(entry, writer=…)` filters by writer, and
`verb_writer(spec)` answers for one verb. The five call sites that
restated "absent means user" use them.
- In the browser, `registry.adoptRegistry()` sets `writer` on every
`x-state` verb when the vocabulary arrives, so `stateSpecs`, widgets and
the command hub read one value.

**Created children.**
- `gesture_words` and the version gate take a created child's tag from
`meaning.creates` rather than re-deriving it.
- `passages.shown_words` is now the one reading of a created child's
`x-text-format`, used by passage capture, the gate and gesture wording.

**`example_data.captured_value`** refuses a `lines` range on a
`unified-diff` capture instead of silently ignoring it.

**The event-log page.** Its captured records are regenerated for
`scope`, the note anchors follow them, and the note on `meaning` names
`scope`.

**Tests.** Everyday suite on the merge with main: 1364 passed, and one
failure under parallel load that passed alone. `npm run test:runtime`:
91. `check:browser` clean; `test:browser` 64. A nightly subset over
diff, data, deferred, request, receipt, create, writer and report passed
303.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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