Dev & Engineering ✓ Microsoft · Official agent-self-improvementmemory-consolidationnightly-sleep-cycleskill-trainingvalidation-gatesession-miningcron-scheduling

SkillOpt-Sleep: Usage-Driven Agent Self-Evolution

Gives your Claude coding agent a nightly offline sleep cycle that reviews past sessions and consolidates recurring work into gate-validated memory and skills — better with every use, no weight training required.

FollowSkills review · FSRS-1.0
Recommended
64/ 100 5-point scale 3.2 / 5
This review was completed under FSRS 1.0. Dimension scores are not converted; it is queued for re-review under FSRS 2.0.
1 2 3 4 5 6
1Utility14 / 20 · 3.5/5
2Reliability13 / 20 · 3.3/5
3Safety15 / 25 · 3.0/5

Officially published by Microsoft (verifiable official source). The core mechanism has an agent offline-review past sessions and self-modify its own CLAUDE.md/SKILL.md — a self-modifying behavior. It has a validation gate (keeps only changes that improve a held-out score) and requires explicit adoption (changes don't silently take effect) — restrained design, but 'an agent rewriting its own instruction files' still warrants understanding the scope of impact.

4Evidence7 / 15 · 2.3/5
5Usability7 / 10 · 3.5/5
6Maintenance8 / 10 · 4.0/5
Evidence confidence:Low Reviewed Jul 17, 2026
Review evidence [1]
See the full review method →

What does this skill do, and when should you use it?

SkillOpt-Sleep is a Claude Code skill from Microsoft's SkillOpt repository that gives a local agent a 'sleep cycle'. On demand or on a nightly schedule, it reads real Claude Code sessions, mines recurring tasks, replays them through a selected backend, and consolidates held-out-gated improvements into CLAUDE.md and SKILL.md. Nothing live changes until you explicitly adopt (or opt into --auto-adopt), and adoption backs up existing files first. The whole loop trains no model weights — it is framed as deployment-time training. The skill shipped with SkillOpt v0.2.0 (2026-07-02).

Runs a six-stage cycle: 1) Harvest — read-only reading of ~/.claude/projects/*/<session>.l and ~/.claude/history.l into session digests; 2) Mine — convert digests into TaskRecords with outcome labels; 3) Replay — re-run tasks under the current skill+memory via a selected backend for (hard, soft) scores (default mock backend, no API spend); 4) Consolidate — reflect on failures and propose bounded add/delete/replace edits, accepted only if a held-out slice strictly improves; 5) Stage — write proposed_CLAUDE.md / proposed_SKILL.md plus report, manifest, and diagnostics into .skillopt-sleep/staging/ without touching live files; 6) Adopt — apply with backup, explicitly or auto. Supports cron scheduling and real backends including --backend claude/codex/copilot/azure_openai.

  1. Engineers using Claude Code daily who want the agent to remember coding preferences and accumulate experience across sessions
  2. Developers on long-running projects who want nightly offline review of sessions to distill solutions for recurring workflows
  3. Team leads who want to inspect each proposal's held-out baseline-to-candidate score before adopting any skill change
  4. Privacy-sensitive users who validate the plumbing on the mock backend, or redact a harvested JSON and replay it via --tasks-file
  5. Heavy agent users who want the cycle scheduled (e.g., 3:17 AM) so self-optimization happens while they sleep

What are this skill's strengths and limitations?

Pros
  • Default validation gate: only edits that strictly improve a held-out score are accepted, with rejected edits recorded for review
  • Mock backend verifies the plumbing at zero API cost, plus a deterministic synthetic demo that demonstrates held-out lift and gate rejection
  • Non-destructive by design: read-only harvest, staging-only writes, automatic backup on adoption
  • Multi-backend support (mock/claude/codex/copilot/handoff/azure_openai), cron scheduling, and independently togglable memory vs. skill evolution
Limitations
  • Real backends send truncated transcript excerpts and derived tasks to third-party providers; the docs state the Claude transcript path is not guaranteed to remove every secret before those calls
  • A held-out gain is run-specific evidence, not a guarantee of broader improvement; results depend on tasks, model, and checks
  • Documented limitations exist, and effectiveness on your own workload requires consulting recorded results in docs/sleep
  • Tightly bound to Claude Code session paths and plugin mechanics; other platforms need adaptation

How do you install this skill?

The skill lives at plugins/claude-code/skills/skillopt-sleep/ in the microsoft/SkillOpt repository and is used as a Claude Code plugin after cloning/installing the repo, invoked via ${CLAUDE_PLUGIN_ROOT}/scripts/sleep.sh. Follow the repository's Documentation & Reproduction Guide (microsoft.github.io/SkillOpt); SKILL.md does not document standalone install steps — see docs/sleep/README.md for details.

How do you use this skill?

Prefer the /skillopt-sleep command in Claude Code, or call the runner directly: '${CLAUDE_PLUGIN_ROOT}/scripts/sleep.sh' dry-run --project "$(pwd)" for a no-staging preview; run for a full cycle that stages a proposal; adopt to apply (with backup); schedule --hour 3 --minute 17 to install a nightly cron, unschedule to remove. The default mock backend costs nothing; add --backend claude or codex to spend real budget. Trigger phrases include 'review my past sessions' or 'run the sleep cycle'. Use python -m skillopt_sleep <action> --help for the authoritative flag surface.

How does this skill compare with similar options?

The SkillOpt paper positions one-shot LLM-generated skills and loosely controlled self-revision as the alternatives it improves on: SkillOpt-Sleep treats the skill document as trainable state with held-out gated acceptance of edits. The source material names no third-party competitors.

FAQ

What does it cost to run?
The default mock backend has zero API spend. Switching to --backend claude/codex/copilot/azure_openai spends real budget; --edit-budget caps edits at 4 per night by default and --max-tasks defaults to 40, bounding cost.
Will it edit my CLAUDE.md/SKILL.md directly?
No. Everything is staged with reports first; live files change only on explicit adopt or opt-in --auto-adopt (if the gate passes), and existing files are backed up before overwrite.
What are the privacy risks?
Local harvest is read-only, but real backends send truncated transcript excerpts and derived tasks to their providers, and not every secret is guaranteed to be removed. For sensitive data use mock, or export via harvest, inspect/redact, mark it reviewed, and replay with --tasks-file.
How do I verify it actually works?
Run python -m skillopt_sleep.experiments.run_experiment --persona researcher --assert-improves — a deterministic synthetic demo where scores rise and the gate blocks a regression. It validates the mechanism, not effectiveness on your own tasks.

More skills from this repository

All from microsoft/SkillOpt

Related skills