黄奕彬

外部精选

Claude Code in the cloud: a field guide to cloud sessions

本文来自外部来源,不是黄奕彬的原创文章。本站提供原文入口,并在采集端生成 AI 结构化摘要、解读与中文翻译(如有),一切以原文为准。

阅读原文(claude.dev)
来源
claude.dev Blog ↗
作者 / 署名
Addy Osmani、Addy Osmani
发布日期
本站收录时间
原文域名
claude.dev

以上时间均为北京时间;来源更新时间由来源提供,不代表首次发布时间。

结构化摘要 AI 生成

背景与问题

面向在本地终端使用 Claude Code 的开发者。本地会话依赖笔记本:共享同一工作树导致多会话互相改文件、争端口;以用户本人凭据运行;电脑休眠或断网即中断。文章要回答的问题是:云会话(cloud sessions)是什么、底层如何运作、何时选云而非本地,以及具体的启动、协作、环境配置与排障方法。

方法或内容

实操指南。作者在虚构示例仓库 tidepool(预测三个虚构港口潮汐的 Node API)上真实运行 4 个云会话,公开其转写、diff 与计时;其中三个在 16 秒内并行启动,分别修复 flaky 测试、重写过期 API 文档、把日志改为结构化 JSON。

随后讲解云会话架构(每任务独立 VM、GitHub token 代理、仓库配置随行、闲置回收)、本地/云对比表、七类适用工作流(并行清积压、自证修复、计划-云端构建-终端收尾、手机查看、CI 失败与评论自动修、routines 定时触发、运行不完全信任的代码)、GitHub 连接三条路径与排障表、环境配置建议、使用习惯清单与常见问答。

关键发现 / 结果

三个会话各运行 61/65/72 秒,首个启动后 87 秒全部完成;因 tidepool 不在 GitHub,重建仓库占每次运行约三分之一到一半(真实仓库会跳过此步)。

flaky 测试根因为 TtlCache.get 竞态:值仅在 loader 完成后写入,加载期间对同一 key 的第二次 get 会再次调用 loader;改为存 in-flight promise、失败时删除条目后,连续 40 次运行 npm test 零失败。

文档会话启动服务器逐个 curl,发现旧文档五处错误(列出 API 从不返回的字段、被代码忽略的 days 参数、高度单位英尺应为米、漏掉 /next-high 端点与错误响应),并将 from= 非法值返回空列表 200 记为注意事项。

日志会话写出 JSON logger 与 5 个测试,但其提交带一个失败测试,重跑缓存测试 8 次失败 5 次,定位到与会话一相同的竞态,仅提议同样修复并在总结中说明套件不干净。第四个手机提问会话发现真实 bug:循环从不检查首尾样本,窗口起点的高潮汐被漏掉。

定价:Pro/Max/Team/Enterprise 无额外计算费、共用计划额度;一次性奖励额度 Pro $100、Max $250,10 月 7 日前领取、11 月 4 日过期,不适用于 Projects 或 Routines。

结论与意义

云会话不取代本地会话,多数人两者并用。适合:并行独立小任务、需反复运行验证的修复、离开键盘仍要继续的长任务、运行不完全信任的代码。本地仍适合:需要真本地数据、VPN 内服务、GPU、手机模拟器或桌面硬件的任务,秒级可视反馈回路,以及启用 Zero Data Retention 的组织(云会话被关闭)。

边界:各会话互相不知情,需按文件边界拆分任务、按合理顺序合并,并预期会话报告另一会话正在修的问题;并行会话约按倍数消耗计划额度;用户级 ~/.claude 不上传,团队所需配置须放进仓库。

AI 解读 AI 生成

方法:按「时空变量」分析(时间 / 空间 / 变量,严格区分包含、相关与因果),对象包括原文作者、署名人员与关键技术及其实际原理;结论用「元反空」(元思考、反思考、空思考、综合)整理。

时间:何时发生,现在是否仍成立

来源日期 2026-10-06,内容描述该日的产品状态。

多条强时效信息:一次性奖励额度须在 10 月 7 日前领取、11 月 4 日过期;projects 为 Pro/Max 公测、self-hosted environments 为 Team/Enterprise beta、routines 为 research preview——这些标签与功能形态最可能随后续迭代变化。

定价(无单独计算费、共享额度)、VM 规格(约 4 vCPU/16GB/30GB)、命令超时默认值(前台默认 2 分钟、最多 10 分钟,后台再加最多 30 分钟)、缓存约 7 天重建等截至发文有效;之后是否仍成立原文未说明,应以当期官方文档核对。

空间:谁的环境 / 场景

适用于 Claude Code 的云会话,入口为 claude.ai/code、Claude 手机 app、Desktop、终端(claude --cloud 命令)与 Slack;需 Pro、Max、Team 或 Enterprise(premium seat 或 Chat + Claude Code seat)并以 claude.ai 账号登录;Console API key 与第三方 provider 不可用。

私有 GitHub 仓库需安装 Claude GitHub App 或经 /web-setup 提供 gh token;Team/Enterprise 需组织所有者先开启云会话及 GitHub 连接器。

非 GitHub 仓库(GitLab/Bitbucket)可上传 bundle 但无法推回;GitHub Enterprise Server 仅 Team/Enterprise 支持。示例场景为 JavaScript/Node 仓库。

变量:实际改变了什么

相对本地会话的实际差异:每任务独立 VM+新分支,取代共享工作树;笔记本休眠/断网时会话继续;产出为分支(可转 PR)而非本地工作树改动;云上审批模式仅 Auto、Accept edits 或 Plan(本地可为任意模式含逐命令);可达范围限于仓库、所设网络级别、已启用连接器及会话级 GitHub 凭据(本地可达 SSH 密钥、云 CLI、~/.claude);云会话无单独计算费用。

一次性促销变更:Pro $100 / Max $250 奖励额度。哪些功能相对更早版本属新增,原文未说明(本文是使用指南而非变更公告)。

区分:包含 ≠ 相关 ≠ 因果

包含:云会话包含于 Pro/Max/Team/Enterprise 计划;CLAUDE.md、rules、skills、agents、commands 属于仓库配置、随仓库上传;个人 ~/.claude 不包含、留在本地。

相关:文档会话与日志会话都各自启动了 API 服务器且互不影响——文中将其归因于各自拥有独立 VM、分支与进程(有机制描述支撑的因果主张)。

有明确因果证据:TtlCache 竞态机制(值仅在 loader 完成后写入导致重复调用)→ 修复 → 40 次零失败复验;日志会话的失败测试经 8 次重跑 5 次失败回溯到同一竞态。

