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
+36-68Lines changed: 36 additions & 68 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -362,42 +362,33 @@ Here are all the tools can be controlled through the agent config.
362
362
363
363
### Permissions
364
364
365
-
Permissions control what actions an agent can take.
365
+
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:
366
366
367
-
- edit, bash, webfetch
368
-
369
-
Each permission can be set to allow, ask, or deny.
370
-
371
-
- allow, ask, deny
372
-
373
-
Configure permissions globally in opencode.json.
367
+
-`"ask"` — Prompt for approval before running the tool
368
+
-`"allow"` — Allow all operations without approval
369
+
-`"deny"` — Disable the tool
374
370
375
371
```json title="opencode.json"
376
372
{
377
373
"$schema": "https://opencode.ai/config.json",
378
374
"permission": {
379
-
"edit": "ask",
380
-
"bash": "allow",
381
-
"webfetch": "deny"
375
+
"edit": "deny"
382
376
}
383
377
}
384
378
```
385
379
386
-
You can override permissions per agent in JSON.
380
+
You can override these permissions per agent.
387
381
388
-
```json title="opencode.json" {7-18}
382
+
```json title="opencode.json" {3-5,8-10}
389
383
{
390
384
"$schema": "https://opencode.ai/config.json",
385
+
"permission": {
386
+
"edit": "deny"
387
+
},
391
388
"agent": {
392
389
"build": {
393
390
"permission": {
394
-
"edit": "allow",
395
-
"bash": {
396
-
"*": "allow",
397
-
"git push": "ask",
398
-
"terraform *": "deny"
399
-
},
400
-
"webfetch": "ask"
391
+
"edit": "ask"
401
392
}
402
393
}
403
394
}
@@ -419,83 +410,60 @@ permission:
419
410
Only analyze code and suggest changes.
420
411
```
421
412
422
-
Bash permissions support granular patterns for fine-grained control.
423
-
424
-
```json title="Allow most, ask for risky, deny terraform"
425
-
{
426
-
"$schema": "https://opencode.ai/config.json",
427
-
"permission": {
428
-
"bash": {
429
-
"*": "allow",
430
-
"git push": "ask",
431
-
"terraform *": "deny"
432
-
}
433
-
}
434
-
}
435
-
```
436
-
437
-
If you provide a granular bash map, the default becomes ask unless you set \* explicitly.
413
+
You can set permissions for specific bash commands.
438
414
439
-
```json title="Granular defaults to ask"
415
+
```json title="opencode.json" {7}
440
416
{
441
417
"$schema": "https://opencode.ai/config.json",
442
-
"permission": {
443
-
"bash": {
444
-
"git status": "allow"
445
-
}
446
-
}
447
-
}
448
-
```
449
-
450
-
Agent-level permissions merge over global settings.
451
-
452
-
- Global sets defaults; agent overrides when specified
453
-
454
-
Specific bash rules can override a global default.
0 commit comments