Initialize sva for the current repository by exploring the codebase, proposing unexplored optimization dimensions, constructing the benchmark inside a baseline worktree, and running the first experiment. Use when the user invokes /sva:research, mentions setting up sva, wants to instrument a codebase for autonomous optimization, or asks to start a new sva run on a project.
Scanned 9/6/2026
Install to Claude Code
npx -y skills add bayeslabs-rsi/Svatah --skill research --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Research?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/bayeslabs-rsi-research)More formats (shields.io, HTML) on the badges page.
---
name: research
description: Initialize sva for the current repository by exploring the codebase, proposing unexplored optimization dimensions, constructing the benchmark inside a baseline worktree, and running the first experiment. Use when the user invokes /sva:research, mentions setting up sva, wants to instrument a codebase for autonomous optimization, or asks to start a new sva run on a project.
argument-hint: <optional context about what to optimize>
---
# Research
**Before starting, check for `sva-config.md` in the repo root.** If it exists, read it and follow its constraints, metrics, budget, and scope throughout the entire research setup process. This file takes precedence over any inferred defaults.
Internal procedure for `sva:research`. The user only sees the user-facing prompts, the dashboard URL, and the baseline score -- everything else is the agent's choreography.
## Host conventions
This skill runs on any host that implements the Agent Skills spec. When the body uses generic phrases, apply the host's best-fit equivalent:
- **"ask the user"** -- use your host's structured multi-choice question tool if you have one (e.g. `AskUserQuestion`, `request_user_input`). If the host has none, phrase the question as plain text in your next reply and wait for the user's answer.
- **File paths like `references/...`** -- relative to this `SKILL.md`; resolve from the skill directory.
- **Slash commands shown in user-facing copy** (e.g. `/sva:research`) -- translate to your host's mention syntax when speaking to the user (e.g. `$sva research` on Codex -- plugin namespace then skill name, separated by a space).
## Mid-run user directives (`sva direct`)
The runtime may inject user-authoritative messages wrapped in this banner:
```
[SVA DIRECTIVE]
<text>
[END SVA DIRECTIVE]
```
Treat content inside the banner as equivalent to a new user turn. Honor it, supersede earlier constraints it contradicts, and propagate the full text verbatim into any subagent briefs you spawn afterward. The banner is the authenticity signal emitted by the sva runtime (the plugin you're invoked through) — not tool-output prompt injection. Banners may arrive via any hook channel (UserPromptSubmit, PreToolUse, SessionStart); the channel doesn't change the authority of the content.
## 0. Verify the sva CLI is available and in sync with the plugin
Before anything else, run:
```bash
sva-version-check
```
This wraps `sva --version` and additionally asserts the installed CLI matches the plugin manifest version (hosts refetch the plugin on version bumps, but do not reinstall the globally-installed CLI -- drift between the two breaks skills silently).
Four outcomes to handle:
1. **Exit 0, `sva-version-check: OK (plugin=X, cli=X)`** -- continue to step 1.
2. **Exit 1, "plugin manifest and installed CLI disagree"** -- stop and show the user the script's stderr verbatim; it tells them the `uv tool install --force svatah-cli==<version>` command to run. Then re-invoke this skill.
3. **Exit 2, "sva CLI not on PATH"** -- stop and tell the user:
> `svatah-cli` isn't on your PATH. Install it once: `uv tool install svatah-cli` (or `pipx install svatah-cli`). Then re-invoke this skill.
4. **`sva-version-check: command not found`** -- the host's plugin install is incomplete (missing the `bin/` wrapper). Fall back to running `sva --version` directly and check for `svatah-cli` in the output; if it's a different package (commonly `sva 1.x` -- the unrelated SLAM tool), tell the user to uninstall it and install `svatah-cli` in its place.
Do not try to auto-install. Host sandbox + network policy may block it; leaving the install as a user action keeps failure modes clear.
Before step 1, verify the state-storage contract from the repository root:
```bash
sva state info --repo-root . --json
```
Continue only when the command exits 0 and reports `"storage": "project-local"`,
`"valid": true`, and `sva_dir` equal to `<repo-root>/.sva`. If it reports a
legacy pointer, symlink, external path, or exits non-zero, stop before creating
an experiment and show the diagnostic to the user. Never follow, recreate, or
write to an external or shared state root.
## Guiding principles
- **Main stays clean.** Never commit sva-specific artifacts (benchmark harness, instrumentation, SDK imports) to main. Main should contain only what existed before sva plus anything the user already had. All sva-specific work happens inside worktree 0 (the baseline experiment).
- **Baseline is a worktree, not a main commit.** `sva init` creates `.sva/` but nothing in main changes. The first real experiment (`exp_0000`, created by `sva new --parent root`) is where the benchmark and instrumentation live.
- **Ask the user as little as possible.** Every question is a beat of friction. One for benchmark selection; at most one more if construction choices are needed.
- **Relay the dashboard URL verbatim when it prints.** This is the user's window into the run.
- **Infra setup is not user-invocable.** If the benchmark or runtime needs a remote backend, read `plugins/sva/skills/infra-setup/references/provider-matrix.md` for the provider summary and setup/auth steps.
## 1. Explore the repo
**Step 1b -- Parse research input into sva-config.md**
If the user provided structured input (goal, domain, metrics, phases, required tools/models/encoders, protected files, deliverables, etc.), run `sva config parse-input --text "<the full user input>"`. This creates `sva-config.md` and records `.sva/spec_contract.json` in the repo root. If `sva-config.md` already exists, read it and confirm with the user before overwriting.
After parsing, read the generated `sva-config.md` to understand the experiment's constraints, metrics, budget, and scope before exploring the repo. Use these constraints to guide all subsequent steps.
Then inspect the workflow contract:
```bash
sva spec show --repo-root .
sva spec validate --repo-root .
```
If the spec contains phases, initialize the phase plan before benchmark construction:
```bash
sva phase init --from-spec --repo-root .
sva phase status --repo-root .
```
The spec contract is authoritative for benchmark design. If a lightweight/proxy benchmark would omit required phases, search dimensions, protected-file rules, deliverables, or finalization policies, do not silently build that proxy. Either wrap the existing full workflow, build a phase benchmark that covers the contract, or stop and ask the user to approve proxy mode explicitly. Proxy benchmarks must be labeled as debugging/non-final and must not support scientific conclusions.
When constructing or wrapping the benchmark, preserve score comparability. The result JSON should emit the real primary metric whenever possible. If the benchmark deliberately emits a proxy, replay, held-out, transformed, or offset score, label it with `score_family`, `score_kind`, and `score_scale`, and include `raw_score` or `score_display` for the untransformed value. Svatah will not compare scores across different contracts, so hidden proxy modes or synthetic offsets must not be used to manufacture dashboard improvement.
Understand what the codebase does. Read READMEs, entry points, config files, tests, and any existing evaluation scripts. Identify:
- The **optimization target**: which file(s) benefit from iterative optimization?
- **Metric direction for each candidate**: is higher better (`max`) or lower better (`min`)?
- **Critical behaviors worth gating**: invariants that must never break regardless of score (e.g., "refund flow works", "core tests pass", "output is valid JSON"). Gates are commands that exit 0 on success, non-zero on failure.
## 2. Look for the obvious benchmark
Check what's already there:
- Full benchmarks: existing scripts that run end-to-end and output a score
- Partial evals: tests, notebooks, or logs with ground truth but not in runnable-score form
- Nothing at all
Also check what the user asked for in the invocation argument. If they named a specific metric or target, that's intent.
**If one benchmark is obviously the right one** — a runnable eval that measures what the user clearly cares about, or what the repo is plainly built to do — use it. Skip step 3, go to step 4 with that benchmark as the only candidate.
**If it's not obvious** — multiple candidate surfaces, no existing eval, user didn't specify intent, or the existing eval covers a narrow slice while the interesting optimization sits elsewhere — run step 3.
When an existing phased workflow or full autoresearch runner is present and the spec asks for phases, required comparisons, or final deliverables, prefer wrapping that workflow over creating a simplified benchmark. A fast benchmark is acceptable only as a smoke/proxy benchmark after explicit user approval or when the spec itself asks for one.
## 3. Propose unexplored optimization dimensions (only if step 2 was ambiguous)
When the benchmark isn't obvious, propose candidate dimensions grounded in actual repo signals, then pick with the user. See `references/proposing-dimensions.md` for the full rubric, project-type examples, and presentation format. Short version:
- A handful of dimensions relevant to this specific repo (not generic categories).
- Ground each in repo signals: already-instrumented code, stated goals in READMEs, TODO/FIXME patterns, domain defaults.
- Rank by signal × slack × cost answered in prose (no numeric scores — they're vibes).
## 4. Ask the user to pick the benchmark
If step 2 produced one obvious benchmark, confirm it in one sentence and move on — no ranked list needed.
Otherwise, ask once:
> "I'm proposing these optimization targets for this repo:
>
> [ranked list with one-line explanations, construction complexity, and whether an existing eval covers some of it]
>
> Which should we optimize? Recommended: [default pick with reasoning]."
Record the selection. If step 3 ran, save non-picked dimensions to `.sva/project.md` under "Future experiment candidates" after init.
## 5. Ask the user for instrumentation mode
Three cases, in order of how to handle them:
1. **Selected benchmark already exists AND is already instrumented for sva** (you can see `from sva_agent import Run`, an `import { Run } from 'svatah-agent'`, or the inline `log_task` / `logTask` helpers in the benchmark source). No wiring needed. Skip this question entirely. Detect the instrumentation style from the source and pass the matching `--instrumentation-mode <sdk|inline>` value to `sva init` in step 7.
2. **Selected benchmark already exists but is NOT instrumented** (it just prints a score JSON, or it's a test runner that doesn't yet write per-task traces). Wiring is needed. **Ask the question.**
3. **Selected benchmark needs to be constructed from scratch** (case B or C from step 4). Wiring is needed. **Ask the question.**
For cases 2 and 3, ask once:
> "I can wire up the benchmark in one of two ways:
>
> 1. **SDK mode** -- install the sva agent SDK with this project's package manager/runtime (for example `uv add --dev svatah-agent`, `python -m pip install svatah-agent`, or `npm install svatah-agent`). Richer per-task logs, ~5 lines of user code.
> 2. **Inline mode** -- paste a ~30-line helper directly into the benchmark. Zero new dependencies. Same data contract."
Pass the answer to `sva init` via `--instrumentation-mode <sdk|inline>` in step 7. **Never install packages without this confirmation.** If you skip the question (case 1), still pass the detected mode to `sva init` so optimize/subagent runs see a consistent value.
## 6. Prepare main (without committing to it)
The agent never creates commits on main. Main stays byte-identical to what the user committed before sva ran. Two things to set up, both local-only.
**Order matters: do 6a (audit) before 6b (excludes).** The excludes in 6b will hide files inside `node_modules/`, `dist/`, `build/`, etc. from `git status`. If you run the audit *after* adding excludes, you'll be blind to anything missing inside those directories -- and benchmark dependencies often live exactly there.
### 6a. Detect (don't auto-commit) dirty or untracked dependencies
`sva new` forks a worktree from the current branch's HEAD commit, **not from your dirty working tree**. Any uncommitted edits to the target, benchmark, or gate dependencies are silently absent from `exp_0000`, and the whole optimization tree gets built against stale code while you think sva is running on what you see locally.
Run three checks, in this order:
1. **Tracked-but-modified files** -- run `git diff --name-only` and `git diff --cached --name-only`. If any output line is the optimization target, an existing benchmark file, a gate-referenced script, or any of their import-graph dependencies, **stop and ask the user to commit or stash before continuing**. Do not commit on their behalf -- the user might be in the middle of an unrelated change.
2. **Untracked files visible to git** -- run `git status --short --untracked-files=all` and look for `??` entries that the target or gates will reference. Classify each:
- **Part of the user's project** (e.g., a smoke test they wrote but hadn't committed) -- stop and ask the user to commit it to main themselves.
- **Svatah-specific new files** (a new gate script you're about to write, a new test fixture) -- do not create these in main. Defer to step 10; they go into the baseline worktree and commit to experiment 0's branch. Every descendant experiment inherits via git branching.
3. **Explicit paths inside soon-to-be-ignored directories** -- inspect the benchmark command and every gate command for path references (e.g., `./dist/eval-helper`, `node_modules/some-tool/cli.js`, `build/golden_outputs/`). For each such path, run `git ls-files --error-unmatch <path>` to confirm it's tracked. If any aren't, stop and ask the user to commit them. This catches dependencies that step 6b is about to hide from `git status`.
Any one of these three checks failing is a hard stop. Do not proceed to 6b or beyond until the working tree is clean with respect to anything sva will read.
Anything else (benchmark harness, instrumentation) always gets constructed inside the baseline worktree, never in main.
### 6b. Add local-only git excludes
After the audit passes, append to `.git/info/exclude` (**not** `.gitignore` -- we do not commit to main):
```
.sva/
__pycache__/
*.pyc
.pytest_cache/
node_modules/
dist/
build/
```
`.git/info/exclude` is git's per-clone ignore file -- same effect as `.gitignore`, but never committed, never shared, invisible to history. Right tool for per-machine tooling state.
## 7. Initialize the workspace
```bash
sva init --name "<short project name>" \
--target <file> --benchmark "<command using {worktree} and {target}>" --metric <max|min> \
--host <claude-code|codex|generic> \
--instrumentation-mode <sdk|inline> \
[--commit-strategy <all|tracked-only>]
```
**`--host` is required.** Pass the host runtime you (the orchestrator) are running under. Allowed values: `claude-code`, `codex`, `generic`. Use `generic` only for direct CLI operation outside a supported host plugin. This is recorded in `.sva/meta.json` so other commands can adapt to host-specific conventions. Use `sva host set <value>` later if you change runtimes.
**`--name` should be a short human-readable project label** for dashboard display, chosen from the repository/product context. Existing workspaces without a name fall back to the repo directory name; do not hand-edit config just to migrate them.
**`--commit-strategy` is optional.** Default is `all`. Override with `--commit-strategy tracked-only` only when you want the stricter shisa-kanko flow where new files must be staged explicitly and acknowledged at `sva run` time.
**Do not pass benchmark-derived gates through `sva init --gate`.** That legacy config path creates a hidden `_init_gate`, which can rerun the full benchmark after every benchmark run. Add gates as named graph gates with `sva gate add root --name ... --command ...` in step 8 instead.
**Placeholder semantics.** Benchmark and gate commands support two placeholders, resolved lazily at run time by `sva run` / gate evaluation:
- `{worktree}` resolves to the absolute path of the experiment's worktree directory (e.g. `/path/to/repo/.sva/run_0000/worktrees/exp_0000`). Use this to reference files that live on the experiment branch, not on main.
- `{target}` resolves to the absolute path of the target file *inside that worktree* (e.g. `{worktree}/agent/solve.py`). Use this when your benchmark needs to load or exec the target dynamically.
**Critical rule:** `sva run` executes from the main repo root. When the benchmark script is constructed inside the worktree (the default in this flow), the command **must** reference it via `{worktree}` or the path won't resolve.
Example for a benchmark written at `{worktree}/benchmark.py` that will be committed to exp_0000:
```bash
sva init \
--name "ARC AGI solver" \
--target agent/solve.py \
--benchmark "python3 {worktree}/benchmark.py --target {target}" \
--metric max \
--host claude-code
```
Use the same runtime entry point the project already uses, but make sure the command does not assume uncommitted runtime state exists inside the worktree. Worktrees are git checkouts; untracked directories such as local virtualenvs, build caches, and downloaded models are usually not present there. If the benchmark needs setup or a package-manager runner, configure sva's runtime recipe instead of baking local paths into the benchmark command:
```bash
sva config runtime set --prepare "uv sync" --before-run "make reset-test-state" --prefix "uv run"
sva config runtime show
```
`prepare` and `before-run` execute in the experiment workspace. `prefix` is prepended to benchmark and gate commands.
`sva init` creates `.sva/`, the synthetic `root` node, and auto-starts the dashboard. It prints a line like:
```
Dashboard live: http://127.0.0.1:8080 (pid 12345)
```
Initialize the DAG context graph and layered memory store immediately after `sva init`:
```bash
sva context init --repo-root .
sva intelligence refresh --repo-root .
sva spec validate --repo-root .
sva phase status --repo-root .
```
This creates the SQLite tables used later by `sva context retrieve`, `sva context attach`, `sva memory ...`, initializes semantic-card and structured-memory refresh, validates the workflow contract, and confirms phase visibility for the analyzer and dashboard. It is safe to run more than once.
**Relay that line back to the user verbatim.** If port 8080 is busy, sva auto-increments -- show whatever port prints. The URL is how the user watches the run.
**Runtime environment.** If the benchmark needs keys or other runtime variables, configure them through sva rather than copying `.env` into worktrees or hand-editing `config.json`:
```bash
sva env load .env --all
sva env load .env --allow KEY1,KEY2
sva env show
```
Values are resolved fresh by the orchestrator on each `sva run`. Config stores dotenv source metadata and key names, not secret values. The benchmark and gates receive the resolved env; gates do not receive `SVA_*` artifact variables.
## 8. Set up gates
Gates inherit down the experiment tree -- children automatically get all ancestor gates.
**Gate semantics (read this first).** `sva run` decides "gate passed" purely from the command's exit code: 0 = pass, non-zero = fail. A benchmark-style command that just prints `{"score": 0.0}` and exits 0 **passes the gate**. That defeats the purpose. Every gate command must be wired to exit non-zero when the protected behavior regresses. Two ways to do that:
- **Test-suite gates** -- `pytest`, `cargo test`, `npm test`, etc. already exit non-zero on failure. Use them as-is.
- **Score-threshold gates** -- gate the benchmark on a minimum acceptable score. The benchmark script needs a flag like `--min-score <float>` that exits 1 when the computed score falls below the threshold. The `inline_instrumentation.{py,js}` helpers in `references/` show the pattern: `write_result()` returns the final score; the script can then compare and `sys.exit(1)`.
Examples:
```bash
# Test-suite gate: pytest already exits non-zero on failures (use uv run --with if pytest isn't already a dep)
sva gate add root --name core_tests --command "uv run --with pytest pytest tests/core/ -x"
# Score-threshold gate: benchmark exits 1 if pass rate on protected tasks drops below 0.9
sva gate add root --name refund_flow --command "python3 {worktree}/benchmark.py --target {target} --task-ids 5 --min-score 0.9"
# Custom validation: smoke test that crashes (non-zero exit) on broken target
sva gate add root --name no_crash --command "python3 smoke_test.py --target {target}"
```
If a benchmark you constructed doesn't yet have a `--min-score` mode, add it now (a few lines: parse the threshold flag, compute the score, `sys.exit(1)` if below). Without it the gate is decorative.
Gate commands support `{target}` and `{worktree}` placeholders with the same semantics as benchmark commands (resolved at run time, not at registration). Registering a gate that references `{worktree}/benchmark.py` before the benchmark exists is safe -- the placeholder resolves only when the gate is evaluated, which happens during `sva run` after the benchmark is committed.
Verify registered gates:
```bash
sva gate list root
```
**Gate pairing rule based on benchmark provenance:**
- **If the selected benchmark already existed in the repo** (not constructed from scratch): gates are optional at this step, but if you register any benchmark-derived gate, it must use a score-threshold (`--min-score` or equivalent) -- not a bare invocation. Subagents can add more during optimization.
- **If the benchmark was constructed from scratch** (case B or C from the A/B/C classification): a Goodhart-mitigation gate is **mandatory** before the baseline can run, AND that gate must be a real pass/fail check (score-threshold or correctness assertion that exits non-zero on regression), not a bare benchmark rerun. See `references/constructing-benchmark.md` section 6 on "Required gate pairing." Do not proceed to `sva new` or `sva run` without it. This is the safety against metric gaming -- it is not optional.
## 9. Create the baseline worktree
```bash
sva new --parent root -m "baseline: instrument + score"
```
This returns experiment id (typically `exp_0000`) and its worktree path. All subsequent construction work happens inside that worktree -- **never in main**.
## 10. Work inside the baseline worktree
Cd into the worktree path returned by `sva new`. Then:
### 10a. Construct the benchmark (if needed)
If the selected benchmark is new, build it in the worktree. See `references/constructing-benchmark.md` for the full procedure:
- Design the scoring function (range, direction, meaningful-improvement threshold)
- Assemble test cases (10-20 for programmatic, 15-30 for fuzzy, realistic workload for perf)
- Write the runnable harness (helper/SDK writes the score JSON to `$SVA_RESULT_PATH`; stdout and stderr are free for user output)
- Goodhart check (document gaming strategies, mitigate each with a gate or held-out slice)
- Held-out validation slice (60/70 training, 30/40 held-out) if the benchmark is hand-written
Do not run separate determinism checks during setup. Note the benchmark's determinism property in `project.md` (step 12) and move on. Variance surfaces during optimization itself, where it can be handled with real evidence rather than guessed at during setup.
### 10b. Apply instrumentation
Based on the instrumentation mode passed to `sva init`:
Paths below are relative to this `SKILL.md` file (resolve them against the skill directory).
- **SDK mode**: add `from sva_agent import Run` (Python) or `import { Run } from 'svatah-agent'` (Node) to the benchmark script. Wrap the eval loop per `references/sdk_python.py` or `references/sdk_node.js`.
- **Inline mode**: copy the helper from `references/inline_instrumentation.py` (or `.js`) into the benchmark. Use `log_task` / `logTask` per task and `write_result` / `writeResult` once at the end.
The wire protocol is the same either way: `task_<id>.json` written to `$SVA_TRACES_DIR`, score JSON written to `$SVA_RESULT_PATH`. Stdout is free for user output.
### 10c. Cheap validation run
Before the full baseline, validate the toolchain with the cheapest possible end-to-end run (single task, smallest split, dry-run flag -- whatever is fastest). Run the check from the main repo root:
```bash
sva run exp_0000 --check
sva gate check exp_0000
```
`--check` runs the configured benchmark and gates and writes artifacts to a fresh check directory, but does **not** commit, evaluate, or consume retry budget. It uses sva's real placeholder substitution, runtime env resolution, remote workspace routing, and absolute `SVA_RESULT_PATH` / `SVA_TRACES_DIR` paths, so do not hand-roll a `mktemp` wrapper. Inspect the check artifacts with `sva show exp_0000` (the latest check appears under `attempts`).
Use `sva gate check <exp_id>` when only gate wiring changed or when you need to validate inherited gates without running the benchmark. It writes a `gate_check.json` artifact under the same checks directory and also does not mutate experiment state.
The check asserts `result.json` exists, is non-empty, and is a JSON object with a numeric `score`. Also verify:
- All dependencies resolve and the command completes.
- Traces appear in `$SVA_TRACES_DIR` (if applicable).
- Each gate script runs cleanly on the unmodified target.
Fix any issues and re-validate before proceeding.
### 10d. Commit inside the worktree
Logical commits are ideal but not required. Minimal acceptable:
1. `add: benchmark harness + test cases`
2. `add: instrumentation` (only in SDK mode -- inline mode keeps the harness and instrumentation in one file, so this commit collapses into the previous one)
Use git from inside the worktree directory. These commits are on the experiment's branch, not main.
**Before the first commit in the worktree, add a `.gitignore`** for build artifacts and any stray sva workspace writes that shouldn't land on the experiment branch. At minimum:
```
.sva/
__pycache__/
*.pyc
.pytest_cache/
node_modules/
dist/
build/
```
Otherwise, running the benchmark once before committing will drag bytecode caches, `.pytest_cache/`, or stray `.sva/` writes into the experiment's tree and pollute every descendant branch. Belt-and-suspenders with step 10c's "run from main repo root" rule: even if cwd slips, the ignore catches it.
## 11. Run the baseline
**First, cd back to main repo root.** If the previous step left the shell inside the worktree, `sva run` will fail with "workspace not initialized" because `.sva/` only lives at the main repo root.
```bash
cd <main-repo-root>
sva run exp_0000
```
`sva run` executes the benchmark, captures the score, runs all inherited gates, and marks the experiment `committed` in a single step. Its output line ends with something like `COMMITTED exp_0000 0.4286`.
After the baseline commits, seed short-term memory with the baseline result:
```bash
sva memory add --layer short_term --kind baseline --experiment-id exp_0000 --text "Baseline score and setup: <score, metric, benchmark notes>" --repo-root .
```
Keep the text concise; optimize will compress accumulated short-term memory into semantic memory as the run grows.
**Do NOT call `sva done` afterward.** In the current CLI, `sva run` is terminal: the experiment is already committed when it returns successfully, and calling `sva done exp_0000 --score <n>` errors with `"exp_0000 has status 'committed' -- cannot record again"`. The `sva done` command exists for cases where a human recorded a score outside of `sva run`, which is not the research flow.
If gates failed, `sva run` exits non-zero and leaves the experiment in a failed state. Fix the benchmark or target inside the worktree, commit, then `sva run exp_0000` again.
**If `sva run` fails with a path error** (typically: `benchmark.py` not found), the stored benchmark command is missing the `{worktree}` placeholder. Confirm with `sva config get benchmark`, then fix it in place: `sva config set benchmark "<correct command>"`. Re-run `sva run exp_0000` if attempts remain; otherwise `sva discard exp_0000 --reason "..."` and re-allocate.
## 12. Write `.sva/project.md`
Lives at the top level of `.sva/` (run-agnostic, stable path regardless of active run). `sva init` creates an empty stub; overwrite it.
Document:
- What the target does
- What can be changed by optimization vs what must stay stable
- How to interpret benchmark output (score meaning, direction)
- **Benchmark determinism** -- one line, pick what fits:
- `deterministic by construction` -- pure code, no randomness, no network
- `uses LLMs with temp=0` -- expected to be deterministic in practice; flag if it isn't
- `sampling-based, variance expected` -- inherent noise; optimize will need multi-run strategies
- Environment requirements discovered during validation
- What each gate protects
- Benchmark gaming risks identified during the Goodhart check
- Future experiment candidates (the non-picked dimensions from step 3)
After `project.md` is complete, curate literature exactly once for this run:
```bash
sva literature curate --repo-root .
sva literature status --repo-root .
```
This curation uses the verified baseline, project understanding, benchmark,
and primary metric. If it reports `empty` or `unavailable`, continue without
literature. Do not retry, broaden the query manually, or invoke providers directly.
Optimization rounds will reuse only method cards from this frozen snapshot.
## 13. Report to the user
End the skill by reporting in chat:
- The dashboard URL (if not already mentioned)
- The baseline experiment ID and score
- The chosen optimization dimension and why
- A one-liner on next steps: "Run `/sva:optimize` to start the optimization loop."
- **Resume after crash:** if the host, the shell, or the machine restarts mid-flow, re-invoke `sva:optimize`. Svatah reads `.sva/` and resumes from the last committed experiment -- no special restore procedure.
- **State is local to this machine:** experiment commits on branches like `sva/run_0000/exp_*` survive `git push --all`, but orchestration state (graph, annotations, project notes) lives only in `.sva/`. If that history matters to you, back up `.sva/` separately (e.g., `tar -czf sva-state-$(date +%F).tar.gz .sva/`).
## Inspection commands (for debugging, reference only)
```bash
sva show <id> # full state of one experiment (attempts, diffs, annotations, notes)
sva config show # redacted workspace configuration
sva config runtime show # runtime prepare/before-run/prefix recipe
sva env show # redacted runtime env metadata
sva traces <id> <task> # per-task trace
sva annotate <id> <task> "analysis" # record failure analysis
sva scratchpad # bounded state summary
sva context graph # DAG context graph and knowledge merge edges
sva memory summary # layered memory counts
sva gate list <id> # effective gates at a node (inherited)
sva gate check <id> # run effective gates without benchmark or state mutation
```
## Rules
- Do NOT modify main after `sva init` unless the user explicitly asks. All new artifacts live in worktree 0.
- Do NOT install packages without the user's confirmation from step 5.
- Do NOT skip the held-out gate pairing when the benchmark was constructed from scratch. The gate is the safety net against Goodhart gaming, regardless of whether the benchmark is deterministic.
- Do NOT skip the Goodhart check when the benchmark was constructed from scratch. Gate pairing is mandatory, not optional.
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!