不确定:并行三任务的绝对耗时数据——仓库重建占约 1/3 至 1/2,真实 GitHub 场景跳过此步,故不能外推为一般耗时(原文已自行说明)。

对象:作者/署名与关键技术原理

作者/署名(仅据结构化作者字段):Addy Osmani(字段中该名重复出现两次)。

关键技术按原文描述:云会话即运行在 Anthropic 托管基础设施或组织自托管机器上的 Claude Code 会话;每任务分配新 VM,仓库克隆到新分支,环境已完成配置;GitHub token 不进入 VM,由代理持有,会话仅获得可推送到自己工作分支的短时凭据;环境经 setup script 构建(以 root 在 Claude Code 启动前运行、须 exit 0、约 5 分钟内完成以进入快照缓存,约 7 天或脚本/允许主机变更时重建,进程不随缓存存活);网络分级 None/Trusted/Custom/Full,全部出站流量经记录主机名的代理,即便设为 None 仍向 Anthropic API 发送请求、仍可推自己的分支;claude --teleport 校验同仓库后将云端分支检出并把完整对话载入本地终端;routines 由计划触发(最细每小时)、HTTP 调用或 GitHub 事件触发,免审批提示、默认推 claude/- 前缀分支;Claude GitHub App 支撑 Auto-fix、GitHub 触发与 projects。

元反空综合结论

元:文章本质在回答"什么时候该把 Claude Code 任务放到云上、怎么跑才不踩坑"——把本地会话三个痛点(争文件/端口、凭据暴露、随机器中断)与云会话的隔离机制逐一对应,并以真实会话证据示范。

反:最可能失效或有边界的部分——奖励额度有硬截止日;projects(公测)、self-hosted(beta)、routines(research preview)的行为细节、UI 路径、各类限额数字(200 线程/天、超时默认、VM 规格、缓存 7 天、每小时触发上限)均随产品迭代易变;耗时数据来自单个非 GitHub 的虚构小仓库且含仓库重建开销,不具外推性;并行会话额度约按会话数放大是主要成本边界。

空:去掉宣传叙事后剩下的必要事实——每任务独立 VM 与分支实现文件/端口隔离;GitHub token 经代理隔离、会话凭据仅限自身分支;无单独计算费但计入计划额度;云上无逐命令审批;私有仓库依赖 GitHub App;会话彼此不知情、需人工按序合并;用户级工具链不上传、团队配置须进仓库;Zero Data Retention 下云会话不可用。

综合:这是一份证据(转写/diff/计时)可复核、实操性强的采用指南;其结构性判断(隔离带来并行安全、凭据不入 VM 降低风险、可自我验证的环境是价值来源)有机制与实验支撑,但所有数字、促销与 beta 功能应以当期官方文档为准,且不应据本文示例耗时推断真实仓库上的表现。

中文译文 AI 生成

你很可能是在自己笔记本电脑的终端里运行 Claude Code。这种会话在三个方面依赖于这台笔记本电脑:它共享你的工作树(working tree),因此在同一仓库上运行的两个会话可能会编辑相同的文件,并争抢同一个端口。它以你的凭据运行。当你的电脑休眠或 Wi-Fi 断开时,它就会停止。

云端会话(cloud session)在专属的机器上运行 Claude Code。每个任务都会获得一台全新的虚拟机,你的仓库会被克隆到一个新分支上,且环境设置已经完成。

你可以从 claude.ai/code、Claude 移动应用、Desktop 应用、你的终端以及 Slack 启动云端会话。之后你可以在浏览器、移动应用和 Desktop 中跟进它。工作完成后,成果位于一个分支上,你可以将其转成 pull request。

云端会话随你的 Pro、Max、Team 或 Enterprise 套餐提供,无需额外费用:云机器不单独收费,会话与 Claude Code 其余部分共用相同的使用限额。视你的套餐而定,可能需要组织所有者先开启云端会话。

云端会话的额外赠送额度。现有的个人 Pro 和 Max 订阅者可以在套餐限额之外领取一次性的云端会话赠送额度:Pro 为 $100,Max 为 $250。请在 10 月 7 日前通过 claude.ai/code/claim-credit 或在 Claude Code 中使用 /claim-credit 领取。

该额度于 11 月 4 日过期。额度用完或过期后,将适用你套餐的常规用量。它不能用于 Projects 或 Routines。参见 Promotional Credit Offer Terms。

为了撰写本指南,我针对一个小型示例仓库运行了四个真实的云端会话。它们的记录(transcript)、diff 和耗时数据贯穿全文出现。截图中的仓库和用户是虚构的。工作内容、输出和数字均来自这些会话。

云端会话的主要优势之一是你能够同时运行多个任务,且它们不会互相干扰。下面是我在 16 秒内先后启动的三个任务,每个任务都在各自的机器上运行。在我自己的笔记本电脑上,我只能一个接一个地运行这些任务,或者花时间防止它们互相干扰。

FIG A 同一仓库上三个云端会话的真实时间线,以秒为单位,从第一个会话启动算起。斜纹条是重建示例仓库的设置步骤(正常使用中该步骤由 GitHub clone 取代),每个点代表一次工具调用。

三个任务、一个仓库、三台机器

示例仓库是 tidepool,一个小型 Node API,为三个虚构的港口预测潮汐。它有三个常见问题:一个测试大约每运行四次就失败一次,API 文档描述了代码已不再读取的参数,而 logger 通过拼接字符串来构建日志行。

我在 16 秒内先后启动了三个云端会话,每个问题对应一个。我以编程方式启动它们,并且由于 tidepool 不在 GitHub 上,每个会话先根据其 prompt 中的文件重建了仓库。使用真实仓库时你会跳过这一步,而在终端中,每个会话只需一条 claude --cloud 命令。精简后的三个 prompt 如下:

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."

这些会话分别运行了 61、65 和 72 秒,三个会话全部在第一个启动后 87 秒内完成。重建仓库大约占每次运行时间的三分之一到刚过一半。以下是结果。

不稳定的测试。Claude 在 TtlCache.get 中发现了一个竞态。缓存只在 loader 完成后才存储值,因此在一次加载期间对同一 key 的第二次 get 会再次调用 loader。

Claude 将缓存改为存储进行中的 promise(in-flight promise),在加载失败时删除该条目,并连续运行 npm test 40 次,零失败。

