Anthropic发布Claude Code云端会话功能与使用指南
Claude Code in the cloud: a field guide to cloud sessions
Claude Code推出云端模式解决了本地算力与环境冲突痛点,支持多任务并行且无需额外付费,对重度开发者极具实用价值,建议关注并试用。
What changes when Claude Code runs on its own machine, the workflows where that pays off, and how to connect GitHub on the first try.
当 Claude Code 在独立机器上运行时,哪些环节会发生变化,哪些工作流能从中受益,以及如何一次性成功连接 GitHub。
- Author: Addy Osmani (Member of Technical Staff) - Published: 2026-10-06 - URL: <https://claude.dev/blog/claude-code-in-the-cloud/>
- 作者:Addy Osmani(技术团队成员) - 发布日期:2026-10-06 - URL:<https://claude.dev/blog/claude-code-in-the-cloud/>
You probably run Claude Code in a terminal on your own laptop. That session depends on the laptop in three ways:
你可能在自己的笔记本电脑终端中运行 Claude Code。该会话通过以下三种方式依赖于你的笔记本电脑:
- It shares your working tree, so two sessions on one repository can edit the same files and fight over the same port. - It runs with your credentials. - It stops when your computer sleeps or the Wi-Fi drops.
- - 它共享你的工作树,因此同一仓库上的两个会话可能会编辑相同的文件并争夺同一个端口。 - 它使用你的凭据运行。 - 当你的电脑进入睡眠状态或 Wi-Fi 断开时,它会停止运行。
A cloud session runs Claude Code on a machine of its own. Each task gets a fresh virtual machine with your repository cloned onto a new branch and your environment's setup already done.
云会话是在其自己的机器上运行 Claude Code。每个任务都会获得一台全新的虚拟机,其中已克隆你的仓库到新分支,并且已完成你环境的设置。
You can start one from claude.ai/code, the Claude mobile app, the Desktop app, your terminal, and Slack. You can then follow it from the browser, the mobile app, and Desktop. When the work is done, it sits on a branch you can turn into a pull request.
你可以从 claude.ai/code、Claude 移动应用、桌面应用、你的终端以及 Slack 启动一个云会话。然后,你可以在浏览器、移动应用和桌面应用中跟踪它的进度。工作完成后,它会停留在一个分支上,你可以将其转换为拉取请求(pull request)。
Cloud sessions come with your Pro, Max, Team, or Enterprise plan at no additional cost: there's no separate charge for the cloud machine, and sessions draw on the same usage limits as the rest of Claude Code. Depending on your plan, an organization owner may need to turn on cloud sessions first.
云会话包含在你的 Pro、Max、Team 或 Enterprise 计划中,无需额外费用:云机器没有单独收费,且会话消耗的额度与 Claude Code 其余部分的使用限制相同。根据你的计划,组织所有者可能需要先开启云会话功能。
Bonus credit for cloud sessions. Existing individual Pro and Max subscribers can claim a one-time bonus credit for cloud sessions, on top of their plan limits: $100 on Pro and $250 on Max. Claim it by October 7 at claude.ai/code/claim-credit or with `/claim-credit` in Claude Code. The credit expires on November 4. After it's used or expires, your plan's regular usage applies. It isn't eligible for Projects or Routines. See the Promotional Credit Offer Terms.
云会话的额外积分奖励。现有的个人 Pro 和 Max 订阅者可以领取一次性的云会话积分奖励,叠加在其计划限额之上:Pro 计划赠送 $100,Max 计划赠送 $250。请在 10 月 7 日之前通过访问 claude.ai/code/claim-credit 或在 Claude Code 中输入 `/claim-credit` 来领取。积分将于 11 月 4 日过期。一旦用完或过期,将恢复适用你计划的常规使用额度。该积分不适用于 Projects 或 Routines。请参阅促销积分优惠条款。
For this guide I ran four real cloud sessions against a small sample repository. Their transcripts, diffs, and timings appear throughout. The repository and the user in the screenshots are made up. The work, the output, and the numbers come from those sessions.
在本指南中,我针对一个小型示例仓库运行了四个真实的云会话。它们的转录记录、差异对比和时间统计贯穿全文。截图中的仓库和用户均为虚构。工作内容、输出结果和数据均源自这些会话。
One of the main advantages of cloud sessions is that you can run several tasks at once without them getting in each other's way. Here are three I started within 16 seconds of each other, each on its own machine. On my laptop, I'd have run these one after another, or spent my time keeping them out of each other's way.
云会话的主要优势之一是你可以在不互相干扰的情况下同时运行多个任务。以下是我在 16 秒内依次启动的三个任务,每个任务都在各自的机器上运行。在我的笔记本电脑上,我会按顺序逐个运行它们,或者花费时间来避免它们互相干扰。
Video: The real timeline of three cloud sessions on one repository, in seconds from the first start. Hatched bars are the setup step that recreated the sample repository (a GitHub clone replaces it in normal use), and each dot is one tool call. — Timeline of three cloud sessions in three VMs, started within 16 seconds of each other. After a hatched setup bar, the flaky-test fix finishes at 65 seconds with the suite run 40 times and 0 failures, the docs rewrite at 62 seconds with 5 doc errors fixed, and the structured-logging change at 87 seconds with JSON logs and 5 new tests.
视频:一个仓库中三个云会话的真实时间线,以从首次启动开始计算的秒数显示。斜线填充的条形图代表重建示例仓库的设置步骤(在正常使用中,GitHub 克隆会替代它),每个点代表一次工具调用。——三个虚拟机中的三个云会话时间线,彼此间隔在 16 秒内启动。在斜线填充的设置步骤之后,flaky-test 修复在 65 秒时完成,套件运行了 40 次且无失败;文档重写在 62 秒时完成,修复了 5 个文档错误;结构化日志更改在 87 秒时完成,包含 JSON 日志和 5 个新测试。
Three tasks, one repository, three machines
三个任务,一个仓库,三台机器
The sample repository is tidepool, a small Node API that predicts tides for three fictional harbors. It had three ordinary problems: one test failed about one run in four, the API docs described parameters the code no longer read, and the logger built its lines by concatenating strings.
示例仓库是 tidepool,一个小型 Node API,用于预测三个虚构港口的潮汐。它存在三个常见问题:一个测试大约四分之一的运行次数会失败;API 文档描述的参数代码已不再读取;日志记录器通过拼接字符串来构建其行。
I started three cloud sessions within 16 seconds of each other, one per problem. I started them programmatically, and because tidepool isn't on GitHub, each session first recreated the repository from files in its prompt. With a real repository you'd skip that step, and from a terminal each session is one `claude --cloud` command. Shortened, the three prompts were:
我在彼此间隔 16 秒内启动了三个云会话,每个问题对应一个。我以编程方式启动它们,由于 tidepool 不在 GitHub 上,每个会话首先从其提示中的文件重建仓库。对于真实仓库,你可以跳过该步骤,而在终端中,每个会话只需一条 `claude --cloud` 命令。简化后的三个提示如下:
claude --cloud "npm test fails maybe one run in four. Find the flaky test, fix the root cause in the code (not the test), and prove it by running the suite at least 30 times in a row."
claude --cloud "docs/API.md is out of date with src/server.js. Rewrite it so every endpoint, parameter, default and response shape matches the code. Start the server and run each curl example to check it."
claude --cloud "Make src/logger.js emit one JSON object per line, keep LOG_LEVEL, and log method, path, status and duration_ms as fields. Add a test for the logger."The sessions ran for 61, 65 and 72 seconds, and all three were done 87 seconds after the first one started. Recreating the repository took roughly a third to just over half of each run. Here are the results.
这三个会话分别运行了 61、65 和 72 秒,且在第一个会话启动后 87 秒全部完成。重建仓库耗时约占每次运行的三分之一到略超过一半。以下是结果。
- The flaky test. Claude found a race in `TtlCache.get`. The cache stored a value only after the loader finished, so a second `get` for the same key during a load called the loader again. Claude changed the cache to store the in-flight promise, dropped the entry when a load fails, and ran `npm test` 40 times in a row with zero failures. - The docs. Claude started the server, ran a curl against every endpoint, and found five ways the old doc was wrong. It listed fields the API never returns, documented a `days` parameter the code ignores, gave heights in feet when they are metres, skipped the `/next-high` endpoint, and left out the error responses. It also found that a malformed `from=` value returns an empty list with a 200, and documented that as a caveat instead of changing server code it wasn't asked to touch. - The logger. Claude wrote the JSON logger, moved the request log to structured fields, and added five tests. Its commit went in with one failing test, so Claude reran the cache test eight times, saw it fail in five of them, and traced the failure to the same race the first session was fixing. It proposed the same fix, left the cache alone because that was outside its task, and said in its summary that the suite wasn't clean.
- 不稳定的测试。Claude 在 `TtlCache.get` 中发现了一个竞态条件。该缓存仅在加载器完成后才存储值,因此在加载期间对同一键的第二次 `get` 调用会再次触发加载器。Claude 将缓存修改为存储正在进行的 promise,在加载失败时丢弃条目,并连续运行了 40 次 `npm test`,零失败。 - 文档。Claude 启动了服务器,对每个端点执行 curl 请求,发现旧文档有五种错误方式。它列出了 API 从未返回的字段,记录了代码忽略的 `days` 参数,以英尺为单位给出高度(实际应为米),跳过了 `/next-high` 端点,并且遗漏了错误响应。它还发现格式错误的 `from=` 值会返回一个状态码为 200 的空列表,并将其记录为一个注意事项,而不是去修改它未被要求触及的服务端代码。 - 日志记录器。Claude 编写了 JSON 日志记录器,将请求日志移至结构化字段,并添加了五个测试。它的提交包含一个失败的测试,因此 Claude 重新运行了缓存测试八次,看到其中五次失败,并将失败追踪到第一个会话正在修复的同一个竞态条件。它提出了相同的修复方案,但保留了缓存不动,因为这超出了它的任务范围,并在其总结中指出测试套件并不干净。
*The three sessions in the claude.ai/code interface, running locally and replaying their real transcripts. Setup steps are trimmed, paths show under /home/user, the bottom three sidebar titles are filler, and the mode chip shows the default.*
*claude.ai/code 界面中的三个会话,本地运行并回放其真实转录内容。设置步骤已裁剪,路径显示在 /home/user 下,底部三个侧边栏标题是填充内容,模式芯片显示默认值。*
*The Fix the flaky test session*
*修复不稳定测试会话*
*The Update the tidepool API docs session*
*更新 tidepool API 文档会话*
Video: A 20-second recording of the same local build: clicking between the three sessions, then scrolling the logger session's transcript — Clicking between the three sessions in the sidebar, then scrolling the logger session's transcript.
视频:同一本地构建的 20 秒录制:在三个会话之间点击,然后滚动日志记录器会话的转录内容 —— 在侧边栏中在三个会话之间点击,然后滚动日志记录器会话的转录内容。
The logger result shows why cloud sessions suit parallel work. Each session had its own copy of the repository, its own processes and its own branch. The docs session and the logger session each started the API server to test against it, and neither affected the other. On a single laptop, two agents working in one checkout would edit the same files, and would collide on a port unless each picked its own.
日志记录器的结果展示了为什么云会话适合并行工作。每个会话都有自己独立的仓库副本、进程和分支。文档会话和日志记录器会话各自启动 API 服务器以进行测试,且互不影响。在单台笔记本电脑上,两个代理在一个检出目录中工作会编辑相同的文件,除非各自选择自己的端口,否则会在端口上发生冲突。
Because of that isolation, the logger session had no access to the cache fix the first session was making. Split parallel tasks along file boundaries, merge the branches in a sensible order, and expect a session to report problems that another session is already fixing.
由于这种隔离性,日志记录器会话无法访问第一个会话正在进行的缓存修复。沿文件边界拆分并行任务,以合理的顺序合并分支,并预期一个会话报告的问题可能是另一个会话已经在修复的。
Under the hood of a Claude Code cloud session
Claude Code 云会话的内部机制
A cloud session is a Claude Code session running on Anthropic-managed infrastructure, or on your organization's own machines with a self-hosted environment. The figure shows the parts. The four takeaways after it are the ones that change how you work.
云会话是指在 Anthropic 管理的基础设施上,或在拥有自托管环境的组织自有机器上运行的 Claude Code 会话。该图展示了其组成部分。随后的四点要点是那些会改变你工作方式的内容。
*Anatomy of a cloud session. Everything the agent can touch sits inside the VM. Your GitHub token and the network policy sit outside it.*
*云会话的解剖结构。智能体所能触及的一切均位于虚拟机内部。你的 GitHub 令牌和网络策略则位于其外部。*
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力