Measure first
The benchmark records its result before correctness checks begin. The primary metric stays clean.
Autonomous optimization for pi
It tests ideas, measures every result, keeps improvements, and reverts the rest.
pi install npm:pi-autoresearch
Runs with your user permissions. Review the source and use a dedicated branch or worktree. Security guidance →
How it works
Give pi a metric and a boundary. It explores one hypothesis at a time, keeps evidence, and lets the benchmark decide.
Start with a measurable goal
/autoresearch optimize unit test runtime, monitor correctness
Agents get clever. Benchmarks remain unimpressed. Only measured improvements survive.
.auto/log.jsonlCorrectness first
Add a checks file once. Every promising experiment must pass it before the change can survive.
#!/bin/bash
set -euo pipefail
pnpm test --run
pnpm typecheck
pnpm lint
The benchmark records its result before correctness checks begin. The primary metric stays clean.
A failed test, type check, or lint blocks the keep and reverts the experiment.
The dashboard distinguishes regressions, crashes, and check failures so the next attempt can learn from them.
Durable by design
Every decision is written to the project. Restarts, context resets, and auto-compaction do not erase the work.
A fresh agent reads the session files and continues from evidence—not a fragile memory of the conversation.
.auto/prompt.md
The objective, constraints, scope, tried ideas, dead ends, and key wins. The handoff for the next agent.
.auto/ideas.md
Promising ideas wait here instead of disappearing with the context window.
.auto/log.jsonl
An append-only record of every metric, commit, decision, description, and confidence score.
.auto/hooks/
before.shexperimentafter.shFetch research before a run; persist learnings or notify afterward.
Read the hook contract →Evidence, not optimism
After three runs, pi-autoresearch compares the best improvement with the session's noise floor using Median Absolute Deviation.
Confidence is advisory. It encourages re-runs when a result is uncertain; it never discards work for you.
Browser dashboard
/autoresearch export opens a live dashboard with the full experiment history. This example uses results from the Shopify Engineering case study.
Domain agnostic
The extension provides the experiment infrastructure. Skills bring the knowledge of what to try.
| Target | Metric | Example command |
|---|---|---|
| Test speed | Seconds ↓ | pnpm test |
| Bundle size | Kilobytes ↓ | pnpm build && du -sb dist |
| LLM training | Validation loss ↓ | uv run train.py |
| Build speed | Seconds ↓ | pnpm build |
| Lighthouse | Performance ↑ | lighthouse http://localhost:3000 |
A clean ending
/skill:autoresearch-finalize groups compatible wins and creates independent branches from the merge-base.
Each branch is focused, reviewable, and carries its measured improvement in the commit history.
Stay close or walk away
Every result stays visible above the pi editor while you work.
Open a scrollable terminal view with /autoresearch dashboard. Optional shortcuts are opt-in.
Open a live chart and shareable results view with /autoresearch export.
Extension points
Optional scripts run before or after each iteration without coupling custom behavior to the agent.
Start with one metric
pi install npm:pi-autoresearch