Install
openclaw skills install @rmarji/auto-optimizerGuide someone through optimizing anything using iterative self-improvement loops, OR run autonomous optimization loops with binary eval scoring. Systematically improve prompts, skills, websites, emails, landing pages, code, ad copy, prediction strategies, or any artifact through automated eval-mutate-select cycles. Supports two modes: binary eval (batch scoring with yes/no criteria, best for soft domains like copy/prompts/UX) and scalar eval (single float metric with git revert, best for code/ML/configs). Use this skill whenever someone says: "optimize", "improve", "make better", "iterate on", "benchmark", "eval", "self-improving", "test and improve", "split test", "A/B test", "improve my prompt", "optimize performance", "increase conversion", "improve accuracy", "score higher", "this isn't good enough", "how do I make this better", "run autoresearch", "start optimization loop", "run experiments on", "improve my metric", "autoresearch loop", "autonomous optimization", "karpathy loop", or any variation of wanting to measurably improve something over time. Also trigger for setting up automated quality loops, evaluation criteria, or self-improving systems.
openclaw skills install @rmarji/auto-optimizerZero-friction optimization engine. Tell your OpenClaw agent "optimize my [thing]" and it runs autonomous improve-eval-keep/revert cycles until your metric goes up. Works on anything: copy, prompts, code, prediction strategies, configs.
Results in under 5 minutes. Zero configuration required for demos.
Follow these steps exactly. No judgment calls needed.
clawhub install auto-optimizer
The optimizer uses git to revert bad changes. Must be in a git repo.
cd your-project
git init && git add . && git commit -m "baseline"
Scalar mode — you have a command that outputs a single number (test score, Brier score, conversion rate, word count, etc.)
Binary mode — you want to evaluate quality with yes/no criteria (copy quality, prompt effectiveness, UX clarity)
Scalar mode:
./skills/auto-optimizer/auto-optimizer.sh \
--file ./your-file.md \
--metric "bash ./your-metric.sh" \
--budget 10
Binary mode:
./skills/auto-optimizer/auto-optimizer.sh \
--eval-mode binary \
--file ./your-file.md \
--evals ./your-evals.md \
--batch-size 10 \
--budget 10
Not sure? Use the wizard:
./skills/auto-optimizer/auto-optimizer.sh --wizard
Three self-contained demos that run immediately. No files to create, no config needed.
Optimizes a cold email template using a mock scoring metric (hook strength + clarity + CTA quality + length).
./skills/auto-optimizer/auto-optimizer.sh --demo outreach --budget 5
What it does:
/tmp/demo-outreach/outreach.mdSample outreach template used:
Subject: Quick question about [Company]
Hi [Name],
I wanted to reach out because I've been following [Company]'s work and think there might be a great opportunity for us to collaborate.
We help companies like yours improve their sales process using AI-powered outreach tools. Our clients typically see a 3x improvement in reply rates within the first month.
Would you be open to a 15-minute call next week to explore if this could be valuable for [Company]?
Looking forward to hearing from you,
[Your Name]
Mock metric logic (inline in demo):
# Score 0-100 based on:
# - Hook length <= 15 words: +25 pts
# - Single CTA (not multiple asks): +25 pts
# - Body <= 120 words: +25 pts
# - Contains specific value/number: +25 pts
Runs the optimization loop on a prediction strategy file, scoring by mock accuracy.
./skills/auto-optimizer/auto-optimizer.sh --demo prediction --budget 5
What it does:
/tmp/demo-prediction/strategy.mdOptimizes a system prompt using 5 yes/no quality criteria.
./skills/auto-optimizer/auto-optimizer.sh --demo prompt --budget 5 --eval-mode binary
What it does:
/tmp/demo-prompt/system-prompt.mdSample system prompt used:
You are a helpful assistant. Answer questions clearly and accurately.
Be concise but thorough. Help the user accomplish their goals.
--wizard — Interactive SetupWalks you through setup interactively. Best when you're not sure which mode to use.
./skills/auto-optimizer/auto-optimizer.sh --wizard
Prompts you to choose:
--eval-mode scalar (default)When to use: Anything with a measurable number. Test pass rate, Brier score, word count, latency, revenue, API response score.
Requirements: Your --metric command must print a single float to stdout.
# Example metric commands:
--metric "python test_score.py" # outputs: 0.847
--metric "bash run_eval.sh | tail -1" # outputs: 73.2
--metric "node score.js" # outputs: 0.91
How it works: Runs metric → agent proposes change → run metric again → if improved, commit; else git checkout to revert.
--eval-mode binaryWhen to use: Copy, prompts, UX, anything where quality is multi-dimensional and hard to reduce to one number.
Requirements: An evals file (markdown list of yes/no criteria) and a --batch-size (default 10).
# Example evals.md:
1. Is the hook under 15 words?
2. Is there exactly one call-to-action?
3. Does it mention a specific outcome or number?
4. Is the total length under 150 words?
5. Does it address a specific pain point?
How it works: For each iteration, generates batch-size outputs from the current file, scores each against all criteria, calculates overall pass % → agent proposes change → compare pass % → keep or revert.
--budget NNumber of optimization iterations to run. Each iteration = one agent call + one eval.
| Budget | Time (approx) | Best for |
|---|---|---|
| 5 | ~2 min | Quick demo, sanity check |
| 10 | ~5 min | Initial optimization pass |
| 20 | ~10 min | Production runs |
| 50+ | ~30 min | Overnight deep optimization |
Minimum effective budget: 5 iterations. Below 5, not enough signal.
--goal minimize / --goal maximize (default: maximize)# Minimize (e.g., Brier score, error rate, latency):
--goal minimize --metric "python score_brier.py"
# Maximize (default — e.g., accuracy, pass rate, revenue):
--metric "python score_accuracy.py"
--session NAMEName your session for organized results. Results saved to ./skills/auto-optimizer/results/NAME/.
--session "outreach-v2-$(date +%Y%m%d)"
--batch-size N (binary mode only)How many outputs to generate per iteration for scoring. Higher = more reliable signal, slower.
Every iteration is logged to results/SESSION/hypothesis_log.jsonl. The agent reads the last 5 entries before each iteration, so it never retries approaches that already failed.
This is what makes multi-iteration runs productive rather than random. The optimizer builds on what worked, avoids what didn't.
"Run auto-optimizer on ./outreach.md optimizing for reply rate, 20 iterations"
"Optimize my system prompt at ./prompts/classifier.md using binary eval mode"
"Start an overnight optimization loop on my prediction strategy, minimize Brier score, budget 50"
"Set up auto-optimizer for my cold outreach template"
Your OpenClaw agent reads this SKILL.md, picks the right mode, sets up the files, and runs the loop.
# Outreach optimization (binary)
./skills/auto-optimizer/auto-optimizer.sh \
--eval-mode binary \
--file ./outreach.md \
--evals ./evals/outreach-evals.md \
--batch-size 10 \
--budget 20 \
--session "outreach-$(date +%Y%m%d)"
# Prediction strategy (scalar, minimize)
./skills/auto-optimizer/auto-optimizer.sh \
--file ./strategy.md \
--metric "python eval_strategy.py" \
--goal minimize \
--budget 30 \
--session "prediction-strategy-v2"
# Code optimization (scalar, maximize test score)
./skills/auto-optimizer/auto-optimizer.sh \
--file ./src/classifier.py \
--metric "python -m pytest tests/ -q 2>&1 | grep -oP '\d+(?= passed)'" \
--budget 20 \
--session "classifier-v2"
From actual runs:
Prediction market strategy — 5 iterations:
Cold outreach template — 10 iterations:
System prompt — 20 iterations (binary):
Typical pattern:
"Not a git repo"
cd your-project && git init && git add . && git commit -m "baseline"
"Metric command failed" or returns 0 always Your metric command must print a single float to stdout. Test it standalone:
bash ./your-metric.sh
# Should output: 73.5
If it outputs anything else (multiline, text, nothing), wrap it:
--metric "bash ./your-metric.sh | grep -oE '[0-9]+\.?[0-9]*' | tail -1"
"claude CLI not found"
Option A: Install claude CLI globally: npm install -g @anthropic-ai/claude-code
Option B: The script falls back to OpenClaw's claude-code skill automatically if skills/claude-code/claude-code.sh exists.
"ERROR: --evals is required for binary eval mode" Binary mode needs an evals file with numbered criteria:
cat > ./my-evals.md << 'EOF'
1. Is the hook under 15 words?
2. Is there exactly one CTA?
3. Does it mention a specific number or outcome?
4. Is the total under 150 words?
5. Does it address a specific pain point?
EOF
"Budget too low"
Minimum 5 iterations to see meaningful improvement. Use --budget 10 for first runs.
Results not improving after many iterations
cat results/SESSION/hypothesis_log.jsonl--session new-run-v2"program.md.template not found"
ls skills/auto-optimizer/
# Should show: auto-optimizer.sh, SKILL.md, program.md.template, results/
If missing, reinstall: clawhub install auto-optimizer
MiroFish is a swarm intelligence engine that runs thousands of AI agents to simulate outcomes and generate prediction reports. Combined with auto-optimizer, you can autonomously improve the "seed" inputs that drive MiroFish simulations.
| Iteration | Seed Content | Confidence Score | Delta |
|---|---|---|---|
| Baseline | Price + Fear/Greed only | 0.35 | — |
| Iter 1 | + Technical signals (TTM Squeeze, funding rates) | 0.58 | +0.23 ✅ |
| Iter 2 | + Whale on-chain data + price levels | 0.67 | +0.09 ✅ |
| Iter 3 | + Cross-asset correlation (BTC) | 0.61 | specific question |
Key insight: Adding technical structure data (funding rates, squeeze, key levels) produces the biggest confidence boost. Whale on-chain context is the #2 improvement driver.
MiroFish must be running (backend on port 5001):
cd /data/workspace-crypto/mirofish
npm run backend
# Or check status:
curl http://localhost:5001/health
Build a seed from live market data:
cd /data/workspace-crypto
.venv/bin/python3 -m src.alpha.mirofish_adapter
Run a simulation manually via the API:
# 1. Get or create a project_id
curl http://localhost:5001/api/graph/project/list
# 2. Create simulation
curl -X POST http://localhost:5001/api/simulation/create \
-H "Content-Type: application/json" \
-d '{"project_id": "proj_XXXX"}'
# 3. Start simulation
curl -X POST http://localhost:5001/api/simulation/start \
-H "Content-Type: application/json" \
-d '{"simulation_id": "sim_XXXX"}'
# 4. Check status
curl http://localhost:5001/api/simulation/sim_XXXX/run-status
# 5. Get agent actions (raw predictions)
curl http://localhost:5001/api/simulation/sim_XXXX/run-status/detail
Extract confidence from MiroFish agent actions:
import urllib.request, json
def score_mirofish_seed(simulation_id: str) -> float:
"""Score a MiroFish simulation — returns 0.0-1.0 confidence."""
url = f"http://localhost:5001/api/simulation/{simulation_id}/run-status/detail"
with urllib.request.urlopen(url) as r:
d = json.loads(r.read())
actions = d['data']['all_actions']
bull_words = ['bullish','accumulation','buy','upside','reversal','support']
bear_words = ['bearish','sell','drop','fear','panic','bleeding']
bull = sum(1 for a in actions
for w in bull_words
if w in a.get('action_args',{}).get('content','').lower())
bear = sum(1 for a in actions
for w in bear_words
if w in a.get('action_args',{}).get('content','').lower())
total = bull + bear
return bull / total if total > 0 else 0.5
/data/workspace-crypto/src/alpha/mirofish_adapter.py/data/workspace-crypto/mirofish-autooptimizer-results.mdhttp://localhost:5001 (Flask backend, port 5001)