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
Copy file name to clipboardExpand all lines: packages/web/src/content/docs/agents.mdx
+44-22Lines changed: 44 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -149,29 +149,26 @@ Configure agents in your `opencode.json` config file:
149
149
"mode": "primary",
150
150
"model": "anthropic/claude-sonnet-4-20250514",
151
151
"prompt": "{file:./prompts/build.txt}",
152
-
"tools": {
153
-
"write": true,
154
-
"edit": true,
155
-
"bash": true
152
+
"permission": {
153
+
"edit": "allow",
154
+
"bash": "allow"
156
155
}
157
156
},
158
157
"plan": {
159
158
"mode": "primary",
160
159
"model": "anthropic/claude-haiku-4-20250514",
161
-
"tools": {
162
-
"write": false,
163
-
"edit": false,
164
-
"bash": false
160
+
"permission": {
161
+
"edit": "deny",
162
+
"bash": "deny"
165
163
}
166
164
},
167
165
"code-reviewer": {
168
166
"description": "Reviews code for best practices and potential issues",
169
167
"mode": "subagent",
170
168
"model": "anthropic/claude-sonnet-4-20250514",
171
169
"prompt": "You are a code reviewer. Focus on security, performance, and maintainability.",
172
-
"tools": {
173
-
"write": false,
174
-
"edit": false
170
+
"permission": {
171
+
"edit": "deny"
175
172
}
176
173
}
177
174
}
@@ -193,10 +190,9 @@ description: Reviews code for quality and best practices
193
190
mode: subagent
194
191
model: anthropic/claude-sonnet-4-20250514
195
192
temperature: 0.1
196
-
tools:
197
-
write: false
198
-
edit: false
199
-
bash: false
193
+
permission:
194
+
edit: deny
195
+
bash: deny
200
196
---
201
197
202
198
You are in code review mode. Focus on:
@@ -417,12 +413,39 @@ You can also use wildcards in legacy `tools` entries to control multiple tools a
417
413
418
414
### Permissions
419
415
420
-
You can configure permissions to manage what actions an agent can take. Currently, the permissions for the `edit`, `bash`, and `webfetch` tools can be configured to:
416
+
You can configure permissions to manage what actions an agent can take. Each permission key can be set to:
421
417
422
418
-`"ask"` — Prompt for approval before running the tool
423
419
-`"allow"` — Allow all operations without approval
|`external_directory`| Any tool that reads or writes files outside the project worktree |
434
+
|`todowrite`|`todowrite`, `todoread`|
435
+
|`webfetch`|`webfetch`|
436
+
|`websearch`|`websearch`|
437
+
|`codesearch`|`codesearch`|
438
+
|`lsp`|`lsp`|
439
+
|`skill`|`skill`|
440
+
|`question`|`question`|
441
+
|`doom_loop`| Recovery prompts when an agent appears stuck |
442
+
443
+
`read`, `edit`, `glob`, `grep`, `list`, `bash`, `task`, `external_directory`, `lsp`, and `skill` accept either a shorthand action (`"allow" | "ask" | "deny"`) or an object of glob/pattern → action for fine-grained control. The remaining keys accept the shorthand action only.
444
+
445
+
:::note
446
+
Permission keys are matched as wildcard patterns against the underlying tool name, so the same syntax works for built-ins, custom tools, and MCP tools — for example `"mymcp_*": "deny"` denies every tool from an MCP server, and `"mymcp_search": "ask"` targets a single one.
447
+
:::
448
+
426
449
```json title="opencode.json"
427
450
{
428
451
"$schema": "https://opencode.ai/config.json",
@@ -680,7 +703,7 @@ This interactive command will:
680
703
1. Ask where to save the agent; global or project-specific.
681
704
2. Description of what the agent should do.
682
705
3. Generate an appropriate system prompt and identifier.
683
-
4. Let you select which tools the agent can access.
706
+
4. Let you select which permissions the agent should be allowed (anything you don't select is denied).
684
707
5. Finally, create a markdown file with the agent configuration.
685
708
686
709
---
@@ -713,8 +736,8 @@ Do you have an agent you'd like to share? [Submit a PR](https://github.com/anoma
713
736
---
714
737
description: Writes and maintains project documentation
715
738
mode: subagent
716
-
tools:
717
-
bash: false
739
+
permission:
740
+
bash: deny
718
741
---
719
742
720
743
You are a technical writer. Create clear, comprehensive documentation.
@@ -735,9 +758,8 @@ Focus on:
735
758
---
736
759
description: Performs security audits and identifies vulnerabilities
737
760
mode: subagent
738
-
tools:
739
-
write: false
740
-
edit: false
761
+
permission:
762
+
edit: deny
741
763
---
742
764
743
765
You are a security expert. Focus on identifying potential security issues.
Copy file name to clipboardExpand all lines: packages/web/src/content/docs/cli.mdx
+13-1Lines changed: 13 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -93,7 +93,19 @@ Create a new agent with custom configuration.
93
93
opencode agent create
94
94
```
95
95
96
-
This command will guide you through creating a new agent with a custom system prompt and tool configuration.
96
+
This command will guide you through creating a new agent with a custom system prompt and permission configuration. Anything you don't allow is denied in the generated agent's frontmatter.
0 commit comments