Official agent skill

SkillOpt Sleep Cycle

by microsoft in microsoft/SkillOpt

Runs a usage-driven self-improvement cycle for the dsh agent: harvest past sessions, mine recurring tasks, replay them and stage validated skill edits.

OfficialMITAuto-check passedAgent Workflows

Install SkillOpt Sleep Cycle

skills CLI
$ npx skills add microsoft/SkillOpt --skill skillopt-sleep -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install microsoft/SkillOpt skillopt-sleep --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/microsoft/SkillOpt.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/dsh/skills/skillopt-sleep .claude/skills/skillopt-sleep && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
skillopt-sleep
GitHub stars
18k
Token cost
~1.4k tokens
SKILL.md length
486 words
Files
1
Skills in repo
5
Repo updated
First seen
Licence
MIT

At a glance

Runs a usage-driven self-improvement cycle for the dsh agent: harvest past sessions, mine recurring tasks, replay them and stage validated skill edits.

  • Works in 6 steps: Harvest — read-only scan of supported… → Mine — digests → recurring task records… → Replay — re-run tasks under the current… → …
  • Letting the agent learn your preferences from past sessions
  • SKILL.md covers When to use, The cycle (six stages), Driving it and Parameters, plus 3 more sections
  • Calls pip and python

What it does

SkillOpt-Sleep is the deployment-time companion engine of Microsoft's SkillOpt. It works in six stages: harvest local session records read-only, mine recurring tasks, replay them with the selected backend, consolidate by reflecting on failures and proposing bounded edits behind a held-out validation gate, stage accepted proposals in a project folder, and adopt them on explicit request. Live files stay unchanged until adoption, and adoption backs them up first.

The agent drives it through seven skillopt tools: status, dry run, run, adopt, harvest, and schedule and unschedule for a nightly cron entry. The default mock backend makes no model calls and is useful for checking the plumbing, while a real backend consumes your API budget. Typical targets are AGENTS.md, SKILL.md and managed skills.

When your agent uses it

  • Letting the agent learn your preferences from past sessions
  • Running a one-off offline self-improvement review
  • Scheduling a nightly sleep cycle for a project
  • Previewing proposed skill edits before applying them

Example prompts

  • “Run a dry run of the sleep cycle and show me what it would learn.”
  • “Schedule the nightly skillopt cycle for this project.”
  • “Adopt the latest staged proposal after backing up my current files.”

Requirements

  • The dsh-skillopt plugin with its skillopt tools
  • API budget when using a real backend

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  1. Harvest — read-only scan of supported local session records → digests
  2. Mine — digests → recurring task records (intent + outcome labels + checkable refs)
  3. Replay — re-run tasks under the current skill+memory with the selected backend → (hard, soft) scores
  4. Consolidate — reflect on failures → propose bounded edits → validation gate on a held-out slice (default: accept only on strict improvement)
  5. Stage — write accepted proposals to /.skillopt-sleep/staging//. Live files are unchanged. A rejected run still has a report but no…
  6. Adopt — explicit (or operator-configured --auto-adopt) copies staged files over live ones, backing up first.

What it can do on your machine

Read from SKILL.md and the folder at commit 343db22. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • pip
    • python

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use pip, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

SkillOpt Sleep Cycle loads about 1.4k tokens when it runs. Until then it costs about 146 tokens; SKILL.md has 486 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~146
When it runs · the whole SKILL.md, loaded when a task matches
~1.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from microsoft/SkillOpt at commit 343db22, republished under its MIT licence (© microsoft). 486 words, ~1,436 tokens.

