[BUG] Plugin agent definitions (body, tools, effort) dropped for named in-process teammates — Fxt() excludes source 'plugin' (re: #35253, #71648)

Status Fixed / completed
Reported on v2.1.285
Maintainer reply None cached
Activity 0 comments · opened Sep 30, 2026 · closed Oct 2, 2026

Summary

With agent teams enabled (CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1), in an interactive session, a subagent spawned with a name runs as an in-process teammate. If that subagent's definition comes from a plugin, the teammate gets none of the definition except the model:

  • no body / system prompt;
  • no tools: allowlist;
  • no disallowedTools:;
  • no effort:.

The same definition spawned without a name, with teams off, or in -p mode applies fully.

This was reported twice before, #35253 and #71648. Both were auto-closed as NOT_PLANNED by the stale bot and never fixed. It still reproduces on 2.1.285.

Root cause (from the 2.1.285 binary)

// handleSpawnInProcess
if(r){let D=e.options.agentDefinitions.activeAgents.find((v)=>v.agentType===r);if(D&&Fxt(D))A=D; ... }
... agentDefinition:A ...
function Fxt(e){return e.source!=="built-in"&&e.source!=="plugin"}

agentDefinition is undefined for every plugin-sourced agent. The plain-subagent path does resolve plugin agents (if(M.source==="plugin"&&M.loadDefinition!==void 0){...}). With --debug, a plugin teammate logs [handleSpawnInProcess] agent_type=<plugin>:<agent>, found=false, and a project or --agents definition logs found=true.

Measured matrix (2.1.285, interactive, minimal test plugin)

| Spawn shape | body | tools: | disallowedTools: | model | effort |
|---|---|---|---|---|---|
| named, plugin agent, teams on | no | no (a Bash-less agent ran Bash) | no | yes | no (ran the lead's effort) |
| named, project/--agents agent, teams on | yes | yes | no | yes | no |
| unnamed, teams on | yes | yes | yes | yes | yes |
| named, teams off (--settings '{"env":{"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS":"0"}}') | yes | yes | yes | yes | yes |
| -p (any) | yes | yes | yes | yes | yes |

disallowedTools: and effort: are also not applied on the teammate path even when a definition is attached (project/--agents sources).

Docs conflict

  • agent-teams.md (~L261) lists teammate subagent scopes as "project, user, or managed": plugin is absent.
  • agent-teams.md (~L271-273) promises that tools and the body apply to a teammate.
  • sub-agents.md (~L243) says definitions "from any of these scopes" (including plugins) are available to agent teams.

Impact

Plugin-shipped roles, such as read-only reviewers, silently run with the full tool set and no role instructions whenever they are spawned by name with teams on. Nothing warns the user; only the model is honoured.

Expected

Either apply plugin definitions (body, tools, disallowedTools, effort) to teammates the way they apply to subagents, or refuse or warn at spawn time and document the exclusion. Also apply disallowedTools/effort on the teammate path for every source.

Workaround

Turn agent teams off for sessions that spawn plugin agents by name, or spawn them unnamed.

View original on GitHub ↗