pub enum PermissionMode {
Default,
AcceptEdits,
BypassPermissions,
DontAsk,
Plan {
pre_plan_mode: Box<PermissionMode>,
bypass_available: bool,
},
Auto,
Strict,
}Expand description
The session-wide permission mode, determining runtime behaviour for tool dispatch.
This is separate from the per-tool allow/deny/interactive lists in the layered config — the mode acts as a top-level policy on top of those static rules.
§Serde
This enum supports both the new camelCase names and the old snake_case names for backward compatibility:
| New | Old aliases |
|---|---|
default | allow |
acceptEdits | — |
bypassPermissions | — |
dontAsk | deny, interactive |
plan (string) | plan |
The plan variant also accepts an object form:
{"prePlanMode": "default", "bypassAvailable": false}.
Variants§
Default
Normal mode: follow static allow/deny rules, defer to Passthrough for unknown tools.
AcceptEdits
Auto-allow write tools within the workspace.
BypassPermissions
Skip all rule checks; every tool is allowed.
DontAsk
Deny any tool that is in the interactive list.
Plan
Plan mode: blocks write tools (except exit_plan_mode).
pre_plan_mode stores the mode to restore on exit.
bypass_available allows writes to bypass plan-mode blocking
when the agent was in BypassPermissions before entering plan.
Fields
pre_plan_mode: Box<PermissionMode>The mode that was active before entering plan mode.
Auto
Auto mode: delegate every tool-call decision to an LLM classifier.
The classifier receives the tool name, argument summary, and recent
conversation context and returns {"block": true|false, "reason": "..."}.
A denial tracker prevents runaway loops (3 consecutive / 10 total
denials → all subsequent calls denied).
Strict
Strict mode: treat Permission::Unknown as Denied.
Any tool that does not have an explicit allow rule is blocked.
This is the safest default for untrusted or audited environments.
Use bypassPermissions to skip all checks, or default to restore
the lenient “unknown = allowed” semantics.
Trait Implementations§
Source§impl Clone for PermissionMode
impl Clone for PermissionMode
Source§impl Debug for PermissionMode
impl Debug for PermissionMode
Source§impl Default for PermissionMode
impl Default for PermissionMode
Source§impl<'de> Deserialize<'de> for PermissionMode
impl<'de> Deserialize<'de> for PermissionMode
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
impl Eq for PermissionMode
Source§impl PartialEq for PermissionMode
impl PartialEq for PermissionMode
Source§impl Serialize for PermissionMode
impl Serialize for PermissionMode
impl StructuralPartialEq for PermissionMode
Auto Trait Implementations§
impl Freeze for PermissionMode
impl RefUnwindSafe for PermissionMode
impl Send for PermissionMode
impl Sync for PermissionMode
impl Unpin for PermissionMode
impl UnsafeUnpin for PermissionMode
impl UnwindSafe for PermissionMode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.