What does this skill do, and when should you use it?
SkillOpt-Sleep is one of the skills bundled in Microsoft's SkillOpt repository (at plugins/codex/skills/skillopt-sleep/), providing on-demand or scheduled offline self-evolution for a local Codex agent. It harvests local session transcripts, mines recurring tasks, replays them through a selected backend, and proposes bounded edits to a configured skill file and the project's CLAUDE.md. With the default validation gate enabled, only changes that improve a held-out score are kept; live files change only through explicit adoption or a user-requested --auto-adopt. No model weights are trained — the deployable artifacts are plain SKILL.md and CLAUDE.md text.
- Harvests local Codex archived sessions (~/.codex/archived_sessions) and normalizes them into session digests
- Mines digests into recurring TaskRecords with outcomes and checkable references where possible
- Replays mined tasks through a selected backend (mock/claude/codex/copilot/handoff/azure_openai)
- Reflects on failures, proposes bounded edits, and accepts them only when the held-out validation score improves
- Stages proposals under .skillopt-sleep/staging/<date>/ and copies staged files over live files (with backups) only on explicit adoption
- Supports schedule/unschedule plus flags like --auto-adopt and --edit-budget
- A developer who wants their Codex agent to get better over time by learning task patterns and preferences from past sessions
- A user who wants a nightly, scheduled self-optimization run that doesn't consume daytime working hours
- A team that wants recurring task feedback consolidated into project memory (CLAUDE.md) or a specific SKILL.md
- A cautious adopter who wants a zero-cost mock dry-run first and reviews staged proposals before any real optimization
- An operator on a system without crontab who needs a manually installable schedule entry
- Users who can't let session content be sent to an external model provider — even with pattern-based redaction, real backends still send truncated transcript/task content to their provider
- Users who want AGENTS.md updated automatically — the current engine explicitly does not write AGENTS.md; Codex-visible results require an explicit --target-skill-path
- Pure cloud environments without Python >= 3.10 or local session archives
How do you install this skill?
- Shell / CLI
- Network access
- Local filesystem
Python >= 3.10SkillOpt repository (SKILLOPT_SLEEP_REPO)crontab or manual schedule line
The skill ships as part of the SkillOpt repository (MIT license); there is no separate install beyond cloning the repo and having Python >= 3.10.
Codex / Claude Code (local agents)
git clone https://github.com/microsoft/SkillOpt.git
export SKILLOPT_SLEEP_REPO=/path/to/SkillOpt
bash "$SKILLOPT_SLEEP_REPO/plugins/run-sleep.sh" status --project "$(pwd)"Windows (CMD)
set SKILLOPT_SLEEP_REPO=C:\path\to\SkillOpt
"%SKILLOPT_SLEEP_REPO%\plugins\run-sleep.cmd" status --project "%CD%"Windows (PowerShell)
$env:SKILLOPT_SLEEP_REPO = "C:\path\to\SkillOpt"
powershell -File "$env:SKILLOPT_SLEEP_REPO\plugins\run-sleep.ps1" status --project "$(pwd)"How do you use this skill?
Once installed, send your agent any of these to trigger it:
- Review my Codex sessions from the past week, find recurring tasks, and consolidate the learned preferences into my skill
- Run a SkillOpt-Sleep dry-run for this project with the mock backend, targeting .agents/skills/example/SKILL.md
- Schedule a nightly sleep self-optimization run at 3am using the codex backend, keeping only validation-gated changes
- Show me the staged proposal report from the last sleep run, and adopt it if it looks good
Drive it through the bundled shell runner; actions are status, harvest, dry-run, run, adopt, schedule, and unschedule. Always keep dry-run --backend mock as the first smoke check (deterministic, no API spend). A Codex skill target requires an explicit --target-skill-path; without it the shared default is a Claude-managed skill under ~/.claude/skills/. Set evolve_memory to false in ~/.skillopt-sleep/config. if CLAUDE.md should not be a secondary target.
export SKILLOPT_SLEEP_REPO=/path/to/SkillOpt
TARGET_SKILL=.agents/skills/example/SKILL.md
bash "$SKILLOPT_SLEEP_REPO/plugins/run-sleep.sh" dry-run --project "$(pwd)" \
--source codex --target-skill-path "$TARGET_SKILL" --backend mock
bash "$SKILLOPT_SLEEP_REPO/plugins/run-sleep.sh" run --project "$(pwd)" \
--source codex --target-skill-path "$TARGET_SKILL" --backend codex \
--max-sessions 5 --max-tasks 3 --progress
bash "$SKILLOPT_SLEEP_REPO/plugins/run-sleep.sh" adopt --project "$(pwd)"For scheduled runs:
bash "$SKILLOPT_SLEEP_REPO/plugins/run-sleep.sh" schedule --project "$(pwd)" \
--backend codex --hour 3 --minute 17The scheduler persists project, backend, time, and optional auto-adopt, but not --source/--target-skill-path; set transcript_source and an absolute target_skill_path in config. before scheduling Codex-targeted runs. Notable flags: --auto-adopt (adopt when the gate passes), --edit-budget N (max bounded edits per night, default 4), --lookback-hours N (harvest window, default 72), -- (machine-readable output).
What are this skill's strengths and limitations?
- Default validation gate keeps only changes that improve a held-out score; edits land in staging first and adoption is explicit with backups — a clear safety boundary
- mock backend is deterministic and spends no API budget, enabling free smoke tests; harvesting is read-only with pattern-based redaction
- Multiple backends (mock/claude/codex/copilot/handoff/azure_openai), scheduling, -- output, and cross-platform runner scripts
- An accepted held-out gain is run-specific evidence, not a guarantee for other skills, tasks, or models; the cited benchmark (brief-writer 0.00→1.00) applies to that specific configuration
- Pattern-based redaction is not a guarantee — real backends send truncated transcript/task content to their provider, so sensitive sessions need review
- Does not write AGENTS.md; Codex targets require a manual --target-skill-path and the scheduler doesn't persist that path, requiring extra config. setup
- Requires local Python >= 3.10 and local session archives; unavailable in pure-API, no-shell environments
How does this skill compare with similar options?
Side by side with related skills; every score comes from the same FSRS standard.
| Skill | FS score | Stars | Last updated | License |
|---|---|---|---|---|
| SkillOpt-Sleep this page ✓ Microsoft · Official | 64 · Recommended | ★ 18k | 19d ago | MIT |
| SkillOpt-Sleep: Sleep-Cycle Self-Improvement for Your Local Claude Agent ✓ Microsoft · Official | 64 · Recommended | ★ 18k | 19d ago | MIT |
| Obsidian Knowledge Brain v4.0 | 56 · Use with care | ★ 100 | 3mo ago | MIT |
| Engram Persistent Memory Protocol | 68 · Recommended | ★ 7.2k | 11d ago | MIT |
| Vibe Replay | 56 · Use with care | ★ 38 | 11d ago | MIT |
Compared with SkillOpt's main training loop (rollout → reflect → aggregate → select → update → evaluate, producing best_skill.md from fixed benchmark datasets), SkillOpt-Sleep targets a local agent's day-to-day usage data: it harvests tasks from historical sessions, runs as an offline 'sleep cycle', and applies the same held-out validation gate. Both edit skill text only, never model weights.
How did FollowSkills review this skill?
Same as above, the Codex platform adaptation, with the same self-modification-plus-validation-gate design.
Open a dimension to read why it scored that way
Evidence confidence:Low — Mostly static review, author material or a limited demo; useful for discovery, not high-risk decisions.
This review was completed under FSRS 1.0. Dimension scores are not converted; it is queued for re-review under FSRS 2.0.
See the full review method →