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.