Lean calculus
The engineering model and its twelve core theorems, proved under stated assumptions. The specification.
Status
Writfold is a source-only preview, v0.1.0-dev.1: a cooperating single-user trial that you build from source. There is no installer or release binary. This page is the single place that says what works, what is blocked and what changed.
Source-only preview Updated 9 November 2026
01 / Today
“Tested alone” means the part works in its own tests against real native tools, but nothing calls it yet. “Proved” means its decision kernel is proved over the shipped Rust (see verification).
| Part | What it does | State |
|---|---|---|
| Agent session | writfold serve: JSON-RPC 2.0 on stdio. With writfold.trial/1 it exposes trial/show, trial/retain, trial/prepare, trial/run and the evidence reads through the same functions as the CLI; approve, apply and recover answer Method not found. p95 under 0.4 s per call on a 100,000-file repository | Runs (trial) |
| Weft assessment | Local symbolic checks with entailed, refuted and undetermined outcomes. Proved: set algebra, verdict classification and the reuse comparison | Runs |
| Splicery preview | Byte-exact edit preview with refusals for missing, ambiguous and overlapping matches. Proved: batch validation, ordering and rendering | Runs |
| Evidence retention | writfold trial retain: exact bytes of a file at a full commit id, bound as a writfold-citation/1 citation by digest. prepare refuses a Weft report citing anything not retained or no longer matching | Runs (trial) |
| Tuft v0 | writfold tuft run: exact text or bounded regex over one pinned commit, retained as citations, projected under a token budget with explicit omissions and a resume cursor. Semantic, fuzzy and ranked queries are refused until Omnigraph | Runs |
| Weft report gate | prepare --report binds a complete Weft report; approve --require CHECK refuses unless each named check is entailed. Weft's results are recorded as hypothetical. Proved: the required-check gate | Runs (trial) |
| Storage-backend boundary | One swappable trait with Dolt as the interim backend: exact reads and lookups pass a 13-check conformance suite against a real disposable Dolt database. A conditional single writer (one transaction per write, an exclusive writer lease, a signed approval; an interrupted write is Unknown and never retried), and a first publication path: one signed approval publishes one candidate, with the Git release ref moved last as the only point it becomes visible. A kill sweep against real Dolt ended with no double publication | Tested alone |
| Exact object storage | Immutable, realm-bound storage of raw bytes | Tested alone |
| Omnigraph data path | Conditional writes, exact snapshots and retained history against a pinned development build; Omnigraph is the target backend but not yet admitted | Tested alone |
| Git worktree creation | Real Worktrunk worktrees for SHA-1 and SHA-256 repositories, refusing corrupt objects | Tested alone |
| Staged file install | Recoverable single-file replacement with original-file reconciliation | Tested alone |
| Ledger heads | Exact, closed decoding of ledger-head records | Tested alone |
| Procedure checking | Structural checks of a procedure graph against its typing rules | Tested alone |
| Edit approval | Signed approval of one exact prepared edit, verified against the policy and current values | Runs (trial) |
| Validated ledger | Full history replay and conditional append, stored durably in Writfold's own local Git repository. Proved: the history check and append readiness, in the calculus's refusal order | Runs (trial) |
| Grants and revocation | Signed operator grants and the current-grant check. Proved: installation guards, current grant, coverage and revocation. There is no revocation command yet | Runs (trial) |
| Trial edit flow | writfold trial: prepare in Writfold’s own sparse worktree, approve, apply after re-verifying, all recorded in the ledger; trial show prints five independent badges (evidence, assessment, approval, claim, effect). Your checkout is never written | Runs (trial) |
| Claims and recovery | A durable claim before each install, one recorded outcome, and writfold trial recover after an interrupted apply. Proved: the recovery outcome. 60 random SIGKILLs during apply each left the file matching its single recorded outcome | Runs (trial) |
02 / Blocked
The combined test run of 6 November passed 12 scenarios across 29 invocations, plus 8 coverage tests. Four scenarios need services that do not exist yet, so they are recorded as blocked rather than passed:
The trial profile now retains citations, binds Weft reports, and approves, applies and recovers edits within its own cooperating scope. These scenarios stay blocked until the hardened services run them.
03 / Verification
The design defines 32 gates that a full release must pass, and a smaller set of 14 requirements for the first experimental release on disposable data. None has passed yet; the preview rests on scoped component evidence. Each tested part keeps a record of the exact source, tools and inputs it ran against.
The engineering model and its twelve core theorems, proved under stated assumptions. The specification.
Writfold's ledger, grant, revocation, recovery-outcome, required-check and edit-flow decisions, Weft's set and verdict decisions and Splicery's edit rendering, translated to Lean by Charon and Aeneas and proved for every input. Production calls exactly that code. All 20 of Writfold's semantic mutants are rejected.
Cases exported from Lean that Rust must agree with, Verus-checked identity and quantity bodies, Rust tests, deliberately broken variants, TLA+ models of concurrent behaviour, an adversarial campaign against the real CLI (8 of 8 cases as expected) and a latency budget (1 s p95, 5 s ceiling) that every trial operation meets.
Trust base for the proofs: the Charon/Aeneas translation, the Aeneas library's models of the Rust operations used, the Lean kernel and Lean's standard axioms. Everything outside those kernels is tested, not proved, and the kernel specifications are not yet machine-linked to the calculus. How we know lists each kernel.
Measurements
We publish measurements as they come, including results that do not favour us. Every agent-facing operation is budgeted at 1 s p95 with a 5 s ceiling; on a 100,000-file repository every trial operation's p95 is under 0.5 s, and through serve the p95 is 27 ms for retain, 166 ms for prepare and 53 ms for show (tables). The agent pilots below use six precise-edit tasks, one Sonnet agent per task and arm, graded byte for byte against hidden expected files. One repeat per cell: debug pilots, not headline results.
| 9 Nov 2026: full Writfold flow | Ordinary tools | writfold trial |
|---|---|---|
| Correct, exact bytes | 6 / 6 | 6 / 6 |
| Checkout left untouched | No (edits it) | 6 / 6 |
| Applied edits with approval, claim and outcome in a validated ledger | — | 5 / 5 |
| Mistaken preparation caught before approval | — | 1 |
| Total tokens | 203,843 | 235,976 (+15.8%) |
| Tool calls / wall time | 24 / 99 s | 35 / 145 s |
| 8 Nov 2026: Splicery edit step only | Ordinary tools | Splicery |
|---|---|---|
| Correct, nothing else touched | 6 / 6 | 6 / 6 |
| Total tokens | 208,074 | 234,106 (+12.5%) |
| Tool calls / wall time | 24 / 52 s | 30 / 79 s |
Correctness was equal in both pilots, and the Writfold flow cost about 16% more tokens: there is no token win yet. What it adds is structural: the agent never wrote the checkout, and every applied edit carries a verified approval and a recorded outcome. In one task the agent’s first preparation would have joined two lines; it was never approved, a corrected one was applied, and the rejected one never touched a file. In these pilots the agent approved its own edits, so they measure mechanics and overhead, not human review; approval has since become CLI-only for serve sessions.
The projection pilot compared Tuft with grep-and-read on six evidence-finding tasks (two repeats each, same model). Correctness was 12/12 in both arms, and the Tuft arm used 5.3% more tokens, more on every task. The tasks had 1 to 9 matches, so Tuft's budget and omissions never came into play. Agents also retyped Tuft's quoted rows by hand where grep output could be piped, and Tuft's headers and byte ranges roughly doubled the tool output. A second projection pilot used lean compact output and tasks with up to 297 matching lines: correctness was again 12/12 in both arms, and the Tuft arm used 3.1% more tokens, more on all six tasks. Its tool output was 5.6% smaller, but agents wrote longer programs and made more calls, and grep pipelines already kept the other arm's output small. So Tuft's typed output costs about the same as grep: within 3.1% of grep's tokens, Tuft gives search pinned to one commit, a completeness signal (coverage, omissions, cursor) and retained citations a Weft report and an approval can bind to. It does not save tokens on lookups a shell pipeline can reduce. Raw data: projection pilot 2, projection pilot, trial-flow pilot, edit pilot.
04 / Next
Done in the trial profile: a durable, validated ledger with grants; retain, prepare, approve, apply and recover through the CLI; show, retain, prepare, run and evidence reads through serve; Tuft v0; evidence reuse across sessions; a Dolt writer with a first publication path. Not built: semantic or fuzzy search, a live knowledge service, named contexts and receipts beyond the trial ledger.
Harder reliability tasks (an unfamiliar repository, multi-file edits, a file changed between prepare and apply), and trial state found without an environment variable, the main trip in the first pilot.
A signed candidate binding, first publication into an empty realm, and a TLA+ model of the publication order, with its decision code proved.
Omnigraph behind the same boundary once it is admitted.
05 / Changelog
serve now runs the one-command trial run and reads retained evidence (trial/run, trial/evidence-list, trial/evidence-show), as a revision of writfold.trial/1; the Weft binary is fixed when the server starts, never named by the client, and approval stays CLI-only. Dolt publication, first slice: one signed approval publishes one candidate; Dolt commits first and moving the Git release ref is the only point it becomes visible, so a crash leaves an interrupted publication that is completed with Git steps only. A kill sweep against real Dolt ended with no double publication and found two crash bugs, both fixed. Tuft's resume cursor is now typed and bound to its program, commit and rows. A first reliability pilot measured mistakes instead of tokens, with a smaller model: 23 of 24 clean trials with ordinary tools, 24 of 24 with Writfold and Tuft, too close to tell apart; the tasks were too easy.
One command, writfold trial run, goes from a Tuft query through a Weft check to a prepared edit and stops at approval. writfold trial evidence list and show read retained evidence back in a later session, verified against its digest. Dolt, the interim backend, gained a conditional single writer: one transaction guarded by the expected head, an exclusive writer lease and a signed approval; an interrupted write is Unknown and never retried, and passed a kill sweep against real Dolt. The trial's edit-flow validator is now proved over the shipped Rust, and a TLA+ model of the trial stream (crashes, recovery and an outside writer) checks with no violation while two deliberately broken variants are caught. Tuft got its own page, compact output and two more pilots.
Source-only preview v0.1.0-dev.1: a cooperating single-user trial that runs end to end, with its commands reproduced from a fresh clone. New: trial retain keeps exact bytes as citations; Tuft v0 finds, retains and projects exact evidence over a pinned commit; a Weft report is bound at prepare and approve --require refuses unless named checks are entailed; trial show prints five independent badges; serve exposes show, retain and prepare, with approval CLI-only. Proved over the shipped Rust: revocation, the recovery outcome and the required-check gate; 20 of 20 semantic mutants rejected. An adversarial campaign ended as expected in 8 of 8 cases, including 60 random SIGKILLs during apply. A sparse worktree cut prepare on a 100,000-file repository from 7,772 ms to a p95 of 239 ms. Dolt became the interim backend behind a swappable storage boundary; Omnigraph remains the target, and Dolt writes are not built.
Decision kernels proved over the shipped Rust with Charon/Aeneas and Lean 4: Writfold's ledger and grant authority (51 theorems), Weft's set algebra, verdict classification and reuse comparison, and Splicery's edit rendering. Every deliberately broken copy of each kernel breaks its named theorem. The proofs found and fixed an integer-overflow edge in the ledger's sequence check. Splicery's Verus proofs for that kernel were retired in favour of these.
First connected flow: writfold trial prepares a Splicery edit in Writfold’s own worktree of any Git repository, signs a grant and approval, and applies the edit only after re-verifying them and the file. Every step is recorded in a durable, kernel-validated ledger stored in Git. A cooperating single-user trial profile, not the hardened path.
Repositories made public. First agent edit pilot published, with no measured win yet. Signed operator grants and revocations, and a current-grant check that agrees with the Lean model on 79 exported steps. Signed approval of one exact prepared edit; a validated ledger that replays full history before each conditional append; procedure checking and the ledger now checked against cases exported from the Lean model. Also tested as separate parts: exact object storage, Git worktree creation and ledger-head decoding. Weft accepts large prior reports for reuse.
Rust Omnigraph data path tested. A source build of Omnigraph PR #1235 passed the scoped relocation and restore test. Scope of the first experimental release agreed.
Writfold, Weft and Splicery exercised together: 12 scenarios across 29 invocations.
writfold serve stdio session, citation components and dependency locks.
The twelve engineering theorems proved in Lean under stated assumptions.
Semantic core ported to Rust; static Linux builds.
Writfold started as the Rust successor to an earlier private prototype.
Every published file on this site is listed with its SHA-256 in the content manifest.
06 / FAQ
As a cooperating single-user trial. An agent can run writfold trial and writfold tuft run from its shell, or call show, retain, prepare, run and evidence reads through writfold serve; approval stays with the operator's CLI. Writfold never writes your checkout, but in this trial nothing stops the agent's own shell from doing so.
No. The agent keeps its own loop and model. Writfold is designed as the layer it goes through for retained evidence and for every change to your files.
Not today. Writfold speaks its own stdio JSON-RPC profile, writfold.agent/1, with the writfold.trial/1 capability. MCP is not implemented.
Not for the trial: it keeps its ledger in a local Git repository. Omnigraph, run locally as a companion process, is the target backend; until it is admitted, Dolt is the interim backend behind a swappable boundary, with a conditional single writer and a first publication path. There is no hosted service and no account.
Use the preview on repositories and data you can delete and recreate. It is a cooperating trial for one user: it assumes nobody races it on its worktree and that the repository is not hostile.
Not as a measured win. In all five pilots the Writfold or Tuft arm used more tokens than ordinary tools, with equal correctness: 16% more for the trial flow, 5.3% and 3.1% more for Tuft projections, and 1.7% more for reading retained evidence back in a later session. With lean output, Tuft's typed, pinned and citable results cost within about 3% of plain grep. A sixth pilot measured mistakes instead, with a smaller model; both arms were nearly always right, so it could not tell them apart.
Yes. The Writfold, Weft and Splicery repositories are public, and this website is public under the MIT license. The v0.1.0-dev.1 tag is a source-only preview; there are no release binaries.
Rust gives a single static binary. Lean states the model and proves its core properties. Aeneas translates small Rust decision kernels to Lean so they can be proved as shipped. Verus checks selected Rust function bodies against their contracts.
No, not as a whole. A few decision kernels are proved over the shipped Rust: the ledger, grant, revocation, recovery-outcome, required-check and edit-flow decisions, plus Weft's and Splicery's kernels, listed on How it works. Everything else is tested or measured, and much of the harness is still a design.