Skip to content

[Feature] 子代理可继承派活主会话的工具/Skill(Task/改模式除外) / Let subagents inherit the parent turn's tools and skills #215

Description

@xingleiwu

Problem / 问题

Subagents already inherit permission mode (permission: inherit) and can inherit the session model (empty model pin). They do not inherit the parent turn's tools / skills / plugin tools.

A built-in explorer is:

tools: [Read, Glob, Grep, Bash]

The assignable whitelist is hard-coded:

SUBAGENT_ASSIGNABLE_TOOLS = [Read, Glob, Grep, BrowserPreview, Bash, Edit, Write]
DEFAULT_SUBAGENT_TOOLS    = [Read, Glob, Grep]

Settings copy is explicit: “Read-only by default. A delegate never inherits anything you don't grant here.”

So a parent Agent with Skill, MCP, plugin tools, ToolSearch, and the same workspace cannot give any of that to the worker it just spawned. Typical fallout on 0.14.6:

  • Parent is tracing PI-Desktop internals. Explorer has no Skill, no asar-aware tools, and guesses Composer.tsx / truncated scratch paths → Read directory (INVALID_ARGUMENT) and os error 3.
  • Parent loaded delivery-contract via Skill. Explorer cannot load it even if the task matches.
  • Parent can ToolSearch on-demand tools. Explorer cannot.

模型 pin 和权限已经能跟会话走;工具能力不能。主会话刚派出去的活,子代理却是另一套残缺工具箱。

Proposed change / 期望改动

Add an inherit path for tools, same idea as permission/model, without turning every explorer into a nested Agent.

Suggested frontmatter:

tools: inherit          # parent's currently enabled tool names, minus a deny list
# or
tools: [inherit, Bash]  # inherit + extras still on the assignable list

Default for builtins can stay today's whitelist (explorer stays read-mostly). Default for user-defined subagents, or a Settings toggle:

Subagents inherit the parent turn's tools (except Task / mode-switch / Ask)

Deny list (never inherit, even with inherit):

Keep off delegates Why
Task / TaskWait / TaskList / TaskStop no nested fan-out
EnterPlanMode / EnterGoalMode mode is the parent's
asktool subagent cannot see the user

Allow inherit (parent has them ⇒ delegate gets them):

  • Skill (and the same pluginSkills catalog the parent already received)
  • ToolSearch if the parent is using on-demand tools
  • plugin / MCP tools the parent was allowed to call
  • Read / Glob / Grep / Bash / Edit / Write / BrowserPreview as today

Runtime shape:

  1. When spawning SubagentRun, build tools from definition.tools. If the list contains inherit (or a new inheritTools: true), union with parent.availableToolNames minus the deny list.
  2. Pass the parent's pluginSkills into the delegate Agent so Skill { id } resolves. Do not require the child to ToolSearch for Skill if the parent already had it as a core/on-demand tool.
  3. Keep workspace + scratch roots the same as the parent (they already share projectPath / scratchDir — the missing piece is tools, not cwd).
  4. Settings: checkbox 「子代理继承当前会话工具」 / Inherit parent tools, default off for builtins, on for user agents — or honor tools: inherit in the markdown.

UI toolsHint today says the opposite; update it to: inherit is opt-in, mutating tools still need an explicit grant or inherit.

Alternatives / 其他方案

  • Put Skill on SUBAGENT_ASSIGNABLE_TOOLS only: helps skill routing, still no MCP/plugin tools, still a second catalog.
  • Always give explorer *: too wide (fixer-level writes on a search agent).
  • Prompt the parent “pass every path in the Task text”: works around missing Skill/ToolSearch, still a tax on every delegation.

Additional context / 补充信息

PI-Desktop 0.14.6 · Windows.

Already inherited today:

  • permission default inherit
  • empty model → session model
  • thinking “Same as the session”

Not inherited: tool names, Skill catalog, plugin/MCP tools.

Code:

  • packages/shared SUBAGENT_ASSIGNABLE_TOOLS / DEFAULT_SUBAGENT_TOOLS / parseSubagentDefinition
  • packages/agent-runtime/src/subagent-definitions.ts builtin explorer/fixer docs
  • packages/agent-runtime SubagentRun (tools: opts.tools) vs parent Runtime.buildTools() (skillTools only if mode === "agent")
  • Settings i18n toolsHint

Related: #204 (Skill as Agent core tool) — even if Skill is core on the parent, delegates still cannot call it until it is assignable or inherited.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: agent-runtimeAgent execution, subagents, tools, and runtime behaviorenhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions