diff --git a/.opencode/agent/core/openagent.md b/.opencode/agent/core/openagent.md index 6af4190..4f3d22e 100644 --- a/.opencode/agent/core/openagent.md +++ b/.opencode/agent/core/openagent.md @@ -1,23 +1,11 @@ --- -# OpenCode Agent Configuration -# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in: -# .opencode/config/agent-metadata.json - name: OpenAgent description: "Universal agent for answering queries, executing tasks, and coordinating workflows across any domain" mode: primary temperature: 0.2 -tools: - read: true - write: true - edit: true - grep: true - glob: true - bash: true - task: true - patch: true -permissions: +permission: bash: + "*": "ask" "rm -rf *": "ask" "rm -rf /*": "deny" "sudo *": "deny" diff --git a/.opencode/agent/core/opencoder.md b/.opencode/agent/core/opencoder.md index 16d5f44..2327490 100644 --- a/.opencode/agent/core/opencoder.md +++ b/.opencode/agent/core/opencoder.md @@ -1,22 +1,9 @@ --- -# OpenCode Agent Configuration -# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in: -# .opencode/config/agent-metadata.json - name: OpenCoder description: "Orchestration agent for complex coding, architecture, and multi-file refactoring" mode: primary temperature: 0.1 -tools: - task: true - read: true - edit: true - write: true - grep: true - glob: true - bash: true - patch: true -permissions: +permission: bash: "rm -rf *": "ask" "sudo *": "deny" diff --git a/.opencode/agent/data/data-analyst.md b/.opencode/agent/data/data-analyst.md index 6291cea..827b6e2 100644 --- a/.opencode/agent/data/data-analyst.md +++ b/.opencode/agent/data/data-analyst.md @@ -1,8 +1,4 @@ --- -# OpenCode Agent Configuration -# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in: -# .opencode/config/agent-metadata.json - name: OpenDataAnalyst description: "Expert in data analysis, visualization, and statistical insights" mode: primary diff --git a/.opencode/agent/meta/repo-manager.md b/.opencode/agent/meta/repo-manager.md index 6a42123..d17f3a8 100644 --- a/.opencode/agent/meta/repo-manager.md +++ b/.opencode/agent/meta/repo-manager.md @@ -1,22 +1,9 @@ --- -# OpenCode Agent Configuration -# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in: -# .opencode/config/agent-metadata.json - name: OpenRepoManager description: "Meta agent for managing OpenAgents Control repository development with lazy context loading, smart delegation, and automatic documentation" mode: primary temperature: 0.2 -tools: - read: true - write: true - edit: true - grep: true - glob: true - bash: true - task: true - list: true - patch: true +permission: bash: "rm -rf *": "ask" "rm -rf /*": "deny" @@ -28,12 +15,6 @@ tools: "**/*.secret": "deny" "node_modules/**": "deny" ".git/**": "deny" -permissions: - bash: - "rm -rf *": "ask" - "rm -rf /*": "deny" - "sudo *": "deny" - "> /dev/*": "deny" --- diff --git a/.opencode/agent/meta/system-builder.md b/.opencode/agent/meta/system-builder.md index b3fd89f..d703d64 100644 --- a/.opencode/agent/meta/system-builder.md +++ b/.opencode/agent/meta/system-builder.md @@ -7,14 +7,6 @@ name: OpenSystemBuilder description: "Main orchestrator for building complete context-aware AI systems from user requirements" mode: primary temperature: 0.2 -tools: - read: true - write: true - edit: true - bash: false - task: true - glob: true - grep: false --- # System Builder Orchestrator diff --git a/.opencode/agent/subagents/code/build-agent.md b/.opencode/agent/subagents/code/build-agent.md index 861321a..8850da2 100644 --- a/.opencode/agent/subagents/code/build-agent.md +++ b/.opencode/agent/subagents/code/build-agent.md @@ -3,15 +3,7 @@ name: BuildAgent description: Type check and build validation agent mode: subagent temperature: 0.1 -tools: - bash: true - read: true - grep: true - glob: true - task: true - edit: false - write: false -permissions: +permission: bash: "tsc": "allow" "mypy": "allow" diff --git a/.opencode/agent/subagents/code/coder-agent.md b/.opencode/agent/subagents/code/coder-agent.md index 3163265..4c83c6c 100644 --- a/.opencode/agent/subagents/code/coder-agent.md +++ b/.opencode/agent/subagents/code/coder-agent.md @@ -3,16 +3,7 @@ name: CoderAgent description: Executes coding subtasks in sequence, ensuring completion as specified mode: subagent temperature: 0 -tools: - read: true - edit: true - write: true - grep: true - glob: true - bash: false - patch: true - task: true -permissions: +permission: bash: "*": "deny" edit: @@ -22,9 +13,9 @@ permissions: "node_modules/**": "deny" ".git/**": "deny" task: + "*": "deny" contextscout: "allow" externalscout: "allow" - "*": "deny" --- # CoderAgent diff --git a/.opencode/agent/subagents/code/reviewer.md b/.opencode/agent/subagents/code/reviewer.md index 8ee87bc..d5b4a00 100644 --- a/.opencode/agent/subagents/code/reviewer.md +++ b/.opencode/agent/subagents/code/reviewer.md @@ -3,15 +3,7 @@ name: CodeReviewer description: Code review, security, and quality assurance agent mode: subagent temperature: 0.1 -tools: - read: true - grep: true - glob: true - bash: false - edit: false - write: false - task: true -permissions: +permission: bash: "*": "deny" edit: @@ -19,8 +11,8 @@ permissions: write: "**/*": "deny" task: - contextscout: "allow" "*": "deny" + contextscout: "allow" --- # CodeReviewer diff --git a/.opencode/agent/subagents/code/tester.md b/.opencode/agent/subagents/code/tester.md index 628cd7e..07398df 100644 --- a/.opencode/agent/subagents/code/tester.md +++ b/.opencode/agent/subagents/code/tester.md @@ -3,15 +3,7 @@ name: TestEngineer description: Test authoring and TDD agent mode: subagent temperature: 0.1 -tools: - read: true - grep: true - glob: true - edit: true - write: true - bash: true - task: true -permissions: +permission: bash: "npx vitest *": "allow" "npx jest *": "allow" @@ -31,8 +23,9 @@ permissions: "**/*.key": "deny" "**/*.secret": "deny" task: - contextscout: "allow" "*": "deny" + contextscout: "allow" + externalscout: "allow" --- # TestEngineer diff --git a/.opencode/agent/subagents/core/context-manager.md b/.opencode/agent/subagents/core/context-manager.md index 3f6cdaa..41c738d 100644 --- a/.opencode/agent/subagents/core/context-manager.md +++ b/.opencode/agent/subagents/core/context-manager.md @@ -3,21 +3,13 @@ name: ContextManager description: Context organization and lifecycle management specialist - discovers, catalogs, validates, and maintains project context structure with dependency tracking mode: subagent temperature: 0.1 -tools: - read: true - grep: true - glob: true - edit: true - write: true - bash: true - task: true -permissions: +permission: read: - "**/*": "allow" + "*": "allow" grep: - "**/*": "allow" + "*": "allow" glob: - "**/*": "allow" + "*": "allow" bash: "find .opencode/context*": "allow" "ls -la .opencode/context*": "allow" @@ -26,6 +18,7 @@ permissions: "*": "deny" edit: ".opencode/context/**/*.md": "allow" + ".opencode/context/**/*.json": "allow" "**/*.env*": "deny" "**/*.key": "deny" "**/*.secret": "deny" @@ -36,8 +29,8 @@ permissions: "**/*.key": "deny" "**/*.secret": "deny" task: - "contextscout": "allow" "*": "deny" + "contextscout": "allow" --- # ContextManager diff --git a/.opencode/agent/subagents/core/context-retriever.md b/.opencode/agent/subagents/core/context-retriever.md index 4565075..49d0016 100644 --- a/.opencode/agent/subagents/core/context-retriever.md +++ b/.opencode/agent/subagents/core/context-retriever.md @@ -3,15 +3,7 @@ name: Context Retriever description: Generic context search and retrieval specialist for finding relevant context files, standards, and guides in any repository mode: subagent temperature: 0.1 -tools: - read: true - grep: true - glob: true - list: true - bash: false - edit: false - write: false -permissions: +permission: bash: "*": "deny" edit: diff --git a/.opencode/agent/subagents/core/contextscout.md b/.opencode/agent/subagents/core/contextscout.md index ecfcd8a..32f93bc 100644 --- a/.opencode/agent/subagents/core/contextscout.md +++ b/.opencode/agent/subagents/core/contextscout.md @@ -2,14 +2,22 @@ name: ContextScout description: Discovers and recommends context files from .opencode/context/ ranked by priority. Suggests ExternalScout when a framework/library is mentioned but not found internally. mode: subagent -tools: - read: true - grep: true - glob: true - write: false - edit: false - bash: false - task: false +permission: + read: + "*": "allow" + grep: + "*": "allow" + glob: + "*": "allow" + bash: + "*": "deny" + edit: + "*": "deny" + write: + "*": "deny" + task: + "*": "deny" + --- # ContextScout diff --git a/.opencode/agent/subagents/core/documentation.md b/.opencode/agent/subagents/core/documentation.md index 552551f..f6a265e 100644 --- a/.opencode/agent/subagents/core/documentation.md +++ b/.opencode/agent/subagents/core/documentation.md @@ -3,15 +3,7 @@ name: DocWriter description: Documentation authoring agent mode: subagent temperature: 0.2 -tools: - read: true - grep: true - glob: true - edit: true - write: true - bash: false - task: true -permissions: +permission: bash: "*": "deny" edit: diff --git a/.opencode/agent/subagents/core/externalscout.md b/.opencode/agent/subagents/core/externalscout.md index 6775144..9ace8a1 100644 --- a/.opencode/agent/subagents/core/externalscout.md +++ b/.opencode/agent/subagents/core/externalscout.md @@ -3,57 +3,29 @@ name: ExternalScout description: Fetches live, version-specific documentation for external libraries and frameworks using Context7 and other sources. Filters, sorts, and returns relevant documentation. mode: subagent temperature: 0.1 -tools: - read: true - bash: true - skill: true - grep: true - webfetch: true - write: true - edit: true - glob: true - task: false - todoread: false - todowrite: false -permissions: +permission: read: + "**/*": "deny" ".opencode/skill/context7/**": "allow" ".tmp/external-context/**": "allow" - "**/*": "deny" bash: + "*": "deny" "curl -s https://context7.com/*": "allow" "jq *": "allow" - "curl *": "deny" - "wget *": "deny" - "rm *": "deny" - "sudo *": "deny" - "mv *": "deny" - "cp *": "deny" - "> *": "deny" - ">> *": "deny" skill: - "context7": "allow" "*": "deny" - webfetch: - "*": "allow" + "*context7*": "allow" write: - ".tmp/external-context/**": "allow" "**/*": "deny" + ".tmp/external-context/**": "allow" edit: - ".tmp/external-context/**": "allow" "**/*": "deny" + ".tmp/external-context/**": "allow" task: "*": "deny" - glob: - ".opencode/skill/context7/**": "allow" - ".tmp/external-context/**": "allow" - "**/*": "deny" - todoread: - "*": "deny" - todowrite: - "*": "deny" --- + # ExternalScout Fast documentation fetcher for external libraries/frameworks diff --git a/.opencode/agent/subagents/core/task-manager.md b/.opencode/agent/subagents/core/task-manager.md index 485602b..52e1a2e 100644 --- a/.opencode/agent/subagents/core/task-manager.md +++ b/.opencode/agent/subagents/core/task-manager.md @@ -3,29 +3,25 @@ name: TaskManager description: JSON-driven task breakdown specialist transforming complex features into atomic, verifiable subtasks with dependency tracking and CLI integration mode: subagent temperature: 0.1 -tools: - read: true - edit: true - write: true - grep: true - glob: true - bash: true - task: true - patch: true -permissions: +permission: bash: + "*": "deny" "npx ts-node*task-cli*": "allow" "mkdir -p .tmp/tasks*": "allow" "mv .tmp/tasks*": "allow" - "*": "deny" edit: "**/*.env*": "deny" "**/*.key": "deny" "**/*.secret": "deny" "node_modules/**": "deny" ".git/**": "deny" -skills: - - task-management + task: + contextscout: "allow" + externalscout: "allow" + "*": "deny" + skill: + "*": "deny" + "task-management": "allow" --- diff --git a/.opencode/agent/subagents/development/devops-specialist.md b/.opencode/agent/subagents/development/devops-specialist.md index c4b3492..5d9aef5 100644 --- a/.opencode/agent/subagents/development/devops-specialist.md +++ b/.opencode/agent/subagents/development/devops-specialist.md @@ -3,19 +3,12 @@ name: OpenDevopsSpecialist description: DevOps specialist subagent - CI/CD, infrastructure as code, deployment automation mode: subagent temperature: 0.1 -tools: - read: true - write: true - edit: true - bash: true - task: true - grep: true - glob: true -permissions: +permission: task: - contextscout: "allow" "*": "deny" + contextscout: "allow" bash: + "*": "deny" "docker build *": "allow" "docker compose up *": "allow" "docker compose down *": "allow" @@ -31,7 +24,6 @@ permissions: "terraform validate *": "allow" "npm run build *": "allow" "npm run test *": "allow" - "*": "deny" edit: "**/*.env*": "deny" "**/*.key": "deny" diff --git a/.opencode/agent/subagents/development/frontend-specialist.md b/.opencode/agent/subagents/development/frontend-specialist.md index 9921441..d52bbc3 100644 --- a/.opencode/agent/subagents/development/frontend-specialist.md +++ b/.opencode/agent/subagents/development/frontend-specialist.md @@ -3,22 +3,12 @@ name: OpenFrontendSpecialist description: Frontend UI design specialist - subagent for design systems, themes, animations mode: subagent temperature: 0.2 -tools: - read: true - write: true - edit: true - bash: false - task: true - glob: true - grep: true -permissions: +permission: task: + "*": "deny" contextscout: "allow" externalscout: "allow" - "*": "deny" write: - "design_iterations/**/*.html": "allow" - "design_iterations/**/*.css": "allow" "**/*.env*": "deny" "**/*.key": "deny" "**/*.secret": "deny" diff --git a/.opencode/agent/subagents/system-builder/context-organizer.md b/.opencode/agent/subagents/system-builder/context-organizer.md index 7548013..311c0db 100644 --- a/.opencode/agent/subagents/system-builder/context-organizer.md +++ b/.opencode/agent/subagents/system-builder/context-organizer.md @@ -3,14 +3,7 @@ name: ContextOrganizer description: Organizes and generates context files (domain, processes, standards, templates) for optimal knowledge management mode: subagent temperature: 0.1 -tools: - read: true - write: true - edit: true - grep: true - glob: true - task: true -permissions: +permission: task: contextscout: "allow" "*": "deny" diff --git a/.opencode/agent/subagents/system-builder/workflow-designer.md b/.opencode/agent/subagents/system-builder/workflow-designer.md index 478d9cd..f664e37 100644 --- a/.opencode/agent/subagents/system-builder/workflow-designer.md +++ b/.opencode/agent/subagents/system-builder/workflow-designer.md @@ -3,14 +3,7 @@ name: WorkflowDesigner description: Designs complete workflow definitions with context dependencies and success criteria mode: subagent temperature: 0.1 -tools: - read: true - write: true - edit: true - grep: true - glob: true - task: true -permissions: +permission: task: contextscout: "allow" "*": "deny" diff --git a/.opencode/agent/subagents/test/simple-responder.md b/.opencode/agent/subagents/test/simple-responder.md index 32eacb1..73a4e95 100644 --- a/.opencode/agent/subagents/test/simple-responder.md +++ b/.opencode/agent/subagents/test/simple-responder.md @@ -7,15 +7,6 @@ name: Simple Responder description: "Test agent that responds with 'AWESOME TESTING' - for eval framework testing" mode: subagent temperature: 0.0 -tools: - read: false - write: false - edit: false - grep: false - glob: false - bash: false - task: false - patch: false --- # Simple Responder - Test Agent diff --git a/.opencode/context/openagents-repo/core-concepts/agent-metadata.md b/.opencode/context/openagents-repo/core-concepts/agent-metadata.md index 472a535..a4cd00b 100644 --- a/.opencode/context/openagents-repo/core-concepts/agent-metadata.md +++ b/.opencode/context/openagents-repo/core-concepts/agent-metadata.md @@ -102,7 +102,7 @@ Based on [OpenCode documentation](https://opencode.ai/docs/agents/), these are t - `prompt` - Custom prompt file path (e.g., `{file:./prompts/build.txt}`) - `hidden` - Hide from @ autocomplete (subagents only) - `tools` - Tool access configuration -- `permission` - Permission rules for tools +- `permission` - Permission rules for tools (v1.1.1+, replaces deprecated `permissions`) ### Example Valid Frontmatter @@ -118,7 +118,7 @@ tools: glob: true write: false edit: false -permission: +permission: # v1.1.1+ (singular, not plural) bash: "*": ask "git *": allow @@ -382,6 +382,37 @@ Then run: ## Migration Guide +### Migrating from permissions (plural) to permission (singular) + +**OpenCode v1.1.1+ Change**: The field name changed from `permissions:` (plural) to `permission:` (singular). + +**Before** (deprecated): +```yaml +permissions: + bash: + "*": "deny" +``` + +**After** (v1.1.1+): +```yaml +permission: + bash: + "*": "deny" +``` + +**Migration Steps**: +1. Find all agents using `permissions:` (plural) + ```bash + grep -r "^permissions:" .opencode/agent/ + ``` + +2. Replace with `permission:` (singular) in each file + +3. Verify no validation errors: + ```bash + opencode agent validate + ``` + ### Migrating Existing Agents **Step 1**: Identify agents with extra fields diff --git a/.opencode/context/openagents-repo/standards/agent-frontmatter.md b/.opencode/context/openagents-repo/standards/agent-frontmatter.md index 6cf7ea4..c6abad4 100644 --- a/.opencode/context/openagents-repo/standards/agent-frontmatter.md +++ b/.opencode/context/openagents-repo/standards/agent-frontmatter.md @@ -41,10 +41,12 @@ tools: # Tool access bash: false task: false -permissions: # Permission rules +permission: # Permission rules (v1.1.1+) + "*": "ask" # Catch-all (last-match-wins) + read: "allow" # Specific override bash: - "git *": "allow" "*": "deny" + "git status*": "allow" edit: "**/*.env*": "deny" task: @@ -72,7 +74,7 @@ tools: write: true bash: true task: true -permissions: +permission: bash: "npx vitest *": "allow" "pytest *": "allow" @@ -108,11 +110,11 @@ tools: ### 3. Wrong Field Names ❌ ```yaml -permission: # ❌ Should be 'permissions' +permissions: # ❌ Deprecated - use 'permission' (singular) bash: "*": "deny" ``` -**Fix**: Use correct field name `permissions:` +**Fix**: Use correct field name `permission:` (singular, v1.1.1+) ### 4. Extra Delimiter Blocks ❌ ```yaml @@ -158,7 +160,7 @@ dependencies: [] # ❌ Not valid - [ ] Only valid OpenCode fields? - [ ] No duplicate keys? - [ ] No orphaned list items? -- [ ] Correct field names (`permissions` not `permission`)? +- [ ] Correct field names (`permission` not `permissions`)? - [ ] Only one `---` delimiter at top? - [ ] Metadata moved to agent-metadata.json? - [ ] Valid YAML syntax? @@ -178,7 +180,7 @@ grep -A 50 "^---$" agent.md | grep -E "^[a-z_]+:" | sort | uniq -d grep -A 50 "^---$" agent.md | grep -E "^[a-z_]+:" | cut -d: -f1 ``` -**Valid keys**: `name`, `description`, `mode`, `temperature`, `model`, `maxSteps`, `disable`, `hidden`, `prompt`, `tools`, `permissions`, `skills` +**Valid keys**: `name`, `description`, `mode`, `temperature`, `model`, `maxSteps`, `disable`, `hidden`, `prompt`, `tools`, `permission`, `skills` --- diff --git a/.opencode/context/openagents-repo/standards/permission-patterns.md b/.opencode/context/openagents-repo/standards/permission-patterns.md new file mode 100644 index 0000000..d9dad82 --- /dev/null +++ b/.opencode/context/openagents-repo/standards/permission-patterns.md @@ -0,0 +1,378 @@ + +# Standard: Permission Patterns for OpenCode v1.1.1+ + +**Purpose**: Comprehensive permission configuration patterns for different agent types +**Priority**: CRITICAL - Load this before configuring agent permissions + +--- + +## Core Principle + +OpenCode v1.1.1+ uses `permission:` (singular) with granular control over tool access. Rules follow **last-matching-wins** evaluation order. + +**Why**: Granular permissions prevent unintended actions while allowing necessary operations. + +--- + +## Permission Evaluation Order + +**Last matching rule wins** - Common pattern: +1. Catch-all `"*"` first (default behavior) +2. Specific overrides after (take precedence) + +Example: +```yaml +permission: + bash: + "*": "deny" # Catch-all: deny all bash + "git status*": "allow" # Override: allow git status + "git diff*": "allow" # Override: allow git diff +``` + +--- + +## Valid Permission Keys + +| Key | Description | Granular? | Default | +|-----|-------------|-----------|---------| +| `read` | File reading | Yes (path globs) | `"allow"` | +| `edit` | File modifications | Yes (path globs) | `"allow"` | +| `glob` | File globbing/searches | Yes | `"allow"` | +| `grep` | Content/regex search | Yes | `"allow"` | +| `list` | Directory listing | Yes | `"allow"` | +| `bash` | Shell commands | Yes (command globs) | `"allow"` | +| `task` | Subagent launches | Yes (subagent type) | `"allow"` | +| `skill` | Skill loading | Yes | `"allow"` | +| `lsp` | LSP queries | No | `"allow"` | +| `todoread` | Todo list read | No | `"allow"` | +| `todowrite` | Todo list update | No | `"allow"` | +| `webfetch` | URL fetching | Yes | `"allow"` | +| `websearch` | Web search | Yes | `"allow"` | +| `codesearch` | Code search | Yes | `"allow"` | +| `external_directory` | Out-of-project paths | Yes | `"ask"` | +| `doom_loop` | Repeated identical calls | Yes | `"ask"` | + +--- + +## Valid Actions + +- `"allow"` - Executes without approval +- `"ask"` - Prompts user (options: once, always, reject) +- `"deny"` - Blocks immediately + +--- + +## Agent Type Patterns + +### Read-Only Agents (Reviewers, Analyzers) + +**Use case**: Code review, analysis, security audits + +```yaml +permission: + bash: + "*": "deny" + edit: + "**/*": "deny" + write: + "**/*": "deny" + task: + contextscout: "allow" + "*": "deny" +``` + +**Examples**: CodeReviewer, SecurityAuditor + +--- + +### Write-Enabled Agents (Coders, Testers) + +**Use case**: Code implementation, test authoring + +```yaml +permission: + bash: + "rm -rf *": "ask" + "sudo *": "deny" + "chmod *": "ask" + "curl *": "ask" + "wget *": "ask" + "docker *": "ask" + "kubectl *": "ask" + # Test-specific commands (for testers) + "npx vitest *": "allow" + "npx jest *": "allow" + "pytest *": "allow" + "npm test *": "allow" + "go test *": "allow" + "cargo test *": "allow" + "*": "deny" + edit: + "**/*.env*": "deny" + "**/*.key": "deny" + "**/*.secret": "deny" + "node_modules/**": "deny" + "**/__pycache__/**": "deny" + "**/*.pyc": "deny" + ".git/**": "deny" + task: + contextscout: "allow" + "*": "deny" +``` + +**Examples**: CoderAgent, TestEngineer, BuildAgent + +--- + +### Orchestrators (Task Managers, Primary Agents) + +**Use case**: Workflow orchestration, task delegation + +```yaml +permission: + bash: + "rm -rf *": "ask" + "sudo *": "deny" + "chmod *": "ask" + "*": "ask" # More permissive for orchestration + edit: + "**/*.env*": "deny" + "**/*.key": "deny" + "**/*.secret": "deny" + "node_modules/**": "deny" + ".git/**": "deny" + task: + "*": "allow" # Can delegate to any subagent +``` + +**Examples**: OpenCoder, OpenAgent, TaskManager + +--- + +### Restricted Bash Agents (Specific Commands Only) + +**Use case**: Agents that need only specific bash commands + +```yaml +permission: + bash: + "git status*": "allow" + "git diff*": "allow" + "git log*": "allow" + "ls *": "allow" + "cat *": "allow" + "*": "deny" + edit: + "**/*.env*": "deny" + task: + contextscout: "allow" + "*": "deny" +``` + +**Examples**: ExternalScout, ContextScout + +--- + +## Security Patterns + +### Always Deny Sensitive Files + +```yaml +permission: + edit: + "**/*.env*": "deny" + "**/*.key": "deny" + "**/*.secret": "deny" + "**/*.pem": "deny" + "**/*.crt": "deny" + "**/credentials*": "deny" +``` + +### Always Deny Dangerous Commands + +```yaml +permission: + bash: + "sudo *": "deny" + "rm -rf /*": "deny" + "chmod 777 *": "deny" + "curl * | bash": "deny" + "wget * | sh": "deny" +``` + +### Always Ask for Destructive Operations + +```yaml +permission: + bash: + "rm -rf *": "ask" + "git push --force*": "ask" + "docker system prune*": "ask" + "npm publish*": "ask" +``` + +--- + +## Task Permission Patterns + +### Allow Specific Subagents Only + +```yaml +permission: + task: + contextscout: "allow" + externalscout: "allow" + "*": "deny" +``` + +### Allow All Except Specific + +```yaml +permission: + task: + "*": "allow" + "dangerous-agent": "deny" +``` + +### Ask for Orchestration Agents + +```yaml +permission: + task: + contextscout: "allow" # Always allow context discovery + "coder-agent": "ask" # Ask before code generation + "build-agent": "ask" # Ask before builds + "*": "deny" +``` + +--- + +## Complete Examples + +### Example 1: Code Reviewer (Read-Only) + +```yaml +--- +name: CodeReviewer +description: Code review, security, and quality assurance agent +mode: subagent +temperature: 0.1 +tools: + read: true + grep: true + glob: true + bash: false + edit: false + write: false + task: true +permission: + bash: + "*": "deny" + edit: + "**/*": "deny" + write: + "**/*": "deny" + task: + contextscout: "allow" + "*": "deny" +--- +``` + +### Example 2: Test Engineer (Write-Enabled) + +```yaml +--- +name: TestEngineer +description: Test authoring and TDD agent +mode: subagent +temperature: 0.1 +tools: + read: true + grep: true + glob: true + edit: true + write: true + bash: true + task: true +permission: + bash: + "npx vitest *": "allow" + "npx jest *": "allow" + "pytest *": "allow" + "npm test *": "allow" + "go test *": "allow" + "cargo test *": "allow" + "rm -rf *": "ask" + "sudo *": "deny" + "*": "deny" + edit: + "**/*.env*": "deny" + "**/*.key": "deny" + "**/*.secret": "deny" + task: + contextscout: "allow" + "*": "deny" +--- +``` + +### Example 3: Primary Orchestrator + +```yaml +--- +name: OpenCoder +description: Orchestration agent for complex coding +mode: primary +temperature: 0.1 +tools: + task: true + read: true + edit: true + write: true + grep: true + glob: true + bash: true +permission: + bash: + "rm -rf *": "ask" + "sudo *": "deny" + "chmod *": "ask" + "curl *": "ask" + "wget *": "ask" + "docker *": "ask" + "kubectl *": "ask" + edit: + "**/*.env*": "deny" + "**/*.key": "deny" + "**/*.secret": "deny" + "node_modules/**": "deny" + ".git/**": "deny" + task: + "*": "allow" +--- +``` + +--- + +## Validation Checklist + +- [ ] Using `permission:` (singular, not `permissions:`) +- [ ] Catch-all rules (`"*"`) come FIRST +- [ ] Specific overrides come AFTER catch-all +- [ ] Sensitive files denied (`**/*.env*`, `**/*.key`, `**/*.secret`) +- [ ] Dangerous commands denied (`sudo *`, `rm -rf /*`) +- [ ] Destructive operations ask (`rm -rf *`, `git push --force*`) +- [ ] Task permissions appropriate for agent type +- [ ] Valid actions only (`"allow"`, `"ask"`, `"deny"`) + +--- + +## Related + +- **Agent Frontmatter**: `standards/agent-frontmatter.md` +- **Subagent Structure**: `standards/subagent-structure.md` +- **Security Patterns**: `../../core/standards/security-patterns.md` +- **OpenCode Docs**: https://opencode.ai/docs/permissions/ + +--- + +**Last Updated**: 2026-02-01 | **Version**: 1.0.0