Complete guide for developing on the OpenAgents Control repository
This guide covers everything you need to know to develop agents, commands, tools, and contribute to the OpenAgents Control ecosystem.
# Clone the repository
git clone https://github.com/darrenhinde/OpenAgentsControl.git
cd OpenAgentsControl
# Install dependencies for testing framework
cd evals/framework
npm install
cd ../..
# Validate registry
make validate-registry
# Run tests
cd evals/framework
npm test
opencode-agents/
├── .opencode/ # OpenCode configuration
│ ├── agent/ # Agent prompts (category-based)
│ │ ├── core/
│ │ │ ├── openagent.md # Universal orchestrator
│ │ │ └── opencoder.md # Development specialist
│ │ ├── meta/
│ │ │ └── system-builder.md # System architect
│ │ ├── development/
│ │ │ ├── frontend-specialist.md
│ │ │ └── backend-specialist.md
│ │ ├── content/
│ │ │ └── copywriter.md
│ │ └── subagents/ # Specialized subagents
│ │ ├── code/ # Code-related subagents
│ │ ├── core/ # Core functionality subagents
│ │ ├── system-builder/ # System building subagents
│ │ └── utils/ # Utility subagents
│ ├── command/ # Slash commands
│ │ ├── openagents/ # OpenAgents Control-specific commands
│ │ │ └── new-agents/ # Agent creation system ⭐
│ │ └── prompt-engineering/ # Prompt optimization commands
│ ├── context/ # Context files
│ │ ├── core/ # Core context (standards, workflows)
│ │ ├── project/ # Project-specific context
│ │ └── system-builder-templates/ # Templates
│ ├── plugin/ # Plugins and integrations
│ ├── prompts/ # Prompt library (model variants, category-based)
│ │ ├── core/
│ │ │ ├── openagent/ # OpenAgent variants
│ │ │ └── opencoder/ # OpenCoder variants
│ │ └── development/
│ │ └── frontend-specialist/ # Frontend specialist variants
│ └── tool/ # Utility tools
├── evals/ # Testing framework
│ ├── agents/ # Agent test suites
│ │ ├── openagent/ # OpenAgent tests
│ │ └── opencoder/ # OpenCoder tests
│ ├── framework/ # Test framework code
│ │ ├── src/ # Framework source
│ │ └── scripts/ # Test utilities
│ └── results/ # Test results
├── scripts/ # Automation scripts
│ ├── registry/ # Registry management
│ ├── prompts/ # Prompt management
│ └── testing/ # Test utilities
├── docs/ # Documentation
│ ├── agents/ # Agent documentation
│ ├── contributing/ # Contribution guides
│ ├── features/ # Feature documentation
│ └── guides/ # User guides
└── registry.json # Component registry
.opencode/agent/Main agent prompts organized by category. These are the "brains" of the system:
.opencode/command/Slash commands that users can invoke:
.opencode/context/Context files that agents load on-demand:
.opencode/prompts/Prompt library with model-specific variants (category-based structure):
evals/Comprehensive testing framework:
git checkout -b feature/my-new-feature
Follow the appropriate guide:
# Validate structure
./scripts/registry/validate-component.sh
# Run tests
cd evals/framework
npm test -- --agent=your-agent
# Test manually
opencode --agent=your-agent
git add .
git commit -m "feat: add new feature"
git push origin feature/my-new-feature
We now have a streamlined system for creating agents following Anthropic 2025 research best practices.
# Use the agent creation command
/create-agent my-agent-name
# Or invoke directly
opencode "Create a new agent called 'python-dev' for Python development"
The system generates:
The agent creation system follows these proven patterns:
Why: Code changes are deeply dependent. Sub-agents can't coordinate edits to the same file.
Application:
Why: "Find the smallest possible set of high-signal tokens that maximize likelihood of desired outcome"
The Balance: | Too Vague | Right Altitude ✅ | Too Rigid | |-----------|------------------|-----------| | "Write good code" | Clear heuristics + examples | 50-line prompt with edge cases |
Application:
Why: Prevents "drowning in irrelevant information"
Application:
Why: "Tool ambiguity is one of the biggest failure modes"
Application:
<tool name="read_file">
<purpose>Load specific file for analysis or modification</purpose>
<when_to_use>You need to examine or edit a file</when_to_use>
<when_not_to_use>You already have the file content in context</when_not_to_use>
</tool>
Why: Improved instruction-following and reasoning efficiency
Application:
Why: Maintain context efficiency over long-horizon tasks
Application:
Why: "Parallel tool calling cut research time by up to 90%"
Application:
Why: "Token usage explains 80% of performance variance"
Measure:
If you prefer manual creation, follow this structure:
1. Create Agent File (.opencode/agent/my-agent.md)
---
description: "Brief one-line description"
mode: primary
temperature: 0.1
tools:
read: true
write: true
edit: true
bash: true
glob: true
grep: true
permissions:
bash:
"rm -rf *": "ask"
"sudo *": "deny"
edit:
"**/*.env*": "deny"
"**/*.key": "deny"
---
# My Agent
<role>
Clear, concise role - what this agent does
</role>
<approach>
1. Read and understand the context
2. Think about the approach before acting
3. Implement changes incrementally
4. Verify each step with appropriate tools
5. Complete with clear summary
</approach>
<heuristics>
- Decompose problems before implementing
- Use tools intentionally (not speculatively)
- Verify outputs before claiming completion
- Stop on errors and report (don't auto-fix blindly)
</heuristics>
<output>
Always include:
- What you did
- Why you did it that way
- Test/validation results
</output>
<examples>
<example name="Typical Use Case">
**User**: "typical request"
**Agent**:
1. Read relevant files
2. Think about approach
3. Implement change
4. Verify
**Result**: Expected outcome
</example>
</examples>
2. Create Context File (.opencode/context/project/my-agent-context.md)
# My Agent Context
## Key Commands
- command 1: what it does
- command 2: what it does
## File Structure
- path pattern: what goes here
## Code Style
- style rule 1
- style rule 2
## Workflow Rules
- workflow rule 1
- workflow rule 2
## Before Committing
1. check 1
2. check 2
3. Create Test Suite
Use the test generator:
/create-tests my-agent
Or manually create 8 tests in evals/agents/my-agent/tests/:
planning/planning-approval-001.yamlcontext-loading/context-before-code-001.yamlimplementation/incremental-001.yamlimplementation/tool-usage-001.yamlerror-handling/stop-on-failure-001.yamlimplementation/extended-thinking-001.yamllong-horizon/compaction-001.yamlcompletion/handoff-001.yaml4. Register Agent
The registry auto-updates on merge to main, or manually:
./scripts/registry/register-component.sh
Pre-built templates are available in:
.opencode/command/openagents/new-agents/templates/
├── agent-template.md # Minimal agent template
├── context-template.md # CLAUDE.md pattern
├── test-config-template.yaml # Test configuration
└── test-*.yaml # 8 test templates
Commands are slash commands users can invoke.
---
description: "What this command does"
---
# Command Name
<target_argument> $ARGUMENTS </target_argument>
<role>
What this command specializes in
</role>
<task>
Specific objective of this command
</task>
<workflow>
<step_1>
Action and process
</step_1>
<step_2>
Action and process
</step_2>
</workflow>
See .opencode/command/openagents/new-agents/create-agent.md for a complete example.
Tools are TypeScript utilities that agents can use.
/**
* Tool Name
*
* Brief description of what this tool does
*/
export function myTool(param: string): string {
// Implementation
return result;
}
Place tools in .opencode/tool/my-tool/index.ts
We use a comprehensive evaluation framework in evals/framework/.
# Run all tests
cd evals/framework
npm test
# Run tests for specific agent
npm test -- --agent=openagent
# Run specific category
npm test -- --agent=openagent --category=planning
# Run single test
npm test -- --agent=openagent --test=planning-approval-001
# Verbose output
npm test -- --verbose
Each agent should have 8 essential test types:
id: test-id-001
name: Test Name
description: |
What this test verifies
category: planning
agent: my-agent
model: anthropic/claude-sonnet-4-5
prompt: |
Test prompt
behavior:
mustContain:
- "expected text"
mustNotContain:
- "forbidden text"
mustUseAnyOf: [[tool1], [tool2]]
minToolCalls: 1
expectedViolations:
- rule: rule-name
shouldViolate: false
severity: error
approvalStrategy:
type: auto-approve
timeout: 30000
tags:
- tag1
- tag2
Use the templates in .opencode/command/openagents/new-agents/templates/ as starting points.
✅ Do:
❌ Don't:
any)set -e for error handlingmy-new-agent.md# 1. Edit the agent file
vim .opencode/agent/my-agent.md
# 2. Test changes
cd evals/framework
npm test -- --agent=my-agent
# 3. Update tests if needed
vim evals/agents/my-agent/tests/...
# 4. Commit
git add .
git commit -m "feat: improve my-agent behavior"
# 1. Create test file
vim evals/agents/my-agent/tests/new-category/new-test-001.yaml
# 2. Update config
vim evals/agents/my-agent/config/config.yaml
# Add new category to testPaths
# 3. Run test
cd evals/framework
npm test -- --agent=my-agent --test=new-test-001
# 1. Copy template
cp .opencode/prompts/core/openagent/TEMPLATE.md .opencode/prompts/core/openagent/my-variant.md
# 2. Edit variant
vim .opencode/prompts/core/openagent/my-variant.md
# 3. Test variant
./scripts/prompts/test-prompt.sh core/openagent my-variant
# 4. Update README with results
vim .opencode/prompts/core/openagent/README.md
# Validate component structure
./scripts/registry/validate-component.sh
# Ensure using default prompts
./scripts/prompts/validate-pr.sh
# Run all tests
cd evals/framework
npm test
# Validate registry
make validate-registry
Problem: Tests fail after making changes
Solution:
--verbose flag for detailsProblem: make validate-registry fails
Solution:
registry.json syntax./scripts/registry/validate-component.sh for detailsProblem: Agent doesn't load context files
Solution:
.opencode/context/read tool enabledProblem: Custom tool not accessible to agent
Solution:
.opencode/tool/my-tool/index.tscd .opencode/tool && npm run buildHappy developing! 🚀