techlist.io

Sparse Checkout

1 posts

Anthropic2026-10-136 min readCurated summary

Redesigning source control at Anthropic

# Scion: Anthropic's In-House Source Control for Agent-Scale Development Anthropic built Scion, an in-house version control system, to replace git for its monorepo after AI coding tools pushed merge volume past what git could handle. Merges grew from about 2,500 per day in May 2026 to over 30,000 per day by September, and the monorepo's main branch history alone is nearly 100 GB. The team migrated fully from git in five months. Their core argument is that git's offline-first, fully replicated design fits poorly when nearly every client is an always-online agent or CI job, and that a server-centric design can scale far more cheaply. ## Why Git Stopped Fitting - The main branch history is almost 100 GB, and a compressed working copy exceeds 25 GB. - CI and research jobs perform about 25 million checkouts per day. Naively fetched, that would be over 600 PB of git traffic daily. - Standard workarounds (shallow clones, sparse checkouts, promisor remotes, blob-stored seeds) helped, but Anthropic ran several hundred internal git mirrors at peak. Seeds drifted from the tip of main between refreshes, and maintaining history-dependent operations like diff and blame on partial clones grew harder. ## Principles for Agent-Scale Source Control The team designed around five principles that depart from git's model: - **Clients are always online.** Clients fetch data on demand from a reachable server instead of holding complete copies. - **Client-server asymmetry.** The server handles history, blame, commit creation, merges, and rebases. The client keeps a bounded object cache, lays out files, and watches the filesystem, so it needs far less local data. - **Source control as an API.** Queries that CI jobs and tools need, like "who last changed this line" or "how are these commits related," are exposed programmatically, so many jobs need no local repository. Automated bisect and revert pipelines depend on this. - **Horizontal scalability.** No full copy of the repo exists anywhere, even on the server. There are no packfiles, so no repository maintenance is required. - **Cheap, lock-free commits.** Commits, rebases, and merges happen server-side, and their cost scales with the size of the change rather than the repo. Refs are discouraged outside main and release branches, since global state that every server must agree on becomes a scaling problem. - **Optional, sparse working copies.** Many CI diffs and writes run via API without checkouts. When files are needed, sparse and virtualized checkouts materialize only what the client reads. ## How Scion Works ### Changesets and Derived Data - The unit of work is a "changeset," an entry in a write-ahead log. Instead of a pointer to a tree, it stores the list of files changed relative to its first parent, plus content-addressed pointers to compressed blobs. - Creating changesets requires no packfiles, locking, cross-server coordination, or ref movement. Refs, when used, are a compare-and-swap on a single Spanner row. - Queries like blame, path history, and commit-graph ancestry rely on "derived data," computed recursively from parent values through one generic mechanism. Each derived data type can be computed eagerly or deferred, and because clients never see these internals, the team can change them without touching the client. ### Serving Layers - Scion servers are stateless and horizontally scalable. All data is content-addressed and immutable, so any server can cache it without coordination. - The client, `scn`, uses a negotiation protocol that asks only for trees and blobs it wants, walking down from a root tree and requesting missing objects recursively. There is no multi-gigabyte packfile, so transfers are efficient and resumable. Sparse and virtual checkouts need no special handling because the client simply doesn't request unwanted trees. - A three-tier topology is strictly enforced to isolate failures: `scion-daemon` on each node (storing objects for the whole node, refreshed from a periodic snapshot), regional `scion-cache` servers that stream objects from memory, and authoritative `scion-server`s that read from Spanner or cloud storage on a cache miss. - All three tiers respond to the same RPCs, so clients don't need to know the topology. ### Results - Scion's CPU and memory footprint is about 200x smaller than the previous git mirror infrastructure. - CI and research checkouts dropped from minutes to seconds, and CI alone gained 25% in CPU capacity. - Each tier sustains a cache hit rate above 99% and holds no long-lived state. ## Lessons From the Build - **Small teams can move fast.** Seven engineers built Scion, Antique (the code review tool), and several related systems, and completed the migration in five months while merge volume grew tenfold. - **Engineers shift from writing code to setting constraints.** Claude outperformed the engineers at writing code, but the team's role was to supply system-level judgment and say "no" when agents violated architectural constraints. Examples include brute-forcing merge times by scanning the commit log instead of querying the review tool, and over-defensive validation driven by adversarial review. Reviewers now evaluate change intent rather than every line. - **Testing and optimization improved.** Claude helped build hermetic simulations of infrastructure interactions, fuzzing, and rate limiting, and found optimizations, such as an ancestry-query fix that bypassed an index, that would otherwise have taken experts days. - **Monorepo security was built in.** Scion supports per-directory permissions, and Antique can express semantic approval rules, such as separating comment-only changes from sensitive logic changes. - **Operations gained "superfan" agents.** Claude instances are dedicated to watching individual components through telemetry and logs. They catch subtle issues that threshold alerts miss. - **Human-scale workflows need rethinking.** A traditional merge queue with a global lock doesn't work at this volume. Anthropic relies on post-merge and pre-deploy testing instead, accepting that concurrent changes can conflict and relying on Claude to fix them quickly. ## Practical Takeaway Anthropic does not recommend that most organizations adopt Scion, which is highly bespoke and would require replacing the entire development toolchain. The more transferable lesson is architectural: git servers don't have to mirror git clients, and server-side RPCs, content-addressed immutable data, and strictly tiered caching can meaningfully improve scalability. The team plans to share these ideas so the git ecosystem can adopt the server-side techniques without abandoning git's overall model.