Agent skill

Skillopt Sleep

by alirezarezvani in alirezarezvani/claude-skills

A skill your agent uses when the user wants their Claude agent to self-improve from past usage, asks about a nightly/offline 'sleep' or 'dream' cycle, memory/skill consolidation, or says things like…

MITAuto-check passedAgent Workflows

Install Skillopt Sleep

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

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

GitHub CLI
$ gh skill install alirezarezvani/claude-skills 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/alirezarezvani/claude-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/engineering/skillopt-sleep/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
28k
Token cost
~1.8k tokens
SKILL.md length
713 words
Files
1
Skills in repo
342
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when the user wants their Claude agent to self-improve from past usage, asks about a nightly/offline 'sleep' or 'dream' cycle, memory/skill consolidation, or says things like…

  • Works in 6 steps: Harvest — read… → Mine — digests → TaskRecords (recurring… → Replay — re-run tasks offline under the… → …
  • The user wants their Claude agent to self-improve from past usage
  • SKILL.md covers When to use this skill, The cycle (six stages), How to drive it and All CLI flags, plus 4 more sections
  • Calls python

What it does

Skillopt Sleep is an agent skill from alirezarezvani/claude-skills. Use when the user wants their Claude agent to self-improve from past usage, asks about a nightly/offline 'sleep' or 'dream' cycle, memory/skill 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 offline self-optimization. Drives the skilloptsleep engine: harvest past sessions - mine recurring tasks - replay offline - consolidate validated CLAUDE.md and SKILL.md…

Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Agent Workflows, covering Scheduled and recurring tasks and Agent instruction files. The repository describes itself as: 380 Claude Code skills & agent skills & plugins (30+ Agents, 70+ custom commands, 380+ skills, customizable references, scripts)for Claude Code, Codex, Gemini CLI, Cursor, and 8… The licence is MIT.

When your agent uses it

  • The user wants their Claude agent to self-improve from past usage
  • Asks about a nightly/offline sleep
  • Memory/skill consolidation
  • Says things like make my agent better the more I use it

Example prompts

  • “cycle, memory/skill consolidation, or says things like”
  • “review my past sessions”
  • “learn my preferences”
  • “/skillopt-sleep”

Requirements

  • Python 3

Workflow steps

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

  1. Harvest — read ~/.claude/projects/*/.jsonl + ~/.claude/history.jsonl (READ-ONLY) → session digests.
  2. Mine — digests → TaskRecords (recurring intents + outcome labels + checkable refs where possible).
  3. Replay — re-run tasks offline under the current skill+memory → (hard, soft) scores.
  4. Consolidate — reflect on failures → propose bounded edits → gate on a held-out slice; accept only if it strictly improves.
  5. Stage — write proposed_CLAUDE.md, proposed_SKILL.md, a diff, and report.md into /.skillopt-sleep/staging//. Nothing live changes.
  6. Adopt — explicit (or opt-in auto): copy staged files over live ones, backing up first.

What it can do on your machine

Read from SKILL.md and the folder at commit 19392f7. 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:

    • python

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

  • Network

    Links to these hosts (documentation or services it may open):

    • microsoft.github.io

    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 loads about 1.8k tokens when it runs. Until then it costs about 140 tokens; SKILL.md has 713 words of instructions outside code blocks.

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

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 alirezarezvani/claude-skills at commit 19392f7, republished under its MIT licence (© alirezarezvani). 713 words, ~1,793 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 their Claude agent to self-improve from past usage, asks about a nightly/offline 'sleep' or 'dream' cycle, memory/skill 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 offline self-optimization. Drives the skillopt_sleep engine: harvest past sessions -> mine recurring tasks -> replay offline -> consolidate validated CLAUDE.md and SKILL.md behind a held-out gate.

SkillOpt-Sleep: offline self-evolution for a local Claude agent

SkillOpt-Sleep gives the user's agent a sleep cycle. While the user is offline (e.g. nightly), it reviews their real past Claude Code sessions, re-runs recurring tasks on their own API budget, and consolidates what it learns into memory (CLAUDE.md) and skills (SKILL.md) — but only keeps changes that pass a held-out validation gate, and only after the user adopts them. The agent gets measurably better at this user's recurring work, with no model-weight training. It is the deployment-time analogue of training: short-term experience → long-term competence.

It synthesizes three ideas:

  • SkillOpt — the skill/memory doc is trainable text; bounded add/delete/replace edits; accepted only through a held-out gate; rejected edits become negative feedback.
  • Claude Dreams — offline consolidation that reads past sessions and rebuilds memory (dedup/merge/resolve); the input is never mutated; output is reviewed then adopted.
  • Agent sleep — periodic offline replay turns episodes into durable skill.

When to use this skill

Trigger when the user wants any of:

  • "make my agent learn from how I use it" / "get better the more I use it" / "remember my preferences across sessions"
  • a nightly/scheduled or on-demand offline self-improvement / dream / sleep run
  • to review past sessions/trajectories and distill recurring tasks
  • to consolidate feedback into CLAUDE.md or a managed skill
  • to schedule the cycle (cron) or adopt a staged proposal

The cycle (six stages)

  1. Harvest — read ~/.claude/projects/*/<session>.jsonl + ~/.claude/history.jsonl (READ-ONLY) → session digests.
  2. Mine — digests → TaskRecords (recurring intents + outcome labels + checkable refs where possible).
  3. Replay — re-run tasks offline under the current skill+memory → (hard, soft) scores.
  4. Consolidate — reflect on failures → propose bounded edits → gate on a held-out slice; accept only if it strictly improves.
  5. Stage — write proposed_CLAUDE.md, proposed_SKILL.md, a diff, and report.md into <project>/.skillopt-sleep/staging/<date>/. Nothing live changes.
  6. Adopt — explicit (or opt-in auto): copy staged files over live ones, backing up first.

How to drive it

Prefer the /skillopt-sleep command. Under the hood it calls the bundled runner:

bash
"${CLAUDE_PLUGIN_ROOT}/scripts/sleep.sh" status                       # what's happened
"${CLAUDE_PLUGIN_ROOT}/scripts/sleep.sh" dry-run --project "$(pwd)"    # safe preview
"${CLAUDE_PLUGIN_ROOT}/scripts/sleep.sh" run --project "$(pwd)"        # full cycle, stages a proposal
"${CLAUDE_PLUGIN_ROOT}/scripts/sleep.sh" adopt --project "$(pwd)"      # apply staged proposal (with backup)
  • Default backend is mock (deterministic, no API spend) — good for trying the plumbing.
  • Add --backend claude or --backend codex to spend the user's real budget for genuine improvement.
  • Scope defaults to the invoked project; --scope all harvests every project.
Scheduling
bash
"${CLAUDE_PLUGIN_ROOT}/scripts/sleep.sh" schedule --project "$(pwd)" --hour 3 --minute 17
"${CLAUDE_PLUGIN_ROOT}/scripts/sleep.sh" unschedule --project "$(pwd)"

Installs a nightly cron entry. unschedule --all removes every managed entry.

All CLI flags

FlagDefaultDescription
--project PATHcwdProject directory to evolve
--scope all|invokedinvokedHarvest scope
--backend mock|claude|codex|copilotmockReplay backend (mock = no API spend)
--model NAMEbackend defaultOverride the model used for replay
--source claude|codex|autoclaudeTranscript source
--lookback-hours N72Harvest window
--max-sessions NunlimitedCap harvested sessions
--max-tasks N40Cap mined tasks
--target-skill-path PATHautoExplicit SKILL.md to evolve
--tasks-file PATH—Reviewed TaskRecord JSON (skip harvest)
--progressoffPrint phase progress to stderr
--auto-adoptoffAuto-adopt if gate passes
--edit-budget N4Max bounded edits per night
--jsonoffMachine-readable JSON output
Show full SKILL.md (245 more words)Show less

Config keys (~/.skillopt-sleep/config.json)

Beyond the CLI flags, advanced behavior is controlled via config:

  • preferences — free-text house rules injected into the optimizer's reflect step (e.g. "Always use async/await", "Answers in \boxed{}").
  • gate_mode — on (default, validation-gated) or off (greedy, accept all edits).
  • gate_metric — hard, soft, or mixed (default). Controls how the held-out gate scores.
  • dream_rollouts — >1 enables multi-rollout contrastive reflection per task.
  • recall_k — >0 recalls K similar past tasks into the dream (long-term memory).
  • evolve_memory / evolve_skill — independently toggle CLAUDE.md vs SKILL.md consolidation.

Memory consolidation

The sleep cycle can consolidate both:

  • SKILL.md — the managed skill file (bounded edits: add/delete/replace)
  • CLAUDE.md — the project memory (same bounded edits)

Both are gated by the same held-out validation score. Set evolve_memory: false to consolidate only skills, or evolve_skill: false for only memory.

Hard rules

  • Never hand-edit the user's CLAUDE.md / SKILL.md as part of this skill. Only the adopt action changes live files, and it backs them up first.
  • Harvest is read-only. mock replay has no side effects.
  • Always show the user the held-out baseline → candidate score and the exact proposed edits before suggesting adoption. Evidence before adoption.
  • If asked whether it really helps, run python -m skillopt_sleep.experiments.run_experiment --persona researcher --json — a deterministic demo that proves held-out lift and that the gate blocks harmful edits.

Validate / demo

bash
# deterministic proof (no API): held-out score rises, gate blocks regressions
python -m skillopt_sleep.experiments.run_experiment --persona researcher --assert-improves
python -m skillopt_sleep.experiments.run_experiment --persona programmer  --assert-improves

See the upstream SkillOpt-Sleep guide section (https://microsoft.github.io/SkillOpt/docs/guideline.html#sleep) for recorded output and the full design. (The original repo-relative design-doc path, docs/superpowers/specs/..., is not vendored into this repo — see this skill's README.md "What was and wasn't vendored" table.)

© alirezarezvani, 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 engineering/skillopt-sleep/skills/skillopt-sleep of alirezarezvani/claude-skills.

Open the folder on GitHubat commit 19392f7

Compare with similar skills

Skillopt Sleep 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 compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Skillopt Sleep this skillalirezarezvani/claude-skills28k—~1.8kAutomated safety check: PassMIT
SkillOpt Sleep Cyclemicrosoft/SkillOpt18k—~2.3kAutomated safety check: PassMIT
Self ImprovementCraftOS-dev/CraftBot3925 repos~4.9kAutomated safety check: PassMIT
Wp Plugin Developmentgambitph/Stackable3503 repos~999Automated safety check: PassGPL-3.0
Self Improvementpskoett/pskoett-ai-skills311—~5kAutomated safety check: PassNone
Harness 24hthu-nmrc/OpenHarness116—~3.6kAutomated safety check: PassApache-2.0

Similar skills

  • 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 2 days ago
    Agent WorkflowsAuto-check passed
  • Self Improvement

    CraftOS-dev/CraftBot

    Captures learnings, errors, and corrections to enable continuous improvement.

    392 GitHub starsUsed in 5 repos~4.9k tokens
    Agent WorkflowsAuto-check passed
  • Wp Plugin Development

    gambitph/Stackable

    A skill your agent uses when developing WordPress plugins: architecture and hooks, activation/deactivation/uninstall, admin UI and Settings API, data storage, cron/tasks, security…

    350 GitHub starsUsed in 3 repos~999 tokens
    Agent WorkflowsAuto-check passed
  • Self Improvement

    pskoett/pskoett-ai-skills

    Captures learnings, errors, corrections, and feature requests to enable continuous improvement.

    311 GitHub stars~5k tokensUpdated 3 days ago
    Agent WorkflowsAuto-check passed
  • Harness 24h

    thu-nmrc/OpenHarness

    A production-grade framework for long-running, autonomous agents based on Harness Engineering principles.

    116 GitHub stars~3.6k tokensUpdated 6 mo ago
    Agent WorkflowsAuto-check passed
  • Self Improvement

    pskoett/pskoett-ai-skills

    Captures learnings, errors, corrections, and feature requests to enable continuous improvement.

    311 GitHub stars~5.4k tokensUpdated 3 days ago
    Agent WorkflowsAuto-check passed

More from alirezarezvani/claude-skills

All 342 skills in this repo
  • Agile Product Owner

    alirezarezvani/claude-skills

    Writes INVEST-checked user stories with acceptance criteria, splits epics, plans sprints from velocity and ranks the backlog with a weighted score.

    28k GitHub starsUsed in 3 repos~3.2k tokens
    Auto-check passed
  • Product Strategist

    alirezarezvani/claude-skills

    OKR cascade toolkit for product leaders: generates aligned company-to-team OKRs from five strategy types and scores how well they line up.

    28k GitHub starsUsed in 2 repos~1.8k tokens
    Auto-check passed
  • App Store Optimization

    alirezarezvani/claude-skills

    App Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store.

    28k GitHub starsUsed in 1 repo~4.2k tokens
    Auto-check passed
  • AWS Solution Architect

    alirezarezvani/claude-skills

    Design AWS architectures for startups using serverless patterns and IaC templates.

    28k GitHub starsUsed in 1 repo~2.5k tokens
    Auto-check passed
  • Campaign Analytics

    alirezarezvani/claude-skills

    Calculates attribution, funnel and ROI figures for marketing campaigns with three Python scripts that need only the standard library.

    28k GitHub starsUsed in 1 repo~2.1k tokens
    Auto-check passed
  • Code to PRD

    alirezarezvani/claude-skills

    Reverse-engineers a frontend, backend or fullstack codebase into a product requirements document with per-page docs, an enum dictionary and an API inventory.

    28k GitHub starsUsed in 1 repo~4.9k tokens
    Auto-check passed

Questions about Skillopt Sleep

What does Skillopt Sleep do?

A skill your agent uses when the user wants their Claude agent to self-improve from past usage, asks about a nightly/offline 'sleep' or 'dream' cycle, memory/skill consolidation, or says things like…. Skillopt Sleep is an agent skill from alirezarezvani/claude-skills. Use when the user wants their Claude agent to self-improve from past usage, asks about a nightly/offline 'sleep' or 'dream' cycle, memory/skill 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 offline self-optimization.

When should I use Skillopt Sleep?

Skillopt Sleep fits situations like: the user wants their Claude agent to self-improve from past usage; asks about a nightly/offline sleep; memory/skill consolidation; says things like make my agent better the more I use it.

How do I install Skillopt Sleep in Claude Code?

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

How do I install Skillopt Sleep in Codex?

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

Can I use Skillopt Sleep 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 alirezarezvani/claude-skills --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 need to run?

Going by SKILL.md and its folder, Skillopt Sleep needs the command-line tools its instructions call (python). Our summary lists: Python 3.

Does Skillopt Sleep access the network?

SKILL.md names 1 domain. As links in the text: microsoft.github.io. This is read from the text; nothing was executed.

Is Skillopt Sleep 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 use?

Skillopt Sleep 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 use?

About 1.8k tokens (SKILL.md is roughly 7.2k 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?

Skills that share tags, products or a category with Skillopt Sleep: SkillOpt Sleep Cycle (microsoft/SkillOpt, 18k stars), Self Improvement (CraftOS-dev/CraftBot, 392 stars), Wp Plugin Development (gambitph/Stackable, 350 stars) and Self Improvement (pskoett/pskoett-ai-skills, 311 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Skillopt Sleep?

alirezarezvani (a GitHub user) maintains it in alirezarezvani/claude-skills, which has 27,829 GitHub stars. The repository holds 342 skills in this directory. The repository was last updated on August 30, 2026.

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