prepare-build
Allocate the next run-NN, snapshot the spec, drop a session breadcrumb
that /extract-build-log will use later, and move into the build folder.
Does NOT start the build — building is the agent's subsequent work.
Steps
- Verify cwd is a course folder. Confirm all exist relative to cwd:
spec.md,builds/,evals/,materials/. If any are missing, refuse with: "Run /prepare-build from inside a course folder —cd courses/<name>first." Stop. - Allocate the next run number.
highest=$(ls -1 builds/ 2>/dev/null | grep -E '^run-[0-9]+$' \ | sed 's/run-//' | sort -n | tail -1) next=$(printf "run-%02d" $(( ${highest:-0} + 1 ))) - Create the run dirs and snapshot the spec.
The eval snapshot atmkdir -p "builds/$next" "evals/$next" cp spec.md "evals/$next/spec.md" # frozen snapshot, read by /eval-spec-vs-build cp spec.md "builds/$next/spec.md" # working copy, read by the build agentevals/$next/spec.mdis judged against later by/eval-spec-vs-build, so the run is judged against the spec it was actually built from even ifspec.mdis regenerated. The working copy atbuilds/$next/spec.mdmakes the build folder self-sufficient — the agent reads./spec.mdfrom inside the build folder and has no reason to navigate back up to the course folder, wherematerials/sits and is forbidden. - Drop the session breadcrumb. Write the absolute path of the
current Claude Code transcript JSONL to
evals/$next/.session. The path is built from$CLAUDE_PROJECT_DIRand$CLAUDE_CODE_SESSION_ID:
Ifslug=$(echo "$CLAUDE_PROJECT_DIR" | sed 's:/:-:g') transcript="$HOME/.claude/projects/$slug/$CLAUDE_CODE_SESSION_ID.jsonl" echo "$transcript" > "evals/$next/.session"$CLAUDE_CODE_SESSION_IDis unset for any reason, fall back to the most recently modified*.jsonlin$HOME/.claude/projects/$slug/and write that path. The file is per-run, write-once at allocation, never updated. - Announce. Say verbatim, replacing NN: "Run NN — building in
builds/run-NN/. Read
spec.md(in this folder) and nothing else from the parent course folder. When the build is in a state worth capturing, run/extract-build-log run-NNto slice the conversation into evals/run-NN/session-log.md." - Move into the build folder.
cd builds/$next. From here on the agent develops the app inside this folder.
Notes
- The breadcrumb at
evals/run-NN/.sessionis a label on the run-NN folder, not coordination state. It's never updated and never read by any other tool — only/extract-build-logconsumes it, and only when the user explicitly asks for an extract. Nothing recorder-like is running in the background. - The whole conversation is already being persisted by Claude Code into
~/.claude/projects/<slug>/<session>.jsonl; the breadcrumb just remembers which transcript to slice.
Don't
- Don't generate or modify
spec.mdhere — that's/generate-spec. - Don't ask the user for a run number — allocation is automatic.
- Don't reuse an existing run-NN folder. Every new build is a new run,
even with the same
spec.md, so runs and their evals can be compared. - Don't read
../materials/,../../materials/, or any course materials during the build. The build is a function ofspec.mdonly — that's what the eval pipeline assumes. APreToolUsehook blocks materials access from inside a build folder; if the hook is bypassed for any reason,/extract-build-logsurfaces a contamination warning.