跳到正文
Skillpedia
智能体41k · #6823

subagent-orchestration

它能做什么

本技能说明 AI 在何时以及如何把工作交给辅助智能体,例如搜索代码库或起草方案的智能体。适合使用支持这类辅助的智能体的人。

适用场景

  • ✓当任务需要在许多文件中进行广泛搜索,而这会占满主对话的时候。
  • ✓当几项相互独立的研究可以同时进行时。
  • ✓当你希望在做任何改动之前,先单独起草一份方案时。

技能链接

https://github.com/PostHog/posthog/blob/master/packages/agent/packages/harness/src/extensions/orchestration/skills/subagent-orchestration/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/PostHog/posthog/blob/master/packages/agent/packages/harness/src/extensions/orchestration/skills/subagent-orchestration/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请查看整个项目,找出登录逻辑在哪里处理,并给我做一个总结。”

每周 5 个新技能,1 分钟读完。

工作原理

主助手会给辅助智能体一个清晰、自成一体的任务。辅助智能体在其独立的上下文中工作,并返回一份简短的摘要,因此主对话只保留重要的内容。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Subagent Orchestration

You (the parent session) can delegate scoped work to focused subagents, each running in its own isolated Pi session with its own context window. Use this to keep your own context clean and to parallelize independent work.

When to delegate

Delegate when a piece of work is:

  • Self-contained: it doesn't need your full conversation history, just a task and some context you can state explicitly.
  • Isolable: it would otherwise burn a lot of your context window (e.g. broad codebase search, reading many files) for a result you can summarize down to a few paragraphs.
  • Parallelizable: several independent instances of it can run at once (e.g. exploring two unrelated areas of a large codebase in the same turn).

Do not delegate trivial one-line changes, or work that fundamentally needs your full conversation context to do correctly — that's what context (below) is for, but if almost everything is relevant, delegation adds overhead for no benefit.

Bundled agents

Agent Use for Tools Model Notes
Explore Focused, read-only recon: find files, entry points, data flow read, bash, grep, find, ls Sol, falls back to your current model Reports compressed findings, never edits
Plan Turn Explore's findings (or your own) into a concrete implementation plan read, bash, grep, find, ls Inherits your current model Never edits
General Actual implementation: make the code changes an Explore/Plan investigation identified, or any task that needs real edits read, bash, edit, write, grep, find, ls Inherits your current model Same read-write capability as you have; makes real changes

Explore and Plan are read-only. General has the same read-write capability you do — reach for it when a change is mechanical/independent enough to delegate (especially several at once via parallel mode) rather than doing every edit yourself in sequence. For a small, one-off change, just make it directly instead of delegating.

Subagents cannot themselves call subagent — they are leaves, not orchestrators. Keep all delegation decisions in your own (parent) session.

For larger fan-out orchestration — many agents, loops over file lists, staged map/verify/synthesize flows — prefer the workflow tool (if available), which runs a JavaScript script coordinating these same read-only agents and returns one synthesized result. subagent is for one-off or small parallel delegations.

A project can add its own agents (including ones that write) as .pi/agents/<name>.md files — same frontmatter convention as the bundled agents above. See agentScope below.

The context field — always fill it in

A subagent gets only its task string, plus a small automatic digest of your last few conversation turns (as a fallback, not a substitute). It does not see the files you've already read, tool results you've already seen, or decisions you've already made unless you put them in context.

Always pass context with whatever the subagent actually needs:

  • File paths and line numbers you already found.
  • Decisions already made ("use approach B, not A, because...").
  • Constraints ("don't touch files under vendor/").

A subagent given a bare one-line task and no context will waste its own turns re-discovering things you already know.

Modes

  • single — one agent, one task. Default choice.
  • parallel — tasks: [...], up to 4 concurrent tasks. Use for independent work that can run at once, e.g. Exploreing two unrelated parts of a codebase together.

For every subagent, supply a brief description with 2 to 5 words. It states the purpose shown in the tool call. Keep the full instructions in task.

single: { agent: "Explore", task: "Find where authentication starts.", description: "Finding auth entrypoint" }
parallel: { tasks: [
  { agent: "Explore", task: "Find authentication entrypoints.", description: "Finding auth entrypoints" },
  { agent: "Explore", task: "Find session persistence code.", description: "Finding session storage" }
] }

For parallel work, put every agent in tasks. Do not use top-level agent or task. There is no chain mode. For a fixed pipeline (e.g. explore then plan), just call subagent twice in sequence yourself and pass the first call's output back in as the second call's context — you are already the orchestrator holding both results.

Recommended patter

常见问题

什么时候AI不应该转交工作?

对于极小的改动,或依赖完整对话内容的工作,因为转交会增加额外开销,收益却很小。

辅助智能体可以修改我的文件吗?

只读的辅助智能体只做搜索或规划。会进行改动的辅助智能体,在你接受其结果之前仍需审核。

辅助智能体会记得我们之前的对话吗?

不会自动记得。AI 必须说明辅助智能体所需的上下文,因为每个辅助智能体都在全新的独立会话中启动。

详情

作者的原始描述

How and when to delegate work to subagents via the `subagent` tool (Explore, Plan, General). Use when a task involves codebase recon, implementation planning, or actual code changes that would benefit from an isolated context window instead of doing it all inline.

repo: PostHog/posthog

热度

GitHub 星标
41k
排名
#6823
许可证
—
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能