Просмотр исходного кода

fix: Clean up agent YAML frontmatter and add standards

Fixed YAML frontmatter issues in 18 agent files:
- Removed duplicate YAML keys (e.g., read: true followed by read: {})
- Removed orphaned list items without parent keys
- Fixed field names (permission: → permissions:)
- Removed extra --- delimiter blocks in content
- Cleaned up comments and invalid OpenCode fields

Changes:
- 14 subagent files fixed (core, code, development, system-builder)
- 4 primary/meta agent files fixed (openagent, opencoder, repo-manager, eval-runner)
- Net reduction: 439 lines removed, 116 lines added (cleaner YAML)

Added agent standards documentation:
- .opencode/context/openagents-repo/standards/agent-frontmatter.md
- .opencode/context/openagents-repo/standards/subagent-structure.md
- .opencode/context/openagents-repo/standards/navigation.md
- Updated main navigation.md with standards section

All files follow MVI principles (<200 lines) and document the 5 common
YAML mistakes that were fixed.

Fixes subagent recognition issues where agents were registered as 'all'
mode instead of 'subagent' mode due to malformed YAML.
darrenhinde 6 месяцев назад
Родитель
Сommit
66738d60b5

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

@@ -16,18 +16,18 @@ tools:
   bash: true
   bash: true
   task: true
   task: true
   patch: true
   patch: true
-permission:
+permissions:
   bash:
   bash:
-    "rm -rf *": ask
-    "rm -rf /*": deny
-    "sudo *": deny
-    "> /dev/*": deny
+    "rm -rf *": "ask"
+    "rm -rf /*": "deny"
+    "sudo *": "deny"
+    "> /dev/*": "deny"
   edit:
   edit:
-    "**/*.env*": deny
-    "**/*.key": deny
-    "**/*.secret": deny
-    "node_modules/**": deny
-    ".git/**": deny
+    "**/*.env*": "deny"
+    "**/*.key": "deny"
+    "**/*.secret": "deny"
+    "node_modules/**": "deny"
+    ".git/**": "deny"
 ---
 ---
 Always use ContextScout for discovery of new tasks or context files.
 Always use ContextScout for discovery of new tasks or context files.
 ContextScout is exempt from the approval gate rule. ContextScout is your secret weapon for quality, use it where possible.
 ContextScout is exempt from the approval gate rule. ContextScout is your secret weapon for quality, use it where possible.

+ 15 - 15
.opencode/agent/core/opencoder.md

@@ -16,23 +16,23 @@ tools:
   glob: true
   glob: true
   bash: true
   bash: true
   patch: true
   patch: true
-permission:
+permissions:
   bash:
   bash:
-    "rm -rf *": ask
-    "sudo *": deny
-    "chmod *": ask
-    "curl *": ask
-    "wget *": ask
-    "docker *": ask
-    "kubectl *": ask
+    "rm -rf *": "ask"
+    "sudo *": "deny"
+    "chmod *": "ask"
+    "curl *": "ask"
+    "wget *": "ask"
+    "docker *": "ask"
+    "kubectl *": "ask"
   edit:
   edit:
-    "**/*.env*": deny
-    "**/*.key": deny
-    "**/*.secret": deny
-    "node_modules/**": deny
-    "**/__pycache__/**": deny
-    "**/*.pyc": deny
-    ".git/**": deny
+    "**/*.env*": "deny"
+    "**/*.key": "deny"
+    "**/*.secret": "deny"
+    "node_modules/**": "deny"
+    "**/__pycache__/**": "deny"
+    "**/*.pyc": "deny"
+    ".git/**": "deny"
 ---
 ---
 
 
 # Development Agent
 # Development Agent

+ 22 - 182
.opencode/agent/eval-runner.md

@@ -1,194 +1,34 @@
 ---
 ---
 # OpenCode Agent Configuration
 # OpenCode Agent Configuration
-# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in:
-# .opencode/config/agent-metadata.json
-
-name: OpenCoder
-description: "Multi-language implementation agent for modular and functional development"
-mode: primary
-temperature: 0.1
-tools:
-  task: true
-  read: true
-  edit: true
-  write: true
-  grep: true
-  glob: true
-  bash: true
-  patch: true
-  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"
-    "**/__pycache__/**": "deny"
-    "**/*.pyc": "deny"
-    ".git/**": "deny"
-  - development
-  - coding
-  - implementation
+id: eval-runner
+name: Eval Runner
+description: "Test harness for evaluation framework - DO NOT USE DIRECTLY"
+category: testing
+type: utility
+version: 1.0.0
+author: opencode
+mode: subagent
+temperature: 0.2
 ---
 ---
 
 
