重新设计 Anthropic 的源代码管理(source control)
Redesigning source control at Anthropic
段落导航
Updated October 15 to include more detail on the projects that pioneered many of the techniques we use in Scion.
10 月 15 日更新,补充了关于那些在 Scion 中开创了我们所用许多技术的项目的更多细节。
At Anthropic, coding is no longer the bottleneck to building systems or doing research.
在 Anthropic,编码不再是构建系统或开展研究的瓶颈。
Claude is able to autonomously iterate on research loops, micro-optimize complex programs, and build new services from the ground up at a speed and scale we haven’t seen before.
Claude 能够自主地在研究循环中迭代、对复杂程序进行微优化,并以我们前所未见的速度和规模从零开始构建新服务。
The bottleneck, now, is all of the developer infrastructure built for human scale: source control, builds, and CI.
如今的瓶颈,是为人类规模构建的所有开发者基础设施:源代码管理、构建和 CI。
In May 2026, Anthropic averaged around 2,500 code changes merged per day; as of September, we merged over 30,000 per day.
2026 年 5 月,Anthropic 平均每天合并约 2,500 个代码变更;到 9 月,我们每天合并超过 30,000 个。
We don’t expect this rate of growth to slow down anytime soon; the latent demand for merging code is practically infinite, and every bottleneck we remove immediately leads to a further increase in the amount of code we produce.
我们认为这种增长速度不会很快放缓;合并代码的潜在需求几乎是无限的,而我们每移除一个瓶颈,都会立刻导致我们产出的代码量进一步增加。

Changes merged to our monorepo per day, from January to September 2026.
2026 年 1 月至 9 月,每天合并到我们 monorepo 的变更数。
In order to support this growth, we built Scion, an in-house version control system, and fully migrated our monorepo from git in five months.
为了支持这种增长,我们构建了 Scion,一个内部版本控制系统(version control system),并在五个月内将我们的 monorepo 从 git 完全迁移出来。
We also built and shipped a code review surface (called Antique), code search, a rich source control IAM system, novel ways of managing and landing large amounts of reviewed code, and more, all in that same time period.
我们还在同一时期构建并发布了代码审查界面(称为 Antique)、代码搜索、一套丰富的源代码管理 IAM 系统、管理和合入大量已审查代码的新颖方式,等等。
In this post, we’ll focus on how we built Scion specifically.
在这篇文章中,我们将重点介绍我们具体是如何构建 Scion 的。
It makes for an interesting case study: Claude’s ability to write code was both what put us in this situation in the first place and how we were able to quickly build a high-quality, scalable system to deal with it.
这是一个有趣的案例研究:Claude 编写代码的能力既是最初让我们陷入这种局面的原因,也是我们能够快速构建高质量、可扩展系统来应对它的原因。
Before we explore what we built, we should acknowledge how unusual our workload is.
在探讨我们构建了什么之前,我们应该承认我们的工作负载有多么不寻常。
Unsurprisingly, Anthropic uses Claude to write software far more than almost any other company, so we’re often the first to see where tools built for human scale start to strain.
毫不意外,Anthropic 使用 Claude 编写软件的程度远超几乎所有其他公司,因此我们常常最先看到为人类规模构建的工具开始吃紧的地方。
Source control is just one example of this.
源代码管理只是其中一个例子。
While we don’t expect many organizations to have these problems in the very near term, we suspect it won’t be too long before others who use AI coding tools experience these same pressure points, which is why we wanted to share what we built and what we learned.
虽然我们不认为许多组织会在非常近的短期内遇到这些问题,但我们怀疑用不了多久,其他使用 AI 编码工具的组织也会经历同样的压力点,这就是我们想分享我们构建了什么以及学到了什么的原因。
Git is a decentralized system: every clone is a complete, self-contained repository that can compute diffs, read history and blame, and check out any revision while fully offline.
Git 是一个去中心化系统:每个克隆都是一个完整、自包含的仓库,可以在完全离线的情况下计算 diff、读取历史和 blame,并检出任意修订版本。
For the vast majority of repositories, this is the right design, and it’s a large part of why git became the standard.
对于绝大多数仓库而言,这是正确的设计,也是 git 成为标准的重要原因之一。
As our monorepo grows, it increasingly doesn’t fit that design space.
随着我们的 monorepo 不断增长,它越来越不适配这种设计空间。
The history of our main branch alone is almost 100 GB, and a compressed working copy is over 25 GB.
仅我们主分支的历史就接近 100 GB,而压缩后的工作副本超过 25 GB。
We perform on the order of 25 million code checkouts per day for CI, before counting developer environments, agent sandboxes, and research jobs.
我们每天为 CI 执行约 2500 万次代码检出,这还不包括开发者环境、智能体沙箱和研究任务。
Fetched naively, that would be over 600 PB of git traffic per day.
如果以朴素方式拉取,那将是每天超过 600 PB 的 git 流量。
Git offers tools for working with a slice of a repository, such as shallow clones, sparse checkouts, and promisor remotes.
Git 提供了用于处理仓库一部分内容的工具,例如浅克隆、稀疏检出和 promisor remote。
Beyond these, there are standard workarounds for large monorepos, like internal git mirrors and repository snapshots (seeds) kept in blob storage.
除此之外,针对大型 monorepo 还有标准变通方案,比如保存在 blob 存储中的内部 git 镜像和仓库快照(seeds)。
We’ve used all of them—at our peak, we operated several hundred internal git mirrors to deal with the load.
我们全都用过——在高峰期,我们运营了数百个内部 git 镜像来应对负载。
This bought us time, but they became harder to operate as our merge rate increased.
这为我们争取了时间,但随着合并速率上升,它们变得越来越难以运营。
Seeds fell further from the tip of main between refreshes, and it took more and more care to keep operations that depend on history, like diff and blame, working on partial clones.
在两次刷新之间,seeds 离 main 的顶端越来越远,而且要让依赖历史信息的操作(如 diff 和 blame)在部分克隆上正常工作,需要投入越来越多的精力。

