claude-code - 💡(How to fix) Fix Agent tool `mode` parameter does not override sub-agent frontmatter `permissionMode` [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#55691Fetched 2026-05-03 04:47:00
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
labeled ×2

The Agent tool's mode parameter (e.g. mode: "bypassPermissions") does not override a sub-agent's YAML frontmatter permissionMode. When the sub-agent has no permissionMode declared, behaviour falls back to default mode — and the spawn-time mode parameter is silently a no-op.

The docs read as if the Agent tool parameter wins per-spawn. Empirically, the frontmatter wins (or the absence of frontmatter wins).

Root Cause

Hit this empirically while running a multi-agent planning session — three sub-agents (architect, business-analyst, service-experience-designer) all returned blockers when asked to write spec docs and open PRs. The parent session ended up doing all three sub-agents' git/write work directly because re-spawning didn't help. Investigation via /agents-style introspection of the claude-code docs identified the precedence gap.

Fix Action

Workaround

Set permissionMode: bypassPermissions directly in the sub-agent's YAML frontmatter. After this, the agent runs Bash + Write freely. The Agent tool's mode parameter then becomes a redundant safety belt rather than the load-bearing setting.

Code Example

---
name: architect
description: Technical architecture stewardship...
tools: Read, Write, Edit, Glob, Grep, Bash, Agent
model: sonnet
---

---

Agent({
  subagent_type: "architect",
  isolation: "worktree",
  mode: "bypassPermissions",
  run_in_background: true,
  prompt: "Write two files and open a PR"
})
RAW_BUFFERClick to expand / collapse

Summary

The Agent tool's mode parameter (e.g. mode: "bypassPermissions") does not override a sub-agent's YAML frontmatter permissionMode. When the sub-agent has no permissionMode declared, behaviour falls back to default mode — and the spawn-time mode parameter is silently a no-op.

The docs read as if the Agent tool parameter wins per-spawn. Empirically, the frontmatter wins (or the absence of frontmatter wins).

Reproduction

Sub-agent definition with no permissionMode field:

---
name: architect
description: Technical architecture stewardship...
tools: Read, Write, Edit, Glob, Grep, Bash, Agent
model: sonnet
---

Parent spawns it via Agent tool:

Agent({
  subagent_type: "architect",
  isolation: "worktree",
  mode: "bypassPermissions",
  run_in_background: true,
  prompt: "Write two files and open a PR"
})

Expected: sub-agent has Write + Bash without per-call permission prompts. Actual: sub-agent returns a blocking report saying Write and Bash are denied. Read and Glob work fine, so the tools list is correctly applied — only the permission gating is wrong.

Re-spawning the same task with mode: "bypassPermissions" set explicitly produces the identical blocker. The agent's own report says: "the environment is not honouring [bypassPermissions] for either Bash or Write."

Workaround

Set permissionMode: bypassPermissions directly in the sub-agent's YAML frontmatter. After this, the agent runs Bash + Write freely. The Agent tool's mode parameter then becomes a redundant safety belt rather than the load-bearing setting.

Suggested fix (pick one)

  1. Doc fix (low-risk) — make precedence explicit: "frontmatter permissionMode takes precedence over the Agent tool's mode parameter. To allow per-spawn override, set permissionMode in frontmatter to the most restrictive mode you'd ever want, then use the Agent tool's mode to widen it." (Or the inverse — whichever matches the actual behaviour.)
  2. Behaviour fix — make the Agent tool's mode parameter actually override frontmatter for the spawn. Matches the natural reading of the existing docs.

Context

Hit this empirically while running a multi-agent planning session — three sub-agents (architect, business-analyst, service-experience-designer) all returned blockers when asked to write spec docs and open PRs. The parent session ended up doing all three sub-agents' git/write work directly because re-spawning didn't help. Investigation via /agents-style introspection of the claude-code docs identified the precedence gap.

This is the second mid-session paper-cut from agent configuration where docs and behaviour disagree (the prior was issue #55680 about /agents not rescanning the filesystem). Both are small individually but together they erode confidence that running parallel sub-agents will work as advertised.

extent analysis

TL;DR

The Agent tool's mode parameter does not override a sub-agent's YAML frontmatter permissionMode, so setting permissionMode in the sub-agent's frontmatter is necessary to achieve the desired behavior.

Guidance

  • To fix the issue, set permissionMode: bypassPermissions directly in the sub-agent's YAML frontmatter, as this takes precedence over the Agent tool's mode parameter.
  • Verify that the sub-agent can run Bash and Write without permission prompts after making this change.
  • Consider updating the documentation to reflect the actual behavior, where frontmatter permissionMode takes precedence over the Agent tool's mode parameter.
  • If the desired behavior is for the Agent tool's mode parameter to override frontmatter, a code change may be necessary to achieve this.

Example

---
name: architect
description: Technical architecture stewardship...
tools: Read, Write, Edit, Glob, Grep, Bash, Agent
model: sonnet
permissionMode: bypassPermissions
---

Notes

The current behavior may not be immediately clear from the documentation, and making the Agent tool's mode parameter override frontmatter may require a code change.

Recommendation

Apply workaround: set permissionMode in the sub-agent's YAML frontmatter, as this is a low-risk change that can achieve the desired behavior.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING