layerfs README

The project's README from github.com/Ephemeral-AI-Lab/layerfs. As one markdown file: README.md.

LayerFS

LayerFS

Ephemeral Workspaces. Durable Shared History.

LayerFS is the substrate under your agents. Each one mounts a complete, writable Workspace over shared committed history, does its work, commits what it changed, and goes away.

Get started · Website · Docs · Benchmarks · Video · LayerFS × DSH · Community

MIT license 2.0.0-rc.2 pre-release Linux and macOS; Windows through WSL2 for Store calls, with no Sandbox Discord

https://github.com/user-attachments/assets/70c25887-86a1-4d81-bd78-571cf1c09a18

Status: this is LayerFS 2.0.0, out as the pre-release v2.0.0-rc.2 (release record). Not every release gate has run yet; the record says what was verified and what was not. 2.0 breaks 1.1.0 code, homes and Stores, with no conversion: see the migration guide. The last stable release is LayerFS 1.1.0.

A SQLite Store opens with the Normal profile (WAL, synchronous=NORMAL), whose safety gate has not run, so no power-loss durability is claimed: use LayerFS for agent work and its history, not as the only copy of data you cannot rebuild.

What's new in 2.0

The 2.0.0 manual has the details, and its limitations what is not built or not verified.

Get started

Build the layerfs command from this checkout (cargo +1.85.1 build -p layerfs-cli), then, in a private root:

export LAYERFS_ROOT=/tmp/demo
layerfs home init
layerfs store create shop
layerfs project init shop/api /tmp/demo/src          # import a folder as project api of Store shop
layerfs branch fork shop/api agent main
echo "# Shop API" | layerfs file write shop/api agent /README.md -m "Update the title"
layerfs workspace mount shop/api agent --host        # a full writable tree, no Sandbox
layerfs workspace exec host:agent 'echo hello > out.txt'
layerfs workspace commit host:agent -m "test output"
layerfs workspace unmount host:agent
layerfs branch publish shop/api agent

Every call answers JSON; layerfs help lists them all. The quickstart walks through the same steps with their answers, Sandboxes, and the same flow in JavaScript and Python. Host mode and Sandboxes need the LayerFS daemon of the same build.

Try it with LayerFS × DSH

LayerFS × DSH: the LayerFS logo and the DeepSeek Harness logo

To see agents use it, try LayerFS × DSH, the dsh-layerfs plugin for DeepSeek Harness. Agents in a dsh session fork Branches, test them in Sandboxes, merge and publish, and the Work and History tabs show every agent's Branch, live.

Try LayerFS × DSH: install guide

Core ideas

fs calls go straight into the Store as Commits; each Bash call mounts a Workspace, runs, commits and unmounts
01 · Ephemeral Computing
Compute exists only while a command runs.
Four agents, each on its own computer, read and commit to one shared Store
02 · Decentralized Agents
Agents on different computers share one serverless Store.
Main with two Branches, three agents on each; a commit to a file that already changed is refused with a Conflict
03 · Multiagent Coordination
One project, many Branches. One Branch, many agents.
Agents fork instantly into new Branches, recursively; each Branch is scored and the best one is kept
04 · Recursive Filesystem
Fork recursively any Commit, at any depth.
Four agents commit the same packages; the first stores every chunk and each later Commit adds only what is new
05 · Ultra Storage Optimization
157 snapshots of a real project in 100 MB, 19.9× smaller than Btrfs + zstd.
Without ignored files the tests fail until packages are installed; with LayerFS the mount already has them
06 · Instant Bootstrap
Dependencies come with every mount. No time lost reinstalling.

And underneath them

Supporting idea In one line
07 · Auto Checkpoints Every step an agent takes is a checkpoint to return to.
08 · Append-only Objects Saved objects are never rewritten. The Store only grows.
09 · Conflict Rules (.lww) Name the files that should never conflict. The newest edit wins.
10 · Big File, Small Edit An edit costs the size of the edit, not the size of the file.

See it run

The LayerFS demo: agents on several Branches run tool calls in Sandboxes and fs, each call becomes a Commit, and the history tree grows

Agents fork Branches, work in Workspaces inside Sandboxes, commit, merge and publish to main. The history grows as they go.

Results (1.0.0)

Every suite ran once on main at e5c7aaae05 through the 1.0.0 JavaScript SDK, with the then-Disposable Store profile (synchronous=OFF). They have not been re-run on 2.0, which makes no new performance claim. Each row links to its method, environment and receipts.

Suite What it measures LayerFS 1.0.0
fs-bench Cloudflare Computer's own twelve-scenario filesystem benchmark, unchanged, same image 5.20 s vs 8.88 s, 1.71× faster; faster in 10 of 12 scenarios
dsh-dedup A real project's history, 157 snapshots (4.94 GB of trees), kept as mountable Commits 100.1 MB vs 1,994.6 MB, 19.9× smaller than Btrfs + zstd; 156/156 read back
pjdfstest POSIX conformance, 8,798 assertions, against kernel overlayfs 0 unexpected failures; keeps 76% of overlayfs's passes, every other failure a deliberate format limit
fsx Random reads, writes, mapped I/O and truncates, every byte checked 14/14 pass, 3.06 M ops, 0 miscompares
fsstress Four concurrent processes, then Commit, remount and compare 3,755/3,755 entries identical; 5.21 GB captured by one Commit in 4.9 s
smallfile 100,000 files of 4 KiB, four threads, against libfuse passthrough Faster in 9 of 9 operations, 1.27×–10.71×
mdtest Metadata create, rename and remove, against libfuse passthrough 0.86–1.28× with 1 process, 1.21–4.22× with 4
fio Data I/O bandwidth, against libfuse passthrough Random read/write mixes 1.49–2.23×; slower on sequential write (0.31×), sequential read (0.81×) and random write (0.40×)

One sample per case, seed 1, no best-of. Host: arm64 Mac, Docker Desktop linux/arm64, 8 CPUs, 8.3 GB; host load is recorded per suite. These are release measurements, not a guarantee for your workload. Earlier fs-bench-pro results: v0.1.4 · v0.1.5 · v0.1.6.

How it works

agent tool call
 ├─ file tool (read, write, edit, grep …) ── file calls ───────────► Store
 └─ Bash ── mount ─► exec ─► commit ─► unmount                       ▲
             └─ Workspace: a FUSE or NFS view served by the daemon ───┘
                of its Store, in a Sandbox or on the host
                (committed root + its own overlay)

Prior art

LayerFS builds on well-known ideas: layered and union filesystems, copy-on-write snapshots, content-addressed storage and throwaway execution environments. What it adds is putting them together for agents: every tool call gets a full writable tree, and every result becomes a Commit on a Branch in one shared Store.

Prior work What it shares with LayerFS Where LayerFS differs
overlayfs, UnionFS, container image layers A read-only lower tree with a writable upper layer, which is also where the "layer" name comes from The upper layer is not just thrown away or kept as a directory: Commit turns it into an immutable snapshot on a Branch, with history, merge and Conflict. overlayfs is in the kernel and more complete; LayerFS's FUSE view deliberately omits FIFOs, sockets, device nodes, set-id bits and separate atime/ctime (pjdfstest)
Btrfs and ZFS snapshots, reflinks Cheap copy-on-write snapshots that share unchanged data Sharing is by content, not by extent, so a file that is rewritten in full still stores only its new chunks. On a small-file history of 157 snapshots that gives 19.9× less space than Btrfs + zstd. Btrfs and ZFS also stay cheap for in-place edits of large files, and they are durable, mature kernel filesystems; LayerFS is not (why Btrfs used more space here)
Git worktrees One repository, many working copies and branches A Workspace holds the whole tree, including .git, ignored files, dependencies and build output, so a new mount needs no reinstall. Commits happen per tool call, not when someone runs git commit
try Run a command against an overlay of your system, then inspect, apply or discard what it changed try works on one machine with one overlay at a time. LayerFS keeps every result as a Commit, and lets many agents branch from any of them and share one Store
Apiary and virtual layered file systems (Potter and Nieh, USENIX ATC 2010, LISA 2011) Ephemeral containers that start instantly over shared layered filesystems Apiary isolates desktop applications. LayerFS's target is agent tool calls whose results are kept, branched and merged as history

