-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Part of #974
Background
Claude Code's agent frontmatter supports a permissionMode field that controls how the agent interacts with permission prompts: default (prompts user), acceptEdits (auto-accepts file edits), dontAsk (auto-accepts everything except shell), bypassPermissions (no prompts at all), and plan (read-only planning mode). This lets automated or trusted agents run without interactive approval while keeping interactive agents safe.
Current state in Zeph
SubAgentPermissions has secrets: bool and background: bool flags but no unified permission mode concept. The FilteredToolExecutor enforces tool policy but does not distinguish between interactive approval and automatic bypass. Zeph currently has no interactive permission prompt system.
Implementation
-
Define
PermissionModeenum:pub enum PermissionMode { Default, // tools follow normal ToolPolicy; destructive tools may prompt AcceptEdits, // file write/edit tools are auto-approved DontAsk, // all tools auto-approved except shell (requires explicit allow) BypassPermissions, // all tools auto-approved including shell Plan, // no tool calls permitted; agent output is plan text only }
-
Add
permission_mode: PermissionModetoSubAgentDefandAgentFileSpec. -
Integrate into
FilteredToolExecutor:Planmode: all tool calls returnErr(ToolBlocked::PlanMode)immediately.BypassPermissions: skip all policy checks.DontAsk: auto-approve all exceptshell; shell requires explicitallow.AcceptEdits: auto-approvewrite_file,edit_file,create_filewithout prompting.Default: existing behavior unchanged.
-
Add
permission_modeto the[agent]TOML config section for runtime override. -
CLI flag:
--permission-mode <mode>foragent runsubcommand.
Acceptance criteria
-
permission_mode: planblocks all tool calls and returns a typed error. -
permission_mode: bypass_permissionsskipsFilteredToolExecutorpolicy evaluation entirely. -
permission_mode: dont_askpermits all non-shell tools automatically. -
permission_mode: accept_editsauto-approves file mutation tools. -
PermissionModeimplementsserde::Deserializewith#[serde(rename_all = "snake_case")]. - Unit tests cover each mode variant's allow/block behavior.
-
cargo nextest run -p zeph-corepasses.
Technical notes
PermissionMode::Defaultmaps to currentFilteredToolExecutorlogic — no behavioral change for existing agents.Planmode system prompt injection: prepend a system message reminding the agent it is in plan-only mode (belt-and-suspenders alongside the tool block).- Keep
PermissionModeinzeph-core/src/subagent/permission.rs. --permission-mode bypass_permissionsshould emit awarn!log entry noting the elevated permission level.