-# Development Agent
-Always start with phrase "DIGGING IN..."
-
-<critical_context_requirement>
-PURPOSE: Context files contain project-specific coding standards that ensure consistency, 
-quality, and alignment with established patterns. Without loading context first, 
-you will create code that doesn't match the project's conventions.
-
-BEFORE any code implementation (write/edit), ALWAYS load required context files:
-- Code tasks → .opencode/context/core/standards/code-quality.md (MANDATORY)
-- Language-specific patterns if available
-
-WHY THIS MATTERS:
-- Code without standards/code-quality.md → Inconsistent patterns, wrong architecture
-- Skipping context = wasted effort + rework
-
-CONSEQUENCE OF SKIPPING: Work that doesn't match project standards = wasted effort
-</critical_context_requirement>
-
-<critical_rules priority="absolute" enforcement="strict">
-  <rule id="approval_gate" scope="all_execution">
-    Request approval before ANY implementation (write, edit, bash). Read/list/glob/grep or using ContextScout for discovery don't require approval.
-    ALWAYS use ContextScout for discovery before implementation, before doing your own discovery.
-  </rule>
-  
-  <rule id="stop_on_failure" scope="validation">
-    STOP on test fail/build errors - NEVER auto-fix without approval
-  </rule>
-  
-  <rule id="report_first" scope="error_handling">
-    On fail: REPORT error → PROPOSE fix → REQUEST APPROVAL → Then fix (never auto-fix)
-  </rule>
-  
-  <rule id="incremental_execution" scope="implementation">
-    Implement ONE step at a time, validate each step before proceeding
-  </rule>
-</critical_rules>
-
-## Available Subagents (invoke via task tool)
-
-- `ContextScout` - Discover context files BEFORE coding (saves time!)
-- `CoderAgent` - Simple implementations
-- `TestEngineer` - Testing after implementation
-- `DocWriter` - Documentation generation
-
-**Invocation syntax**:
-```javascript
-task(
-  subagent_type="ContextScout",
-  description="Brief description",
-  prompt="Detailed instructions for the subagent"
-)
-```
-
-Focus:
-You are a coding specialist focused on writing clean, maintainable, and scalable code. Your role is to implement applications following a strict plan-and-approve workflow using modular and functional programming principles.
-
-Adapt to the project's language based on the files you encounter (TypeScript, Python, Go, Rust, etc.).
-
-Core Responsibilities
-Implement applications with focus on:
-
-- Modular architecture design
-- Functional programming patterns where appropriate
-- Type-safe implementations (when language supports it)
-- Clean code principles
-- SOLID principles adherence
-- Scalable code structures
-- Proper separation of concerns
-
-Code Standards
-
-- Write modular, functional code following the language's conventions
-- Follow language-specific naming conventions
-- Add minimal, high-signal comments only
-- Avoid over-complication
-- Prefer declarative over imperative patterns
-- Use proper type systems when available
-
-<delegation_rules>
-  <delegate_when>
-    <condition id="simple_task" trigger="focused_implementation" action="delegate_to_coder_agent">
-      For simple, focused implementations to save time
-    </condition>
-  </delegate_when>
-  
-  <execute_directly_when>
-    <condition trigger="single_file_simple_change">1-3 files, straightforward implementation</condition>
-  </execute_directly_when>
-</delegation_rules>
+# Eval Runner - Test Harness
 
 
-<workflow>
-  <stage id="1" name="ContextDiscovery" required="true">
-    1. Use `ContextScout` to discover relevant project files.
-    2. MANDATORY: Read `.opencode/context/core/standards/code-quality.md`.
-    3. Read `.opencode/context/core/workflows/component-planning.md`.
-    
-    *Constraint: You cannot create a valid plan until you have read the standards.*
-  </stage>
+**⚠️ DO NOT USE THIS AGENT DIRECTLY ⚠️**
 
 
-  <stage id="2" name="MasterPlanning" required="true" enforce="@approval_gate">
-    1. Create a session directory: `.tmp/sessions/{YYYY-MM-DD}-{task-slug}/`
-    2. **Decompose** the request into functional Components (Auth, DB, UI, etc.).
-    3. Create `master-plan.md` following the `component-planning.md` standard.
-       - Define Architecture.
-       - List Components in dependency order.
-    4. Present `master-plan.md` for approval.
-  </stage>
+This agent is a test harness used by the OpenCode evaluation framework.
 
 
-  <stage id="3" name="ComponentExecutionLoop" when="approved" enforce="@incremental_execution">
-    *Repeat for each Component in Master Plan:*
-    
-    1. **Plan Component**:
-       - Create `component-{name}.md` with detailed Interface, Tests, and Tasks.
-       - Request approval for this specific component's design.
-       
-    2. **Execute Component**:
-       - Load tasks from `component-{name}.md` into `TodoWrite`.
-       - Execute loop: `TodoRead` -> Implement -> Validate -> `TodoWrite`.
-       - If complex, delegate to `CoderAgent` passing `component-{name}.md`.
-       
-    3. **Integrate**:
-       - Mark component complete in `master-plan.md`.
-       - Verify integration with previous components.
-  </stage>
+## Purpose
 
 
-  <stage id="4" name="ValidationAndHandoff" enforce="@stop_on_failure">
-    1. Verify all components in `master-plan.md` are complete.
-    2. Run full system integration tests.
-    3. Ask user to clean up `.tmp` files.
-    4. Suggest `DocWriter` or `TestEngineer`.
-  </stage>
-</workflow>
+This file is **dynamically replaced** during test runs:
+- Before tests: Replaced with target agent's prompt (e.g., openagent, opencoder)
+- During tests: Acts as the target agent
+- After tests: Restored to this default state
 
 
-<execution_philosophy>
-  Development specialist with strict quality gates and context awareness.
-  
-  **Approach**: Plan → Approve → Load Context → Execute Incrementally → Validate → Handoff
-  **Mindset**: Quality over speed, consistency over convenience
-  **Safety**: Context loading, approval gates, stop on failure, incremental execution
-</execution_philosophy>
+## Configuration
 
 
-<constraints enforcement="absolute">
-  These constraints override all other considerations:
-  
-  1. NEVER execute write/edit without loading required context first
-  2. NEVER skip approval gate - always request approval before implementation
-  3. NEVER auto-fix errors - always report first and request approval
-  4. NEVER implement entire plan at once - always incremental, one step at a time
-  5. ALWAYS validate after each step (type check, lint, test)
-  
-  If you find yourself violating these rules, STOP and correct course.
-</constraints>
+- **ID**: eval-runner
+- **Mode**: subagent (test harness only)
+- **Status**: Template - will be overwritten during test runs
 
 
+If you see this prompt during a test run, something went wrong with the test setup.
 
 

+ 6 - 5
.opencode/agent/meta/repo-manager.md

@@ -28,11 +28,12 @@ tools:
     "**/*.secret": "deny"
     "**/*.secret": "deny"
     "node_modules/**": "deny"
     "node_modules/**": "deny"
     ".git/**": "deny"
     ".git/**": "deny"
-  - repository
-  - meta
-  - coordination
-  - openagents-repo
-  - lazy-loading
+permissions:
+  bash:
+    "rm -rf *": "ask"
+    "rm -rf /*": "deny"
+    "sudo *": "deny"
+    "> /dev/*": "deny"
 ---
 ---
 
 
 <!-- ═══════════════════════════════════════════════════════════════════════════ -->
 <!-- ═══════════════════════════════════════════════════════════════════════════ -->

+ 4 - 13
.opencode/agent/subagents/code/build-agent.md

@@ -1,10 +1,6 @@
 ---
 ---
-# OpenCode Agent Configuration
-# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in:
-# .opencode/config/agent-metadata.json
-
 name: BuildAgent
 name: BuildAgent
-description: "Type check and build validation agent"
+description: Type check and build validation agent
 mode: subagent
 mode: subagent
 temperature: 0.1
 temperature: 0.1
 tools:
 tools:
@@ -13,6 +9,9 @@ tools:
   grep: true
   grep: true
   glob: true
   glob: true
   task: true
   task: true
+  edit: false
+  write: false
+permissions:
   bash:
   bash:
     "tsc": "allow"
     "tsc": "allow"
     "mypy": "allow"
     "mypy": "allow"
@@ -31,20 +30,12 @@ tools:
   task:
   task:
     contextscout: "allow"
     contextscout: "allow"
     "*": "deny"
     "*": "deny"
-  - build
-  - validation
-  - type-check
 ---
 ---
 
 
 # BuildAgent
 # BuildAgent
 
 
 > **Mission**: Validate type correctness and build success — always grounded in project build standards discovered via ContextScout.
 > **Mission**: Validate type correctness and build success — always grounded in project build standards discovered via ContextScout.
 
 
----
-# OpenCode Agent Configuration
-# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in:
-# .opencode/config/agent-metadata.json
-
   <rule id="context_first">
   <rule id="context_first">
     ALWAYS call ContextScout BEFORE running build checks. Load build standards, type-checking requirements, and project conventions first. This ensures you run the right commands for this project.
     ALWAYS call ContextScout BEFORE running build checks. Load build standards, type-checking requirements, and project conventions first. This ensures you run the right commands for this project.
   </rule>
   </rule>

+ 2 - 12
.opencode/agent/subagents/code/coder-agent.md

@@ -1,10 +1,6 @@
 ---
 ---
-# OpenCode Agent Configuration
-# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in:
-# .opencode/config/agent-metadata.json
-
 name: CoderAgent
 name: CoderAgent
-description: "Executes coding subtasks in sequence, ensuring completion as specified"
+description: Executes coding subtasks in sequence, ensuring completion as specified
 mode: subagent
 mode: subagent
 temperature: 0
 temperature: 0
 tools:
 tools:
@@ -16,6 +12,7 @@ tools:
   bash: false
   bash: false
   patch: true
   patch: true
   task: true
   task: true
+permissions:
   bash:
   bash:
     "*": "deny"
     "*": "deny"
   edit:
   edit:
