Worktree: a checked-out tree with its state in one wtlog

A worktree is a checked-out tree on disk, with its per-call state in one append-only <wt>/.be/wtlog. The goal is cheap, disposable worktrees over one hard-to-break Store — a machine needs only one store per upstream repo, and every extra worktree is just a dir pointing back. The method: row 0's base get anchors the store, later get/post rows track the branch and tip, Sniff stamps each file it touches with the row's timestamp, and POST reads those stamps back to classify files at commit time.

The wtlog and the anchor

Per-wt state — base branch, base tip, and pending PATCH parents — lives in <wt>/.be/wtlog; the current branch is the latest get row's ?branch, never a fixed field, so switching just appends a get row.

The context URI

Every command runs against a context URI//worktree/path?rev — the versioned cwd; there is no argv relay (the old --at coordinate is gone, no dogs are spawned anymore).

File classification by stamps

Every sniff row stamps each file it touched with the row's ts via utimensat; at commit time POST reads each file's mtime, finds the owning row, and decides KEEP vs REWRITE in selective or implicit (commit-all) mode.

Eager branching replaces stash

Branches are mkdir-cheap, so the idiom is to fork preventively: mint a sub-branch before anything speculative, experiment freely, then bring the result home as one squash — there is never a reason to stash.