When you accept a permission in the parent session (via UI prompt or --dangerously-skip-permissions), that grant lives in the parent's session memory only. Child subagents spawned via the Agent tool start with a fresh permission state.
This means:
settings.json allows them for specific paths (#51287)Instead of accepting permissions at runtime, declare them upfront:
{
"permissions": {
"allow": [
"Edit",
"Write",
"Read",
"Bash(git *)",
"Bash(npm *)"
],
"deny": [
"Bash(rm -rf *)",
"Bash(git push --force *)"
]
}
}
Pre-declared permissions are read from settings.json at session start, so both parent and child agents see them.
npx @gaebalai/cc-guard --shield to set up a complete permission + hook configuration that works for both parent and subagent sessions.
Hooks execute for every tool call regardless of the session. A PreToolUse hook that auto-approves safe patterns works identically for parent and child:
// In settings.json
{
"hooks": {
"PreToolUse": [
{
"matcher": "Edit",
"hooks": [{
"type": "command",
"command": "bash ~/.claude/hooks/auto-approve-project-edits.sh"
}]
}
]
}
}
If you know you'll spawn subagents, set everything up in settings.json before starting the session. Runtime grants are ephemeral — they won't survive subagent dispatch.
If subagents need to edit files, use isolation: "worktree" in your Agent tool call. Each subagent gets its own git worktree with full write access, avoiding permission conflicts entirely.
Claude Code's permission model was designed for single-session use. The Agent tool dispatches child processes that inherit some parent state but not runtime permission grants. This is an architectural limitation that Anthropic will likely need to address at the framework level.
Until then, the safest approach is: if subagents need a permission, declare it in settings.json, not at runtime.