The typical setup for scaling git checkouts.
用于扩展 git 检出的典型设置。
Taking a step back, we noticed that, like most companies, we were using git as a centralized system with one authoritative copy, but nearly all of our clients were agents and jobs that are online by definition.
退一步看,我们注意到,和大多数公司一样,我们把 git 当作一个具有单一权威副本的集中式系统来使用,但我们的客户端几乎都是智能体和任务,它们在定义上就是始终在线的。
The properties that make git excellent for distributed, offline work were actively undermining our ability to scale as the repo grew.
让 git 非常适合分布式、离线工作的那些特性,实际上正在削弱我们随着仓库增长而扩展的能力。
So we asked ourselves: if we designed source control with the fact that agents are always online in mind from the start, what would it look like?
于是我们问自己:如果我们从一开始就以智能体始终在线这一事实为前提来设计源代码管理,它会是什么样子?
With agentic coding, many common assumptions about how software is developed are evolving.
随着智能体式编码的兴起,关于软件开发方式的许多常见假设正在演变。
We embraced these changes when building Scion, which allowed us to take a fundamentally different approach than git on several core principles.
在构建 Scion 时,我们拥抱了这些变化,这让我们能够在若干核心原则上采取与 git 根本不同的方法。
Source control for huge monorepos has prior art, notably Google’s Piper and Meta’s Sapling,2 so we were able to build Scion with their hard-won lessons in mind.
面向超大型 monorepo 的源代码管理已有先例,尤其是 Google 的 Piper 和 Meta 的 Sapling,2,因此我们能够借鉴他们来之不易的经验教训来构建 Scion。
Our principles are:
我们的原则是:
Clients are always online.
客户端始终在线。
Git assumes that clients work offline and need a complete copy of the repository.
git 假定客户端离线工作,并且需要仓库的完整副本。
Since nearly all of our clients are agents and jobs, we designed Scion’s client and protocols around a server that is always reachable, and have clients fetch data when they need it.
由于我们几乎所有客户端都是智能体和作业(job),我们围绕一个始终可达的服务器设计了 Scion 的客户端和协议,并让客户端在需要时获取数据。
Client-server asymmetry.
客户端-服务器不对称。
In git, every client is capable of being a full-fledged server.
在 git 中,每个客户端都能充当完整的服务器。
In Scion, the server answers questions about file history and blame, creates commits, performs merges and rebases, and so on.
在 Scion 中,服务器回答关于文件历史和 blame 的问题、创建提交、执行合并和 rebase 等。
The client maintains a bounded local object cache, lays out the working copy files on disk, monitors for filesystem changes, and gives users an ergonomic way to work with the server.
客户端维护有界的本地对象缓存,将工作副本文件布置到磁盘上,监控文件系统变更,并为用户提供符合人体工学的方式与服务器协作。
It can compute very little on its own but, in exchange, it requires much less data locally.
它自身几乎无法进行多少计算,但作为交换,它在本地需要的数据少得多。
A comprehensive source control service can power many novel applications.
一个全面的源代码管理服务可以支撑许多新颖应用。
With git, a CI job or tool that needs to ask a question about the repository, such as who last changed a line or how two commits are related, has to maintain a local copy of the repo or hope that vendor-specific APIs provide the answer.
使用 git 时,需要查询仓库相关问题的 CI 作业或工具,例如谁最后修改了某一行,或两个提交之间有何关系,必须维护仓库的本地副本,或者寄希望于特定供应商的 API 提供答案。
With Scion, all of the source control queries the client uses are also exposed via API, so in many cases jobs don’t need a local repository at all.
使用 Scion 时,客户端使用的所有源代码管理查询也都通过 API 暴露,因此在许多情况下作业根本不需要本地仓库。
Many internal tools, such as our automated bisect and revert pipelines, wouldn’t be practical at scale without this cheap, programmatic access to source control.
许多内部工具,例如我们的自动化 bisect 和 revert 流水线,如果没有这种低成本、可编程的源代码管理访问方式,就无法在规模上实用。
Everything must be horizontally scalable.
一切都必须能够水平扩展。
At our peak, we ran several hundred git mirrors, which significantly strained capacity and no longer scaled once the repo outgrew the mirrors’ disks or memory limits.
在我们高峰时,我们运行了数百个 git 镜像,这显著造成了容量压力;一旦仓库超出镜像的磁盘或内存限制,就无法再扩展。
In Scion, the repository’s data is distributed, and every component is independently scalable; there is no fully materialized copy of the repo anywhere, even on the server.
在 Scion 中,仓库的数据是分布式的,每个组件都可以独立扩展;任何地方都不存在仓库的完整物化副本,甚至在服务器上也没有。
There is no equivalent of packfiles (git’s compressed bundles of objects), so no repository maintenance is needed.
不存在 packfiles(git 的压缩对象包)的等价物,因此不需要仓库维护。
Commits must be cheap, incremental, and lock-free.
提交必须低成本、增量且无锁。
In git, you commit locally and then push to share your work.
在 git 中,你在本地提交,然后推送以共享你的工作。
In Scion, every commit, rebase, or merge happens on the server, so there’s nothing to push, but each of those operations needs to be fast.
在 Scion 中,每次提交、rebase 或合并都发生在服务器上,因此没有什么需要推送,但这些操作中的每一个都必须很快。
The cost of creating a commit and updating its downstream data structures has to scale with the size of the change, not the overall size of the repo, or the server can’t keep up.
创建提交并更新其下游数据结构的成本必须随变更大小扩展,而不是随仓库整体大小扩展,否则服务器无法跟上。
The development lifecycle in Scion discourages refs (pointers to commits, such as branches and tags), except for the main ref or release branches, because global state that every server has to agree on is a looming scaling problem.
Scion 中的开发生命周期不鼓励使用 refs(指向提交的指针,例如分支和标签),main ref 或发布分支除外,因为每个服务器都必须达成一致的全局状态是一个迫在眉睫的扩展问题。
The working copy is optional, and sparse by design.
工作副本是可选的,并且从设计上就是稀疏的。
Because our monorepo is so large, and because we check out code tens of millions of times a day for CI, we wanted to avoid checkouts whenever we could.
因为我们的 monorepo 非常大,而且我们每天为 CI 检出代码数千万次,所以我们希望尽可能避免检出。
With Scion, a CI job that needs the diff between a commit and its merge base, for example, can ask the server for it.
使用 Scion 时,例如需要某个提交与其合并基(merge base)之间 diff 的 CI 作业,可以向服务器请求它。
The same goes for writes: many write workloads can also skip the checkout and function entirely via API.
写入也是如此:许多写入工作负载也可以跳过检出,完全通过 API 运行。
Scion’s protocol is centered around sparse checkouts, which only contain the directories the client asks for, and virtualized checkouts, which materialize files on demand, so when a job does need files on disk, the client only pays for what it actually reads.
Scion 的协议围绕稀疏检出和虚拟化检出展开:稀疏检出只包含客户端请求的目录,虚拟化检出按需物化文件,因此当作业确实需要磁盘上的文件时,客户端只为实际读取的内容付出代价。
It’s helpful to understand how these principles came together in practice when building Scion.
了解在构建 Scion 时这些原则如何在实践中结合,会很有帮助。
These insights can apply to other source control systems or, more broadly, to other stages of the software development lifecycle.
这些见解可以应用于其他源代码管理系统,或者更广泛地,应用于软件开发生命周期(software development lifecycle)的其他阶段。
In Scion, the unit of work is a “changeset,” an entry in a write-ahead log.
在 Scion 中,工作单元是“变更集(changeset)”,即预写日志(write-ahead log)中的一条条目。
A changeset stores most of what you’d expect from a commit in git.
变更集存储了你在 git 中期望从一次提交里看到的大部分内容。
But where a git commit stores a pointer to the tree, a changeset stores a list of the files that changed relative to its first parent,1 along with content-addressed pointers to the compressed file contents in blob storage.
但是,git 提交存储的是指向树对象的指针,而变更集存储的是相对于其第一个父提交,1 发生变更的文件列表,以及指向 blob 存储中压缩文件内容的内容寻址指针。
Changesets are created server-side and are available everywhere, instantly.
变更集在服务器端创建,并且立即可在所有地方可用。

