Free · open source
GPLv3, royalty-free or commercial — your choice$0forever
- Lossless compress and dedupe
- Seed new worktrees from a sibling
- Read-only status and advise
Sweep the swarf out of Cargo target/ directories — compress and dedupe build output without deleting what you still build with.
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/pyrlyn/swarfr/releases/latest/download/swarfr-installer.sh | sh

See it run
$ swarfr status ~/code $ swarfr advise ~/code $ swarfr run --dry-run ~/code $ swarfr run ~/code $ swarfr run --dry-run --lossy orphans ~/code $ swarfr run --lossy evict --evict-max-total-gib 50 ~/code
Overview
Swarf is the chips and shavings a lathe or a mill throws off: metal cut away, waste that is not
the part. Much of a Cargo target/ directory is swarf, and swarfr sweeps it out without
deleting what you still build with and without slowing builds.
One planner runs several approaches that reinforce each other: transparent compression of stable artifacts, copy-on-write dedupe across targets, zero-byte seeding of new worktrees, and opt-in removal of orphaned and idle targets. Everything runs under cargo's own build lock and keeps mtimes, so nothing is rebuilt.
swarfr is in active development: v0.1.0 is out, and testing volunteers are welcome. Lossless
compress and dedupe need a filesystem that can share blocks or compress (APFS, btrfs, XFS
with reflink); on Windows the tool builds and reports, but those two passes plan no work yet.
Features
Files of 8 KB and more get transparent APFS compression (LZFSE), or btrfs compression on Linux; hardlink groups stay groups.
Files with equal content become copy-on-write clones of one copy, compared inside a family: a repository and its worktrees.
A new worktree's target starts as a zero-byte clone of a sibling's, so third-party crates are not rebuilt.
Opt-in removal of targets whose worktree is gone, idle targets, and the least recently built above a global size cap; every removal is printed with its reason.
Read-only: names the manifest and cargo config keys that make targets bigger than they need to be, with the file each one belongs in.
GOCACHE and Go's module cache, SwiftPM .build, .NET obj/ and bin/, and CMake build dirs go through the same passes with their own safety rules.
Install
Every release carries binaries for Apple Silicon macOS (signed), x86_64 Linux and x86_64
Windows. The shell installer puts swarfr and its updater swarfr-update into cargo's bin
directory:
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/pyrlyn/swarfr/releases/latest/download/swarfr-installer.sh | sh
With ketch:
ketch install pyrlyn/swarfr
Or build it from a checkout, with the toolchain the repository pins:
git clone https://github.com/pyrlyn/swarfr
cargo install --locked --path swarfr
The first five minutes: everything is read-only until the last step.
swarfr status ~/code
swarfr advise ~/code
swarfr run --dry-run ~/code
swarfr run ~/code
More examples below.
Usage examples
Opt in to a lossy pass, on a dry run first.
swarfr run --dry-run --lossy orphans ~/code
swarfr run --lossy evict --evict-max-total-gib 50 ~/code
Run it as a service that visits a build dir once it has gone cold.
swarfr daemon install
swarfr daemon status
Links
You can use swarfr under any of the following licenses, at your choice:
Pricing
Pro is a placeholder$0forever
$9 / moper seat
Placeholder — the Pro waitlist is not open yet.
Free and open source. Star it, file an issue, or send a pull request.