Use something else if you need power-loss durability (the Store's Normal profile claims none yet), full POSIX node types, or top sequential I/O bandwidth (fio). For a few long-lived checkouts on one machine, Btrfs snapshots or Git worktrees may be all you need.

Learn more

2.0 Manual · Quickstart · All calls · Limitations · Migrating from 1.1.0 · Node, Python and the command
Docs LayerFS × DSH guide · layerfs.ai/docs · Core ideas · Architecture
Concepts Core concepts · Documentation index
Benchmarks layerfs.ai/benchmarks
Release 2.0.0 pre-release record · Previous: 1.1.0 release record; 1.0.0 release and its plan; 0.1.7 release record and its manual

Community

Report product bugs and request features in LayerFS Issues. Maintainers file internal implementation, verification and planning work in layerfs-project. See the issue intake policy.

Questions, ideas and show-and-tell are welcome in either place.

Discord

Join the LayerFS Discord

discord.gg/8mmAMCDc2
WeChat · LayerFS的好朋友

QR code for the LayerFS WeChat group
Scan in WeChat to join the group.

License

LayerFS is licensed under the MIT License.

layerfs (Ephemeral-AI-Lab/layerfs)

Searching Database…

What is this?LayerFS is a filesystem built for AI agents: it gives every agent a complete, writable Workspace mounted over one shared committed history, without copying the base data, so agents can work in parallel, checkpoint what they change, and later branch, rewind or merge.
Is this a filesystem I mount, or a library I call from code?Both: it is a FUSE-based filesystem daemon backed by a single SQLite Store, plus a JavaScript SDK and a dsh plugin so agents can mount Workspaces and call commit, branch and merge programmatically.
How do I start using LayerFS with my agents?Right now it runs through the dsh-layerfs plugin for DeepSeek Harness or the JavaScript SDK: agents in a dsh session fork Branches, test them in Sandboxes, then merge and publish to main.
What do I need to run it?A Linux environment with FUSE mounting support, since the Workspace mount targets Linux; the benchmarks show it being used on a Mac host only inside Docker Desktop's linux/arm64 container.
Is it safe to store data I can't rebuild?No. The Store currently runs only in a Disposable profile with no crash or power-loss durability guarantee, and 1.0.0 is the first official release after 0.1.x previews, so it should hold agent work and its history, not irreplaceable data.
How much storage does LayerFS actually save?On a real project's 157 snapshots (4.94 GB of trees), LayerFS kept the full history in about 100 MB, 19.9x smaller than Btrfs with zstd, and read back all 156 snapshots correctly.
What are .lww conflict rules?By default two commits that touch the same file are refused as a Conflict; a .lww rule lets you name files where the newest edit should always win instead.
What is DSH, and why does LayerFS mention it so much?DSH (DeepSeek Harness) is a coding-agent harness; the dsh-layerfs plugin lets agents in a dsh session fork Branches, test changes in Sandboxes, and merge/publish to main, which is LayerFS's main way to be used today.
How does LayerFS perform against overlayfs?In the fs-bench suite LayerFS ran 1.71x faster than kernel overlayfs across Cloudflare's twelve-scenario benchmark, and in POSIX conformance tests (pjdfstest) it had zero unexpected failures while keeping 76% of overlayfs's passes.
Size
855.2 MB
Stars
2.8K
Age
3mo
Commits · 90 Days