@@ -28,19 +25,12 @@ tools:
     contextscout: "allow"
     contextscout: "allow"
     externalscout: "allow"
     externalscout: "allow"
     "*": "deny"
     "*": "deny"
-  - coding
-  - implementation
 ---
 ---
 
 
 # CoderAgent
 # CoderAgent
 
 
 > **Mission**: Execute coding subtasks precisely, one at a time, with full context awareness and self-review before handoff.
 > **Mission**: Execute coding subtasks precisely, one at a time, with full context awareness and self-review before handoff.
 
 
----
-# OpenCode Agent Configuration
-# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in:
-# .opencode/config/agent-metadata.json
-
   <rule id="context_first">
   <rule id="context_first">
     ALWAYS call ContextScout BEFORE writing any code. Load project standards, naming conventions, and security patterns first. This is not optional — it's how you produce code that fits the project.
     ALWAYS call ContextScout BEFORE writing any code. Load project standards, naming conventions, and security patterns first. This is not optional — it's how you produce code that fits the project.
   </rule>
   </rule>

+ 2 - 13
.opencode/agent/subagents/code/reviewer.md

@@ -1,10 +1,6 @@
 ---
 ---
-# OpenCode Agent Configuration
-# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in:
-# .opencode/config/agent-metadata.json
-
 name: CodeReviewer
 name: CodeReviewer
-description: "Code review, security, and quality assurance agent"
+description: Code review, security, and quality assurance agent
 mode: subagent
 mode: subagent
 temperature: 0.1
 temperature: 0.1
 tools:
 tools:
@@ -15,6 +11,7 @@ tools:
   edit: false
   edit: false
   write: false
   write: false
   task: true
   task: true
+permissions:
   bash:
   bash:
     "*": "deny"
     "*": "deny"
   edit:
   edit:
@@ -24,20 +21,12 @@ tools:
   task:
   task:
     contextscout: "allow"
     contextscout: "allow"
     "*": "deny"
     "*": "deny"
-  - review
-  - quality
-  - security
 ---
 ---
 
 
 # CodeReviewer
 # CodeReviewer
 
 
 > **Mission**: Perform thorough code reviews for correctness, security, and quality — always grounded in project standards discovered via ContextScout.
 > **Mission**: Perform thorough code reviews for correctness, security, and quality — always grounded in project standards discovered via ContextScout.
 
 
----
-# OpenCode Agent Configuration
-# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in:
-# .opencode/config/agent-metadata.json
-
   <rule id="context_first">
   <rule id="context_first">
     ALWAYS call ContextScout BEFORE reviewing any code. Load code quality standards, security patterns, and naming conventions first. Reviewing without standards = meaningless feedback.
     ALWAYS call ContextScout BEFORE reviewing any code. Load code quality standards, security patterns, and naming conventions first. Reviewing without standards = meaningless feedback.
   </rule>
   </rule>

+ 2 - 12
.opencode/agent/subagents/code/tester.md

@@ -1,10 +1,6 @@
 ---
 ---
-# OpenCode Agent Configuration
-# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in:
-# .opencode/config/agent-metadata.json
-
 name: TestEngineer
 name: TestEngineer
-description: "Test authoring and TDD agent"
+description: Test authoring and TDD agent
 mode: subagent
 mode: subagent
 temperature: 0.1
 temperature: 0.1
 tools:
 tools:
@@ -15,6 +11,7 @@ tools:
   write: true
   write: true
   bash: true
   bash: true
   task: true
   task: true
+permissions:
   bash:
   bash:
     "npx vitest *": "allow"
     "npx vitest *": "allow"
     "npx jest *": "allow"
     "npx jest *": "allow"
@@ -36,19 +33,12 @@ tools:
   task:
   task:
     contextscout: "allow"
     contextscout: "allow"
     "*": "deny"
     "*": "deny"
-  - testing
-  - tdd
 ---
 ---
 
 
 # TestEngineer
 # TestEngineer
 
 
 > **Mission**: Author comprehensive tests following TDD principles — always grounded in project testing standards discovered via ContextScout.
 > **Mission**: Author comprehensive tests following TDD principles — always grounded in project testing standards discovered via ContextScout.
 
 
----
-# OpenCode Agent Configuration
-# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in:
-# .opencode/config/agent-metadata.json
-
   <rule id="context_first">
   <rule id="context_first">
     ALWAYS call ContextScout BEFORE writing any tests. Load testing standards, coverage requirements, and TDD patterns first. Tests without standards = tests that don't match project conventions.
     ALWAYS call ContextScout BEFORE writing any tests. Load testing standards, coverage requirements, and TDD patterns first. Tests without standards = tests that don't match project conventions.
   </rule>
   </rule>

+ 2 - 15
.opencode/agent/subagents/core/context-manager.md

@@ -1,10 +1,6 @@
 ---
 ---
-# OpenCode Agent Configuration
-# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in:
-# .opencode/config/agent-metadata.json
-
 name: ContextManager
 name: ContextManager
-description: "Context organization and lifecycle management specialist - discovers, catalogs, validates, and maintains project context structure with dependency tracking"
+description: Context organization and lifecycle management specialist - discovers, catalogs, validates, and maintains project context structure with dependency tracking
 mode: subagent
 mode: subagent
 temperature: 0.1
 temperature: 0.1
 tools:
 tools:
@@ -15,6 +11,7 @@ tools:
   write: true
   write: true
   bash: true
   bash: true
   task: true
   task: true
+permissions:
   read:
   read:
     "**/*": "allow"
     "**/*": "allow"
   grep:
   grep:
@@ -41,22 +38,12 @@ tools:
   task:
   task:
     "contextscout": "allow"
     "contextscout": "allow"
     "*": "deny"
     "*": "deny"
-  - context
-  - organization
-  - management
-  - lifecycle
-  - catalog
 ---
 ---
 
 
 # ContextManager
 # ContextManager
 
 
 > **Mission**: Discover, catalog, validate, and maintain project context structure with dependency tracking and lifecycle management.
 > **Mission**: Discover, catalog, validate, and maintain project context structure with dependency tracking and lifecycle management.
 
 
----
-# OpenCode Agent Configuration
-# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in:
-# .opencode/config/agent-metadata.json
-
   <rule id="context_root">
   <rule id="context_root">
     The ONLY entry point is `.opencode/context/`. All operations start from navigation.md files. Never hardcode paths — follow navigation dynamically.
     The ONLY entry point is `.opencode/context/`. All operations start from navigation.md files. Never hardcode paths — follow navigation dynamically.
   </rule>
   </rule>

+ 2 - 11
.opencode/agent/subagents/core/context-retriever.md

@@ -1,10 +1,6 @@
 ---
 ---
-# OpenCode Agent Configuration
-# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in:
-# .opencode/config/agent-metadata.json
-
 name: Context Retriever
 name: Context Retriever
-description: "Generic context search and retrieval specialist for finding relevant context files, standards, and guides in any repository"
+description: Generic context search and retrieval specialist for finding relevant context files, standards, and guides in any repository
 mode: subagent
 mode: subagent
 temperature: 0.1
 temperature: 0.1
 tools:
 tools:
@@ -15,18 +11,13 @@ tools:
   bash: false
   bash: false
   edit: false
   edit: false
   write: false
   write: false
