* fix(shellcheck): declare and assign separately in router.sh (SC2155) * feat(plugin): enhance context management and skill invocation - Update .context-manifest.json to include profile and detailed source information. - Revise context-scout.md to clarify context root discovery and navigation. - Modify commands to replace deprecated skills with updated ones (brainstorming → approach, systematic-debugging → debugger). - Streamline install-context.md for clarity and remove interactive profile selection. - Improve oac-status.md to provide a more comprehensive status report. - Add OAC system paths to session-start.sh for better context management. - Remove obsolete skills and improve documentation for existing commands.
4.5 KiB
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 | Valid OpenCode frontmatter fields and common mistakes | critical | <200 |
| subagent-structure.md | Standard structure for subagent files | critical | <200 |
Quick Reference
Valid OpenCode Fields (Frontmatter)
Required:
name- Display namedescription- When to use this agentmode- Agent type (primary, subagent, all)
Optional:
temperature- Response randomness (0.0-1.0)model- Model overridemaxSteps- Max iterationsdisable- Disable agenthidden- Hide from autocompleteprompt- Custom prompt filetools- Tool access configpermission- Permission rulesskills- Skills to load
Invalid Fields (Move to agent-metadata.json)
These fields are NOT valid in OpenCode frontmatter:
id- Agent identifiercategory- Agent categorytype- Component typeversion- Version numberauthor- Author identifiertags- Discovery tagsdependencies- 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
- Load
agent-frontmatter.md- Understand valid fields - Load
subagent-structure.md- Follow structure pattern - Reference existing agents as examples
- Validate YAML syntax before committing
For Fixing Existing Agents
- Load
agent-frontmatter.md- Identify invalid fields - Check for common mistakes (duplicates, orphans, wrong names)
- Move invalid fields to agent-metadata.json
- Validate with YAML parser
For Code Reviews
- Load
agent-frontmatter.md- Check frontmatter validity - Load
subagent-structure.md- Verify structure compliance - Check for common mistakes
- Validate YAML syntax
Validation Commands
Check YAML Syntax
yq eval '.opencode/agent/category/agent.md' > /dev/null
Check for Duplicate Keys
grep -A 50 "^---$" .opencode/agent/category/agent.md | grep -E "^[a-z_]+:" | sort | uniq -d
List All Frontmatter Keys
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 - Centralized metadata management
- Agents - Agent system overview
- Categories - Agent categorization
Guides
- Adding Agents - How to create new agents
- Testing Agents - Agent testing workflow
Lookup
- File Locations - 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