Download SKILL.mdSave it as .claude/skills/skillopt-sleep/SKILL.md (or your agent's skills folder).
name
skillopt-sleep
description
Use when the user wants the dsh agent to self-improve from past usage, asks about a nightly/offline 'sleep' or 'dream' cycle, skill/memory consolidation, or says things like 'make my agent better the more I use it', 'review my past sessions', 'learn my preferences', 'consolidate what you learned', 'run the sleep cycle', or wants to schedule background self-optimization. Drives the skillopt_sleep engine through the skillopt_* tools: harvest past sessions -> mine recurring tasks -> replay via a selected backend -> consolidate validated skills behind a held-out gate.

SkillOpt-Sleep: usage-driven self-evolution for the dsh agent

SkillOpt-Sleep is Microsoft's SkillOpt deployment-time companion engine: it reviews your past sessions (harvest), mines recurring tasks (mine), replays them through a selected backend (replay), and consolidates what it learns into skill documents behind a held-out validation gate (consolidate).

This skill drives the engine through the 7 skillopt_* tools exposed by the dsh-skillopt plugin. The default mock backend makes no model calls, which is useful for verifying the plumbing; a real backend consumes your API budget.

When to use

  • "make my agent better the more I use it" / "learn my preferences across sessions"
  • a one-off offline self-evolution / sleep / dream run (immediate or scheduled)
  • review past sessions/trajectories and distill recurring tasks
  • consolidate feedback into AGENTS.md / SKILL.md / managed skills
  • schedule (cron) the cycle, or adopt a staged proposal

The cycle (six stages)

  1. Harvest — read-only scan of supported local session records → digests
  2. Mine — digests → recurring task records (intent + outcome labels + checkable refs)
  3. Replay — re-run tasks under the current skill+memory with the selected backend → (hard, soft) scores
  4. Consolidate — reflect on failures → propose bounded edits → validation gate on a held-out slice (default: accept only on strict improvement)
  5. Stage — write accepted proposals to <project>/.skillopt-sleep/staging/<timestamp>/. Live files are unchanged. A rejected run still has a report but no proposal files.
  6. Adopt — explicit (or operator-configured --auto-adopt) copies staged files over live ones, backing up first.

Driving it

Prefer the tools over hand-editing files:

ToolBehavior
skillopt_statusstate, engine availability, latest staged proposal & report
skillopt_dry_runfull preview (harvest+mine+replay), stages nothing
skillopt_runfull cycle, stages a proposal (live files unchanged by default)
skillopt_adoptapply latest staged proposal (with backup) — the live-change boundary
skillopt_harvestread-only show/export of mined tasks
skillopt_schedule / skillopt_unscheduleinstall/remove the nightly cron entry for this project

Typical flow:

text
# 1. check state (default mock backend, zero cost)
skillopt_status

# 2. preview the cycle
skillopt_dry_run project=<dir> source=<claude|codex|…>

# 3. real run (consumes the selected backend's API budget)
skillopt_run project=<dir> backend=<codex|claude|…> preferences="Prefer pytest; keep commits imperative."

# 4. review the report, then adopt
skillopt_adopt project=<dir>

# 5. schedule nightly at 03:17
skillopt_schedule project=<dir> hour=3 minute=17 backend=<codex>
Show full SKILL.md (194 more words)Show less

Parameters

ParameterDefaultMeaning
projectconfig or cwdproject directory to evolve
backendmockmock|claude|codex|copilot|cursor|pi|opencode|handoff|azure_openai (mock = no model calls)
sourceconfigtranscript source: claude|codex|copilot|cursor|pi|opencode|auto
modelbackend defaultreplay model override
maxTasks40mined-task cap
preferencesemptyhouse rules for the reflection prior (e.g. "always use async/await")

Configuration (cordis.yml / bundle patch)

yaml
- insert:
    - id: skillopt
      name: './src/index.js'
      config:
        backend: codex
        project: /path/to/project
        preferences: 'Always use async/await'
        # auto-adopt is OPERATOR-ONLY — the model cannot set it
        autoAdopt: false

Advanced engine keys go in ~/.skillopt-sleep/config.json: gate_mode (on/off), gate_metric (hard/soft/mixed), gate_no_regression, dream_rollouts, recall_k, evolve_memory / evolve_skill.

Hard rules

  • Never hand-edit AGENTS.md / SKILL.md around skillopt_adopt; let the engine's explicit adopt (or operator-configured --auto-adopt) apply the staging manifest, backing up live files first.
  • Harvest is read-only; mock replay has no side effects.
  • Real backends send truncated transcript excerpts and derived tasks to the selected provider for mining/replay/judging/reflection. For sensitive sessions, export tasks first (skillopt_harvest output=<file>), redact, set the top-level "reviewed" to true, then replay with --tasks-file; real backends refuse unreviewed task files.
  • Show the user the held-out baseline → candidate score and the exact proposed edits before suggesting adoption. Evidence before adoption.

Validate / demo (no API spend)

bash
pip install skillopt
python -m skillopt_sleep.experiments.run_experiment --persona researcher --assert-improves

Deterministic synthetic demo: the score rises and the gate blocks a regression. It validates the mechanism, not effectiveness on your own tasks.

See the SkillOpt-Sleep docs for recorded results and limitations.

© microsoft, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in plugins/dsh/skills/skillopt-sleep of microsoft/SkillOpt.

Open the folder on GitHubat commit 343db22

Compare with similar skills

SkillOpt Sleep Cycle next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

SkillOpt Sleep Cycle compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
SkillOpt Sleep Cycle this skillmicrosoft/SkillOpt18k—~1.4kAutomated safety check: PassMIT
PicoClaw Agentsipeed/picoclaw30k—~7.2kAutomated safety check: NotesMIT
Watchmen Setupfirstbatchxyz/watchmen297—~1.1kAutomated safety check: NotesMIT
Watchmen Setupfirstbatchxyz/watchmen297—~1.2kAutomated safety check: NotesMIT
MetaBot CLIxvirobotics/metabot990—~573Automated safety check: PassMIT
Loopany Reflectsuperdesigndev/loopany140—~1.4kAutomated safety check: PassNone

Similar skills

  • PicoClaw Agent

    sipeed/picoclaw

    Answers questions about running and changing PicoClaw, from onboarding and model selection to MCP server setup, skill loading and scheduled jobs.

    30k GitHub stars~7.2k tokensUpdated 12 days ago
    Agent WorkflowsAuto-check: notes
  • Watchmen Setup

    firstbatchxyz/watchmen

    Walks through installing watchmen, running its init wizard, wiring the plugin into Codex or Claude Code and checking the result with doctor.

    297 GitHub stars~1.1k tokensUpdated 1 mo ago
    Agent WorkflowsAuto-check: notes
  • Watchmen Setup

    firstbatchxyz/watchmen

    Sets up watchmen on the current machine: installs the CLI, hands off the init wizard, wires the plugin and statusline into Claude Code and Codex, and verifies with doctor.

    297 GitHub stars~1.2k tokensUpdated 1 mo ago
    Agent WorkflowsAuto-check: notes
  • MetaBot CLI

    xvirobotics/metabot

    Documents the unified `metabot` CLI for personal memory, the skill hub, durable agent messaging, the agent registry, T5T status and scheduling.

    990 GitHub stars~573 tokensUpdated 22 days ago
    Agent WorkflowsAuto-check passed
  • Loopany Reflect

    superdesigndev/loopany

    Runs a self-improvement loop for loopany: reads recent task outcomes and dismissed signals, finds patterns, writes learnings and skill proposals, and applies accepted ones.

    140 GitHub stars~1.4k tokensUpdated 4 mo ago
    Agent WorkflowsAuto-check passed
  • Command reference for the omniroute CLI's memory, plugin, marketplace and skills commands: search and manage stored memory, install and scaffold plugins, and find skill packages.

    74k GitHub stars~1k tokensUpdated today
    Agent WorkflowsAuto-check passed

More from microsoft/SkillOpt

  • SkillOpt Sleep Cycle

    microsoft/SkillOpt

    Official

    Runs an on-demand or nightly sleep cycle that reviews past Claude Code sessions and proposes validated updates to CLAUDE.md and skills.

    18k GitHub stars~2.3k tokensUpdated today
    Auto-check passed
  • Official

    Runs a nightly or on-demand sleep cycle for a local Codex agent: review past sessions, replay recurring tasks and stage validated skill and memory edits for adoption.

    18k GitHub stars~2.3k tokensUpdated today
    Auto-check passed
  • SkillOpt-Sleep for Cursor

    microsoft/SkillOpt

    Official

    Mines recurring tasks from recent local Cursor sessions, replays them to test bounded skill edits, and stages validated improvements to a project Cursor skill for review.

    18k GitHub stars~2.4k tokensUpdated today
    Auto-check passed
  • Official

    Reference-only OpenClaw adaptation of SkillOpt-Sleep. Use it to study or port the contributed DeepSeek wrapper, not as a ready-to-run installation.

    18k GitHub stars~1.3k tokensUpdated today
    Auto-check passed

Categories

Questions about SkillOpt Sleep Cycle

What does SkillOpt Sleep Cycle do?

Runs a usage-driven self-improvement cycle for the dsh agent: harvest past sessions, mine recurring tasks, replay them and stage validated skill edits. SkillOpt-Sleep is the deployment-time companion engine of Microsoft's SkillOpt. It works in six stages: harvest local session records read-only, mine recurring tasks, replay them with the selected backend, consolidate by reflecting on failures and proposing bounded edits behind a held-out validation gate, stage accepted proposals in a project folder, and adopt them on explicit request.

When should I use SkillOpt Sleep Cycle?

SkillOpt Sleep Cycle fits situations like: letting the agent learn your preferences from past sessions; running a one-off offline self-improvement review; scheduling a nightly sleep cycle for a project; previewing proposed skill edits before applying them.

How do I install SkillOpt Sleep Cycle in Claude Code?

Run `npx skills add microsoft/SkillOpt --skill skillopt-sleep -a claude-code`. Or copy the skill folder (plugins/dsh/skills/skillopt-sleep in microsoft/SkillOpt) into .claude/skills/skillopt-sleep in your project. Claude Code loads it when a task matches its description.

How do I install SkillOpt Sleep Cycle in Codex?

Run `npx skills add microsoft/SkillOpt --skill skillopt-sleep -a codex`. Or copy the skill folder (plugins/dsh/skills/skillopt-sleep in microsoft/SkillOpt) into .agents/skills/skillopt-sleep in your project. Codex loads it when a task matches its description.

Can I use SkillOpt Sleep Cycle in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add microsoft/SkillOpt --skill skillopt-sleep -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/skillopt-sleep, .gemini/skills/skillopt-sleep, .github/skills/skillopt-sleep and .opencode/skills/skillopt-sleep in your project.

What does SkillOpt Sleep Cycle need to run?

Going by SKILL.md and its folder, SkillOpt Sleep Cycle needs the command-line tools its instructions call (pip and python). Our summary lists: The dsh-skillopt plugin with its skillopt tools; API budget when using a real backend.

Does SkillOpt Sleep Cycle access the network?

SKILL.md contains no URLs. Its commands use pip, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is SkillOpt Sleep Cycle safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does SkillOpt Sleep Cycle use?

SkillOpt Sleep Cycle is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does SkillOpt Sleep Cycle use?

About 1.4k tokens (SKILL.md is roughly 5.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to SkillOpt Sleep Cycle?

Skills that share tags, products or a category with SkillOpt Sleep Cycle: PicoClaw Agent (sipeed/picoclaw, 30k stars), Watchmen Setup (firstbatchxyz/watchmen, 297 stars), Watchmen Setup (firstbatchxyz/watchmen, 297 stars) and MetaBot CLI (xvirobotics/metabot, 990 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains SkillOpt Sleep Cycle?

microsoft (a GitHub organization, an official publisher) maintains it in microsoft/SkillOpt, which has 18,087 GitHub stars. The repository holds 5 skills in this directory. The repository was last updated on October 6, 2026.

Source: microsoft/SkillOpt on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.