+permissions:
   bash:
   bash:
     "*": "deny"
     "*": "deny"
   edit:
   edit:
     "**/*": "deny"
     "**/*": "deny"
   write:
   write:
     "**/*": "deny"
     "**/*": "deny"
-  context: []
-  tools: []
-  - context
-  - search
-  - retrieval
-  - subagent
 ---
 ---
 
 
 # Context Retriever Agent
 # Context Retriever Agent

+ 5 - 60
.opencode/agent/subagents/core/contextscout.md

@@ -1,61 +1,21 @@
 ---
 ---
-# OpenCode Agent Configuration
-# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in:
-# .opencode/config/agent-metadata.json
-
 name: ContextScout
 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."
+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
 mode: subagent
-temperature: 0.1
 tools:
 tools:
   read: true
   read: true
   grep: true
   grep: true
   glob: true
   glob: true
-  read:
-    "**/*": "allow"
-  grep:
-    "**/*": "allow"
-  glob:
-    "**/*": "allow"
-  bash:
-    "*": "deny"
-  edit:
-    "**/*": "deny"
-  write:
-    "**/*": "deny"
-  task:
-    "*": "deny"
-  skill:
-    "*": "deny"
-  lsp:
-    "*": "deny"
-  todoread:
-    "*": "deny"
-  todowrite:
-    "*": "deny"
-  webfetch:
-    "*": "deny"
-  websearch:
-    "*": "deny"
-  codesearch:
-    "*": "deny"
-  external_directory:
-    "*": "deny"
-  - context
-  - search
-  - discovery
-  - subagent
+  write: false
+  edit: false
+  bash: false
+  task: false
 ---
 ---
 
 
 # ContextScout
 # ContextScout
 
 
 > **Mission**: Discover and recommend context files from `.opencode/context/` (or custom_dir from paths.json) ranked by priority. Suggest ExternalScout when a framework/library has no internal coverage.
 > **Mission**: Discover and recommend context files from `.opencode/context/` (or custom_dir from paths.json) ranked by priority. Suggest ExternalScout when a framework/library has no internal coverage.
 
 
----
-# OpenCode Agent Configuration
-# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in:
-# .opencode/config/agent-metadata.json
-
   <rule id="context_root">
   <rule id="context_root">
     The context root is determined by paths.json (loaded via @ reference). Default is `.opencode/context/`. If custom_dir is set in paths.json, use that instead. Start by reading `{context_root}/navigation.md`. Never hardcode paths to specific domains — follow navigation dynamically.
     The context root is determined by paths.json (loaded via @ reference). Default is `.opencode/context/`. If custom_dir is set in paths.json, use that instead. Start by reading `{context_root}/navigation.md`. Never hardcode paths to specific domains — follow navigation dynamically.
   </rule>
   </rule>
@@ -85,7 +45,6 @@ tools:
     - Flag frameworks/libraries for ExternalScout when needed
     - Flag frameworks/libraries for ExternalScout when needed
   </tier>
   </tier>
   <conflict_resolution>Tier 1 always overrides Tier 2/3. If returning more files conflicts with verify-before-recommend → verify first. If a path seems relevant but isn't confirmed → don't include it.</conflict_resolution>
   <conflict_resolution>Tier 1 always overrides Tier 2/3. If returning more files conflicts with verify-before-recommend → verify first. If a path seems relevant but isn't confirmed → don't include it.</conflict_resolution>
----
 
 
 ## How It Works
 ## How It Works
 
 
@@ -95,13 +54,6 @@ tools:
 2. **Follow navigation** — Read `navigation.md` files from `.opencode/context/` downward. They are the map.
 2. **Follow navigation** — Read `navigation.md` files from `.opencode/context/` downward. They are the map.
 3. **Return ranked files** — Priority order: Critical → High → Medium. Brief summary per file.
 3. **Return ranked files** — Priority order: Critical → High → Medium. Brief summary per file.
 
 
----
-# OpenCode Agent Configuration
-# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in:
-# .opencode/config/agent-metadata.json
-
----
-
 ## Response Format
 ## Response Format
 
 
 ```markdown
 ```markdown
@@ -133,13 +85,6 @@ The framework **[Name]** has no internal context coverage.
 → Invoke ExternalScout to fetch live docs: `Use ExternalScout for [Name]: [user's question]`
 → Invoke ExternalScout to fetch live docs: `Use ExternalScout for [Name]: [user's question]`
 ```
 ```
 
 
----
-# OpenCode Agent Configuration
-# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in:
-# .opencode/config/agent-metadata.json
-
----
-
 ## What NOT to Do
 ## What NOT to Do
 
 
 - ❌ Don't hardcode domain→path mappings — follow navigation dynamically
 - ❌ Don't hardcode domain→path mappings — follow navigation dynamically

+ 2 - 12
.opencode/agent/subagents/core/documentation.md

@@ -1,10 +1,6 @@
 ---
 ---
-# OpenCode Agent Configuration
-# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in:
-# .opencode/config/agent-metadata.json
-
 name: DocWriter
 name: DocWriter
-description: "Documentation authoring agent"
+description: Documentation authoring agent
 mode: subagent
 mode: subagent
 temperature: 0.2
 temperature: 0.2
 tools:
 tools:
@@ -15,6 +11,7 @@ tools:
   write: true
   write: true
   bash: false
   bash: false
   task: true
   task: true
+permissions:
   bash:
   bash:
     "*": "deny"
     "*": "deny"
   edit:
   edit:
@@ -26,19 +23,12 @@ tools:
   task:
   task:
     contextscout: "allow"
     contextscout: "allow"
     "*": "deny"
     "*": "deny"
-  - documentation
-  - docs
 ---
 ---
 
 
 # DocWriter
 # DocWriter
 
 
 > **Mission**: Create and update documentation that is concise, example-driven, and consistent with project conventions — always grounded in doc standards discovered via ContextScout.
 > **Mission**: Create and update documentation that is concise, example-driven, and consistent with project conventions — always grounded in doc standards discovered via ContextScout.
 
 
----
-# OpenCode Agent Configuration
-# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in:
-# .opencode/config/agent-metadata.json
-
   <rule id="context_first">
   <rule id="context_first">
     ALWAYS call ContextScout BEFORE writing any documentation. Load documentation standards, formatting conventions, and tone guidelines first. Docs without standards = inconsistent documentation.
     ALWAYS call ContextScout BEFORE writing any documentation. Load documentation standards, formatting conventions, and tone guidelines first. Docs without standards = inconsistent documentation.
   </rule>
   </rule>

+ 8 - 10
.opencode/agent/subagents/core/externalscout.md

@@ -1,10 +1,6 @@
 ---
 ---
-# OpenCode Agent Configuration
-# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in:
-# .opencode/config/agent-metadata.json
-
 name: ExternalScout
 name: ExternalScout
-description: "Fetches live, version-specific documentation for external libraries and frameworks using Context7 and other sources. Filters, sorts, and returns relevant documentation."
+description: Fetches live, version-specific documentation for external libraries and frameworks using Context7 and other sources. Filters, sorts, and returns relevant documentation.
 mode: subagent
 mode: subagent
 temperature: 0.1
 temperature: 0.1
 tools:
 tools:
@@ -13,6 +9,13 @@ tools:
   skill: true
   skill: true
   grep: true
   grep: true
   webfetch: true
   webfetch: true
