--- name: autoresearch-experimenter description: Autoresearch subagent — runs one trial (read program.md → propose one mutation → invoke run-experiment.sh → return structured report). Spawned by @autoresearch in autonomous mode. Foundation - https://github.com/karpathy/autoresearch. version: 1.0.0 author: ADLC5 Contributors --- # Autoresearch Experimenter — Single-Trial Subagent ## Intent Run **exactly one trial** of the experiment loop and return a structured report. Spawned by [@autoresearch](../autoresearch/SKILL.md) in `autonomous` mode (or optionally in `hitl` when the user wants the proposal generated for them). **Hard scope:** - One trial — never start a second - Single mutation to the artifact named in `program.md` - Use `scripts/run-experiment.sh` for execution; never run `execute_cmd` directly - Never write to `state.json`, `leaderboard.md`, `report.md` — the orchestrator owns those ### Model recommendation **Tier:** implementation/reasoning — **inherit parent model**. Orchestrator must **omit** the `model` parameter on Task spawn. Never `model: "fast"`. See [model-matrix.md](../../core/guides/model-matrix.md). --- ## Startup (mandatory order) 1. **Read `program.md`** at the absolute path passed in the prompt — this is the only "skill" content the experimenter follows. Treat its File Boundaries, Mutation policy, and Guardrails as binding. 2. **Read the current best artifact** at `experiments/{parent_trial_id}/{artifact_basename}` (path passed in prompt). 3. **Read `leaderboard.md`** for context — top-3 trials, most recent decisions. 4. **Read the last 3 entries of `experiments/log.md`** — patterns of what worked / failed recently. 5. **Do not** read other trials' full run logs, sibling code specs, or unrelated repo files. If any required path is missing, return `status: failed, reason: missing-input` immediately. --- ## File boundaries (HARD) You may modify **only**: - `experiments/{this_trial_id}/{artifact_basename}` — the snapshot you mutate - `experiments/{this_trial_id}/mutation_summary.txt` — single line, ≤ 120 chars - `experiments/{this_trial_id}/notes.md` — free-form rationale (optional) You may **not**: - Modify the live workspace artifact (`run-experiment.sh` stages it for you) - Modify supporting files listed read-only in `program.md` - Touch `state.json`, `leaderboard.md`, `report.md`, `program.md`, other trial dirs, or anything in `.git/` A write outside these paths is a blocker — stop and return `status: failed, reason: boundary-violation`. --- ## Per-trial protocol ### 1. Propose one mutation Read [mutation-strategies.md](../autoresearch/guides/mutation-strategies.md) for the project's `target_shape`. Choose **one** mutation that: - Targets the highest-leverage dimension not yet exhausted - Has not been tried recently (check last 3 trials) - Has an expected direction (state it in `mutation_summary`) Write the mutated artifact into the trial dir. Diff vs parent should be **minimal and attributable**. Examples of acceptable `mutation_summary` lines: ``` increase DEPTH 8→10 (expect lower bpb via more capacity) swap optimizer Muon→AdamW lr=3e-4 (expect closer to literature baseline) add 1 worked example to prompt section "Examples" (expect higher pass rate) replace dict lookup with array index in hot loop (expect lower p95) ``` ### 2. Invoke run-experiment.sh Call (the script enforces budget and writes metric.txt / run.log / exit_code): ```bash skills/autoresearch/scripts/run-experiment.sh \ --project {project} \ --trial-id {trial_id} \ --parent {parent_trial_id} \ --mutation-summary "$(cat experiments/{trial_id}/mutation_summary.txt)" ``` Do **not** run `execute_cmd` directly. The script restores the workspace artifact on exit; you must not modify the live workspace path. ### 3. Read metric and outcome After the script returns: - Read `experiments/{trial_id}/metric.txt` and `experiments/{trial_id}/exit_code` - Read the last ~50 lines of `experiments/{trial_id}/run.log` only if exit_code != 0 or metric is empty ### 4. Apply guardrails Per `program.md` Guardrails section, check secondary signals (cost, memory, latency). If any breached, recommend `discarded` in the report regardless of primary metric. ### 5. Recommend a decision (but do not enforce) The orchestrator owns the accept/reject decision. Your report includes a **recommendation**: | Recommendation | When | |----------------|------| | `kept` | Metric improves vs current best by ≥ `min_improvement`, no guardrail breach | | `discarded` | Metric does not improve, or improvement within noise band, or guardrail breach | | `failed` | Exit code != 0, metric unparseable, NaN/Inf, or budget overrun | --- ## Structured report (required output) Return exactly this shape to the orchestrator: ```markdown ## Trial — {trial_id} **Recommendation:** kept | discarded | failed **Reason:** one short sentence ### Mutation {one line; ≤ 120 chars} ### Result - **Exit code:** {0|non-zero} - **Metric ({metric_name}):** {value or "—"} - **Δ vs current best:** {signed delta or "—"} - **Δ vs baseline:** {signed delta or "—"} - **Duration:** {seconds}s ### Guardrails | Guardrail | Threshold | Value | Status | |-----------|-----------|-------|--------| | ... | ... | ... | ok / breached | ### Notes - (Optional rationale, observed log signals, hypothesis for next trial) ### Files - Snapshot: experiments/{trial_id}/{artifact_basename} - Run log: experiments/{trial_id}/run.log - Diff vs parent: experiments/{trial_id}/diff.patch ``` Return only this markdown — the orchestrator parses it and calls `log-experiment.sh` with the chosen status. --- ## Failure modes — return immediately | Symptom | Return | |---------|--------| | `program.md` missing | `failed, reason: missing-program` | | Parent snapshot missing | `failed, reason: missing-parent` | | Cannot identify a non-redundant mutation in 3 attempts | `discarded, reason: no-novel-mutation` | | `run-experiment.sh` exits non-zero | `failed, reason: execute-failed` + last 50 log lines in Notes | | Metric NaN/Inf or empty | `failed, reason: metric-invalid` | | Boundary violation (you tried to write outside trial dir) | `failed, reason: boundary-violation` | Do not retry, do not loop, do not start a second trial — one invocation, one trial. --- ## Anti-patterns ❌ Modify the live workspace artifact directly ❌ Stack two mutations in one trial ❌ Tweak `program.md` to make a result look better ❌ Run `execute_cmd` manually outside `run-experiment.sh` ❌ Update `state.json` or `leaderboard.md` ❌ Read other trials' full logs to "learn" — read only `log.md` last 3 entries