Skip to content

One prompt runs on a fresh fork for each task. Each fork starts from the same disk, runs the agent, then runs the repository’s tests. The output is a pass or fail table.

  • An approved account and an API key from the API keys page.
  • A base VM with your repository in /home/user/app, its dependencies installed, and Claude Code signed in. Follow steps 1 and 2 of Fix a failing test with Claude Code, then clone the repository and install its dependencies in the same VM.
  • A test command, npm test, that exits with 0 when the repository passes. A fork passes when that command exits with 0.
  • Python 3.12 with requests, Node 22 for the TypeScript tab, or jq for the curl tab.

Set these once in your terminal. The prompt must not contain a single quote, because the job wraps it in quotes.

Terminal window
export SI_API_KEY=si_...
export BASE=<base-vm-id>
export PROMPT='Fix the failing test in this repository. Do not change the tests.'

Create one fork of the base VM for each task. Each fork is named eval-1, eval-2 and so on, and carries the label run=eval. The label lets the next steps find the forks.

Terminal window
for NUMBER in 1 2 3; do
curl -sS -X POST "https://api.slashinfra.com/svms" \
-H "Authorization: Bearer $SI_API_KEY" -H "Content-Type: application/json" \
-d "{\"name\":\"eval-$NUMBER\",\"fork_of\":\"$BASE\",\"labels\":{\"run\":\"eval\"}}"
echo
done
Output
{"id":"6f1c0f0e8a","name":"eval-1","generation":1,...}
{"id":"7h2d1g1f9b","name":"eval-2","generation":1,...}
{"id":"8j3e2h2g0c","name":"eval-3","generation":1,...}

Each fork starts with the files of the base VM. Its writes stay in its own VM, so the forks do not see each other’s changes.

In each fork, start a job that runs the agent and then npm test. The job’s exit code is the exit code of npm test, because the agent’s own exit code does not decide the result. The forks run at the same time. The table lists each fork and its result. --permission-mode bypassPermissions lets Claude Code edit files and run commands without asking. A job has no one to answer a prompt, and the agent works inside its own VM.

Terminal window
SCRIPT="cd /home/user/app && claude -p --permission-mode bypassPermissions '$PROMPT'; npm test"
LISTING=$(curl -sS "https://api.slashinfra.com/svms?label.run=eval" -H "Authorization: Bearer $SI_API_KEY")
echo "name result exit"
RUNS=$(jq -r '.svms[] | "\(.id) \(.name)"' <<<"$LISTING")
while read -r ID NAME; do
JOB=$(curl -sS -X POST "https://$ID.slashinfra.dev/usr/bin/job?cwd=/home/user&arg=-q" \
-H "Authorization: Bearer $SI_API_KEY" --data-binary "$SCRIPT")
while HEADERS=$(curl -sS -D - -o /dev/null -X POST "https://$ID.slashinfra.dev/usr/bin/job?arg=wait&arg=$JOB" \
-H "Authorization: Bearer $SI_API_KEY"); grep -qi '^X-Timeout: 1' <<<"$HEADERS"; do :; done
CODE=$(grep -i '^X-Exit-Code' <<<"$HEADERS" | cut -d' ' -f2 | tr -d '\r')
if [ "$CODE" = "0" ]; then RESULT=pass; else RESULT=fail; fi
printf '%-8s%-8s%s\n' "$NAME" "$RESULT" "$CODE"
done <<<"$RUNS"
Output
name result exit
eval-1 pass 0
eval-2 fail 1
eval-3 pass 0

Delete the forks. The base VM stays, so you can run the evals again. Delete it with DELETE /svms/{id} when you no longer need it.

Terminal window
for ID in $(curl -sS "https://api.slashinfra.com/svms?label.run=eval" -H "Authorization: Bearer $SI_API_KEY" | jq -r '.svms[].id'); do
curl -sS -o /dev/null -w "%{http_code}\n" -X DELETE "https://api.slashinfra.com/svms/$ID" -H "Authorization: Bearer $SI_API_KEY"
done
Output
204
204
204

The table has one row for each fork, and each row shows pass or fail with the exit code of its npm test. To compare runs, delete the forks with step 3, then run steps 1 and 2 again and compare the two tables.

Symptom Cause Fix
409 on step 1 A fork named eval-1 already exists. Run step 3, then step 1 again.
Every row shows fail with 127 npm or claude is missing from the path of the job. Run npm --version and claude --version in the base VM.
Every row fails at once The prompt contains a single quote, which ends the quoted text in the job script. Remove the quote from PROMPT, then run steps 1 and 2 again.

Scroll horizontally to see all columns.

  • Background work: the jobs that run each fork, and the log of each job.
  • Snapshots: keep a base VM as a snapshot, so you can fork it later.
  • Software factory: the same forks, each ending in a pull request.