Docs · alpha · macOS on Apple Silicon

How LastDB keeps data on disk.

On-disk data lives in folders called homes. This page is a plain-English walk through one home: what a run is, how a write becomes durable, how a read finds a key, and why deletes wait for a merge.

Last reviewed 27 November 2026 against the laststore disk format and the Explore design notes for homes and the commit log.

01 · The home

One LastStore folder. Four named parts for the sealed set.

A home holds a sealed set of runs.

A home is a directory. Inside it you will find a small descriptor that identifies the home, a LOCK file so only one process writes at a time, CURRENT (the official list of live data files), and a runs/ folder for those files.

LastDB uses one home for records and another for record files (attachments). The diagram below is one home; both homes share this shape.

HOME · ONE LASTSTORE FOLDER DESCRIPTOR identifies this home LOCK one writer at a time CURRENT official list of live runs RUNS/ immutable data files each written once never changed in place THE SEALED RUN SET · RECORD HOMES ALSO KEEP A COMMIT LOG
Fig. 1 — One home folder
02 · A run

One file of records, written once.

Runs are immutable.

A run is one file of records sorted by key. It is written once and never changed. Each record is a key plus a value, or a key plus a delete marker.

The file is split into blocks. Each block is compressed with zstd when that makes it smaller, then encrypted with AES-256-GCM using a key derived from the home’s key.

Everything is encrypted at rest, block by block. A reader that does not hold the home key cannot read the records.

03 · Writing

Log first. Seal later.

Commits land in a log before a seal.

On the record home, a write appends a complete commit to an encrypted commit log and flushes it. That commit is durable and readable right away. A later seal freezes those logged commits into a new run, makes the run durable, and only then publishes it by atomically swapping in a new CURRENT.

COMMIT LOG durable · readable later SEAL new run DURABLE on disk CURRENT swap A FLUSHED LOG COMMIT IS LIVE BEFORE THE SEAL readers see whole commits · sealed runs advance CURRENT unnamed run files are deleted on restart · durable log frames above CURRENT replay
Fig. 2 — Commit log, then seal

A reader always sees whole commits. Reads consult the logged commits first, then the sealed runs named by CURRENT.

A crash cannot leave a half-published run in the live set. On restart, run files that CURRENT does not name are deleted. Durable log frames above the sealed frontier are replayed.

04 · Reading

Log first, then runs newest to oldest.

Lookups check the log, then the runs.

  1. 01

    Skip what cannot hold the key.

    After the logged commits, lookups walk sealed runs newest to oldest. A bloom filter skips runs that definitely do not hold the key.

  2. 02

    Read two blocks on a hit.

    A hit in a run reads one index block and one data block.

  3. 03

    Newest version wins.

    If the newest version is a delete marker, the record is gone.

05 · Deletes

A marker now. Reclaim later.

Deletes are not instant on disk.

Runs are never edited in place, so removing one record would mean rewriting a whole file. Instead a delete saves a small marker that hides the old value from later reads.

When these markers are estimated to hide enough logical data, background work seals them into a run. A later base merge removes obsolete data. Readers can delay removal of old files.

06 · Merging

Eight into one. Space first.

Merges reclaim deleted and replaced data.

Eight runs of a level merge into one, keeping only the newest version of each key.

Base compaction becomes eligible when obsolete data exceeds both 64 KiB and one eighth of the logical bytes in the runs. Those bytes are counted before compression.

Merges reserve disk space before writing. If space is insufficient, they preserve the previous saved state and leave the work for later.

Disk format reference: laststore README. Commit-log and dual-home detail is in the Explore guide.

Build an app: the developer guide →

07 · Related

Other pages.

INSTALL

Install LastDB

The installer script, the same steps by hand, the database on its own, and how to confirm it is running.

USE

Daily Loop

Brain for notes and decisions, LastSecrets for credentials, and MCP for agents.

OPERATE

Node Health

The health check, the status command, and when a restart is the right step.

Build an app: the developer guide →