You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit fe4e8ea
Browse filesBrowse the repository at this point in the historyBrowse files
Use index.html as mutable page source. Activate each valid save as an
immutable content-addressed revision, then stamp exact revisions into
sequential public versions.
Scope events and projections to revisions, keep pinned versions stable, and
show draft and validation state across the browser, CLI, docs, and examples.
{"kind": "comment", "author": "user", "version": 1, "text": "Rejecting at the door is right for the API, but the batch importer retries blindly — it would hammer us. Drop oldest there.", "anchor": {"section": "shed", "quote": "Callers get a 429 immediately"}, "id": "a56486d1", "ts": "2026-08-16T02:35:07-07:00", "seq": 3}
{"kind": "comment", "author": "user", "revision": 1, "text": "Rejecting at the door is right for the API, but the batch importer retries blindly — it would hammer us. Drop oldest there.", "anchor": {"section": "shed", "quote": "Callers get a 429 immediately"}, "id": "a56486d1", "ts": "2026-08-16T02:35:07-07:00", "seq": 3}
236
239
237
240
$ leaf ack ./review 3</code></pre>
238
241
<pid="loop-shell-read">
239
-
The batch carries two events. The pick is an action, and every later version
242
+
The batch carries two events. The pick is an action, and every later revision
240
243
replays it, so the decision survives the page being rewritten under it. The
241
244
comment carries the passage it was drawn on — the reader selected
242
245
<em>Callers get a 429 immediately</em> and wrote against it — so the objection
243
246
reaches the agent attached to the sentence that prompted it, rather than as a
244
247
paraphrase of where they were looking. The pick belongs to no conversation and
245
248
the comment opens its own, so the first line's <code>threads</code> is empty;
246
249
a later reply in that thread names only the message it answers, and the
247
-
exchange behind it comes along there. The agent answers by publishing v2.
250
+
exchange behind it comes along there. The agent answers by updating
251
+
<code>index.html</code>; the valid save goes live, and a meaningful checkpoint
252
+
can then be stamped as v2.
248
253
</p>
249
254
250
255
<pid="wait-trick">
@@ -287,44 +292,46 @@ <h3 id="loop-shell">One turn, from the agent's side</h3>
287
292
<sectionid="agent">
288
293
<h2>A command never edits the document</h2>
289
294
<pid="agent-split">
290
-
The agent has two ways in, and only one of them is HTML. A version is a file:
291
-
the agent writes the whole document into the page directory, an ordinary file
292
-
write with nothing mediating it. Everything it has to <em>say</em> goes
295
+
The agent has two ways in, and only one of them is HTML. The source is a file:
296
+
the agent writes the whole document to <code>index.html</code>, an ordinary
297
+
file write with nothing mediating it. Everything it has to <em>say</em> goes
293
298
through the <code>leaf</code> command instead — a reply in a thread, a comment
294
-
it opens on a passage of its own, the changelog note that publishes a version
295
-
— and each of those appends one event to the log. The log takes a command
296
-
rather than a file write because it isn't the agent's alone: the browser
297
-
appends to it too, and one writer is what gives every event an id to reply to
298
-
and a place in the order.
299
+
it opens on a passage of its own, the changelog note that stamps a version —
300
+
and each of those appends one event to the log. The log takes a command rather
301
+
than a file write because it isn't the agent's alone: the browser appends to
302
+
it too, and one writer is what gives every event an id to reply to and a place
303
+
in the order.
299
304
</p>
300
305
<pid="agent-render">
301
306
So the agent's words reach the screen without the document changing. What the
302
-
user looks at is the version composed with the log, recomposed on a two-second
303
-
poll: the reply appears in a thread in the injected panel, the passage it
304
-
answers is lit by the browser's highlight registry — which paints a range and
305
-
touches no nodes — and the banner's line is whatever
307
+
user looks at is the active revision composed with the log, recomposed on a
308
+
two-second poll: the reply appears in a thread in the injected panel, the
309
+
passage it answers is lit by the browser's highlight registry — which paints a
310
+
range and touches no nodes — and the banner's line is whatever
306
311
<code>leaf status</code> last wrote. Nothing in the document was rewritten to
307
312
put any of it there, and it is the same composition that shows the user their
308
-
own edits before a version carries them.
313
+
own edits before a later revision carries them.
309
314
</p>
310
315
<pid="agent-versions">
311
-
The HTML changes once per version, and even then nothing is edited in place: a
312
-
revision is a new file beside the last one, <code>v2.html</code> next to
313
-
<code>v1.html</code>, and <code>version publish</code> publishes it. Until the
314
-
publication note lands the file is on disk and unreachable, and publishing
315
-
lints it first, so a broken version is never exposed. The next poll moves the
316
-
tab onto the new version, keeping the reader's place, and holds while the user
317
-
is mid-comment or mid-drag. Coming back the other way,
318
-
<code>leaf wait</code> starts after the last acknowledged user event, so a
319
-
comment posted between a wait and its acknowledgement remains beyond the
320
-
cursor and still lands.
316
+
The HTML can change on every save, without spending a public version number.
317
+
Leaf validates <code>index.html</code>, copies each changed valid save to an
318
+
immutable revision such as <code>r2-a81c…html</code>, and moves the live root
319
+
to it. An invalid save creates no revision, leaves the last valid one live,
320
+
and shows its diagnostic. <code>version stamp</code> copies the exact current
321
+
source to the next public file, such as <code>v2.html</code>, and records
322
+
which revision it names. A tab at the root follows revisions while a tab
323
+
pinned to v1 stays there. The next poll moves a live tab onto the new
324
+
revision, keeping the reader's place, and holds while the user is mid-comment
325
+
or mid-drag. Coming back the other way, <code>leaf wait</code> starts after
326
+
the last acknowledged user event, so a comment posted between a wait and its
327
+
acknowledgement remains beyond the cursor and still lands.
321
328
</p>
322
329
</section>
323
330
324
331
<sectionid="pages">
325
332
<h2>What a page is made of</h2>
326
333
<pid="scaffold">
327
-
A version is one complete HTML document, and the required scaffold is two
334
+
A revision is one complete HTML document, and the required scaffold is two
328
335
lines: the theme stylesheet and the runtime module. Everything between them is
329
336
the agent's, drawn from the four building blocks below in ascending order of
330
337
specialization; each earns its place only where the one before it has no way
@@ -529,17 +536,18 @@ <h2>Each page owns its layer</h2>
529
536
<sectionid="gate">
530
537
<h2>Nothing broken goes live</h2>
531
538
<p>
532
-
Before a version is published, <code>version check</code> lints it
533
-
deterministically, with no browser: the HTML parses with balanced tags, the
534
-
scaffold is exactly the theme link and the runtime module, every
539
+
Before a source save becomes a revision, Leaf runs the same deterministic lint
540
+
as <code>version check</code>, with no browser: the HTML parses with balanced
541
+
tags, the scaffold is exactly the theme link and the runtime module, every
535
542
<code>lf-*</code> element validates against the page's registry along with the
536
543
head's <code>lf-*</code> metas, ids stay unique and every comment anchor from
537
-
the previous version survives, and nothing is wider than the readable column.
538
-
The changelog note runs the lint and refuses a failing version, so an open
539
-
browser never sees one. Before a page's URL first goes out,
540
-
<code>version check --render</code> also loads it in the machine's own Chrome
541
-
and refuses what only a layout engine can see — a console error, a widget
542
-
rendered into a box of no size, a sideways scroll — in both color schemes.
544
+
the previous revision survives, and nothing is wider than the readable column.
545
+
A stamp checks the exact current source again and refuses a failing source, so
546
+
neither the live root nor a version can expose broken markup. Before a page's
547
+
URL first goes out, <code>version check --render</code> also loads it in the
548
+
machine's own Chrome and refuses what only a layout engine can see — a console
549
+
error, a widget rendered into a box of no size, a sideways scroll — in both
0 commit comments