The shape of a changeset in Scion.
Scion 中变更集的结构。
This structure lets us accept changesets with very high throughput because there are no packfiles to accept, no locking or cross-server coordination, and no refs to move around.
这种结构让我们能以非常高的吞吐量接收变更集,因为没有压缩对象包需要接收,没有锁定或跨服务器协调,也没有引用需要移动。
Scion does technically support refs, but since neither creating nor fetching commits involves them, moving one is a compare-and-swap on a single Spanner row that happens separately from creating changesets.
Scion 在技术上确实支持引用,但由于创建和拉取提交都不涉及引用,移动一个引用就是对单个 Spanner 行执行比较并交换(compare-and-swap),这与创建变更集是分开进行的。
A changeset records only what’s changed, so on its own, it can’t quickly answer questions like who last edited a line or which commits affected a file.
变更集只记录变更的内容,因此仅凭自身,它无法快速回答诸如谁最后编辑了某一行或哪些提交影响了某个文件之类的问题。
To answer those, Scion builds additional data structures from the changesets, including dedicated structures for file blame and path history and skip lists for the commit graph.
为了回答这些问题,Scion 从变更集构建额外的数据结构,包括用于文件追溯(file blame)和路径历史的专用结构,以及用于提交图的跳表(skip lists)。
We call everything that isn’t directly part of the changeset “derived data,” and we compute it all through one generic mechanism.
我们把所有不直接属于变更集的内容称为“派生数据(derived data)”,并通过一个通用机制计算全部派生数据。
Each type of derived data is defined recursively, so its value for a changeset is computed from its values for that changeset’s parents.
每种派生数据都是递归定义的,因此一个变更集的派生数据值是根据其父变更集的值计算得出的。
This mechanism has three benefits.
这种机制有三个好处。
First, we can easily add a new type of derived data when a new data structure would make some operation faster.
首先,当新的数据结构能让某些操作更快时,我们可以轻松添加一种新的派生数据类型。
Second, for each type, we can choose whether to compute it eagerly or defer the work, so we avoid materializing data we don’t need.
其次,对于每种类型,我们可以选择是立即计算还是推迟计算,从而避免物化我们不需要的数据。
And third, because the client never sees the internals of these data structures, we can optimize them without changing the client.
第三,由于客户端从不会看到这些数据结构的内部实现,我们可以在不修改客户端的情况下优化它们。
We’ve added new types of derived data many times as the system has grown, such as new indices for performing copy detection or path-based file search.
随着系统的发展,我们已多次添加新的派生数据类型,例如用于执行副本检测(copy detection)或基于路径的文件搜索的新索引。
A small fleet of Scion servers provides source control APIs for any operation a client needs, such as getting changesets, computing diffs, finding merge bases, and fetching blobs.
一个小型 Scion 服务器集群提供 source control API,用于客户端需要的任何操作,例如获取 changeset、计算 diff、查找 merge base 和获取 blob。
All source control data is content-addressed, so a piece of data never changes once it’s stored, and any server can cache it without checking with the others.
所有 source control 数据都是内容寻址(content-addressed)的,因此一份数据一旦存储就永远不会改变,任何服务器都可以缓存它,而无需与其他服务器核对。
As a result, the servers are horizontally scalable and require little coordination.
因此,这些服务器可以横向扩展,并且几乎不需要协调。
They are essentially large caches that can also compute derived data on the fly and write the results back to Spanner.
它们本质上是大规模缓存,也可以即时计算 derived data 并将结果写回 Spanner。
Scion’s many consumers no longer need to maintain local repositories of their own.
Scion 的众多使用方不再需要维护自己的本地仓库(repository)。
Fetching and maintaining the repository used to be a significant maintenance burden for CI jobs or tools that needed to ask source control questions, particularly about commit ancestry and blame.
过去,对于需要向 source control 提问的 CI job 或工具,尤其是关于提交祖先关系(commit ancestry)和 blame 的问题,获取和维护仓库是一项重大的维护负担。
Early in the migration, before we had our own client, repo format, or protocols, Scion only answered these “metadata” queries.
在迁移初期,在我们拥有自己的客户端、repo 格式或协议之前,Scion 只应答这些“元数据”查询。
Fetching file contents and materializing working copies are far more data-intensive operations, and they needed a design of their own.
获取文件内容并生成工作副本(working copy)是数据密集程度高得多的操作,它们需要自己的设计。
Scion’s scn client deviates from git’s fetch protocols in several important ways and, as a result, lends itself to a highly scalable architecture that requires significantly less CPU than git servers.
Scion 的 scn 客户端在几个重要方面偏离了 git 的 fetch 协议,因此适合一种高度可扩展的架构,并且比 git 服务器需要的 CPU 显著更少。
Scion’s negotiation doesn’t tell the server what the client already has; instead, it operates exclusively on trees and blobs the client wants.
Scion 的协商不会告诉服务器客户端已经拥有什么;相反,它只针对客户端想要的 tree 和 blob 进行操作。
Starting from a root tree, the client checks its local store for missing trees and requests them recursively, then repeats the process for blobs.
从根 tree 开始,客户端检查本地存储中缺失的 tree 并递归请求它们,然后对 blob 重复这一过程。
Every request is for a specific object that never changes, so any cache can answer it, and the architecture closely resembles traditional tiered caches.
每个请求都是针对一个永不改变的特定对象,因此任何缓存都可以应答它,而且该架构与传统分层缓存非常相似。
The process is also efficient and resumable, because there is no single multi-gigabyte packfile response.
这个过程也高效且可恢复,因为不存在单个数 GB 的 packfile 响应。
Sparse and even virtualized checkouts don’t need special support, because the client simply doesn’t ask for trees it doesn’t want.
稀疏检出乃至虚拟化检出(virtualized checkout)不需要特殊支持,因为客户端根本不会请求它不想要的 tree。
In the fleet, the client talks over a socket to a daemon, scion-daemon, that stores objects for the whole node.
在集群中,客户端通过 socket 与守护进程(daemon)scion-daemon 通信,后者为整个节点存储对象。
Most of our nodes need access to the monorepo, and jobs on the same node reuse most of the same objects.
我们的大多数节点都需要访问 monorepo,同一节点上的 job 会复用大部分相同的对象。
Each daemon starts from a periodically refreshed snapshot, then talks only to the tree and blob cache servers in its region, called scion-cache.
每个守护进程都从一个定期刷新的快照开始,然后只与其所在区域中称为 scion-cache 的 tree 和 blob 缓存服务器通信。
These cache servers stream objects directly from memory, in the disk format that the daemon will consume, so they don’t need to spend time computing the client’s missing objects or performing delta compression.
这些缓存服务器直接以守护进程将要使用的磁盘格式从内存流式传输对象,因此它们无需花时间计算客户端缺失的对象或执行增量压缩(delta compression)。
When a cache is missing an object, it asks the authoritative scion-servers, which read from Spanner or cloud storage as needed.
当某个缓存缺少对象时,它会向权威的 scion-servers 请求,后者按需从 Spanner 或云存储读取。
The scion-daemon, scion-cache, and scion-server all respond to identical RPCs for this protocol, so the client doesn’t need to know the cache topology.
scion-daemon、scion-cache 和 scion-server 都对该协议响应相同的 RPC,因此客户端不需要知道缓存拓扑。
Any tier could theoretically talk to any other, but we strictly enforce the tiering to isolate failure domains.
理论上任何层级都可以与任何其他层级通信,但我们严格强制执行分层(tiering)以隔离故障域(failure domain)。
We want to avoid a situation where a failure in a regional scion-cache overwhelms the upstream scion-servers and brings down the entire system.
我们希望避免出现以下情况:某个区域 scion-cache 的故障压垮上游 scion-servers,并导致整个系统宕机。

