agent-optimize

agent-optimize is a skill for Claude Code from skillberry-ai/cap-evolve. It costs 73 tokens per session (5,369 once invoked), scanned A, original, Apache-2.0.

An agent-controlled search procedure for improving an AI agent's capabilities through repeated candidate changes and validation. The agent chooses what to try, when to stop, and how to run the existing evaluation steps.

In plain words
What is it for?
Use it for agent-orchestration experiments that propose capability edits, compare them with a baseline, run full validation, and track the run.
Why use it?
It supports experiments where no fixed optimisation loop is provided, while still requiring candidates to pass the project's validation process.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: positional $N argument.

Good fit Use it for agent-orchestration experiments that propose capability edits, compare them with a baseline, run full validation, and track the run.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/skillberry-ai/cap-evolve/legacy
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add skillberry-ai/cap-evolve --skill legacy
Clone the repo
git clone --depth 1 https://github.com/skillberry-ai/cap-evolve

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for agent-optimize

README.md
[![agentmods](https://agentmods.dev/badge/skills/skillberry-ai/cap-evolve/legacy/github.svg)](https://agentmods.dev/skills/skillberry-ai/cap-evolve/legacy)
Your own site
<a href="https://agentmods.dev/skills/skillberry-ai/cap-evolve/legacy"><img src="https://agentmods.dev/badge/skills/skillberry-ai/cap-evolve/legacy/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for agent-optimize

Your own site · 80×15
<a href="https://agentmods.dev/skills/skillberry-ai/cap-evolve/legacy"><img src="https://agentmods.dev/badge/skills/skillberry-ai/cap-evolve/legacy.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 73 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,369 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00073 $0.05369
Opus 5.5 $0.00029 $0.02148
Sonnet 5.5 $0.00015 $0.01074
Haiku 4.5 $0.00007 $0.00537

Measured 6d ago against content hash 1bd74c08109a, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

agent-optimize scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

docs/archive/agent-optimize-legacy/legacy-SKILL.md · 333 lines

How it starts

The opening of the file, as written. The whole thing — 333 lines — stays where its author put it; the contents beside it link to each section on GitHub.

agent-optimize — the free-form loop you own

The one algorithm with no deterministic subprocess and no per-iteration optimizer: you — the agent that ran intake — are the optimizer, the scheduler and the stopping rule. cap-evolve run (with orchestration_mode: agent) does check → baseline, prints a handoff, and returns. From there the search is yours, bounded by core's invariants and the free-text stop_condition. Drive the existing primitives so the run dir and dashboard stay populated as in a deterministic run (unattended: host.py/--agent-driver). A forensic run (#665) followed this loop in PROSE, not BEHAVIOR — 1 candidate/round forever, full-val paid regardless of scope, two mergeable accepts never merged — so every step below names the script that decides for you.

Shell variables used below

R="<run_dir from the agent-mode handoff>"      # e.g. .capevolve/run_20250101_120000
P="<project dir>"                              # the dir holding capevolve.yaml + adapters/
S="${CAPEVOLVE_SKILLS_DIR:?set CAPEVOLVE_SKILLS_DIR to the skills/ dir}"
A="$S/algorithms/agent-optimize/scripts"       # this skill's helpers
mkdir -p "$R/work"                             # working copies live here (RunDir does NOT create it)

Every script imports _bootstrap itself and prints JSON on stdout.

Phase 0 — understand before you optimize

Once, before any edit, and ask the user any blocking question here so the loop then runs unattended. Read PROJECT.md, capevolve.yaml, the adapter, every file under capability_path, ./guidance/<cap>/SKILL.md, optimizer/INSTRUCTIONS.md if present; understand the task, run_target output, score() reward, per-task feedback, val/test size, num_trials, gate_mode/gate_k_se, objectives/model_routing if set (sections below), edit surface.

Then let spend.py parse the free-text stop_condition rather than restating it: it prints constraints.predicates, every concrete check it extracts. If constraints.ambiguous is non-empty, ASK THE USER before the loop starts — a vague clause is reported, never guessed at.

Read the full file on GitHub · 333 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 333 lines · 73 tokens per session scan A 1bd74c08109a

Subscribe to this mod's changes

agent-optimize is a skill published in the GitHub repository skillberry-ai/cap-evolve (65 stars, last pushed today), licensed Apache-2.0. It adds 73 tokens to every session and 5,369 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-11.

Related

Other skills, from other repositories

foundry-hosted-agent-validation

Step-by-step process for validating a Python Foundry hosted agent sample (under python/samples/04-hosting/foundry-hosted-agents/) end to end — running it locally (native runtime and azd ai agent run) and after deploying it to an Azure AI Foundry project with azd. Use this when asked to validate a hosted agent sample.

microsoft/agent-framework · 82 tokens

build-and-test

How to build and test .NET projects in the Agent Framework repository. Use this when verifying or testing changes.

microsoft/agent-framework · 26 tokens

workflow-patterns

Use this skill when implementing tasks according to Conductor's TDD workflow, handling phase checkpoints, managing git commits for tasks, or understanding the verification protocol.

wshobson/agents · 35 tokens

ios-simulator

Verify and debug native, React Native, Expo, or Flutter apps on an iOS Simulator with agent-device. Use when an agent needs to launch an app, inspect its live UI, tap, type, scroll, validate a code change, collect failure evidence, or reproduce a workflow on an iPhone or iPad Simulator.

callstack/agent-device · 69 tokens

agent-evaluation

Run one specified Test Agent on one specified Benchmark Case exactly once, privately score that execution, and return one protocol result.

Prism-Shadow/penguin-harness · 28 tokens

neuron-evaluation

Create and run AI evaluations with datasets, assertions, and output drivers in Neuron AI. Use this skill whenever the user mentions evaluation, testing AI systems, creating evaluators, dataset-driven testing, assertion-based validation, or wants to measure AI system performance. Also trigger for tasks involving…

neuron-core/neuron-ai · 102 tokens