Claude
Code v2.1.88
源码泄露深度解析:卧底模式、隐藏提示词与未发布功能全揭秘
2026年3月31日,Anthropic 的 Claude Code v2.1.88 源码被反编译并公开在
GitHub 上。仓库短时间内获得 1.4k Star、2.9k
Fork。本文基于源码和分析报告,梳理最值得关注的发现。
一、概况
Claude Code 是 Anthropic 官方的 AI 编程 CLI 工具。其 npm 包
@anthropic-ai/claude-code v2.1.88 仅发布了一个打包后的
cli.js(约 12MB),但有人成功从中解包出 ~1,884 个
TypeScript 源文件、约 512,664 行代码。
仓库结构: – src/ — 反编译的完整源码 –
docs/ — 5 篇中英双语深度分析报告 – stubs/ —
类型桩文件 – scripts/ — 构建工具
二、最惊人的发现:卧底模式(Undercover
Mode)
什么是卧底模式?
Anthropic 员工在公开仓库贡献代码时,Claude Code
会自动进入卧底模式,剥离所有 AI
痕迹,让提交看起来像人类写的。
触发条件
export function isUndercover(): boolean {
if (process.env.USER_TYPE === 'ant') {
if (isEnvTruthy(process.env.CLAUDE_CODE_UNDERCOVER)) return true
return getRepoClassCached() !== 'internal' // 非内部仓库自动开启
}
return false
}
- 仅对 Anthropic 员工生效(
USER_TYPE === 'ant') - 默认开启:除非明确确认是内部仓库
- 没有关闭选项:“There is NO force-OFF”
模型收到的指令
## UNDERCOVER MODE — CRITICAL
You are operating UNDERCOVER in a PUBLIC/OPEN-SOURCE repository.
NEVER include:
- Internal model codenames (Capybara, Tengu, etc.)
- Unreleased model version numbers
- Internal repo or project names
- The phrase "Claude Code" or any mention that you are an AI
- Co-Authored-By lines or any other attribution
Write commit messages as a human developer would.
争议点:在开源社区中,AI
生成的代码被刻意伪装成人类作者,这对代码透明度和信任基础提出了严肃挑战。
三、内部 vs
外部用户:提示词待遇天差地别
源码揭示了 Anthropic 员工和普通用户收到的系统提示词存在显著差异:
| 维度 | 普通用户 | 内部用户(ant) |
|---|---|---|
| 输出风格 | “Be extra concise” | “Err on the side of more explanation” |
| 假完成防护 | 无 | 专门的抗幻觉提示词 |
| 数字长度锚点 | 无 | “工具间≤25词,最终≤100词” |
| 验证代理 | 无 | 复杂变更自动启动独立验证 |
| 注释指导 | 泛泛而谈 | 详细的”默认不写注释”规则 |
| 主动纠正 | 无 | “如果用户有误解,主动指出” |
内部用户专用的抗假完成提示词
Report outcomes faithfully: if tests fail, say so; if you did not run a
verification step, say that rather than implying it succeeded. Never claim
"all tests pass" when output shows failures.
内部用户专用的代码风格指导
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.
Don't reference the current task or fix, since those belong in the PR description
and rot as the codebase evolves.
Before reporting complete, verify it actually works: run the test, execute the script.
四、26 个隐藏斜杠命令
源码中发现了 26 个不在 --help 中的隐藏命令:
| 命令 | 状态 | 功能 |
|---|---|---|
/btw |
可用 | 在不打断的情况下问旁注问题 |
/stickers |
可用 | 订购 Claude Code 贴纸 |
/thinkback |
可用 | 2025 年度回顾 |
/effort |
可用 | 设置模型努力等级 |
/voice |
隐藏 | 语音模式(已就绪但被门控) |
/researcher |
隐藏 | 研究员模式 |
/context visualizer |
隐藏 | 上下文可视化器 |
/session teleport |
隐藏 | 会话传送 |
/session sharing |
隐藏 | 会话共享 |
/adv planning |
隐藏 | 高级规划 |
/PR webhooks |
隐藏 | GitHub PR Webhook |
/auto PR fix |
隐藏 | 自动 PR 修复 |
/internal trace |
隐藏 | 内部追踪 |
/perf report |
隐藏 | 性能报告 |
/bug debug |
隐藏 | Bug 调试 |
/force snip |
隐藏 | 强制裁剪上下文 |
/mock limits |
隐藏 | 模拟限额 |
/bridge test |
隐藏 | 桥接测试 |
/backfill |
隐藏 | 回填 |
/invalidate cache |
隐藏 | 缓存失效 |
/consolidation |
隐藏 | 整合 |
/verifier setup |
隐藏 | 验证器设置 |
五、32 个编译时 Feature Flag
源码中嵌入了 32 个 Feature Flag,在编译时通过 Bun 的
feature() 内建函数控制:
| Flag | 含义 | 状态 |
|---|---|---|
persistent assistant |
持久化助手 | 编译门控 |
bg sleeping agents |
后台休眠代理 | 编译门控 |
multi-agent |
多代理协作 | 编译门控 |
remote control |
远程控制 | 编译门控 |
session supervisor |
会话监督 | 编译门控 |
background sessions |
后台会话 | 编译门控 |
30-min planning |
30分钟规划 | 编译门控 |
AI companion pet |
AI 宠物伙伴 | 编译门控 |
workflow auto |
工作流自动化 | 编译门控 |
voice |
语音模式 | 编译门控 |
computer use |
计算机操控 | 对 Max/Pro 开放 |
Unix socket IPC |
Unix Socket 通信 | 编译门控 |
agent forking |
代理分叉 | 编译门控 |
research mode |
研究模式 | 编译门控 |
self-hosted |
自托管 | 编译门控 |
memory analytics |
记忆分析 | 编译门控 |
六、遥测系统:收集了什么?
Claude Code 建立了双层分析管道:
- 第一方(→
Anthropic):环境指纹、进程指标、每个事件携带会话/用户 ID - Datadog:额外的遥测接收器
关键发现: –
没有用户可见的退出开关(1P 日志不可关闭) –
OTEL_LOG_TOOL_DETAILS=1 可启用完整工具输入捕获 –
每个事件都携带仓库哈希、环境指纹
七、远程控制与紧急开关
Claude Code 每小时轮询
/api/claude_code/settings,Anthropic
可以远程控制客户端行为:
- 危险变更弹出阻塞对话框 — 用户拒绝 = 程序退出
- 6+ 紧急开关:绕过权限、快速模式、语音模式、分析
sink 等 - GrowthBook 特性门控可无用户同意改变行为
GrowthBook
门控(tengu_* 命名空间)
| 门控 | 功能 |
|---|---|
tengu_frond_boric |
分析开关 |
tengu_amber_quartz_disabled |
语音模式开关 |
tengu_amber_flint |
代理团队 |
tengu_hive_evidence |
验证代理 |
tengu_onyx_plover |
自动梦境(后台记忆整合) |
八、模型代号体系
Anthropic 使用动物名称作为内部模型代号:
| 代号 | 对应 | 备注 |
|---|---|---|
| Capybara | Sonnet 系列,当前 v8 | 有 29-30% false-claim 率 |
| Tengu | 产品/遥测前缀 | 250+ 事件用 tengu_* |
| Fennec | Opus 4.6 的前身 | fennec-latest → opus |
| Numbat | 下一代模型(开发中) | “Remove when we launch numbat” |
| Chicago | Computer Use | 内部代号 |
九、未来路线图
源码中埋藏了多个未发布功能的代码:
- KAIROS — 完全自主代理模式,带心跳
<tick>、推送通知、PR 订阅 - 语音模式 — Push-to-talk,已就绪但被 GrowthBook
门控 - 17 个未发布工具 —
SleepTool、MonitorTool、WebBrowserTool、WorkflowTool
等 - Opus 4.7 / Sonnet 4.8 —
下一代模型已在代码中引用 - 108 个缺失模块 — 被
feature()编译时
DCE 移除,仅存在于 Anthropic 内部
十、普通人可以借鉴的提示词技巧
1. 让 Claude
更充分解释(抄内部用户的配置)
Err on the side of more explanation. Write for a person who stepped away
and lost the thread. Use complete, grammatically correct sentences.
2. 防止假完成(防止 Claude
编造测试结果)
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.
3. 克制写代码
Don't add features, refactor code, or make improvements beyond what was asked.
Default to writing no comments. Only add one when the WHY is non-obvious.
4. 行动前确认
For actions that are hard to reverse or affect shared systems,
check with the user before proceeding. A user approving once does NOT
mean they approve in all contexts.
参考资料
- GitHub
仓库:https://github.com/sanbuphy/claude-code-source-code - CCLeaks 整理:https://www.ccleaks.com/
- 源码下载(t.co):https://t.co/jBiMoOzt8G
本文基于公开的反编译源码和分析报告撰写,仅供技术研究参考。所有源码版权归
Anthropic 和 Claude 所有。











