Repository navigation
Conversation
A cut as a value that stands for what the store held as of it, on the model of the snapshot library. On positions the cuts inside a store are a lattice and the difference of two cuts is the events between them. On contents a row of a chain kept by generation is alive on one interval, a set of rows is an expression over the contents of cuts with no complement, and the signed difference of two cuts is two such sets. Palace/SnapshotAlgebra.lean proves 110 theorems over SnapshotAlgebra/Defs.lean, six of them controls. PalaceTest/SnapshotAlgebra.lean attacks them on seeds 529 to 566: 21 attacks and 17 controls. The seven laws enter family XVI of docs/LAWS.md with their 80 declarations stated in Spec/SnapshotAlgebra.lean and named in comparator.json. Their rows name no anchor and their falsifier is a gap until stage SN-1b builds the code. formal/check.sh passes: 460 statements judged, 56,530 declarations replayed. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Amends dn-temporal-snapshot for the read of every head at a cut. The shape half of SN-c is decided: the read is the contents of a cut, named by a predicate and read as a count, as columns or as a difference from another cut. - 4.4: the objects, the operators and their types, the four forms every operator is built on, the lattice on positions, the interval reads and the statements they run as, the sets, the signed difference, contents against positions, a family of cuts, the default operand. - 5.7: which edge species follow from the node difference, what is updated over a difference with its measured break-even points, and the interface a cut's graph gives an operator, which SN-4 builds. - 6.5: every operator commutes with the grant, a hole is in no set, a retire is a removal. - 7.4 to 7.6: the region reconciled with GD-4, the tool, and where the grammar takes the algebra later. - 10 to 13: SNP-11 to SNP-17, the probes, stage SN-1b, the rollbacks revised so that none is a switch, the decisions recorded as decided (D15 to D23) and the proposals awaiting confirmation (D24 to D36). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
From this branch's run of formal/check.sh: 113 rows, 460 statements judged, 1,654 theorems, 253 attacks and 223 controls over 34 modules, 56,530 declarations replayed. formal/README.md gains the SnapshotAlgebra module, its seven status rows and its attacks by seed. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Stage SN-1b's engine (dn-temporal-snapshot §4.4), in core/stores/cuts.py. A cut is one position a landing chain: an immutable, hashable value with the pointwise order, its join and its meet, the bottom, and the head read from the log. Every read happens inside an evaluation, which reads the chains of the asker's classes and their heads once, when it starts: an operation that names no cut reads that head, and every result names the cuts it reads. What a cut holds is a set of versions, the store rows no purge emptied, named and not read. Union, intersection, difference and symmetric difference compose expressions and run no statement; membership is a predicate on a row's position and its closing stamp, bounded by the intervals so that a statement takes the primary key or landings_closed as a range. A count is one statement that builds no row, and the rows come back as columns, one buffer a column. The signed difference of two cuts is two such sets, whose statements walk what changed; read, it sorts by path within a chain into removed, added and replaced, applies to a set, and composes through a cut between the two and refuses one outside. The family operations (persisted, existed, in how many, the count at each cut walked by the differences, the pairwise sizes) are written on the four forms the note names: apply, combine, map and fold. VaultCatalog.cuts(classes) starts an evaluation over the catalog's file. tests/property/test_cut_algebra.py checks SNP-11 to SNP-17 and the default against a plain fold of the log kept in the test, over SN-1's random catalog writes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
eval/cut_algebra_bench.py measures stage SN-1b on a copy-on-write clone of an instance's catalog, migrated in place under a secret made for the run, as SN-1's harness does (its timing helpers are reused). Every head at the head of the genesis, before the contents replace it: SN-1's heads_at, a row in Python a head, against the contents counted and read as columns, with SNF-6's tenth of a second as the bar. Then a history of catalog writes after the genesis (new versions, retires and new paths, shuffled), and on it: the signed difference ending at the head over 1, 1,000, 100,000 positions, the whole history and every position, against two heads_at reads and a set difference of their rows; ten cuts over the history, their counts walked by the differences against ten counts, what persisted and what existed, and the pairwise sizes; and the plans SQLite gives the statements of a cut's contents and of each side. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every head of a class at a cut is now the contents of the cut (core/stores/cuts.py): a count that builds no row, or columns, one buffer a column. heads_at, which built a Landing in Python a head, is removed from LandingLog and VaultCatalog with nothing kept beside the contents (dn-temporal-snapshot D20, D29). Its callers move: - tests/property/test_landing_log.py checks the closing-stamp read as the contents: at every position of every chain the versions are the fold's store rows that keep their content, and the holes are counted, so a purged version of a live path is no version at a cut where it was the head and is counted as a hole there; - eval/landing_log_bench.py reads every head as the contents, counted and as three columns; - eval/cut_algebra_bench.py keeps SN-1's statement and its row a head as the baseline it measures the contents against; it gave the rows heads_at gave at 6,927 cuts of 300 random catalogs before the removal; - SNP-5's row in docs/LAWS.md anchors the closing-stamp read at Evaluation.held. SN-1's record and its article stay as the dated records of what was measured then. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
agents/ambassador/cut_tool.py is the handler of the palace's tool for cuts (dn-temporal-snapshot §7.5), over core/stores/cuts.py. A call names an operator, op, and its operands: a and b, each a cut's name or a call written as an object whose result is the operand, and cuts, a family. A cut is named head, bottom, or by its positions, land.<chain>@<seq> one a chain, a chain left out standing at 0, and every answer prints the cuts it read that way. An operand left out is the head, read once when the call starts. over narrows the classes read to some of the grant's; list returns the rows beside the counts, the first limit of them. The operators are named as the note names them, both meanings of union and intersection among them: join and meet return a cut, union and intersection a set. A cut given where a set is expected is the set it holds; a set, a signed difference, events or a number given where a cut is expected is refused, naming what was given and what is taken. A position past a chain's head is refused with the head, a chain the grant does not read in the words used for one that does not exist, and a position under a chain's horizon is read at the chain's empty prefix. The note says when the head was read, which chain was read below the position asked, how many rows of the ranges read are holes, and that the result is of versions, edges and graph mathematics at a cut arriving with SN-4. tests/unit/test_cut_tool.py calls the handler as the server does, the arguments and the answer through JSON. Nothing registers the tool yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/experiments/cut-algebra-2026-11-13.md, with both runs in its JSON: eval/cut_algebra_bench.py at 4e94b44, the engine at b210db0, on two copy-on-write clones of the corpus instance's catalog. Every head of the corpus chain, 400,274, counted in 66 ms (0.17 us an event) and read as three columns in 219 to 224 ms, against 1.74 to 1.79 s for SN-1's rows: the count passes SNF-6's tenth of a second and the columns do not, three columns passing it near 180,000 heads. After a history of 200,000 writes, the signed difference ending at the head costs what changed: 0.02 ms for one position, 2.5 ms for 1,000, 0.28 to 0.31 s for 100,000 and 0.56 to 0.60 s for the whole history, against 3.6 to 3.8 s for two reads of every head and a set difference, with every side equal to it. Ten cuts: the counts walked by the differences in 0.43 to 0.49 s against 0.79 to 0.83 s for ten counts, what persisted in 64 ms, the pairwise sizes in 0.32 s. The design note records SN-1b as built: the front matter and the opening, §1.4, §4.2's size set from the measurement (D30, the parked SN-c, SNF-6), §11's rows, §12's as-built list of what the build settles or departs from (the bounds, the columns, the holes counted, the pairwise read, the walk to a horizon, the tool's limits), and the cross-references. The harness's docstring counts the listing's eight columns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The seven rows of the algebra of cuts entered family XVI with the design, each naming no anchor and a gap for its falsifier. SN-1b's code and tests give each its anchor in core/stores/cuts.py, its property tests as its falsifier (tests/property/test_cut_algebra.py, and the tool's in tests/unit/test_cut_tool.py where the tool states the law), and the label Claim; each statement's clause that the code is not built is replaced by what the tests check on the code. The family's opening says the code was built on 2026-11-13 and that the cut tool is the log's one reader, and formal/README.md's SnapshotAlgebra entry names the code and its tests. The formal column, the Spec statements and the comparator's names are unchanged: 113 rows, 466 cited declarations, 100 laws marked and 460 statements judged, as scripts/check_laws_xref.py reports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
papers/2026-11-13-cut-algebra: the cut as a lazy value and its algebra over the landing log, the design and its build in one article. The lattice of cuts on positions; a version alive on one half-open interval, which makes every set operation on contents a predicate on two columns and both differences of two cuts range reads; the seven laws SNP-11 to SNP-17 with their Lean declarations and controls; the build over SQLite, with the bounds each statement carries (as pseudocode), the columns, the signed difference counted and sorted, the families and the tool; and the measurements on a copy of the corpus instance's catalog. The deterministic tier it reports passes at 3,751 tests with the algebra's 30. Every reference was looked up: the DOIs and pages against Crossref, the rest against the publishers' and indexes' records. It builds in 10 pages, the tenth holding the last reference, with no overfull box, undefined reference or BibTeX warning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n is walked once Three repairs to the engine of the algebra of cuts (core/stores/cuts.py), from the review of SN-1b. `^` wrote what exactly one of two sets holds as (a - b) | (b - a), which names both operands twice. Nested, the statement doubled at each level: a call of about a kilobyte asked for a statement whose building took tens of seconds or several gigabytes. The symmetric difference is now a node of its own, whose predicate on a chain is the two operands' predicates compared, `p <> q`. A predicate is never null, so the two differ exactly when a row is in one set, the rows of Held.symm (Held.has_symm). Every node now carries `terms`, how many times its statement names a cut, which an operator adds and never multiplies; the tool bounds a call by it. Evaluation.served walked each named position back to its chain's horizon row, since no index finds it, and walked again for every name, twice for a cut named twice. `serves` keeps what each walk learnt: the horizon found answers every later position on its chain, a position found under the horizon answers every position under it, and a walk above it goes down only to it. No row is walked twice in one evaluation. served's docstring said that every frontier of landing chains is consistent before SN-2. One pair of rows is not among §3.5's references: a change of class writes a `leave` in the old class's chain and then the `store` in the new class's chain, and a cut that holds one without the other holds the path in both classes or in neither. The docstring says so, and that such a cut is read as asked. `read_only` opens a catalog's file with a connection that only reads, for an evaluation that must take no lock and write nothing; opening the catalog itself runs its migration, a write transaction, at every open. The Table docstring cited Held.has_gone_triangle for the sizes, which it states for rows; it now says the sizes follow from the rows. Tests: a symmetric difference sixty-three deep names sixty-four cuts and equals the fold's; a chain's horizon is walked once an evaluation, statement by statement; a cut that splits a change of class is served as asked, with the path in both chains or in neither. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ithin a bound Repairs to the cut tool's handler (agents/ambassador/cut_tool.py) from the review of SN-1b, each with its test in tests/unit/test_cut_tool.py. - The handler takes a connection, not the catalog. Opening VaultCatalog runs its migration, a write transaction, at every open, so a call waited on a writer's transaction and failed after the five seconds of the busy timeout, though the tool said it writes nothing. The server now opens the file with core.stores.cuts.read_only (its registration commit), and the tests call the handler over such a connection, as the server does. - A call's sets name at most TERMS = 256 cuts, counted each time their statement names one (Versions.terms). DEPTH bounds how deep calls nest, not how large the statement grows, and a composition of differences repeats its operands. The bound is checked on every value the call builds, before a statement is written, and the refusal says it. With the engine's symmetric difference, thirty-one nested in one call make a statement that names thirty-two cuts. - Two names lowered to one cut are both kept: the answer lists the cut read once beside each cut asked for it, where only the first was kept. - in_how_many reads the first `limit` rows it lists, not every row of the set, and counts the rows every cut holds in SQL, as what the set and the family's persisted set both hold. - A cut over two chains or more that is neither the head nor the bottom can split a change of class, a `leave` in one chain and the `store` in another, and is read as asked; the note of a result that reads what cuts hold says so (SPLIT). - The docstring said nothing is read before the outermost operator needs it. A call reads the heads when it starts and, for a position named under a chain's head, that chain's horizon once; the docstring says so, and the test now asserts every statement a call runs. New tests: the head is read once a call though writes land while it runs, for a signed difference, a set and a join with an operand left out (a handler that reads the head again fails it); the bound and the linear symmetric difference; two lowered names; the change of class split, both ways; in_how_many with a limit. The test that asserted the laziness by its count statement alone is renamed for what it now asserts, and SNP-14's row in docs/LAWS.md names it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eorems state The review of SN-1b found three citations that claimed more than the cited theorem states; two are docstrings of formal/Palace/ SnapshotAlgebra.lean. - Held.has_gone_triangle states that a row gone from a to c is gone from a to b or from b to c. Its docstring and the module's summary of SNP-13 said that the sizes of the differences obey the triangle inequality; they now state the rows, and say that the sizes follow from them. - Held.has_inter_cut states that what two cuts both hold is what their meet and their join both hold. Its docstring and the summary of SNP-15 added that this is what the meet holds less the rows closed between the two, which no theorem states; that clause is gone. The statements are unchanged, so formal/Spec/SnapshotAlgebra.lean changes in the same two docstrings only, and the line counts of both files are as they were. Checked with every step of formal/check.sh that stays under a 4 GB resident cap on this shared machine: the sources check, lake build --wfail Palace, lake build Spec, lake test, lake lint, mk_all, the sorry budget, the axiom grep, Audit.lean (5495 declarations, no non-standard axiom, none on sorry) and check_laws_xref.py (113 rows, 466 cited declarations, 100 laws marked, 460 statements, consistent). The export with its six kernel replays and the in-process comparator were not run: the comparator went past the cap, and a docstring is in no declaration they check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dn-temporal-snapshot.md, corrected where the review of SN-1b found it wrong or loose, each change marked where it stands: - §3.5, §7.5 and the open questions: a change of class writes a `leave` in the old class's chain and then the `store` in the new class's chain, in one transaction, and no reference of §3.5 joins the two. §7.5 said every frontier of landing chains is consistent before SN-2 and read as asked. A frontier can split the pair, holding the path in both classes or in neither; it is read as asked, and the tool's note says so. Whether the pair becomes a resolved reference, and where its bound is recorded, is an open question with that default. - §6.5 and SNF-22: "no operator opens a channel" holds for a grant that names whole chains. A grant's test of rows inside a chain leaves the stamps computed over every row, and a shown row's stamp names the position of the row of its path that closed it, which the test may hide. SN-1b's grants name whole classes. - §13: D15 to D23 restated in the note's own sentences, and §4.4's summary of them; §5.7 no longer attributes to the owner decisions on the node outside the nine, and says what the interface assumes; D34 says "the owner" where it said "he". - §4.4 and §10: Held.has_gone_triangle states rows, from which the sizes follow; Held.has_inter_cut states what the meet and the join both hold; the come side of the sorting is covered by a theorem and its exclusivity attacked and tested, not proved. The operators' table says which results are operands again (a cut, a set, a signed difference) and types in_how_many as a set and a family to rows. - §4.4, §7.5, §12: a cut is not read, but a position named under a chain's head reads the chain's horizon, once a call; the tool reads through a read-only connection, bounds a call by the cuts its statement names, lists two lowered names, and reads only the rows in_how_many lists. - §4.2: the difference over a thousand positions is 0.6 ms for the rows come and 2.0 ms for the rows gone, on the fixture of 200,002 rows; the design probes' times are marked as taken without a recorded load in §4.2, §4.4 and §11. - §7.2 cites universe.py:204-207 and :930-937 for the averaged vector; the cross-references say the code was read before SN-1b changed it; the intro's paragraphs are separate again. docs/LAWS.md: SNP-13's row says what is proved of the triangle and of the sorting into removed, added and replaced. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…o timed statement The record of the algebra of cuts on the corpus catalog now says what the stage delivers: the cut as a value, the contents of a cut and their algebra over the landing log, and the cut tool's handler with its registration for the Ambassador; it is not yet the graph, and edges and graph mathematics at a cut arrive with SN-4. It also says that the repairs made after the review (the symmetric difference as one node, a chain's horizon walked once a call) change no statement the harness times, so its figures stand for the code as it is now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…reads it The review of SN-1b asked for a test that the cut tool binds the head once a call. tests/unit/test_cut_tool.py had one for an operand left out of a signed difference, of a set and of a join. Run against mutants of the handler, it caught the one that reads the head again for an operand left out, and passed the one that reads it again for a family given no cuts and the one that reads it again for the `head` operator. While writes land after each call reads the heads, the test now also asks for a measure over a family given no cuts and for `head` itself, and asserts their cuts, their note and their value against the head the call read when it started. All three mutants of the handler fail it, and so does an engine that reads the head again at every use. The docstring of the property test of a cut that splits a change of class said that a cut of either chain alone holds the path once; a cut of the chain it left, taken at the `leave`, holds it nowhere. It now says what the test asserts: the head holds it once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… are restated The review of SN-1b found §13's D15 to D23 near copies of the sentences the owner's decisions were relayed in, and an earlier commit restated them. The same sentences stood in other places too, and each is now in the note's own words: §1.1, items 10 and 11 of §1.2, the paragraph of §4.4 on what a version is, §5.7's paragraph on a node, and §12's opening. The engine's module docstring (core/stores/cuts.py) carried one of them as well. Also, in dn-temporal-snapshot.md: - D28 says that registering `cut` makes it a second read of the Ambassador's server beside `query`, which the owner's ruling of 2026-11-04 had made the server's one command for reading (dn-query-sentence-algebra), so that confirming D28 confirms that departure. - §12, SN-1b: what the repairs measure on a clone of the corpus catalog after the harness's history, by a probe outside the repository at a load average of 1.7 to 3.0. The walk to a chain's horizon takes 22 ms over about 200,000 rows, and a second position reads nothing; 64 cuts named near the head take 119 ms, where the review measured 1.4 s; a signed difference from a cut named a thousand positions back takes 24 ms, nearly all of it the walk, against 2.4 ms for its counts; in_how_many takes 158 ms, where the review measured 457 ms. The review's alternative, the horizon read with the heads, walks the genesis block, 42 ms at every call. - SNP-14 in §10 and in docs/LAWS.md, and property 4 of SN-1b's list, say that the sets the operators give are operands again, where they said every result is. - §4.2's arithmetic from the fixture says the fixture's load average was not recorded; the introduction states the four corrected claims more plainly; the note is dated 2026-11-14. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
papers/2026-11-13-cut-algebra/paper.tex, from the review of SN-1b: - The abstract and the evaluation give the signed difference over a thousand positions as counted in 2.5 ms and read and sorted in 2.7 to 2.9 ms. The baseline of two full reads and a set difference is 3.6 to 3.8 s at every span that ends at the head from inside the history, and 1.8 to 1.9 s from the bottom, where one of the two reads is empty. - The introduction states the requirements in the article's own words. - SNP-13's theorem states the sorting as the library proves it: each row gone is removed or the first of a replaced pair, and not both; each row come is added or the second of one. - The tool reads the heads when a call starts, a chain's horizon once for a position named under its head, and then what its outermost operator needs; the server reads the catalog's file through a connection that only reads; a call's sets name at most 256 cuts. - The background says the log's chains read no other chain but for a change of class, and the limitations that a frontier can split one, which is read as asked and which the tool's note names. - The tier is the count of the final run: 3,757 tests with the algebra's 36. It builds in 10 pages with no overfull box, undefined reference or BibTeX warning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The tests badge, the tier's sentence and the coverage, from a run of the tier exactly as .github/workflows/ci.yml runs it on this branch's code and tests: 3,757 passed, 11 skipped, 21 deselected, coverage 78% on the report's total line. The tier is main's 3,721 tests and this branch's 36: the 21 property tests of the algebra of cuts, the 14 of the cut tool's handler and the test of its registration through the server's dispatch, which the last commit adds. The landing log's tests moved to the contents of a cut and are as many as they were. The badge and the testing paragraph said 77%, and say 78% from this run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The property test of a cut that splits a change of class, added after the review of SN-1b, declared that its helper returns list[str | None] and built a list[str]. `uv run mypy` reported it as a new error, 68 against the pinned baseline of 67; the helper now declares list[str], and the baseline holds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The palace's MCP server registers the tool `cut` (dn-temporal-snapshot §7.5) in the Ambassador's table, after overview, with the handler's own description and schema (agents/ambassador/cut_tool.py). Ambassador.cut opens the instance's catalog file through a connection that only reads (core.stores.cuts.read_only), answers the call under the classes the Ambassador's grant reads (classes_of(AMBASSADOR.strata)), and closes it. It does not open VaultCatalog, whose migration is a write transaction at every open: a call made that way waited on a writer and failed after the five seconds of the busy timeout, though the tool writes nothing. The guest's table is unchanged: what a guest may call waits on the owner's ruling (D34, proposed), so a guest is told the tool does not exist. The Open WebUI bridge's allowlist is unchanged too. The texts that said the server has one read now name two, `query` and `cut`: the module docstring of agents/ambassador/mcp.py, the description of `query` (which began "The one read", and which the edge's committed manifest, edge/palace_tools.json, copies, so it is regenerated), the handoff's account of the web client's tools, README.md's surfaces and architecture, and the query configuration's text in config/defaults.toml and core/kernel/config/loader.py, which keep the owner's ruling of 2026-11-04 as it was given and say that `cut` is a second read since SN-1b (D28, proposed). The two dash pauses of the rewrapped docstrings are gone. tests/unit/test_ambassador_surface.py calls the tool through the server's own dispatch: it is listed with its schema, a call reads a catalog through the Ambassador, an operand written as a call composes, a call answers while another connection holds the catalog's write lock, a refusal is an error result, and the guest server refuses the name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two module docstrings said a read-only evaluation takes no lock at all. A WAL reader takes a read mark for each statement; what holds, and what read_only's own docstring and the note's section 7.5 say, is that it takes no lock a writer waits on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A cut of the landing log is one position a chain. This pull request makes it a value that stands
for the palace as of it and is read only when an operation asks for something of it, gives it an
algebra on positions and on contents, proves the algebra's seven laws in Lean, builds it over the
landing log with a property test against a fold of the log, measures it on a copy of the corpus
instance's catalog, and exposes it to the Ambassador as one MCP tool,
cut. The article ispapers/2026-11-13-cut-algebra/paper.tex; the design is §4.4, §5.7, §6.5 and §7.4 to §7.6 ofdocs/design-notes/dn-temporal-snapshot.md.Abstract
A personal knowledge store records every change to its catalog in an append-only log, one chain a
provenance class, so a cut, one position a chain, names the store as of a moment. Its first read
of every version a cut holds built a row in Python a head, 1.7 to 1.8 s for the 400,274 heads of a
corpus chain whose walk in SQL takes 66 ms. This pull request treats the cut as a lazy value with
an algebra instead. On positions, cuts form a distributive lattice, as the consistent cuts of a
distributed computation do, and the difference of two cuts is the events between them. On
contents, a version is one row of the log, alive on one half-open interval of positions, so the
union, the intersection and the difference of what cuts hold are predicates on a row's position
and its closing stamp: they compose without a read and run as one statement, and the signed
difference of two cuts is two range reads whose cost grows with what changed. The union on
contents is not the union on positions: it holds both versions of an edited note, and the two
agree exactly on rows that are never closed. Seven laws are proved in Lean 4, 110 theorems with
six controls among them, and a property test checks the code against a fold of the log. On a
copy of the corpus catalog, every head counts in 66 ms and reads as three columns in 0.22 s, and
the signed difference over a thousand positions is counted in 2.5 ms and read and sorted in 2.7
to 2.9 ms, against 3.6 to 3.8 s for two full reads and a set difference.
What changes
The design and its laws (the first part):
docs/design-notes/dn-temporal-snapshot.md: §4.4 the cut as a lazy object and its algebra(the objects and their types, the four forms apply, combine, map and fold, the lattice on
positions, the intervals and the four range reads, the sets, the signed difference, contents
against positions, a family of cuts, the default operand); §5.7 the graph at a cut (which edge
species follow from the node difference, what is updated over a difference and what is
computed again, with the break-even points measured on synthetic graphs, and the interface
SN-4 builds); §6.5 the algebra under a grant and an erasure; §7.4 reconciled with GD-4; §7.5
the tool; §7.6 where the grammar takes the algebra later; §10 SNP-11 to SNP-17; §11; §12 the
stage SN-1b and the rollbacks revised by the change rule; §13 D15 to D36; falsifiers SNF-18 to
SNF-24.
formal/Palace/SnapshotAlgebra.leanoverformal/Palace/SnapshotAlgebra/Defs.lean: SNP-11 toSNP-17, 110 theorems, six of them controls;
formal/PalaceTest/SnapshotAlgebra.lean, seeds 529to 566;
formal/Spec/SnapshotAlgebra.lean, 80 statements judged by the comparator.docs/LAWS.md: seven rows of family XVI.The build (the second part):
core/stores/cuts.py: the cut (Cut), an immutable, hashable frontier with its order, its joinand its meet, the bottom and the head read from the log; the evaluation (
Evaluation, startedby
VaultCatalog.cuts(classes), or over any connection, such as one that only reads thecatalog's file,
read_only), which reads the chains of the asker's classes and their headsonce, so an operation that names no cut reads that head and every result names the cuts it
read; the contents of a cut and the sets they generate (
Versions), composed without astatement, each operand named once in the statement, counted by one statement that builds no
row, and read as columns, one buffer a column; the signed difference (
Delta), counted, sortedinto removed, added and replaced, applied and composed through a cut between; the events
between two cuts; the family operations; and the four forms the named operations are written
on.
heads_atis removed fromLandingLogandVaultCatalog, with no eager list kept beside thecontents. The log's tests and SN-1's bench read the contents; the bench of the algebra keeps
SN-1's statement as its baseline.
agents/ambassador/cut_tool.py: the handler of the toolcut, with every operator of §7.5under its name,
joinandmeet(a cut) apart fromunionandintersection(a set);operands that are calls; refusals by type, past a chain's head, of a chain the grant does not
read, and of a call whose sets would name more than 256 cuts; and an answer that names its cuts
by their positions and carries a note. The last commit registers it in
agents/ambassador/mcp.pyfor the Ambassador; the server opens the catalog's file to only readfor each call. The guest's table and the Open WebUI bridge's tool list are unchanged, and the
README, the MCP server's text and the query configuration's text now name the two reads.
tests/property/test_cut_algebra.py(SNP-11 to SNP-17 and the default, against a foldof the log kept in the test, over SN-1's random catalog writes),
tests/unit/test_cut_tool.py(the handler called as the server calls it, over a connection that only reads) and a test of
the registration through the server's own dispatch.
eval/cut_algebra_bench.pyanddocs/experiments/cut-algebra-2026-11-13.mdwith its JSON; therows SNP-11 to SNP-17 now name their anchors, their tests and the label Claim.
What this delivers is the cut as a value, the contents of a cut and their algebra over the
landing log, the tool's handler and its registration for the Ambassador. It is not yet the
graph: edges and graph mathematics at a cut arrive with SN-4. Apart from the tool, nothing in the
palace reads the new module yet.
After review
An audit of the design, the code and the texts found these; the later commits fix them, and §12
of the note says under SN-1b what each changed:
each level: fourteen levels in a call of 803 bytes took 41 s, and twenty reached 1.7 GB before
SQLite refused the statement. It is now one node whose statement names each operand once, and a
call's sets name at most 256 cuts, counted each time their statement names one: thirty-two
levels take under a millisecond on a small catalog and 0.66 s on the corpus copy.
a chain once: 64 cuts named near the head take 119 ms on the corpus copy, where they took
1.4 s. The texts that said nothing is read before the outermost operator now say what is, and
the test asserts every statement a call runs.
writer and failed after five seconds. The server now reads the file through a connection that
only reads, tested while a writer holds the lock.
runs;
in_how_manyreads only the rows it lists (158 ms where it took 457 ms); and two nameslowered to one cut are both listed.
leavein one chain and thestorein another, and a frontierbetween the two holds the path in both classes or in neither. The note had called every
frontier of landing chains consistent. §3.5 now records the pair, the tool's note says that
such a cut is read as asked, and whether the pair becomes a reference the resolver follows is
an open question.
chain (the stamps of the rows it keeps show where hidden rows lie); three citations state what
their theorems state; the types table says which results are operands again; the owner's
decisions are in the note's own words, and §5.7 attributes none beyond them; and the costs, the
loads and the line numbers are corrected.
Decisions
Decided by the owner on 2026-11-11 and 2026-11-12 (§13, D15 to D23). The value a cut names is
the palace's graph at its positions, evaluated lazily. Operators take one cut with another, a
difference, a union and an intersection among them, and operations of any kind may take one cut
or a set of cuts; the ones named illustrate the range. The engine and a tool over it are built
before the grammar takes the algebra. An operation given no cut works on the current one, as an
operation on a stack works on its top. When something changes, its new form takes the place of
the old, and nothing keeps the old reachable beside it. A node and every operation on a node each
have a single definition, with nothing to configure; a use decides only which operations it
applies. Union and intersection are kept twice, on positions and on contents. And an edit gives a
node a new version while it stays the same node, so that a cut holds each node in the version
alive there.
Proposed, for the owner to confirm (§13, D24 to D36), each with its recommendation:
returns is an operand again, and numbers, series, tables and rows are typed as answers.
joinandmeeton positions return a cut;unionandintersectionon contents returna set;
betweenis the difference on positions, anddifference,symmetric_differenceanddeltathe ones on contents.stack of cuts and no session state.
Registered,
cutis a second read of the Ambassador's server besidequery, which the owner'sruling of 2026-11-04 had made its one command for reading; D18 puts a tool before the grammar,
and confirming D28 confirms that departure.
SN-3, SN-4 and SN-5 are revised to the revert, and SN-1b removes
heads_at.size: three columns of every head pass the bar near 180,000 heads, the count near 600,000
events; the corpus chain, with 400,274 heads, is over it.
storerow of the log.cuttool. Therecommendation is every operator under the guest's own grant.
cut, and a cut named byhead,bottomor its positions before SN-2.Open, with its default (the note's open questions): whether the
storeof a change of classbecomes a resolved reference of its
leave; until then such a frontier is read as asked and thetool says so.
Gates
On the branch's last commit, with Python 3.15.2, on a shared machine at a load average of 2.1 at
the start and 4.1 at the end:
uv run ruff check .: all checks passed.uv run python scripts/check_imports.py: OK.uv run mypy core agents eval ops scheduler scripts: no issues in 377 files;uv run mypy: 67errors, the pinned baseline, the same 67 as before the review's repairs and none in a file this
pull request touches.
uv run python -m ops.type_gate: OK..github/workflows/ci.ymlruns it: 3,757 passed, 11 skipped, 21deselected, coverage 78% on the report's total line; main's 3,721 and this pull request's 36.
The run's peak resident memory was 2.0 GB.
uv run python scripts/check_laws_xref.py: 113 rows, 466 cited declarations, 100 laws markedand 460 statements, consistent.
formal/check.sh: green on the Lean files of the first part (exit 0): 460 statementsidentical, 113 rows and 466 cited declarations consistent, 56,530 declarations accepted by each
kernel. After the review two docstrings of
formal/Palace/SnapshotAlgebra.lean, and the sametwo of
formal/Spec/SnapshotAlgebra.lean, changed, and no statement. This machine is sharedand holds a process under 4 GB, and every step of
check.shthat fits ran green on them: thesources check,
lake build --wfail Palace,lake build Spec,lake test,lake lint,mk_all, the sorry budget, the axiom grep andAudit.lean. The in-process comparator passedthe cap and was stopped, and the export with its six kernel replays was not run; a docstring is
in no declaration either checks, and the repository's Lean workflow runs both.
Notes
the original was never opened, and the landing-log secret was a random one made for each run.
The repairs changed no statement the harness times. They were measured again by a probe
outside the repository on a third clone after the same history, at a load average of 1.7 to
3.0 (§12, SN-1b), and the clone was deleted.
the bounds each statement carries, the columns' encoding, the holes counted, the pairwise
table's read, the walk that finds a chain's horizon, and the tool's limits.
landings_closed, then read from the table); both grow with what changed.call, since no index finds the row: 22 ms from the head of the corpus copy after its history.
Reading the horizon with the heads instead walks the chain's genesis block, 42 ms there at
every call.
Merge order
On main after the landing log (#92) and the guest principal (#89), both merged. The keyword and
ledger pull request (#93) and the instance lifecycle pull request may merge first; whichever merges
later is rebased. The shared counters (
README.md,formal/README.md,formal/comparator.json,docs/LAWS.md) are recomputed at the rebase.🤖 Generated with Claude Code