Scion’s checkout architecture.
Scion 的检出架构。
Each tier of this system maintains a cache hit rate of over 99% and does not require long-lived state, so it’s easy to scale up if needed.
该系统的每一层都保持 99% 以上的缓存命中率,并且不需要长期存活的状态,因此需要时很容易扩展。
Our Scion infrastructure footprint is now 200x smaller than our previous git mirroring infrastructure in terms of CPU and memory requirements.
就 CPU 和内存需求而言,我们的 Scion 基础设施占用现在比之前的 git 镜像基础设施小 200 倍。
CI and research jobs check out code two orders of magnitude faster (in seconds rather than minutes), which frees up a sizable amount of capacity across the fleet; CI alone realized a 25% CPU capacity win.
CI 和研究任务检出代码的速度快了两个数量级(以秒计而非分钟计),这在整个机群中释放出相当多的容量;仅 CI 就实现了 25% 的 CPU 容量收益。
Neither clients nor caches need to perform repository maintenance, which simplifies the lifecycle management of our jobs.
客户端和缓存都不需要进行仓库维护,这简化了我们任务的生命周期管理。
We started building Scion around the same time as Claude Mythos Preview and Claude Tag became available internally.
我们开始构建 Scion 的时间,与 Claude Mythos Preview 和 Claude Tag 在内部变得可用的时间大致相同。
Both of these releases simultaneously amplified the need for Scion and meaningfully accelerated how quickly we could build it.
这两个发布同时放大了对 Scion 的需求,并显著加快了我们构建它的速度。
Here’s a particularly striking example.
这里有一个特别引人注目的例子。
Earlier in the year, we had largely handwritten the first version of the git-to-Scion ingestion pipeline as a prototype.
今年早些时候,我们基本上手写了 git-to-Scion 摄取(ingestion)流水线的第一版作为原型。
We thought it was good—until we got our hands on an early internal snapshot of Claude Mythos Preview.
我们认为它很好——直到我们拿到了 Claude Mythos Preview 的早期内部快照。
We asked it to rewrite the whole thing, and with no further instructions, it produced a version that consumed 20x less memory and was 4x faster, while preserving all of the implicit invariants around ingestion ordering and data structures.
我们让它重写整个东西,而在没有进一步指示的情况下,它产出的版本内存消耗少了 20 倍、速度快了 4 倍,同时保留了围绕摄取顺序和数据结构的全部隐式不变量。

