summaryrefslogtreecommitdiffhomepage
path: root/packages/web/src/content/docs/agents.mdx
diff options
context:
space:
mode:
authorJay V <[email protected]>2025-10-08 12:13:38 -0400
committerJay V <[email protected]>2025-10-08 12:13:42 -0400
commit1d621260ff83751e70859c3f4c6a834bb481ed81 (patch)
treeebc5f2a4c9b7dbd4c25e9b632ce07d4aea496ceb /packages/web/src/content/docs/agents.mdx
parenta63fa64dece5a75082f4a5335d1f4bd20af8cc50 (diff)
downloadopencode-1d621260ff83751e70859c3f4c6a834bb481ed81.tar.gz
opencode-1d621260ff83751e70859c3f4c6a834bb481ed81.zip
docs: fix permission docs
Diffstat (limited to 'packages/web/src/content/docs/agents.mdx')
-rw-r--r--packages/web/src/content/docs/agents.mdx104
1 files changed, 36 insertions, 68 deletions
diff --git a/packages/web/src/content/docs/agents.mdx b/packages/web/src/content/docs/agents.mdx
index 82d3c8ccb..7016d6576 100644
--- a/packages/web/src/content/docs/agents.mdx
+++ b/packages/web/src/content/docs/agents.mdx
@@ -362,42 +362,33 @@ Here are all the tools can be controlled through the agent config.
### Permissions
-Permissions control what actions an agent can take.
+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:
-- edit, bash, webfetch
-
-Each permission can be set to allow, ask, or deny.
-
-- allow, ask, deny
-
-Configure permissions globally in opencode.json.
+- `"ask"` — Prompt for approval before running the tool
+- `"allow"` — Allow all operations without approval
+- `"deny"` — Disable the tool
```json title="opencode.json"
{
"$schema": "https://opencode.ai/config.json",
"permission": {
- "edit": "ask",
- "bash": "allow",
- "webfetch": "deny"
+ "edit": "deny"
}
}
```
-You can override permissions per agent in JSON.
+You can override these permissions per agent.
-```json title="opencode.json" {7-18}
+```json title="opencode.json" {3-5,8-10}
{
"$schema": "https://opencode.ai/config.json",
+ "permission": {
+ "edit": "deny"
+ },
"agent": {
"build": {
"permission": {
- "edit": "allow",
- "bash": {
- "*": "allow",
- "git push": "ask",
- "terraform *": "deny"
- },
- "webfetch": "ask"
+ "edit": "ask"
}
}
}
@@ -419,83 +410,60 @@ permission:
Only analyze code and suggest changes.
```
-Bash permissions support granular patterns for fine-grained control.
-
-```json title="Allow most, ask for risky, deny terraform"
-{
- "$schema": "https://opencode.ai/config.json",
- "permission": {
- "bash": {
- "*": "allow",
- "git push": "ask",
- "terraform *": "deny"
- }
- }
-}
-```
-
-If you provide a granular bash map, the default becomes ask unless you set \* explicitly.
+You can set permissions for specific bash commands.
-```json title="Granular defaults to ask"
+```json title="opencode.json" {7}
{
"$schema": "https://opencode.ai/config.json",
- "permission": {
- "bash": {
- "git status": "allow"
- }
- }
-}
-```
-
-Agent-level permissions merge over global settings.
-
-- Global sets defaults; agent overrides when specified
-
-Specific bash rules can override a global default.
-
-```json title="Global ask, agent allows safe commands"
-{
- "$schema": "https://opencode.ai/config.json",
- "permission": { "bash": "ask" },
"agent": {
"build": {
"permission": {
- "bash": { "git status": "allow", "*": "ask" }
+ "bash": {
+ "git push": "ask"
+ }
}
}
}
}
```
-Permissions affect tool availability and prompts differently.
-
-- deny hides tools (edit also hides write/patch); ask prompts; allow runs
-
-For quick reference, here are common setups.
+This can take a glob pattern.
-```json title="Read-only reviewer"
+```json title="opencode.json" {7}
{
"$schema": "https://opencode.ai/config.json",
"agent": {
- "review": {
- "permission": { "edit": "deny", "bash": "deny", "webfetch": "allow" }
+ "build": {
+ "permission": {
+ "bash": {
+ "git *": "ask"
+ }
+ }
}
}
}
```
-```json title="Planning agent that can browse but cannot change code"
+And you can also use the `*` wildcard to manage permissions for all commands.
+Where the specific rule can override the `*` wildcard.
+
+```json title="opencode.json" {8}
{
"$schema": "https://opencode.ai/config.json",
"agent": {
- "plan": {
- "permission": { "edit": "deny", "bash": "deny", "webfetch": "ask" }
+ "build": {
+ "permission": {
+ "bash": {
+ "git status": "allow",
+ "*": "ask"
+ }
+ }
}
}
}
```
-See the full [permissions guide](/docs/permissions) for more patterns.
+[Learn more about permissions](/docs/permissions).
---