文档。Claude 启动了服务器,对每个 endpoint 都运行了 curl,发现旧文档有五处错误。它列出了 API 从不返回的字段,记录了代码会忽略的 days 参数,在高度实际以米为单位时给出了英尺数值,遗漏了 /next-high endpoint,并且没有涵盖错误响应。

它还发现格式错误的 from= 值会返回带 200 状态码的空列表,并将其作为注意事项记录下来,而没有去修改未被要求改动的服务器代码。

logger。Claude 编写了 JSON logger,将请求日志改为结构化字段,并添加了五个测试。它的提交带着一个失败的测试入库,于是 Claude 重新运行了缓存测试八次,其中五次失败,并将失败原因追溯到第一个会话正在修复的同一个竞态。

它提出了相同的修复方案,但因为那超出了它的任务范围而没有动缓存,并在其总结中说明测试套件并未全部通过。

FIG E 同一本地构建的 20 秒录屏:在三个会话之间点击切换,然后滚动查看 logger 会话的记录

logger 的结果说明了为什么云端会话适合并行工作。每个会话都有自己的一份仓库副本、自己的进程和自己的分支。docs 会话和 logger 会话各自启动了 API 服务器来进行测试,二者互不影响。

在单台笔记本电脑上,在同一个 checkout 中工作的两个 agent 会编辑相同的文件,除非各自选用不同的端口,否则会在端口上发生冲突。

正因为这种隔离,logger 会话无法获取第一个会话正在进行的缓存修复。沿着文件边界拆分并行任务,以合理的顺序合并分支,并预期某个会话会报告另一个会话已在修复的问题。

CLAUDE CODE 云端会话的内部机制

云端会话是在 Anthropic 托管的基础设施上运行的 Claude Code 会话,或通过自托管环境运行在你所在组织自己的机器上的会话。图中展示了各个组成部分。图后的四个要点正是会改变你工作方式的内容。

图 F 云端会话的剖析。智能体能接触到的一切都位于 VM 之内。你的 GitHub token 和网络策略位于其外。

每个任务都有自己专属的机器。一台全新的 VM,你的仓库会被克隆到一个新分支上,因此各会话之间无法触碰彼此的文件或端口。请参阅“已安装内容”。

你的 GitHub token 永远不会进入 VM。一个代理持有它,会话获得的是一个短时效凭证,只能推送到它自己的工作分支。请参阅“GitHub 代理”。

仓库的 Claude 配置会随行,你个人的配置则不会。CLAUDE.md、rules、skills、agents 和 commands 随仓库一起带过去,而你的 ~/.claude 仍留在你的笔记本上。请参阅“云端会话中的设置”。

闲置的 VM 会被回收。重新打开会话时你会得到一台全新的 VM,对话会被恢复,所以请及时 commit 你在意的成果。请参阅“环境过期”。

关于 specs、权限模式和网络级别,请参阅云端环境文档。

本地还是云端?

云端会话并不取代本地会话,大多数人两者并用。表格展示了它们的差异,表格之后的段落说明了各自适用的时机。

本地会话 | 云端会话运行于 | 你的机器 | 每个任务一台全新的 VM笔记本休眠或离线时 | 会话停止 | 会话继续运行在同一仓库上处理多个任务 | 各自独立的 worktree 和端口,并需小心维护 | 每个任务一个 VM、一个分支智能体能接触的范围 | 你的用户账号能接触的一切,包括 SSH 密钥、云 CLI 和 ~/.claude | 仓库、你设定的网络级别、你启用的 connectors,以及一个会话级的 GitHub 凭证发起或跟进 | 那台机器,或通过 Remote control 用你的手机 | 浏览器、手机、Desktop、终端、Slack、一次 API 调用或一个定时计划审批 | 任意模式,包括逐条命令审批 | Auto、Accept edits 或 Plan结束时 | 你工作树中的变更 | 一个分支,以及需要时的 pull request计算资源 | 你的机器 | 无单独的计算费用;使用你套餐的限额

当任务需要只有你的机器才具备的东西时,请留在本地。这包括装有真实本地数据的数据库、需通过 VPN 访问的服务、GPU、手机模拟器,或你桌上的硬件。

当你需要紧凑的视觉循环——想在几秒内于自己的浏览器中看到每一处改动时,也请留在本地;当你的组织以 Zero Data Retention 方式运行时——这会关闭云端会话——同样请留在本地。

有两个功能介于两者之间。Remote control 让会话留在你的机器上,同时让你从手机或浏览器操控它。Self-hosted environments 目前对 Team 和 Enterprise 处于 beta 阶段,它在你所在组织自己的基础设施上运行云端会话,因此可以访问私有网络。

如果以上情况都不适用,这个任务就很适合放到云端。下一节介绍那些最能体现云端价值的工作流。

七个适合云端会话的工作流

这些工作流把表格中的差异用到实处:每个任务一台独立机器、你不在时仍持续运行的会话,以及最后留待你审查的一个分支。

  1. 并行清理积压任务

假设你有五个互不相关的小修复。在本地,你要么一个接一个地做,要么设置五个 worktree,并把它们的端口和安装环境分开。在云端,你只需启动五个会话,然后审查五个分支。

Shell claude --cloud "Fix the flaky test in auth.spec.ts" claude --cloud "Update the API documentation" claude --cloud "Refactor the logger to use structured output"

claude --cloud 会克隆你的 GitHub 远端仓库到你当前所在的分支,所以请先把本地提交 push 上去。在 VM 启动期间,CLI 会实时显示一个包含各设置步骤的清单,并把你输入的任何内容排入队列。

把每个任务写成一份自成一体的工单,说明哪里出了问题、“完成”是什么样子,以及如何验证。那个不稳定测试的提示词写明了它的验证方式:连续运行测试套件至少 30 次。该会话实际运行了 40 次。

当这些任务同属一项更大的工作时,project(对 Pro 和 Max 处于公开 beta)会运行一个协调者对话,为你启动并跟踪这些云端会话,然后按状态将它们分组:进行中、等待你处理、可供审查。

  1. 让它证明修复有效

不稳定测试是最典型的需要反复验证的工作:你必须一遍又一遍地运行测试套件,而你不会希望这个循环占用你正在使用的机器。在云端,Claude 修补了缓存,并用一条命令把整个套件运行了 40 次。

图 G 运行 40 次,零失败:这是不稳定测试会话的真实命令与输出,在本地运行的 claude.ai/code 界面中回放。Claude 修补了 src/cache.js,并在一步中把完整套件循环运行了 40 次。路径显示在 /home/user 之下。

