Skip to content

Commit 2ad9cf5

Browse files
committed
chore: add shared Claude Code permissions for parallel worktree agents
Background agents in git worktrees need pre-approved tool permissions to avoid blocking on interactive prompts. Adds .claude/settings.json (committed) with allow rules for standard operations, documents the setup in AGENTS.md, and gitignores local-only Claude Code files.
1 parent 1f5bed0 commit 2ad9cf5

4 files changed

Lines changed: 50 additions & 0 deletions

File tree

‎.claude/settings.json‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(git *)",
5+
"Bash(npm run *)",
6+
"Bash(ls *)",
7+
"Bash(bd *)",
8+
"Bash(gh *)",
9+
"Bash(npx skills *)",
10+
"Edit",
11+
"Write",
12+
"Read",
13+
"Grep",
14+
"Glob",
15+
"WebSearch",
16+
"WebFetch"
17+
],
18+
"deny": [
19+
"Bash(git push --force *)",
20+
"Bash(rm -rf *)"
21+
]
22+
}
23+
}

‎.docs-plan/decisions.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,10 @@ Record decisions that constrain future work — things an agent needs to know th
130130
**Decision:** Never link to `internetcomputer.org/docs/` or `docs.internetcomputer.org` — these are the old docs being replaced by this project. Instead: (1) link to a page in this docs site using relative paths, even if it's still a stub, or (2) link to Learn Hub (`learn.internetcomputer.org`) for protocol internals, or (3) explain the concept inline if no suitable page exists yet.
131131
**Rationale:** Old docs URLs will break once the new site replaces the old one. Linking to stubs is fine — they'll have content by the time the site launches. If a topic has no planned page, flag it as a page proposal.
132132
**Alternatives considered:** Keep old links with a TODO to update later (easy to forget, broken links at launch)
133+
134+
## 2026-03-13: Shared Claude Code permissions for parallel worktree agents
135+
136+
**Context:** Background agents launched in git worktrees need Bash, Edit, Read, etc. but block waiting for interactive permission approval that never comes. Per-user settings at `~/.claude/projects/<path>/settings.json` don't apply to worktree agents because the worktree has a different filesystem path.
137+
**Decision:** Commit `.claude/settings.json` to the repo with pre-approved tools (git, npm, bd, gh, Edit, Write, Read, Grep, Glob). Deny destructive operations (force push, rm -rf). Gitignore `.claude/settings.local.json` and `.claude/worktrees/` (local-only).
138+
**Rationale:** Shared settings travel with the repo and apply to all agents regardless of working directory. Every developer gets the same permission baseline without manual configuration.
139+
**Alternatives considered:** Per-user project settings (doesn't apply to worktrees), fully permissive mode (too broad), manual approval (blocks background agents)

‎.gitignore‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ public/docs-manifest.json
2828
# macOS-specific files
2929
.DS_Store
3030

31+
# Claude Code (local-only files; .claude/settings.json is committed)
32+
.claude/settings.local.json
33+
.claude/worktrees/
34+
3135
# Dolt database files (added by bd init)
3236
.dolt/
3337
*.db

‎AGENTS.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,21 @@ All tasks (content pages, infrastructure, tooling) are coordinated through [Bead
3838

3939
If `bd` or `dolt` aren't installed, the script tells you how. Without them you can still write docs — check `.docs-plan/migration-plan.md` for tasks manually.
4040

41+
### Parallel agents (worktrees)
42+
43+
For batch operations like addressing PR feedback across multiple PRs, Claude Code can launch background agents in isolated git worktrees. Each agent works on a separate branch without conflicts.
44+
45+
**Prerequisites:**
46+
- `.claude/settings.json` (committed to git) pre-approves tools that agents need (Bash, Edit, Read, etc.). Without this, background agents block waiting for interactive permission approval that never comes.
47+
- `.claude/settings.local.json` and `.claude/worktrees/` are gitignored (local-only).
48+
49+
**How it works:**
50+
1. The parent agent claims tasks in Beads, then launches one background agent per PR using `isolation: "worktree"`
51+
2. Each agent gets its own git worktree (isolated copy of the repo), checks out its branch, makes edits, and commits
52+
3. The parent agent collects results, pushes branches, and posts feedback-addressed comments
53+
54+
**If agents fail with permission errors:** Check that `.claude/settings.json` exists and includes all required tools. The shared settings file is the authoritative source — per-user `~/.claude/projects/` settings don't apply to worktree agents (different path).
55+
4156
### Session start
4257

4358
```bash
@@ -298,6 +313,7 @@ Add enough context in the notes so the next agent (or human) understands the blo
298313
- `docs/guides/tools/migrating-from-dfx.md` — Synced from `dfinity/icp-cli` (do not edit directly)
299314
- `.docs-plan/` — Analysis artifacts, decisions, and progress tracking (see `.docs-plan/README.md`)
300315
- `.sources/` — **Pinned submodules of upstream source repos** (see "Source material repos" below)
316+
- `.claude/settings.json` — Shared Claude Code permissions (committed to git). Ensures worktree/background agents can run without interactive approval.
301317
- `icp.yaml` — icp-cli project config (asset canister recipe)
302318
- `.icp/data/` — Canister ID mappings (committed to git). `.icp/cache/` is gitignored.
303319

0 commit comments

Comments
 (0)