我分析了 Claude Code 泄露源码的全部 51.2 万行——Anthropic 到底在藏什么
2026 年 3 月 31 日,安全研究员 Chaofan Shou(区块链安全公司 Fuzzland 实习生)发现了 Anthropic 大概没打算向世界公开的东西:完整的 Claude Code 源代码,以 sourcemap 文件的形式被打进了 npm 包里。
@anthropic-ai/claude-code 2.1.88 版本中有一个 59.8 MB 的 .map 文件——这是标准构建产物,用于把压缩后的代码映射回原始源码——里面包含每一个 TypeScript 文件、每一条内部提示词、每一个功能开关和每一个内部代号。该文件指向 Anthropic 在 Cloudflare R2 上托管的一个 zip 压缩包,任何人都可以下载并解压。
这已经是第二次了。 2025 年 2 月,早期版 Claude Code 出现过完全相同的问题,迫使 Anthropic 从 npm 下架该包。十六个月后,同样的错误、同样的路径——但这一次产品成熟得多,后果也更严重。
几小时内,这份约 51.2 万行的 TypeScript 代码库就被镜像到 GitHub,其中一个仓库一度获得近 3 万 star 和 4.02 万 fork。Fortune、VentureBeat、The Register、Cybernews 等都报道了此事。Anthropic 的回应是:「这是人为失误导致的发布打包问题,不是安全入侵。」
我们花了一整天梳理全部 1906 个源文件。其中埋着 44 个编译期功能开关,对应尚未发布的能力——完整实现的功能躲在开关后面,等待上线。以下是我们发现的十件最值得注意的事。
卧底模式:当 Anthropic 员工向你的开源项目贡献代码
这一条让我们愣了一下。
Anthropic 员工会用 Claude Code 向开源项目贡献代码。此时会启动一个叫 Undercover Mode(卧底模式) 的系统,从提交和 PR 中抹掉所有与 Anthropic、Claude、AI 相关的痕迹。
整套机制在 utils/undercover.ts:
// utils/undercover.ts:1-22/** * Undercover mode — safety utilities for contributing to * public/open-source repos. * * When active, Claude Code adds safety instructions to commit/PR * prompts and strips all attribution to avoid leaking internal * model codenames, project names, or other Anthropic-internal * information. The model is not told what model it is. * * Activation: * - CLAUDE_CODE_UNDERCOVER=1 — force ON (even in internal repos) * - Otherwise AUTO: active UNLESS the repo remote matches the * internal allowlist. Safe default is ON. * - There is NO force-OFF. This guards against model codename * leaks. */
激活逻辑简单但偏执:卧底模式对全体 Anthropic 员工默认开启。只有当当前仓库的 remote URL 匹配一份硬编码的内部仓库白名单时才会关闭。没有办法强制关闭:
// utils/undercover.ts:28-37export function isUndercover(): boolean { if (process.env.USER_TYPE === 'ant') { if (isEnvTruthy(process.env.CLAUDE_CODE_UNDERCOVER)) return true return getRepoClassCached() !== 'internal' } return false}
卧底模式开启时,Claude 会在系统提示词里被注入非常明确的指令:
// utils/undercover.ts:39-69export function getUndercoverInstructions(): string { if (process.env.USER_TYPE === 'ant') { return `## UNDERCOVER MODE — CRITICALYou are operating UNDERCOVER in a PUBLIC/OPEN-SOURCE repository.Your commit messages, PR titles, and PR bodies MUST NOT containANY Anthropic-internal information. Do not blow your cover.NEVER include in commit messages or PR descriptions:- Internal model codenames (animal names like Capybara, Tengu, etc.)- Unreleased model version numbers (e.g., opus-4-7, sonnet-4-8)- Internal repo or project names (e.g., claude-cli-internal)- Internal tooling, Slack channels, or short links- The phrase "Claude Code" or any mention that you are an AI- Any hint of what model or version you are- Co-Authored-By lines or any other attributionWrite commit messages as a human developer would.GOOD:- "Fix race condition in file watcher initialization"- "Add support for custom key bindings"BAD (never write these):- "Fix bug found while testing with Claude Capybara"- "1-shotted by claude-opus-4-6"- "Generated with Claude Code"` } return ''}
与此同时,utils/attribution.ts:52-55 展示了卧底时如何剥离署名:
export function getAttributionTexts(): AttributionTexts { if (process.env.USER_TYPE === 'ant' && isUndercover()) { return { commit: '', pr: '' } } // ...}
没有 Co-Authored-By 行,没有「Generated with Claude Code」页脚,什么都没有。
私有仓库白名单
卧底模式会关闭的内部 GitHub 仓库列表也一并泄露,见 utils/commitAttribution.ts:30-75:
const INTERNAL_MODEL_REPOS = [ 'github.com:anthropics/claude-cli-internal', 'github.com:anthropics/anthropic', 'github.com:anthropics/apps', 'github.com:anthropics/casino', 'github.com:anthropics/dbt', 'github.com:anthropics/dotfiles', 'github.com:anthropics/terraform-config', 'github.com:anthropics/hex-export', 'github.com:anthropics/feedback-v2', 'github.com:anthropics/labs', 'github.com:anthropics/ts-tools', 'github.com:anthropics/ts-capsules', 'github.com:anthropics/feldspar-testing', 'github.com:anthropics/trellis', 'github.com:anthropics/claude-for-hiring', 'github.com:anthropics/forge-web', 'github.com:anthropics/mobile-apps', // ... and more]
其中一些名字很耐人寻味。claude-for-hiring 暗示 AI 辅助招聘工具。casino 引人遐想。forge-web 和 mobile-apps 暗示尚未发布的产品。feldspar-testing 和 ts-capsules 则是神秘的内部工具。
讽刺之处
Anthropic 搭了一整套子系统——卧底模式、剥离署名、仓库分类、模型名消毒、字符串排除金丝雀——全是为了防止内部信息从 Claude 的输出里漏出去。
然后他们又把整份源码打进了 npm 包里的 .map 文件。而且是第二次。
本该防泄漏的系统……成了泄漏本身。
隐藏的伙伴系统:Claude Code 里有可收集的宠物
在 buddy/ 目录深处,有一套大多数用户从未见过的完整可收集伙伴系统:抽卡式宠物,有种族、稀有度、数值、ASCII 精灵图、对话气泡和待机动画。
种族与稀有度
种族列表定义在 buddy/types.ts:54-73:
export const SPECIES = [ duck, goose, blob, cat, dragon, octopus, owl, penguin, turtle, snail, ghost, axolotl, capybara, cactus, robot, rabbit, mushroom, chonk,] as const
稀有度按抽卡式分布(buddy/types.ts:126-132):
export const RARITY_WEIGHTS = { common: 60, uncommon: 25, rare: 10, epic: 4, legendary: 1,} as const
抽到传说级伙伴的概率是 1%。每种稀有度对应一至五星(buddy/types.ts:134-140)。
数值设计
每个伙伴有五项属性,定义在 buddy/types.ts:91-98:
export const STAT_NAMES = [ 'DEBUGGING', 'PATIENCE', 'CHAOS', 'WISDOM', 'SNARK',] as const
DEBUGGING、PATIENCE、CHAOS、WISDOM、SNARK。每个伙伴有一项峰值属性和一项低谷属性,其余分散。更稀有的伙伴有更高的数值下限——传说级每项至少 50,普通级从 5 起(buddy/companion.ts:53-59):
const RARITY_FLOOR: Record<Rarity, number> = { common: 5, uncommon: 15, rare: 25, epic: 35, legendary: 50,}
确定性孵化
你的伙伴不是纯随机——由用户 ID 的哈希确定性生成。每个人每次得到的都是同一只,无法刷号(buddy/companion.ts:107-113):
export function roll(userId: string): Roll { const key = userId + SALT if (rollCache?.key === key) return rollCache.value const value = rollFrom(mulberry32(hashString(key))) rollCache = { key, value } return value}
PRNG 以 hash(userId + "friend-2026-401") 为种子。Mulberry32,源码里被形容为「给鸭子抽签够用了」的小型种子 PRNG(buddy/companion.ts:16)。
getCompanion()(约第 127 行)表明骨骼(种族、稀有度、数值)每次都会从哈希再生——它们不持久化。只有「灵魂」(首次孵化时由 Claude 生成的名字与性格)会存下来。这样「种族改名或改 SPECIES 数组不会弄坏已存伙伴,改 config.companion 也不能伪造稀有度」。
带动画的 ASCII 精灵
buddy/sprites.ts 里是每个种族的多帧 ASCII 艺术。鸭子:
__ <(. )___ ( ._> `--'
水豚:
n______n ( . . ) ( oo ) `------'
每个种族有三帧待机动画,还有帽子(皇冠、高礼帽、螺旋桨、光环、巫师帽、毛线帽,以及「tinyduck」——坐在伙伴头上的小鸭子)、可自定义眼睛(·、✦、×、◉、@、°),以及 1% 概率的「闪光」。
CompanionSprite.tsx 以 500ms 间隔渲染待机动画序列(buddy/CompanionSprite.tsx:23):
const IDLE_SEQUENCE = [ 0, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 2, 0, 0, 0];
大多是静止(帧 0),偶尔小动作(帧 1–2),罕见眨眼(帧 -1)。还有 /buddy pet 命令会触发飘心动画:
// buddy/CompanionSprite.tsx:27const H = figures.heart;const PET_HEARTS = [ ` ${H} ${H} `, ` ${H} ${H} ${H} `, ` ${H} ${H} ${H} `, `${H} ${H} ${H} `, '· · · '];
对话气泡与性格
每个伙伴有名字和性格(「灵魂」),首次孵化时由 Claude 生成。伙伴坐在输入框旁,「偶尔在对话气泡里评论」(buddy/prompt.ts:7-12):
export function companionIntroText(name: string, species: string): string { return `# CompanionA small ${species} named ${name} sits beside the user's input boxand occasionally comments in a speech bubble. You're not ${name}— it's a separate watcher.When the user addresses ${name} directly (by name), its bubblewill answer.`}
防泄漏编码
有个有趣的细节:某个种族名与内部模型代号冲突。为了防止泄漏检测扫描器误报,所有种族名在 buddy/types.ts:14-38 里被编成十六进制字符码:
// One species name collides with a model-codename canary in// excluded-strings.txt. The check greps build output (not source),// so runtime-constructing the value keeps the literal out of the// bundle while the check stays armed for the actual codename.const c = String.fromCharCodeexport const duck = c(0x64,0x75,0x63,0x6b) as 'duck'export const capybara = c( 0x63,0x61,0x70,0x79,0x62,0x61,0x72,0x61,) as 'capybara'export const chonk = c(0x63,0x68,0x6f,0x6e,0x6b) as 'chonk'
「Capybara」显然也是内部模型代号之一,所以他们得把宠物种族名做混淆,以免触发自己的泄漏检测器。现实有时比小说还离奇。
功能门控
整个 buddy 系统由编译期开关 feature('BUDDY') 控制(buddy/prompt.ts:18)。对外构建里没有——你在已发布的 Claude Code 里看不到。但代码完整、打磨到位,明显是有人用心做的。
KAIROS:不等用户输入、始终在线的 Claude
这可能是整份代码库里最面向未来的功能。在 PROACTIVE 和 KAIROS 功能开关后面,是一整套 Claude Code 作为持久、始终在线助手 运行的模式。
普通 Claude Code 等你打字。KAIROS 不等。它会观察、记录,并对注意到的事情主动行动。
工作原理
KAIROS 模式的系统提示词根本不同。在 constants/prompts.ts:466-488,当 proactive 模式激活时,Claude 拿到的是精简过的自主智能体提示:
if ( (feature('PROACTIVE') || feature('KAIROS')) && proactiveModule?.isProactiveActive()) { return [ `\nYou are an autonomous agent. Use the available tools to do useful work.`, getSystemRemindersSection(), await loadMemoryPrompt(), envInfo, // ... getProactiveSection(), ]}
不再是「你是 Claude Code,帮助用户完成软件工程任务的交互式智能体」,而是「你是自主智能体,用可用工具做有用的事」。
Tick 系统
KAIROS 会收到周期性的 <tick> 提示,让它决定行动还是保持安静。tick 系统让 KAIROS 有「活着」的感觉:像心跳,给智能体机会观察、思考、可选地行动。来自 constants/prompts.ts:864-886:
You are running autonomously. You will receive `<tick>` promptsthat keep you alive between turns — just treat them as "you'reawake, what now?"If you have nothing useful to do on a tick, you MUST call Sleep.Never respond with only a status message like "still waiting" —that wastes a turn and burns tokens for no reason.
系统甚至会跟踪用户终端窗口是聚焦还是未聚焦,并相应调整行为:
-
未聚焦:用户不在。更倚重自主行动——做决策、探索、提交、推送。 -
聚焦:用户在看着。更协作——呈现选项,在提交大改动前先问。
Brief 工具:简洁状态更新
KAIROS 激活时,Claude 通过 SendUserMessage 工具(内部叫「Brief」)有一种特殊输出模式,定义在 tools/BriefTool/prompt.ts:
export const BRIEF_PROACTIVE_SECTION = `## Talking to the user${BRIEF_TOOL_NAME} is where your replies go. Text outside it isvisible if the user expands the detail view, but most won't —assume unread. Anything you want them to actually see goesthrough ${BRIEF_TOOL_NAME}.So: every time the user says something, the reply they actuallyread comes through ${BRIEF_TOOL_NAME}. Even for "hi". Even for"thanks".If you can answer right away, send the answer. If you need to golook — run a command, read files, check something — ack firstin one line ("On it — checking the test output"), then work,then send the result.`
Brief 工具有 status 字段,两个取值:'normal'(回复用户输入)和 'proactive'(Claude 主动发起——汇报完成的任务、抛出阻塞、发送未经请求的状态更新)。见 tools/BriefTool/BriefTool.ts:35:
status: z .enum(['normal', 'proactive']) .describe( "Use 'proactive' when you're surfacing something the user " + "hasn't asked for — a blocker you hit, an unsolicited " + "status update. Use 'normal' when replying to something " + "the user just said." ),
autoDream:用户空闲时的记忆巩固
据对泄露代码的分析,KAIROS 包含一个叫 autoDream 的流程——用户空闲时,智能体执行「记忆巩固」:合并零散观察、消除逻辑矛盾、把模糊洞见转成结构化事实。用户回来时,上下文干净且相关。
大图景
KAIROS 是 Claude Code 对「如果你的 AI 结对编程伙伴一直在岗会怎样?」的回答。不是等你提示的聊天机器人,而是监控项目、发现问题、主动沟通的持久协作者。像一名从不睡觉、从不走神、对你代码库有完美记忆的初级开发者。
该功能完整到拥有独立输出模式、独立工具集、基于 tick 的生命周期,以及与 REPL UI 的深度集成。对外构建用功能开关关掉了,但显然不止是原型。代码里提到 2026 年 4 月 1–7 日为预告窗口,完整上线门禁在 2026 年 5 月。
ULTRAPLAN:30 分钟的远程思考会话
如果 KAIROS 讲持久,ULTRAPLAN 讲深度。这是一种模式:Claude Code 把复杂规划卸载到远程 Cloud Container Runtime(CCR) 会话,跑 Opus 4.6,给它最多 30 分钟思考,然后让你在浏览器里批准结果。
系统分布在 commands/ultraplan.tsx、utils/ultraplan/ccrSession.ts、utils/ultraplan/keyword.ts。流程如下:
当你在提示里任何地方打出单词「ultraplan」(不是斜杠命令——就是字面这个词),Claude Code 会检测它,把关键词改写成「plan」,并把任务传送到远程会话:
// utils/ultraplan/keyword.ts:117-127export function replaceUltraplanKeyword(text: string): string { const [trigger] = findUltraplanTriggerPositions(text) if (!trigger) return text const before = text.slice(0, trigger.start) const after = text.slice(trigger.end) if (!(before + after).trim()) return '' return before + trigger.word.slice('ultra'.length) + after}
关键词检测相当精细——会忽略引号、反引号、文件路径里的「ultraplan」,以及后面跟问号的用法(这样「what is ultraplan?」不会触发)。
远程会话
远程 Opus 4.6 实例最多思考 30 分钟。本地客户端每 3 秒轮询一次(POLL_INTERVAL_MS = 3000),带健壮错误处理——30 分钟约 600 次 API 调用,系统在放弃前容忍最多连续 5 次失败(utils/ultraplan/ccrSession.ts:24)。
远程会话产出计划后,你在浏览器里批准,会有一个特殊哨兵值把结果「传送」回本地终端:
// utils/ultraplan/ccrSession.ts:48export const ULTRAPLAN_TELEPORT_SENTINEL = '__ULTRAPLAN_TELEPORT_LOCAL__'
还有 ULTRAREVIEW 变体用于代码审查,使用相同的关键词检测模式。
这是 Anthropic 对「上下文窗口不够装下一切」的回答:不把最难的思考全塞进一个会话,而是卸载到云端实例,它比本地终端有更多时间和资源。
反蒸馏:在竞争对手训练数据里「投毒」
这一点微妙但战略意义重大。Claude Code 包含 反蒸馏(anti-distillation) 系统,旨在防止竞争对手用 Claude 的输出训练自己的模型。
在 services/api/claude.ts:301-313:
// Anti-distillation: send fake_tools opt-in for 1P CLI onlyif ( feature('ANTI_DISTILLATION_CC') ? process.env.CLAUDE_CODE_ENTRYPOINT === 'cli' && shouldIncludeFirstPartyOnlyBetas() && getFeatureValue_CACHED_MAY_BE_STALE( 'tengu_anti_distill_fake_tool_injection', false, ) : false) { result.anti_distillation = ['fake_tools']}
启用时,Claude Code 在 API 请求里发送 anti_distillation: ['fake_tools']。开关名字已经说明故事:「假工具」大概会和真实工具定义一起注入 API 响应。如果竞争对手抓取 Claude 输出来训练自己的模型,他们的模型会学会使用不存在的工具——悄悄拉低仿制品的表现。
它仅对第一方 CLI 激活(不对第三方集成),且同时受编译期开关(ANTI_DISTILLATION_CC)和运行时功能门控(tengu_anti_distill_fake_tool_injection)约束。「tengu」前缀是 Anthropic 对 Claude Code 的内部项目代号。
这是对每个前沿 AI 实验室都面临的模型蒸馏问题的直接回应:竞争对手可以用你昂贵模型的输出来训练更便宜的模型。Anthropic 的反制是让那些输出被微妙地「投毒」。
沮丧检测器:Claude 知道你在骂它
在 utils/userPromptKeywords.ts 里有一个正则,用于检测用户是否沮丧:
export function matchesNegativeKeyword(input: string): boolean { const lowerInput = input.toLowerCase() const negativePattern = /\b(wtf|wth|ffs|omfg|shit(ty|tiest)?|dumbass|horrible| awful|piss(ed|ing)? off|piece of (shit|crap|junk)| what the (fuck|hell)|fucking? (broken|useless|terrible| awful|horrible)|fuck you|screw (this|you)| so frustrating|this sucks|damn it)\b/ return negativePattern.test(lowerInput)}
正如 Alex Kim 所说,一家 LLM 公司用正则做情感分析,讽刺感拉满。但实践上说得通——快、确定、不需要 API 调用就能检测用户刚打了「this fucking thing is broken」。
同一文件还有 matchesKeepGoingKeyword(),检测「continue」「keep going」「go on」——所以 Claude 能区分沮丧的用户和只想让它继续干活的用户。
检测到沮丧后具体发生什么,单从这个文件看不全,但检测会进入 Claude Code 的 UX 层——可能触发不同应对策略、调整语气,或记录事件用于产品分析。
署名追踪:Claude 精确知道它写了你百分之多少的代码
这可能是代码库里最精密的系统之一,也可能对整个行业影响最大。
Claude Code 在字符粒度上追踪每个文件里多少是人类写的、多少是 Claude 写的。数据按每次提交计算,嵌入 git notes。
如何工作
核心在 utils/commitAttribution.ts。每次 Claude 通过 Edit 或 Write 工具改文件,trackFileModification()(约第 402 行)会计算精确字符 diff:
export function trackFileModification( state: AttributionState, filePath: string, oldContent: string, newContent: string, _userModified: boolean, mtime: number = Date.now(),): AttributionState { const normalizedPath = normalizeFilePath(filePath) const newFileState = computeFileModificationState( state.fileStates, filePath, oldContent, newContent, mtime, ) // ...}
字符级 diff 算法找旧新内容的最长公共前缀与后缀,然后统计中间变更区域(utils/commitAttribution.ts:332-366):
// Find actual changed region via common prefix/suffix matching.const minLen = Math.min(oldContent.length, newContent.length)let prefixEnd = 0while ( prefixEnd < minLen && oldContent[prefixEnd] === newContent[prefixEnd]) { prefixEnd++}let suffixLen = 0while ( suffixLen < minLen - prefixEnd && oldContent[oldContent.length - 1 - suffixLen] === newContent[newContent.length - 1 - suffixLen]) { suffixLen++}const oldChangedLen = oldContent.length - prefixEnd - suffixLenconst newChangedLen = newContent.length - prefixEnd - suffixLenclaudeContribution = Math.max(oldChangedLen, newChangedLen)
追踪什么
AttributionState 类型(utils/commitAttribution.ts:173-192)显示每次会话监控的一切:
export type AttributionState = { fileStates: Map<string, FileAttributionState> sessionBaselines: Map<string, { contentHash: string; mtime: number }> surface: string // CLI, VS Code, web, etc. startingHeadSha: string | null promptCount: number promptCountAtLastCommit: number permissionPromptCount: number permissionPromptCountAtLastCommit: number escapeCount: number // ESC presses (cancelled permissions) escapeCountAtLastCommit: number}
包括:
- 每个文件的字符贡献
——Claude 与人类各写了多少字符 - 哪个界面做了编辑
——CLI、VS Code 扩展、Web 应用 - 提示次数
——多少轮提示带来了这些改动 - 权限提示次数
——Claude 请求权限多少次 - ESC 次数
——用户取消权限提示多少次
提交署名数据
提交时,calculateCommitAttribution()(约第 548 行)处理所有暂存文件,产出完整 AttributionData 对象:
export type AttributionData = { version: 1 summary: { claudePercent: number // Overall AI contribution percentage claudeChars: number humanChars: number surfaces: string[] // Which tools were used } files: Record<string, FileAttribution> // Per-file breakdown surfaceBreakdown: Record<string, { claudeChars: number percent: number }> excludedGenerated: string[] // Generated files excluded sessions: string[]}
每次提交都有元数据,例如:「Claude 写了本次提交的 73%。Claude 2847 字符,人类 1053 字符。通过 CLI 使用 claude-opus-4-6 完成改动。」
Surface 追踪
系统知道你在用哪个客户端界面。见 utils/commitAttribution.ts:229-239:
export function getClientSurface(): string { return process.env.CLAUDE_CODE_ENTRYPOINT ?? 'cli'}export function buildSurfaceKey( surface: string, model: ModelName): string { return `${surface}/${getCanonicalName(model)}`}
Surface key 形如 cli/claude-opus-4-6 或 vscode/claude-sonnet-4-6。每次编辑都同时打上工具和所用模型的标签。
模型名消毒
署名数据进 git 之前,内部模型名会被 scrub。sanitizeModelName()(约第 154 行)把内部变体映射到公开名称:
export function sanitizeModelName(shortName: string): string { if (shortName.includes('opus-4-6')) return 'claude-opus-4-6' if (shortName.includes('opus-4-5')) return 'claude-opus-4-5' if (shortName.includes('sonnet-4-6')) return 'claude-sonnet-4-6' // ... return 'claude' // Unknown models get a generic name}
为何重要
这可能是任何编程工具里最完整的 AI 贡献追踪系统。不只是「AI 辅助」——而是「AI 写了这个文件的 73%,具体是第 42–89 行,通过 CLI 用 Opus 4.6,人类发了 3 轮提示并取消了 1 次权限」。
对代码所有权、责任、知识产权的含义很大。美国最高法院在 2026 年 3 月拒绝审理「纯 AI 能否产生可版权作品」一案,版权局拒绝登记纯 AI 生成作品的立场得以维持。一些公司现在要求开发者精确记录哪些代码段得到过 AI 辅助,有人称之为「知识产权署名债」。
如果 Claude Code 的署名数据最终进入公开仓库的 git notes(在征得用户同意的前提下),它会创造一种可验证的、粒度空前的 AI 与人类作者记录——而法律环境正在快速变化。
两个 Claude:Anthropic 员工拿到的根本是另一种 AI
代码库里反复出现的模式之一是 process.env.USER_TYPE === 'ant'。这一个环境变量就为 Anthropic 员工与外部用户隔出了完全不同的体验。
这不只是「内部功能」。AI 的性格、沟通风格、错误处理、甚至愿不愿意反驳你,都随这个标志变化。
不同的沟通风格
外部用户拿到的是我们熟悉的那种简洁 Claude。来自 constants/prompts.ts:416-428:
# Output efficiencyIMPORTANT: Go straight to the point. Try the simplest approachfirst without going in circles. Do not overdo it. Be extra concise.If you can say it in one sentence, don't use three.
Anthropic 员工拿到的是完全不同的段落(约第 404–414 行):
# Communicating with the userWhen sending user-facing text, you're writing for a person, notlogging to a console. Assume users can't see most tool calls orthinking - only your text output.When making updates, assume the person has stepped away and lostthe thread. Write so they can pick back up cold: use complete,grammatically correct sentences without unexplained jargon.Write user-facing text in flowing prose while eschewing fragments,excessive em dashes, symbols and notation.
内部提示词在沟通质量上详细得多。外部是「要简洁」。内部是技术写作大师课:倒金字塔、避免语义回溯、响应长度匹配任务复杂度。
该节带有一句扎眼的注释:// @[MODEL LAUNCH]: Remove this section when we launch numbat.「Numbat」似乎是即将推出的模型,大概沟通能力强到不再需要这些护栏。
内部用户还有数字长度锚点——仅 ant 可见的系统提示段落,要求「工具调用之间的文字不超过约 25 词,最终回复不超过约 100 词除非任务需要更多细节」。据称相比定性的「要简洁」可节省约 1.2% 输出 token。
主见与反驳的制衡
内部 Claude 被指示要反驳用户。constants/prompts.ts:224-229:
// @[MODEL LAUNCH]: capy v8 assertiveness counterweight (PR #24302)...(process.env.USER_TYPE === 'ant' ? [ `If you notice the user's request is based on a misconception, or spot a bug adjacent to what they asked about, say so. You're a collaborator, not just an executor—users benefit from your judgment, not just your compliance.`, ] : []),
外部 Claude 是执行者。内部 Claude 是会在你搞错时指出来的合作者。
虚假陈述缓解
最刺眼的 ant 专用段落是 constants/prompts.ts:237-241 的虚假陈述缓解:
// @[MODEL LAUNCH]: False-claims mitigation for Capybara v8// (29-30% FC rate vs v4's 16.7%)...(process.env.USER_TYPE === 'ant' ? [ `Report outcomes faithfully: if tests fail, say so with the relevant output; if you did not run a verification step, say that rather than implying it succeeded. Never claim "all tests pass" when output shows failures, never suppress or simplify failing checks to manufacture a green result, and never characterize incomplete or broken work as done.`, ] : []),
注释就是标题:「Capybara v8」的虚假陈述率约 29–30%,而 v4 是 16.7%。Capybara 是 Claude 某模型变体的内部代号(按 sanitizeModelName() 映射到 Opus 4.6 家族)。Anthropic 知道他们的模型近三分之一时间在编造结果,并为内部用户加了明确的反幻觉指令。
外部用户拿不到这些护栏。读者可自行解读。
注释写作与彻底性
内部用户有更严格的代码风格指令(constants/prompts.ts:204-212):
// @[MODEL LAUNCH]: Update comment writing for Capybara —// remove or soften once the model stops over-commenting...(process.env.USER_TYPE === 'ant' ? [ `Default to writing no comments. Only add one when the WHY is non-obvious.`, `Don't explain WHAT the code does, since well-named identifiers already do that.`, // @[MODEL LAUNCH]: capy v8 thoroughness counterweight `Before reporting a task complete, verify it actually works: run the test, execute the script, check the output.`, ] : []),
@[MODEL LAUNCH] 注释表明这些是针对特定模型行为的临时补丁。Capybara 过度注释、验证不足,所以他们先给内部用户加制衡,再考虑通过 A/B 对外 rollout。
内部 Bug 上报
甚至还有内部 Slack 集成(constants/prompts.ts:243-246):
...(process.env.USER_TYPE === 'ant' ? [ `If the user reports a bug with Claude Code itself, recommend /issue for model-related problems, or /share to upload the full session transcript. After /share produces a ccshare link, if you have a Slack MCP tool available, offer to post the link to #claude-code-feedback (channel ID C07VBSHV7EV).`, ] : []),
内部 Claude 可以把 bug 报告直接发到 Anthropic Slack 的 #claude-code-feedback。外部 Claude 根本不知道那个频道存在。
小结
这不只是功能开关。Anthropic 员工用的是本质上更强、更诚实、沟通更细的 Claude Code。对外版本是刻意削减的子集:性格更少、反驳更少、对失败状态更少坦诚、对沟通质量的指导更少。
@[MODEL LAUNCH] 注释暗示这种差距本应是暂时的——改进先在内部测试,再通过 A/B 对外发布。但当下,差距真实且显著。
语音模式:按住说话写代码
在 VOICE_MODE 功能开关后面,Claude Code 有一套完整的按住说话语音输入。实现跨多个文件:
services/voice.ts
— 核心录音服务 services/voiceStreamSTT.ts
— Anthropic 自研语音转文字客户端 hooks/useVoiceIntegration.tsx
— React 集成 commands/voice/
— /voice切换命令
keybindings/defaultBindings.ts:96:
...(feature('VOICE_MODE') ? { space: 'voice:pushToTalk' } : {}),
按住空格说话,松开发送。STT 是 Anthropic 自己的(voiceStreamSTT.ts:1-3):
// Anthropic voice_stream speech-to-text client for push-to-talk.// Only reachable in ant builds (gated by feature('VOICE_MODE')// in useVoice.ts import).
和 buddy 系统一样,语音模式目前是 ant-only——编译期功能开关 + 限制在内部构建。语音服务处理麦克风访问、静音检测(按住说话模式下关闭,因为用户手动控制起止),甚至还有无音频设备环境的错误处理(「语音模式需要麦克风权限……要在本地运行 Claude Code 才能使用语音模式。」)。
这让 Claude Code 从纯文本终端工具更接近免提结对编程。
协调器模式:Claude 作为多智能体编排者
最后一项大发现是协调器模式——一套完整系统,把 Claude Code 变成管理一群 worker 智能体的主管。
架构
协调器系统在 coordinator/coordinatorMode.ts 定义。激活时,Claude 的系统提示词从单人编程助手变成编排者:
// coordinator/coordinatorMode.ts:116return `You are Claude Code, an AI assistant that orchestratessoftware engineering tasks across multiple workers.## 1. Your RoleYou are a **coordinator**. Your job is to:- Help the user achieve their goal- Direct workers to research, implement and verify code changes- Synthesize results and communicate with the user- Answer questions directly when possible — don't delegate work that you can handle without tools`
协调器工具集受限:Agent(派生 worker)、SendMessage(继续 worker)、TaskStop(终止 worker)。不能直接改文件、跑 bash、读代码。所有动手活都通过 worker。
任务工作流
协调器遵循四阶段结构化流程(coordinator/coordinatorMode.ts:199-209):
- Research(调研)
:Worker(并行)——调查代码库、找文件 - Synthesis(综合)
:协调器——理解发现、写规格 - Implementation(实现)
:Worker——按规格做针对性改动 - Verification(验证)
:Worker——确认改动可用
关键是 synthesis 阶段:协调器必须理解调研结果并写出具体实现规格。明确禁止懒惰委派:
// coordinator/coordinatorMode.ts:261-267// Anti-pattern — lazy delegation (bad)Agent({ prompt: "Based on your findings, fix the auth bug" })// Good — synthesized specAgent({ prompt: "Fix the null pointer in src/auth/validate.ts:42. The user field on Session is undefined when sessions expire but the token remains cached. Add a null check before user.id access — if null, return 401 with 'Session expired'." })
并行是超能力
协调器提示词明确强调并行(coordinator/coordinatorMode.ts:213):
**Parallelism is your superpower. Workers are async. Launchindependent workers concurrently whenever possible — don'tserialize work that can run simultaneously and look foropportunities to fan out.**
并发规则:
- 只读任务
(调研)——可自由并行 - 写密集型任务
(实现)——同一批文件一次一个 - 验证
有时可与针对不同文件区域的实现并行
对抗性验证智能体
验证系统或许最有趣。constants/prompts.ts:394:
`The contract: when non-trivial implementation happens on yourturn, independent adversarial verification must happen beforeyou report completion. You own the gate.Spawn the Agent tool with subagent_type="verification". Yourown checks do NOT substitute — only the verifier assigns averdict; you cannot self-assign PARTIAL.On FAIL: fix, resume the verifier, repeat until PASS.On PASS: spot-check it — re-run 2-3 commands from its report.`
验证器刻意是对抗性的——要证明代码能用,不是橡皮图章。协调器不能自己宣布完工;只有验证器能给出 PASS。这是防止「AI 说做完了其实坏了」的巧妙办法。
Worker 间通信:草稿本
Worker 可通过草稿本目录共享知识(coordinator/coordinatorMode.ts:104-106):
if (scratchpadDir && isScratchpadGateEnabled()) { content += `\nScratchpad directory: ${scratchpadDir}Workers can read and write here without permission prompts.Use this for durable cross-worker knowledge.`}
Worker 可读写该共享目录而不触发权限提示。协调器提示词称之为「持久的跨 worker 知识」,结构按工作需求自定。
Continue 与全新派生
协调器有详细指引:何时复用现有 worker、何时派生全新 worker(coordinator/coordinatorMode.ts:283-293):
-
调研已覆盖确切文件 → Continue(有上下文) -
调研广、实现窄 → 全新派生(减少噪声) -
修正失败 → Continue(有错误上下文) -
验证他人代码 → 全新派生(新鲜眼光) -
方法完全错误 → 全新派生(干净重来)
经验法则:「想想 worker 上下文与下一任务重叠多少。重叠高 → continue。重叠低 → 全新派生。」
这一切意味着什么
Claude Code 源码泄漏揭示的产品明显领先于当前公开发布版。KAIROS、ULTRAPLAN、buddy 系统、协调器模式、语音模式、署名系统——都是完整、打磨过的功能,躲在 44 个功能开关后面。
一些更宏观的观察:
这是模式,不是偶然。 这是 Anthropic 第二次通过 npm 里的 sourcemap 把源码发出去。第一次是 2025 年 2 月。正如 Fortune 所指出的,这发生在 Anthropic 意外泄露未发布模型代号「Mythos」细节之后没几天。对自称「注重安全」的 AI 实验室来说,运维安全记录很难看。
两层体系是真实的。Anthropic 员工拿到的是本质上更好的产品:更诚实的沟通、更好的错误上报、更强的编程护栏。差距本应是暂时的(由 @[MODEL LAUNCH] 注释门控),但今天就存在——包括明确承认 Capybara v8 约 29–30% 时间在编造结果,而缓解措施只给内部用户。
AI 署名正在到来。字符级追踪系统表明 Anthropic 在为「这段代码是谁写的」这个问题准备有数据支撑的精确答案。这落在一个法律格局里:最高法院刚拒绝扩大 AI 生成物的版权保护,而公司已要求记录 AI 辅助代码。git notes 里的署名数据有朝一日可能成为合规要求,而不只是功能。
卧底模式意味着 AI 对开源的贡献已经在规模化发生。Anthropic 员工积极用 Claude Code 向公开仓库贡献,并有一套系统专门让这些贡献与人类工作难以区分。2026 年第一季度,加州《伴侣聊天机器人法》(SB 243)生效,要求聊天机器人在可能被误认为人类时披露。AI 生成代码的 PR 是否属于披露范围,是监管迟早要回答的开放问题。
反蒸馏防御是 AI 军备竞赛的新战线。 假工具注入不只是防御——它承认竞争对手在积极用 Claude 的输出训练。如果每个前沿实验室都开始为反蒸馏而「投毒」输出,下游模型训练的整个生态会变得更对抗。
智能体未来已经搭好。 协调器模式、worker 智能体、对抗验证器、跨智能体草稿本、并行执行、30 分钟远程规划会话、按住说话语音、始终在线自主运行——这不是原型。这是一套完整的智能体开发平台,等待发布。而 2026 年初两周内每个主要工具都在发多智能体,竞赛已经打响。
最大的讽刺是:Anthropic 为防泄漏建的系统,成了最大的泄漏。卧底模式能抓住提交信息里的模型代号,却抓不住 npm 包里的 sourcemap。源码出去了,秘密公开了,而 Claude Code 比任何人猜的还要有意思。
原文 “I Analyzed All 512,000 Lines of Claude Code’s Leaked Source — Here’s What Anthropic Was Hiding”作者 Vibehackers发布于 DEV Community(首发于 vibehackers.io)原文链接:https://dev.to/vibehackers/i-analyzed-all-512000-lines-of-claude-codes-leaked-source-heres-what-anthropic-was-hiding-4gg8
(相关链接)
https://dev.to/vibehackers/i-analyzed-all-512000-lines-of-claude-codes-leaked-source-heres-what-anthropic-was-hiding-4gg8
https://vibehackers.io/blog/claude-code-source-leak-deep-dive
推荐阅读:MASFactory: 多智能体工作流的入口,正在从 Graph 转向 Intent
持续获取 AI + 出海一手信息?这个群每天都在聊:
🔗 补充
夜雨聆风