Zero-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.
bash
clawhub install auto-optimizer
The optimizer uses git to revert bad changes. Must be in a git repo.
bash
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:
bash
./skills/auto-optimizer/auto-optimizer.sh \
--file ./your-file.md \
--metric "bash ./your-metric.sh" \
--budget 10
Binary mode:
bash
./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:
bash
./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).
bash
./skills/auto-optimizer/auto-optimizer.sh --demo outreach --budget 5
What it does:
/tmp/demo-outreach/outreach.mdSample outreach template used:
text
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):
bash
# 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.
bash
./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.
bash
./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:
text
You are a helpful assistant. Answer questions clearly and accurately.
Be concise but thorough. Help the user accomplish their goals.
--wizard — Interactive Setup#Walks you through setup interactively. Best when you're not sure which mode to use.
bash
./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.
bash
# 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 binary#When 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).
bash
# 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 N#Number of optimization iterations to run. Each iteration = one agent call + one eval.
BudgetTime (approx)Best for52 minQuick demo, sanity check105 minInitial optimization pass20~10 minProduction runs50+~30 minOvernight deep optimization
Minimum effective budget: 5 iterations. Below 5, not enough signal.
--goal minimize / --goal maximize (default: maximize)#bash
# 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 NAME#Name your session for organized results. Results saved to ./skills/auto-optimizer/results/NAME/.
bash
--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.
text
"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.
bash
# 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"
bash
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
bash ./your-metric.sh
# Should output: 73.5
If it outputs anything else (multiline, text, nothing), wrap it:
bash
--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:
bash
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"
bash
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.
IterationSeed ContentConfidence ScoreDeltaBaselinePrice + Fear/Greed only0.35—Iter 1+ Technical signals (TTM Squeeze, funding rates)0.58+0.23 ✅Iter 2+ Whale on-chain data + price levels0.67+0.09 ✅Iter 3+ Cross-asset correlation (BTC)0.61specific 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):
bash
cd /data/workspace-crypto/mirofish
npm run backend
# Or check status:
curl http://localhost:5001/health
Build a seed from live market data:
bash
cd /data/workspace-crypto
.venv/bin/python3 -m src.alpha.mirofish_adapter
Run a simulation manually via the API:
bash
# 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:
python
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)