Merged changes to the Scion and Antique codebases per week, from January to September 2026.
2026 年 1 月至 9 月,每周合并到 Scion 和 Antique 代码库的变更。
What we learned building and operating Scion offers some interesting lessons for what building agent-scale software could look like.
我们在构建和运营 Scion 过程中学到的东西,为构建智能体(agent)规模的软件可能是什么样子提供了一些有趣的经验教训。
Rapid development with a small team will become more common.
小团队的快速开发将变得更加普遍。
A team of seven people built both Scion and Antique (our code review tool, which we could easily write a whole other blog post about), not to mention half a dozen related systems, and fully migrated to them in five months.
一个七人团队构建了 Scion 和 Antique(我们的代码审查工具,我们完全可以为此另写一整篇博客文章),更不用说还有六个相关系统,并在五个月内完全迁移到这些系统上。
We did all this while the volume of code merged per day increased by 10x.
我们完成这一切的同时,每天合并的代码量增加了 10 倍。
In the past, developing and deploying a source control system like this would have taken a company years of iterative migration, with many more engineers.
在过去,开发和部署这样一个源代码控制系统,会让一家公司花费数年时间进行迭代式迁移,并需要多得多的工程师。
We think this sort of fast, nimble migration will become more common in the future.
我们认为这种快速、灵活的迁移在未来会变得更加普遍。
Engineers are no less valuable, but their work is changing.
工程师的价值丝毫不减,但他们的工作正在发生变化。
All of the engineers who worked on this system would now rate Claude as better at writing code than them.
所有参与这个系统的工程师现在都会认为,Claude 在编写代码方面比他们更强。
But our engineers still supplied the invaluable understanding of the high-level inter-system components and the design-level tradeoffs, making informed choices around the problems we wanted to solve and the scale we knew we needed to achieve.
但我们的工程师仍然提供了不可或缺的理解:高层级系统间组件以及设计层面的权衡,围绕我们想要解决的问题和知道自己需要达到的规模做出明智选择。
Very often, we found that the role of the engineers was to tell Claude “no.”
很多时候,我们发现工程师的角色就是告诉 Claude“不”。
Agents will sometimes violate core system constraints to satisfy a pattern that should never have been allowed in the first place.
智能体有时会违反核心系统约束,去满足一个从一开始就不该被允许的模式。
This was particularly common in our migration.
这在我们迁移过程中尤其常见。
For example, there were multiple systems that tried to brute force looking up when a change merged to main by linearly reading the commit log instead of asking our code review tool.
例如,有多个系统试图通过线性读取 commit log,而不是询问我们的代码审查工具,来暴力查找一个变更何时合并到 main。
Anthropic also makes extensive use of adversarial review, and, while this is incredibly effective in many ways, it can also be myopic, so skilled engineers needed to steer Claude away from over-engineering parts of the system in response to hypothetical concerns.
Anthropic 还大量使用对抗性审查(adversarial review),尽管这在许多方面极其有效,但也可能目光短浅,因此熟练的工程师需要引导 Claude 不要因假设性担忧而对系统某些部分过度工程化。
For example, one such review was overly defensive about trusting another internal service, which resulted in Claude adding excessive validation and complexity.
例如,其中一次审查对信任另一个内部服务过于防御,导致 Claude 添加了过多的校验和复杂性。
Our team members still review every change request for the system, but they now examine the intent of the change as opposed to reading every line of code.
我们的团队成员仍然审查该系统的每一个变更请求,但他们现在检查的是变更意图,而不是逐行阅读代码。
We were able to substantially improve optimization and quality.
我们得以大幅提升优化程度和质量。
By virtue of Claude’s ability to write immense amounts of code much faster than we could ourselves, Scion is among the most well-tested and well-defended codebases we have ever worked on.
凭借 Claude 能够比我们自己快得多地编写海量代码的能力,Scion 是我们参与过的测试最充分、防护最完善的代码库之一。
Even on our tight timeline, we were able to build hermetic simulations of every non-trivial infrastructure and source control interaction we’ve ever encountered, as well as fuzzing and sophisticated rate limiting.
即便时间表很紧,我们也能为我们遇到过的每一种非平凡基础设施和源代码控制交互构建封闭式仿真,以及模糊测试和复杂的速率限制。
Claude also casually found significant optimizations—for example, an algorithmic optimization to ancestry queries that missed one of our indexes—that would have taken an expert days or weeks of analysis and tuning… and then did it all again the next day.
Claude 还顺手发现了重大优化——例如,对漏掉我们某个索引的提交祖先关系查询进行算法优化——这些优化本会让专家花上数天或数周进行分析和调优……然后第二天又把这一切重做了一遍。

