Dev & Engineering ✓ Microsoft · Official

SkillOpt-Sleep

Gives your local Codex agent a 'sleep cycle': offline review of past sessions that keeps only validation-gated improvements — no model-weight training involved.

64/ 100
Recommended

Generally reliable with disclosed limitations; trial as directed and keep a rollback path.

See how it was scored ↓
Works as-is in
Codex · Claude Code
Stars
★ 18k
Last updated
19d ago
License
MIT
self-improvementskill-optimizationsession-miningmemory-consolidation
+4nightly-schedulingvalidation-gatecodexcli-runner

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
Good fit
  • 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
Not a fit
  • 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?

Before you start
Your agent needs
  • Shell / CLI
  • Network access
  • Local filesystem
Install first
  • Python >= 3.10
  • SkillOpt 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?

Try saying

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 17

The 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?

Pros
  • 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
Limitations
  • 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?

FollowSkills review · FSRS-1.0
Recommended
64/ 100 5-point scale 3.2 / 5
1Utility14 / 20 · 3.5/5
2Reliability13 / 20 · 3.3/5
3Safety15 / 25 · 3.0/5

Same as above, the Codex platform adaptation, with the same self-modification-plus-validation-gate design.

4Evidence7 / 15 · 2.3/5
5Usability7 / 10 · 3.5/5
6Maintenance8 / 10 · 4.0/5
1 2 3 4 5 6

Open a dimension to read why it scored that way

Reviewed Jul 17, 2026 Review evidence[1]

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 →

FAQ

How much API cost does it incur?
The default backend is mock, which is deterministic and spends nothing; real spend happens only when you explicitly choose claude/codex/copilot/azure_openai backends, billed against those CLIs/endpoints.
Could it break my live files?
By default run only writes to a staging directory; live files are overwritten only via explicit adopt or an explicitly requested --auto-adopt that passes the gate, and existing targets are backed up first.
Is my session data safe?
Harvesting is read-only and strips known secret-shaped strings, developer instructions, and raw tool payloads from Codex transcripts, but the docs state this is not a guarantee — real backends still send truncated content to their provider; review sensitive sessions or use a --tasks-file workflow when the data boundary matters.
Which platforms does it work on?
The runner is invoked via shell, so any local agent with shell access, filesystem, and Python >= 3.10 (e.g., Codex, Claude Code) can drive it; a bare model API with no shell cannot run it directly.

More skills from this repository

All from microsoft/SkillOpt

Related skills