--- name: autoresearch description: Auto-improve any OpenClaw skill using iterative prompt optimization. Inspired by Karpathy's autoresearch method. Run when asked to improve, optimize, or auto-tune any skill. Runs a loop — score → change → test → keep/revert — until target quality is reached. Fully autonomous once started. --- # Autoresearch Skill Auto-improve any skill file in this workspace using iterative, scored prompt optimization. ## The Method (Karpathy's Autoresearch) 1. Define what "good" looks like as a binary checklist (yes/no questions) 2. Run the skill on test inputs 3. Score each output against the checklist 4. Propose ONE targeted change to the skill prompt 5. Test again — keep if score improved, revert if not 6. Repeat until 95%+ or max rounds hit ## Quick Start ```bash cd /Users/jacopo/.openclaw/workspace-bertuccio/skills/autoresearch python3 scripts/autoresearch.py \ --skill /path/to/SKILL.md \ --checklist inputs/my-checklist.json \ --inputs inputs/my-inputs.json \ --max-rounds 30 \ --target 0.95 \ --dashboard \ --out /path/to/improved-SKILL.md ``` ## Input Formats ### checklist.json ```json [ {"question": "Does the output include a specific number or result? (not vague promises)"}, {"question": "Is the output free of buzzwords like 'revolutionary', 'cutting-edge', 'synergy'?"}, {"question": "Does the output include a clear, specific call to action?"}, {"question": "Is the output under 200 words?"}, {"question": "Does the first line address a specific pain point?"} ] ``` 3-6 questions is the sweet spot. Too many and the skill overfits. ### inputs.json ```json [ "Write landing page copy for an AI productivity tool for freelancers", "Write landing page copy for a B2B SaaS that automates invoicing", "Write landing page copy for a fitness app targeting busy parents" ] ``` ## Dashboard Pass `--dashboard` to get a live HTML dashboard at: `skills/autoresearch/autoresearch-dashboard/index.html` Auto-refreshes every 8 seconds. Shows: - Current score + history chart - Per-check pass/fail breakdown - Change log with keep/revert status ## Outputs | File | Description | |------|-------------| | `improved-SKILL.md` | Best version found (saves as you go) | | `backup-SKILL.md` | Original skill, untouched | | `autoresearch-log.json` | Full history: every round, score, change, keep/revert | | `autoresearch-dashboard/` | Live HTML dashboard | ## Recommended Checklist Questions Good checklist questions are: - **Binary** — pass or fail, not "sort of" - **Specific** — "mentions a number" not "is concrete" - **Independent** — each checks one thing Bad questions: - "Is the output high quality?" (too vague) - "Is the tone right?" (too subjective) - "Is it good?" (useless) ## Requirements - `ANTHROPIC_API_KEY` set in environment - Python 3.9+ - `pip3 install anthropic` ## Notes - The improved skill is saved separately — original is always backed up - The agent uses Claude itself to both evaluate outputs and propose changes - Changes that hurt the score are automatically reverted - The changelog in `autoresearch-log.json` is the most durable artifact — hand it to a future model to continue where this one left off