


dd4699dc72
Granular Tool Permission Buttons (#46284)
Adds buttons for confirming (and optionally persisting) granular
permissions on tool calls:
<img width="688" height="302" alt="Screenshot 2026-01-14 at 1 58 40 PM"
src="https://github.com/user-attachments/assets/3228cc39-efd5-4a73-989f-ddb28969847f"
/>
<img width="690" height="282" alt="Screenshot 2026-01-14 at 1 58 31 PM"
src="https://github.com/user-attachments/assets/8367a888-5728-4877-a502-1ff20ac929ec"
/>
## Features
### Tool Permission Settings
- **Per-tool rules** in `agent.tool_permissions.tools.<tool_name>`:
- `default_mode`: `"allow"`, `"deny"`, or `"confirm"` (default)
- `always_allow`: Array of regex patterns to auto-approve
- `always_deny`: Array of regex patterns to block
- `always_confirm`: Array of regex patterns requiring confirmation
- **Supported tools**: `terminal`, `edit_file`, `delete_path`,
`move_path`, `create_directory`, `save_file`, `copy_path`, `fetch`,
`web_search`
- **MCP tool support**: Third-party tools from context servers with
`mcp:<server>:<tool>` naming
### Smart Permission Buttons
When a tool requires confirmation, the dialog shows contextual buttons:
- **"Always allow \`<tool>\`"** - Sets `default_mode = "allow"` for the
tool
- **"Always allow \`<pattern>\`"** - Adds a pattern to `always_allow`:
- Terminal: Command name (e.g., `cargo`, `npm`, `git`)
- File tools: Parent directory path
- URL tools: Domain name
- **"Allow"** / **"Deny"** - One-time decision
### Pattern Extraction
Automatically extracts meaningful patterns from tool inputs:
- Terminal commands → `^cargo\s`, `^npm\s`, etc.
- File paths → `^/Users/alice/project/src/`
- URLs → `^https?://github\.com`
### Invalid Pattern Handling
- Malformed regex patterns are detected at settings load time
- Tools with invalid patterns show an error and block execution
- Clear error messages identify which pattern failed
## Changes
### New Files
- `crates/agent/src/tool_permissions.rs` - Permission evaluation logic
- `crates/agent/src/pattern_extraction.rs` - Pattern extraction
functions
### Modified Files
- `crates/agent_settings/src/agent_settings.rs` - `ToolPermissions`,
`ToolRules` structs
- `crates/settings/src/settings_content/agent.rs` - Settings schema and
serialization
- `crates/settings/src/settings_file.rs` - Helper methods for modifying
settings
- `crates/agent/src/thread.rs` - `authorize_with_context()`,
`authorize_third_party_tool()` methods
- `crates/agent/src/tools/*.rs` - Updated all granular tools to use
permission system
- `crates/agent/src/tools/context_server_registry.rs` - MCP tool
authorization
- `crates/agent_ui/src/acp/thread_view.rs` - Permission button UI,
removed Keep/Reject buttons
## Example Configuration
```json
{
"agent": {
"tool_permissions": {
"tools": {
"terminal": {
"default_mode": "confirm",
"always_allow": ["^cargo\\s", "^npm\\s", "^git\\s"],
"always_deny": ["^rm\\s+-rf", "^sudo\\s"]
},
"edit_file": {
"default_mode": "allow",
"always_deny": ["^\\.env", "^/etc/"]
},
"mcp:filesystem:write_file": {
"default_mode": "confirm"
}
}
}
}
}
```
Release Notes:
- You can now set per-tool permissions when confirming/denying tool use
---------
Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
Co-authored-by: Michael Benfield <mbenfield@zed.dev>
2026-01-14 19:39:04 +00:00
..
2026-01-14 13:49:51 -05:00
2025-12-29 11:01:19 -03:00
2026-01-14 13:49:51 -05:00
2026-01-07 12:48:24 -08:00
2026-01-14 19:39:04 +00:00
2026-01-14 14:41:31 +01:00
2026-01-14 19:39:04 +00:00
2026-01-14 19:39:04 +00:00
2026-01-14 10:57:43 +00:00
2025-12-18 17:05:04 -05:00
2026-01-08 10:59:03 +00:00
2026-01-14 07:19:13 +00:00
2025-10-17 18:58:14 +00:00
2025-10-17 18:58:14 +00:00
2026-01-14 07:19:13 +00:00
2026-01-09 17:13:00 +00:00
2026-01-07 12:48:24 -08:00
2026-01-07 12:48:24 -08:00
2025-11-11 12:55:19 +00:00
2026-01-07 12:48:24 -08:00
2025-10-17 18:58:14 +00:00
2025-12-17 12:54:57 +01:00
2026-01-06 09:42:00 -03:00
2026-01-14 07:19:13 +00:00
2026-01-07 12:48:24 -08:00
2026-01-07 12:48:24 -08:00
2025-12-16 01:22:41 +00:00
2026-01-14 07:19:13 +00:00
2025-11-06 09:16:45 +00:00
2025-11-10 23:00:55 -07:00
2025-10-17 18:58:14 +00:00
2026-01-13 15:27:31 +00:00
2026-01-14 07:19:13 +00:00
2026-01-14 12:31:49 +01:00
2026-01-14 07:19:13 +00:00
2025-10-17 18:58:14 +00:00
2026-01-14 07:19:13 +00:00
2025-10-17 18:58:14 +00:00
2025-10-17 18:58:14 +00:00
2026-01-14 07:19:13 +00:00
2026-01-07 12:48:24 -08:00
2026-01-14 14:44:13 +00:00
2026-01-14 14:44:13 +00:00
2026-01-14 14:44:13 +00:00
2026-01-14 07:19:13 +00:00
2026-01-07 12:48:24 -08:00
2026-01-14 07:19:13 +00:00
2025-12-08 19:57:02 +01:00
2025-10-17 18:58:14 +00:00
2026-01-14 07:19:13 +00:00
2026-01-07 12:48:24 -08:00
2026-01-14 07:19:13 +00:00
2025-12-18 12:47:34 +00:00
2025-10-17 18:58:14 +00:00
2026-01-07 12:48:24 -08:00
2025-12-18 21:59:05 -05:00
2026-01-14 14:44:13 +00:00
2026-01-13 21:53:44 +00:00
2026-01-13 13:31:23 -08:00
2026-01-06 17:20:25 -05:00
2026-01-14 14:44:13 +00:00
2026-01-14 17:43:38 +00:00
2026-01-07 07:24:46 +00:00
2026-01-12 18:07:41 +00:00
2025-12-18 17:26:20 +01:00
2025-10-17 18:58:14 +00:00
2025-12-18 17:05:04 -05:00
2025-12-17 16:25:07 -08:00
2025-12-08 21:49:26 +01:00
2026-01-14 07:19:13 +00:00
2026-01-07 12:48:24 -08:00
2026-01-14 13:49:51 -05:00
2025-10-17 18:58:14 +00:00
2026-01-07 12:48:24 -08:00
2025-10-17 18:58:14 +00:00
2026-01-14 07:19:13 +00:00
2025-10-20 10:30:06 +00:00
2025-12-26 18:47:53 +00:00
2025-12-08 19:50:20 +01:00
2026-01-14 07:19:13 +00:00
2026-01-05 16:15:21 +00:00
2026-01-14 17:43:38 +00:00
2025-12-17 16:51:16 +00:00
2025-12-17 20:12:40 -06:00
2026-01-14 07:19:13 +00:00
2026-01-14 07:19:13 +00:00
2026-01-07 12:48:24 -08:00
2025-10-17 18:58:14 +00:00
2025-12-09 09:29:40 -08:00
2025-10-17 18:58:14 +00:00
2025-12-15 13:02:01 -03:00
2026-01-14 11:49:38 +02:00
2026-01-07 12:48:24 -08:00
2026-01-07 12:48:24 -08:00
2025-11-19 22:00:58 +00:00
2026-01-07 12:48:24 -08:00
2026-01-08 17:32:38 -05:00
2026-01-14 07:19:13 +00:00
2025-12-09 13:22:57 +01:00
2025-12-19 15:04:41 -05:00
2026-01-14 14:44:13 +00:00
2025-10-17 18:58:14 +00:00
2026-01-07 12:48:24 -08:00
2026-01-14 14:44:13 +00:00
2026-01-14 16:52:39 +00:00
2025-10-22 19:52:38 +00:00
2025-10-17 18:58:14 +00:00
2026-01-14 07:19:13 +00:00
2025-10-17 18:58:14 +00:00
2026-01-14 07:19:13 +00:00
2026-01-13 22:38:28 -07:00
2025-12-29 11:01:19 -03:00
2025-10-17 18:58:14 +00:00
2025-12-30 07:49:01 -03:00
2025-12-16 07:51:28 -03:00
2026-01-14 07:19:13 +00:00
2025-12-18 09:49:32 +00:00
2026-01-14 07:19:13 +00:00
2026-01-06 08:14:34 +00:00
2025-10-17 18:58:14 +00:00
2025-12-17 16:53:42 +00:00
2026-01-07 12:48:24 -08:00
2025-11-11 16:10:47 +01:00
2025-12-17 16:51:16 +00:00
2026-01-10 17:40:20 +00:00
2025-11-24 13:24:26 -05:00
2026-01-14 08:06:55 -03:00
2026-01-13 16:39:41 +00:00
2025-10-17 18:58:14 +00:00
2025-12-10 12:10:43 -08:00
2025-12-30 13:29:44 -03:00
2026-01-07 12:48:24 -08:00
2026-01-14 14:44:13 +00:00
2026-01-09 20:22:29 +01:00
2026-01-14 07:19:13 +00:00
2026-01-14 07:19:13 +00:00
2026-01-07 12:48:24 -08:00
2026-01-13 13:39:07 +00:00
2026-01-14 11:49:21 +00:00
2025-12-15 13:30:13 +00:00
2025-11-27 13:46:43 +00:00
2026-01-14 11:49:21 +00:00
2026-01-14 07:19:13 +00:00
2026-01-14 07:19:13 +00:00
2025-12-09 09:29:40 -08:00
2025-11-03 19:25:15 +00:00
2025-12-31 20:02:45 -05:00
2025-12-29 20:21:59 +00:00
2026-01-08 22:39:06 -05:00
2026-01-14 07:19:13 +00:00
2025-12-16 10:48:14 -05:00
2026-01-14 07:19:13 +00:00
2026-01-14 07:19:13 +00:00
2026-01-14 19:39:04 +00:00
2025-10-27 10:13:26 -04:00
2025-11-21 08:28:17 -07:00
2025-11-07 22:27:14 +00:00
2026-01-14 14:44:13 +00:00
2025-10-17 18:58:14 +00:00
2026-01-11 15:08:34 +02:00
2025-10-17 18:58:14 +00:00
2025-10-17 18:58:14 +00:00
2025-10-17 18:58:14 +00:00
2025-10-17 18:58:14 +00:00
2026-01-14 07:19:13 +00:00
2025-11-03 19:25:15 +00:00
2025-12-15 08:25:50 +01:00
2026-01-04 23:28:18 +00:00
2026-01-04 23:28:18 +00:00
2025-12-27 23:29:36 +00:00
2025-11-24 13:34:04 +01:00
2025-12-16 08:26:29 +00:00
2025-12-04 15:37:32 -05:00
2025-12-09 09:08:59 +01:00
2025-11-07 11:36:05 +00:00
2025-11-24 13:34:04 +01:00
2026-01-14 07:19:13 +00:00
2026-01-14 09:32:08 +00:00
2025-12-31 20:02:45 -05:00
2026-01-13 15:38:13 -06:00
2025-10-17 18:58:14 +00:00
2025-10-17 18:58:14 +00:00
2025-12-01 20:52:57 -07:00
2025-10-17 18:58:14 +00:00
2026-01-13 18:48:51 -03:00
2026-01-07 12:48:24 -08:00
2026-01-13 18:48:51 -03:00
2026-01-07 10:52:51 +00:00
2025-10-17 18:58:14 +00:00
2025-10-17 18:58:14 +00:00
2026-01-13 07:56:02 +01:00
2025-10-17 18:58:14 +00:00
2025-10-17 18:58:14 +00:00
2026-01-14 10:55:15 +00:00
2025-11-07 22:27:14 +00:00
2025-10-17 18:58:14 +00:00
2025-10-17 18:58:14 +00:00
2025-10-17 18:58:14 +00:00
2025-12-17 11:53:48 -07:00
2026-01-14 10:41:46 -08:00
2026-01-14 07:19:13 +00:00
2026-01-07 12:48:24 -08:00
2025-12-08 16:38:34 +01:00
2026-01-14 13:49:51 -05:00
2026-01-13 13:39:07 +00:00
2025-12-13 11:06:30 -05:00
2026-01-13 21:53:44 +00:00
2025-12-06 17:56:49 +00:00
2025-11-07 22:27:14 +00:00
2025-12-17 16:14:57 +00:00
2025-12-05 17:23:06 +00:00