Observed performance improvements on native Scion repos.
在原生 Scion 仓库上观察到的性能提升。
We laid the groundwork for new forms of monorepo security.
我们为新形式的 monorepo 安全奠定了基础。
Managing safety, security, and compliance in a massive monorepo is as important as managing the size and scale.
在庞大的 monorepo 中管理安全管理、安全防护与合规性,与管理规模和体量同样重要。
We built Scion with these in mind from the start.
我们从一开始构建 Scion 时就考虑到了这些。
It supports rich access control on repositories, as well as the ability to apply permissions to individual directories in order to protect the most sensitive code without losing the benefits of a monorepo.
它支持对仓库进行丰富的访问控制,也支持将权限应用到单个目录,以保护最敏感的代码,同时不失去 monorepo 的优势。
Furthermore, the code review tooling we built can express complex semantic constraints on approvals, which lets us differentiate simple things like comment-only changes from sensitive logical changes, so that human reviewers can focus on the most consequential changes.
此外,我们构建的代码审查工具能够对批准表达复杂的语义约束,这让我们能区分仅注释变更这类简单变更与敏感逻辑变更,从而让人类审查者可以专注于最重大的变更。
A new level of operational excellence is possible.
实现更高水平的运维卓越(operational excellence)是可能的。
Our team uses Claude Tag heavily, which has helped us monitor each component of the system.
我们的团队大量使用 Claude Tag,这帮助我们监控系统的每个组件。
For example, we created Slack channels where we tasked Claude with being obsessively focused on the health of a single component.
例如,我们创建了 Slack 频道,让 Claude 近乎偏执地专注于单个组件的健康状况。
We call these Claudes “superfans.”
我们称这些 Claude 为“超级粉丝”。
We have a scion-daemon superfan, a scion-cache superfan, an Antique merge queue superfan, and so on.
我们有 scion-daemon 超级粉丝、scion-cache 超级粉丝、Antique merge queue 超级粉丝,等等。
They have access to our telemetry and logs, and act like an experienced engineer who has nothing better to do than to refresh charts and look for anything strange.
它们可以访问我们的遥测数据和日志,表现得像一个经验丰富的工程师,除了刷新图表和寻找任何异常之外没有更好的事可做。
We also have traditional alerts for all of our systems, but our superfans can detect subtle and novel issues that make these alerts seem one-dimensional by comparison.
我们也为所有系统设置了传统告警,但我们的超级粉丝能够检测到细微且新颖的问题,相比之下,这些告警显得过于单一。
We’re completely rethinking our priors.
我们正在彻底重新思考我们的既有认知。
This project prompted us to take a very hard look at other workflows designed for human scale.
这个项目促使我们认真审视其他为人类规模设计的工作流。
A proper merge queue, for example, doesn’t make much sense at agent scale.
例如,一个规范的合并队列(merge queue)在智能体规模下就不太说得通。
What does CI even mean when hundreds or even thousands of changes can merge while tests are running?
当数百甚至数千个变更可以在测试运行期间合并时,CI 到底意味着什么?
We haven’t been able to effectively replicate the industry standard of a global repository lock on the merge queue, so instead, we’ve invested in post-merge and pre-deploy automated testing.
我们一直未能有效复现行业标准的做法——在合并队列上对全局仓库加锁,因此转而投入合并后和部署前的自动化测试。
This does mean that concurrent changes can conflict, but Claude can typically fix these conflicts faster than humans can even identify them.
这确实意味着并发变更可能产生冲突,但 Claude 通常能比人类识别冲突的速度更快地修复这些冲突。
We see Scion as just one part of the answer to the scaling concerns that increasingly capable AI agents have raised.
我们认为 Scion 只是应对能力日益强大的 AI 智能体所引发的扩展性担忧的一部分答案。
We’re sharing these details as an example of how teams can tackle similar challenges, though we don’t expect our solution, or our considerations, to suit every case.
我们分享这些细节,是把它作为团队如何应对类似挑战的一个示例,尽管我们并不认为我们的解决方案或我们的考量适用于所有情况。
Scion is by no means a suitable replacement for git for general use.
Scion 绝不是 git 在通用场景下的合适替代品。
The concepts we’ve outlined here really only make sense for truly enormous monorepos, with either tens of thousands of engineers or swarms of agents prolifically writing code.
我们在这里概述的概念,实际上只适用于真正庞大的 monorepo:要么有数万名工程师,要么有成群的智能体在大量编写代码。
Plus, Anthropic is unique in that our ability to spend tokens for internal use far exceeds what any other business would realistically want to spend.
此外,Anthropic 的独特之处在于,我们为内部使用花费 token 的能力远远超出任何其他企业现实中愿意承担的支出。
We do this both to address our own software development needs, and to test Claude’s capabilities.
我们这样做既是为了满足自身的软件开发需求,也是为了测试 Claude 的能力。
Practically speaking, it’s difficult to offer Scion in a form that would be broadly useful to other organizations.
实际上,很难把 Scion 以对其他组织广泛有用的形式提供出来。
It diverges significantly from git, meaning companies would need to migrate every piece of the development lifecycle, and it requires its own code review, code search, and CI.
它与 git 差异很大,意味着公司需要迁移开发生命周期的每一个环节,而且它还需要自己的代码审查、代码搜索和 CI。
Our internal versions of these components are highly bespoke, so they would be difficult for other organizations to adopt, and we worry that attempting to build a public version that tries to please everyone wouldn’t actually be very useful.
我们这些组件的内部版本高度定制化,因此其他组织很难采用,而且我们担心,试图打造一个让所有人都满意的公开版本,实际上并不会有多大用处。
However, we anticipate that this class of problems will become more commonplace over the next six to 12 months, and it would be an inefficient use of engineering resources for every company using git to face similar challenges alone.
然而,我们预计这类问题在未来 6 到 12 个月内会变得更加普遍,而让每一家使用 git 的公司各自面对类似挑战,会是对工程资源的低效使用。
Given that, we think the most impactful thing we can do is to share our thinking, so that other developers can apply some of the most successful parts of Scion to git without departing from the overall model.
有鉴于此,我们认为最有影响力的事情就是分享我们的思考,让其他开发者可以在不脱离整体模型的前提下,把 Scion 中最成功的一些部分应用到 git 上。
A git server doesn’t have to work the same way as a git client does; novel server architectures exist that provide significant scaling improvements.
git 服务器不一定要像 git 客户端那样工作;存在一些新颖的服务器架构,可以带来显著的扩展性提升。
Git platforms can provide comprehensive server-side RPCs like Scion, perhaps even in a standardized way across forges that the git client can learn to talk to.
Git 平台可以提供像 Scion 那样全面的服务端 RPC,甚至可能以标准化方式跨越各个代码托管平台(forge),让 git 客户端学会与之通信。
The negotiation protocol doesn’t have to look exactly like it does today, either, and the various sparse and shallow features in git can be made to compose well.
协商协议也不必与今天完全一样,而且 git 中各种 sparse 和 shallow 特性也可以被设计成良好组合。
Lastly, we want to acknowledge that the git community has spent nearly two decades scaling the platform for millions of developers.
最后,我们要承认,git 社区花了近二十年时间,为数百万开发者扩展这一平台。
Our contribution is far narrower: sharing our early view into how agentic software development interacts with these systems, so that we can partner with GitHub, GitLab, and the OSS community to support the changing needs of developers.
我们的贡献要窄得多:分享我们对智能体化软件开发如何与这些系统交互的早期看法,以便与 GitHub、GitLab 和 OSS 社区合作,支持开发者不断变化的需求。
We’re all in it together as the software development lifecycle intersects with the AI exponential.
当软件开发生命周期与 AI 的指数级发展相交汇时,我们都身处其中。
Written by Nick G. and the source control team: S.G., R.K., Dan C., Garrett H., Ben L., Colin M., Joe P.
作者:Nick G. 与源代码管理团队:S.G.、R.K.、Dan C.、Garrett H.、Ben L.、Colin M.、Joe P.
We’re grateful to Vilas J. and Sergiu D. for supporting the source control team on this ambitious journey and Amir O. for early contributions to Antique.
我们感谢 Vilas J. 和 Sergiu D. 在这段雄心勃勃的旅程中对源代码管理团队的支持,以及 Amir O. 对 Antique 的早期贡献。
Storing changed files relative to the first parent of a merge is a stylistic choice; in practice, we’ve found that people only care about history or blame for commits on the main line in trunk-based development in a monorepo.
相对于合并的第一个父提交来存储变更文件是一种风格选择;在实践中,我们发现在 monorepo 的基于主干的开发(trunk-based development)中,人们只关心主线上提交的历史或 blame。
Specifically, the server component of Sapling, Mononoke.
具体来说,就是 Sapling 的服务端组件 Mononoke。
It pioneered many of the techniques we use in Scion, in particular the Bonsai data model.
它开创了我们如今在 Scion 中使用的许多技术,尤其是 Bonsai 数据模型。