You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Claude Code's Bash tool runs commands inside a macOS sandbox-exec sandbox by default, restricting file system and network access. Additionally, Claude Code supports several permission and tool restriction modes via CLI flags:
--permission-mode <mode> — controls how tool permissions are handled (default, plan, acceptEdits, dontAsk, bypassPermissions)
--dangerously-skip-permissions — bypasses all permission checks (intended for sandboxed environments)
--allowed-tools <tools> / --disallowed-tools <tools> — whitelist/blacklist specific tools
--tools <tools> — restrict the available tool set entirely (e.g., "Read,Grep,Glob" for read-only)
--settings <json> — pass a settings file or JSON string to configure the session
Currently, the orchestrator's build_claude_command() function (in crates/orchestrator/src/manager.rs) constructs the claude CLI invocation but does not pass any of these security-related flags. All agents run with default permissions, meaning:
Sandbox is on by default for Bash (good), but agents can request dangerouslyDisableSandbox: true via the Bash tool parameter
There's no way to enforce --permission-mode plan or restrict the tool set
The /sandbox slash command is an interactive-mode feature that cannot be used in SDK mode (--sdk-url)
The Problem
Users want to create agents with explicit security postures — e.g., a read-only agent that can only use Read/Grep/Glob, or an agent in plan mode that can explore but not modify code, or a fully sandboxed agent with --dangerously-skip-permissions (paradoxically, this is the recommended mode for sandboxed environments because the sandbox itself provides the restriction).
Proposal
Add permission_mode, allowed_tools, disallowed_tools, and sandbox configuration to agent creation, and pass the corresponding CLI flags when launching Claude.
Agent Config Changes
// In crates/orchestrator/src/types.rspubstructAgentConfig{// ... existing fields .../// Permission mode for the claude session./// Maps to --permission-mode flag./// Options: "default", "plan", "acceptEdits", "dontAsk", "bypassPermissions"#[serde(skip_serializing_if = "Option::is_none")]pubpermission_mode:Option<String>,/// Allowed tools whitelist./// Maps to --allowed-tools flag./// e.g., ["Bash(git:*)", "Read", "Grep", "Glob"]#[serde(default, skip_serializing_if = "Vec::is_empty")]puballowed_tools:Vec<String>,/// Disallowed tools blacklist./// Maps to --disallowed-tools flag./// e.g., ["Bash", "Write", "Edit"]#[serde(default, skip_serializing_if = "Vec::is_empty")]pubdisallowed_tools:Vec<String>,/// Restrict to specific built-in tools only./// Maps to --tools flag./// e.g., ["Read", "Grep", "Glob", "WebFetch"]#[serde(default, skip_serializing_if = "Vec::is_empty")]pubtools:Vec<String>,/// Enable --dangerously-skip-permissions./// Intended for use WITH sandbox mode — the sandbox provides the security/// boundary, and skipping permissions avoids the agent blocking on prompts.#[serde(default)]pubskip_permissions:bool,}
# .agentd/agents/reviewer.ymlname: reviewerworking_dir: "."permission_mode: plantools:
- Read
- Grep
- Glob
- WebFetchsystem_prompt: | You are a code reviewer. Read and analyze code, but do not modify anything.
# .agentd/agents/sandboxed-worker.ymlname: sandboxed-workerworking_dir: "."skip_permissions: truedisallowed_tools:
- "Bash(rm:*)"
- "Bash(sudo:*)"system_prompt: | You are a worker agent. The sandbox restricts your file and network access.
Acceptance Criteria
Add permission_mode, allowed_tools, disallowed_tools, tools, and skip_permissions fields to AgentConfig
Add corresponding fields to CreateAgentRequest
Update build_claude_command() to pass the correct CLI flags
scripts/launch-planner.sh, scripts/launch-worker.sh — examples that could use these flags
Notes
The macOS sandbox-exec sandbox is always on by default for the Bash tool in Claude Code — this issue is about configuring the permission model and tool restrictions that layer on top of it
--dangerously-skip-permissions sounds dangerous but is actually the recommended approach for sandboxed agents: the sandbox provides the security boundary, and skipping permissions prevents the agent from blocking indefinitely on permission prompts that no human will answer
Interactive mode (config.interactive = true) agents don't use these flags since the user interacts directly
Dependencies
Related:#67 (orchestrator-level ToolPolicy provides defense-in-depth alongside Claude-level sandbox restrictions), #72 (YAML agent templates should support permission_mode/tools fields)
Context
Claude Code's Bash tool runs commands inside a macOS
sandbox-execsandbox by default, restricting file system and network access. Additionally, Claude Code supports several permission and tool restriction modes via CLI flags:--permission-mode <mode>— controls how tool permissions are handled (default,plan,acceptEdits,dontAsk,bypassPermissions)--dangerously-skip-permissions— bypasses all permission checks (intended for sandboxed environments)--allowed-tools <tools>/--disallowed-tools <tools>— whitelist/blacklist specific tools--tools <tools>— restrict the available tool set entirely (e.g.,"Read,Grep,Glob"for read-only)--settings <json>— pass a settings file or JSON string to configure the sessionCurrently, the orchestrator's
build_claude_command()function (incrates/orchestrator/src/manager.rs) constructs theclaudeCLI invocation but does not pass any of these security-related flags. All agents run with default permissions, meaning:dangerouslyDisableSandbox: truevia the Bash tool parameter--permission-mode planor restrict the tool set/sandboxslash command is an interactive-mode feature that cannot be used in SDK mode (--sdk-url)The Problem
Users want to create agents with explicit security postures — e.g., a read-only agent that can only use Read/Grep/Glob, or an agent in
planmode that can explore but not modify code, or a fully sandboxed agent with--dangerously-skip-permissions(paradoxically, this is the recommended mode for sandboxed environments because the sandbox itself provides the restriction).Proposal
Add
permission_mode,allowed_tools,disallowed_tools, andsandboxconfiguration to agent creation, and pass the corresponding CLI flags when launching Claude.Agent Config Changes
build_claude_command Changes
CLI Changes
YAML Template Support (from #72)
Acceptance Criteria
permission_mode,allowed_tools,disallowed_tools,tools, andskip_permissionsfields toAgentConfigCreateAgentRequestbuild_claude_command()to pass the correct CLI flags--permission-mode,--allowed-tools,--disallowed-tools,--tools,--skip-permissions--skip-permissionsis used without explaining sandbox intentget-agentandlist-agentsoutputbuild_claude_command()with various security configurationsInteraction with Tool Policy (#67, #68)
This feature and the orchestrator-level ToolPolicy (#67) provide defense in depth:
--tools,--allowed-tools,--permission-mode— restrict what the Claude model can even attempt to invokecan_use_toolcontrol requests and allows/denies/queues for approval at the WebSocket protocol levelBoth layers should be configurable independently. For maximum security, use both:
--tools "Read,Grep,Glob,Bash"(Claude-level: only these tools exist)AllowList ["Read", "Grep", "Glob", "Bash(git:*)"](Orchestrator-level: further restricts Bash usage patterns)Relevant Files
crates/orchestrator/src/types.rs—AgentConfig,CreateAgentRequestcrates/orchestrator/src/manager.rs—build_claude_command()crates/orchestrator/src/storage.rs— agent persistencecrates/cli/src/commands/orchestrator.rs—CreateAgentcommandscripts/launch-planner.sh,scripts/launch-worker.sh— examples that could use these flagsNotes
sandbox-execsandbox is always on by default for the Bash tool in Claude Code — this issue is about configuring the permission model and tool restrictions that layer on top of it--dangerously-skip-permissionssounds dangerous but is actually the recommended approach for sandboxed agents: the sandbox provides the security boundary, and skipping permissions prevents the agent from blocking indefinitely on permission prompts that no human will answerconfig.interactive = true) agents don't use these flags since the user interacts directlyDependencies
Related: #67 (orchestrator-level ToolPolicy provides defense-in-depth alongside Claude-level sandbox restrictions), #72 (YAML agent templates should support permission_mode/tools fields)