/agents:autoresearch-agentfrom AI Agents and Models
Autonomous experiment loop that optimizes any file by a measurable metric. Inspired by Karpathy's autoresearch. The agent edits a target file, runs a fixed evaluation, keeps improvements (git commit), discards failures (git reset), and loops indefinitely. Use when: user wants to optimize code speed, reduce bundle/image size, improve test pass rate, optimize prompts, improve content quality (headlines, copy, CTR), or run any measurable improvement loop. Requires: a target file, an evaluation command that outputs a metric, and a git repo.
Ships in AI Agents and Models. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
You sleep. The agent experiments. You wake up to results.
Autonomous experiment loop inspired by Karpathy's autoresearch. The agent edits one file, runs a fixed evaluation, keeps improvements, discards failures, and loops indefinitely.
Not one guess — fifty measured attempts, compounding.
The upstream package exposed these as five slash commands; here they are flows of this one skill, driven by the three scripts in scripts/. In every command below, $S is ${CLAUDE_PLUGIN_ROOT}/skills/autoresearch-agent/scripts.
| Flow | What it does |
|---|---|
| setup | Set up a new experiment interactively |
| run | Run a single experiment iteration |
| loop | Start an autonomous loop with a configurable interval (10m, 1h, daily, weekly, monthly) |
| status | Show dashboard and results |
| resume | Resume a paused experiment |
If the user gave the parameters, pass them straight to setup_experiment.py (see Setup below). If not, collect each one at a time:
python3 "$S/setup_experiment.py" --list-evaluators. "Use a built-in evaluator, or your own?"Then run setup_experiment.py with the collected parameters. --list shows existing experiments. Afterwards report the experiment path and branch name, whether the eval command worked and the baseline metric, and offer run (one iteration) or loop.
Exactly ONE iteration: if no experiment was named, run setup_experiment.py --list and ask the user to pick. Then follow the Agent Protocol below (load context, decide one change, edit, commit, evaluate) and report the result: KEEP "Improvement! {metric}: {value} ({delta} from previous best)", DISCARD "No improvement. {metric}: {value} vs best {best}. Reverted.", CRASH "Evaluation failed: {reason}. Reverted."
A recurring loop at a user-selected interval, using Claude Code's in-session scheduler (CronCreate / CronDelete; the /loop skill is the same mechanism).
*/10 * * * * (10m), 7 * * * * (1h), 57 8 * * * (daily), 57 8 * * 1 (weekly), 57 8 1 * * (monthly).You are running autoresearch experiment "{domain}/{name}".
1. Read .autoresearch/{domain}/{name}/config.cfg for: target, evaluate_cmd, metric, metric_direction
2. Read .autoresearch/{domain}/{name}/program.md for strategy and constraints
3. Read .autoresearch/{domain}/{name}/results.tsv for experiment history
4. Run: git checkout autoresearch/{domain}/{name}
Then do exactly ONE iteration:
- Review results.tsv: what worked, what failed, what hasn't been tried
- Edit the target file with ONE change (strategy escalation based on run count)
- Commit: git add {target} && git commit -m "experiment: {description}"
- Evaluate: python3 <absolute path of $S>/run_experiment.py --experiment {domain}/{name} --single
- Read the output (KEEP/DISCARD/CRASH)
Rules:
- ONE change per experiment
- NEVER modify the evaluator
- If 5 consecutive crashes in results.tsv, delete this cron job and alert
- After every 10 experiments, update Strategy section of program.md
Current best metric: {read from results.tsv or "no baseline yet"}
Total experiments so far: {count from results.tsv}
.autoresearch/{domain}/{name}/loop.json with cron_id, interval, started (ISO timestamp) and experiment.Stopping: read loop.json for the cron ID, delete the job, delete loop.json, confirm "Loop stopped for {experiment}. {n} experiments completed."
Limitations: scheduled jobs auto-expire (3 days); re-run loop to restart and it picks up where it left off, since results persist. One loop per experiment. Concurrent experiments only on different git branches (the default — each gets autoresearch/{domain}/{name}).
log_results.py as in Viewing Results below (--experiment, --domain, --dashboard, --format csv|markdown --output <file>). For each experiment also cat .autoresearch/{domain}/{name}/loop.json 2>/dev/null and, if it exists, show Active loop: every {interval} (cron ID: {id}, started: {date}).
setup_experiment.py --list; show status for each (active/paused/done from results.tsv age) and let the user pick.git checkout autoresearch/{domain}/{name}, read config.cfg, program.md, results.tsv, and git log --oneline -20.Recognize these patterns from the user:
If the user describes a target file + a way to measure success → this skill applies.
Run the setup script. The user decides where experiments live:
Project-level (inside repo, git-tracked, shareable with team):
S=${CLAUDE_PLUGIN_ROOT}/skills/autoresearch-agent/scripts
python3 "$S/setup_experiment.py" \
--domain engineering \
--name api-speed \
--target src/api/search.py \
--eval "pytest bench.py --tb=no -q" \
--metric p50_ms \
--direction lower \
--scope project
User-level (personal, in ~/.autoresearch/):
python3 "$S/setup_experiment.py" \
--domain marketing \
--name medium-ctr \
--target content/titles.md \
--eval "python evaluate.py" \
--metric ctr_score \
--direction higher \
--evaluator llm_judge_content \
--scope user
The --scope flag determines where .autoresearch/ lives:
project (default) → .autoresearch/ in the repo root. Experiment definitions are git-tracked. Results are gitignored.user → ~/.autoresearch/ in the home directory. Everything is personal..autoresearch/
├── config.yaml ← Global settings
├── .gitignore ← Ignores results.tsv, *.log
└── {domain}/{experiment-name}/
├── program.md ← Objectives, constraints, strategy
├── config.cfg ← Target, eval cmd, metric, direction
├── results.tsv ← Experiment log (gitignored)
└── evaluate.py ← Evaluation script (if --evaluator used)
results.tsv columns: commit | metric | status | description
commit — short git hashmetric — float value or "N/A" for crashesstatus — keep | discard | crashdescription — what changed or why it crashed| Domain | Use Cases |
|---|---|
engineering | Code speed, memory, bundle size, test pass rate, build time |
marketing | Headlines, social copy, email subjects, ad copy, engagement |
content | Article structure, SEO descriptions, readability, CTR |
prompts | System prompts, chatbot tone, agent instructions |
custom | Anything else with a measurable metric |
program.md Already ExistsThe user may have written their own program.md. If found in the experiment directory, read it. It overrides the template. Only ask for what's missing.
You are the loop. The scripts handle setup and evaluation — you handle the creative work.
.autoresearch/{domain}/{name}/config.cfg to get:
target — the file you editevaluate_cmd — the command that measures your changesmetric — the metric name to look for in eval outputmetric_direction — "lower" or "higher" is bettertime_budget_minutes — max time per evaluationprogram.md for strategy, constraints, and what you can/cannot changeresults.tsv for experiment history (columns: commit, metric, status, description)git checkout autoresearch/{domain}/{name}git add {target} && git commit -m "experiment: {description}"python3 "$S/run_experiment.py" --experiment {domain}/{name} --singlegit reset --hard HEAD~1)# Single iteration (the agent calls this repeatedly)
python3 "$S/run_experiment.py" --experiment engineering/api-speed --single
# Dry run (test setup before starting)
python3 "$S/run_experiment.py" --experiment engineering/api-speed --dry-run
After every 10 experiments, review results.tsv for patterns. Update the Strategy section of program.md with what you learned (e.g., "caching changes consistently improve by 5-10%", "refactoring attempts never improve the metric"). Future iterations benefit from this accumulated knowledge.
evaluate.py is the ground truth. Modifying it invalidates all comparisons. Hard stop if you catch yourself doing this.Ready-to-use evaluation scripts in evaluators/. Copied into the experiment directory during setup with --evaluator.
| Evaluator | Metric | Use Case |
|---|---|---|
benchmark_speed | p50_ms (lower) | Function/API execution time |
benchmark_size | size_bytes (lower) | File, bundle, Docker image size |
test_pass_rate | pass_rate (higher) | Test suite pass percentage |
build_speed | build_seconds (lower) | Build/compile/Docker build time |
memory_usage | peak_mb (lower) | Peak memory during execution |
| Evaluator | Metric | Use Case |
|---|---|---|
llm_judge_content | ctr_score 0-10 (higher) | Headlines, titles, descriptions |
llm_judge_prompt | quality_score 0-100 (higher) | System prompts, agent instructions |
llm_judge_copy | engagement_score 0-10 (higher) | Social posts, ad copy, emails |
LLM judges call the CLI tool the user is already running (Claude, Codex, Gemini). The evaluation prompt is locked inside evaluate.py — the agent cannot modify it. This prevents the agent from gaming its own evaluator.
The user's existing subscription covers the cost:
If no built-in evaluator fits, the user writes their own evaluate.py. Only requirement: it must print metric_name: value to stdout.
#!/usr/bin/env python3
# My custom evaluator — DO NOT MODIFY after experiment starts
import subprocess
result = subprocess.run(["my-benchmark", "--json"], capture_output=True, text=True)
# Parse and output
print(f"my_metric: {parse_score(result.stdout)}")
# Single experiment
python3 "$S/log_results.py" --experiment engineering/api-speed
# All experiments in a domain
python3 "$S/log_results.py" --domain engineering
# Cross-experiment dashboard
python3 "$S/log_results.py" --dashboard
# Export formats
python3 "$S/log_results.py" --experiment engineering/api-speed --format csv --output results.csv
python3 "$S/log_results.py" --experiment engineering/api-speed --format markdown --output results.md
python3 "$S/log_results.py" --dashboard --format markdown --output dashboard.md
DOMAIN EXPERIMENT RUNS KEPT BEST Δ FROM START STATUS
engineering api-speed 47 14 185ms -76.9% active
engineering bundle-size 23 8 412KB -58.3% paused
marketing medium-ctr 31 11 8.4/10 +68.0% active
prompts support-tone 15 6 82/100 +46.4% done
Flag these without being asked:
git init && git add . && git commit -m 'initial' first.agents:loop-design-check — check the goal is machine-decidable and bounded before letting this loop run unattended.software:human-gate — human sign-off before an experiment result ships.software:tdd — complementary; tests can be the evaluation function.evaluators/benchmark_size.py (opens in a new tab)evaluators/benchmark_speed.py (opens in a new tab)evaluators/build_speed.py (opens in a new tab)evaluators/llm_judge_content.py (opens in a new tab)evaluators/llm_judge_copy.py (opens in a new tab)evaluators/llm_judge_prompt.py (opens in a new tab)evaluators/memory_usage.py (opens in a new tab)evaluators/test_pass_rate.py (opens in a new tab)references/experiment-domains.md (opens in a new tab)references/program-template.md (opens in a new tab)scripts/log_results.py (opens in a new tab)scripts/run_experiment.py (opens in a new tab)scripts/setup_experiment.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub mattmakes/skill-marketplace --plugin agents24 skills in this plugin
/agent-architecture-auditFull-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack./book-to-skillConverts books, documentation folders, and source collections (PDF, EPUB, DOCX, HTML, Markdown, RST, AsciiDoc, RTF, MOBI/AZW) into structured agent skills — extracting named frameworks, principles, techniques, and anti-patterns into a master SKILL.md plus on-demand chapter files, a glossary, a patterns file, and a decision cheatsheet. Use when the user wants to study a document with an agent, apply an author's frameworks while working, turn internal docs or standards into a reusable knowledge base, or package a compiled book skill as a Claude Code plugin./checkpoint-promotionGate fine-tuned checkpoints with drift budgets, paired comparison, and forgetting checks before promotion. Use after a training run produces a checkpoint, when deciding whether a tuned model ships, or when a promoted model needs re-gating against updated goldens./cli-for-agentsDesigns or reviews CLIs so coding agents can run them reliably: non-interactive flags, layered --help with examples, stdin/pipelines, fast actionable errors, idempotency, dry-run, and predictable structure. Use when building a CLI, adding commands, writing --help, or when the user mentions agents, terminals, or automation-friendly CLIs./dataset-curationPrepare, format, and validate datasets for supervised fine-tuning and preference training. Use when converting raw data into training format, applying chat templates, configuring sequence packing, generating synthetic training data, or writing a dataset card before a run./eval-harness-firstBuild the evaluation harness that gates every fine-tuning run — golden sets, per-failure-mode graders, judge calibration, and base-model baselines. Use when starting a fine-tuning effort, when converting traces into an eval set, or when calibrating a judge against human labels.