autoresearch README

The project's README from github.com/uditgoenka/autoresearch. As one markdown file: README.md.

Autoresearch

Turn Claude Code, OpenCode, or OpenAI Codex into a relentless improvement engine.

Based on Karpathy's autoresearch — constraint + mechanical metric + autonomous iteration = compounding gains.

Claude Code Skill OpenCode Codex Version License: MIT

Based on Follow @iuditg Support


"Set the GOAL → The agent runs the LOOP → You wake up to results"

You don't need AGI. You need a goal, a metric, and a loop that never quits.

Supports Claude Code, OpenCode, and OpenAI Codex for the core skill, bundled runtime, installation, and verification surface. Hook guardrails are Claude Code-only.

v2.2.0 — Autonomous Orchestrator: Type a plain-language goal to /autoresearch and it classifies your goal, derives a Success predicate, confirms it once, then loops across subcommands until done. No manual chaining required. Metric:/Verify: invocations run the classic loop unchanged. See guide/autoresearch-orchestrator.md.


How It Works · Commands · Quick Start · Guides · FAQ


     PLAN             LOOP            DEBUG             FIX             SECURE            SHIP
 ┌──────────┐     ┌──────────┐     ┌──────────┐     ┌──────────┐     ┌──────────┐     ┌──────────┐
 │   Goal   │     │  Modify  │     │   Find   │     │   Fix    │     │  STRIDE  │     │  Stage   │
 │  Metric  │────▶│  Verify  │────▶│   Bugs   │────▶│  Errors  │────▶│  OWASP   │────▶│  Deploy  │
 │  Scope   │     │Keep/Drop │     │  Trace   │     │  Repair  │     │ Red Team │     │ Release  │
 └──────────┘     └──────────┘     └──────────┘     └──────────┘     └──────────┘     └──────────┘
 /autoresearch:   /autoresearch    /autoresearch:   /autoresearch:   /autoresearch:   /autoresearch:
   plan                              debug            fix              security         ship

 ┌──────────┐     ┌──────────┐     ┌──────────┐     ┌──────────┐
 │  Probe   │     │ Scenario │     │ Predict  │     │  Reason  │
 │ Require- │     │   Edge   │     │ 5-Expert │     │  Debate  │
 │  ments   │     │  Cases   │     │  Swarm   │     │ Converge │
 └──────────┘     └──────────┘     └──────────┘     └──────────┘
 /autoresearch:   /autoresearch:   /autoresearch:   /autoresearch:
   probe            scenario         predict          reason

 ┌──────────┐     ┌──────────┐     ┌──────────┐     ┌──────────┐
 │  Learn   │     │ Improve  │     │   Eval   │     │ Baseline │
 │   Docs   │     │ Research │     │ Analyze  │     │   Diff   │
 │   Gen    │     │   PRDs   │     │ Results  │     │ Verdict  │
 └──────────┘     └──────────┘     └──────────┘     └──────────┘
 /autoresearch:   /autoresearch:   /autoresearch:   /autoresearch:
   learn            improve          evals            regression

Why This Exists

Karpathy's autoresearch demonstrated that a 630-line Python script could autonomously improve ML models overnight — 100 experiments per night — by following simple principles: one metric, constrained scope, fast verification, automatic rollback, git as memory.

Claude Autoresearch generalizes these principles to ANY domain. Not just ML — code, content, marketing, sales, HR, DevOps, or anything with a number you can measure.

v2.1.0 is a major architecture rebuild. The monolithic SKILL.md (813 lines, ~100K tokens per invocation) is replaced with a thin 41-line routing file and 12 self-contained command files (94–120 lines each, ~5–8K tokens per invocation). That is a 95% token reduction with the same capability surface.


How It Works

