LayerFS:面向 AI 编程智能体的文件系统
LayerFS: The filesystem for AI coding agents
LayerFS 是面向 AI 编程智能体的文件系统,每个智能体在共享提交历史上挂载一个完整可写的临时工作区,执行任务后提交改动即退出。每次文件工具调用是一次原子 Store 操作,每次 Bash 调用结束时提交,挂载仅需 0.05 秒,而传统方案重装依赖约需 5 分钟。10 份副本经去重与压缩后体积降至 0.31,任意提交可零成本递归 fork。
Ephemerality: scaling multi-agent development beyond imagination
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.
- Ephemeral workspaces
- Durable results
- Massive parallelism
Why LayerFS
Ten ideas, one filesystem.
six core · four supporting
Compute exists only while a command runs.
- Compute: Agents spend ~80% thinking, ~10% in Bash.
- FS: Each file tool call is one atomic Store op.
- Sandbox: Each Bash tool call mounts an ephemeral workspace, then commits.
Agents on different computers share one serverless Store.
- Shared storage: Every agent commits to one Store, with no DB server.
- Distributed computing: Each agent runs on its own computer.
One project, many branches. One branch, many agents.
- Commits: Every tool call is a commit on its branch.
- Conflict: A same-file clash is refused with Conflict.
- Blame: Each line names the step that wrote it.
Fork recursively any commit, at any depth.
- Zero cost: A fork is metadata and copies no files.
- Recursive: A filesystem for RSI agents and recursive exploration for RL training.
10 copies compress into 0.31.
- Dedup: Each content chunk is stored once.
- Compression: The stored chunks shrink further.
- Ratio: 10 copies → 1.05 dedup → 0.31 compression wtf???
Dependencies come with every mount. No wasting time for re-installation.
- Git / other AgentFS: Drops ignored files; reinstalls.
- LayerFS: Ignored files stay in every commit.
- Comparison: ~5 min to install vs 0.05 s to mount.
Four supporting ideas
- Auto CheckpointsEvery step an agent takes is a checkpoint to return to.Every call: Each file call is a commit; each Bash call commits when it ends.No noise: A call that changes nothing commits nothing.Rewind: Fork from any checkpoint and read any file as it was.
- Append-only ObjectsSaved objects are never rewritten. The Store only grows.Content-addressed: An object is named by the hash of its bytes.Sealed: A written pack is never updated or deleted.Safe to share: Branches share objects; readers never wait for the writer.
- Conflict Rules (.lww)Name the files that should never conflict. The newest edit wins./.lww: Gitignore-style rules at the root of the tree.Newer wins: A matched file changed on both sides takes the newer edit.For: Lockfiles, build output and caches.
- Big File, Small EditAn edit costs the size of the edit, not the size of the file.Overlay: A write keeps only the bytes it wrote.Commit: Only the edited extents and their tree path are rebuilt.Storage: The rest of the file is shared with its old version.
Agent tool calls and their history
HISTORYmain @ L00 commits · 0 live
main is the green middle bough; each publish adds a Layer bandLayer · a band on mainCommit · a leafBranch · a boughmerge · grafts backpublish · adds a bandstopped · bare twigclick a name tag to focus its Branch
store.statsmain · read-only
dedupe1.5×
compression3.32×
stored9.4 MB
file10.0 MB
logical 48.0 MB · canonical 31.2 MB · metadata 420 KB · free 180 KB · 0 commits · 1 layers
orchestratorproject · branch
来源:Hacker News · layerfs.ai