Repository navigation
Releases
sandfs 0.9.0
The main changes:
- A fork of a plain folder on another disk than sandfs's home is a frozen copy on that disk, in
.sandfs/copiesat its top, instead of being refused. - A file that shrinks in a folder under a mount is never shown padded with zeros, and git in a linked worktree of a mounted or forked folder stays inside the workspace.
- A mount keeps its caches within a budget and gives memory back: after a minute unused, on
sandfs trim, and when unmounted, freed memory goes back to the system instead of staying with the process. - A mount keeps less memory per file it is asked about, and a fork of a git clone on a Linux disk that clones files is a real folder.
API changes in the sandfs crate: Changes has a new field, committed, so code that builds a Changes itself needs it. CrossDevice comes up far less often, now that a folder on another disk is copied there. Home::trim and Trimmed are new. In sandfs-core, Source has two new methods with defaults, entry_now and trim, and Workspace has recheck and trim.
- sandfs, folders on another disk:
sandfs forkof a plain folder on another disk than sandfs's home, such as an external volume, was refused (CrossDevice), since a file is cloned only within one disk, and a program fell back to mounting the folder itself, which shows the folder as it changes and has written zeros over files. The copy is now made on the folder's own disk, in.sandfs/copiesat that disk's top: a frozen copy as on the home's disk, which takes no space until a file in it changes. sandfs makes that folder the first time, leaves it out of every copy and mount of the disk, and deletes it once it holds no copy. It does so only where no one else can move that folder:.sandfsand.sandfs/copiesare this user's and writable by no one else, at a top where others can't rename them (a sticky one, as /dev/shm is, will do).CrossDeviceis left for a folder mounted inside the one forked, or a disk whose top sandfs can't use that way. - sandfs, sandfs-core and sandfs-git, giving memory back: the process serving mounts grew with every file a walk asked about and never shrank: about 1 GB after a walk of a 700,000-file folder on macOS, and even after the unmount it held 337 MB, freed but kept by macOS's allocator. Now the folder listings, directories found and file bytes a workspace keeps to answer faster stay within a budget (32 MiB of listings, 16 MiB of file bytes), the least used going first, and are read again when needed. A mount nobody has used for a minute is trimmed: its changes are saved, those caches go, idle
git cat-filereaders exit, and the allocator is asked to hand the freed memory back to the system (on macOSmalloc_zone_pressure_relief, on glibcmalloc_trim; this one call is the only code sandfs runs that Rust can't check).sandfs trim [NAME]trims at once, and in the libraryHome::trimdoes, for a program to call when a task goes idle. The memory is handed back after every unmount too. On macOS, walks (findandls -lR) of a 706,605-file folder peaked at 404 MB where they peaked at 1,028 MB, and after the unmount the process kept 48 MB where it kept 337 MB. On Linux, a walk of 50,000 files peaked at 25 MB where it peaked at 31 MB, and a trim took it to 13 MB. The price is time on walks of folders whose listings don't fit the budget: a folder listed again is read again, so on macOS those two walks of 706,605 files took 59 s where they took 43 s; walks of smaller folders, and work within one part of a large one, are as fast as before. What stays is a record of each file the system asked about: a mount's table of files now holds each path once, not twice, and on macOS, whose NFS client never says it is done with a file, that table lasts until the unmount. Insandfs-corethis isWorkspace::trimandSource::trim, with a default that does nothing, whichGitSourceimplements. - sandfs and sandfs-core, less memory per file: a mount keeps less for each file it is asked about. After a walk of 200,000 files (
findandls -lR), the process serving the mount held 89 MB where it held 147 MB, and walks take as long as before. Three changes do it. The record of each file the kernel knows is smaller. Files are found through their folder's listing, and only folders are kept in the table that resolves paths in one lookup. The table of files the kernel knows gives its room back once the kernel forgets most of them, which took a further 14 MB off after the kernel forgot the walk. A git mount also keeps at most 64 MiB of whole files read lately, down from 256 MiB. - sandfs and sandfs-cli, linked worktrees in a folder: a git worktree's
.gitis a file naming its repository by full path, so git in a mount or fork of a folder holding one wrote that repository on the disk: a commit landed in the real repository while the files it was made from stayed in the workspace, and the real worktree then looked changed. A mount and a fork now show such a file with the path the repository has there: relative, when the repository is in the folder too, so the commit stays in the workspace; otherwise a path that isn't there, so git stops instead of writing outside it, and the file says "this worktree's repository is outside this folder, at PATH".sandfs changesnow says which folders hold a repository with commits made in the workspace, which copies leave out with the rest of.git; in the library that is the newChanges::committed. - sandfs and sandfs-core, a file that shrank in the folder under a mount: a mount of a folder lists each file once and reads its bytes from the folder as they are. When a file got shorter in the folder after that (a copy onto it truncates it first), a read came back short of the listed size, and macOS's NFS client filled the rest with zeros: copying files from a mount onto the folder under it wrote zeros into them. Now a read that comes back short makes the mount ask the folder again for that file's size and time alone. On Linux the read is the file's end and a later
statgives the new size. On macOS, whose client won't take a smaller size from a read, the read fails ("Stale NFS file handle") and the file gets a new inode, which the client looks up within a second or so and then reads as the file is now. A read never gives zeros. Insandfs-corethis isWorkspace::recheckand a newSource::entry_nowwith a default that changes nothing, whichDirSourceimplements. Errors from a folder now name the path they happened at ("source error: PATH: Permission denied"). - sandfs and sandfs-cli, real folders on Linux:
sandfs forkof a git clone (or of a fork kept as a folder) into a folder on a disk that clones files, btrfs or XFS, now keeps the fork there as a real folder of clones of the clone's files, as on macOS, instead of mounting it. It takes no space for the files, about 30 ms to make, and builds and git run in it at the disk's own speed, where a mount ran a build after an edit 25-40% slower and created small files 2-5 times slower. sandfs finds out by cloning one file next to the folder and removing it. On ext4, or with--read-onlyor--mount, the fork is mounted as before.
sandfs 0.8.0
The main changes:
- On macOS, a fork of a git clone is a real folder of APFS clones rather than a mount, so programs and git run in it at the disk's own speed.
- A fork of a plain folder on another disk than sandfs's home can copy its files (
--allow-copy) instead of being refused, and the refusal is an error a program can match on. - Forks,
changesand small-file writes in a mount are faster, and a slow first read on a macOS mount waits instead of failing.
API changes in the sandfs crate: ForkOptions has two new fields, real_folder and allow_copy, and Forked has real_folder, so code that builds ForkOptions without ..Default::default() needs to add them. sandfs::CrossDevice is new. sandfs-core and the Python API are unchanged.
- sandfs and sandfs-cli, a fork of a clone kept as a real folder: on macOS a mount goes through the system's NFS client, which makes work on many small files 4 to 10 times slower than in a worktree.
sandfs fork CLONE DIR(or a fork of such a fork) is now a real folder there by default: its files are clones of the clone's, with their times and modes, ignored files left out, and its.gitis what a mount would show (same commit,--branch, origin). sandfs brings the workspace up to date from the folder beforechangesandfork, running git in a private repository of its own, so settings written into the folder's.gitnever makesandfs changesrun a program;.git/configedits and hooks are still reported.--real-foldermakes one on any platform (copying files where the disk can't clone),--mountforces a mount, and--read-onlyimplies one.rm --unmountdeletes the folder;mount,update,unmount,serve --mcpandshellrefuse one and say why. In the library this isForkOptions::real_folderandForked::real_folder. A fork of a real folder carries its files but not commits made in it. - sandfs and sandfs-cli, forking a folder on another disk: a fork of a plain folder clones its files into the home, and a file is cloned only within one disk that can clone, so a folder on another disk (such as a separate APFS volume on macOS) was refused with "can't clone ...: Cross-device link", which read like a fault of the disk. It is now refused with "FOLDER is on another disk than sandfs's home (HOME)", and in the library with a
sandfs::CrossDevice { folder, home }error, found witherr.downcast_ref::<sandfs::CrossDevice>().ForkOptions::allow_copy(sandfs fork --allow-copy) copies the files that can't be cloned in full instead, on another disk or on one that doesn't clone files such as ext4, andupdateof such a fork copies the same way. Files that can be cloned still are. Without it, nothing changed: the fork is refused rather than copied. - sandfs-cli, faster forks and
changes: small files (64 KiB or less) written in a mount stay in memory until a save packs them, instead of going through a file on disk first (Linux, 1,000 files: rewrite 511 to 65 ms, create 576 to 110 ms). macOS sees an unmount at once rather than at its next half-second check. A fork of a local clone runs fewer git processes, and the ones left at once (Linux: 31 to 17 ms);changeson a real folder skips files unchanged since it last looked and reuses the source its update opened (macOS CI: 113 to about 60 ms, and 84 to 97 ms after an edit). - sandfs-cli, a slow first read on macOS: a macOS mount was soft, so the system gave up on a call after at most about 30 s, and a first read waiting on a slow download failed with an I/O error. It is now
hard,intr,deadtimeout=60: slow reads wait, and if the mount process dies, calls fail after a minute without answers. - Benchmarks:
sandfs-bench --only copiescompares a git worktree, a copy-on-write copy of a clone andsandfs forkat the work an agent does in a task's copy, on Linux and macOS for every pull request.
sandfs 0.7.1
The sandfs crate's README and docs.rs page now say how to build on it, and git's file monitor no longer prints an error in a git worktree added from a mount. No API changes.
- sandfs, documentation for building on it: the README has a "Build on sandfs" section, and the
sandfscrate's README and docs.rs page say what the library gives a program, the one line it needs inmain, what to weigh before depending on it (the API may change before 1.0; writes in a mount cost more, most of all on macOS) and who uses it.examples/attempts.rsruns a whole round trip in a temporary folder: two copies of a folder, changed two ways, compared, and one written back. - sandfs and sandfs-cli, git's file monitor outside a mount: a git worktree added from a git mount shares the mount's settings, so git ran
sandfs git-fsmonitorthere too, and it failed with "is neither a workspace name nor a mounted workspace" on every git command, often several times per command. Outside a mount it now answers that any file may have changed, the same fallback git already took, without the error.
sandfs 0.7.0
The main changes:
- A new
sandfscrate, the library behind the command: a program can mount, fork, update and list changes of saved workspaces, and serve their mounts, withoutsandfsinstalled. sandfs updateworks on a mounted workspace, in place, so a shell or agent working in it carries on.
The sandfs command works as in 0.6.0; sandfs-core and the Python API are unchanged.
- sandfs, a library of everything the command does: the new
sandfscrate holds what only the command could do before: the home of saved workspaces, the folder, git and GitHub sources,fork,update,changeswith--copy-to,clean, and mounting with its background process. Each command is a method ofsandfs::Homethat returns what it found (Changes,Updated,Forkedand so on) instead of printing it, so a program builds on workspaces without runningsandfsor parsing its output.Home::locatefinds the same home the command uses;Home::attakes another. The mount process outlives whoever asked for a mount, so sandfs starts it by running the program again: a program embedding sandfs callssandfs::handle_relaunch(&["sandfs"])first thing inmain, and runs ofPROGRAM sandfs ...are then sandfs's. Thesandfscommand is now a thin layer over the library and works as before.sandfs-corestays the in-memory engine underneath. - sandfs-cli,
updateon a mounted workspace:sandfs update NAMEno longer asks to unmount first. A mounted workspace moves in place: its changes are saved, and the mount reads as the newer source from then on, while a shell in one of its folders and files left open carry on (an open file the newer source removed still reads as it was). On Linux the kernel is told what to forget. On macOS, whose NFS client can't be told, files that may have changed get new file handles, folders' attributes are asked for again after a second, andupdatewaits that second before returning.
sandfs 0.6.0
The main changes:
sandfs forkis the one command for a task's copy: from a workspace or its mount, from a clone on this machine (itsHEADplus uncommitted files, with--branchto push work back), or from any folder (cloned, so it takes no space, on APFS, btrfs or XFS).changes --copy-torefuses to overwrite a file edited where it copies since the workspace started.sandfs updatemoves a workspace onto a newer commit or folder, keeping only its own changes.- One process serves thousands of mounts, and commands in a mount stay fast however many there are.
- sandfs never runs git with the settings of a mount's
.git.
Only the sandfs command changed; the Rust and Python APIs are as in 0.5.1.
- sandfs-cli, task copies:
sandfs forkmakes the copy to hand one task, wherever it starts. FROM can now be a folder of a git repository on this machine, such as a clone: the fork is itsHEADplus what its folder has changed since (changed, staged, new and deleted files, links and modes, but not ignored files), copied once, so the copy keeps its starting point while work goes on in the folder, andchangeslists them from the start; what was staged shows as unstaged in the copy, and the repository is only read. FROM can also be any folder inside a mount.--branch NAMEstarts git in the fork on a new branch at FROM's commit, keeping its files and index, so its commits go back withgit push origin NAME; a name the repository or FROM already has is refused.--read-only PATHadds read-only paths.sandfs rm --unmount NAME(or the mount's directory) unmounts a workspace and deletes it in one step. README gains a git-to-sandfs table. - sandfs-cli, git settings in a mount never run as you: sandfs asked a server for its branches (
mount git:URL,fork --branch) by running git in the folder it was started in, so started inside a mount, it took that mount's.git/config, which any program writing to the mount can set to run a command (a remote rewritten to anext::program, say). It now asks from an empty folder, andfork --branchasks a partial clone's remote by its URL, not through the repository's settings.mount git:PATHrefuses a repository inside a mounted workspace, pointing tosandfs forkinstead. - sandfs-cli,
changes --copy-tokeeps work done where it copies: a file in DIR that differs from both what the workspace started from and what the copy would write, such as one edited there since, now refuses the copy before anything is written, naming each such file;--forceoverwrites as before. A deleted file below a link, or replaced by a folder, in DIR is left alone instead of failing the copy. - sandfs-cli, many mounts at once: commands run inside a mount, and every git command there (git asks
sandfs git-fsmonitor), found their workspace by reading the system's mount table once per workspace, so they slowed down as mounts were added. With 10,000 copies of one repository mounted,git statusin one of them took 86 s andsandfs list95 s; they now take 0.06 s and 0.13 s, as with one mount. - sandfs-cli, more mounts per process: the one process that serves a home's mounts stopped at a few hundred mounts on a system that limits a process to 1,024 open files (most Linux systems; macOS allows 256), and on Linux it crashed at about 3,100, taking every mount down with it, once its threads used up the memory maps a process may have (
vm.max_map_count). It now raises its open-file limit as far as the system allows, saves every mount's changes from 4 shared threads instead of one per mount, tells the kernel about stale folder listings from one shared thread, and refuses a new mount it has no room for with an error naming the limit. On Linux each mount now takes 2 threads instead of 4, so one process serves about 7,000 mounts with the default limit (more withsysctl -w vm.max_map_count=262144). - sandfs-cli, a fork of a plain folder:
sandfs fork FOLDER DIRnow takes any folder, not only a workspace or a git repository: the fork is the folder as it is now, its files cloned with their modes and times into$SANDFS_HOME/copies(no space for their contents; 20,000 files in 1.8 s on btrfs), so later edits in the folder stay out andchanges --copy-to FOLDERcan tell an edit made there since. The copy is deleted with the last workspace over it, or bysandfs clean. It needs the folder and$SANDFS_HOMEon one disk that clones files (APFS, btrfs, XFS) and is refused elsewhere, such as on ext4, rather than copied in full.--branchis refused for a plain folder. - sandfs-cli, many mounts on macOS: each mount ran
mounttwice a second to see whether it was still mounted, so 100 mounts started 200 processes a second while doing nothing; one thread now checks for every mount of the process, with onemountper half second. Each mount is served by one thread instead of three or more. - sandfs-cli, moving a workspace onto a newer source:
sandfs update NAME [SOURCE]moves an unmounted workspace onto the newest commit of its branch, or onto SOURCE (another commit of the same repository, or another folder; a fork of a plain folder takes a new copy of it), and keeps only the workspace's own changes. Its changes that match the newer source, such as files agit pullin the mount brought in (even ones upstream changed again since), stop counting as changes; paths changed on both sides are printed asC pathand keep the workspace's version. Base files the newer commit changed report the update's time, so builds redo only them. Git's index is built again (what was staged shows unstaged),HEADand branches in the mount (packed ones too) follow the new commit, and a branch holding commits made in the workspace is refused, as is a newer source with a file where a folder holding a change was. Forks aren't moved.
sandfs 0.5.1
The same code as 0.5.0, released again so that it reaches PyPI. The 0.5.0 crates and GitHub release (with the sandfs downloads) came out, but the PyPI upload failed because the release workflow handed PyPI the sandfs archives along with the Python packages. It now uploads only the Python packages.
sandfs 0.5.0
The main changes:
sandfs mountworks on macOS with nothing to install.- A repository mounts from a plain URL, and listing it,
statandgit statusdownload almost nothing. - Git works inside a git mount.
- Workspaces and mounts hold symbolic and hard links.
- Read-only paths,
sandfs shellandchanges --copy-tolet a workspace be all the files an agent has. - Forks, saves and memory cost far less after a large build.
- Each GitHub release now carries the
sandfscommand, ready to run, for Linux and macOS.
Breaking changes for Rust code that matches on these types or builds their entries:
Kindhas a new variant,Kind::Symlink, so amatchover it needs an arm for links.Errorhas a new variant,Error::ReadOnly, so amatchover it needs one too.SourceEntryhas a new field,modified, so a source that builds entries field by field must set it (Noneis fine).
Every change:
- Prebuilt
sandfscommand: each GitHub release hassandfsbuilt for Linux (x86_64 and aarch64, linked statically against musl so it runs on any distribution) and macOS (Apple silicon, Intel), so the command needs no Rust toolchain. Download the archive for your machine from the release page, unpack it and putsandfson yourPATH.sandfs-cli's license is nowMIT AND BSD-3-Clause, since it carries nfsserve's NFS server. - sandfs-cli, writes kept under memory pressure: on Linux, a file written and closed could lose what was written if the kernel, short of memory, forgot it within a quarter second of the last write. Git's index was the usual victim (
index file smaller than expected). Such writes are now kept. - sandfs-cli, quicker unmount: unmounting no longer waits out the quarter second the mount gives a burst of writes to settle before saving it; the final save at unmount does that work. Unmounting a copy after
git statusin it went from 270 ms to 5 ms. - sandfs-cli, folders listed again: on Linux the kernel now keeps each folder's listing once read and lists it again without asking the mount, until something changes that folder through the mount. A walk over folders already seen (
find, an editor's file tree, git looking for new files) no longer costs four requests per folder. On a VS Code mount from GitHub,findover the whole tree takes 0.04 s instead of 0.66 s once it has run, as fast as on a clone; in the benchmark, a second walk of 10,000 files takes 5.6 ms instead of 32 ms and listing a 10,000-file folder again 1.5 ms instead of 6.7 ms. - sandfs-cli, listings and inode numbers agree: once the kernel forgot a file it had seen in a kept folder listing, that listing went on giving the file's old inode number while
statgave a new one, sols -iand tools that match the two disagreed. The mount now has the kernel drop such listings. - Benchmarks:
small/walk-warmlists every folder of the small-file tree a second time. - Benchmarks, tracked:
sandfs-bench --compare BEFORE AFTERcompares two saved runs. It lists each number that moved beyond a threshold and both runs' spread, and how far each is from what it has to beat in its own run (the host folder, overlayfs, a clone).--skip NAMEleaves workloads out. CI now runs the quick suite on main and on each pull request that changes the Rust code, on the same machine, and puts the comparison in the run's summary. Pushes to main keep their results as artifacts. - Benchmarks on macOS:
sandfs-benchruns on a Mac, with the NFS mount as itssandfs NFScolumn; overlayfs is skipped there. Memory comes fromgetrusage,psandvmmapinstead of/proc. - Benchmarks, a day of work: the
--remotetable also times the firstgit statusin the second copy,findover the whole copy, a secondgrep -r, and removing the second copy. - Read-only paths:
Workspace::set_read_only(path, true)makes a path and everything below it read-only in a workspace and its later forks, so whoever it is handed to can read but not change it, even in their own copy. Writes, deletes, moves and new entries there fail with the newError::ReadOnly, and so does removing or moving a folder that holds the path;is_read_onlyandread_only_pathsreport them. Python:set_read_only(path),is_read_only(path)andmount(..., read_only=True), raisingOSErrorwith errnoEROFS.sandfs-mcp --read-only PATHdoes the same over MCP and names the paths in its instructions to the agent. Matching onErrorneeds the new variant. - sandfs-cli, confined shells:
sandfs shell NAME [-- COMMAND...]runs a shell or a command in a mounted workspace that can't reach the machine's other files: not your home folder, other folders or the workspace's source. It has no network unless--networkis given, HOME is an empty folder outside the mount, and only a few harmless environment variables pass through. Bubblewrap does the confining on Linux, and the system's own sandbox on macOS, so an agent working through a shell gets the mount as its only files. - sandfs-cli, read-only paths:
sandfs mount SOURCE DIR --read-only PATHandsandfs serve --mcp SOURCE --read-only PATHmake a file or folder of the source read-only in a new workspace, and its forks keep it. In a mount, changes there fail withEROFS(NFS3ERR_ROFSon macOS) and its files show without write permission. The paths are kept inworkspace.json; workspaces saved before have none. - sandfs-cli, git settings in reviews:
sandfs changeson agit:mount still leaves.gitout of its listing, but names any change to.git/configor.git/hookson stderr. Git runs the programs those name, so whoever reviews an agent's work sees such a change before running git in the mount. - sandfs-cli, keeping changes:
sandfs changes NAME [PATH...] --copy-to DIRwrites a workspace's changes into a folder: added and modified files and links are copied with their executable bit, deleted ones removed, and only where DIR points. PATH arguments limitchanges, with or without--copy-to, to some files or folders. It never writes through a link it finds in DIR, so links an agent made can't carry a later file out of it, and leaves out changes in a.gitfolder (also.GITorgit~1, which a Mac or Windows disk reads as one), since git runs the programs named there. This replaces the loop overchangesoutput that broke on unusual names (#41). - Changes since a checkpoint:
Workspace::changes_since(base)lists the files that differ from another workspace, reported likechanges(): what an attempt did after a fork kept as a checkpoint, or how two attempts forked from one checkpoint differ. It skips everything the two still share, so the cost follows what changed after they split. Python:changes(since=other). MCP:Server::changes_since(checkpoint)makes thechangestool compare against a checkpoint. CLI:sandfs changes NAME --since OTHERfor two workspaces of the same source. - Hard links: a file can have several names (
Workspace::hard_link,hard_linksandhas_hard_links;hard_link(src, dst)andhard_links(path)in Python). A write through any name is seen through all of them, removing one leaves the others, and a move keeps the link while a copy or a fork gets its own file.changes()reports each name on its own. The Linux mount supportslink(2)with one inode per file, and saved workspaces keep links, so rustc's incremental cache and cargo, which link their files, no longer copy them through the mount. The macOS mount supports them too (NFSLINK), which makes small cargo rebuilds there about three times faster. - Symbolic links: a workspace can hold symbolic links (
Kind::Symlink;Workspace::symlinkandread_link,symlink(path, target)andread_link(path)in Python). A link is stored as its target and never followed by the workspace:read,writeandset_executablerefuse one instead.changes()reports links like files. A host folder's links are now listed as links instead of skipped, and still never lead a read outside the folder; each keeps the meaning it has on the host wherever the workspace is mounted, except that a link into the folder reaches the workspace's copy. Mounted folders supportln -sandreadlinkon Linux and macOS, sopython3 -m venvand npm's.binlinks work in a mount, and saved workspaces keep their links. A source may list links too: itsreadof one returns the target. Matching onKindneeds the new variant. - Mounting on macOS:
sandfs mountworks on macOS with nothing to install. The mount's process serves the workspace over NFS on localhost and macOS's own NFS client mounts it, with no kernel extension, macFUSE or sudo. Writes are saved by the same rule as on Linux, except thatfsyncdoesn't reach the server and saves nothing by itself. It answers only the user who mounted it and root. - sandfs-cli, root and containers on Linux: a Linux mount lets root in as well as the user who made it, whenever
/etc/fuse.confhasuser_allow_other(or root made the mount). Before, a mount made by a user refused root, so Docker couldn't bind the folder into a container. - README: rewritten for newcomers. It explains what sandfs is for in plain terms, starts with one short example, then covers each kind of source (with a git example), giving a workspace to an agent, mounting it as a folder, performance tables (parallel attempts, and mounting VS Code and Chromium from GitHub against cloning them) and the limits.
- sandfs-cli speed: the FUSE mount tells the kernel it needn't open or close files, so a first read of a small file is about a quarter faster and rereads and overwrites take about 40% less time.
- sandfs-cli saving: closing a file no longer commits it. A write is saved once its file has gone 250 ms without a write, on
fsync, or atunmount,forkorchanges. A program that writes a file, closes it and exits still has it saved a moment later, but no...
sandfs v0.4.0
A rewrite. sandfs is now a general-purpose sandbox filesystem with a Rust core, and the Python package is a thin binding over it. Nothing from the 0.2 API carries over.
- Workspaces: mount read-only sources at paths, keep every write, directory and deletion in a copy-on-write overlay, and fork in O(1). Forks share everything already read but never see each other's changes.
- Sources: a host directory (
DirSource), in-memory files (MemorySource), a git commit read without a checkout (GitSource, faster in a partial clone), or any Python object withlist(path)andread(path). - Changes:
changes()lists every added, modified or deleted file. The harness decides what to keep and writes it back. - Bytes first: files are bytes of any kind.
statalways reports an exact size and a version, andwrite(..., expected_version=...)rejects a write to a file that changed since it was read. - Large files:
read(path, offset=..., length=...)reads one range without caching the whole file. A source can defineread_rangeto serve ranges itself. - Concurrency: calls release the GIL, and forks reading the same uncached file fetch it from the source once.
- sandfs-mcp: an MCP server exposing a copy-on-write workspace as nine file tools (read, list, glob, grep, write, edit, move, delete, changes);
sandfs-mcp --dir MOUNT=PATH. A path holding a control character or line separator is shown as a quoted JSON string, so one name can't read as two lines. - sandfs-cli: the
sandfscommand mounts a workspace as a real directory over FUSE on Linux;sandfs mount,fork,changes,unmount. Sources are a host folder orgit:<path or url>[@rev]; a remote repository mounts in about a second, since only the mounted commit and its folder listings are fetched, with no history. File contents are fetched when first read. A branch or tag name is looked up on the server at every mount; a commit id mounted before also mounts offline. Changes are saved on disk between mounts.sandfs serve --mcp NAMEserves a workspace to an agent as MCP file tools instead. - sandfs-cli speed: the FUSE mount keeps the kernel's cache for files that haven't changed, lists directories with their attributes, skips flushes on files opened read-only and polls for mounts in milliseconds, so rereading small files takes half the time, stat after a listing is 25× faster and
sandfs forkreturns in 7 ms instead of 54. - sandfs-core speed: workspaces resolve a path in one lookup instead of one per directory and host-folder reads check the file they opened instead of resolving each parent folder first, so a stat 64 folders deep is about 12× faster and creates and deletes about a third faster.
- sandfs-cli concurrency: one process serves a workspace at a time. A second mount or
serve --mcpof a workspace in use is refused instead of saving over the first, as is a second mount on the same directory.unmountfails if the final save failed,serve --mcpundoes and reports a change it couldn't save, andchangesreads a workspace safely while another process is saving it. Buildingsandfs-clinow needs Rust 1.89 (the library crates still build with 1.85). - Benchmarks:
sandfs-bench, an unpublished crate, times sandfs through the Rust API and the FUSE mount against the host filesystem and overlayfs, including a workflow of parallel attempts that search, edit and check their files (--only workflow);cargo run --release -p sandfs-bench -- --scratch /dev/shm. - sandfs-cli on macOS and Windows: the
sandfscommand builds there with everything but the mount, andsandfs serve --mcp SOURCEcreates a workspace over a source. The library crates and the Python package are tested on macOS and Windows in CI. - Packaging: one abi3 wheel per platform covers Python 3.11 and later. The Rust crates
sandfs-core,sandfs-git,sandfs-mcpandsandfs-cliare published alongside. - Removed: the bash-like shell, host-command bridge, Python executor, access policies, storage adapters, write hooks, symlinks, text edit and unified diffs.