Introduction
Sekai records chunk-level deduplicated commits of Minecraft Java region
files (.mca) and rebuilds the world from any commit quickly. It is
built for frequent hot-recovery — rewinding a live server after griefing
or a bad update — rather than long-term archival.
Identical chunk payloads are stored once and shared across commits via content-addressed storage, so an unchanged commit costs roughly one metadata row instead of a full world copy. Checkout reproduces the exact bytes captured for the commit, atomically and verbatim.
Sekai ships two things:
- the
sekaiCLI documented in this guide, - a reusable Rust library (
sekai-appoversekai-core) for server-management software. The library API is documented with rustdoc (cargo doc); this book covers operating the CLI only.
Design background lives in ARCHITECTURE.md: layering, the two-layer hashing model, and the commit-graph data model. The machine-readable output contract lives in docs/json.md.
Installation
Prebuilt binaries are attached to each GitHub Release
(sekai-<target triple>.tar.gz). Alternatively, with a Rust toolchain
installed (the pinned version is in rust-toolchain.toml):
cargo install --git https://github.com/tmcjapan/sekai
The installed binary is named sekai.
Verify the setup:
sekai --help
Quickstart
# Create the store (once, before any other command)
sekai init
# Record the current world state (pause the server first; see
# "Server coordination")
sekai commit ./world
# Preview what a commit would record, without writing anything
sekai status ./world
# List commits
sekai log
# Rebuild the world from a known commit (overwrites region files)
sekai checkout ./world 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a
# Restore one area from HEAD (or --source <rev>), like git restore
sekai restore ./world --in overworld:-8,-8..7,7
# Compare chunk NBT between two commits (hashes from `log`)
sekai diff 1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a --in overworld:0,0
The store defaults to .sekai; see Store location for
using another location. Every
command accepts --json for machine-readable output and, except log,
init, and cache clean, --timing for a per-phase breakdown.
commit, status, checkout, restore, diff, and cache update take
--progress for a stderr progress bar (refused with --json). commit,
status, checkout, restore, and diff accept a scope
(--in, --region, --kind); nothing selected means the whole world.
Restore is the exception: like git restore’s pathspec, it requires a
selection.
Store location
By default sekai uses a store directory named .sekai in the
current working directory. In that case --store can be omitted
from every command:
sekai init
sekai commit ./world
sekai log
Pass --store only when you want a store somewhere else:
sekai --store ./backups/sekai init
sekai --store ./backups/sekai commit ./world
--store is a global option and works with all subcommands.
Initializing a store
sekai init is the only command that creates a store; run it once
before anything else. Every other command (including commit) fails
on a missing store and asks you to run sekai init first.
Like git init, re-running init on an existing store is safe: it
reports a re-initialization and leaves the recorded history untouched.
Store configuration
sekai config reads and writes store settings in <store>/config.toml,
like git config limited to the repository scope — there is no global
config. The first setting is the commit author name:
sekai config user.name "Alice" # set
sekai config user.name # read (prints just the value)
sekai config --list # every set key as key=value
sekai config user.name --unset # remove
Keys are case-insensitive; an unset key fails with exit 1 unless
--default <value> supplies a fallback. Like every command, config
opens the store exclusively, so it cannot run while another process
holds the store (a running backup); a store link resolves to the real
store root. --json emits the standard envelope (see docs/json.md).
Worktrees
A store can back up several worlds, each registered as a worktree keyed
by the store location it opens: the store root itself for the store’s own
(main) worktree, a store link file for a linked one. Linked worktrees
share the store’s history, blobs, and cache. See
Worktrees for sekai worktree list and
sekai worktree remove.
Secondary backups
For a full secondary backup of everything — commits, metadata, blobs, and the region-image cache — copy or archive the entire store directory to an external location. Store writes are crash-ordered (CAS blobs flushed before the metadata commit that references them), so a copied store is self-consistent. The cache is derived and rebuildable, so leaving it out of a backup only costs performance on the next run.
Server coordination
sekai never touches the server process. Pausing writes around a commit
belongs to the caller or the administrator — never to the tool:
save-off(stop the server from writing region files),save-all(flush pending writes to disk),- run
sekai commit, save-on(resume).
Committing a world that is being written concurrently can capture torn sectors. Reads tolerate trailing partial sectors the way vanilla does, but genuinely corrupt runs fail loudly instead of being recorded silently. Checkout reads only from the store, so it needs no server coordination beyond stopping the server before you let players back in — checkout overwrites live region files.
World layouts
Three server families share the .mca format but not the directory
layout. Sekai reads the path you pass through one detection step, turns
the result into a dimension map (one directory per observed dimension),
and everything else — commit, checkout, and diff — works from that
map. Pass the same path on every run.
Layouts
- Vanilla: one world folder (
region/,DIM-1/,DIM1/, and since 26.1dimensions/minecraft/<name>/). - Bukkit-family (Bukkit/Spigot/Paper/Purpur, pre-26.1 layout): the
server root, holding
<base>/,<base>_nether/DIM-1/, and<base>_the_end/DIM1/, wherebaseis thelevel-name(worldby default). Each datapack dimension<namespace>:<path>lives in its own sibling folder<base>_<namespace>_<path>/dimensions/<namespace>/<path>/. Paper 26.1+ migrates to the vanilla layout. - Plugin worlds (Multiverse et al.): arbitrary folders, detected by their contents.
Detection
Opening a world classifies the root once:
- Sekai reads
server.propertiesat the root, when present, and takes the first uncommentedlevel-name=line; the value is trimmed, and a missing, unreadable, or unusable value counts as “no name” — unusable means empty, or anything but one plain directory name (no separators, no./..), so a corrupted file cannot point the layout outside the observed root. - A directory counts as a world folder when
region/,entities/, orpoi/inside it holds at least one parseabler.<x>.<z>.mcafile. - Bukkit candidate bases are tried first: the
level-namebase when one is known, otherwise bases elected from structure alone — a folder nesting adimensions/tree, or one with a_netheror_the_endsibling folder (worldwins ties, then lexical order). The first match wins:
Bukkit candidate bases (level-name, else elected from structure)
├─ <base>/dimensions/minecraft/<name>/ is a world folder? → Bukkit, 26.1 layout
└─ <base>/, <base>_nether/DIM-1, <base>_the_end/DIM1? → Bukkit, split layout
dimensions/minecraft/<name>/ is a world folder? → Vanilla, 26.1 layout
region/, DIM-1/, or DIM1/ is a world folder? → Vanilla, legacy layout
none of the above → empty legacy layout
Only the first matching layout is observed: leftovers of another layout
(for example legacy folders next to a 26.1 dimensions/ tree) stay out of
discovery. A root that matches nothing yet becomes an empty legacy-layout
world; discovery of a missing root still fails loudly. A directory that
cannot be inspected (permission denied, or a kind directory that cannot
be listed) fails the open loudly as well, instead of silently changing
the observed layout.
The dimension map
Detection picks the layout; collection then resolves one directory per observed dimension:
Bukkit, 26.1 every <namespace>/<name> under <base>/dimensions/
Bukkit, split <base>/ (overworld), <base>_nether/DIM-1, <base>_the_end/DIM1,
plus every <namespace>/<name> under each sibling's dimensions/ tree
Vanilla, 26.1 every <namespace>/<name> under dimensions/
Vanilla, legacy region/ (overworld), DIM-1, DIM1,
plus dimensions/<namespace>/<name> when present (pre-migration datapacks)
- The split layout’s sibling folder name is ambiguous (
<namespace>and<path>may both contain_), so a datapack dimension takes its identity from thedimensions/tree inside the folder, not from the folder name. - Empty dimension directories stay in the map, even before their first region file appears.
- Each dimension is keyed by a stable hash of its canonical
<namespace>:<name>id. The vanilla trio always usesminecraft:overworld,minecraft:the_nether, andminecraft:the_end, wherever its files live, so a world that migrates between layouts (say, Paper 26.1 flattening the split layout intodimensions/) keeps the same ids — and one continuous history. Renaming the world folder does not change ids; renaming a dimension directory (or its namespace) starts a new history for that dimension.
Discovery
For every dimension in the map, sekai walks the three region families and yields the files a commit or checkout operates on:
dimension dir ─▶ region/ entities/ poi/
─▶ entries sorted by name
─▶ keep parseable r.<x>.<z>.mca files;
two spellings of one coordinate are an error
─▶ (RegionKey { dim, kind, x, z }, actual path)
- Each result carries the path discovery actually found, so non-canonical
spellings such as
r.00.00.mcaare read, backed up, and restored. - Two spellings of the same coordinates (
r.0.0.mcaandr.00.00.mca) are ambiguous: the name alone does not say which one the game reads, so discovery fails instead of picking one and dropping the other.derive_regionstill names the canonicalr.<x>.<z>.mcafor restoring a region whose file is missing. - Symlinks are followed, like the game does; a missing kind directory is read as empty, but a missing world root or an unreadable directory fails loudly instead of silently dropping a dimension.
- Checkout derives its target paths from the map; when folders
have moved since the commit, a missing region file is restored next to a
live sibling of the same dimension, and when no observed location exists
the run fails loudly (
UnknownRegionPath) rather than writing somewhere wrong.
The wider architectural summary lives in ARCHITECTURE.md (“World Layouts”).
Concepts
- Commit: one recorded world state, identified by a content-addressed
Blake3 hash over its parents, creation time, and delta (
logshows them oldest first, using the store’s local record order). Commits store only fresh rows; reads resolve effective state through fallback, so metadata grows with changes, not with universe size. Recording the same commit twice is idempotent. - Ref: a named, movable pointer to a commit - sekai’s branch. One ref is active, and new commits hang from it.
- Chunk hash (CAS key): the normalized digest of a decompressed chunk,
over a canonical encoding with volatile tags such as
LastUpdateexcluded. It is independent of the order of the chunk’s top-level keys and of the compression codec; keys sekai does not read never affect it.entities/poipayloads have no level-chunk schema, so they key on their exact bytes. Identical content shares one stored copy across all commits; checkout restores the captured bytes verbatim, rewinding volatile tags to capture time. - No separate diff hash:
diffcompares the very same digest recorded at commit time, read straight from history. Only well-formed NBT is a chunk: aregion/payload must decode as a level chunk, and anentities/poipayload must be well-formed NBT. A payload that cannot be normalized gets no key and fails ingest instead of being stored under a byte-level identity. - Tombstone: an explicit “chunk absent” row. A chunk deleted between commits is recorded as a tombstone, not as silence — this is what lets checkout delete it again faithfully.
- No derived state table: region fingerprints are not persisted. Every commit rereads in-scope files and writes rows only for chunks whose blob changed. The region-image cache is derived state outside the metadata schema: wiping it costs performance only, never history correctness. See Cache.
The authoritative definitions are in ARCHITECTURE.md (“Data & Hashing Model” and “History and State Model”).
Scope selection
commit, checkout, restore, and diff accept a scope: the whole
world by default, or per-dimension areas. Entries compose by union;
--kind (repeatable, empty means all) applies to every area. Restore
is the exception: like git restore’s pathspec, it requires a selection.
sekai commit ./world --in overworld --kind region --kind entities
sekai checkout ./world 3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d --in overworld:0,0..31,31
sekai restore ./world --in overworld:0,0..31,31
sekai diff 1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a --in overworld:0,0
--in DIMselects a whole dimension;--in DIM:x,zone chunk;--in DIM:x0,z0..x1,z1an inclusive chunk rectangle.--region DIM:RX,RZselects every chunk of one region file (rectangle shorthand).--kindselects region families (region,entities,poi). Alone it narrows the whole world to those families.
The scope is a filter, not a partition: a scoped commit reads as the truth for its scope only (out-of-scope coordinates record nothing and resolve through fallback), and a scoped checkout never touches files outside the scope. See ADR-0003.
Named scopes
An area you select over and over can be saved in the store once and
selected by name with --scope on commit, status, checkout,
restore, and diff. Scopes live in the store, so it must exist first:
run sekai init before scope create on a new store.
sekai scope create spawn --in overworld:-8,-8..7,7 --region nether:0,0
sekai commit ./world --scope spawn
sekai scope list
sekai scope delete spawn
scope create <name>takes one or more--in DIM:x,z,--in DIM:x0,z0..x1,z1, or--region DIM:RX,RZareas. A whole dimension (--in DIM) is refused: every area is stored as a chunk rectangle. An existing name fails unless--forcereplaces it.- A named scope covers every region family;
--scopecannot be combined with--in,--region, or--kind, and names one scope per run. - The name is looked up when the command runs: replacing a scope changes what later runs select, never what earlier commits hold. An unknown name fails.
- Scope names follow the ref name rules (ASCII alphanumerics plus
.,_,-,/; 1-64 bytes), but may be all digits.
See ADR-0021.
Commit
sekai commit ./world
Records the current world state as a new commit and prints the commit hash, chunk/blob counts, and tombstones. Recording an identical commit again returns the existing hash without adding rows.
Before recording, the command runs the same pass as cache update over
the whole world, warming the region-image cache so diff and status
can prove unchanged regions right away (see Cache). With
--timing, cache_ms measures that pass and the total spans both.
--jobs Nsets the worker count for both passes (0means one per CPU).--progressshows a stderr progress bar (refused with--json).- Scope flags (
--in,--region,--kind) restrict what is recorded; see Scope selection. - For a dry-run preview of the above, see
statusunder Inspection. - The store must already exist: run
sekai initfirst (see Store location). A missing store fails without creating anything.
Every region file in scope is read on each commit; unchanged chunks resolve through fallback and cost no new blobs or history rows. A commit with no changes still writes one commit row.
Checkout
sekai checkout ./world 1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b
sekai checkout ./world 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a --in overworld
Rebuilds the world from a commit, overwriting region files atomically
(temp file in the target directory + fsync + rename; in-place
mutation never happens). The commit argument is a revision: a 64-character commit hash, a ref name, or HEAD (alias @), optionally followed by one ~<n> to step back to an ancestor, such as HEAD~1. Files are stamped with the commit time, and
volatile tags are rewound to capture values.
The default policy is strict:
- region files unknown to the commit (created afterwards) are deleted;
- chunks unknown to the commit vanish on rebuild;
- tombstoned chunks are removed (fully tombstoned regions delete the file, never leaving a header-only shell);
- a blob missing from CAS aborts loudly (corruption — a partial world would be worse than none).
Each behavior is configurable without changing the default:
| Flag | Effect |
|---|---|
--keep-post-commit-files | keep commit-unknown files instead of deleting them |
--keep-post-commit-chunks | keep live bytes for commit-unknown chunks inside rebuilt regions |
--keep-tombstoned-chunks | keep live bytes for tombstoned chunks; fully tombstoned files are left alone |
--on-missing-blob skip-chunk | skip chunks whose blob is missing (default abort) |
--on-missing-file derived-only|error | ignore sibling folders, or fail, instead of guessing a location (default sibling-first) |
--jobs Nsets how many files rebuild at once (0means one per CPU).- Scope flags (
--in,--region,--kind) rebuild and delete only inside the scope; see Scope selection. Combine with--timing/--jsonas usual. - Before rebuilding, the CLI echoes the target commit, scope, and policy to stderr (human output only).
For the narrower case — undo local changes in one area against HEAD (or another source) without recording anything — see Restore.
Restore
sekai restore ./world --in overworld:-8,-8..7,7
sekai restore ./world --source HEAD~1 --scope spawn
sekai restore ./world -s main --overlay --region overworld:0,0
Restores the selected portion of the world from a source commit —
sekai’s git restore. Where Checkout rebuilds the world
(or a selection) from a commit you name, restore is the everyday
hot-recovery case: undo local damage in one area against the commit the
world is currently on, without naming it. Nothing is recorded and no
ref moves; region files are rebuilt atomically from the captured
payloads, exactly like checkout.
Source and selection
- The selection plays git’s pathspec and is required: spell areas
with
--in/--region, or name a saved scope with--scope(see Scope selection). A baresekai restore ./world— or--kindalone, which narrows families but spells no path — fails withyou must specify path(s) to restore. Whole-world rebuilding stays checkout’s job. --source <rev>/-s <rev>names the restore source: any revision checkout accepts (a commit hash, a ref name,HEAD/@, optionally one~<n>step). Omitted, it defaults to the active ref’s target (HEAD) — sekai has no index, so HEAD replaces git’s index default. An unborn HEAD (no commit to continue) fails withno commit selected.
What gets written
The default follows git restore’s no-overlay mode:
- region files inside the selection that the source does not know (created afterwards) are deleted, to match the source exactly;
- every rebuilt file holds exactly the source’s chunks: chunks created after the source commit vanish, and tombstoned chunks are removed (fully tombstoned regions delete the file);
- a blob missing from CAS aborts loudly, like checkout.
Each behavior is configurable without changing the default:
| Flag | Effect |
|---|---|
--overlay | keep source-unknown files instead of deleting them (git’s overlay mode); rebuilt files still hold exactly the source’s chunks |
--on-missing-blob skip-chunk | skip chunks whose blob is missing (default abort) |
--on-missing-file derived-only|error | ignore sibling folders, or fail, instead of guessing a location (default sibling-first) |
--jobs Nsets how many files rebuild at once (0means one per CPU).- Combine with
--timing/--json/--progressas usual; the JSON payload is checkout’s shape under therestoreenvelope (see Automation). - Before rebuilding, the CLI echoes the source, scope, and policy to stderr (human output only).
Pause the server’s writes first, exactly like checkout; see Server coordination.
Inspection
These commands never write to the world or the store.
sekai log
sekai status ./world
sekai diff 1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a --in overworld:0,0
logprints commits oldest first with raw Unix-millis timestamps (RFC 3339 rendering is human-output only).--statappends per-commit change statistics (fresh/tombstone/new-blob/effective counts). An empty store prints a note to stderr and exits 0.statuspreviews what a commit would record: the basis commit (latest,nullwhen the store is empty), changed regions (new and deleted files split out), chunks that would be newly recorded, tombstones, and blobs absent from CAS.cleanmeans nothing in scope differs from the latest commit; counts match a subsequent commit unless the world changes in between. There is deliberately nocommit --dry-run:statusis that command.diffcompares chunk NBT between two commits, or between the live world (--world) and a commit. One--in DIM:x,zselection keeps the single-chunk output; several selections switch to grouped output, omitting chunks without differences. Scope flags (--in,--region,--kind) select the compared chunks; see Scope selection. A chunk absent or tombstoned on a side diffs as an empty compound there — missing coordinates are never errors (see ADR-0006); only corrupt payloads and missing blobs fail loudly. With commit arguments, a missing newer side defaults to the active ref’s target and a missing older side defaults to the newer side’s lowest-ID parent; when both are omitted, diff uses the active ref’s target against its lowest-ID parent, so a root commit has no implicit older side and the command errors — pass the older commit explicitly or use--world(whose single commit defaults to the active ref’s target).--show-valuesprints concrete old/new values in human output.- Worktree administration has its own page:
worktree listandworktree removeare covered under Worktrees.
Worktrees
A worktree is one world a store backs up. Each is keyed by the store location it opens — the store root itself for the store’s own (main) worktree, a store link file for a linked one — and carries its own HEAD (a branch name or a detached commit). Every worktree of a store shares that store’s history, blobs, and cache.
sekai worktree list
sekai worktree remove ./world-2/.sekai
Worktrees are a local-store feature
(ADR-0038):
the backend-neutral layers know nothing of them, so these commands open
the store directly instead of going through an app operation. The store
must already exist; run sekai init first (see
Store location).
Listing worktrees
worktree list prints every worktree the store backs up, mirroring
git worktree list: the store’s own (main) worktree first, then the
linked ones in path order, each with its abbreviated HEAD and
[branch] or (detached HEAD):
/home/me/world/.sekai 3f2a9c1 [main]
/home/me/world-2/.sekai be71d40 [feature/village]
A HEAD on a branch with no commits yet is unborn and shows zeros, like Git’s null object ID.
--porcelainswitches to Git’s record-block format: one block per worktree withworktree,HEAD(the full 64-hex commit ID), thenbranch <refname>ordetached, blocks separated by a blank line.-zrequires--porcelainand terminates every line, the separators included, with NUL instead of newline.-v/--verboseis accepted for compatibility but has no effect: sekai worktrees carry no locked or prunable annotations, and there is noworktree prune.--jsonreports the same rows aspath,commit(nullwhile unborn),branch(full refname,nullwhen detached), andmain; the payload contract is docs/json.md. It is exclusive with--porcelain/-z.
Removing a worktree
worktree remove <worktree> removes a linked worktree, mirroring
git worktree remove [-f] <worktree>:
sekai worktree remove ./world-2/.sekai
The positional is the store location the worktree opens (its store link
file), the same spelling --store accepts for it. Removal deletes that
link and the registration only — the world directory the worktree backs
up is left untouched.
- The store’s own (main) worktree is refused
(
'<path>' is a main worktree), as is an unregistered location ('<path>' is not a worktree). Both exit 1. -f/--forceis accepted and repeatable (-f -f), but inert: sekai worktrees carry no dirty or locked state, and the refusals are never overridden.- A link that is already gone is not an error: the registration is still cleaned up, like Git cleaning up a worktree whose directory vanished.
--jsonreturns the removed location aspath; human output printsremoved worktree <path>.
Only list and remove are exposed by the CLI. A linked worktree is
registered through the local backend API (LocalStore::add_worktree),
which writes the store link naming the store’s absolute root; opening
that link with --store resolves back to the shared store.
Cache
sekai cache clean
sekai cache update --world ./world
cache manages the region-image cache, the speed-only keyspace inside
the store (cache/, beside meta.sqlite and blobs/). It holds the
undecomposed .mca image behind each region node hash so diff and the
status preview can prove a fully covered region unchanged without
decompressing or normalizing a single chunk (see
Concepts).
The cache is derived state, never history: every entry can be recomputed from the world and the snapshot tree.
-
cache cleanremoves every cached entry and reports how many were removed:cleared 12 cached region image(s)It is safe at any time. Cleaning never changes what a commit or checkout reads or writes; it only costs performance until the next commit rebuilds the entries it needs. Running it again on an empty cache reports
0— the operation is idempotent. -
cache updatehashes the live world’s region files and populates the cache without recording a commit:cached 3 new region image(s), 1 already present, 0 empty (4 files, 101 chunks)It reads and hashes every chunk exactly as a commit would, but writes only cache entries — no blobs, no metadata, no commit.
sekai commitruns this same pass before recording; use the standalone command to warm the cache aftercache clean, or before the first commit, sodiffandstatuscan prove unchanged regions right away.--worlddefaults to the current directory;--jobssets the hashing worker count (0means one per CPU). The whole world is hashed: a corrupt or unsupported chunk fails the run loudly, and entries already written stay. -
Use
cleanto reclaim space. Commits and blobs are append-only and are never deleted, so the cache is the only part of the store you can shrink. Cleaning before a secondary backup keeps the copy small; the restored store simply runs colder until its next commit (orcache update). -
The store must already exist: run
sekai initfirst (see Store location). A missing store fails without creating anything. -
--jsonreports the removed count asentriesforclean, andfiles/chunks/entries/existing/emptyforupdate; the full payload contract is docs/json.md.updateaccepts--timingand--progress;cleanhas no phases to time or items to count, so neither applies to it.
Automation
Every command accepts --json: stdout carries exactly one JSON document,
stderr stays silent on success, and colors never appear. Every command
except log, init, and cache clean accepts --timing, which prints a per-phase table in human
mode and merges the same block into the JSON document in --json mode.
--progress draws a stderr bar and is refused with --json.
Exit codes: 0 success, 1 runtime failure (stdout holds the error
envelope), 2 usage error (clap prints to stderr).
Dry runs by command:
| Preview | Dry-run means |
|---|---|
status | the whole command (commit has no --dry-run by design) |
checkout | none (checkout is destructive by definition) |
restore | none (restore is destructive by definition) |
The full contract — flag matrix, envelope, per-command payloads, and the compatibility promise — is docs/json.md. That page is the reference; this book does not duplicate it.
Troubleshooting
no store at <path>— the store was never initialized. Runsekai init(with the same--store) first; onlyinitcreates a store, every other command fails without creating anything.unknown commit: <hash>— no commit with that hash exists in this store. Checklogand copy the full 64-character hash. IDs are content-derived: the same parents, timestamp, and delta always produce the same hash, so an identical history in another store shares it.you must specify path(s) to restore— restore requires a selection, like git restore’s pathspec. Spell areas with--in/--regionor name a saved scope with--scope;--kindalone spells no path. Whole-world rebuilding is Checkout’s job.no commit selected: the store is empty or the active ref is unborn— restore without--sourcedefaults to HEAD, and there is no commit to restore from yet. Record acommitfirst, or pass--sourceexplicitly.blob missing from CAS: <hex>— store corruption (or a store copied incompletely). Checkout aborts rather than writing a partial world;--on-missing-blob skip-chunk(checkout and restore) continues without the affected chunks. Restore the store from the secondary copy, then investigate.cannot derive region path for dim ...(UnknownRegionPath) — a custom-dimension region whose folder the world’s layout cannot map. Run it against a world tree with the same folder layout the commit came from so derivation (and sibling lookup) can work.region file r.<x>.<z>.mca ... is missing ... refuses to derive its location(MissingRegionFile) —--on-missing-file error: the commit rebuilds a region whose file no longer exists, and theerrorpolicy forbids guessing where to rebuild it. Run it against the original layout, or drop the flag to recreate the file at the derived location.unsupported schema version— the store was written by a newer (or older) binary. The project is pre-release: recreate the store, don’t migrate.- Region parse failures name the file (
failed to process region file ...). Torn tails from interrupted saves are tolerated when unreferenced; genuinely corrupt sector runs fail loudly by design. - Slow commands: rerun with
--timing(release build) and compare phases; for commit-path slowdowns prefer--timing --json, which carries the per-region breakdown.