TECHNOLOGY

LayerFS, an open-source filesystem, gives each AI coding agent task its own writable workspace

LayerFS is an MIT-licensed filesystem built for AI coding agents. Each tool call mounts a full workspace over shared history, commits its changes and disappears.

Illustration of several temporary workspaces branching from one shared commit history storeTECHNOLOGY

Image: LayerFS

LayerFS is an open-source filesystem for AI coding agents, released under the MIT license. The idea is simple. Each agent gets a complete, writable workspace on top of shared, committed history, does its work, commits what it changed, and then goes away.

The project describes itself as the "substrate" under agents, meaning the layer they all run on. Its slogan is "Ephemeral Workspaces. Durable Shared History." The workspace is temporary. The history is not.

Here is how it works, based on the project's description. When an agent runs a Bash command, LayerFS mounts a workspace, runs the command, commits the result and unmounts. Mounting binds the whole committed tree without copying it. Writes go to the workspace's own overlay, a separate layer, until a commit saves them. Unmounting deletes that overlay, but never the history. File tools such as read, write, edit and grep go straight to the store through the SDK, the project's software kit, without a mount.

Everything lives in a single store. That store is one SQLite file holding every branch, commit and content object. Each daemon and SDK process opens it directly, so there is no database server. The project says agents on different computers can share one serverless store. Content is chunked and stored once.

Branches work like a writable line of commits. Publishing a branch to main adds a layer. If two commits change the same file, LayerFS refuses with a conflict. A project can add a .lww rule for files that should never conflict, and in those files the newest edit wins. The project also says saved objects are never rewritten, so the store only grows, and that every agent step acts as a checkpoint to return to.

The project also says dependencies can be committed once and come with every mount. In its example, npm install was committed earlier, so a new workspace can run tests without reinstalling. It says measured mounts take 5 to 20 milliseconds, and it contrasts this with about five minutes for a typical clone and install. A figure of 10 copies compressing to 0.31 is labeled illustrative on the page.

The project also lists benchmark results. These are the project's own numbers, run once on main at commit e5c7aaae05 through the JavaScript SDK. They have not been independently verified here.

On Cloudflare Computer's twelve-scenario filesystem benchmark, LayerFS finished in 5.20 seconds against 8.88 seconds, which it calls 1.71 times faster. It was faster in 10 of 12 scenarios. In a dedup test on a real project's history, 157 snapshots totaling 4.94 GB came to 100.1 MB, against 1,994.6 MB for Btrfs with zstd compression. That is 19.9 times smaller, and all 156 of 156 checked snapshots read back correctly.

On correctness, the project reports 0 unexpected failures in the pjdfstest POSIX conformance suite of 8,798 assertions, run against kernel overlayfs. It says it keeps 76 percent of overlayfs's passes and that every other failure is a deliberate format limit. The fsx test passed 14 of 14 with 3.06 million operations and no miscompares. In fsstress, 3,755 of 3,755 entries were identical after commit and remount.

Against libfuse passthrough, the results are mixed. LayerFS was faster in all 9 smallfile operations, by 1.27 to 10.71 times. Metadata results in mdtest ranged from 0.86 to 1.28 times with one process and 1.21 to 4.22 times with four. In fio, random read and write mixes ran 1.49 to 2.23 times faster. Sequential write (0.31 times), sequential read (0.81 times) and random write (0.40 times) were slower.

The page mentions a version for DSH that can be tried now, and says support for Pi is coming soon.

Sources and further readingLayerFS: the filesystem for AI coding agents ↗
ABOUT THE DESK

Harsh DV

IntraGoals reports on important changes in technology and work. We check each story for clear writing, trusted sources and useful information before it is published.

KEEP READING

Latest from IntraGoals.

All latest stories ↗