Skillopt Sleep logo

Skillopt Sleep

OrganizationPopular
microsoft
skillopt-sleep

Use when the user wants Codex to self-improve from past usage, asks about a nightly/offline 'sleep' or 'dream' cycle, wants Codex to review past sessions, learn preferences, consolidate memory/skills, run dry-run/run/adopt/status for SkillOpt-Sleep, or schedule background self-optimization. Drives the skillopt_sleep engine: harvest past sessions -> mine recurring tasks -> replay through a selected backend -> consolidate validated memory + skills behind a held-out gate.

Overview

Publishermicrosoft
RepositorySkillOpt
Skill nameskillopt-sleep
Stars
17.2K
Forks
1.6K
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by microsoft on GitHub. Read the source before you install it.

Installation

Install the Skillopt Sleep AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/microsoft/SkillOpt.git /tmp/SkillOpt
mkdir -p .claude/skills
cp -r /tmp/SkillOpt/plugins/codex/skills/skillopt-sleep .claude/skills/skillopt-sleep
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Skillopt Sleep in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Skillopt Sleep on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Skillopt Sleep is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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

SkillOpt-Sleep gives the user's Codex agent a sleep cycle. On demand or on a nightly schedule, it reviews past local sessions, re-runs recurring tasks through the selected backend, and proposes changes to a configured skill and to the project's CLAUDE.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. There is no model-weight training.

The current shared engine does not write AGENTS.md. For a Codex-visible result, always select a Codex skill explicitly with --target-skill-path (for example .agents/skills/<name>/SKILL.md). If project CLAUDE.md is not a desired secondary target, set "evolve_memory": false in ~/.skillopt-sleep/config.json before running.

When to use

Trigger when the user wants any of:

  • Codex to learn from past sessions or get better the more they use it;
  • a nightly/scheduled or on-demand sleep/dream/offline self-improvement run;
  • to review past sessions and distill recurring tasks;
  • to consolidate feedback into memory or managed skills;
  • to run status, harvest, dry-run, run, or adopt for SkillOpt-Sleep.

The cycle

  1. Harvest - read local session transcripts according to the engine configuration and normalize them into session digests.
  2. Mine - turn digests into recurring TaskRecords with outcomes and checkable references where possible.
  3. Replay - re-run mined tasks through the selected backend under the current skill and memory.
  4. Consolidate - reflect on failures and propose bounded edits.
  5. Gate - with the default gate enabled, accept edits only when the held-out validation score improves.
  6. Stage - write the proposal under <project>/.skillopt-sleep/staging/<date>/; nothing live changes.
  7. Adopt - explicitly, or through user-requested auto-adopt, copy staged files over live files with backups for existing targets.

How to drive it

Invoke the bundled runner via shell (Codex exec has shell access). The runner finds the engine and a Python >= 3.10 automatically.

bash
# point at the repo if it isn't auto-detected from CWD:
export SKILLOPT_SLEEP_REPO=/path/to/SkillOpt
TARGET_SKILL=.agents/skills/example/SKILL.md
bash "$SKILLOPT_SLEEP_REPO/plugins/run-sleep.sh" status --project "$(pwd)"
bash "$SKILLOPT_SLEEP_REPO/plugins/run-sleep.sh" harvest --project "$(pwd)" \
  --source codex --target-skill-path "$TARGET_SKILL"
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" status --project "$(pwd)"
bash "$SKILLOPT_SLEEP_REPO/plugins/run-sleep.sh" adopt --project "$(pwd)" --legacy

For a fan-out night, select reviewed proposals with repeatable --skill NAME or --all-skills; do not treat bare adopt as “adopt everything.”

On Windows (CMD / PowerShell):

cmd
:: CMD
set SKILLOPT_SLEEP_REPO=C:\path\to\SkillOpt-Sleep
"%SKILLOPT_SLEEP_REPO%\plugins\run-sleep.cmd" status --project "%CD%"
powershell
# PowerShell
$env:SKILLOPT_SLEEP_REPO = "C:\path\to\SkillOpt-Sleep"
powershell -File "$env:SKILLOPT_SLEEP_REPO\plugins\run-sleep.ps1" status --project "$(pwd)"

Actions are status, harvest, dry-run, run, adopt, schedule, and unschedule.

  • Default backend is mock, which is deterministic and spends no API budget.
  • --backend codex uses the user's Codex budget for model-driven optimization. An accepted held-out gain is run-specific evidence, not a guarantee of broader improvement; results depend on the tasks, model, and checks.
  • --source codex reads Codex Desktop archived sessions from ~/.codex/archived_sessions; use --codex-home /path/to/.codex if the archive lives elsewhere.
  • --target-skill-path is required for a Codex skill target. Without it, the shared default is a Claude-managed skill under ~/.claude/skills/, not an .agents skill.
  • Keep dry-run --backend mock as the first smoke check unless the user explicitly asked for a real optimization run.

