Summary
Track per-engine success rates, token usage, duration, and gate pass rates so users can make informed decisions about which execution engine works best for their project. A lightweight version of Gastown's agent CV system — no permanent identity, no skill routing, just metrics.
Motivation
With #408 (Agent Adapter Architecture), CodeFrame will support multiple engines (Claude Code, Codex, OpenCode, built-in, etc.). The natural question becomes: "Which engine works best for my Python project?" or "Is Claude Code worth the cost vs the built-in agent?"
Gastown tracks full agent CVs with work history, skill demonstration, and quality metrics. That's overkill for CodeFrame's single-developer audience. But basic performance tracking per engine is genuinely useful and trivially implementable since CodeFrame already tracks run outcomes.
Design (single session)
Data to track (per engine, per workspace)
| Metric |
Source |
Description |
tasks_attempted |
runtime |
Total tasks started with this engine |
tasks_completed |
runtime |
Tasks that reached DONE |
tasks_failed |
runtime |
Tasks that reached FAILED |
gate_pass_rate |
gates |
% of runs where gates passed on first try |
self_correction_rate |
verification loop |
% of runs needing self-correction retries |
avg_duration_ms |
runtime |
Average execution time per task |
total_tokens |
adapter result |
Total token usage |
avg_tokens_per_task |
computed |
Tokens / completed tasks |
Storage
Add an engine_stats table to the existing SQLite database:
CREATE TABLE engine_stats (
workspace_id TEXT,
engine TEXT,
metric TEXT,
value REAL,
updated_at TEXT,
PRIMARY KEY (workspace_id, engine, metric)
);
Plus a run_engine_log table for per-run detail:
CREATE TABLE run_engine_log (
run_id TEXT PRIMARY KEY,
engine TEXT,
task_id TEXT,
status TEXT, -- COMPLETED, FAILED, BLOCKED
duration_ms INT,
tokens_used INT,
gates_passed BOOLEAN,
self_corrections INT,
created_at TEXT
);
New CLI commands
cf engines stats # Show engine performance comparison
cf engines stats --engine claude-code # Stats for one engine
cf engines compare # Side-by-side comparison table
Example output:
Engine Performance (my-project)
┌──────────────┬──────────┬──────────┬───────────┬──────────────┬─────────────┐
│ Engine │ Tasks │ Success │ Gate Pass │ Avg Duration │ Avg Tokens │
├──────────────┼──────────┼──────────┼───────────┼──────────────┼─────────────┤
│ claude-code │ 12 │ 92% │ 75% │ 45s │ 8,200 │
│ built-in │ 8 │ 75% │ 50% │ 120s │ 15,400 │
│ opencode │ 3 │ 100% │ 67% │ 60s │ 10,100 │
└──────────────┴──────────┴──────────┴───────────┴──────────────┴─────────────┘
Integration points
Acceptance Criteria
Dependencies
Complexity Note
This is deliberately simpler than Gastown's agent CV system:
- No permanent agent identity (engines don't have names like "Toast")
- No skill routing (we don't auto-select engines based on history)
- No cross-project tracking (stats are per-workspace)
- No audit trails or compliance features
- Just: "which engine works best here?"
Summary
Track per-engine success rates, token usage, duration, and gate pass rates so users can make informed decisions about which execution engine works best for their project. A lightweight version of Gastown's agent CV system — no permanent identity, no skill routing, just metrics.
Motivation
With #408 (Agent Adapter Architecture), CodeFrame will support multiple engines (Claude Code, Codex, OpenCode, built-in, etc.). The natural question becomes: "Which engine works best for my Python project?" or "Is Claude Code worth the cost vs the built-in agent?"
Gastown tracks full agent CVs with work history, skill demonstration, and quality metrics. That's overkill for CodeFrame's single-developer audience. But basic performance tracking per engine is genuinely useful and trivially implementable since CodeFrame already tracks run outcomes.
Design (single session)
Data to track (per engine, per workspace)
tasks_attemptedtasks_completedtasks_failedgate_pass_rateself_correction_rateavg_duration_mstotal_tokensavg_tokens_per_taskStorage
Add an
engine_statstable to the existing SQLite database:Plus a
run_engine_logtable for per-run detail:New CLI commands
Example output:
Integration points
core/runtime.py— afterexecute_agent()completes, record engine + outcomecore/verification_loop.py([Phase 4] Verification Gate Wrapper for External Agents #415) — record gate pass/fail and self-correction countTokenUsageinAgentResultAcceptance Criteria
cf engines statsshows per-engine performance summarycf engines compareshows side-by-side tableDependencies
Complexity Note
This is deliberately simpler than Gastown's agent CV system: