/darkroom:autoresearch [skill-name]from Darkroom Engineering
Autonomously optimizes a SKILL.md prompt through mutate/score/keep cycles using git-based revert and checklist pass rates. Useful for iteratively improving skill prompts without manual tuning.
Ships in Darkroom Engineering. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
This workflow runs in Claude Code. In Claude Code, skip this section and continue. Only when the host is the standalone Codex CLI, stop: the loop depends on Claude subprocess isolation and model pinning, and Codex has no measured equivalent, so do not substitute native agents or claim comparable scores.
Autonomous skill optimization. You modify a skill's prompt, test it, keep improvements, revert failures. Repeat forever.
Adapted from Karpathy's autoresearch. Same method: single editable file, single metric, git-based keep/revert, autonomous loop. The only difference: SKILL.md replaces train.py, checklist pass rate replaces val_bpb.
NEVER STOP. Once the loop begins, do NOT pause to ask the human if you should continue. The human might be away and expects you to work indefinitely until manually interrupted. If you run out of ideas, think harder — re-read failing outputs, try combining near-misses, try more radical prompt rewrites. The loop runs until the human interrupts you, period.
Work with the user to configure and review the baseline, then go autonomous.
Parse target skill: Get <skill-name> from $ARGUMENTS. Validate skills/<skill-name>/SKILL.md exists.
Load or create RESEARCH.md: Check for skills/<skill-name>/RESEARCH.md; its shape and the checklist guidelines are in RESEARCH-FORMAT.md. If it exists, read it — a skill born from /harvest arrives with a seeded RESEARCH.md whose ## Test Inputs are the harvest trap prompts and whose ## Checklist is the harvest quality bar. If not, generate one:
If an existing RESEARCH.md has no ## Held-out Inputs section (a /harvest seed never does), derive 2 from the SKILL.md description, add them, and show them to the user. Derive them from the skill's stated use cases only, never by rewording a test input.
Either way, validate the shape before measuring: bun run lint:research skills/<skill-name>/RESEARCH.md (required sections present, ≥2 test inputs, held-out inputs, 3-7 checklist items, numeric settings). A seed that fails this parses wrong in the loop below.
Parse config from RESEARCH.md:
## Test Inputs — each ### Test N: heading is one training case (the text below is the prompt). The loop reads their outputs and mutates toward them.## Held-out Inputs — same shape. They are scored every round but never read by the loop (see Held-out Rule).## Checklist — each - [ ] line is a binary criterion## Settings — optional: samples (default 3), min_improvement (default 0.05), stall_rounds (default 3), model (default claude-sonnet-5-5, exported as AUTORESEARCH_MODEL — see Sample Isolation), tools (default none: samples and the judge run with every tool off; a skill that needs files may list Read, Write, Edit, Glob, Grep, which run under --restricted in an empty per-call directory)Check for a prior run: if branch autoresearch/<skill-name> exists, say so in the step 6 summary; after confirmation you resume it (see Resuming) instead of starting fresh. Create no branch or commit yet.
Read the SKILL.md as the baseline prompt. Note the YAML frontmatter boundaries — you will NEVER modify frontmatter.
Then read ~/.claude/tmp/autoresearch/LESSONS.md if it exists (see Lessons).
Its entries come from earlier runs on other skills: hypotheses for HYPOTHESIZE
to try first when a cue matches, never facts that skip measurement.
Confirm and go: Show the user the config summary (target, test count, held-out count, checklist count, samples per round, pinned model). Get confirmation. Only then, for a new run, git checkout -b autoresearch/<skill-name> from current HEAD and measure the baseline; the loop goes autonomous after the baseline review. For a prior run, check out its branch and follow Resuming instead.
bun ~/.claude/src/scripts/autoresearch-round.ts does every measurement, so no
sample is ever scored by hand and no measurement row is ever typed:
baseline <skill-name> measures the baseline (see Baseline).round <skill-name> --type <a-g> --description "<hypothesis line>" evaluates
and decides the mutation committed at HEAD (loop step 5).Run it from the repo root with a 10-minute Bash timeout or in the background; a
call runs many claude -p sessions. It is stateless between calls: best score,
held-out best, noise floor, bar, guardrail floors and sample count come from
results.tsv (see Resuming). It writes results.tsv, dashboard.md and each
training output with its verdicts (round-<N>/train-<i>.md) under
~/.claude/tmp/autoresearch/<skill-name>/. Held-out outputs are judged in memory
and never written or printed. --concurrency (default 3) sets parallel calls;
--max-cost-usd (default 5) caps the whole call, and running out logs crash.
bun ~/.claude/src/scripts/autoresearch-round.ts baseline <skill-name>.
It runs N training and N held-out samples (N = samples), scores them, and
runs the training samples a second time on the unchanged skill:
noise = |run1 - run2|. A change from best_score within this spread is
inconclusive, or the loop would keep judge randomness. At or above
min_improvement it doubles samples once; still at or above, it sets
min_improvement = noise (adding test inputs is the better fix; name it in
the final report). It then re-scores the first-run training outputs, logs
row 0, and prints the summary.The baseline correctness and safety are the floor for every later round and
never move, even when a mutation improves them — a later regression is measured
against the original skill, not against the best round so far. The pass bar
(min_improvement, the noise floor, the guardrail floors) is registered at the
baseline, before the first mutation, and holds until a rebaseline.
The loop mutates the skill toward the failures it reads, so the training score rises partly because the skill learns the specific test inputs. The held-out inputs measure whether a change generalizes. They work only while the loop has never seen them:
best_heldout and invalidates the comparison.A sample run must not inherit this machine's configuration. An in-process
Agent(...) call loads ~/.claude/CLAUDE.md, the installed hooks, and the whole
skill list into the sample — so every score measures our config plus the skill,
not the skill. When the skill under test overlaps anything in CLAUDE.md (delegation,
register, the Laziness Ladder), the loop optimizes toward a baseline that already
contains the behavior it is trying to add, and the mutation looks worthless.
The runner runs every sample, and the judge without the body, as a subprocess with settings disabled and the model pinned; run the control arm below the same way:
# Strip YAML frontmatter, keep the body — the frontmatter is never under test.
BODY=$(awk 'NR==1 && /^---$/ {fm=1; next} fm && /^---$/ {fm=0; next} !fm' \
"skills/<skill-name>/SKILL.md")
claude -p \
--setting-sources "" \
--strict-mcp-config \
--model "$AUTORESEARCH_MODEL" \
--append-system-prompt "$BODY" \
"<test input>"
--setting-sources "" loads none of user, project, local. Without it the
operator's CLAUDE.md, hooks, memory, and output style leak into every condition.--strict-mcp-config keeps MCP servers out unless the skill declares them.--model is pinned because isolation also drops the operator's saved model and
effort settings. Unpinned, the eval silently runs whatever the CLI defaults to —
the score then varies between machines and across CLI releases. Record the pinned
model with any published result; it is part of the result.Set AUTORESEARCH_MODEL once at setup (default claude-sonnet-5-5) and never change
it mid-run — a model swap invalidates every earlier row in results.tsv.
Control arm. Mutation scores are relative: they say variant B beat variant A.
They do not say the skill beats no skill. Before publishing any claim that a
skill helps, run one extra condition with --append-system-prompt carrying only a
plain one-line instruction of the same intent ("Answer concisely", "Plan before you
edit"). The honest delta is skill-vs-instruction, not skill-vs-nothing — comparing
against an empty system prompt conflates the skill with the generic ask and inflates
the number.
LOOP FOREVER (round = 1, 2, 3, ...):
1. ANALYZE
- Read the current SKILL.md body
- Review the per-item pass rates from the most recent scoring
- Identify the lowest-scoring checklist items (these are the targets)
- Among items with similar pass rates, target first the one where samples
of the SAME input split YES/NO: the skill leaves that step to chance,
and one explicit instruction usually settles it. An item that fails on
every sample of one input and passes on the others is more often an
ambiguous input or a checklist bug (Stall Review categories 1-2)
- Review recent results.tsv entries for patterns (repeated failures on same items)
2. HYPOTHESIZE
- Propose ONE targeted change to improve the lowest-scoring item(s)
- Write a one-line description of the hypothesis that names the training
sample and criterion that motivated it; a mutation no sample motivated
is speculation
- Mutation types (pick one per round):
a. ADD instruction — missing guidance for a failing criterion
b. CLARIFY — replace a vague "consider" with the exact condition and the
reason it matters (no emphasis words; they over-trigger on current models)
c. ADD example — concrete example showing desired behavior
d. ADD template — output format template that naturally satisfies criteria
e. RESTRUCTURE — move critical instructions earlier / more prominent
f. REMOVE noise — cut instructions that don't help any checklist item
g. SIMPLIFY — shorter, clearer wording for the same instruction
- Simplicity criterion (from Karpathy): "All else being equal, simpler is better.
A small improvement that adds ugly complexity is not worth it."
3. MUTATE
- Edit the SKILL.md body with the proposed change
- NEVER modify YAML frontmatter (the --- delimited block at top)
- Verify the file still has valid frontmatter after the edit
4. COMMIT
git add skills/<name>/SKILL.md
git commit -m "autoresearch: <one-line description>"
5. EVALUATE + DECIDE — one call; never score samples by hand
bun ~/.claude/src/scripts/autoresearch-round.ts round <name> --type <a-g> --description "<hypothesis line>"
- It refuses (exit 2, nothing run) unless HEAD changes only this SKILL.md
with the frontmatter untouched, HEAD~1 is the accepted commit, HEAD is
not already logged, and the tracked tree is clean
- It runs N training and N held-out samples, scores them, applies DECIDE,
rolls back to HEAD~1 with git reset --keep unless the status is kept or
simplified, logs the row and rewrites dashboard.md
- Leave git alone while it runs: if the branch, HEAD or a tracked file
changes, it exits 4 without logging or touching git
- Its summary (status, training score, held-out score, guardrails,
per-item training pass rates for the last 3 rounds, training output
paths) is the input to the next ANALYZE
DECIDE, first match wins (bar = best_score + min_improvement; each
guardrail may drop 0.1 below its baseline floor):
- vetoed: a BLOCKER in any sample, or correctness or safety below its
floor. It found a way to score higher by dropping correctness or
safety: a finding, not noise. Never re-propose it.
- simplified (KEEP; best_score and best_heldout stay put): under the bar,
a type f or g mutation cut words, |score - best_score| <= noise, and
held-out >= best_heldout
- inconclusive: under the bar, |score - best_score| <= noise; the change
cannot be told from judge noise and the current best stands
- reverted: under the bar, outside noise
- overfit: bar cleared, held-out not above best_heldout (unless both are
1.0); it raised training without helping inputs the loop never saw
- kept: bar cleared and held-out rose; best_score and best_heldout move
- A kept or simplified outcome becomes inconclusive when any judged
sample lacks an explicit BLOCKER verdict after one retry
6. CONTINUE — increment round, go to step 1
The runner scores a crashed or empty sample 0.0. When every sample crashes, or
the cost ceiling runs out, it logs crash and reverts.
After stall_rounds consecutive rounds without a KEEP, stop mutating and
review the current training failures before the next round. Sort each failing
checklist item on each training input into one of:
Append one row by hand, the only one the runner does not write: the next round
number, - as commit, five empty columns, status "stall-review", and the count
per category. If categories 1-3 have any entries, fix them in RESEARCH.md (never
the held-out inputs), commit, and run baseline <skill-name> --rebaseline, which
logs a "rebaseline" row; earlier rows no longer compare. Then resume the loop,
aiming mutations only at category 4. If category 4 is empty, the skill passes
every fair case: say so in the stall-review row and switch to SIMPLIFY and
REMOVE-noise mutations.
If the score reaches 0.95+ on three consecutive kept rounds, print
Converged at {score} after {round} rounds. Still running — interrupt to stop.
and keep going: there may still be room for improvement or simplification.
The runner judges every sample output against the checklist with strict binary
evaluation: an isolated judge sees the checklist, the test input, and the output,
and answers YES or NO per item ("unsure" is NO, no partial credit), CORRECTNESS
and SAFETY from 1 (fails) to 5, and BLOCKER YES for a dangerous instruction, a
material factual error, or a failure to follow an explicit output contract.
Score = YES count / checklist items. The prompt is scoringPrompt in
~/.claude/src/lib/autoresearch.ts.
Blind-run rule. The eval is only honest if the sample run is blind: the sample agent gets the test input and the skill — never the checklist, the expected outcome, or this conversation's context. The judge gets the checklist and the artifact — never the sample agent's transcript. Leak either direction and you are teaching to the test, not measuring the skill.
State the bar, not a parts list. Checklist criteria should express the outcome a good artifact achieves ("sliced so each piece is independently verifiable, at the granularity a competent practitioner would pick") rather than pre-enumerating every required element — the skill's judgment is what's under test, and an exhaustive parts list turns the eval into a conformance check.
The checklist measures whether the skill does its job. It does not notice when a
mutation buys a higher score by cutting something that mattered — a terser variant
that drops a confirmation step scores better on a concision-shaped checklist. The
two guardrails exist to catch exactly that, and they gate KEEP independently of the
checklist (loop step 5). The 0.1 band below each baseline floor is judge noise,
not a real regression. One BLOCKER: YES vetoes the round; it is not averaged,
because one dangerous output is not offset by two good ones.
Adapted from ayghri/i-have-adhd's eval rubric (MIT), which weights correctness 35% and safety 10% and gates release on both staying within 0.1 of baseline.
The runner rewrites ~/.claude/tmp/autoresearch/<skill-name>/dashboard.md after
every call: best and baseline scores, held-out and noise floor, guardrails
against their floors, the pinned model, status counts, per-item training pass
rates over the last 3 rounds with their trend, recent rounds, and the next target.
If autoresearch/<skill-name> branch already exists, check it out, read
dashboard.md, print Resuming from round {N}, best score: {score}, and continue
at ANALYZE. The runner rebuilds the state on every call: best_score and
best_heldout come from the last "kept" row after the latest "baseline" or
"rebaseline" row (or that row itself), and the noise floor, bar, guardrail floors
and sample count from that baseline row. The accepted commit is the last "kept"
or "simplified" row since that baseline, else the commit the baseline measured.
Before the next mutation, reconcile HEAD with the accepted commit:
pending.json in the results directory names it): rerun round on it.git reset --keep <accepted commit>, then mutate. The runner
refuses a mutation whose parent is not the accepted commit, and refuses to
re-run a commit that is already logged, so a retried kept round cannot
revert the winner.If results.tsv has no data rows (missing or header only: branch exists but no tracking), run baseline from the current branch state and start fresh tracking.
When the user stops the run, before reporting, append at most one entry to
~/.claude/tmp/autoresearch/LESSONS.md, the file every later run reads at setup:
## <skill-name> · <YYYY-MM-DD> · <model>
- cue: <the shape of skill or failure this applies to, not this skill's specifics>
- lesson: <the mutation to try, stated so it can be applied and checked>
- evidence: <the kept rounds it rests on, with training and held-out deltas>
- confidence: <high | medium | low, and why>
Write it only from a kept round whose held-out gain exceeded the noise floor.
simplified, inconclusive, reverted, and overfit rows are not evidence a mutation
transfers, and a RESTRUCTURE that changed several things at once supports only
the narrower claim the rounds isolate. If no round qualifies, append the
heading with the single line NO_ENTRY. Aim between too generic ("be clearer")
and too specific to fire again ("add the severity-label example"). Never copy a
test input, held-out input, or failing output into an entry; the Held-out Rule
applies here too.
When a later run tries a lesson, log the round's description with the lesson's heading, so a lesson that keeps reverting can be found and deleted.
When the user is satisfied (or after convergence), they merge the optimized skill
with git checkout main && git merge autoresearch/<skill-name>. The original skill on main was never modified during optimization. The branch contains the full history of every mutation that was kept.
Every number that leaves this loop names the conditions that produced it: the pinned model, sample count, and whether the comparison was against the previous variant or against the control arm. A score without those is not reproducible and should not be quoted.
Lead with the held-out score against the baseline held-out score, then the training score. A held-out gain no larger than the noise floor is "no measurable change", whatever the training score did.
Report only deltas between arms that were actually run. Never extrapolate a saving
against a counterfactual — "this skill saved N tokens on the work you did today" is
unknowable, because the run without the skill never happened. Where an estimate is
genuinely useful, label it est. and say what it was extrapolated from.
Do not compare results produced with different test inputs, checklists, models, or sample counts. That includes comparing against a published number from another project: unless the cases and the model match, the comparison measures the harness, not the skill.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub darkroomengineering/cc-settings --plugin darkroom24 skills in this plugin
/auditRepo audits, one mode or all (codebase, docs, process, perf, tests, state, threat-model, motion, SEO, platform guidelines, debt). Triggers "audit the codebase", "full audit", "perf audit", "audit the tests", "find the implicit state machines", "threat model", "motion audit", "seo audit", "platform audit", "does this follow the HIG", "debt ledger"./buildBuild a feature, page, or integration end-to-end with a GO/NO-GO gate. Triggers "build a feature", "implement feature", "add feature", "build integration". Components go to /component./case-studyTurn any web project (WebGL, three.js, React Three Fiber, Theatre.js, GSAP or Lenis scroll sites, plain DOM sites, and browser games or app-like flows) into case-study material for the studio website. Produces frame-perfect 16:9 clips of every chapter and transition (games are played through by a script with real input), layer-by-layer decompositions of every scene, Blender turntables and clay/wire/bake renders, every sound exported separately with mixes rebuilt from the animation data, every image asset (glyphs, logos, frames, textures, sprite sheets) exported separately, and a shareable exploration board with playable pieces rebuilt from the project's own assets. Triggers "case study", "showcase", "portfolio piece", "making-of", "breakdown", "how it's made", "decompose the scene", "take apart the landscape", "record the site", "capture footage", "turntable", "export the sounds", "extract the icons/assets". Use when a finished project needs to be shown, even if nobody says "case study".Other plugins' skills for the same job