Redesigning source control at Anthropic
https://www.anthropic.com/engineering/redesigning-source-control📌 【Anthropic 工程部落格】Claude 寫太多程式碼,逼出一套新版本控制系統
TL;DR:Anthropic 自建 Scion 取代 git,五個月內完成monorepo 全面遷移,只因 agent 把程式碼合併量衝到每天三萬次。
🎣 2026 年 5 月,Anthropic 平均每天合併約 2,500 次程式碼變更;到了 9 月,這個數字變成超過 30,000 次。不是團隊變多了,而是 Claude 自己在寫程式。當 agent 的產出速度遠超人類開發基礎設施的負荷上限,瓶頸就從「寫程式」轉移到了「版本控制」。
🤔 當 git 的設計假設不再成立
Anthropic 在文章中指出,coding 已經不再是建構系統或做研究的瓶頸:Claude 能自主迭代研究迴圈、微調複雜程式、從零打造新服務。真正卡住團隊的,是為「人類開發速度」設計的基礎設施:source control、build 與 CI。
git 的核心設計是去中心化:每個 clone 都是完整、可離線運作的 repository。但 Anthropic 的 monorepo 主分支歷史已逼近 100GB,壓縮後的工作副本超過 25GB,單日光是 CI 就要執行約 2,500 萬次 checkout(還不含開發環境、agent sandbox 與研究任務)。若直接 fetch,等於每天產生超過 600 PB 的 git 流量。團隊雖然用了 shallow clone、sparse checkout、promisor remote,甚至曾經同時維運數百個內部 git mirror 來撐住負載,但 seed(存放在 blob storage 的 repo 快照)會隨著主幹更新而逐漸過時,依賴歷史紀錄的操作(如 diff、blame)在partial clone 上也愈來愈難維持。
🧩 把「client 永遠在線」當成第一原則
Anthropic 觀察到一個關鍵事實:幾乎所有的 client 都是 agent 與自動化任務,而這些 client 定義上就是「永遠在線」的。於是團隊重新設計了一套名為 Scion 的版本控制系統,核心原則包括:
- Client 永遠在線:不像 git 假設 client 需要離線運作與完整副本,Scion 的 client 只維護有限大小的本地 object 快取,資料由 server 隨需取得。
- Client-server 不對稱:git 的每個 client 都能充當完整 server;Scion 則由 server 負責歷史查詢、blame、建立 commit、merge 與 rebase,client 只負責本地快取、檔案系統監控與使用者互動。
- 完整的 API 化 source control 服務:許多內部工具(如自動化 bisect 與 revert pipeline)可以直接透過 API 查詢版本控制資訊,不需要本地 repo 副本。
- 一切都要能水平擴展:Scion 的資料是分散式的,沒有任何地方存有完整的 repo 副本(包括 server 端),也沒有 git packfile 這類需要維護的壓縮檔。
- Commit 必須便宜、增量、無鎖:所有 commit、rebase、merge 都發生在 server 端,操作成本只跟變更大小相關,而非整個 repo 的大小;除了主分支與 release 分支外,Scion 盡量避免使用 ref(分支、tag),以減少所有 server 必須同步的全域狀態。
- 工作副本是可選的,且預設為 sparse:CI job 可以直接向 server 詢問兩個 commit 之間的 diff,不需要先 checkout;Scion 的協議以 sparse checkout 與「虛擬化 checkout」(依需求才實體化檔案)為中心,真正需要讀取檔案時才會產生對應成本。
文章也提到,Scion 的設計參考了 Google Piper 與 Meta Sapling 這類大型 monorepo 版本控制系統的既有經驗。在實作上,Scion 的基本工作單位是「changeset」,以 write-ahead log 的形式記錄,涵蓋了 git commit 中大部分常見的資訊。除了 Scion 本身,Anthropic 同期也打造了程式碼審查介面 Antique、程式碼搜尋,以及一套 source control 專用的 IAM 系統。
💡 問題本質不是「git 不好」,而是「人類規模 vs agent 規模」
這篇文章最值得注意的觀點是:git 為離線、分散式協作設計的特性,在一個幾乎所有 client 都是「永遠在線的 agent」的世界裡,反而成了限制擴展的包袱。Anthropic 並不是說 git 設計有誤,而是指出當開發主體從人類轉移到大量自動化 agent 時,原本的假設不再成立。
🎯 實務啟示
對正在大量導入 AI coding agent 的團隊而言,即使暫時不需要重建整套版本控制系統,Scion 的設計原則仍值得參考:優先思考「API 化的 source control 查詢」能不能取代本地 checkout,以及現有 CI/CD pipeline 在 agent 產出量大幅成長後,哪個環節會最先撐不住。
🔗 來源
- 標題:Redesigning source control at Anthropic
- 作者/機構:Anthropic
- 連結:https://www.anthropic.com/engineering/redesigning-source-control
#Anthropic #Scion #VersionControl #SourceControl #AgenticCoding #DeveloperInfrastructure #Monorepo #Git #SoftwareEngineering #ClaudeCode
原始資料 Anthropic Engineering · 收集於 2026-10-13
摘要原文
At Anthropic, coding is no longer the bottleneck to building systems or doing research. 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. The bottleneck, now, is all of the developer infrastructure built for human scale: source control, builds, and CI. In May 2026, Anthropic averaged around 2,500 code changes merged per day; as of September, we merged over 30,000 per day. 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. 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. 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. In this post, we’ll focus on how we built Scion specifically. 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. Growing our monorepo 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. 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. 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. For the vast majority of repositories, this is the right design, and it’s a large part of why git became the standard. As our monorepo grows, it increasingly doesn’t fit that design space. The history of our main branch alone is almost 100 GB, and a compressed working copy is over 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. Fetched naively, that would be over 600 PB of git traffic per day. Git offers tools for working with a slice of a repository, such as shallow clones, sparse checkouts, and promisor remotes. Beyond these, there are standard workarounds for large monorepos, like internal git mirrors and repository snapshots (seeds) kept in blob storage. We’ve used all of them—at our peak, we operated several hundred internal git mirrors to deal with the load. 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. The typical setup for scaling git checkouts. 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. The properties that make git excellent for distributed, offline work were actively undermining our ability to scale as the repo grew. 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? Principles for agent-scale source control 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. Source control for huge monorepos has prior art, notably Google’s Piper and Meta’s Sapling , so we were able to build Scion with their hard-won lessons in mind. Our principles are: Clients are always online. Git assumes that clients work offline and need a complete copy of the repository. 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. Client-server asymmetry. In git, every client is capable of being a full-fledged server. In Scion, the server answers questions about file history and blame, creates commits, performs merges and rebases, and so on. 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. 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. 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. 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. 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. There is no equivalent of packfiles (git’s compressed bundles of objects), so no repository maintenance is needed. Commits must be cheap, incremental, and lock-free. In git, you commit locally and then push to share your work. 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. 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. 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. With Scion, a CI job that needs the diff between a commit and its merge base, for example, can ask the server for it. The same goes for writes: many write workloads can also skip the checkout and function entirely via 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. How Scion works It’s helpful to understand how these principles came together in practice when building Scion. These insights can apply to other source control systems or, more broadly, to other stages of the software development lifecycle. Data structures In Scion, the unit of work is a “changeset,” an entry in a write-ahead log. A changeset stores most of what you’d expect from a commit in git.
由 claude-code/sonnet 自動生成