+  write: true
+  edit: true
+  glob: true
+  task: false
+  todoread: false
+  todowrite: false
+permissions:
   read:
   read:
     ".opencode/skill/context7/**": "allow"
     ".opencode/skill/context7/**": "allow"
     ".tmp/external-context/**": "allow"
     ".tmp/external-context/**": "allow"
@@ -49,11 +52,6 @@ tools:
     "*": "deny"
     "*": "deny"
   todowrite:
   todowrite:
     "*": "deny"
     "*": "deny"
-  - external-docs
-  - libraries
-  - frameworks
-  - context7
-  - subagent
 ---
 ---
 
 
 # ExternalScout
 # ExternalScout

+ 4 - 11
.opencode/agent/subagents/core/task-manager.md

@@ -1,10 +1,6 @@
 ---
 ---
-# OpenCode Agent Configuration
-# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in:
-# .opencode/config/agent-metadata.json
-
 name: TaskManager
 name: TaskManager
-description: "JSON-driven task breakdown specialist transforming complex features into atomic, verifiable subtasks with dependency tracking and CLI integration"
+description: JSON-driven task breakdown specialist transforming complex features into atomic, verifiable subtasks with dependency tracking and CLI integration
 mode: subagent
 mode: subagent
 temperature: 0.1
 temperature: 0.1
 tools:
 tools:
@@ -16,6 +12,7 @@ tools:
   bash: true
   bash: true
   task: true
   task: true
   patch: true
   patch: true
+permissions:
   bash:
   bash:
     "npx ts-node*task-cli*": "allow"
     "npx ts-node*task-cli*": "allow"
     "mkdir -p .tmp/tasks*": "allow"
     "mkdir -p .tmp/tasks*": "allow"
@@ -27,12 +24,8 @@ tools:
     "**/*.secret": "deny"
     "**/*.secret": "deny"
     "node_modules/**": "deny"
     "node_modules/**": "deny"
     ".git/**": "deny"
     ".git/**": "deny"
-  skills:
-    - task-management  # CLI for status, validation, and completion tracking
-  - planning
-  - tasks
-  - breakdown
-  - json
+skills:
+  - task-management
 ---
 ---
 
 
 <context>
 <context>

+ 2 - 16
.opencode/agent/subagents/development/devops-specialist.md

@@ -1,10 +1,6 @@
 ---
 ---
-# OpenCode Agent Configuration
-# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in:
-# .opencode/config/agent-metadata.json
-
 name: OpenDevopsSpecialist
 name: OpenDevopsSpecialist
-description: "DevOps specialist subagent - CI/CD, infrastructure as code, deployment automation"
+description: DevOps specialist subagent - CI/CD, infrastructure as code, deployment automation
 mode: subagent
 mode: subagent
 temperature: 0.1
 temperature: 0.1
 tools:
 tools:
@@ -15,6 +11,7 @@ tools:
   task: true
   task: true
   grep: true
   grep: true
   glob: true
   glob: true
+permissions:
   task:
   task:
     contextscout: "allow"
     contextscout: "allow"
     "*": "deny"
     "*": "deny"
@@ -39,23 +36,12 @@ tools:
     "**/*.env*": "deny"
     "**/*.env*": "deny"
     "**/*.key": "deny"
     "**/*.key": "deny"
     "**/*.secret": "deny"
     "**/*.secret": "deny"
-  - devops
-  - ci-cd
-  - infrastructure
-  - deployment
-  - docker
-  - kubernetes
 ---
 ---
 
 
 # DevOps Specialist Subagent
 # DevOps Specialist Subagent
 
 
 > **Mission**: Design and implement CI/CD pipelines, infrastructure automation, and cloud deployments — always grounded in project standards and security best practices.
 > **Mission**: Design and implement CI/CD pipelines, infrastructure automation, and cloud deployments — always grounded in project standards and security best practices.
 
 
----
-# OpenCode Agent Configuration
-# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in:
-# .opencode/config/agent-metadata.json
-
   <rule id="context_first">
   <rule id="context_first">
     ALWAYS call ContextScout BEFORE any infrastructure or pipeline work. Load deployment patterns, security standards, and CI/CD conventions first. This is not optional.
     ALWAYS call ContextScout BEFORE any infrastructure or pipeline work. Load deployment patterns, security standards, and CI/CD conventions first. This is not optional.
   </rule>
   </rule>

+ 3 - 11
.opencode/agent/subagents/development/frontend-specialist.md

@@ -1,10 +1,6 @@
 ---
 ---
-# OpenCode Agent Configuration
-# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in:
-# .opencode/config/agent-metadata.json
-
 name: OpenFrontendSpecialist
 name: OpenFrontendSpecialist
-description: "Frontend UI design specialist - subagent for design systems, themes, animations"
+description: Frontend UI design specialist - subagent for design systems, themes, animations
 mode: subagent
 mode: subagent
 temperature: 0.2
 temperature: 0.2
 tools:
 tools:
@@ -15,6 +11,7 @@ tools:
   task: true
   task: true
   glob: true
   glob: true
   grep: true
   grep: true
+permissions:
   task:
   task:
     contextscout: "allow"
     contextscout: "allow"
     externalscout: "allow"
     externalscout: "allow"
@@ -38,12 +35,7 @@ tools:
 
 
 # Frontend Design Subagent
 # Frontend Design Subagent
 
 
-> **Mission**: Create complete UI designs with cohesive design systems, themes, and animations — always grounded in current library docs and project standards.
-
----
-# OpenCode Agent Configuration
-# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in:
-# .opencode/config/agent-metadata.json
+> **Mission**: Create complete UI designs with cohesive design systems, themes, animations — always grounded in current library docs and project standards.
 
 
   <rule id="context_first">
   <rule id="context_first">
     ALWAYS call ContextScout BEFORE any design or implementation work. Load design system standards, UI conventions, and accessibility requirements first.
     ALWAYS call ContextScout BEFORE any design or implementation work. Load design system standards, UI conventions, and accessibility requirements first.

+ 2 - 13
.opencode/agent/subagents/system-builder/context-organizer.md

@@ -1,10 +1,6 @@
 ---
 ---
-# OpenCode Agent Configuration
-# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in:
-# .opencode/config/agent-metadata.json
-
 name: ContextOrganizer
 name: ContextOrganizer
-description: "Organizes and generates context files (domain, processes, standards, templates) for optimal knowledge management"
+description: Organizes and generates context files (domain, processes, standards, templates) for optimal knowledge management
 mode: subagent
 mode: subagent
 temperature: 0.1
 temperature: 0.1
 tools:
 tools:
@@ -14,6 +10,7 @@ tools:
   grep: true
   grep: true
   glob: true
   glob: true
   task: true
   task: true
+permissions:
   task:
   task:
     contextscout: "allow"
     contextscout: "allow"
     "*": "deny"
     "*": "deny"
@@ -21,20 +18,12 @@ tools:
     "**/*.env*": "deny"
     "**/*.env*": "deny"
     "**/*.key": "deny"
     "**/*.key": "deny"
     "**/*.secret": "deny"
     "**/*.secret": "deny"
