Skip to content

Ignore the fields Claude Code ignores on a plugin agent - #421

Merged
ilovepixelart merged 1 commit into
mainfrom
fix/plugin-agent-fields
Nov 4, 2026
Merged

ilovepixelart merged 1 commit into
mainfrom
fix/plugin-agent-fields

Conversation

@ilovepixelart

Copy link
Copy Markdown
Owner

Plugin agents now follow Claude Code's plugin rules in extensions/subagent/agents.ts. Project and user agents are unchanged. Behavior was measured on Claude Code 2.1.318 with --plugin-dir, with a project agent as control, and the subagent docs state that plugin subagents do not support hooks or permissionMode "for security reasons".

Security

  • A plugin agent's hooks no longer reach the child (readAgentFile). hooks.PreToolUse in agents/hooky.md was passed to the child in PI_CODE_AGENT_HOOKS and ran there. The field is now dropped, and agentHooksEnv returns {} for that agent. A project agent's hooks still run.

Plugin agents that failed or differed

  • permissionMode is ignored on a plugin agent (readAgentFile). permissionMode: plan with no tools: gave read, grep, find, ls. The agent now has every tool. Behavior change: this widens a plugin agent that set plan.
  • A missing or empty description no longer rejects a plugin agent (parseAgentFile). name: nodesc with no description was dropped. It now loads with the description Agent from toolkit plugin.
  • Frontmatter that does not parse no longer rejects a plugin agent (readAgentFile). name: [unclosed dropped the file with a warning. It now loads as toolkit:<filename> with every field ignored and no warning. Behavior change: tools: in such a file is not applied, so the agent has every tool.

Verification

  • Biome, tsc, knip and vitest with coverage pass on macOS.
  • In pi 1.5.0 with a local model, a plugin agent's PreToolUse hook did not fire while a project agent's did, and a plugin agent with unparseable frontmatter loaded and ran.

Measured on Claude Code 2.1.318 with --plugin-dir, beside a project
agent as control: a plugin agent's hooks do not fire, permissionMode
does not restrict its tools, a missing description becomes "Agent from
<plugin> plugin", and frontmatter that does not parse still loads the
agent. The subagent docs state hooks and permissionMode are unsupported
on plugin agents for security reasons.
@sonarqubecloud

sonarqubecloud Bot commented Nov 4, 2026

Copy link
Copy Markdown

@ilovepixelart
ilovepixelart merged commit 4a3c4ca into main Nov 4, 2026
13 checks passed
@ilovepixelart
ilovepixelart deleted the fix/plugin-agent-fields branch November 4, 2026 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant