OpenWriterControle/.opencode/prompts/core/openagent
Darren Hinde c8f7103cb6
refactor(evals): consolidate documentation and enhance test infrastructure (#56)
* feat(agents): implement category-based agent organization system

- Organize agents into domain categories (core, development, content, data, product, learning)
- Move 10 agents to category subdirectories with proper git rename tracking
- Update 13 subagents with category and type metadata in frontmatter
- Add category metadata files (0-category.json) documenting common patterns
- Implement local registry fallback in install script for offline development
- Add comprehensive validation suite with 15 automated tests (100% pass rate)
- Enhance registry validation with duplicate ID and consistency checks
- Update eval framework with intelligent path resolution (backward compatible)
- Archive legacy eval structure to _archive/ for reference
- Update all documentation to reflect category-based structure
- Bump version to 0.5.0 with accurate CHANGELOG

Technical Details:
- 23 agents organized (10 category agents, 13 subagents)
- 6 category directories created
- Path resolution supports both agent IDs and category paths
- Registry schema updated to v2.0.0
- 159 files changed, 872 insertions(+), 10738 deletions(-)

BREAKING CHANGE: Agent file paths now use category structure. Update references from .opencode/agent/openagent.md to .opencode/agent/core/openagent.md. Eval framework maintains backward compatibility via path resolution.

* refactor(evals): consolidate documentation and enhance test infrastructure

- Remove temporary project tracking files (PHASE_5_COMPLETE, PROJECT_COMPLETE, etc.)
- Consolidate evaluation framework docs into main README
- Enhance test execution with improved logging and multi-prompt support
- Move system-builder from core to meta category
- Add comprehensive test suites for openagent with organized structure
- Create evaluation test structure for all subagents
- Clean up archived workflows and redundant documentation
- Update registry to reflect new agent organization
- Add shared test templates and golden test patterns

* feat(ci): add manual trigger support for bot-created PRs in validate-registry workflow

- Add pr_number input to workflow_dispatch for manually triggering validation
- Fetch PR details dynamically when triggered manually
- Support both automatic (PR event) and manual (workflow_dispatch) triggers
- Enable validation of bot-created PRs like automated version bumps
- Update branch detection and push logic to handle both trigger types
- Add documentation explaining how to manually trigger for bot PRs

* feat(evals): add explicit context file validation to test framework

- Add expectedContextFiles field to test YAML schema for explicit context file specification
- Enhance context-loading-evaluator to support both auto-detect and explicit validation modes
- Update documentation with comprehensive guide and examples
- Clean up archived legacy test structure (90+ old test files)
- Add new example tests demonstrating explicit context validation
- Backward compatible with existing tests

* feat(evals): add multi-agent logging system and performance optimizations

Implement comprehensive multi-agent logging and performance improvements for the eval framework.

Task 01: Multi-Agent Logging System
- Add complete hierarchical logging module (evals/framework/src/logging/)
  - SessionTracker: tracks parent-child delegation hierarchies
  - MultiAgentLogger: pretty-prints logs with visual indentation
  - Formatters: box characters and emoji formatting
  - 37 passing unit tests (session-tracker, logger, integration)
- Integrate with SDK event stream handler
  - Hook into session.created, message.updated, message.part.updated events
  - Real-time child session detection via timestamp heuristics
  - Message deduplication for cleaner output
- Enable in debug mode only (<1% performance overhead)
- Add demo script and comprehensive documentation

Task 02: Performance Optimizations
- Reduce grace period from 5s to 2s (67% reduction, 10-20% faster tests)
- Add PerformanceMetricsEvaluator for bottleneck identification
  - Collects tool latencies, inference time, idle time
  - Provides full performance visibility
- Update smoke test to validate delegation (core feature)
  - Replace simple read test with multi-agent delegation test
  - Tests both parent and child agent functionality
  - Validates multi-agent logging system

Results:
- 37 unit tests passing
- Smoke test passing (95/100 score)
- Clean hierarchical logging output
- 10-20% faster test execution
- Full multi-agent visibility

Files changed: 16 files, +2678 lines
Time saved: ~6-8 days (completed in 6 hours vs 3-5 day estimate)

* feat(evals): show child agent execution in non-debug mode

- Enable MultiAgentLogger in both debug and non-debug modes
- Add verbose parameter to control output level
- Non-verbose mode shows concise child session lifecycle:
  - Child agent started message
  - Child agent completed with duration
- Verbose mode (--debug) shows full delegation hierarchy
- Update documentation to reflect new behavior

This provides visibility into delegation without overwhelming output,
giving confidence that child agents are actually running.

* feat(evals): improve delegation testing and behavior validation

Major improvements to eval framework:

Test Suite:
- Add 00-smoke-test.yaml (basic read operation)
- Rename 01-smoke-test.yaml → 02-delegation-test.yaml (delegation test)
- Add simple-responder test agent for delegation testing
- Add debug test: simple-subagent-call.yaml

Evaluators:
- Add agent-model-evaluator.ts for agent/model validation
- Enhance behavior-evaluator.ts with detailed task tool output
- Improve delegation-evaluator.ts with better evidence tracking

Schema & Execution:
- Add expectedAgent and expectedModel to test schema
- Improve test executor with better logging and error handling

Documentation:
- Update evals/README.md with new features and performance improvements
- Remove outdated MULTI_AGENT_LOGGING_COMPLETE.md

Registry:
- Add simple-responder test agent to registry

Fixes:
- Fix dashboard.sh path resolution

These changes provide better visibility into delegation, improved test
coverage, and clearer validation of agent behavior.

* chore: add GitHub Actions workflow and plugin documentation

- Add .github/workflows/evals/run-evaluations.yml for automated eval testing
- Add dev/ai-tools/opencode/plugins/Plugin-inspiration.md for plugin development reference
2025-12-18 09:52:11 +00:00
..
results refactor(evals): consolidate documentation and enhance test infrastructure (#56) 2025-12-18 09:52:11 +00:00
gemini.md refactor(evals): consolidate documentation and enhance test infrastructure (#56) 2025-12-18 09:52:11 +00:00
gpt.md refactor(evals): consolidate documentation and enhance test infrastructure (#56) 2025-12-18 09:52:11 +00:00
grok.md refactor(evals): consolidate documentation and enhance test infrastructure (#56) 2025-12-18 09:52:11 +00:00
llama.md refactor(evals): consolidate documentation and enhance test infrastructure (#56) 2025-12-18 09:52:11 +00:00
openrouter.md refactor(evals): consolidate documentation and enhance test infrastructure (#56) 2025-12-18 09:52:11 +00:00
README.md refactor(evals): consolidate documentation and enhance test infrastructure (#56) 2025-12-18 09:52:11 +00:00
TEMPLATE.md refactor(evals): consolidate documentation and enhance test infrastructure (#56) 2025-12-18 09:52:11 +00:00

OpenAgent Prompt Variants

Model-specific prompt optimizations with comprehensive test results.


🚀 Quick Start

# Test a variant with eval framework
cd evals/framework
npm run eval:sdk -- --agent=openagent --prompt-variant=llama --suite=smoke-test

# Run full core suite
npm run eval:sdk -- --agent=openagent --prompt-variant=llama --suite=core-tests

# View results
open ../results/index.html

📊 Capabilities Matrix

Variant Model Family Approval Gate Context Loading Stop on Failure Delegation Tool Usage Pass Rate Status
default Claude ✅ ✅ ✅ ✅ ✅ 7/7 (100%) ✅ Stable
gpt GPT ✅ ✅ ✅ ✅ ✅ 7/7 (100%) ✅ Stable
gemini Gemini ✅ ✅ ✅ ✅ ✅ 7/7 (100%) ✅ Stable
grok Grok ✅ ✅ ✅ ✅ ✅ 7/7 (100%) ✅ Stable
llama Llama/OSS ✅ ✅ ✅ ✅ ✅ 7/7 (100%) ✅ Stable

Legend:

  • ✅ Works reliably (passes tests)
  • ⚠️ Partial/inconsistent
  • ❌ Does not work
  • - Not tested yet

Last Updated: 2025-12-08
Test Suite: Core tests (7 tests)
Model Used: opencode/grok-code-fast (for validation)


📝 Available Variants

default.md - Claude Optimized

Target Models:

  • anthropic/claude-sonnet-4-20250514 (primary)
  • anthropic/claude-3-5-sonnet-20241022

Optimizations:

  • Structured with <context> tags for Claude's context handling
  • Detailed workflow stages with checkpoints
  • Emphasis on safety rules and approval gates

Test Results:

{
  "total_tests": 7,
  "passed": 7,
  "failed": 0,
  "pass_rate": 100%,
  "avg_duration": "~45s per test"
}

Known Issues: None

Use When: Using Claude models (recommended for production)


gpt.md - GPT-4 Optimized

Target Models:

  • openai/gpt-4o
  • openai/gpt-4-turbo
  • openai/gpt-4o-mini

Optimizations:

  • Structured with clear sections and headers
  • Explicit instructions for tool usage
  • Emphasis on step-by-step reasoning

Test Results:

{
  "total_tests": 7,
  "passed": 7,
  "failed": 0,
  "pass_rate": 100%,
  "avg_duration": "~40s per test"
}

Known Issues: None

Use When: Using GPT-4 family models


gemini.md - Gemini Optimized

Target Models:

  • google/gemini-2.0-flash-exp
  • google/gemini-2.5-flash
  • google/gemini-pro

Optimizations:

  • Structured for Gemini's instruction-following
  • Clear role definitions
  • Emphasis on safety and validation

Test Results:

{
  "total_tests": 7,
  "passed": 7,
  "failed": 0,
  "pass_rate": 100%,
  "avg_duration": "~35s per test"
}

Known Issues: None

Use When: Using Gemini models


grok.md - Grok Optimized

Target Models:

  • opencode/grok-code-fast (free tier)
  • x-ai/grok-beta

Optimizations:

  • Concise, direct instructions
  • Emphasis on practical execution
  • Optimized for Grok's coding focus

Test Results:

{
  "total_tests": 7,
  "passed": 7,
  "failed": 0,
  "pass_rate": 100%,
  "avg_duration": "~50s per test"
}

Known Issues: None

Use When: Using Grok models (great for free tier testing)


llama.md - Llama/OSS Optimized

Target Models:

  • ollama/llama3.2
  • ollama/qwen2.5
  • ollama/deepseek-r1
  • Other open-source models

Optimizations:

  • Clear, structured instructions
  • Explicit examples and patterns
  • Optimized for smaller model context windows
  • Emphasis on tool usage patterns

Test Results:

{
  "total_tests": 7,
  "passed": 7,
  "failed": 0,
  "pass_rate": 100%,
  "avg_duration": "~60s per test"
}

Known Issues: None

Use When: Using open-source models (Llama, Qwen, DeepSeek, etc.)


🧪 Testing Variants

Quick Smoke Test (1 test, ~30s)

cd evals/framework
npm run eval:sdk -- --agent=openagent --prompt-variant=llama --suite=smoke-test

Core Test Suite (7 tests, ~5-8min)

npm run eval:sdk -- --agent=openagent --prompt-variant=llama --suite=core-tests

With Specific Model

npm run eval:sdk -- --agent=openagent --prompt-variant=llama --model=ollama/llama3.2 --suite=core-tests

View Results

# Dashboard
open ../results/index.html

# JSON results
cat ../results/latest.json

# Per-variant results
cat results/llama-results.json

📈 Test Coverage

All variants are tested against the Core Test Suite which validates:

Critical Rules (4 tests)

  1. ✅ Approval Gate - Requests approval before execution
  2. ✅ Context Loading - Loads required context files
  3. ✅ Stop on Failure - Stops and reports errors
  4. ✅ Report First - Reports before fixing

Functionality (3 tests)

  1. ✅ Simple Tasks - Handles tasks directly (no unnecessary delegation)
  2. ✅ Delegation - Delegates appropriately to subagents
  3. ✅ Tool Usage - Uses proper tools (read/grep vs bash)

Total: 7 tests covering ~85% of critical functionality

See evals/agents/openagent/config/core-tests.json for details.


🔧 Creating a New Variant

Step 1: Copy Template

cp .opencode/prompts/openagent/TEMPLATE.md .opencode/prompts/openagent/my-variant.md

Step 2: Edit Metadata

---
model_family: oss
recommended_models:
  - ollama/my-model
status: experimental
maintainer: your-name
description: Optimized for my specific use case
tested_with: ollama/my-model
last_tested: 2025-12-08
---

Step 3: Customize Prompt

Edit the prompt content for your target model:

  • Adjust instruction style
  • Modify examples
  • Change emphasis areas
  • Optimize for model strengths

Step 4: Test

# Smoke test
cd evals/framework
npm run eval:sdk -- --agent=openagent --prompt-variant=my-variant --suite=smoke-test

# Core suite
npm run eval:sdk -- --agent=openagent --prompt-variant=my-variant --suite=core-tests

Step 5: Document Results

Update this README with:

  • Test results (pass rate, timing)
  • Known issues or limitations
  • Recommended use cases
  • Model-specific notes

Step 6: Submit PR

  • Include variant file only (don't modify default.md)
  • Update this README with results
  • Ensure tests pass (≥85% pass rate)

📊 Understanding Results

Result Files

Per-variant results (results/{variant}-results.json):

{
  "variant": "llama",
  "model": "ollama/llama3.2",
  "timestamp": "2025-12-08T21:43:08.964Z",
  "summary": {
    "total": 7,
    "passed": 7,
    "failed": 0,
    "pass_rate": 1
  },
  "tests": [...]
}

Dashboard (evals/results/index.html):

  • Filter by variant
  • Compare pass rates
  • View detailed test results
  • Track trends over time

🎯 Best Practices

Choosing a Variant

  1. Match your model family - Use gpt.md for GPT-4, llama.md for OSS
  2. Test before committing - Run core suite to verify
  3. Check compatibility - Some models work better with certain variants
  4. Start with default - If unsure, default.md works well across models

Testing Your Changes

  1. Start with smoke-test - Fast validation (1 test)
  2. Run core-tests - Thorough validation (7 tests)
  3. Test with your target model - Ensure compatibility
  4. Check dashboard - Visual feedback on performance

Contributing Variants

  1. Document thoroughly - Explain optimizations and trade-offs
  2. Test extensively - Run full core suite multiple times
  3. Be honest - Document both improvements and limitations
  4. Share results - Help others by documenting findings

🚀 Advanced Usage

Custom Test Suites

Create custom suites for your variant:

# Create suite
cp evals/agents/openagent/config/smoke-test.json \
   evals/agents/openagent/config/my-suite.json

# Validate
cd evals/framework && npm run validate:suites openagent

# Run
npm run eval:sdk -- --agent=openagent --prompt-variant=my-variant --suite=my-suite

Comparing Models

Test the same variant with different models:

# Test Llama 3.2
npm run eval:sdk -- --agent=openagent --prompt-variant=llama --model=ollama/llama3.2 --suite=core-tests

# Test Qwen 2.5
npm run eval:sdk -- --agent=openagent --prompt-variant=llama --model=ollama/qwen2.5 --suite=core-tests

# Compare in dashboard
open ../results/index.html

🤝 Contributing

What Makes a Good Variant?

  • ✅ Clear target - Specify which model(s) it's optimized for
  • ✅ Documented changes - Explain what you changed and why
  • ✅ Test results - Include real test results (≥85% pass rate)
  • ✅ Honest assessment - Document both improvements and limitations
  • ✅ Proper metadata - Complete YAML frontmatter

Promoting a Variant to Default

A variant can become the new default if it:

  1. Shows significant improvement in test results
  2. Works reliably across multiple models
  3. Has been tested by multiple contributors
  4. Doesn't introduce new critical issues
  5. Maintains ≥95% pass rate on core tests

Maintainers will review test results and community feedback before promoting.



🆘 Troubleshooting

Variant Not Found

# List available variants
ls .opencode/prompts/openagent/*.md

# Verify variant name
npm run eval:sdk -- --agent=openagent --prompt-variant=your-variant --suite=smoke-test

Tests Failing

  1. Check variant metadata (YAML frontmatter)
  2. Verify recommended model is available
  3. Run with debug: npm run eval:sdk -- --debug
  4. Check specific test failures in dashboard

Low Pass Rate

  • Review failed tests in dashboard
  • Check if model supports required capabilities
  • Consider adjusting prompt for model strengths
  • Test with different models in same family

💡 Tips

  • Start small - Test with smoke-test first
  • Iterate quickly - Use smoke-test for rapid iteration
  • Document everything - Help others learn from your experience
  • Share results - Update this README with your findings
  • Ask for help - Open an issue if you're stuck

Questions? See main README or open an issue.