How ephemeral-ai-lab/layerfs works
LayerFS is a versioned filesystem for AI agents: agents fork branches, work in isolated writable Workspaces, commit changes into durable shared history, merge, and publish. The README documents both direct Store-backed file/branch operations and Sandbox-backed command execution; compute is separate from durable state. The graph follows those documented capabilities and the sampled content/overlay internals. Some implementation links are inferred from the documented product flow and are marked dashed where the excerpts do not establish the call directly.
Main entry points: src/lib.rs Rust API · merge.rs Branch operations · exec.rs Sandbox commands · src/lib.rs Workspace semantics
Components 18
Agent interface
- Rust API
core/crates/layerfs-api/src/lib.rs - Daemon dispatch
core/crates/layerfs-daemon/src/operator/dispatch.rs
Branches and history
- Branch operations
core/crates/layerfs-api/src/branch/merge.rs - History queries
core/crates/layerfs-history/src/contract/query.rs
Workspace operations
- Filesystem calls
core/crates/layerfs-api/src/fs/write.rs - Workspace semantics
core/crates/layerfs-workspace/src/lib.rs - Workspace overlay
core/crates/layerfs-overlay/src/lib.rs
Sandbox and mount
- Sandbox commands
core/crates/layerfs-api/src/sandbox/exec.rs - FUSE operations
core/crates/layerfs-fuse/src/operations/read.rs - Daemon bridge
core/crates/layerfs-bridge/src/control_reply.rs
Content and storage
- Filesystem construction
core/crates/layerfs-content/src/filesystem/update.rs - File edits
core/crates/layerfs-content/src/file/edit/engine.rs - File mapping
core/crates/layerfs-content/src/file/mapping/build.rs - Canonical objects
core/crates/layerfs-content/src/object/codec.rs - Content merge
core/crates/layerfs-content/src/merge/build.rs - Store service
core/crates/layerfs-store-service/src/store_service.rs - SQLite persistence
core/crates/layerfs-persistence/src/backend/sqlite/query.rs
Other components
- Agent or caller
Connections 20
- Agent or caller → Rust API: calls
README.md - Rust API → Branch operations: routes branch calls
- Rust API → Filesystem calls: routes file calls
- Rust API → Sandbox commands: manages sandboxes
README.md - Rust API → Daemon dispatch: dispatches
- Branch operations → History queries: reads history
- Branch operations → Store service: updates shared Store
README.md - Filesystem calls → Store service: uses shared Store
README.md - Store service → Workspace semantics: binds private Workspace
core/crates/layerfs-store-service/src/store_service.rs - Workspace semantics → Workspace overlay: uses overlay jobs
- Workspace semantics → Filesystem construction: constructs filesystem state
- Filesystem construction → File edits: applies file edits
- File edits → File mapping: uses mapping codec
core/crates/layerfs-content/src/file/edit/engine.rs - File mapping → Canonical objects: encodes objects
- Branch operations → Content merge: merges changes
README.md - Store service → SQLite persistence: persists state
- Sandbox commands → Daemon bridge: controls daemon
- Sandbox commands → FUSE operations: mounts Workspace
README.md - FUSE operations → Workspace semantics: serves filesystem requests
- Sandbox commands → Branch operations: commits Workspace
README.md