-  - context:core/context-system/*
-  - context
-  - organization
 ---
 ---
 
 
 # Context Organizer
 # Context Organizer
 
 
 > **Mission**: Generate well-organized, MVI-compliant context files that provide domain knowledge, process documentation, quality standards, and reusable templates.
 > **Mission**: Generate well-organized, MVI-compliant context files that provide domain knowledge, process documentation, quality standards, and reusable templates.
 
 
----
-# OpenCode Agent Configuration
-# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in:
-# .opencode/config/agent-metadata.json
-
   <rule id="context_first">
   <rule id="context_first">
     ALWAYS call ContextScout BEFORE generating any context files. You need to understand the existing context system structure, MVI standards, and frontmatter requirements before creating anything new.
     ALWAYS call ContextScout BEFORE generating any context files. You need to understand the existing context system structure, MVI standards, and frontmatter requirements before creating anything new.
   </rule>
   </rule>

+ 2 - 12
.opencode/agent/subagents/system-builder/workflow-designer.md

@@ -1,10 +1,6 @@
 ---
 ---
-# OpenCode Agent Configuration
-# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in:
-# .opencode/config/agent-metadata.json
-
 name: WorkflowDesigner
 name: WorkflowDesigner
-description: "Designs complete workflow definitions with context dependencies and success criteria"
+description: Designs complete workflow definitions with context dependencies and success criteria
 mode: subagent
 mode: subagent
 temperature: 0.1
 temperature: 0.1
 tools:
 tools:
@@ -14,6 +10,7 @@ tools:
   grep: true
   grep: true
   glob: true
   glob: true
   task: true
   task: true
+permissions:
   task:
   task:
     contextscout: "allow"
     contextscout: "allow"
     "*": "deny"
     "*": "deny"
@@ -21,19 +18,12 @@ tools:
     "**/*.env*": "deny"
     "**/*.env*": "deny"
     "**/*.key": "deny"
     "**/*.key": "deny"
     "**/*.secret": "deny"
     "**/*.secret": "deny"
-  - workflow
-  - design
 ---
 ---
 
 
 # Workflow Designer
 # Workflow Designer
 
 
 > **Mission**: Design complete, executable workflow definitions that map use cases to agent coordination patterns — always grounded in existing workflow standards discovered via ContextScout.
 > **Mission**: Design complete, executable workflow definitions that map use cases to agent coordination patterns — always grounded in existing workflow standards discovered via ContextScout.
 
 
----
-# OpenCode Agent Configuration
-# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in:
-# .opencode/config/agent-metadata.json
-
   <rule id="context_first">
   <rule id="context_first">
     ALWAYS call ContextScout BEFORE designing any workflow. You need to understand existing workflow patterns, agent capabilities, and coordination standards before creating new workflows.
     ALWAYS call ContextScout BEFORE designing any workflow. You need to understand existing workflow patterns, agent capabilities, and coordination standards before creating new workflows.
   </rule>
   </rule>

+ 21 - 6
.opencode/context/openagents-repo/navigation.md

@@ -2,7 +2,7 @@
 
 
 **Purpose**: Context files specific to the OpenAgents Control repository
 **Purpose**: Context files specific to the OpenAgents Control repository
 
 
-**Last Updated**: 2026-01-30
+**Last Updated**: 2026-01-31
 
 
 ---
 ---
 
 
@@ -10,6 +10,7 @@
 
 
 | Function | Files | Purpose |
 | Function | Files | Purpose |
 |----------|-------|---------|
 |----------|-------|---------|
+| **Standards** | 2 files | Agent creation standards |
 | **Concepts** | 2 files | Core ideas and principles |
 | **Concepts** | 2 files | Core ideas and principles |
 | **Examples** | 1 file | Working code samples |
 | **Examples** | 1 file | Working code samples |
 | **Guides** | 10 files | Step-by-step workflows |
 | **Guides** | 10 files | Step-by-step workflows |
@@ -18,6 +19,17 @@
 
 
 ---
 ---
 
 
+## Standards (Agent Creation)
+
+| File | Topic | Priority |
+|------|-------|----------|
+| `standards/agent-frontmatter.md` | Valid OpenCode YAML frontmatter | ⭐⭐⭐⭐⭐ |
+| `standards/subagent-structure.md` | Standard subagent file structure | ⭐⭐⭐⭐⭐ |
+
+**When to read**: Before creating or modifying any agent files
+
+---
+
 ## Concepts (Core Ideas)
 ## Concepts (Core Ideas)
 
 
 | File | Topic | Priority |
 | File | Topic | Priority |
@@ -101,11 +113,13 @@
 4. If errors: Load `errors/tool-permission-errors.md`
 4. If errors: Load `errors/tool-permission-errors.md`
 
 
 ### For Agent Creation:
 ### For Agent Creation:
-1. Load `core-concepts/agents.md` (understand structure)
-2. Load `guides/adding-agent.md` (step-by-step)
-3. **If using external libraries**: Load `guides/external-libraries-workflow.md` (fetch docs)
-4. Load `examples/subagent-prompt-structure.md` (if subagent)
-5. Load `guides/testing-agent.md` (validate)
+1. Load `standards/agent-frontmatter.md` (valid YAML frontmatter)
+2. Load `standards/subagent-structure.md` (file structure)
+3. Load `core-concepts/agents.md` (understand system)
+4. Load `guides/adding-agent.md` (step-by-step)
+5. **If using external libraries**: Load `guides/external-libraries-workflow.md` (fetch docs)
+6. Load `examples/subagent-prompt-structure.md` (if subagent)
+7. Load `guides/testing-agent.md` (validate)
 
 
 ### For Issue Management:
 ### For Issue Management:
 1. Load `guides/github-issues-workflow.md` (understand workflow)
 1. Load `guides/github-issues-workflow.md` (understand workflow)
@@ -124,6 +138,7 @@
 
 
 All files follow MVI principle (<200 lines):
 All files follow MVI principle (<200 lines):
 
 
+- ✅ Standards: <200 lines
 - ✅ Concepts: <100 lines
 - ✅ Concepts: <100 lines
 - ✅ Examples: <100 lines
 - ✅ Examples: <100 lines
 - ✅ Guides: <150 lines
 - ✅ Guides: <150 lines

+ 194 - 0
.opencode/context/openagents-repo/standards/agent-frontmatter.md

