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 say
复制下面这句话,粘贴给 Claude Code、Codex、Cursor 等 AI 编程工具,它会读取安装说明并在你确认后完成安装。
请阅读 https://ai.atlankj.com/install/asset/gh-skillopt-sleep-52ef913edd88 ,按照其中的说明把「skillopt-sleep」安装到你(当前 AI 工具)中。执行前先告诉我将运行的命令和写入的位置,等我确认。
查看 AI 将读取的安装说明正在读取 GitHub 原文…
内容来自 GitHub 原始文件,由原作者维护。在 GitHub 查看
SkillOpt-Sleep is Microsoft's SkillOpt deployment-time companion engine: it reviews your past sessions (harvest), mines recurring tasks (mine), replays them through a selected backend (replay), and consolidates what it learns into skill documents behind a held-out validation gate (consolidate).
This skill drives the engine through the 7 skillopt_* tools exposed by the
dsh-skillopt plugin. The default mock backend makes no model calls, which is
useful for verifying the plumbing; a real backend consumes your API budget.
AGENTS.md / SKILL.md / managed skills<project>/.skillopt-sleep/staging/<timestamp>/. Live files are unchanged. A rejected run still has a report but no proposal files.--auto-adopt) copies staged files over live ones, backing up first.Prefer the tools over hand-editing files:
| Tool | Behavior |
|---|---|
skillopt_status | state, engine availability, latest staged proposal & report |
skillopt_dry_run | full preview (harvest+mine+replay), stages nothing |
skillopt_run | full cycle, stages a proposal (live files unchanged by default) |
skillopt_adopt | apply latest staged proposal (with backup) — the live-change boundary |
skillopt_harvest | read-only show/export of mined tasks |
skillopt_schedule / skillopt_unschedule | install/remove the nightly cron entry for this project |
Typical flow:
# 1. check state (default mock backend, zero cost)
skillopt_status
# 2. preview the cycle
skillopt_dry_run project=<dir> source=<claude|codex|…>
# 3. real run (consumes the selected backend's API budget)
skillopt_run project=<dir> backend=<codex|claude|…> preferences="Prefer pytest; keep commits imperative."
# 4. review the report, then adopt
skillopt_adopt project=<dir>
# 5. schedule nightly at 03:17
skillopt_schedule project=<dir> hour=3 minute=17 backend=<codex>
| Parameter | Default | Meaning |
|---|---|---|
project | config or cwd | project directory to evolve |
backend | mock | mock|claude|codex|copilot|cursor|pi|opencode|handoff|azure_openai (mock = no model calls) |
source | config | transcript source: claude|codex|copilot|cursor|pi|opencode|auto |
model | backend default | replay model override |
maxTasks | 40 | mined-task cap |
preferences | empty | house rules for the reflection prior (e.g. "always use async/await") |
- insert:
- id: skillopt
name: './src/index.js'
config:
backend: codex
project: /path/to/project
preferences: 'Always use async/await'
# auto-adopt is OPERATOR-ONLY — the model cannot set it
autoAdopt: false
Advanced engine keys go in ~/.skillopt-sleep/config.json:
gate_mode (on/off), gate_metric (hard/soft/mixed), gate_no_regression,
dream_rollouts, recall_k, evolve_memory / evolve_skill.
AGENTS.md / SKILL.md around skillopt_adopt; let the
engine's explicit adopt (or operator-configured --auto-adopt) apply the
staging manifest, backing up live files first.mock replay has no side effects.skillopt_harvest output=<file>), redact, set
the top-level "reviewed" to true, then replay with --tasks-file; real
backends refuse unreviewed task files.pip install skillopt
python -m skillopt_sleep.experiments.run_experiment --persona researcher --assert-improves
Deterministic synthetic demo: the score rises and the gate blocks a regression. It validates the mechanism, not effectiveness on your own tasks.
See the SkillOpt-Sleep docs for recorded results and limitations.