这个 VM 不收计算费用,占用的也不是你的 CPU,所以尽管要求彻底的验证。运行套件 200 次、在 50 个提交之间 bisect 一个回归、运行较慢的集成层,或者像那个文档会话所做的那样启动应用并用 curl 访问它。

Claude 的每一轮仍会计入你的套餐,但在一条命令内进行的长测试运行消耗很少。前台命令默认在 2 分钟后超时(至多 10 分钟),超时后会在后台继续运行至多再 30 分钟。你可以在环境变量中通过 BASH_DEFAULT_TIMEOUT_MS 和 BASH_MAX_TIMEOUT_MS 调高这些默认值。

  1. 在桌前规划,在云端构建,在终端收尾

对于较大的改动,先在来回沟通成本低的地方就方案达成一致。以 plan 模式启动 Claude,一起敲定计划,将计划 commit 并 push。

Shell claude --permission-mode plan # ...agree on the plan, save it to docs/migration-plan.md, commit and push... claude --cloud "Execute the migration plan in docs/migration-plan.md"

当云端会话进行构建时,你的终端可以腾出来做其他工作。完成后,把该会话拉到本地,手动收尾。

Shell claude --teleport # pick a cloud session

claude --teleport <session-id>

Teleport 会检查你是否在同一个仓库中,获取该会话的分支,将其检出,并把整个对话加载到你的终端里。你需要一个干净的工作树(它会提议执行 stash),而且该分支必须已被推送。在 Claude Code 内部,/teleport(或 /tp)会打开同样的选择器,而且 /tasks 之后按 t 也可以。

Desktop 应用则走的是反方向,它的 Open in 菜单可以把本地会话发送到云端。

  1. 从手机上跟进

Claude 应用中的 Code 标签页连接到相同的会话。在手机上,你可以启动一个任务、跟踪它、引导它、回答 Claude 提出的问题,或者让 Claude 监视一个 pull request。

手机适合那些等你走到键盘前就会忘掉的问题。我给第四个会话提了一个你会在手机上输入的那类问题:tidepool 是如何预测潮汐的?在时间窗口的边缘它可能怎样出错?它运行代码来验证自己的答案,并发现了一个真实的 bug。那个循环从不检查第一个或最后一个样本,因此 API 会漏掉恰好落在窗口起点处的一次满潮。

  1. 把 CI 失败和 review 评论交给 Claude

在某个仓库上安装了 Claude GitHub App 之后,云会话就可以监视一个 pull request,并对其发生的事情采取行动。在 claude.ai/code 的会话中,通过 CI 栏开启 Auto-fix。

你也可以在终端中于 PR 分支上运行 /autofix-pr,让移动应用监视这个 PR,或者把 PR 的 URL 粘贴到某个会话中。

Claude 会为失败的检查和 review 评论推送明确的修复,并解释它改动了什么。遇到任何含糊不清或涉及架构的问题,它都会询问你。在 review 线程中的回复会以你的 GitHub 用户名发布,并标注为 Claude Code。

Claude 不会收到关于与 base 分支发生 merge conflict 的通知,因此需要你主动让它 rebase。它的评论还可能触发由评论驱动的自动化,例如 Atlantis。

  1. 不必亲自启动就开始工作

routine(research preview)是为完成某项任务而保存的一组资源,例如一个 prompt、若干仓库、connectors 和一个环境。每次运行都是一个云会话,由某个触发器启动。

触发器可以是一个定时计划(最多每小时一次)、对 routine 自身 endpoint 的一次 HTTP 调用,或者一个 GitHub 事件,例如 pull request 被打开或一次 release。

可以在 claude.ai/code/routines 或 Desktop 应用中创建,也可以在 CLI 中用 /schedule 创建。Routine 运行时不会出现审批提示,并且默认推送到以 claude/ 为前缀的分支。

这里还有两个较小的工具能帮上忙。你可以在任何你已登录的机器上(包括某个 CI job)向一个正在运行的会话排队追加后续指令。

CODEShellclaude -p "The integration tier is green now; rebase on main and push" --cloud <session-id>

你还可以收藏一个预先填充好的会话。诸如 claude.ai/code?prompt=Triage+the+newest+issues&repositories=acme-labs/tidepool 这样的 URL 会打开 claude.ai/code,并已填好 prompt 和仓库。

  1. 运行你并不完全信任的代码

贡献者的 pull request、新依赖的安装脚本、或者你五分钟前才 clone 的仓库,都可能运行你没读过的代码。在你的笔记本上,这些代码就运行在你的 SSH 密钥、云 CLI 会话和浏览器配置文件旁边。

而在云会话中,它运行在一个一次性的 VM 里,上面没有那些东西,只有一个会话级别的 GitHub 凭证,以及一个你可以收窄的网络。

要进行最严格的运行,可将环境的网络访问设为 None;或者保持 Trusted,它允许访问包注册表、GitHub 以及主要的云 SDK 主机。即使设为 None,Claude Code 仍会向 Anthropic API 发送请求,因此数据可能经由这一途径离开 VM,而且会话仍能推送到它自己的分支。所有出站流量都会经过一个记录主机名的代理。

连接 GitHub 而不被卡住

如果你的第一个云会话出了问题,GitHub 是最可能的原因。大多数问题源于云会话需要两种相互独立的 GitHub 权限。

用 GitHub 登录告诉 Claude 你是谁。

在某个账户或组织上安装 Claude GitHub App,决定了 Claude 在那里能看到哪些私有仓库。

公共仓库只需前者即可使用。私有仓库则需要后者,并且要装在拥有这些仓库的那个账户或组织上。如果你已连接 GitHub 却发现某个私有仓库不见了,通常是因为 App 没有安装在拥有该仓库的账户或组织上。

你已连接的内容 | 公共仓库 | 你的私有仓库 | 组织的私有仓库 | Auto-fix、GitHub 触发器、项目

仅用 GitHub 登录 | 是 | 否 | 否 | 否

  • 在你的个人账户上安装 App | 是 | 是 | 否 | 你的仓库
  • 在组织上安装 App(所有者批准) | 是 | 仅当你的个人账户上也安装了 App 时 | 是 | 组织仓库

/web-setup(你的 gh token) | 是 | 是 | 你的 token 能访问到的任何仓库 | 否,需要 App

路径 A:在浏览器中连接(推荐)

在 claude.ai/connect-github 连接你的 GitHub 账户,然后在拥有你仓库的账户或组织上安装 Claude GitHub App。对于组织,通常需要所有者批准安装。quickstart 会逐步讲解每个步骤。

