Folder sites
.culm/: Culm's own record
.culm/
head current revision number
blobs/<sha256> file contents, stored once each
revisions/<n>.json { files: { path: sha256 }, by: "culm" | "outside", key?, request?, result?, time }
journal.json present only while a batch is being written
lock present only while a process is writing.culm/ is the history of the folder. A revision is a set of file contents, not a copy of the document, so a restore writes those contents back and comments and layout return exactly. It is not edited by hand, and culm init writes a .gitignore that excludes it, so history is per machine.
What a revision covers. culm.json, site.json, and every file under pages/, pieces/ and blocks/. Not data/, assets/ or fonts/.
Only apply and restore write to .culm/. dev, build, check, schema, expand and every read write nothing there.
A batch is wholly visible or wholly absent, with its key, including after a crash at any step. The rename of head is the single commit point. On the next open, a revision record above head is deleted, and the files in a journal are restored from the head revision's blobs.
Hand edits. apply and restore record an outside revision first if the files changed since head, holding the lock, and the revision number always advances. Any number of saves between two batches is one outside revision. A batch from a revision before it is REVISION_CONFLICT.
SOURCE_CONFLICT. The revision matched when the batch was planned, and a file to be edited changed before the write. Nothing is changed.
Files that do not load. Nothing is recorded. head returns the located problems, and plan, apply, reads and measure return them as the refusal until the files load again.
The lock is stale when its process is gone or it is older than 60 seconds. It is taken over by an atomic rename, so only one of two contenders succeeds. culm dev and culm mcp can run on one folder; only writers take the lock.
Size. The last 200 revisions are kept, with their keys. Blobs no kept revision names are deleted when revisions are pruned. A restore or diff that names an older revision is UNSUPPORTED_CAPABILITY, and a key of a pruned revision is treated as new.
What losing .culm/ means
Your files are the site. If .culm/ is deleted:
the site loads and builds exactly as before;
every earlier revision is gone, so diff and restore to an older revision are UNSUPPORTED_CAPABILITY;
every request key is forgotten, so a retry of a batch sent before the loss is applied again, not answered from the record;
the next revision numbers are the Unix time in seconds, and count up from it, so a number from the lost history is lower than any number in the new one. A batch, cursor or key that names an old number is refused, never matched to a different state.
A store that is running when .culm/ is deleted never restarts at an old number either. Damage that is not a clean deletion (a missing head beside several revision records, an unreadable record) is reported as a problem naming the file, and nothing is rewritten.
The JSON Schema for editors
culm schema writes culm.schema.json, generated from the registry: the node fields, the settings and style properties each kind allows, short forms with each block's settings, uses of pieces, and the site and page files. Every file's $schema names it, so an editor completes keys and flags a misspelt kind.
The schema and validateSite are two statements of what is valid, and they can disagree. The schema never refuses what validation accepts; this is tested on every valid fixture. The reverse is allowed: the schema cannot express depth and count limits, references between nodes, or a product's rules, so a file that passes the schema in the editor can still fail validation on save.
What this does not protect
Four limits are stated here and are not tested away. The ones for live data, islands and packages are detailed in app/live-data.md, app/islands.md, app/packages.md and app/policy.md.
A plug-in in culm.json runs as code. Culm imports each named package and runs it with the privileges of the process, which is yours. A plug-in can read and write any file you can, and open the network. Install only plug-ins you would run. A plug-in whose real package root or entry file is inside the project and outside <project>/node_modules is refused, so a node_modules entry that is a symbolic link into the project does not load; a link to a folder outside the project loads, because workspaces and pnpm link packages that way. Hard links are not detected, and the dependencies of a plug-in are not checked. Block and data files are data: they cannot name a function.
A caller with file access can bypass every operation. The operations, the revision check, the request keys and the protect guard (see mcp.md) are rules for callers that go through plan and apply. Anyone or anything that can write the files can write a file the guard would have refused. Culm then sees an outside revision and validates it on the next load, but it does not stop the write. Protect the folder as you protect the source of the site.
A package is someone else's code, and approval is disclosure. culm approve shows a person what a package holds and records that they did. It is not a review. culm.lock.json and packages/ decide what code the site carries, so review every change to them like code. A shell with a pseudo-terminal could still run culm approve, as it could edit the lock by hand. An in-page island and a framed island each have limits of their own (an in-page island is trusted code that can read the sign-in key; a framed island can leak the rows it was granted).
The policy does not restrict navigation, and not every host sends it. On github-pages it reaches the visitor only as a <meta>, without frame-ancestors or report-uri. A page that shows content only when signed in is still a public file.
Not built yet
A change to a plug-in's own code is not picked up by culm dev: Node caches an imported module, so restart the server.
Previous
Next