{
  "$comment": "The permission posture `install --unattended` writes into ~/.claude/multi-agent-unattended.settings.json (never ~/.claude/settings.json, so attended sessions keep their own posture), one reason per entry, and the rule doctor's unattended-permissions check and the autopilot runner's launch precondition apply (lib/unattended-profile-check.mjs). The OS sandbox block is the boundary for Bash and everything it starts; the Edit and Read deny rules cover the file tools the sandbox does not; agent-guard.sh under MULTI_AGENT_UNATTENDED=1 is a second layer over both (multi-agent-refs/features/unattended-security.md). Keys checked against the Claude Code settings reference: permissions.defaultMode, permissions.allow, permissions.deny, env, sandbox.enabled, sandbox.failIfUnavailable, sandbox.allowUnsandboxedCommands, sandbox.autoAllowBashIfSandboxed, sandbox.enableWeakerNetworkIsolation, sandbox.filesystem.allowWrite, sandbox.filesystem.denyWrite, sandbox.filesystem.denyRead, sandbox.network.allowedDomains, sandbox.network.strictAllowlist, sandbox.network.allowLocalBinding, sandbox.network.allowMachLookup.",
  "defaultMode": {
    "value": "dontAsk",
    "why": "a call that would prompt is denied instead of waiting for a person who is not there"
  },
  "wideAllows": [
    {
      "rule": "Bash",
      "why": "a bare Bash allow in ~/.claude/settings.json lets every command through; permission lists merge across files, so it would apply to an unattended run too. Reported, never removed: that file is the attended posture"
    },
    {
      "rule": "Bash(*)",
      "why": "Bash(*) is a whole-Bash allow, the same as bare Bash; reported, never removed"
    },
    {
      "rule": "Bash(:*)",
      "why": "Bash(:*) is a whole-Bash allow, the same as bare Bash; reported, never removed"
    },
    {
      "rule": "Bash(**)",
      "why": "Bash(**) is a whole-Bash allow, the same as bare Bash; reported, never removed"
    }
  ],
  "allow": [
    ["Read", "reading the repo it was pointed at"],
    ["Glob", "finding files by pattern"],
    ["Grep", "searching file content"],
    [
      "Edit",
      "Phase 2 changes files; protected paths and manifests are denied below and by agent-guard"
    ],
    ["Write", "new files and every artefact a phase leaves behind; same limits as Edit"],
    ["NotebookEdit", "notebooks in the repo; same limits as Edit"],
    ["Agent", "Phase 1 and Phase 3 dispatch subagents"],
    ["Skill", "the phase specs are skills"],
    ["WebFetch", "issue and ticket bodies referenced by URL (reads only)"],
    ["TaskCreate", "the phase tracker's task list"],
    ["TaskUpdate", "the same"],
    ["TaskList", "the same"],
    ["TaskGet", "the same"],
    ["mcp__multi-agent__*", "simulator, build and design tools; research tools are denied below"],
    ["Bash(git *)", "status, diff, add, commit, log; pushes are denied below and by agent-guard"],
    [
      "Bash(gh *)",
      "reads of issues and PRs; every write is blocked by agent-guard when unattended"
    ],
    ["Bash(bash *)", "the pipeline's own scripts under ~/.claude/scripts and ~/.claude/lib"],
    ["Bash(node *)", "the pipeline's own .mjs scripts and the repo's node tooling"],
    ["Bash(python3 *)", "the pipeline's Python helpers"],
    ["Bash(jq *)", "state and payload reads"],
    ["Bash(npm run *)", "the repo's own build and test scripts"],
    ["Bash(npm test *)", "the same"],
    ["Bash(npm ci *)", "restore from the committed lockfile"],
    [
      "Bash(npx *)",
      "binaries already in the repo's node_modules; npx --yes is blocked by agent-guard"
    ],
    ["Bash(xcodebuild *)", "iOS build and test"],
    ["Bash(xcrun simctl *)", "simulator control"],
    ["Bash(xcrun xcresulttool *)", "reading test result bundles"],
    ["Bash(xcrun xctrace *)", "performance traces"],
    ["Bash(xcrun --find *)", "toolchain lookups"],
    ["Bash(swift *)", "SwiftPM build and test"],
    ["Bash(./gradlew *)", "Android build and test"],
    [
      "Bash(pod install *)",
      "restore from the committed Podfile.lock; blocked by agent-guard once the Podfile changed"
    ],
    ["Bash(pytest *)", "Python tests"],
    ["Bash(go test *)", "Go tests"],
    ["Bash(go build *)", "Go builds"],
    ["Bash(cargo test *)", "Rust tests"],
    ["Bash(cargo build *)", "Rust builds"],
    ["Bash(make *)", "repos whose entry point is a Makefile"],
    ["Bash(ls *)", "listing"],
    ["Bash(cat *)", "reading"],
    ["Bash(head *)", "reading"],
    ["Bash(tail *)", "reading"],
    ["Bash(wc *)", "counting"],
    ["Bash(find *)", "finding"],
    ["Bash(grep *)", "searching"],
    ["Bash(rg *)", "searching"],
    ["Bash(sed *)", "text filtering; in-place edits of protected paths are blocked by agent-guard"],
    ["Bash(awk *)", "text filtering"],
    ["Bash(sort *)", "text filtering"],
    ["Bash(diff *)", "comparing"],
    ["Bash(mkdir *)", "creating directories"],
    ["Bash(cp *)", "copying; protected destinations are blocked by agent-guard"],
    ["Bash(mv *)", "moving; protected destinations are blocked by agent-guard"],
    ["Bash(echo *)", "output"],
    ["Bash(printf *)", "output"],
    ["Bash(date *)", "timestamps"],
    ["Bash(cd *)", "changing directory inside the worktree"]
  ],
  "deny": [
    ["Bash(gh pr merge *)", "merging is a person's decision"],
    ["Bash(git push *)", "the runner pushes, after it verified pr-request.json"],
    ["Bash(git push)", "the same, with no arguments"],
    ["Read(~/.ssh/**)", "SSH keys"],
    ["Read(~/.aws/**)", "cloud credentials"],
    ["Read(~/.gnupg/**)", "signing keys"],
    ["Read(~/Library/Keychains/**)", "the Keychain database files"],
    ["Read(~/.netrc)", "plaintext host credentials"],
    ["Read(~/.git-credentials)", "plaintext git credentials"],
    ["Read(~/.docker/config.json)", "registry credentials"],
    ["Read(~/.kube/**)", "cluster credentials"],
    ["Read(~/.config/gcloud/**)", "cloud credentials"],
    ["Read(~/.azure/**)", "cloud credentials"],
    ["Read(~/.config/op/**)", "password manager CLI session"],
    ["Read(~/.terraform.d/**)", "infrastructure provider tokens"],
    ["Read(~/.pypirc)", "package index credentials"],
    ["Read(~/Library/Cookies/**)", "browser session cookies"],
    ["Read(~/Library/Application Support/Google/Chrome/**)", "browser cookies and saved passwords"],
    ["Read(~/Library/Application Support/Firefox/**)", "browser cookies and saved passwords"],
    ["Read(~/Library/Application Support/com.apple.Safari/**)", "browser history and session data"],
    ["Read(~/.android/adbkey)", "the adb private key a device trusts"],
    ["Read(~/.appstoreconnect/**)", "App Store Connect API keys"],
    ["Read(~/.private_keys/**)", "App Store Connect API keys (altool default location)"],
    ["Read(~/private_keys/**)", "App Store Connect API keys (altool default location)"],
    ["Read(~/.config/configstore/**)", "CLI tokens kept by configstore (Firebase and others)"],
    ["Read(~/.config/github-copilot/**)", "the Copilot OAuth token"],
    ["Read(~/.local/share/gh/**)", "GitHub CLI data and extensions"],
    ["Read(~/.zsh_history)", "shell history, which holds pasted tokens"],
    ["Read(~/.bash_history)", "shell history, which holds pasted tokens"],
    ["Read(~/.gradle/gradle.properties)", "signing and repository credentials"],
    [
      "Read(~/.gradle/**)",
      "init scripts, the configuration cache key store and daemon state that may hold credentials; a run uses its own Gradle home and downloads what it needs into it"
    ],
    ["Read(~/Library/Application Support/Code/**)", "VS Code state, including extension tokens"],
    [
      "Read(~/Library/Application Support/Microsoft Edge/**)",
      "browser cookies and saved passwords"
    ],
    ["Read(~/Library/Application Support/BraveSoftware/**)", "browser cookies and saved passwords"],
    ["Read(~/Library/Application Support/Arc/**)", "browser cookies and saved passwords"],
    ["Read(~/Library/Application Support/com.vercel.cli/**)", "the Vercel CLI token"],
    [
      "Read(~/.claude/logs/multi-agent/contract-server/**)",
      "the local contract server's bearer token, which can start sessions"
    ],
    [
      "Edit(~/.claude/**)",
      "the installed pipeline, its settings, this profile and the runner's files; a run writes its logs and its PR request under the unattended run directory instead"
    ],
    ["Edit(~/.copilot/**)", "the Copilot CLI twin of the installed pipeline"],
    ["Edit(~/.codex/**)", "the Codex twin of the installed pipeline"],
    ["Edit(~/.claude.json)", "Claude Code's own state and MCP server list"],
    ["Edit(~/Library/LaunchAgents/**)", "per-user launchd jobs run as the operator"],
    ["Edit(~/.zshrc)", "shell startup file"],
    ["Edit(~/.zshenv)", "shell startup file"],
    ["Edit(~/.zprofile)", "shell startup file"],
    ["Edit(~/.zlogin)", "shell startup file"],
    ["Edit(~/.zlogout)", "shell startup file"],
    ["Edit(~/.bashrc)", "shell startup file"],
    ["Edit(~/.bash_profile)", "shell startup file"],
    ["Edit(~/.bash_login)", "shell startup file"],
    ["Edit(~/.profile)", "shell startup file"],
    ["Edit(~/.ssh/**)", "SSH keys and their config"],
    ["Edit(~/.gnupg/**)", "signing keys and their config"],
    ["Edit(~/.config/gh/**)", "the GitHub CLI's hosts and config"],
    ["Edit(~/.config/git/**)", "the XDG git config"],
    ["Edit(~/.gitconfig)", "the user's git config"],
    ["Edit(~/.npmrc)", "npm registry and token configuration"],
    ["Edit(~/.netrc)", "plaintext host credentials"],
    ["Edit(~/.git-credentials)", "plaintext git credentials"],
    ["Edit(~/.gradle/init.d/**)", "Gradle init scripts run in every build"],
    ["Edit(~/.gradle/init.gradle)", "the Gradle init script run in every build"],
    ["Edit(~/.gradle/init.gradle.kts)", "the Gradle init script run in every build"],
    [
      "Edit(~/.multi-agent-unattended-homes/**)",
      "the unattended data directory (links to the operator's data, rebuilt before every launch) and the quarantine finished Gradle homes are deleted from"
    ],
    [
      "Edit(~/.config/multi-agent-pipeline/**)",
      "a preferences file the pipeline and agent-guard read, the same as ~/.claude/multi-agent-preferences.json"
    ],
    [
      "Edit(~/.config/multi-agent-mcp/**)",
      "the toolkit's store reference file, which names the Keychain items its store tools use"
    ],
    [
      "Edit(~/.config/multi-agent-toolkit/**)",
      "the same file at its earlier path, which the toolkit reads while the current one is absent"
    ],
    ["Edit(~/.lldbinit)", "commands lldb runs at start"],
    ["Edit(~/.curlrc)", "options curl applies to every request"],
    ["Edit(.git/hooks/**)", "hooks run on the next git command"],
    ["Edit(.git/config)", "the repository's git config"],
    ["Edit(**/.github/workflows/**)", "CI definitions run with the repo's secrets"],
    ["mcp__multi-agent__research_*", "research tools send the query to an outside service"]
  ],
  "env": [
    [
      "MCP_TOOLKIT_URL_POLICY",
      "strict",
      "web_goto, web_crawl, web_map and web_scrape refuse loopback, link-local and metadata addresses"
    ],
    [
      "MCP_TOOLKIT_INDEX_DENY",
      "~/.ssh,~/.aws,~/.gnupg,~/Library/Keychains,~/.netrc,~/.git-credentials,~/.docker/config.json,~/.kube,~/.config/gcloud,~/.azure,~/.config/op,~/.terraform.d,~/.pypirc,~/Library/Cookies,~/Library/Application Support/Google/Chrome,~/Library/Application Support/Firefox,~/Library/Application Support/com.apple.Safari,~/.android/adbkey,~/.appstoreconnect,~/.private_keys,~/private_keys,~/.config/configstore,~/.config/github-copilot,~/.local/share/gh,~/.zsh_history,~/.bash_history,~/.gradle/gradle.properties,~/.gradle,~/Library/Application Support/Code,~/Library/Application Support/Microsoft Edge,~/Library/Application Support/BraveSoftware,~/Library/Application Support/Arc,~/Library/Application Support/com.vercel.cli,~/.claude/logs/multi-agent/contract-server,~/.claude/logs/multi-agent/office",
      "context_index never indexes, and context_get never returns, credential directories"
    ],
    [
      "XDG_DATA_HOME",
      "~/.multi-agent-unattended-homes/xdg-data",
      "gh reads its data directory from here, rebuilt before every launch as links into the operator's data directory without gh, so it never needs ~/.local/share/gh, which the sandbox denies; gh extensions are not available unattended"
    ]
  ],
  "gradleRunHome": {
    "parent": "~/.multi-agent-unattended",
    "why": "Gradle uses a user home of its own per run, <parent>/run-<session id>-<random>/gradle-home, so it never needs ~/.gradle, which the sandbox denies. It is not in this file: the runner and the office build it before each launch where no run can write (lib/unattended-tool-homes.mjs createRunLaunch), with a gradle.properties holding only org.gradle.daemon=false, move it into the run directory, and launch the run with a settings file of its own, ~/.multi-agent-unattended-homes/launch/<session id>.json: this profile with that run directory added to allowWrite and GRADLE_USER_HOME and GRADLE_OPTS=-Dorg.gradle.daemon=false added to env, and no other Gradle variable. The launch precondition accepts exactly that file and that home for the session. Nothing in it persists and no Gradle cache is shared with it: it is removed once the run ends, so every run downloads its dependencies, its Gradle distribution and its JDK toolchains"
  },
  "sandbox": {
    "$comment": "Always written. On macOS the sandbox is Seatbelt. failIfUnavailable makes a missing sandbox a refusal to start; allowUnsandboxedCommands false removes the unsandboxed retry; autoAllowBashIfSandboxed false keeps the allow list above in force for sandboxed commands; no excludedCommands, so every command runs sandboxed. Writes are limited to the working directory, the session temp directory and allowWrite; ~/.claude is also protected by Claude Code itself. In-repo paths are denied through the Edit deny rules above, which Claude Code adds to denyWrite: a relative denyWrite entry in a --settings file does not resolve to the repository. enableWeakerNetworkIsolation lets Go tools such as gh reach the macOS trust service to verify TLS; network egress stays limited to allowedDomains. allowMachLookup lets xcrun simctl reach the simulator service. ~/.multi-agent-unattended-homes, the tool-home parent, is in denyWrite as a whole: nothing in it is the run's to write. ~/.multi-agent-unattended itself is in no allowWrite entry and in no denyWrite entry: only its shared directories (logs, pr-requests, repo-profiles, toolkit-index) are listed here, and each launch adds its own run directory in the settings file it is launched with. It is not denied because the sandbox gives denyWrite precedence over allowWrite, so a deny on it would also deny the run directory below it. ~/.gradle is in denyWrite and in denyRead as a whole (init scripts, the configuration cache key store, daemon state); a run uses a Gradle home of its own and downloads what it needs into it.",
    "enabled": true,
    "failIfUnavailable": true,
    "allowUnsandboxedCommands": false,
    "autoAllowBashIfSandboxed": false,
    "enableWeakerNetworkIsolation": true,
    "filesystem": {
      "allowWrite": [
        "~/.multi-agent-unattended/logs",
        "~/.multi-agent-unattended/pr-requests",
        "~/.multi-agent-unattended/repo-profiles",
        "~/.multi-agent-unattended/toolkit-index",
        "~/.npm",
        "~/Library/Caches/Yarn",
        "~/.m2/repository",
        "~/.cargo/registry",
        "~/.cargo/git",
        "~/go/pkg/mod",
        "~/Library/Caches/go-build",
        "~/Library/Caches/pip",
        "~/Library/Caches/CocoaPods",
        "~/Library/Caches/org.swift.swiftpm",
        "~/Library/Caches/com.apple.dt.Xcode",
        "~/Library/Developer/Xcode/DerivedData"
      ],
      "denyWrite": [
        "~/.claude",
        "~/.copilot",
        "~/.codex",
        "~/.claude.json",
        "~/Library/LaunchAgents",
        "~/.zshrc",
        "~/.zshenv",
        "~/.zprofile",
        "~/.zlogin",
        "~/.zlogout",
        "~/.bashrc",
        "~/.bash_profile",
        "~/.bash_login",
        "~/.profile",
        "~/.ssh",
        "~/.gnupg",
        "~/.config/gh",
        "~/.config/git",
        "~/.gitconfig",
        "~/.npmrc",
        "~/.netrc",
        "~/.git-credentials",
        "~/.gradle/init.d",
        "~/.gradle/init.gradle",
        "~/.gradle/init.gradle.kts",
        "~/.gradle/gradle.properties",
        "~/.multi-agent-unattended-homes",
        "~/.config/multi-agent-pipeline",
        "~/.config/multi-agent-mcp",
        "~/.config/multi-agent-toolkit",
        "~/.gradle",
        "~/.lldbinit",
        "~/.curlrc"
      ],
      "denyRead": [
        "~/.ssh",
        "~/.aws",
        "~/.gnupg",
        "~/Library/Keychains",
        "~/.netrc",
        "~/.git-credentials",
        "~/.docker/config.json",
        "~/.kube",
        "~/.config/gcloud",
        "~/.azure",
        "~/.config/op",
        "~/.terraform.d",
        "~/.pypirc",
        "~/Library/Cookies",
        "~/Library/Application Support/Google/Chrome",
        "~/Library/Application Support/Firefox",
        "~/Library/Application Support/com.apple.Safari",
        "~/.android/adbkey",
        "~/.appstoreconnect",
        "~/.private_keys",
        "~/private_keys",
        "~/.config/configstore",
        "~/.config/github-copilot",
        "~/.local/share/gh",
        "~/.zsh_history",
        "~/.bash_history",
        "~/.gradle/gradle.properties",
        "~/.gradle",
        "~/Library/Application Support/Code",
        "~/Library/Application Support/Microsoft Edge",
        "~/Library/Application Support/BraveSoftware",
        "~/Library/Application Support/Arc",
        "~/Library/Application Support/com.vercel.cli",
        "~/.claude/logs/multi-agent/contract-server"
      ]
    },
    "network": {
      "strictAllowlist": true,
      "allowLocalBinding": true,
      "allowMachLookup": ["com.apple.coresimulator.*"],
      "allowedDomains": [
        "github.com",
        "api.github.com",
        "codeload.github.com",
        "objects.githubusercontent.com",
        "raw.githubusercontent.com",
        "registry.npmjs.org",
        "registry.yarnpkg.com",
        "pypi.org",
        "files.pythonhosted.org",
        "repo.maven.apache.org",
        "repo1.maven.org",
        "dl.google.com",
        "maven.google.com",
        "plugins.gradle.org",
        "plugins-artifacts.gradle.org",
        "services.gradle.org",
        "downloads.gradle.org",
        "cdn.cocoapods.org",
        "proxy.golang.org",
        "sum.golang.org",
        "index.crates.io",
        "static.crates.io",
        "rubygems.org"
      ]
    }
  }
}