Scheduling

bash
bash "$SKILLOPT_SLEEP_REPO/plugins/run-sleep.sh" schedule --project "$(pwd)" \
  --backend codex --hour 3 --minute 17
bash "$SKILLOPT_SLEEP_REPO/plugins/run-sleep.sh" unschedule --project "$(pwd)"

The scheduler persists the project, backend, time, and optional auto-adopt flag; it does not persist --source or --target-skill-path from this command. Before scheduling a Codex-targeted run, set "transcript_source": "codex" and an absolute "target_skill_path" in ~/.skillopt-sleep/config.json. On systems without crontab, schedule prints a line for manual installation. unschedule --all removes every managed entry.

All backends

  • --backend mock — deterministic, no API spend (default)
  • --backend claude — uses the Claude CLI
  • --backend codex — uses the Codex CLI
  • --backend copilot — uses the GitHub Copilot CLI
  • --backend handoff — emits prompt/answer files for an interactive session
  • --backend azure_openai — uses the configured Azure OpenAI endpoint

Additional flags

FlagDescription
--auto-adoptAuto-adopt if the gate passes (default: stage only)
--edit-budget NMax bounded edits per night (default: 4)
--lookback-hours NHarvest window in hours (default: 72)
--jsonMachine-readable JSON output

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

  • preferences — free-text house rules for the optimizer
  • gate_modeon (validation-gated, default) or off (greedy)
  • gate_metrichard | soft | mixed (default)
  • gate_no_regressionfalse by default; set it to true to reject a candidate when any validation task's gate score decreases
  • dream_rollouts — >1 for multi-rollout contrastive reflection
  • recall_k — >0 recalls similar past tasks from the archive

Memory consolidation

The shared sleep cycle consolidates project memory (CLAUDE.md) and the selected skill (SKILL.md) by default. It does not update AGENTS.md. Each target is independently toggleable through evolve_memory / evolve_skill, and both are gated by the same held-out validation score.

Steps

  1. Run the requested action; capture stdout.
  2. For dry-run and run, report the held-out baseline -> candidate score, gate action, task count, session count, and exact proposed edits.
  3. If a staging directory is printed, read report.md before summarizing.
  4. run stages by default; if --auto-adopt was explicitly supplied, report the paths it updated instead of claiming nothing changed.
  5. Offer adoption only after the user has reviewed a still-staged proposal.
  6. Never hand-edit the configured CLAUDE.md or target skill as a substitute for the engine's adopt path; adoption is the safety boundary and backs up existing targets first.

Hard rules

  • Harvest is read-only. Do not edit archived sessions or raw transcripts.
  • Codex transcript harvesting removes known secret-shaped strings, developer instructions, and raw tool payloads, but pattern-based redaction is not a guarantee. A real backend still sends truncated transcript/task content to its provider. Review sensitive sessions and provider policy first; prefer a reviewed --tasks-file workflow when the data boundary matters.
  • Keep raw secrets, credentials, private user data, and transcript contents out of messages, logs, generated artifacts, and commits.
  • Show validation evidence before recommending adoption.
  • Treat generated edits as proposals, not as source of truth.
  • Do not rely on deprecated custom prompts or /sleep slash commands for this Codex integration. This skill is the entrypoint.

Validate

bash
python -m skillopt_sleep dry-run --project "$(pwd)" --source codex \
  --target-skill-path .agents/skills/example/SKILL.md --backend mock --json
python -m skillopt_sleep.experiments.run_gbrain --backend codex \
  --seeds brief-writer --data-root /path/to/gbrain-evals/eval/data/skillopt-v1 \
  --nights 2 --limit-replay 3 --limit-holdout 3

In the recorded brief-writer gbrain run, the deliberately deficient fixture went 0.00 -> 1.00 on that run's held-out set. Treat this as reproducible benchmark evidence for that configuration, not a guarantee for other skills, tasks, or models; see the recorded results for context and limitations.

Frequently asked questions

What does the Skillopt Sleep AI skill do?

Use when the user wants Codex to self-improve from past usage, asks about a nightly/offline 'sleep' or 'dream' cycle, wants Codex to review past sessions, learn preferences, consolidate memory/skills, run dry-run/run/adopt/status for SkillOpt-Sleep, or schedule background self-optimization. Drives the skillopt_sleep engine: harvest past sessions -> mine recurring tasks -> replay through a selected backend -> consolidate validated memory + skills behind a held-out gate.

Why use Skillopt Sleep on TypingMind?

Because you install it once and use it with any model. Skillopt Sleep is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Skillopt Sleep in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/microsoft/SkillOpt/tree/main/plugins/codex/skills/skillopt-sleep. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Skillopt Sleep?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Skillopt Sleep?

As many as you like. As long as a model supports skills, you can use Skillopt Sleep with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Skillopt Sleep AI skill free?

Yes. It is published on GitHub by microsoft under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