如果 GitHub 没有把你送回 claude.ai/code,claude.ai/connect-github 上的连接页面可以显示一份简短的清单,列出常见原因。其中之一是单点登录(single sign-on)步骤——如果跳过它,组织的仓库就会被隐藏。

FIG L 如果 GitHub 没有把你送回来:产品自带的、针对 GitHub 连接中断的检查清单,来自本地运行的 claude.ai/code 界面中的 quick-setup 新手引导流程

Auto-fix、由 GitHub 触发的 routine 以及 projects 也依赖这个 App,所以即使你通过其他方式连接,也要安装它。

路径 B:在终端中用 /web-setup 连接

如果你已经在使用 gh CLI,可在 Claude Code 内运行 /web-setup,把你的 gh token 发送给你的 Claude 账户。这样,会话就能访问该 token 能访问的任何仓库,无论是否安装了 App。具体步骤参见 Connect from your terminal。

在 Team 和 Enterprise 套餐中,所有者必须先开启 Quick setup。

路径 C:为一次性使用跳过 GitHub

在某个没有 GitHub remote 的仓库中,或该 App 未安装的仓库中运行 claude --cloud 时,Claude Code 会将你的仓库打包上传,而不是克隆它。只有当你的 GitHub 连接对该仓库具有 push 权限时,会话才能 push 回去。文档列出了该 bundle 包含和不包含的内容。

如果你使用 Team 或 Enterprise

管理员(owner)有一份简短的清单:在 claude.ai/admin-settings/connectors 开启 GitHub connector,在 Claude Code 管理设置中允许 cloud sessions,在组织的仓库上安装 Claude GitHub App(或批准成员的请求),并决定是否开启 Quick setup。

使用 IP allowlist 或 GitHub Enterprise Server 的组织还有额外一步。参见关于 IP allowlist 和 GitHub Enterprise Server 的文档。

当问题仍未解决时

你看到的现象|原因|解决方法选择器中缺少某个私有仓库|该 App 未安装在拥有该仓库的账户或组织上,或其 repository access 未包含该仓库|在该处安装该 App,或在你 GitHub 设置中该 App 的 Repository access 里添加该仓库出现错误,提示你必须先成为该组织的 owner 才能关联它|该组织阻止了成员资格检查,通常是因为有待处理的 App 权限请求、IP allow list 或 SAML single sign-on|由 owner 在该组织的 GitHub App 设置中接受待处理的权限请求,为已安装的 GitHub Apps 开启 IP allow list 继承,或(在 SAML 下)授予 Claude 访问该组织的权限连接刚完成后,某个组织的仓库缺失|该组织使用 SAML single sign-on,且其授权步骤被跳过了|在 GitHub 的 "Single sign-on to your organizations" 步骤中,继续之前点击每个组织旁边的 Authorize。

如果你已经跳过了,请在你 GitHub 设置中为该组织授权 Claude,然后重新连接每个 cloud session 都因身份验证错误而失败|你的 Claude 组织使用了 IP allowlisting|请求支持团队将 Anthropic 托管的服务加入豁免

对于其他情况,请参见文档中的 troubleshooting,包括连接 GitHub 后没有仓库出现的问题。要完全断开 GitHub,请使用 claude.ai/customize/connectors。

为会话提供检查自身工作所需的东西

能够运行你的测试的会话,会在把工作交回之前先检查自己的工作。否则,你审查的是没有人运行过的更改。本指南演示中的大部分价值来自 Claude 实际运行:测试套件运行了 40 次、服务器及其 curl、窗口边缘的潮汐计算。十分钟的环境设置能让 Claude 有办法运行这些检查。

FIG M 在 claude.ai/code 界面中添加 cloud environment,在本地以示例值运行:一个名称、一个网络访问级别、.env 格式的变量,以及一个 setup script

从 Default environment 开始。它使用 Trusted 网络访问级别,没有变量也没有 setup script,这对大多数 JavaScript、Python、Go 和 Rust 仓库已经足够。

为机器使用 setup script。它在 Claude Code 启动之前以 root 身份运行,因此 apt install 可以工作。它必须以退出码 0 结束,否则会话不会启动;它应在约五分钟内完成,以便环境被缓存。此后,新会话会从带有磁盘上工具的快照启动。

当你更改脚本或允许的主机时,缓存会重建,大约每七天也会重建一次。

为项目使用 SessionStart hook。把 npm install 及类似步骤放进仓库 .claude/settings.json 中的一个 hook 里,这样它们在本地和云端以相同的方式运行。如果某个步骤应只在云端运行,请检查 CLAUDE_CODE_REMOTE。仓库 hook 会在单仓库会话中加载。

每个会话单独启动服务。缓存存储的是文件。正在运行的进程无法在缓存中留存。让 Claude 运行 service postgresql start,或在 SessionStart hook 中完成。

选择可用的最窄网络级别。Trusted 覆盖常见的 registry。使用 Custom 来添加私有 registry,只有当任务需要开放互联网时才使用 Full。更改会在约一分钟内到达正在运行的会话。

不要把机密放进共享变量。环境变量对使用该环境的任何人都可见。在 Pro 和 Max 上,环境的 API credentials 会在 VM 之外为你指定的主机的请求附加一个 key,因此该 key 从不会存在于变量中。

把命令写进 CLAUDE.md。你个人的 ~/.claude 不会到达云端 VM。如果 Claude 需要知道如何运行集成测试,仓库必须说明这一点。

带来回报的习惯

一个任务,一个会话。小的、独立的会话更容易审查,丢弃成本也更低。

要求证据。指明能证明任务已完成的命令,并在看 diff 之前先读 Claude 的总结。

在运行 claude --cloud 之前先 push。VM 从 GitHub 克隆,因此未 push 的 commit 不会到达它那里。

在长任务中随手 commit。闲置的 VM 可能被回收。

在 diff 视图中审查。内联评论会被批量打包进你的下一条消息,而 Create PR 可以打开完整的 PR、草稿,或 GitHub 的 compose 页面。

在 Claude 工作时进行引导。你在 Claude 工作期间发送的消息会排队,而且你可以收回一条已排队的消息。

分享会话。在 Team 和 Enterprise 上,将会话的可见性设为 Team,这样审查者可以读到更改是如何完成的。来自 cloud sessions 的 commit 带有一个链接回 transcript 的 Claude-Session trailer。

注意你的限额。并行会话会并行消耗你的套餐限额,因此五个会话的消耗速度约为单个会话的五倍。Routines 有自己的每小时上限,projects 每天最多可以启动 200 个新线程。

