Subagent (Task tool) does not inherit permission allowlist from settings.json
Description
When using the Task tool to spawn a subagent, the child agent does not appear to inherit the permission allowlist from .claude/settings.json. This results in permission prompts for commands that should be pre-approved.
Steps to Reproduce
- Add a command pattern to
.claude/settings.jsonallowlist:
{
"permissions": {
"allow": [
"Bash(ctest:*)"
]
}
}
- Use the Task tool to spawn a subagent that runs the allowed command:
Task: Build and test project
Subagent runs: ctest --test-dir build --output-on-failure -j $(nproc)
- Observe that the subagent prompts for permission to run
ctest, despite it being in the allowlist.
Expected Behavior
Subagents spawned via the Task tool should inherit the permission allowlist from the parent session's .claude/settings.json. Commands matching allowed patterns should execute without prompting.
Actual Behavior
The subagent prompts for permission to run commands that are explicitly allowed in the settings file.
Environment
- Claude Code CLI
- Subagent spawned using Task tool with
subagent_type: build-test-lint
Additional Context
This affects workflows where custom agents are configured to run build/test commands autonomously. The workaround is to manually approve each command, but this defeats the purpose of the allowlist for automated pipelines.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