Clone
1
lessons/sprints/sprint-3---background-agent-permissions-must-be-pre-granted
Leo Miranda edited this page 2026-01-28 15:09:51 +00:00

Sprint 3 - Background Agent Permissions Must Be Pre-Granted

Metadata

Context

During Sprint 3, background agents were spawned to implement hook functionality across multiple plugins. These agents needed to write files, edit code, and run git commands.

Problem

Background agents failed silently because they didn't have permissions to use Write, Edit, or Bash tools. Permissions must be explicitly granted before spawning agents - they don't inherit the main session's permissions or prompt for them.

Solution

Added the required permissions to settings.local.json before spawning agents:

  • Write - for creating new files
  • Edit - for modifying existing files
  • Bash(git:*) - for git operations
  • Bash(mkdir:*) - for creating directories

Prevention

Before spawning background agents:

  1. Review what operations the agent needs to perform
  2. Pre-grant ALL required permissions in settings.local.json
  3. Include file write (Write, Edit) and relevant Bash commands
  4. Test with a simple operation before full execution

Permission checklist for agent tasks:

  • Creating files? Add Write
  • Modifying files? Add Edit
  • Git operations? Add Bash(git:*)
  • Directory creation? Add Bash(mkdir:*)
  • Running tests? Add Bash(pytest:*) or similar

Tags

agents, permissions, claude-code, sprint-3, hooks


Tags: agents, permissions, claude-code, sprint-3, hooks