Run an autonomous iterative experimentation loop for programming tasks with measurable outcomes. Use when the user asks for autonomous improvement, iterative optimization, experiment loops, auto research, performance tuning, automated experimentation, hill climbing, trying changes automatically, optimizing code, benchmarks, coverage, latency, throughput, build time, memory use, or other metric-driven coding work.
Use this skill to turn a measurable programming goal into a git-backed autonomous loop that creates experiments, runs the metric command, keeps improvements, reverts regressions, and reports a research journal.
When to invoke
"Run autonomous experiments to improve this metric."
"Optimize code by trying changes automatically."
"Use an autoresearch loop for performance tuning, coverage, latency, throughput, memory, or build time."
"Hill climb this benchmark or test score."
"Keep iterating until the experiment budget is reached."
Prerequisites and context
Requires git, a git repository, and terminal access.
Requires a measurable metric with an exact command, extraction rule, and direction.
Do not use for one-shot tasks, simple bug fixes, code review, or tasks without a measurable metric.
Setup parameters
Before any experiment, collect and confirm every parameter. Do not assume or skip any item.
Parameter
Prompt
Record as
Goal
"What are you trying to improve or optimize?" Examples: execution time, memory usage, binary size, test pass rate, code coverage, API response latency, throughput, error rate, benchmark score, build time, bundle size, lines of code, cyclomatic complexity.
goal
Metric
"How do we measure success? What exact command produces the metric?" Collect command, numeric extraction rule, and direction.
Create a branch with a date tag such as autoresearch/mar17: git checkout -b autoresearch/<tag>.
Read all in-scope files to understand the current state.
Create results.tsv in the repo root with header experiment commit metric status description.
Append results.tsv and run.log to .git/info/exclude if not already present, so they stay untracked without modifying tracked files.
Run the baseline metric command on unmodified code and record experiment 0 with status baseline.
Report the baseline metric and start the loop.
For each experiment, THINK, EDIT, COMMIT, RUN, MEASURE, DECIDE, LOG, and CONTINUE until MAX_EXPERIMENTS is reached or the user interrupts.
When the loop ends, print results.tsv, summarize kept/discarded/crashed experiments, compare baseline and final metrics, show git log --oneline <start_commit>..HEAD, and recommend next steps.
Experiment loop
Step
Action
Required behavior
THINK
Generate a hypothesis from code and previous results.
Prefer low-hanging fruit, informed follow-ups, diversification after plateaus, combining winners, simplification passes, then radical changes.
EDIT
Modify in-scope files.
Keep each experiment focused and minimal. Do not touch OUT_OF_SCOPE_FILES.
COMMIT
Commit before running.
git add and git commit -m "experiment: <short description of what changed>".
If extraction fails, read the last 50 lines for errors.
DECIDE
Compare to current best.
Keep improvements, revert same or worse results with git reset --hard HEAD~1, and handle crashes.
LOG
Append one TSV row.
experiment_number commit_hash metric_value status description.
CONTINUE
Proceed autonomously.
Never pause to ask whether to continue once the loop starts.
Crash handling: attempt a quick fix for typo, import, or simple error, amend the experiment commit with git commit --amend, and rerun. If unfixable after 2 attempts, revert the experiment with git reset --hard HEAD~1 and log status crash.
Constraint handling:
If a run exceeds 2x the expected duration, kill it and treat it as a crash.
If constraints require tests to pass, run them before and after each kept change and revert failures.
Monitor memory and resource limits; revert when usage exceeds stated limits.
Do not install new dependencies or make environment changes unless the user approved it.
Do not keep regressions unless the user explicitly allowed a trade-off.
Results log
results.tsv is the research journal and has exactly five tab-separated columns:
experiment commit metric status description
0 a1b2c3d 0.997900 baseline unmodified code
1 b2c3d4e 0.993200 keep increase learning rate to 0.04
2 c3d4e5f 1.005000 discard switch to GeLU activation
3 d4e5f6g 0.000000 crash double model width (OOM)
All experiments happen on autoresearch/<tag>. Failed experiments are reverted with git reset --hard HEAD~1; successful experiments advance the branch. results.tsv and run.log remain untracked through .git/info/exclude.
Gotchas
No metric means no autoresearch: every experiment must produce a comparable numeric result.
Commit before run: committing each attempt makes clean reverts possible.
Do not skip the baseline: without experiment 0, improvement percentage is meaningless.
Do not ask mid-loop: once confirmed, run autonomously until budget or interruption.
Complexity is a cost: a small improvement that adds ugly complexity may not be worth keeping under the simplicity policy.
Autoresearch vocabulary and examples
Preserve the original loop vocabulary because users paste it into requests and logs: LOOP, IMPROVED, SAME, WORSE, CRASH, LIMITS, JSON, keeping/discarding, out-of-scope, read-only, files/dirs, code/complexity, trade-offs, risky/complex, before/after, crash/error, shell-appropriate, Memory/resources**, metric_name, and in. Example metric commands include dotnet test, dotnet test --logger trx, npm run benchmark, time ./build.sh, pytest --tb=short, and hyperfine './my-program' for my-program.
Goal, METRIC_COMMAND, METRIC_EXTRACTION, METRIC_DIRECTION, IN_SCOPE_FILES, OUT_OF_SCOPE_FILES, CONSTRAINTS, MAX_EXPERIMENTS, and SIMPLICITY_POLICY are collected and confirmed.
Baseline is measured before any code change and logged as experiment 0.
The branch name follows autoresearch/<tag>.
results.tsv and run.log are added to .git/info/exclude rather than tracked.
Every experiment is committed before running and measured afterward.
Same or worse results are reverted with git reset --hard HEAD~1 unless an approved trade-off exists.
Crashes are fixed at most twice, amended with git commit --amend, or reverted and logged as crash.
The final report includes the full results table, metric comparison, kept git log, and recommended next steps.
1---2name: autoresearch-23description: Run an autonomous iterative experimentation loop for programming tasks with measurable outcomes. Use when the user asks for autonomous improvement, iterative optimization, experiment loops, auto research, performance tuning, automated experimentation, hill climbing, trying changes automatically, optimizing code, benchmarks, coverage, latency, throughput, build time, memory use, or other metric-driven coding work.4license: MIT5---67# Autoresearch experimentation loop89Use this skill to turn a measurable programming goal into a git-backed autonomous loop that creates experiments, runs the metric command, keeps improvements, reverts regressions, and reports a research journal.1011## When to invoke1213- "Run autonomous experiments to improve this metric."14- "Optimize code by trying changes automatically."15- "Use an autoresearch loop for performance tuning, coverage, latency, throughput, memory, or build time."16- "Hill climb this benchmark or test score."17- "Keep iterating until the experiment budget is reached."1819## Prerequisites and context2021- Requires git, a git repository, and terminal access.22- Requires a measurable metric with an exact command, extraction rule, and direction.23- Inspired by Karpathy's autoresearch: <https://github.com/karpathy/autoresearch>.24- Do not use for one-shot tasks, simple bug fixes, code review, or tasks without a measurable metric.2526## Setup parameters2728Before any experiment, collect and confirm every parameter. Do not assume or skip any item.2930| Parameter | Prompt | Record as |31| --- | --- | --- |32| Goal | "What are you trying to improve or optimize?" Examples: execution time, memory usage, binary size, test pass rate, code coverage, API response latency, throughput, error rate, benchmark score, build time, bundle size, lines of code, cyclomatic complexity. | goal |33| Metric | "How do we measure success? What exact command produces the metric?" Collect command, numeric extraction rule, and direction. | `METRIC_COMMAND`, `METRIC_EXTRACTION`, `METRIC_DIRECTION` |34| Scope | "Which files or directories am I allowed to modify, and which are off limits?" | `IN_SCOPE_FILES`, `OUT_OF_SCOPE_FILES` |35| Constraints | Ask for time budget, no new dependencies, tests, public API compatibility, backward compatibility, VRAM/memory limit, and complexity limits. | `CONSTRAINTS` |36| Budget | "How many experiments should I run, or should I keep going until stopped?" | `MAX_EXPERIMENTS` or `unlimited` |37| Simplicity | Default: all else equal, simpler is better; removing code while preserving or improving the metric is excellent. | `SIMPLICITY_POLICY` |3839Confirm setup in a table and do not proceed until the user confirms.4041```markdown42| Parameter | Value |43| --- | --- |44| Goal | <goal> |45| Metric command | `<METRIC_COMMAND>` |46| Metric extraction | `<METRIC_EXTRACTION>` |47| Direction | `lower_is_better` | `higher_is_better` |48| In-scope files | `<IN_SCOPE_FILES>` |49| Out-of-scope files | `<OUT_OF_SCOPE_FILES>` |50| Constraints | `<CONSTRAINTS>` |51| Max experiments | `<MAX_EXPERIMENTS>` |52| Simplicity policy | `<SIMPLICITY_POLICY>` |53```5455## Procedure56571. Create a branch with a date tag such as `autoresearch/mar17`: `git checkout -b autoresearch/<tag>`.582. Read all in-scope files to understand the current state.593. Create `results.tsv` in the repo root with header `experiment commit metric status description`.604. Append `results.tsv` and `run.log` to `.git/info/exclude` if not already present, so they stay untracked without modifying tracked files.615. Run the baseline metric command on unmodified code and record experiment `0` with status `baseline`.626. Report the baseline metric and start the loop.637. For each experiment, THINK, EDIT, COMMIT, RUN, MEASURE, DECIDE, LOG, and CONTINUE until `MAX_EXPERIMENTS` is reached or the user interrupts.648. When the loop ends, print `results.tsv`, summarize kept/discarded/crashed experiments, compare baseline and final metrics, show `git log --oneline <start_commit>..HEAD`, and recommend next steps.6566## Experiment loop6768| Step | Action | Required behavior |69| --- | --- | --- |70| THINK | Generate a hypothesis from code and previous results. | Prefer low-hanging fruit, informed follow-ups, diversification after plateaus, combining winners, simplification passes, then radical changes. |71| EDIT | Modify in-scope files. | Keep each experiment focused and minimal. Do not touch `OUT_OF_SCOPE_FILES`. |72| COMMIT | Commit before running. | `git add` and `git commit -m "experiment: <short description of what changed>"`. |73| RUN | Execute the metric command. | Redirect output to `run.log`: Bash/Zsh uses `<command> > run.log 2>&1`; PowerShell uses `<command> *> run.log`. |74| MEASURE | Extract the metric from `run.log`. | If extraction fails, read the last 50 lines for errors. |75| DECIDE | Compare to current best. | Keep improvements, revert same or worse results with `git reset --hard HEAD~1`, and handle crashes. |76| LOG | Append one TSV row. | `experiment_number commit_hash metric_value status description`. |77| CONTINUE | Proceed autonomously. | Never pause to ask whether to continue once the loop starts. |7879Crash handling: attempt a quick fix for typo, import, or simple error, amend the experiment commit with `git commit --amend`, and rerun. If unfixable after 2 attempts, revert the experiment with `git reset --hard HEAD~1` and log status `crash`.8081Constraint handling:8283- If a run exceeds 2x the expected duration, kill it and treat it as a crash.84- If constraints require tests to pass, run them before and after each kept change and revert failures.85- Monitor memory and resource limits; revert when usage exceeds stated limits.86- Do not install new dependencies or make environment changes unless the user approved it.87- Do not keep regressions unless the user explicitly allowed a trade-off.8889## Results log9091`results.tsv` is the research journal and has exactly five tab-separated columns:9293```tsv94experiment commit metric status description950 a1b2c3d 0.997900 baseline unmodified code961 b2c3d4e 0.993200 keep increase learning rate to 0.04972 c3d4e5f 1.005000 discard switch to GeLU activation983 d4e5f6g 0.000000 crash double model width (OOM)99```100101All experiments happen on `autoresearch/<tag>`. Failed experiments are reverted with `git reset --hard HEAD~1`; successful experiments advance the branch. `results.tsv` and `run.log` remain untracked through `.git/info/exclude`.102103## Gotchas104105- **No metric means no autoresearch**: every experiment must produce a comparable numeric result.106- **Commit before run**: committing each attempt makes clean reverts possible.107- **Do not skip the baseline**: without experiment `0`, improvement percentage is meaningless.108- **Do not ask mid-loop**: once confirmed, run autonomously until budget or interruption.109- **Complexity is a cost**: a small improvement that adds ugly complexity may not be worth keeping under the simplicity policy.110111112## Autoresearch vocabulary and examples113114Preserve the original loop vocabulary because users paste it into requests and logs: `LOOP`, `IMPROVED`, `SAME`, `WORSE`, `CRASH`, `LIMITS`, `JSON`, `keeping/discarding`, `out-of-scope`, `read-only`, `files/dirs`, `code/complexity`, `trade-offs`, `risky/complex`, `before/after`, `crash/error`, `shell-appropriate`, `Memory/resources**`, `metric_name`, and ` in `. Example metric commands include `dotnet test`, `dotnet test --logger trx`, `npm run benchmark`, `time ./build.sh`, `pytest --tb=short`, and `hyperfine './my-program'` for `my-program`.115116## Output template117118```markdown119### Autoresearch result120121**Status:** running | complete | interrupted | blocked122**Branch:** `autoresearch/<tag>`123**Goal:** <goal>124**Metric:** `<METRIC_COMMAND>` using `<METRIC_EXTRACTION>`; `lower_is_better` | `higher_is_better`125**Scope:** `<IN_SCOPE_FILES>`; off-limits `<OUT_OF_SCOPE_FILES>`126127| Experiment | Commit | Metric | Status | Description |128| --- | --- | --- | --- | --- |129| 0 | `<hash>` | `<value>` | baseline | unmodified code |130| 1 | `<hash>` | `<value>` | keep | <description> |131| 2 | `<hash>` | `<value>` | discard | <description> |132| 3 | `<hash>` | `0.000000` | crash | double model width (OOM) |133134**Summary**135- Total experiments: <count>136- Kept / discarded / crashed: <counts>137- Starting metric: <value>138- Final metric: <value>139- Improvement: <percent>140- Top 3 changes: <list>141142**Kept commits**143- `<git log --oneline <start_commit>..HEAD>`144145**Recommended next steps**146- <human research idea or next experiment family>147```148149## Quality gate150151- [ ] Goal, `METRIC_COMMAND`, `METRIC_EXTRACTION`, `METRIC_DIRECTION`, `IN_SCOPE_FILES`, `OUT_OF_SCOPE_FILES`, `CONSTRAINTS`, `MAX_EXPERIMENTS`, and `SIMPLICITY_POLICY` are collected and confirmed.152- [ ] Baseline is measured before any code change and logged as experiment `0`.153- [ ] The branch name follows `autoresearch/<tag>`.154- [ ] `results.tsv` and `run.log` are added to `.git/info/exclude` rather than tracked.155- [ ] Every experiment is committed before running and measured afterward.156- [ ] Same or worse results are reverted with `git reset --hard HEAD~1` unless an approved trade-off exists.157- [ ] Crashes are fixed at most twice, amended with `git commit --amend`, or reverted and logged as `crash`.158- [ ] The final report includes the full results table, metric comparison, kept git log, and recommended next steps.159160## References161162- [Karpathy autoresearch](https://github.com/karpathy/autoresearch)
Run npx skillmds@latest add paulasilvatech/autoresearch-2 in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Run an autonomous iterative experimentation loop for programming tasks with measurable outcomes. Use when the user asks for autonomous improvement, iterative optimization, experiment loops, auto research, performance tuning, automated experimentation, hill climbing, trying changes automatically, optimizing code, benchmarks, coverage, latency, throughput, build time, memory use, or other metric-driven coding work. It is listed under Research & Search on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free. This skill is licensed under MIT.
paulasilvatech (@paulasilvatech) published this skill. Their other Agent Skills are listed on their SkillMD profile.