{"slug":"skillopt-sleep-5","title":"skillopt-sleep","summary":"Use when the user wants the dsh agent to self-improve from past usage, asks about a nightly/offline 'sleep' or 'dream' cycle, skill/memory consolidation, or says things like 'make my agent better the more I use it', 'review my past sessions', 'learn my preferences', 'consolidate ","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-09-30T16:42:59.67542Z","repo":{"url":"https://github.com/microsoft/SkillOpt","stars":17898,"forks":1683,"license":"MIT","updatedAt":"2026-09-30T11:22:44Z"},"bodyHtml":"<hr>\n<h2>name: skillopt-sleep\ndescription: \"Use when the user wants the dsh agent to self-improve from past usage, asks about a nightly/offline 'sleep' or 'dream' cycle, skill/memory consolidation, or says things like 'make my agent better the more I use it', 'review my past sessions', 'learn my preferences', 'consolidate what you learned', 'run the sleep cycle', or wants to schedule background self-optimization. Drives the skillopt_sleep engine through the skillopt_* tools: harvest past sessions -&gt; mine recurring tasks -&gt; replay via a selected backend -&gt; consolidate validated skills behind a held-out gate.\"</h2>\n<h1>SkillOpt-Sleep: usage-driven self-evolution for the dsh agent</h1>\n<p>SkillOpt-Sleep is Microsoft's <a href=\"https://github.com/microsoft/SkillOpt\">SkillOpt</a>\ndeployment-time companion engine: it reviews your past sessions (harvest), mines\nrecurring tasks (mine), replays them through a selected backend (replay), and\nconsolidates what it learns into skill documents behind a <strong>held-out validation\ngate</strong> (consolidate).</p>\n<p>This skill drives the engine through the 7 <code>skillopt_*</code> tools exposed by the\ndsh-skillopt plugin. The default <code>mock</code> backend makes no model calls, which is\nuseful for verifying the plumbing; a real backend consumes your API budget.</p>\n<h2>When to use</h2>\n<ul>\n<li>\"make my agent better the more I use it\" / \"learn my preferences across sessions\"</li>\n<li>a one-off <strong>offline self-evolution / sleep / dream</strong> run (immediate or scheduled)</li>\n<li>review past sessions/trajectories and distill recurring tasks</li>\n<li>consolidate feedback into <code>AGENTS.md</code> / <code>SKILL.md</code> / managed skills</li>\n<li>schedule (cron) the cycle, or adopt a staged proposal</li>\n</ul>\n<h2>The cycle (six stages)</h2>\n<ol>\n<li><strong>Harvest</strong> — read-only scan of supported local session records → digests</li>\n<li><strong>Mine</strong> — digests → recurring task records (intent + outcome labels + checkable refs)</li>\n<li><strong>Replay</strong> — re-run tasks under the current skill+memory with the selected backend → (hard, soft) scores</li>\n<li><strong>Consolidate</strong> — reflect on failures → propose bounded edits → <strong>validation gate</strong> on a held-out slice (default: accept only on strict improvement)</li>\n<li><strong>Stage</strong> — write accepted proposals to <code>&lt;project&gt;/.skillopt-sleep/staging/&lt;timestamp&gt;/</code>. <strong>Live files are unchanged.</strong> A rejected run still has a report but no proposal files.</li>\n<li><strong>Adopt</strong> — explicit (or operator-configured <code>--auto-adopt</code>) copies staged files over live ones, backing up first.</li>\n</ol>\n<h2>Driving it</h2>\n<p>Prefer the tools over hand-editing files:</p>\n<table>\n<thead>\n<tr>\n<th>Tool</th>\n<th>Behavior</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>skillopt_status</code></td>\n<td>state, engine availability, latest staged proposal &amp; report</td>\n</tr>\n<tr>\n<td><code>skillopt_dry_run</code></td>\n<td>full preview (harvest+mine+replay), stages nothing</td>\n</tr>\n<tr>\n<td><code>skillopt_run</code></td>\n<td>full cycle, stages a proposal (live files unchanged by default)</td>\n</tr>\n<tr>\n<td><code>skillopt_adopt</code></td>\n<td>apply latest staged proposal (with backup) — the live-change boundary</td>\n</tr>\n<tr>\n<td><code>skillopt_harvest</code></td>\n<td>read-only show/export of mined tasks</td>\n</tr>\n<tr>\n<td><code>skillopt_schedule</code> / <code>skillopt_unschedule</code></td>\n<td>install/remove the nightly cron entry for this project</td>\n</tr>\n</tbody>\n</table>\n<p>Typical flow:</p>\n<pre><code># 1. check state (default mock backend, zero cost)\nskillopt_status\n\n# 2. preview the cycle\nskillopt_dry_run project=&lt;dir&gt; source=&lt;claude|codex|…&gt;\n\n# 3. real run (consumes the selected backend's API budget)\nskillopt_run project=&lt;dir&gt; backend=&lt;codex|claude|…&gt; preferences=\"Prefer pytest; keep commits imperative.\"\n\n# 4. review the report, then adopt\nskillopt_adopt project=&lt;dir&gt;\n\n# 5. schedule nightly at 03:17\nskillopt_schedule project=&lt;dir&gt; hour=3 minute=17 backend=&lt;codex&gt;\n</code></pre>\n<h2>Parameters</h2>\n<table>\n<thead>\n<tr>\n<th>Parameter</th>\n<th>Default</th>\n<th>Meaning</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>project</code></td>\n<td>config or cwd</td>\n<td>project directory to evolve</td>\n</tr>\n<tr>\n<td><code>backend</code></td>\n<td><code>mock</code></td>\n<td><code>mock\\|claude\\|codex\\|copilot\\|cursor\\|pi\\|opencode\\|handoff\\|azure_openai</code> (mock = no model calls)</td>\n</tr>\n<tr>\n<td><code>source</code></td>\n<td>config</td>\n<td>transcript source: <code>claude\\|codex\\|copilot\\|cursor\\|pi\\|opencode\\|auto</code></td>\n</tr>\n<tr>\n<td><code>model</code></td>\n<td>backend default</td>\n<td>replay model override</td>\n</tr>\n<tr>\n<td><code>maxTasks</code></td>\n<td>40</td>\n<td>mined-task cap</td>\n</tr>\n<tr>\n<td><code>preferences</code></td>\n<td>empty</td>\n<td>house rules for the reflection prior (e.g. \"always use async/await\")</td>\n</tr>\n</tbody>\n</table>\n<h2>Configuration (cordis.yml / bundle patch)</h2>\n<pre><code>- insert:\n    - id: skillopt\n      name: './src/index.js'\n      config:\n        backend: codex\n        project: /path/to/project\n        preferences: 'Always use async/await'\n        # auto-adopt is OPERATOR-ONLY — the model cannot set it\n        autoAdopt: false\n</code></pre>\n<p>Advanced engine keys go in <code>~/.skillopt-sleep/config.json</code>:\n<code>gate_mode</code> (on/off), <code>gate_metric</code> (hard/soft/mixed), <code>gate_no_regression</code>,\n<code>dream_rollouts</code>, <code>recall_k</code>, <code>evolve_memory</code> / <code>evolve_skill</code>.</p>\n<h2>Hard rules</h2>\n<ul>\n<li><strong>Never</strong> hand-edit <code>AGENTS.md</code> / <code>SKILL.md</code> around <code>skillopt_adopt</code>; let the\nengine's explicit adopt (or operator-configured <code>--auto-adopt</code>) apply the\nstaging manifest, backing up live files first.</li>\n<li>Harvest is read-only; <code>mock</code> replay has no side effects.</li>\n<li>Real backends send truncated transcript excerpts and derived tasks to the\nselected provider for mining/replay/judging/reflection. For sensitive\nsessions, export tasks first (<code>skillopt_harvest output=&lt;file&gt;</code>), redact, set\nthe top-level <code>\"reviewed\"</code> to <code>true</code>, then replay with <code>--tasks-file</code>; real\nbackends refuse unreviewed task files.</li>\n<li>Show the user the <strong>held-out baseline → candidate</strong> score and the exact\nproposed edits before suggesting adoption. Evidence before adoption.</li>\n</ul>\n<h2>Validate / demo (no API spend)</h2>\n<pre><code>pip install skillopt\npython -m skillopt_sleep.experiments.run_experiment --persona researcher --assert-improves\n</code></pre>\n<p>Deterministic synthetic demo: the score rises and the gate blocks a regression.\nIt validates the mechanism, not effectiveness on your own tasks.</p>\n<p>See the <a href=\"https://github.com/microsoft/SkillOpt/tree/main/docs/sleep\">SkillOpt-Sleep docs</a>\nfor recorded results and limitations.</p>\n","files":[{"path":"SKILL.md","sizeBytes":5775,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-09-30T16:44:15.924856Z","sha256":"CED05F4080ADB375979A0AC9B8FA070F7514B502C31FA8D6E689CE6244B496CC","sizeBytes":2736},"review":null,"source":{"repositoryUrl":"https://github.com/microsoft/SkillOpt","path":"plugins/dsh/skills/skillopt-sleep","license":"MIT","commit":"f02c6fce16e958c185b57ebb66e241a8ab2a7b76","subtreeSha":"91B17FA5E5959077CB88FADBEA2D0F8CBF28709A9206AA67EA8F518C6D7EAD6F","lastSyncedAt":"2026-09-30T16:42:58.831078Z"},"reviewedAt":"2026-09-30T16:47:17.746894Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/microsoft/SkillOpt/tree/main/plugins/dsh/skills/skillopt-sleep"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install microsoft-skillopt@llmmart"},{"target":"git","command":"git clone https://github.com/microsoft/SkillOpt.git"}]}