|
|
8 months ago | |
|---|---|---|
| .. | ||
| framework | 8 months ago | |
| opencode | 8 months ago | |
| results | 8 months ago | |
| README.md | 8 months ago | |
| SETUP_COMPLETE.md | 8 months ago | |
Comprehensive evaluation framework for testing and validating OpenCode agent behavior against defined standards and rules.
evals/
├── framework/ # Reusable evaluation framework
│ ├── src/
│ │ ├── collector/ # Session data collection
│ │ ├── evaluators/ # Evaluation logic
│ │ ├── runner/ # Test execution
│ │ ├── reporters/ # Result reporting
│ │ └── types/ # TypeScript types
│ └── package.json
│
├── opencode/ # OpenCode agent evaluations
│ ├── openagent/ # OpenAgent-specific tests
│ ├── opencoder/ # OpenCoder-specific tests
│ └── shared/ # Shared test cases
│
└── results/ # Test results (gitignored)
└── YYYY-MM-DD/
cd evals/framework
npm install
npm run build
# Evaluate a specific session
npm run eval -- --agent openagent --session ses_xxxxx
# Run all OpenAgent tests
npm run eval -- --agent openagent --all
# Run specific test case
npm run eval -- --agent openagent --test approval-gates
# View latest results
cat evals/results/$(ls -t evals/results | head -1)/openagent/summary.json | jq
# Generate report
npm run report -- --agent openagent --date 2025-11-21
Reads and parses OpenCode session data from ~/.local/share/opencode/
Components:
SessionReader - Read session filesMessageParser - Parse message structureTimelineBuilder - Build event timelineValidate agent behavior against rules
Available Evaluators:
ApprovalGateEvaluator - Check approval before executionContextLoadingEvaluator - Verify context loadingDelegationEvaluator - Validate delegation decisionsToolUsageEvaluator - Check tool selectionModelSelectionEvaluator - Validate model choicesExecute test cases and collect results
Components:
TestRunner - Run test suitesSessionAnalyzer - Analyze historical sessionsLiveRunner - Run live tests (future)Generate test reports
Formats:
opencode/openagent/)Tests for the universal OpenAgent:
Test Categories:
opencode/opencoder/)Tests for the OpenCoder agent (future)
opencode/shared/)Common test cases applicable to all agents
Test cases are defined in YAML:
test_cases:
- id: simple-question
name: "Simple Question (No Execution)"
description: "Ask a question that requires no execution tools"
category: conversational
input: "What does this code do?"
expected_behavior:
no_execution_tools: true
no_approval_required: true
response_provided: true
evaluators:
- approval-gate
- tool-usage
pass_threshold: 100
Results include:
Example Result:
{
"testCaseId": "simple-question",
"sessionId": "ses_xxxxx",
"passed": true,
"score": 100,
"evaluationResults": [
{
"evaluator": "approval-gate",
"passed": true,
"score": 100,
"violations": []
}
],
"metadata": {
"agent": "openagent",
"model": "claude-sonnet-4-20250514",
"duration": 7205,
"cost": 0.107
}
}
Pass Threshold: 75% (configurable per test)
framework/src/evaluators/BaseEvaluatorevaluate() methodopencode/{agent}/test-cases/# Framework tests
cd evals/framework
npm test
# Integration tests
npm run test:integration
# Test specific evaluator
npm run test:evaluator -- approval-gate
# .github/workflows/eval.yml
name: Agent Evaluation
on: [push, pull_request]
jobs:
evaluate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- run: cd evals/framework && npm install
- run: npm run eval -- --agent openagent --all
- run: npm run report -- --format json
framework/config.ts)export const config = {
projectPath: process.cwd(),
sessionStoragePath: '~/.local/share/opencode/',
resultsPath: 'evals/results/',
passThreshold: 75,
evaluators: ['approval-gate', 'context-loading', 'delegation', 'tool-usage']
};
opencode/openagent/config.yaml)agent: openagent
test_cases_path: ./test-cases
sessions_path: ./sessions
evaluators:
- approval-gate
- context-loading
- delegation
- tool-usage
pass_threshold: 75
See CONTRIBUTING.md
MIT