Stamp a self-replicating four-bead autoresearch loop (doer/judge/arbiter/strategist) for autonomous iterative improvement of any artifact. Use after interactive intake when you have a program and want to run an autonomous improvement loop with blind scoring. Triggers on: autoresearch, research loop, autonomous loop, overnight loop, iterative improvement.
Stamp and configure an autoresearch loop.
Takes a program (what to work on) and a metric (how to score it), then
stamps an initial four-bead cycle into a br epic. The beads self-replicate:
the strategist's last action is creating the next cycle's beads. The loop runs
in ralph-loop (external bash runner) until a terminal condition is met.
This skill does NOT run the loop. It stamps the beads and returns the epic ID.
The user runs ralph-loop <epic-id> separately.
br CLI installed and initialized (.beads workspace exists)Collect from the user or from prior pipeline artifacts:
hard (test command, lint, benchmark) or soft (agent
with rubric). If spec refinement, default to soft with spec-quality.md
rubric.specs/<subject>.md and specs/_artifacts/<subject>/.mkdir -p .autoresearch
Write .autoresearch/config.json:
{
"subject": "<subject>",
"epic_id": "<will be set after epic creation>",
"metric": {
"type": "soft|hard",
"rubric_path": "<path to rubric file, for soft>",
"command": "<shell command, for hard>",
"artifact_path": "<path to artifact being evaluated>"
},
"target": <number or null>,
"caps": {
"max_iterations": 20,
"wall_clock_seconds": 0,
"plateau_threshold": 3
},
"scope": {
"doer_paths": ["<paths>"],
"judge_paths": ["<paths>"]
},
"agents": {
"doer": "claude-opus",
"judge": "claude-haiku",
"strategist": "claude-sonnet"
},
"adversarial_threshold": 80,
"confirmation_rounds": 2
}
Write .autoresearch/program.md — the stable directive. If from a Forge
intake, include:
Initialize the ledger:
touch .autoresearch/research-log.jsonl
Write .autoresearch/judge-template.md — the fully-rendered judge description
with all variables filled EXCEPT {{JUDGE_OUTPUT_PATH}}, which stays as a
literal placeholder for the strategist to fill per-iteration.
Write .autoresearch/arbiter-template.sh — the fully-rendered arbiter script
(from references/arbiter.sh) with all variables filled EXCEPT {{ITER}} and
{{JUDGE_OUTPUT_PATH}}, which stay as literal placeholders for the strategist
to fill per-iteration.
These templates give the strategist concrete files to read when stamping subsequent cycles, rather than having to re-derive the descriptions.
br create --type epic --title "autoresearch: <subject>" \
--labels "autoresearch,forge:<subject-slug>"
Update config.json with the epic ID.
Create four beads under the epic. Each bead's description is rendered from the
templates in references/. The templates are parameterized — fill in paths,
iteration number (1), and the program content.
br create --title "doer-1: initial improvement" \
--type task --parent <epic-id> \
--labels "autoresearch,role:doer,agent:<doer-agent>" \
--description "<rendered doer.md template>"
The doer description includes:
.autoresearch/program.mdbr create --title "judge-1: score iteration 1" \
--type task --parent <epic-id> \
--labels "autoresearch,role:judge,agent:<judge-agent>" \
--description "<rendered judge-soft.md or judge-hard.md template>"
Depends on doer-1:
br dep add <judge-1-id> <doer-1-id>
The judge description includes:
.autoresearch/judge-output-1.jsonbr create --title "arbiter-1: keep/revert decision" \
--type task --parent <epic-id> \
--labels "autoresearch,role:arbiter-script,agent:bash" \
--description "<rendered arbiter.sh template>"
Depends on judge-1:
br dep add <arbiter-1-id> <judge-1-id>
The arbiter description contains a bash script in a fenced code block. The runner extracts and executes it directly — no LLM involved.
br create --title "strategist-1: plan next iteration" \
--type task --parent <epic-id> \
--labels "autoresearch,role:strategist,agent:<strategist-agent>" \
--description "<rendered strategist.md template>"
Depends on arbiter-1:
br dep add <strategist-1-id> <arbiter-1-id>
The strategist description includes:
Output to the user:
.autoresearch/)ralph-loop <epic-id> [--wall-clock <seconds>]Do NOT run the loop. Return control to the user.