LOOP (N iterations or until done):
  1. Review current state + git history + results log
  2. Pick the next change (based on what worked, what failed, what's untried)
  3. Make ONE focused change
  4. Git commit (before verification)
  5. Run mechanical verification (tests, benchmarks, scores)
  6. If improved → keep. If worse → git revert. If crashed → fix or skip.
  7. Log the result
  8. Repeat until N iterations complete or goal is met.

Every improvement stacks. Every failure auto-reverts. Progress is logged in TSV format.

The Setup Phase

Before looping, Claude performs a one-time setup:

  1. Read context — reads all in-scope files
  2. Define goal — extracts or asks for a mechanical metric
  3. Define scope — which files can be modified vs read-only
  4. Establish baseline — runs verification on current state (iteration #0)
  5. Confirm and go — shows setup, then begins the loop

8 Critical Rules

# Rule
1 Bounded by default — every command has a default iteration count; unlimited is opt-in via Iterations: unlimited
2 Read before write — understand full context before modifying
3 One change per iteration — atomic changes; if it breaks, you know why
4 Mechanical verification only — no subjective "looks good"; use metrics
5 Automatic rollback — failed changes revert instantly
6 Simplicity wins — equal results + less code = keep
7 Git is memory — experiments committed with experiment: prefix; agent reads git log + git diff before each iteration
8 When stuck, think harder — re-read, combine near-misses, try radical changes

Hooks & Safety

Hooks are defense-in-depth guardrails, not a security sandbox. Claude Code ships the hook surface; OpenCode and Codex ship the core skill/runtime/install surface without hook parity.

What's Protected

Hook What it does Event
scout-block Blocks node_modules/, .git/, pycache/, etc. from filling your context PreToolUse
privacy-block Blocks .env, SSH keys, credentials from being read in sessions PreToolUse
dangerous-cmd-block Blocks force-push, rm -rf, git reset --hard PreToolUse
iteration-context Injects recent TSV iteration data after context compaction UserPromptSubmit
subagent-context Gives subagents awareness of active loop state SubagentStart
dev-rules-reminder Re-injects plan path and code standards after compaction UserPromptSubmit
simplify-gate Warns at 400 LOC, blocks at 800 LOC before shipping UserPromptSubmit
session-init Sets up project context at session start SessionStart
stop-notify Terminal notification + optional webhook on session end SessionEnd

Configuration

All hooks are on by default. Disable individually only for troubleshooting:

# Disable a specific hook
export AR_DISABLE_SCOUT_BLOCK=1
export AR_DISABLE_PRIVACY_BLOCK=1
export AR_DISABLE_DANGEROUS_CMD_BLOCK=1
# ... etc for each hook name

Optional webhook for session completion notifications:

export AR_NOTIFY_WEBHOOK=https://hooks.slack.com/services/...

Customize blocked directories with a .ckignore file (gitignore syntax) at your project root.

See guide/hooks.md for full reference.

Release preparation and contributor verification live in scripts/release.md.


Commands

Command What it does Default Iterations
/autoresearch Classic: Core iterate loop: modify → verify → keep/discard · Orchestrator: free-form goal → auto-select pipeline → loop until predicate met 25 / goal-bounded
/autoresearch:plan Convert goal into validated config one-shot
/autoresearch:debug Hunt bugs via hypothesis iteration 15
/autoresearch:fix Crush errors one-by-one to zero 20
/autoresearch:security STRIDE + OWASP audit with red-team 15
/autoresearch:ship Ship through 8 phases linear
/autoresearch:scenario Generate edge cases across 12 dimensions 20
/autoresearch:predict 5 expert personas debate one-shot
/autoresearch:learn Scout → generate docs → validate → fix 10
/autoresearch:reason Adversarial debate with blind judges 8
/autoresearch:probe 8 personas interrogate requirements 15
/autoresearch:improve Research ICP, discover improvements, generate PRDs 15
/autoresearch:evals Analyze iteration results: trends, plateaus one-shot
/autoresearch:regression Stability gate: baseline vs candidate, verdict STABLE/UNSTABLE one-shot

Universal flags: Iterations: N, Iterations: unlimited, --evals, --evals-interval N, --chain <targets>, --<subcommand> shorthand.

All commands use interactive setup when invoked without arguments. Just type the command — the agent asks for what it needs with smart defaults based on your codebase.

OpenCode users: Commands use underscore naming (/autoresearch_debug, /autoresearch_fix, etc.). All 14 commands available.

Codex users: Invoke via $autoresearch mention syntax. Subcommands are keywords: $autoresearch debug, $autoresearch plan, etc.

Quick Decision Guide

I want to... Use
Give a plain-language goal, let it self-orchestrate /autoresearch <goal> (bare, no Metric/Verify)
Improve test coverage / reduce bundle size / any metric /autoresearch
Run bounded iterations Add Iterations: N to any command
Don't know what metric to use /autoresearch:plan
Run a security audit /autoresearch:security
Ship a PR / deployment / release /autoresearch:ship
Optimize without breaking existing tests Add Guard: npm test
Hunt all bugs in a codebase /autoresearch:debug
Fix all errors (tests, types, lint) /autoresearch:fix
Debug then auto-fix /autoresearch:debug --fix
Check if something is ready to ship /autoresearch:ship --checklist-only
Explore edge cases for a feature /autoresearch:scenario
Generate test scenarios /autoresearch:scenario --format test-scenarios
Get expert opinions before starting /autoresearch:predict
Analyze from multiple angles then debug /autoresearch:predict --chain debug
Generate docs for a new codebase /autoresearch:learn --mode init
Update existing docs after changes /autoresearch:learn --mode update
Debate an architecture decision /autoresearch:reason --domain software
Surface hidden constraints before starting /autoresearch:probe
Pre-flight a fuzzy goal then loop /autoresearch:probe --chain plan,autoresearch
Discover what to build next for your ICP /autoresearch:improve
Research competitors and generate PRDs /autoresearch:improve --depth deep
Probe requirements then research improvements /autoresearch:probe --improve
Analyze trends and plateaus across past runs /autoresearch:evals
Check if a run has stalled /autoresearch:evals --file *-results.tsv
Verify a change won't regress before pushing /autoresearch:regression
Gate a PR: predict, fix, re-gate, then ship /autoresearch:regression --predict --fix --ship

Quick Start

Claude Code

Option A — npx install (recommended):

npx skills add uditgoenka/autoresearch

All 14 commands are available after restarting Claude Code.

Option B — Plugin install:

/plugin marketplace add uditgoenka/autoresearch
/plugin install autoresearch@autoresearch

Note: Start a new Claude Code session after installing. Reference files aren't resolvable in the same session where installation happened — this is a Claude Code platform limitation.

Updating (no reinstall needed):

/plugin update autoresearch

Run /reload-plugins to activate. No need to uninstall or re-clone.

Option C — Manual copy:

git clone https://github.com/uditgoenka/autoresearch.git

# Copy skill + subcommands to your project
cp -r autoresearch/.claude/skills/autoresearch .claude/skills/autoresearch
cp -r autoresearch/.claude/commands/autoresearch .claude/commands/autoresearch
cp autoresearch/.claude/commands/autoresearch.md .claude/commands/autoresearch.md

Or install globally:

cp -r autoresearch/.claude/skills/autoresearch ~/.claude/skills/autoresearch
cp -r autoresearch/.claude/commands/autoresearch ~/.claude/commands/autoresearch
cp autoresearch/.claude/commands/autoresearch.md ~/.claude/commands/autoresearch.md

Option D — Guided installer:

git clone https://github.com/uditgoenka/autoresearch.git
cd autoresearch
./scripts/install.sh --claude --global

OpenCode Quick Start

Option A — Guided installer (recommended):

git clone https://github.com/uditgoenka/autoresearch.git
cd autoresearch
./scripts/install.sh --opencode --global

Option B — Manual copy:

git clone https://github.com/uditgoenka/autoresearch.git

cp -r autoresearch/.opencode/skills/autoresearch .opencode/skills/autoresearch
cp autoresearch/.opencode/commands/autoresearch*.md .opencode/commands/

Or globally:

cp -r autoresearch/.opencode/skills/autoresearch ~/.config/opencode/skills/autoresearch
cp autoresearch/.opencode/commands/autoresearch*.md ~/.config/opencode/commands/

All 14 commands available as /autoresearch_debug, /autoresearch_fix, /autoresearch_improve, etc.

Codex Quick Start

Option A — Guided installer (recommended):

git clone https://github.com/uditgoenka/autoresearch.git
cd autoresearch
./scripts/install.sh --codex --global

Option B — Manual copy:

git clone https://github.com/uditgoenka/autoresearch.git
cp -r autoresearch/.agents/skills/autoresearch ~/.codex/skills/autoresearch

Invoke via $autoresearch mention syntax. Subcommands are keywords: $autoresearch plan, $autoresearch debug, $autoresearch evals, etc. The installed Codex package includes the bundled orchestrator and regression helpers under plugins/autoresearch/skills/autoresearch/ and .agents/skills/autoresearch/.

Run It

/autoresearch
Goal: Increase test coverage from 72% to 90%
Scope: src/**/*.test.ts, src/**/*.ts
Metric: coverage % (higher is better)
Verify: npm test -- --coverage | grep "All files"
Iterations: 25

Claude reads all files, establishes a baseline, and starts iterating — one change at a time. Keeps improvements, auto-reverts failures, logs everything. Stops after N iterations or when you interrupt.


/autoresearch:plan — Goal to Config

The hardest part isn't the loop — it's defining Scope, Metric, and Verify correctly. /autoresearch:plan converts your plain-language goal into a validated, ready-to-execute configuration.

/autoresearch:plan
Goal: Make the API respond faster

Walks through 5 steps: capture goal → define scope → define metric → define direction → validate verify command (dry-run). Every gate is mechanical — scope must resolve to files, metric must output a number, verify must pass a dry-run. Emits a handoff.json for chaining.


/autoresearch:debug — Autonomous Bug Hunter

Scientific method meets autoresearch loop. Doesn't stop at one bug — iteratively hunts ALL bugs using falsifiable hypotheses, evidence-based investigation, and 7 investigation techniques.

/autoresearch:debug
Scope: src/api/**/*.ts
Symptom: API returns 500 on POST /users
Iterations: 15

How it works: Gather symptoms → Recon → Hypothesize (specific, testable) → Test (one experiment per iteration) → Classify (confirmed/disproven/inconclusive) → Log → Repeat.

Every finding requires code evidence (file:line + reproduction steps). Every disproven hypothesis is logged — equally valuable.

Flag Purpose
--fix After hunting, auto-switch to /autoresearch:fix
--scope <glob> Limit investigation scope
--symptom "<text>" Pre-fill symptom
--severity <level> Minimum severity to report

/autoresearch:fix — Autonomous Error Crusher

Takes a broken state and iteratively repairs it until everything passes. ONE fix per iteration. Atomic, committed, verified, auto-reverted on failure.

/autoresearch:fix
Iterations: 20

Auto-detects what's broken (tests, types, lint, build) → Prioritizes (blockers first) → Fixes ONE thing → Commits → Verifies error count decreased → Guard check → Keep/Revert → Repeat. Stops automatically when error count hits zero.

Flag Purpose
--target <command> Explicit verify command
--guard <command> Safety command that must always pass
--category <type> Only fix specific type (test, type, lint, build)
--from-debug Read findings from latest debug session

Chain them: /autoresearch:debug → /autoresearch:fix --from-debug


/autoresearch:security — Autonomous Security Audit

Read-only security audit using STRIDE threat modeling, OWASP Top 10 sweeps, and red-team adversarial analysis with 4 hostile personas.

/autoresearch:security
Iterations: 15

Codebase recon → asset inventory → trust boundaries → STRIDE threat model → attack surface map → autonomous testing loop → structured report. Every finding requires code evidence (file:line + attack scenario).

Flag Purpose
--diff Only audit files changed since last audit
--fix Auto-fix confirmed Critical/High findings
--fail-on <severity> Exit non-zero for CI/CD gating

Output: Creates security/{date}-{slug}/ with 7 structured report files.


/autoresearch:ship — Universal Shipping Workflow

Ship anything through 8 phases: Identify → Inventory → Checklist → Prepare → Dry-run → Ship → Verify → Log.

/autoresearch:ship --auto

Auto-detects what you're shipping (code PR, deployment, blog post, email campaign, sales deck, research paper, design assets) and generates domain-specific che

autoresearch (uditgoenka/autoresearch)

Searching Database…

这是什么?Autoresearch 是一个技能/插件,可以把 Claude Code(也可以是 OpenCode 或 OpenAI Codex)变成一个自主改进引擎:你设定目标,它会自行循环执行“修改、验证、保留或丢弃”的周期,并记录每一次实验。
这是独立应用,还是接入我现有的编码智能体?它不是独立应用,而是一套由技能、命令和钩子组成的捆绑包,安装到你的编码智能体中,并通过该智能体的界面运行。用于拦截危险操作的钩子仅适用于 Claude Code。
怎样把它安装到 Claude Code 中?共有四种方式:npx 安装(推荐)、插件安装、手动复制到项目中或全局目录,或使用引导式安装程序;OpenCode 和 Codex 有各自同等的引导式或手动安装途径。
它实际支持哪些编码智能体?支持 Claude Code、OpenCode 和 OpenAI Codex。全部 14 个命令在每个平台上都能使用,但 OpenCode 使用下划线风格的命令名,而 Codex 则通过 $autoresearch 提及语法调用,而不是斜杠命令。
无论我用哪个智能体,安全钩子都会生效吗?不会。钩子防护(拦截 rm -rf、访问密钥、上下文膨胀等)只在 Claude Code 中提供;OpenCode 和 Codex 只获得核心技能和运行时,没有这些钩子的同等功能。
v2.1.0 架构重构有哪些变化?原本 813 行的单体 SKILL.md(每次调用约 10 万 token)被替换为一个 41 行的路由文件,加上 12 个各 94–120 行的独立命令文件,在保持功能不变的前提下,把每次调用的 token 成本降低了约 95%。
v2.2.0 的编排器模式是什么?你不必手动串联各个命令,只需用自然语言向 /autoresearch 描述一个目标;它会对目标进行分类、推导出成功判定条件、确认一次,然后自动在合适的子命令之间循环,直到满足该判定条件。
技能自带哪些命令?共 14 个命令,涵盖核心循环以及专门的工作流:plan、debug、fix、security、ship、scenario、predict、learn、reason、probe、improve、evals 和 regression,每个命令都有各自的默认迭代次数。
为什么要开发它,而不直接使用 Karpathy 的原始脚本?Karpathy 的版本是一个 630 行的 Python 脚本,仅限于通宵的机器学习实验;Autoresearch 则把同样的“修改、验证、保留/丢弃”循环推广到任何有可衡量指标的领域,包括代码、内容、营销、销售、人力资源或 DevOps。
Creator
uditgoenka
Size
0.9 MB
Stars
6.6K
Age
7mo
Commits · 90 Days