常见问题

谁可以使用 cloud sessions?Pro、Max 和 Team 套餐,以及拥有 premium seat 或 Chat + Claude Code seat 的 Enterprise 用户,需使用 claude.ai 账户登录。使用 Console API key 或第三方 provider 时不可用。参见 cloud sessions 文档。

我的数据会去向哪里?Anthropic 会存储会话记录(session transcript),保留时长取决于你的套餐和模型改进设置。VM 在一段时间不活动后会被回收,删除会话会移除其数据。参见 data usage and security。

Claude 会在我的云端会话数据上进行训练吗?云端会话遵循与 Claude Code 其余部分相同的政策。在 Team、Enterprise 和 API 上,除非你的组织选择加入,否则 Anthropic 不会基于你的代码或提示词训练模型。在 Free、Pro 和 Max 上,则取决于你的模型改进设置。参见 data usage。

它能处理我的大型仓库吗?VM 拥有约 4 个 vCPU、16 GB 内存和 30 GB 磁盘。把繁重的安装放进一个安装脚本中,这样它们只运行一次并落入缓存的快照中。

那 GitLab 或 Bitbucket 呢?claude --cloud 可以从任意 git 仓库上传 bundle,但会话无法推送回这些主机。GitHub Enterprise Server 在 Team 和 Enterprise 上受支持。参见 the platform restrictions。

并行分支发生冲突时会发生什么?各个会话彼此互不知情。先合并一个分支,然后给下一个会话发送一条后续指令,例如 claude -p "rebase on main and fix any conflicts" --cloud <session-id>。

我会失去本地工具吗?用户级配置不会随之迁移,因此把团队需要的内容移入仓库:将 skills 和 commands 提交到 .claude/ 下,将项目范围的 MCP servers 添加到 .mcp.json,并在 CLAUDE.md 中记录测试命令。

Settings in cloud sessions 列出了每个会话会读取的内容。

五分钟内开始

设置大约需要五分钟。之后,你可以交出一个任务,合上笔记本电脑,然后回来时就能得到一个已准备好接受评审的分支。

打开 claude.ai/code,或在 Claude Code 中使用你的 claude.ai 账户运行 /login。

连接 GitHub,并在你的仓库所在位置安装 Claude GitHub App。

选择仓库和 Default 环境。

从你的 backlog 中给 Claude 一个任务,并附带一个能证明任务已完成的命令。

关闭标签页。稍后用手机查看进度,然后在 claude.ai/code 审查 diff 并创建 pull request。

展开原文提取正文(采集端自动提取,可能有缺失)

You probably run Claude Code in a terminal on your own laptop. That session depends on the laptop in three ways:

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.

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. 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. 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. 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. 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. FIG AThe 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. 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. 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: CODEShellclaude --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.

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.

FIG EA 20-second recording of the same local build: clicking between the three sessions, then scrolling the logger session's transcript 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. 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 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. FIG FAnatomy of a cloud session. Everything the agent can touch sits inside the VM. Your GitHub token and the network policy sit outside it.

Every task gets its own machine. A fresh VM with your repository cloned onto a new branch, so sessions can't touch each other's files or ports. See what's installed. Your GitHub token never enters the VM. A proxy holds it, and the session gets a short-lived credential that can push only to its own working branch. See the GitHub proxy. The repository's Claude config comes along. Your personal one doesn't. CLAUDE.md, rules, skills, agents, and commands travel with the repo, and your ~/.claude stays on your laptop. See settings in cloud sessions. Idle VMs get reclaimed. Reopen the session and you get a fresh VM with the conversation restored, so commit work you care about. See environment expiry.

For specs, permission modes, and network levels, see the cloud environments docs. LOCAL OR CLOUD? Cloud sessions don't replace local ones, and most people use both. The table shows where they differ, and the paragraphs after it say when each one fits. Local sessionCloud sessionRuns onYour machineA fresh VM for each taskLaptop asleep or offlineThe session stopsThe session keeps goingSeveral tasks on one repoSeparate worktrees, ports and careOne VM and one branch per taskWhat the agent can reachAnything your user account can, including SSH keys, cloud CLIs and ~/.claudeThe repository, the network level you set, the connectors you enable, and a session-scoped GitHub credentialStart or follow fromThat machine, or your phone through remote controlBrowser, phone, Desktop, terminal, Slack, an API call or a scheduleApprovalsAny mode, including per-commandAuto, Accept edits or PlanEnds withChanges in your working treeA branch, and a pull request when you want oneComputeYour machineNo separate compute charge; uses your plan's limits Stay local when the task needs something only your machine has. That covers a database with real local data, a service you reach over VPN, a GPU, a phone simulator, or hardware on your desk. Stay local too for tight visual loops where you want to see each change in your own browser within seconds, and when your organization runs with Zero Data Retention, which turns cloud sessions off. Two features sit between the options. Remote control keeps the session on your machine and lets you steer it from your phone or browser. Self-hosted environments, in beta for Team and Enterprise, run cloud sessions on your organization's own infrastructure, so they can reach private networks. If none of that applies, the task is a good candidate for the cloud. The next section covers the workflows where that pays off most. SEVEN WORKFLOWS THAT SUIT CLOUD SESSIONS These workflows put the differences in the table to work: a separate machine for each task, sessions that keep running while you're away, and a branch at the end for you to review.

  1. Clear a backlog in parallel

Let's say you have five small, unrelated fixes. Locally, you'd do them one after another, or set up five worktrees and keep their ports and installs apart. In the cloud, you'd start five sessions and review five branches. CODEShellclaude --cloud "Fix the flaky test in auth.spec.ts" claude --cloud "Update the API documentation" claude --cloud "Refactor the logger to use structured output" claude --cloud clones your GitHub remote at your current branch, so push your local commits first. While the VM starts, the CLI shows a live checklist of setup steps and queues anything you type. Write each task as a self-contained ticket that states what's wrong, what done looks like, and how to prove it. The flaky-test prompt named its proof: running the suite at least 30 times in a row. The session ran it 40 times. When the tasks belong to one larger effort, a project (public beta for Pro and Max) runs a coordinator conversation that starts and tracks the cloud sessions for you. It then groups them by state: working, waiting on you, and ready for review.

  1. Let it prove the fix

A flaky test is the clearest case of work that needs repeated proof: you have to run the suite again and again, and you don't want that loop tying up the machine you're working on. In the cloud, Claude patched the cache and ran the whole suite 40 times in one command. FIG GForty runs, zero failures: the flaky-test session's real command and output, replayed in the claude.ai/code interface running locally. Claude patched src/cache.js and looped the full suite 40 times in one step. Paths show under /home/user. The VM has no compute charge and its CPU isn't yours, so ask for thorough proof. Run the suite 200 times, bisect a regression across 50 commits, run the slow integration tier, or start the app and hit it with curl the way the docs session did. Each of Claude's turns still counts toward your plan, but a long test run inside one command costs little. Foreground commands time out after 2 minutes by default (10 at most) and then keep running in the background for up to 30 more. You can raise the defaults with BASH_DEFAULT_TIMEOUT_MS and BASH_MAX_TIMEOUT_MS in the environment's variables.

  1. Plan at your desk, build in the cloud, finish in your terminal

For a larger change, agree on the approach first where back-and-forth is cheap. Start Claude in plan mode, work out the plan together, commit the plan, and push it. CODEShellclaude --permission-mode plan # ...agree on the plan, save it to docs/migration-plan.md, commit and push... claude --cloud "Execute the migration plan in docs/migration-plan.md" While the cloud session builds, your terminal is free for other work. When it's done, pull the session down to finish it by hand. CODEShellclaude --teleport # pick a cloud session claude --teleport <session-id> Teleport checks that you're in the same repository, fetches the session's branch, checks it out, and loads the whole conversation into your terminal. You need a clean working tree (it offers to stash), and the branch has to be pushed. From inside Claude Code, /teleport (or /tp) opens the same picker, and /tasks then t works too. The Desktop app goes the other way, and its Open in menu sends a local session to the cloud.

  1. Check in from your phone

The Code tab in the Claude app connects to the same sessions. From your phone you can start a task, follow it, steer it, answer a question Claude asked, or tell Claude to watch a pull request. A phone suits questions you'd otherwise forget by the time you reach a keyboard. I gave a fourth session the kind of question you'd type on one: how does tidepool predict tides, and how could it go wrong at the edges of a time window? It ran code to check its answer and found a real bug. The loop never examines the first or last sample, so the API misses a high tide that falls exactly at the start of the window.

  1. Hand CI failures and review comments to Claude

With the Claude GitHub App installed on a repository, a cloud session can watch a pull request and act on what happens to it. From the CI bar in a session at claude.ai/code, turn on Auto-fix. You can also run /autofix-pr on the PR branch in your terminal, ask the mobile app to watch the PR, or paste the PR URL into a session. Claude pushes clear fixes for failing checks and review comments, and explains what it changed. It asks you about anything ambiguous or architectural. Replies on review threads post under your GitHub username, labeled as Claude Code. Claude doesn't get notified about merge conflicts with the base branch, so ask it to rebase. Its comments can also trigger comment-driven automation such as Atlantis.

  1. Start work without starting it yourself

A routine (research preview) is several saved resources designed to accomplish a task, such as a prompt, repositories, connectors, and an environment. Each run is a cloud session, started by a trigger. Triggers can be a schedule (hourly at most often), an HTTP call to the routine's own endpoint, or a GitHub event such as a pull request opening or a release. Create one at claude.ai/code/routines, in the Desktop app, or with /schedule in the CLI. Routines run without approval prompts, and by default they push to claude/-prefixed branches. Two smaller tools help here. You can queue a follow-up into a running session from any machine where you're logged in, including a CI job. CODEShellclaude -p "The integration tier is green now; rebase on main and push" --cloud <session-id> You can also bookmark a prefilled session. A URL such as claude.ai/code?prompt=Triage+the+newest+issues&repositories=acme-labs/tidepool opens claude.ai/code with the prompt and repository already filled in.

  1. Run code you don't fully trust

A contributor's pull request, a new dependency's install script, or a repository you cloned five minutes ago can all run code you haven't read. On your laptop, that code runs next to your SSH keys, your cloud CLI sessions and your browser profile. In a cloud session it runs in a disposable VM with none of those, a session-scoped GitHub credential, and a network you can narrow. Set the environment's network access to None for the strictest run, or keep Trusted, which allows package registries, GitHub and the major cloud SDK hosts. Even at None, Claude Code still sends requests to the Anthropic API, so data can leave the VM that way, and the session can still push to its own branch. All outbound traffic passes through a proxy that logs hostnames. CONNECTING GITHUB WITHOUT GETTING STUCK If your first cloud session goes wrong, GitHub is the most likely reason. Most problems come from cloud sessions needing two separate GitHub permissions.

Signing in with GitHub tells Claude who you are. Installing the Claude GitHub App on an account or organization sets which private repositories Claude can see there.

Public repositories work with the first alone. Private repositories need the second, on whichever account or organization owns them. If you connected GitHub and a private repository is missing, the App usually isn't installed on the account or organization that owns it. What you've connectedPublic reposYour private reposAn org's private reposAuto-fix, GitHub triggers, projectsSigned in with GitHub onlyYesNoNoNo+ App on your personal accountYesYesNoYour repos+ App on the organization (owner approves)YesOnly if also on your accountYesOrg repos/web-setup (your gh token)YesYesWhatever your token can reachNo, needs the App Path A: connect in the browser (recommended) Connect your GitHub account at claude.ai/connect-github, then install the Claude GitHub App on the account or organization that owns your repository. For an organization, an owner usually has to approve the install. The quickstart walks through each step.

