cc-haha/docs/desktop/agents.md
程序员阿江(Relakkes) c2cd615824 docs: rebuild the documentation site around two readers
The site had drifted from the product. Every screenshot predated the
v0.5.0 UI redesign, the reading experience shipped no search and no
syntax highlighting, and a third of the pages were internal process
artefacts — migration task lists addressed to agentic workers, a
release runbook, a proposal marked "historical".

Reorganise around the only two people who read this: someone getting
the desktop app running for the first time, and someone reading the
source. Five sections replace nine — start / desktop / im / cli /
internals — and the pages that served neither reader are gone.

Site rewrite:

- Palette lifted from the desktop app's 「纸·墨·印」 themes, so the
  site and the product read as one thing. Light mirrors 纯白, dark
  mirrors 墨夜, and dark mode exists at all now.
- Fonts are self-hosted. The old @import from Google Fonts is
  unreachable from mainland China, which left every heading in a
  fallback serif; it also only requested weight 600 while the CSS
  asked for 900, so Latin and CJK in the same heading disagreed.
- Docs were shipped as one 968KB manifest downloaded on every page
  view. Split into a 32KB index plus one lazily imported chunk per
  page; the entry bundle is now 101KB gzipped.
- Add search, syntax highlighting, per-route meta with canonical and
  hreflang, a sitemap, and an error boundary. Replace the 44vh
  mobile sidebar with a drawer.
- Image dimensions are read at build time and written into the tag,
  so lazy images reserve their space instead of collapsing.

Screenshots are recaptured from a real v0.5.0 build against a clean
demo project, with tokens, QR codes and paired accounts redacted.
The previous set is deleted rather than kept alongside.

Routes follow file paths, so the restructure would have broken every
inbound link; 37 old paths redirect, in both languages. The PR policy
gate and CODEOWNERS also hardcoded docs/guide/contributing.md.

Verified: check:docs 78 pages / 323 links / 0 problems, check:policy
127 pass. Walked every route at 1440 and 390 in both themes for
overflow, contrast, keyboard reachability and focus management.
2026-07-27 17:32:41 +08:00

4.6 KiB
Raw Blame History

title nav_title description order
子 Agent 与任务拆分 子 Agent 什么时候该派子 Agent、内置的有哪些、怎么捏一个自己的。 3

子 Agent 与任务拆分

子 Agent 就是 Claude 派出去的分身:给它一个明确的小任务,它自己带着独立上下文去干,干完只把结论交回来。

好处是主对话不会被一堆中间过程撑爆。比如「在这个仓库里找出所有调用 validateUser 的地方」,如果主 Agent 亲自去搜,几十个文件的内容全会挤进上下文;派个子 Agent 去,回来的只有一份清单。

什么时候该派

  • 要翻很多文件才能回答的问题 — 找用法、理清依赖、统计某种模式在哪些地方出现。
  • 可以并行的独立工作 — 前端一个、后端一个、测试一个,同时开工。
  • 需要多个角度看同一件事 — 比如让几个 Agent 各自审一遍同一段代码。

反过来,你已经知道文件在哪、改哪一行,那就直接说,不用绕这一圈。

派出去的子 Agent 会出现在活动面板的「SubAgent」区块工具活动实时冒泡点进去能看它完整的运行记录和最终结果。后台跑的也一样不用等它结束才知道在干什么。

内置 Agent

不用配置就能用的几个:

名称 干什么的
general-purpose 通用兜底。复杂问题研究、找代码、多步骤任务,不知道派谁就派它
Explore 专门快速探索代码库。按模式找文件、按关键词搜代码、回答「这块是怎么工作的」
Plan 架构师。设计实现方案,返回分步计划、关键文件和取舍
claude-code-guide 回答关于 Claude Code、Agent SDK 和 Claude API 本身的问题
verification 收工前的验收。跑构建、测试、linter给出通过 / 失败 / 部分通过的结论
statusline-setup 配置 Claude Code 状态栏

在会话里可以直接说「用 Explore 去找一下……」,也可以让 Claude 自己判断该派谁。

看已经装了哪些

设置 → Agents:按来源分组的 Agent 浏览器

打开 设置 → Agents。顶部三张卡是总数、生效中、来源类型数下面按来源分组

用户项目本地托管插件CLI 参数内置

同名的 Agent 上面的来源会盖住下面的,被盖住的那个会标「被 X 覆盖」。日常主要看两组:

  • 用户 — 你自己建的,对所有项目生效,文件在 ~/.claude/agents/
  • 项目 — 只在当前项目生效,文件在项目里的 .claude/agents/,会跟着仓库一起分发。

点任意一条进详情页,能看到它的模型、思考强度、工具范围和完整系统提示词。内置和插件来源是只读的,详情页右上角会有一个「只读」标记。

捏一个自己的

「创建 Agent」弹窗:作用域、模型、思考强度、工具、系统提示词

点右上角「创建 Agent」要填的字段

  1. 配置范围 — 用户还是项目。选「项目」时下面会让你确认目标项目路径。
  2. 名称 — 164 位小写字母、数字、连字符或下划线,比如 code-reviewer。这是主 Agent 调用它时用的名字。
  3. 描述 — 说明主 Agent 应该在什么场景下委派给它。这一条最重要:主 Agent 就是靠它决定要不要派这个 Agent写含糊了就永远不会被叫到。
  4. 系统提示词 — 定义这个 Agent 的职责、边界和预期输出。
  5. 模型 — 继承主 Agent或指定 Haiku / Sonnet / Opus / Fable也可以填自定义模型 ID。简单重复的活给 Haiku 更快更省。
  6. 思考强度 — 继承,或单独指定低 / 中 / 高 / 极高 / 最大。模型不支持某档时会自动降级或忽略。
  7. 工具 — 三选一:全部工具、不允许使用工具、自定义列表。选自定义时按读取与搜索 / 修改文件 / 执行命令 / 工作流分类勾选,下面还有一个自由输入框,用来填 MCP 工具名或者 Bash(git:*) 这样的权限规则。
  8. 颜色 — 用来在界面上区分,可选。

保存后写入对应目录的 Markdown 文件,桌面端会尝试刷新当前会话。刷新失败不会回滚已经写好的文件,重启后仍然有效。

:::tip 只给必需的工具。一个只负责读代码给结论的 Agent 不需要 Write 和 Bash——权限收窄了它跑偏的空间也就小了。 :::

想了解 Agent 文件格式、来源优先级和继承规则,看Agent 系统原理