@@ -0,0 +1,194 @@
+<!-- Context: openagents-repo/standards/agent-frontmatter | Priority: critical | Version: 1.0 | Updated: 2026-01-31 -->
+# Standard: Agent YAML Frontmatter
+
+**Purpose**: Valid OpenCode agent frontmatter structure and common mistakes to avoid  
+**Priority**: CRITICAL - Load this before creating or modifying agent files
+
+---
+
+## Core Principle
+
+Agent frontmatter must contain ONLY valid OpenCode fields. All other metadata (id, name, category, tags, dependencies) belongs in `.opencode/config/agent-metadata.json`.
+
+**Why**: OpenCode validates frontmatter strictly. Extra fields cause validation errors.
+
+---
+
+## Valid OpenCode Fields
+
+### Required
+```yaml
+---
+name: AgentName                      # Display name
+description: "What this agent does"  # When to use
+mode: subagent                       # primary, subagent, or all
+---
+```
+
+### Optional
+```yaml
+temperature: 0.1                     # Response randomness (0.0-1.0)
+model: anthropic/claude-sonnet-4     # Model override
+maxSteps: 50                         # Max iterations
+disable: false                       # Disable agent
+hidden: false                        # Hide from autocomplete
+prompt: "{file:./prompts/custom.txt}" # Custom prompt
+
+tools:                               # Tool access
+  read: true
+  write: false
+  edit: false
+  bash: false
+  task: false
+
+permissions:                         # Permission rules
+  bash:
+    "git *": "allow"
+    "*": "deny"
+  edit:
+    "**/*.env*": "deny"
+  task:
+    contextscout: "allow"
+    "*": "deny"
+
+skills:                              # Skills to load
+  - task-management
+```
+
+---
+
+## Complete Example
+
+```yaml
+---
+name: TestEngineer
+description: Test authoring and TDD agent
+mode: subagent
+temperature: 0.1
+tools:
+  read: true
+  grep: true
+  edit: true
+  write: true
+  bash: true
+  task: true
+permissions:
+  bash:
+    "npx vitest *": "allow"
+    "pytest *": "allow"
+    "sudo *": "deny"
+    "*": "deny"
+  edit:
+    "**/*.env*": "deny"
+  task:
+    contextscout: "allow"
+    "*": "deny"
+---
+```
+
+---
+
+## Common Mistakes (Fixed in 18 Agents)
+
+### 1. Duplicate Keys ❌
+```yaml
+tools:
+  read: true
+  read: {"**/*": "allow"}  # ❌ Duplicate key
+```
+**Fix**: Use only one declaration per key
+
+### 2. Orphaned List Items ❌
+```yaml
+tools:
+  read: true
+  - write: false  # ❌ No parent key
+```
+**Fix**: Proper YAML structure (no orphaned items)
+
+### 3. Wrong Field Names ❌
+```yaml
+permission:  # ❌ Should be 'permissions'
+  bash:
+    "*": "deny"
+```
+**Fix**: Use correct field name `permissions:`
+
+### 4. Extra Delimiter Blocks ❌
+```yaml
+---
+name: MyAgent
+---
+# Content
+---  # ❌ Extra delimiter
+More content
+```
+**Fix**: Only one `---` block at top
+
+### 5. Invalid OpenCode Fields ❌
+```yaml
+---
+id: my-agent          # ❌ Not valid
+category: development # ❌ Not valid
+type: agent           # ❌ Not valid
+version: 1.0.0        # ❌ Not valid
+tags: [coding]        # ❌ Not valid
+dependencies: []      # ❌ Not valid
+```
+**Fix**: Move to `.opencode/config/agent-metadata.json`:
+```json
+{
+  "agents": {
+    "my-agent": {
+      "id": "my-agent",
+      "category": "development",
+      "type": "agent",
+      "version": "1.0.0",
+      "tags": ["coding"],
+      "dependencies": []
+    }
+  }
+}
+```
+
+---
+
+## Validation Checklist
+
+- [ ] Only valid OpenCode fields?
+- [ ] No duplicate keys?
+- [ ] No orphaned list items?
+- [ ] Correct field names (`permissions` not `permission`)?
+- [ ] Only one `---` delimiter at top?
+- [ ] Metadata moved to agent-metadata.json?
+- [ ] Valid YAML syntax?
+
+---
+
+## Validation Commands
+
+```bash
+# Check YAML syntax
+yq eval '.opencode/agent/category/agent.md' > /dev/null
+
+# Find duplicate keys
+grep -A 50 "^---$" agent.md | grep -E "^[a-z_]+:" | sort | uniq -d
+
+# List all frontmatter keys
+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`
+
+---
+
+## Related
+
+- **Agent Metadata**: `core-concepts/agent-metadata.md`
+- **Subagent Structure**: `standards/subagent-structure.md`
+- **Adding Agents**: `guides/adding-agent.md`
+- **OpenCode Docs**: https://opencode.ai/docs/agents/
+
+---
+
+**Last Updated**: 2026-01-31 | **Version**: 1.0.0

+ 159 - 0
.opencode/context/openagents-repo/standards/navigation.md

@@ -0,0 +1,159 @@
+<!-- Context: openagents-repo/standards/navigation | Priority: critical | Version: 1.0 | Updated: 2026-01-31 -->
+# OpenAgents Repo Standards
+
+**Purpose**: Standards for creating and maintaining agents in OpenAgents Control  
+**Last Updated**: 2026-01-31
+
+---
+
+## Overview
+
+This directory contains standards for agent creation, focusing on:
+- Valid OpenCode YAML frontmatter structure
+- Subagent file organization and patterns
+- Common mistakes and how to avoid them
+
+These standards emerged from fixing YAML frontmatter issues across 18 agent files.
+
+---
+
+## Standards Files
+
+| File | Description | Priority | Lines |
+|------|-------------|----------|-------|
+| [agent-frontmatter.md](agent-frontmatter.md) | Valid OpenCode frontmatter fields and common mistakes | critical | <200 |
+| [subagent-structure.md](subagent-structure.md) | Standard structure for subagent files | critical | <200 |
+
+---
+
+## Quick Reference
+
+### Valid OpenCode Fields (Frontmatter)
+
+**Required**:
+- `name` - Display name
+- `description` - When to use this agent
+- `mode` - Agent type (primary, subagent, all)
+
+**Optional**:
+- `temperature` - Response randomness (0.0-1.0)
+- `model` - Model override
+- `maxSteps` - Max iterations
+- `disable` - Disable agent
+- `hidden` - Hide from autocomplete
+- `prompt` - Custom prompt file
+- `tools` - Tool access config
+- `permissions` - Permission rules
+- `skills` - Skills to load
+
+### Invalid Fields (Move to agent-metadata.json)
+
+These fields are NOT valid in OpenCode frontmatter:
+- `id` - Agent identifier
+- `category` - Agent category
+- `type` - Component type
+- `version` - Version number
+- `author` - Author identifier
+- `tags` - Discovery tags
+- `dependencies` - Component dependencies
+
+**Solution**: Move these to `.opencode/config/agent-metadata.json`
+
+---
+
+## Common Mistakes Fixed
+
+### 1. Duplicate YAML Keys
+**Problem**: `read: true` followed by `read: {"**/*": "allow"}`  
+**Fix**: Use only one declaration per key
+
+### 2. Orphaned List Items
+**Problem**: Lines without parent keys (e.g., `- write: false`)  
+**Fix**: Proper YAML structure with parent keys
+
+### 3. Wrong Field Names
+**Problem**: `permission:` instead of `permissions:`  
+**Fix**: Use correct field name `permissions:`
+
+### 4. Extra Delimiter Blocks
+**Problem**: Multiple `---` blocks in content  
+**Fix**: Only one frontmatter block at top
+
+### 5. Invalid OpenCode Fields
+**Problem**: Fields like `id`, `category`, `type` in frontmatter  
+**Fix**: Move to agent-metadata.json
+
+---
+
+## Loading Strategy
+
+### For Creating New Agents
+1. Load `agent-frontmatter.md` - Understand valid fields
+2. Load `subagent-structure.md` - Follow structure pattern
+3. Reference existing agents as examples
+4. Validate YAML syntax before committing
+
+### For Fixing Existing Agents
+1. Load `agent-frontmatter.md` - Identify invalid fields
+2. Check for common mistakes (duplicates, orphans, wrong names)
+3. Move invalid fields to agent-metadata.json
+4. Validate with YAML parser
+
+### For Code Reviews
+1. Load `agent-frontmatter.md` - Check frontmatter validity
+2. Load `subagent-structure.md` - Verify structure compliance
+3. Check for common mistakes
+4. Validate YAML syntax
+
+---
+
+## Validation Commands
+
+### Check YAML Syntax
+```bash
+yq eval '.opencode/agent/category/agent.md' > /dev/null
+```
+
+### Check for Duplicate Keys
+```bash
+grep -A 50 "^---$" .opencode/agent/category/agent.md | grep -E "^[a-z_]+:" | sort | uniq -d
+```
+
+### List All Frontmatter Keys
+```bash
+grep -A 50 "^---$" .opencode/agent/category/agent.md | grep -E "^[a-z_]+:" | cut -d: -f1
+```
+
+Valid keys: `name`, `description`, `mode`, `temperature`, `model`, `maxSteps`, `disable`, `hidden`, `prompt`, `tools`, `permissions`, `skills`
+
+---
+
+## Related Context
+
+### Core Concepts
+- [Agent Metadata System](../core-concepts/agent-metadata.md) - Centralized metadata management
+- [Agents](../core-concepts/AGENTS.md) - Agent system overview
+- [Categories](../core-concepts/categories.md) - Agent categorization
+
+### Guides
+- [Adding Agents](../guides/adding-agent.md) - How to create new agents
+- [Testing Agents](../guides/testing-agent.md) - Agent testing workflow
+
+### Lookup
+- [File Locations](../lookup/file-locations.md) - Where files go
+
+---
+
+## History
+
+**2026-01-31**: Initial standards created after fixing YAML frontmatter issues in 18 agent files. Issues fixed:
+- Duplicate YAML keys (e.g., `read: true` + `read: {"**/*": "allow"}`)
+- Orphaned list items (lines without parent keys)
+- Wrong field names (`permission:` → `permissions:`)
+- Extra `---` delimiter blocks in content
+- Invalid OpenCode fields in frontmatter
+
+---
+
+**Version**: 1.0.0  
+**Maintainer**: OpenAgents Control Team

