Architecture

cap-evolve is a library of Agent Skills over a tiny pure-stdlib core (core/cap_evolve). The pipeline is:

intake → implement-and-check → baseline → algorithm → finalize → report

The phases

The cap-evolve pipeline Six sequential phases — intake, check, baseline, algorithm, finalize, report — with the algorithm phase expanded to show its per-iteration inner loop: diagnose, propose, evaluate, gate. On rejection, control returns to diagnose. On acceptance, the iteration is committed and the loop advances. intake check (hard gate) baseline algorithm iterate ×N finalize seal test report algorithm — each iteration diagnose cluster failures propose optimizer edit evaluate N trials on val gate Δ > k·SE rejected — try again (protect-set + IMPACT + JOURNAL) accepted → git-commit iteration → memory updated → next iter or exit Repeats until iteration budget is exhausted; best candidate advances to finalize.
The pipeline runs left-to-right; the algorithm phase is the only one that loops, and the gate is what makes each accepted iteration a real improvement.

See HONEST_EVAL.md for the splitting / gating / sealing guarantees and ADAPTER_CONTRACT.md for the adapter.

What the optimizer receives each iteration

The harness assembles a capability-scoped working dir per iteration, then runs your chosen coding-agent CLI in it:

Cross-iteration files (clean ownership)

FileOwnerPurpose
LEDGER.mdframeworkFACTS: every iteration's outcome + the exact tasks it broke/fixed
JOURNAL.mdoptimizerappend-only HANDOVER across the run (tried / worked / regressed / refuted / focus-next)
PROCESS.mdoptimizerEXPLAINABILITY, snapshotted per candidate
RUNMAP.md + prior_iterations/frameworka manifest plus every prior iteration's PROCESS.md and capability diff, for real prior-work access

Because it sees all failure clusters, the protect-set, and the prior causal impact at once, the optimizer produces one bold, multi-part candidate per iteration that addresses every cluster without regressing the wins — not a one-line tweak.

What the optimizer can change

The prompt and the tools are equally fair game:

Speed + observability

All N trials of a candidate run in one concurrent pass when the adapter implements run_trials(tasks, ctx, *, n_trials, base_seed) (per-trial persistence and pass^k/SE are byte-for-byte unchanged). The live dashboard shows intake cost/time, per-iteration optimizer & runner cost + time, the cumulative-best stair, a tasks × iterations pass/fail heatmap, per-iteration git diffs, the lineage tree, and gate decisions.

Skill library

18 skills over the core. Extending is one folder or one registry row — see EXTENDING.md.

ComponentSkills
orchestrateorchestrate · using-cap-evolve
phasesintake · implement-and-check · baseline · evaluate · diagnose · gate · finalize · report
capabilitiessystem-prompt · skill-package · tools · mcp-tool
algorithmshill-climb (--focus all|cyclic|hardest-first) · gepa · skillopt
optimizersrun-optimizer + optimizers/registry.yaml (14 backends incl. mock)
Claude Code plugin
claude --plugin-dir ./plugins/cap-evolve exposes every skill as /cap-evolve:<skill> and arms honesty hooks (PreToolUse denies edits to the sealed test/gold; Stop/SubagentStop block finishing until cap-evolve check and the gate are green) — all in core-owned scripts, never in editable skill markdown.