SkillOpt-Sleep
Gives your local Codex agent a 'sleep cycle': it reviews past sessions offline, replays recurring tasks, and adopts skill and memory edits only when a held-out validation score improves — no model-weight training.
Same as above, the Codex platform adaptation, with the same self-modification-plus-validation-gate design.
What does this skill do, and when should you use it?
SkillOpt-Sleep is a skill in Microsoft's SkillOpt repository that provides nightly or on-demand offline self-evolution for frozen LLM agents. It runs a seven-stage cycle — harvest, mine, replay, consolidate, gate, stage, adopt: reading local session transcripts, distilling recurring tasks, replaying them through a selected backend, and proposing bounded edits to a target skill file and the project's CLAUDE.md. With the default validation gate enabled, changes are accepted only when the held-out validation score improves; live files change only through explicit adoption or an explicitly requested --auto-adopt. It trains no model weights — the deployed artifact is a plain-text skill document.
Reads Codex archived sessions from ~/.codex/archived_sessions (harvest is read-only); mines digests into recurring TaskRecords with outcomes and checkable references; replays tasks through one of six backends (mock, claude, codex, copilot, handoff, azure_openai); reflects on failures and proposes bounded edits; gates them on held-out validation improvement; writes proposals to <project>/.skillopt-sleep/staging/<date>/; and overwrites live files only on explicit adopt (which backs up existing targets first). Supports status/harvest/dry-run/run/adopt/schedule/unschedule actions, flags like --edit-budget, --lookback-hours, --auto-adopt and --, and crontab-based scheduling.
- A developer who uses Codex heavily every day and wants the agent to keep learning from its own past sessions
- A team wanting unattended overnight self-optimization via a scheduled 3 a.m. run
- A user who wants data-driven improvements to their project skill file (.agents/skills/<name>/SKILL.md) but requires every change to pass a validation gate first
- A cost-conscious user testing the waters with the deterministic, zero-API-cost mock backend and dry-run
- A user maintaining project conventions in CLAUDE.md who wants session feedback consolidated into that memory file
What are this skill's strengths and limitations?
- Default validation gate keeps only edits that genuinely improve held-out scores — weight-training discipline with zero inference-time overhead
- Stage-only by default with backup-on-adopt gives a clear safety boundary
- Deterministic mock backend costs nothing and enables safe smoke tests
- Six backends, cross-platform runners (Linux/macOS shell, CMD/PowerShell), and crontab scheduling
- Harvest is read-only, with pattern-based redaction of secret-shaped strings, developer instructions, and raw tool payloads
- A passed gate is run-specific evidence only — no guarantee of broader improvement for other skills, tasks, or models
- Redaction is pattern-based and not a guarantee; real backends still send truncated transcript content to their provider, so data-boundary-sensitive users must be careful
- The shared engine does not write AGENTS.md, and the scheduler does not persist --source or --target-skill-path, requiring manual config. edits
- On systems without crontab, schedule just prints a line for manual installation
- The 0.00→1.00 result comes from a single recorded run on one fixture (brief-writer gbrain) — limited evidence
How do you install this skill?
This skill lives in the microsoft/SkillOpt repository (MIT license) at plugins/codex/skills/skillopt-sleep/SKILL.md. The repo ships as the skillopt package on PyPI as of v0.2.0 (pip install skillopt), but this sleep skill is invoked via the in-repo runner (bash plugins/run-sleep.sh). Clone the repository and set SKILLOPT_SLEEP_REPO to its path; Python >= 3.10 is located automatically by the runner. The exact steps for installing the skill into a Codex client for scheduled use are not detailed in the source.
How do you use this skill?
1) export SKILLOPT_SLEEP_REPO=/path/to/SkillOpt and pick a target, e.g. TARGET_SKILL=.agents/skills/example/SKILL.md (Codex skills require --target-skill-path explicitly). 2) Smoke test first: bash "$SKILLOPT_SLEEP_REPO/plugins/run-sleep.sh" dry-run --project "$(pwd)" --source codex --target-skill-path "$TARGET_SKILL" --backend mock. 3) Real run: switch to --backend codex and optionally add --max-sessions, --max-tasks, --progress. 4) Review the staged report.md, then adopt explicitly. 5) Nightly scheduling: schedule --backend codex --hour 3 --minute 17 (after setting transcript_source and an absolute target_skill_path in ~/.skillopt-sleep/config.). Windows runners exist (run-sleep.cmd / run-sleep.ps1).
How does this skill compare with similar options?
Within the same repository, SkillOpt's main training loop (rollout→reflect→aggregate→select→update→evaluate) treats the skill document as trainable state and produces best_skill.md; SkillOpt-Sleep is its nightly offline self-evolution variant, distinguished by session harvesting and a validation-gated nightly pipeline. Compared with hand-maintaining skill files or one-shot LLM skill generation, Sleep requires edits to pass a held-out validation gate.