+ 192 - 0
.opencode/context/openagents-repo/standards/subagent-structure.md

@@ -0,0 +1,192 @@
+<!-- Context: openagents-repo/standards/subagent-structure | Priority: critical | Version: 1.0 | Updated: 2026-01-31 -->
+# Standard: Subagent File Structure
+
+**Purpose**: Standard structure for subagent files  
+**Priority**: CRITICAL - Load this before creating subagent files
+
+---
+
+## File Template
+
+```markdown
+---
+name: AgentName
+description: Brief description
+mode: subagent
+temperature: 0.1
+tools: {...}
+permissions: {...}
+---
+
+# AgentName
+> **Mission**: One-sentence mission
+
+<rule id="rule_name">Rule description</rule>
+
+<context>
+  <system>Role in pipeline</system>
+  <domain>Expertise area</domain>
+  <task>What agent does</task>
+  <constraints>Limitations</constraints>
+</context>
+
+<tier level="1" desc="Critical">
+  - @rule_id: Description
+</tier>
+
+## Workflow
+### Step 1: Preparation
+### Step 2: Execution
+### Step 3: Output
+
+## Output Format
+```yaml
+status: "success" | "failure"
+```
+```
+
+---
+
+## Section Details
+
+### 1. Frontmatter
+- ONLY valid OpenCode fields (see agent-frontmatter.md)
+- No duplicate keys, orphaned items, or invalid fields
+
+### 2. Header + Mission
+```markdown
+# TestEngineer
+> **Mission**: Author tests following TDD — grounded in project standards.
+```
+
+### 3. Critical Rules (3-5 max)
+```markdown
+<rule id="context_first">ALWAYS call ContextScout BEFORE writing tests.</rule>
+<rule id="positive_and_negative">EVERY behavior needs positive AND negative tests.</rule>
+```
+
+### 4. Context
+```markdown
+<context>
+  <system>Code quality gate</system>
+  <domain>Code review, security, quality</domain>
+  <task>Review code against standards</task>
+  <constraints>Read-only, no modifications</constraints>
+</context>
+```
+
+### 5. Execution Tiers
+```markdown
+<tier level="1" desc="Critical">
+  - @context_first: Load context first
+</tier>
+<tier level="2" desc="Core">
+  - Load standards
+  - Analyze code
+</tier>
+<conflict_resolution>Tier 1 overrides Tier 2/3</conflict_resolution>
+```
+
+---
+
+## Tool Permission Patterns
+
+### Read-Only (Reviewers, Analyzers)
+```yaml
+tools: {read: true, grep: true, glob: true, bash: false, edit: false, write: false}
+permissions:
+  bash: {"*": "deny"}
+  edit: {"**/*": "deny"}
+  task: {contextscout: "allow", "*": "deny"}
+```
+
+### Write-Enabled (Coders, Testers)
+```yaml
+tools: {read: true, edit: true, write: true, bash: true}
+permissions:
+  bash: {"npm test *": "allow", "git *": "allow", "sudo *": "deny", "*": "deny"}
+  edit: {"**/*.env*": "deny", "**/*.key": "deny"}
+  task: {contextscout: "allow", "*": "deny"}
+```
+
+### Restricted Bash (Task Managers)
+```yaml
+tools: {read: true, bash: true}
+permissions:
+  bash: {"npx ts-node*task-cli*": "allow", "mkdir -p .tmp/tasks*": "allow", "*": "deny"}
+```
+
+---
+
+## File Organization
+
+```
+.opencode/agent/subagents/
+├── code/           # tester, reviewer, coder-agent, build-agent
+├── core/           # task-manager, contextscout, documentation
+├── system-builder/ # agent-generator, command-creator
+└── utils/          # image-specialist
+```
+
+---
+
+## Validation Checklist
+
+- [ ] Valid OpenCode frontmatter (no extra fields)?
+- [ ] Mission statement present?
+- [ ] 3-5 critical rules with unique IDs?
+- [ ] Context section complete?
+- [ ] Execution tiers defined with conflict resolution?
+- [ ] Workflow steps clear and actionable?
+- [ ] Output format specified?
+- [ ] Tool permissions appropriate for role?
+- [ ] File in correct category directory?
+- [ ] No YAML syntax errors?
+
+---
+
+## Common Patterns
+
+**Context-First Pattern**:
+```markdown
+<rule id="context_first">
+  ALWAYS call ContextScout BEFORE starting work. Load relevant standards first.
+</rule>
+```
+
+**Read-Only Pattern**:
+```markdown
+<rule id="read_only">
+  Read-only agent. NEVER use write, edit, or bash. Provide suggestions only.
+</rule>
+```
+
+**Security Pattern**:
+```markdown
+permissions:
+  edit:
+    "**/*.env*": "deny"
+    "**/*.key": "deny"
+    "**/*.secret": "deny"
+```
+
+---
+
+## Examples
+
+**See existing subagents**:
+- `.opencode/agent/subagents/code/tester.md` - Write-enabled with tests
+- `.opencode/agent/subagents/code/reviewer.md` - Read-only reviewer
+- `.opencode/agent/subagents/core/task-manager.md` - Restricted bash
+
+---
+
+## Related
+
+- **Frontmatter**: `standards/agent-frontmatter.md`
+- **Metadata**: `core-concepts/agent-metadata.md`
+- **Adding Agents**: `guides/adding-agent.md`
+
+---
+
+**Last Updated**: 2026-01-31 | **Version**: 1.0.0