Reflective optimization for agents

Make your agent reliably better — and prove it

Optimize agentic capabilities — with agents.

cap-evolve improves an AI agent's prompts, tools, and skills by learning from its failed evaluation traces. Bring the agent and the eval you already have. cap-evolve runs the loop — evaluate → diagnose → propose an edit → keep it only if it beats a held-out split by a significant margin → commit — and reports one honest number. It optimizes what your agent reads, not its weights.

Test sealed, scored once Every number ships its artifact 0 runtime dependencies
beta (0.x) python 3.10+ Apache-2.0 23 skills · 5 algorithms (3 run-executable + 2 agent-mode) 14 optimizer backends
Made at IBM Red Hat

Try it in two minutesno API key

git clone https://github.com/skillberry-ai/cap-evolve.git
cd cap-evolve
python3 -m venv .venv && source .venv/bin/activate
pip install ./core
bash benchmarks/toy/examples/calc/run.sh

toy_calc is a deterministic zero-API stand-in: the seed prompt scores 0.0; the optimized prompt is gate-accepted and scores 1.0 on the sealed test split — no model is called. Full walkthrough: Getting started · then run it on a real benchmark.

cap-evolve dashboard — a real τ²-bench airline run: KPIs and the fitness stair from baseline 53.6% to best 71.2%
A real τ²-bench airline run in the live dashboard — baseline 53.6% → best 71.2%. The curve only steps up: the paired significance gate refused every change it couldn't tell from noise.

How the loop works

One iteration. A coding agent reads the failing traces and proposes a bold, multi-part edit; the framework keeps it only if it clears a held-out significance gate.

1 · evaluate

Score on val

Run the candidate on the validation split — every trial its own seed for honest variance.

→
2 · diagnose

Read the failures

Cluster failing rollouts into a reflective dataset: inputs, outputs, and gold-safe feedback.

→
3 · propose

Edit the capability

The optimizer agent writes one bold, multi-part change to the prompt, tools, or skill.

→
4 · gate

Keep only if it wins

Accept only when Δ > k·SE on val. Noise-level gains are rejected and remembered.

→
5 · commit

Git-commit + learn

Every iteration is a commit; a journal records what worked so the next one builds on it.

What that produces

τ²-bench airline, policy + tool code jointly optimized over 50 tasks × 10 trials (fit metric — no holdout on this committed run).

0.536
Baseline (seed)
→
0.712
Best candidate
+32.8%
relative gain on val
0.694
sealed test (pass@1)
5 / 10
iterations gate-accepted
593 → 832
lines of tool code written

Most of the lift is real code the optimizer wrote into the tool bodies — deterministic guards, not just prose. See every accepted edit on Results, or reproduce it step by step.

See the whole run — offline

Every run ships a self-contained dashboard export. No backend, no live model — open it and inspect exactly what happened, honestly.

Candidates tab: the lineage tree — seed, five accepted candidates on the best path, the rejected branches, and the paired-gate math for the champion.
Candidates — accepted (green) vs rejected (red), and the paired-gate math behind the champion.
Diffs tab: one commit per iteration and the actual diff the optimizer wrote.
Diffs — one commit per iteration; the optimizer's real edits and its institutional memory.

Why cap-evolve

Five things that shape how it works — and how it differs from what came before.

Results

Cross-checked against committed run artifacts. Each is labeled fit metric (no holdout) or held-out (test scored once on ids the optimizer never saw). Full detail, models, task/trial counts, and costs: Results.

BenchmarkSplitBaseline → OptimizedGain
toy_calc (zero-API) sealed test 0.0 → 1.0 deterministic proof
τ²-bench airline (policy + tools) val — fit metric 0.536 → 0.712 +0.176 / +32.8%
τ²-bench airline (held-out 30/10/10) sealed test 30.0 → 47.5 +58.3% · reported
SkillsBench (skill package) sealed test (held-out) 0.556 → 0.667 +0.111 / +20.0%

What cap-evolve optimizes

Pick one — or combine them, e.g. [system-prompt, tools].

CapabilityWhat the optimizer may change
System promptsRewrite / consolidate / add rules, examples, output contracts — never drop a needed rule
Tool implementationsEdit tool code for deterministic enforcement; add/wrap/swap tools (never bare-remove)
MCP tool surfacesSafe edits only — tool docs, in-description examples, and which tools are exposed
Skill packagesAn Agent Skill dir — SKILL.md bodies, references, and executable scripts
Agent harnessLoop and stopping rules, context compaction, cross-run memory (lessons learned from past runs), tool-error retries, sampling, sub-agents

Choose your path

Every path shares the same core install and the same honesty guarantees.

PathUse it whenStart
Claude Code pluginYou use Claude Code and want slash commands + honesty hooksclaude --plugin-dir ./plugins/cap-evolve
Another coding-agent hostCodex, Gemini, opencode, Cursor, Droid, Copilot, Kimi, Pi, Antigravity, openclaw, IBM Bob, or bare./install.sh --host <name>
Manual adapter + CLIYou want to wire the adapter yourself and drive cap-evolve directlyOptimize your own agent

Documentation

Hand-crafted pages for the hero topics; the rest are on GitHub, alongside the code they describe.

Getting started on this site

Your first successful run in two minutes, no API key. The toy_calc loop end-to-end.

Run end-to-end on this site

A real benchmark, start to finish: τ²-bench airline from setup to sealed result, step by step.

Results on this site

Full benchmark detail: toy_calc, τ²-bench airline (fit + held-out), SkillsBench. Reproducibility and artifacts.

Benchmark runs on this site

The raw CI log: every ci/benchmarks execution on PRs and manual runs, sortable and filterable.

Architecture on this site

The pipeline (intake → check → baseline → algorithm → finalize → report), the optimizer context, and the skill library.

Agent mode on this site

Deterministic vs agent orchestration, and the agent-optimize algorithm — the conversational agent drives the loop itself.

Optimize your own agent on this site

Wire one small adapter — three methods. Two ways: let your coding agent do it, or drive the CLI yourself.

Adapter templates on this site

Copy-and-run adapters — JSONL, HuggingFace, tau2, SWE-bench, SkillsBench — for any litellm provider. Config, not code.

Onboarding course on this site

New to the team? Eight 20-minute slide decks, from the idea down to the code: vocabulary, repo, object model, threading, the gate, tests. English and Hebrew speaker notes.

Honest evaluation on GitHub

Splits, gates, sealing — the discipline that keeps the numbers meaningful.

Adapter contract on GitHub

The full method signatures and semantics if you're implementing an adapter.

Comparison on GitHub

Positioning vs other tool-optimization work (EvoTool, Evolutionary Context Search) — with the caveats.

Troubleshooting on GitHub

Installation or a run failed — start here.