Browse Source

Fix permission rule ordering per opencode v1.1.1+ best practices

Follow opencode v1.1.1+ pattern: catch-all rule first, specific overrides after.
Last matching rule wins, so specific rules override the catch-all.

Changes:
- TestEngineer: Move '*': deny to FIRST (was at end, breaking allows)
- BuildAgent: Move '*': deny to FIRST (was at end)
- RepoManager: Add '*': ask as FIRST rule (was missing catch-all)
- OpenCoder: Add '*': allow as FIRST + change 'rm -rf *' to 'rm -rf /*'
- OpenAgent: Add '*': ask as FIRST + remove redundant 'rm -rf *'

Permission strategy by agent:
- OpenCoder: '*': allow (dev-focused, needs speed)
- OpenAgent: '*': ask (universal, needs caution)
- RepoManager: '*': ask (meta operations, needs approval)
- TestEngineer/BuildAgent: '*': deny (subagents, specific allows only)

References:
- https://opencode.ai/docs/permissions
- Issue #164
darrenhinde 6 months ago
parent
commit
1312b1c914

+ 1 - 1
.opencode/agent/core/openagent.md

@@ -18,7 +18,7 @@ tools:
   patch: true
 permission:
   bash:
-    "rm -rf *": "ask"
+    "*": "ask"
     "rm -rf /*": "deny"
     "sudo *": "deny"
     "> /dev/*": "deny"

+ 2 - 1
.opencode/agent/core/opencoder.md

@@ -18,7 +18,8 @@ tools:
   patch: true
 permission:
   bash:
-    "rm -rf *": "ask"
+    "*": "allow"
+    "rm -rf /*": "deny"
     "sudo *": "deny"
     "chmod *": "ask"
     "curl *": "ask"

+ 1 - 1
.opencode/agent/meta/repo-manager.md

@@ -30,7 +30,7 @@ tools:
     ".git/**": "deny"
 permission:
   bash:
-    "rm -rf *": "ask"
+    "*": "ask"
     "rm -rf /*": "deny"
     "sudo *": "deny"
     "> /dev/*": "deny"

+ 1 - 1
.opencode/agent/subagents/code/build-agent.md

@@ -13,6 +13,7 @@ tools:
   write: false
 permission:
   bash:
+    "*": "deny"
     "tsc": "allow"
     "mypy": "allow"
     "go build": "allow"
@@ -22,7 +23,6 @@ permission:
     "yarn build": "allow"
     "pnpm build": "allow"
     "python -m build": "allow"
-    "*": "deny"
   edit:
     "**/*": "deny"
   write:

+ 1 - 1
.opencode/agent/subagents/code/tester.md

@@ -13,6 +13,7 @@ tools:
   task: true
 permission:
   bash:
+    "*": "deny"
     "npx vitest *": "allow"
     "npx jest *": "allow"
     "pytest *": "allow"
@@ -25,7 +26,6 @@ permission:
     "cargo test *": "allow"
     "rm -rf *": "ask"
     "sudo *": "deny"
-    "*": "deny"
   edit:
     "**/*.env*": "deny"
     "**/*.key": "deny"