Install & the Deterministic Sleep Experiment

Lesson 2 · SkillOpt & Agent Harnesses · ~15 minutes · hands-on

Warm-up: retrieve before you build

Answer these from memory — no peeking at Lesson 1. Say your answers out loud (or to me) before clicking.

From Lesson 1: what condition must a candidate skill edit meet before SkillOpt accepts it?
Storage strength building nicely. The gate is empirical: no improvement on unseen tasks, no merge. You'll watch this happen live in about ten minutes.
The budget bounds edit size, and the optimizer only proposes — acceptance is decided by the validation gate: strict improvement on held-out tasks. Re-skim Lesson 1's callout before continuing.

What you'll do

Install SkillOpt and run its deterministic validation experiment — the acceptance test the authors ship for the whole sleep-cycle idea. It uses a MockBackend: no API key, no cost, fully reproducible. According to the experiment source, one run proves three things:

  1. Monotonic lift — over N sleep "nights", the held-out score climbs from a baseline (empty skill) toward 1.0 as the gate accepts the rules the tasks require.
  2. Gate safety — an injected harmful edit is rejected, proving a bad nightly proposal can never be adopted.
  3. Plumbing — harvest → mine → replay → consolidate → stage → adopt all run, and the adopted artifact retains the lift when re-scored.

Step 1 — Install

Create a clean virtualenv in the workspace (SkillOpt needs Python ≥ 3.10):

cd ~/learn-skillopt-harness
python3 -m venv .venv
source .venv/bin/activate
pip install skillopt
skillopt-sleep --help

If skillopt-sleep --help prints a usage banner, you're installed.

Step 2 — Run the experiment

There are two built-in personas — a researcher (wants arXiv ids in <answer> tags) and a programmer (wants imperative-mood commit subjects). Given your mission, run the programmer:

python -m skillopt_sleep.experiments.run_experiment --persona programmer --assert-improves

The --assert-improves flag makes it exit non-zero if the lift doesn't materialize — so a clean exit is the proof.

Step 3 — Read the trace like an optimizer

Don't just check the exit code. In the output, find and note down:

Connect it back to the mental model

Everything in this trace maps to Lesson 1: the mock backend is the harness, the persona's task list is the env, and the document being grown night-by-night is the skill. Same three roles, all the way up to the paper's 52-cell benchmark grid.

Step 4 — One experiment of your own

Change one variable and predict the outcome before running:

python -m skillopt_sleep.experiments.run_experiment --persona programmer --nights 1

Prediction first: with only one night, will the held-out score reach the same level as the multi-night run? Why or why not? (Hint: think about the edit budget per night — the textual learning rate.) Run it, then check.

The experiment runs with no API key. What replaces the real LLM during replay and consolidation?
Right — MockBackend responds deterministically and carries a known-bad rule specifically so the gate-safety probe can prove rejection. Reproducible science, zero spend.
No cache and no local model — it's a deterministic MockBackend with known rules (including one known-bad rule for the gate-safety probe). That's what makes the run reproducible and free.
Next lesson needs raw material

Lesson 3 harvests your real Claude Code / Codex session transcripts. The more sessions you have between now and then, the better the mining. Just use your agents normally — that is the homework.

Recommended Reading

SkillOpt-Sleep README — Microsoft Research. How one "night" works, the dream-train / real-val / real-test split, and honest scope notes on when gains appear (~10 minutes). Skip the results tables for now.

Questions? Ask me anything that's unclear. I'm your teacher — paste any confusing output from the experiment and I'll walk you through it line by line.
Prev Next