skillopt-sleep
它能做什么
在你离开时,它会审查你过去的 Claude Code 会话,重新运行周期性任务,并提出记忆和技能的更新建议,只有通过验证检查的更新才会被保留。适合希望智能体随时间学习自己偏好的人。
适用场景
- ✓当你希望智能体从过往会话中学习你的偏好时。
- ✓当你希望安排夜间或定时运行的自我改进时。
- ✓当你希望把过往会话审查并整合进记忆时。
技能链接
https://github.com/alirezarezvani/claude-skills/blob/main/engineering/skillopt-sleep/skills/skillopt-sleep/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请审查我过去的会话并学习我的偏好,这样我用得越多,我的智能体就会越好用。”
每周 5 个新技能,1 分钟读完。
工作原理
在你离开时,智能体重放周期性任务并审查你的会话。它会提出对记忆和技能文件的修改,并且在你批准后,只保留通过留出集检查的修改。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
SkillOpt-Sleep: offline self-evolution for a local Claude agent
SkillOpt-Sleep gives the user's agent a sleep cycle. While the user is
offline (e.g. nightly), it reviews their real past Claude Code sessions,
re-runs recurring tasks on their own API budget, and consolidates what it
learns into memory (CLAUDE.md) and skills (SKILL.md) — but only
keeps changes that pass a held-out validation gate, and only after the user
adopts them. The agent gets measurably better at this user's recurring work,
with no model-weight training. It is the deployment-time analogue of training:
short-term experience → long-term competence.
It synthesizes three ideas:
- SkillOpt — the skill/memory doc is trainable text; bounded add/delete/replace edits; accepted only through a held-out gate; rejected edits become negative feedback.
- Claude Dreams — offline consolidation that reads past sessions and rebuilds memory (dedup/merge/resolve); the input is never mutated; output is reviewed then adopted.
- Agent sleep — periodic offline replay turns episodes into durable skill.
When to use this skill
Trigger when the user wants any of:
- "make my agent learn from how I use it" / "get better the more I use it" / "remember my preferences across sessions"
- a nightly/scheduled or on-demand offline self-improvement / dream / sleep run
- to review past sessions/trajectories and distill recurring tasks
- to consolidate feedback into
CLAUDE.mdor a managed skill - to schedule the cycle (cron) or adopt a staged proposal
The cycle (six stages)
- Harvest — read
~/.claude/projects/*/<session>.jsonl+~/.claude/history.jsonl(READ-ONLY) → session digests. - Mine — digests →
TaskRecords (recurring intents + outcome labels + checkable refs where possible). - Replay — re-run tasks offline under the current skill+memory → (hard, soft) scores.
- Consolidate — reflect on failures → propose bounded edits → gate on a held-out slice; accept only if it strictly improves.
- Stage — write
proposed_CLAUDE.md,proposed_SKILL.md, a diff, andreport.mdinto<project>/.skillopt-sleep/staging/<date>/. Nothing live changes. - Adopt — explicit (or opt-in auto): copy staged files over live ones, backing up first.
How to drive it
Prefer the /skillopt-sleep command. Under the hood it calls the bundled runner:
"${CLAUDE_PLUGIN_ROOT}/scripts/sleep.sh" status # what's happened
"${CLAUDE_PLUGIN_ROOT}/scripts/sleep.sh" dry-run --project "$(pwd)" # safe preview
"${CLAUDE_PLUGIN_ROOT}/scripts/sleep.sh" run --project "$(pwd)" # full cycle, stages a proposal
"${CLAUDE_PLUGIN_ROOT}/scripts/sleep.sh" adopt --project "$(pwd)" # apply staged proposal (with backup)
- Default backend is
mock(deterministic, no API spend) — good for trying the plumbing. - Add
--backend claudeor--backend codexto spend the user's real budget for genuine improvement. - Scope defaults to the invoked project;
--scope allharvests every project.
Scheduling
"${CLAUDE_PLUGIN_ROOT}/scripts/sleep.sh" schedule --project "$(pwd)" --hour 3 --minute 17
"${CLAUDE_PLUGIN_ROOT}/scripts/sleep.sh" unschedule --project "$(pwd)"
Installs a nightly cron entry. unschedule --all removes every managed entry.
All CLI flags
| Flag | Default | Description |
|---|---|---|
--project PATH |
cwd | Project directory to evolve |
--scope all|invoked |
invoked | Harvest scope |
--backend mock|claude|codex|copilot |
mock | Replay backend (mock = no API spend) |
--model NAME |
backend default | Override the model used for replay |
--source claude|codex|auto |
claude | Transcript source |
--lookback-hours N |
72 | Harvest window |
--max-sessions N |
unlimited | Cap harvested sessions |
--max-tasks N |
40 | Cap mined tasks |
--target-skill-path PATH |
auto | Explicit SKILL.md to evolve |
--tasks-file PATH |
— | Reviewed TaskRecord JSON (skip harvest) |
--progress |
off | Print phase progress to stderr |
--auto-adopt |
off | Auto-adopt if gate passes |
--edit-budget N |
4 | Max bounded edits per night |
--json |
off | Machine-readable JSON output |
Config keys (~/.skillopt-sleep/config.json)
Beyond the CLI flags, advanced behavior is controlled via config:
preferences— free-text house rules injected into the optimizer's reflect step (e.g. "
常见问题
它会不经询问就修改我的文件吗?
不会。只有在通过验证检查并且你采纳之后,修改才会被保留。
它会训练 AI 模型吗?
不会。它改进的是记忆和技能文件中的文字,并不训练模型权重。
它会花钱吗?
可能会。重新运行任务会使用你自己的 API 额度。
详情
作者的原始描述
Use when the user wants their Claude agent to self-improve from past usage, asks about a nightly/offline 'sleep' or 'dream' cycle, memory/skill 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 offline self-optimization. Drives the skillopt_sleep engine: harvest past sessions → mine recurring tasks → replay offline → consolidate validated CLAUDE.md and SKILL.md behind a held-out gate.
热度
- GitHub 星标
- 29k
- 排名
- #9572
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
agent-launcher-orchestrator
29k帮你的智能体从一个清晰的目标出发,逐步规划、构建、测试并定时运行你自己账户中的 Claude 托管智能体。
grade-iterate
29k让你的智能体按评分标准为托管 AI 智能体的工作打分,并在固定的轮次内改进,因此它永远不会无限循环。
interview
29k让你的智能体就一个 AI 智能体的想法对你进行访谈,并在任何上线之前,把你的回答整理成一份简单的构建计划。
run-without-you
29k帮你的智能体设置托管 AI 智能体,使其按计划或在某个事件发生时运行,并在启动前检查定时设置。