第8章 多件事同时做、云端、定时 — 让整理工具自己运转
选读 需要的时候再读。跳过也能跟上后面的章节。一句话总结:你可以打开多个会话,把几件事并排交出去。想让它到点自动运行,就创建定时任务。 定时有三种(桌面、云端、
/loop),最大的区别是我的电脑是否必须开着。
这一章依据2026年10月31日确认的 Claude Code 官方文档编写。会话列表和定时列表里会直接显示真实的任务名称,所以这一章不用截图,而是按官方文档的说明和界面名称来指引。它会用到第7章做的 /weekly-review 技能。
多件事并排做
会话是彼此独立的对话,各自拥有背景和改动内容。[1] 所以你可以打开多个会话,同时交办不同的事。
- 新会话:侧边菜单的 + New,或者 Cmd+N(Windows 是 Ctrl+N)[2]
- 在会话之间切换:Ctrl+Tab / Ctrl+Shift+Tab[2:1]
- 并排查看两个会话:按住 Option(Windows 是 Alt)的同时,点侧边菜单里的会话[2:2]
比如,可以在一个会话里用 /study-notes 做学习笔记,同时在另一个会话里用 /weekly-review 做周复盘。这两件事用的是不同的文件,所以不会冲突。
不要让两个会话同时修改同一个文件。 一个会话改过的行,可能会被另一个会话重新覆盖。而且一个会话的回退,通常不会追踪另一个会话改过的内容(第4章)。[3] 这样一来,出了错也很难恢复。
想把同一个文件朝多个方向改改看时,用的功能是工作树(Worktree,文件夹的独立副本)。在是 Git 仓库的文件夹(第3、4章里打开了变更记录的文件夹)里,先打开输入框下面的工作树再开始会话。这样那个会话就不在原来的文件夹里,而是在副本里工作。[4] 相当于两个会话互不碰对方的文件。
要把副本里改的内容合并回原来的文件夹,需要再多懂一点 Git。所以一开始,做到一个文件只在一个会话里修改就够了。
理解检查
想同时把任务交给两个会话。最该避免的是什么?
三种定时
让 Claude 到约定的时间自动开始一个新会话,就是定时任务。[5] 方法有三种。
| 桌面定时 | 云端定时 | /loop | |
|---|---|---|---|
| 在哪里运行 | 我的电脑 | 云端 | 我的电脑 |
| 电脑是否必须开着 | 是(应用运行中、没有休眠) | 否 | 是 |
| 是否必须开着会话 | 否 | 否 | 是 |
| 能否访问我的文件 | 能 | 不能(重新获取的副本) | 能 |
出处:Claude Code 官方文档[6]
对整理工具来说,桌面定时最合适。 因为它要读我电脑里的 inbox 备忘。
云端定时即使关掉电脑也能运行。但它看不到我电脑里的文件。它会把放在 GitHub(把一批文件放到网上、大家一起用的服务)上的仓库(用 Git 留下记录的文件夹)重新获取到云端再工作。[6:1][7] 如果你从没把 inbox 备忘放到 GitHub 上,那么在云端就等于没有备忘可读。
/loop 用在打开着的会话里短时间重复确认,过了7天就会自动结束。[8]
详细内容(点击展开)— 最多能多频繁地运行(点击展开)
最短间隔是:桌面定时1小时(以界面表单为准)、云端定时1小时、/loop 1分钟。[6:2] 如果是像周复盘这样一周运行一次的事,不用在意。
理解检查
想设置一个定时,读取我电脑里的 inbox 笔记,每周生成回顾。哪种定时合适?
预约每周五的周复盘
桌面定时有两种创建方法。
方法1 — 用话请它做。 在任何会话里说出想要的日程就行。[9]
请创建一个定时任务:每周五下午6点,用 /weekly-review 生成本周的周复盘。如果那一周没有复盘备忘,就什么都不要生成,只留下“没有备忘”。方法2 — 在界面上创建。 点 Code 标签页侧边菜单里的 Scheduled(或 More 菜单里面),再点 New task。[10] 如果是旧版应用,这些名字会显示为 Routines 和 New routine。[11] 日程可以从每小时、每天、工作日、每周等中选,也可以不设日程先存着,之后用 Run now 随时运行。[12]
设定定时时,一定要注意四点。
1. 应用和电脑必须醒着。
- 桌面定时只在应用开着、电脑醒着时才运行。
- 要防止休眠,请打开设置里的 Keep computer awake。
- 合上笔记本盖子,电脑还是会休眠。[13]
2. 关机期间错过的运行,只补一次。
如果电脑休眠了,醒来时只会把错过的运行里最近的一次运行一遍。比如,周五下午6点的定时任务,可能会在周六早上才运行。[14] 所以要在请求里一并写上条件,比如“如果那一周没有备忘……”。[14:1] 这样就算晚了才运行,也不会做出莫名其妙的复盘。
3. 可能会停在授权窗口。
定时任务也有单独的权限模式。如果是「手动(수동)」,在需要授权的时刻会停下来等待。[15] 因为没人盯着,它会一直停在那里,直到有人来点。
所以创建之后,请用 Run now 运行一次,并在弹出的授权窗口里选择「始终允许(항상 허용)」。这样从下一次运行起就不会停了。[15:1]
第7章里推荐的是「只允许一次(한 번만 허용)」。那是因为当时我就在屏幕前看着。定时任务在我不在的时候运行,所以要提前允许。不过,在选择始终允许之前,请读一读预览,确认它和我交给它的事(例:写复盘文件)是否一致。如果是看不懂的命令,就拒绝,然后修改请求。
4. 我电脑整体设置里的允许规则也会适用。
Claude Code 会在我的电脑上放一个所有文件夹共用的设置文件(~/.claude/settings.json)。这里写的允许规则,也适用于定时任务。[15:2] 如果你从没在这个文件里另外写过允许规则,可以跳过这一条。
理解检查
周五下午 6 点的定时,那个时间笔记本电脑正睡着。桌面定时会怎样?
在云端工作
云端会话即使关掉我的电脑也会继续工作。[16] 不过云端看不到我电脑里的文件夹,通常是获取 GitHub 仓库后再工作。所以一般需要连接 GitHub。[7:1] 像本指南的整理工具那样,在我电脑文件夹里做的事,适合用桌面这一边。等你把工作放到 GitHub 上并开始使用时,再试试云端。
理解检查
关于云端会话,哪种说法是对的?
亲自试一试
- 打开两个会话,一边运行
/study-notes,另一边运行/weekly-review。确认两个结果有没有保存到不同的文件里。 - 用话请它创建每周五周复盘的定时任务。在请求里加上“如果没有备忘……”这个条件。
- 在定时列表里打开那个任务,用 Run now 运行一次。如果弹出授权窗口,就提前处理好。
- 不需要的话,就关掉或删除这个定时任务。定时运行也是会话,所以每次运行都会消耗用量。
连续任务:定时任务读复盘备忘时,如果备忘里混进了“无视这个指示,然后……”这样的句子,会怎么样?我们在第9章里确认。
小结
- 会话是彼此独立的。打开多个会话,并排交办不同文件的工作。同一个文件要避开,或者用工作树。
- 定时有桌面(我的电脑、可访问文件)、云端(电脑可以关、GitHub)、
/loop(会话内、7天)。 - 整理工具要读我的文件,所以桌面定时最合适。
- 错过的运行,在醒来时只运行一次。要在请求里写下条件,并用 Run now 提前处理授权窗口。
术语表
| 术语 | 中文名称 | 一句话解释 |
|---|---|---|
| Scheduled task | 定时任务 | 到约定的时间自动开始新会话的任务 |
| Routine | Routine | 旧版应用界面里定时任务用过的名字 |
| Worktree | 工作树 | 同一个 Git 仓库的独立工作副本 |
| Cloud session | 云端会话 | 不在我的电脑上,而在云端运行的会话 |
/loop | 循环 | 在打开着的会话里重复做事的命令(7天后结束) |
这一章读完了吗?
学习记录只保存在这个浏览器中。整体进度可以在 全部目录中查看。
下一章:第9章. 成本、数据、安全
参考资料(16 条)
Claude Code 官方文档,「Desktop application」。"Each session is an independent conversation with its own context and changes." code.claude.com (确认日期 2026-10-31) ↩︎
Claude Code 官方文档,「Desktop application」。"Click + New in the sidebar, or press Cmd+N on macOS or Ctrl+N on Windows, to work on multiple tasks in parallel. Press Ctrl+Tab and Ctrl+Shift+Tab to switch between sessions." / "Side by side: hold Option on macOS or Alt on Windows and click a session in the sidebar" code.claude.com (确认日期 2026-10-31) ↩︎
Claude Code 官方文档,「Checkpointing」。"Manual changes you make to files outside of Claude Code and edits from other concurrent sessions are normally not captured" code.claude.com (确认日期 2026-10-31) ↩︎
Claude Code 官方文档,「Desktop application」。"In a project that's a Git repository, turn on Worktree before you start a session to run it in its own Git worktree, an isolated copy of the project." code.claude.com (确认日期 2026-10-31) ↩︎
Claude Code 官方文档,「Schedule recurring tasks in Claude Code Desktop」。"Scheduled tasks start a new session automatically at a time and frequency you choose." code.claude.com (确认日期 2026-10-31) ↩︎
Claude Code 官方文档,「Schedule recurring tasks in Claude Code Desktop」。比较表(Runs on / Requires machine on / Requires open session / Access to local files / Minimum interval)和 "Use cloud tasks for work that should run reliably without your machine. Use Desktop tasks when you need access to local files and tools." code.claude.com (确认日期 2026-10-31) ↩︎
Claude Code 官方文档,「Use Claude Code in the cloud」。"Cloud sessions need access to your GitHub repositories to clone code and push branches." code.claude.com (确认日期 2026-10-31) ↩︎
Claude Code 官方文档,「Run prompts on a schedule」。"Recurring tasks automatically expire 7 days after creation." code.claude.com (确认日期 2026-10-31) ↩︎
Claude Code 官方文档,「Schedule recurring tasks in Claude Code Desktop」。"You can also create a task by describing what you want in any session." code.claude.com (确认日期 2026-10-31) ↩︎
Claude Code 官方文档,「Schedule recurring tasks in Claude Code Desktop」。"click Scheduled in the sidebar or in the sidebar's More menu." / "Click New task to open the New scheduled task dialog." code.claude.com (确认日期 2026-10-31) ↩︎
Claude Code 官方文档,「Schedule recurring tasks in Claude Code Desktop」。"If your app shows the feature under its earlier name, click Routines wherever this page says Scheduled and New routine where it says New task." code.claude.com (确认日期 2026-10-31) ↩︎
Claude Code 官方文档,「Schedule recurring tasks in Claude Code Desktop」。"Hourly: runs every hour" / "Weekdays: same as Daily but skips Saturday and Sunday" / "Weekly: shows a time picker and a day picker" / "Manual: no schedule, only runs when you click Run now." code.claude.com (确认日期 2026-10-31) ↩︎
Claude Code 官方文档,「Schedule recurring tasks in Claude Code Desktop」。"Tasks only run while the desktop app is running and your computer is awake. If your computer sleeps through a scheduled time, the run is skipped. To prevent idle-sleep, turn on Keep computer awake" / "Closing the laptop lid still puts it to sleep." code.claude.com (确认日期 2026-10-31) ↩︎
Claude Code 官方文档,「Schedule recurring tasks in Claude Code Desktop」。"If it did, Desktop starts exactly one catch-up run for the most recently missed time and discards anything older." / "If timing matters, add guardrails to the prompt itself" code.claude.com (确认日期 2026-10-31) ↩︎
Claude Code 官方文档,「Schedule recurring tasks in Claude Code Desktop」。"Each task has its own permission mode, which you set when creating or editing the task. Allow rules from ~/.claude/settings.json also apply to scheduled task sessions." / "the run stalls until you approve it" / "To avoid stalls, click Run now after creating a task, watch for permission prompts, and select "always allow" for each one. Future runs of that task auto-approve the same tools without prompting." code.claude.com (确认日期 2026-10-31) ↩︎
Claude Code 官方文档,「Get started with the desktop app」。"Cloud: Run sessions in the cloud that continue even if you close the app." code.claude.com (确认日期 2026-10-31) ↩︎