skillopt-sleep

A sleep cycle reviews an agent's past coding sessions, repeats recurring tasks, and proposes updates to its memory files and skill instructions. It improves the agent's written guidance, not the model's underlying weights.

In plain words
What is it for?
Use it for scheduled or on-demand review of past work, testing proposed improvements, and consolidating accepted lessons into CLAUDE.md and SKILL.md.
Why use it?
It reduces the need to teach the same preferences and procedures repeatedly, while a validation check keeps changes that improve replay results.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/microsoft/skillopt/skillopt-sleep
Any agent
npx skills add microsoft/SkillOpt --skill skillopt-sleep
Clone the repo
git clone --depth 1 https://github.com/microsoft/SkillOpt

Made for: Claude Code, Codex.

Per session 127 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,209 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00127 $0.02209
Opus 5 $0.00063 $0.01104
Sonnet 5 $0.00025 $0.00442
Haiku 4.5 $0.00013 $0.00221

Measured 2d ago against content hash f8e6e40eb1ee, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

skillopt-sleep scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/claude-code/skills/skillopt-sleep/SKILL.md · 157 lines

How it starts

The opening of the file, as written. The whole thing — 157 lines — stays where its author put it; the contents beside it link to each section on GitHub.

SkillOpt-Sleep: usage-driven self-evolution for a local Claude agent

SkillOpt-Sleep gives the user's agent a sleep cycle. On demand or on a nightly schedule, it reviews real past Claude Code sessions, re-runs recurring tasks through the selected backend, and consolidates what it learns into memory (CLAUDE.md) and skills (SKILL.md). With the default validation gate enabled, it keeps only changes that improve a held-out score. Live files change only through explicit adoption or a user-requested --auto-adopt. It aims to improve this user's recurring work, while making each accepted proposal measurable on the run's held-out tasks, 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 are recorded in the run report for review.
  • Claude Dreams — consolidation that reads past sessions and proposes changes inside protected learned blocks; the input is never mutated, and output is reviewed before adoption.
  • Agent sleep — periodic background 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 through the selected backend under the current skill+memory → (hard, soft) scores.
  4. Consolidate — reflect on failures → propose bounded edits → gate on a held-out slice; with the default gate enabled, accept only if it strictly improves.
  5. Stage — write the accepted proposed_CLAUDE.md and/or proposed_SKILL.md, plus report.md, report.json, manifest.json, and diagnostics.json into <project>/.skillopt-sleep/staging/<timestamp>/. Nothing live changes. A rejected run still has a report but no proposed live-file replacement.
  6. Adopt — explicit (or opt-in auto): copy staged files over live ones, backing up first.

Read the full file on GitHub · 157 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 157 lines · 127 tokens per session scan A f8e6e40eb1ee

Subscribe to this mod's changes

skillopt-sleep is a skill published in the GitHub repository microsoft/SkillOpt (16,489 stars, last pushed 3d ago), licensed MIT. It adds 127 tokens to every session and 2,209 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

agent-coordination

Coordinate a deliberation across multiple AI agents (Claude, Gemini, Codex, Cursor, Antigravity, etc.) using a shared markdown log. Teaches Claude to read the full log before responding, append entries with the locked preface format, follow the phase model (Research → Converge → Stabilize → Action-List → Approval →…

bogdanbaciu21/skills · 187 tokens

quiz-me

Run an active-recall quiz on a topic, document, book chapter, codebase area, interview subject, meeting-prep topic, or study material the user wants to learn or retain. Use when the user says "quiz me", "test me on", "drill me on", "flashcard me", "ask me questions about", "help me study", "interview prep on", "I need…

bogdanbaciu21/skills · 145 tokens

article-writing

Write articles, guides, blog posts, tutorials, newsletter issues, and other long-form content in a distinctive voice derived from supplied examples or brand guidance. Use when the user wants polished written content longer than a paragraph, especially when voice consistency, structure, and credibility matter.

affaan-m/ECC · 57 tokens

a-evolve

Apply A-Evolve's agentic evolution methodology to improve AI agent performance across runs. Use when the user wants to diagnose agent failures, generate targeted skills from error patterns, evolve system prompts, or accumulate episodic knowledge. Works standalone or inside AutoResearchClaw pipelines. Triggers on…

aiming-lab/AutoResearchClaw · 100 tokens

hive.chart-creation-foundations

Required reading whenever any chart tool is available. Teaches the one-tool embedding contract (call chartrender → live chart appears in chat AND a downloadable PNG lands in the queen session dir), the ECharts (data viz) vs Mermaid (structural diagrams) decision, the BI/financial-grade aesthetic baseline (no…

aden-hive/hive · 133 tokens

📝 任务完成后归档

重要提醒: 每次完成复杂调试或开发任务后,主动执行此流程! 将学到的经验归档为 skill,供以后参考。不要等用户提醒。.

Project-N-E-K-O/N.E.K.O · 49 tokens