This article details how Anthropic redesigned their source control system, named Scion, to handle the extreme scale of AI-generated code in a monorepo. It highlights the architectural limitations of Git for such workloads and introduces Scion's client-server asymmetry, content-addressing for caching, and distributed data handling to manage massive change rates and checkouts. The article focuses on the design choices and trade-offs made to build a highly scalable and efficient version control system.
Read original on ByteByteGoAnthropic faced a unique challenge with its source control infrastructure: a rapid increase in AI-generated code leading to an exponential growth in daily merges (from 2,500 to over 30,000) and an enormous monorepo size (100 GB history, 25 GB compressed working copy). This resulted in an astounding 25 million CI checkouts per day, generating PBs of traffic. Traditional Git, with its distributed nature, became a bottleneck due to the high costs associated with repeated data transfer, storage, and maintenance for numerous, often partial, client repositories.
Git's core strength lies in its local independence, allowing developers to perform operations offline. However, for Anthropic's automated CI jobs and agents, this independence was not valuable. Managing hundreds of internal Git mirrors, keeping them in sync, and dealing with outdated seeds proved unsustainable. The partial repository data on clients also complicated operations requiring historical context. Anthropic's workflow already relied on a single authoritative shared repository, making Git's client-side independence an architectural impedance mismatch.
Anthropic's solution, Scion, adopts a client-server asymmetric model. The server is responsible for most repository operations (historical queries, diffs, commits, merges), while the client (scn) maintains a limited cache and manages local files. This shifts the burden of historical data and complex operations from individual clients to a centralized, scalable service. Commit creation, for instance, becomes a server operation, eliminating the separate 'push' step found in Git. While this introduces a strong dependency on service availability, Scion is designed as a distributed service, not a single server.
Scion extensively uses content-addressing for its source control objects, recognizing them by their cryptographic hash. This makes objects immutable: a specific ID always refers to the same data. This immutability simplifies caching significantly. Cached historical objects don't require freshness checks, as their content cannot change. The system's design is heavily optimized around requesting and caching these immutable objects efficiently. Changesets (durable records of changes), blobs (file contents), and trees (directory structures) are managed this way, with metadata in Spanner and file contents in object storage.
Scion scales by separating answering repository questions (e.g., blame, history) from delivering working directory files, leveraging shared source control APIs, and a hierarchy of caches. Repository operations are handled by a shared service. The server-derived root tree, rather than a stored one, allows recording changes based on affected data and structures without processing the entire repository, which is crucial for handling high change rates in a monorepo. This architecture prioritizes efficient data distribution and processing for an environment with massive, concurrent consumers.
Architectural Insight
The core architectural shift in Scion from Git is moving from client-side repository independence to a robust, scalable server-side service that intelligently serves immutable content-addressed objects to 'thin' clients. This is a common pattern in distributed systems when local autonomy becomes a burden at extreme scale.