If GitHub doesn't send you back to claude.ai/code, the connect page at claude.ai/connect-github can show a short checklist for the usual causes. One of them is the single sign-on step, which hides an organization's repositories if you skip it. FIG LIf GitHub doesn't send you back: the product's own checklist for an interrupted GitHub connection, from the quick-setup onboarding flow in the claude.ai/code interface running locally Auto-fix, GitHub-triggered routines and projects also depend on the App, so install it even if you connect another way. Path B: connect from your terminal with /web-setup If you already use the gh CLI, run /web-setup inside Claude Code to send your gh token to your Claude account. Sessions can then reach any repository that token can, with or without the App. See Connect from your terminal for the walkthrough. On Team and Enterprise plans, an owner has to turn on Quick setup first. Path C: skip GitHub for a one-off Run claude --cloud in a repository that has no GitHub remote, or one where the App isn't installed, and Claude Code uploads a bundle of your repository instead of cloning it. The session can push back only if your GitHub connection has push access to that repository. The docs list what the bundle includes and leaves out. If you run Team or Enterprise An owner has a short checklist: turn on the GitHub connector at claude.ai/admin-settings/connectors, allow cloud sessions in the Claude Code admin settings, install the Claude GitHub App on the organization's repositories (or approve members' requests), and decide whether to turn on Quick setup. Organizations with IP allowlists or GitHub Enterprise Server have an extra step. See the docs on IP allowlists and GitHub Enterprise Server. When it still doesn't work What you seeWhyFixA private repository is missing from the pickerThe App isn't installed on the account or organization that owns it, or its repository access excludes itInstall the App there, or add the repository to the App's Repository access in your GitHub settingsAn error saying you must be an owner of the organization to link itThe organization blocked a membership check, usually because of a pending App permission request, an IP allow list, or SAML single sign-onAn owner accepts the pending permission request in the organization's GitHub App settings, turns on IP allow list inheritance for installed GitHub Apps, or (under SAML) grants Claude access to the organizationAn organization's repositories are missing right after you connectThe organization uses SAML single sign-on, and its authorization step was skippedOn GitHub's "Single sign-on to your organizations" step, click Authorize next to each organization before you continue. If you already skipped it, authorize Claude for that organization in your GitHub settings, then reconnectEvery cloud session fails with an authentication errorYour Claude organization uses IP allowlistingAsk support to exempt Anthropic-hosted services For anything else, see troubleshooting in the docs, including no repositories appearing after you connect GitHub. To disconnect GitHub entirely, use claude.ai/customize/connectors. GIVE SESSIONS WHAT THEY NEED TO CHECK THEIR OWN WORK A session that can run your tests checks its own work before it hands the work back. Without that, you review changes nobody has run. Most of the value in this guide's demos came from Claude running things: the suite 40 times, the server and its curls, the tide calculation at the window's edge. Ten minutes of environment setup gives Claude a way to run those checks. FIG MAdding a cloud environment in the claude.ai/code interface, running locally with sample values: a name, a network access level, variables in .env format, and a setup script

Start with the Default environment. It uses Trusted network access, no variables and no setup script, which is enough for most JavaScript, Python, Go and Rust repositories. Use a setup script for the machine. It runs as root before Claude Code starts, so apt install works. It must exit 0 or the session won't start, and it should finish within about five minutes so the environment gets cached. After that, new sessions start from a snapshot with your tools on disk. The cache rebuilds when you change the script or the allowed hosts, and about every seven days. Use a SessionStart hook for the project. Put npm install and similar steps in a hook in the repository's .claude/settings.json, so they run the same way locally and in the cloud. Check CLAUDE_CODE_REMOTE if a step should run only in the cloud. Repository hooks load in single-repository sessions. Start services per session. The cache stores files. Processes that were running don't survive it. Ask Claude to run service postgresql start, or do it in a SessionStart hook. Pick the narrowest network level that works. Trusted covers the common registries. Use Custom to add a private registry, and Full only when the task needs the open internet. Changes reach running sessions within about a minute. Keep secrets out of shared variables. Environment variables are visible to anyone who uses the environment. On Pro and Max, an environment's API credentials attach a key to requests for the hosts you name, outside the VM, so the key never sits in a variable. Put the commands in CLAUDE.md. Your personal ~/.claude doesn't reach the cloud VM. If Claude needs to know how to run the integration tests, the repository has to say so.

HABITS THAT PAY OFF

One task, one session. Small, separate sessions are easier to review and cheaper to throw away. Ask for evidence. Name the command that proves the task is done, and read Claude's summary before the diff. Push before claude --cloud. The VM clones from GitHub, so unpushed commits don't reach it. Commit as you go on long tasks. Idle VMs can be reclaimed. Review in the diff view. Inline comments are batched into your next message, and Create PR can open a full PR, a draft, or GitHub's compose page. Steer while Claude works. Messages you send while Claude works queue up, and you can take a queued one back. Share the session. On Team and Enterprise, set a session's visibility to Team so a reviewer can read how the change was made. Commits from cloud sessions carry a Claude-Session trailer that links back to the transcript. Watch your limits. Parallel sessions draw on your plan limits in parallel, so five sessions use them about five times as fast as one. Routines have their own hourly caps, and projects can start up to 200 new threads a day.

COMMON QUESTIONS Who can use cloud sessions? Pro, Max, and Team plans, and Enterprise users with a premium seat or a Chat + Claude Code seat, signed in with a claude.ai account. They aren't available with a Console API key or a third-party provider. See the cloud sessions docs. Where does my data go? Anthropic stores the session transcript, and how long it's kept depends on your plan and model-improvement setting. VMs are reclaimed after inactivity, and deleting a session removes its data. See data usage and security. Will Claude train on my cloud sessions data? Cloud sessions follow the same policy as the rest of Claude Code. On Team, Enterprise, and the API, Anthropic doesn't train models on your code or prompts unless your organization opts in. On Free, Pro, and Max, it depends on your model-improvement setting. See data usage. Will it handle my large repository? The VM has about 4 vCPUs, 16 GB of RAM, and 30 GB of disk. Put heavy installs in a setup script so they run once and land in the cached snapshot. What about GitLab or Bitbucket? claude --cloud can upload a bundle from any git repository, but the session can't push back to those hosts. GitHub Enterprise Server is supported on Team and Enterprise. See the platform restrictions. What happens when parallel branches conflict? The sessions don't know about each other. Merge one branch, then send the next session a follow-up such as claude -p "rebase on main and fix any conflicts" --cloud <session-id>. Will I lose my local tools? User-level config doesn't travel, so move what the team needs into the repository: commit skills and commands under .claude/, add project-scoped MCP servers to .mcp.json, and document test commands in CLAUDE.md. Settings in cloud sessions lists what each session reads. START IN FIVE MINUTES Setup takes about five minutes. After that, you can hand off a task, close your laptop, and come back to a branch that's ready for review.

Open claude.ai/code, or run /login in Claude Code with your claude.ai account. Connect GitHub and install the Claude GitHub App where your repository lives. Pick the repository and the Default environment. Give Claude one task from your backlog, with a command that proves it's done. Close the tab. Check in from your phone later, then review the diff and create the pull request at claude.ai/code.

原文入口

阅读原文(claude.dev)

原文将在新窗口打开。收录时间不是内容更新时间;正文、译文与解读的版权归原作者/来源所有,本站仅作个人阅读辅助并保留原文入口;页面时间均为北京时间。

作者/署名来自原文结构化字段(Atom/RSS/HTML meta/JSON-LD;GitHub release 显示的是发布者账号),未经模型补充。

了解来源批准与收录规则