autoresearch

A loop for testing and improving an agent’s prompts, tool descriptions, skills, or output format. It generates changes, evaluates them against test cases, keeps useful changes, and repeats.

In plain words
What is it for?
Use it to improve tool selection, system prompts, SKILL.md files, or structured decision outputs using repeatable evaluations.
Why use it?
It helps find which wording or instructions lead to better agent decisions, instead of relying on manual trial and error.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/fortunto2/rust-code/autoresearch
Any agent
npx skills add fortunto2/rust-code --skill autoresearch
Clone the repo
git clone --depth 1 https://github.com/fortunto2/rust-code

Made for: Claude Code, Codex.

Per session 73 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 912 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00073 $0.00912
Opus 5 $0.00036 $0.00456
Sonnet 5 $0.00015 $0.00182
Haiku 4.5 $0.00007 $0.00091

Measured 2d ago against content hash b8b6a481aa53, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

autoresearch 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 2d ago.

The scan reads SKILL.md. This mod also ships 3 executable files (base.py, dashboard.py, tool_selection.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

skills/autoresearch/SKILL.md · 93 lines

How it starts

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

/autoresearch — Self-Improving Prompt Optimization

Karpathy autoresearch pattern: Generate → Evaluate → Score → Keep/Discard → Mutate → Repeat

Architecture

Core engine: crates/sgr-agent/src/autoresearch.rs (Rust module, feature genai). Dashboard: skills/autoresearch/dashboard.py (Python, standalone viewer). Test cases: skills/autoresearch/test_cases/*.json (embedded at compile time via include_str!).

Targets

Target What it optimizes Eval metric
tool-selection Tool descriptions in agent % correct tool chosen for 66 test tasks
system-prompt Agent system prompt (SOUL.md) Decision quality: right tool + coherent reasoning (4 criteria)
skill Any SKILL.md file Binary criteria pass rate (4 criteria)
decision-parser Structured output schema Parse success + field quality (5 criteria)

Usage (Rust API)

use sgr_agent::autoresearch::{AutoResearch, Config, Target};

let config = Config {
    target: Target::ToolSelection,
    batch_size: 10,
    cycle_secs: 120,
    gen_model: "gemini-2.5-flash".into(),
    eval_model: "claude-sonnet-4-6".into(),
    data_dir: "autoresearch_data/tool-selection".into(),
};
let ar = AutoResearch::new(config);
ar.run(20).await?; // 20 cycles

Quick Start (CLI — when wired into rc-cli)

# Tool selection optimization (most impactful)
cargo run -- autoresearch tool-selection --cycles 20

# System prompt optimization
cargo run -- autoresearch system-prompt --cycles 10

# Optimize a specific skill
cargo run -- autoresearch skill --name delegate --cycles 15

# Optimize decision parsing
cargo run -- autoresearch decision-parser --cycles 10

# Dashboard (Python, standalone)
python3 skills/autoresearch/dashboard.py --target tool-selection --port 8501

How It Works

Each cycle:

  1. Generate N outputs with current prompt (via Gemini — same model agent uses)
  2. Evaluate each output against binary criteria (via Claude Sonnet — different model for objectivity)
  3. Score = sum of passed criteria across all outputs
  4. Keep if score > best_score, discard otherwise
  5. Mutate the winning prompt to try improvements
  6. Log to JSONL for dashboard tracking
  7. Wait for next cycle (default 2 min)

Read the full file on GitHub · 93 lines

Files

What ships with it

6 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 2d ago First seen · 93 lines · 73 tokens per session scan A b8b6a481aa53

Subscribe to this mod's changes

autoresearch is a skill published in the GitHub repository fortunto2/rust-code (41 stars, last pushed 10d ago), licensed MIT. It adds 73 tokens to every session and 912 once invoked, about $0.0004 per session on Opus 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-08-30.