SkillOpt-Sleep: offline self-evolution for a local Claude agent
SkillOpt-Sleep gives a local Claude agent an offline 'sleep cycle' that reviews past sessions, mines recurring tasks, replays them, and consolidates validated improvements into CLAUDE.md and SKILL.md, staged behind a held-out gate for user adoption. It produces staged proposals and reports, improving the agent's competence for the user's recurring work without model-weight training.
✨ What it does
- Harvests past Claude Code sessions read-only from ~/.claude/projects and history.
- Mines recurring tasks with outcome labels and checkable references.
- Replays tasks offline under current skill+memory, scoring hard/soft metrics.
- Consolidates failures into bounded edits to CLAUDE.md and SKILL.md, gated on a held-out slice.
- Stages proposals (proposed files, diff, report) without changing live files until adoption.
- Supports mock backend (no API spend) and real backends (claude, codex) with configurable flags.
🎯 When to use it
- User wants the agent to self-improve from past usage, e.g., 'make my agent better the more I use it'.
- User asks for a nightly or scheduled offline 'sleep' or 'dream' cycle to consolidate memory and skills.
- User wants to review past sessions and distill recurring tasks or preferences.
- User wants to schedule the cycle via cron or adopt a staged proposal.
🚀 How to use
Trigger: /skillopt-sleep
Trigger with the /skillopt-sleep command or a natural-language request like 'run the sleep cycle' or 'make my agent learn from my usage'. The skill runs a six-stage cycle (harvest, mine, replay, consolidate, stage, adopt). Inputs: project directory (default cwd), optional scope, backend (mock default, or claude/codex), and various flags for lookback, session caps, and edit budget. Example prompts:
/skillopt-sleep run --project /path/to/project --backend claude
"Run the sleep cycle for this project and stage a proposal."
📄 Output: Staged proposal files (proposed_CLAUDE.md, proposed_SKILL.md, diff, report.md) in <project>/.skillopt-sleep/staging/<date>/.
📦 Add this skill to Claude Code
# 1. Get the skills repo
git clone --depth 1 https://github.com/alirezarezvani/claude-skills /tmp/claude-skills
# 2. Copy this skill into your project (or ~/.claude/skills for all projects)
mkdir -p .claude/skills
cp -r /tmp/claude-skills/engineering/skillopt-sleep/skills/skillopt-sleep .claude/skills/skillopt-sleepSkill source: engineering/skillopt-sleep/skills/skillopt-sleep/SKILL.md
⚠️ Good to know
Requires the skillopt_sleep engine and scripts to be installed; live files are only changed via explicit adopt (or opt-in auto-adopt), and mock backend provides no real improvement.
❓ FAQ
Does the sleep cycle modify my CLAUDE.md or SKILL.md automatically?
No. The cycle only stages proposals; live files are changed only when you run the adopt action, which backs up first.
What is the default backend and does it cost API credits?
The default backend is 'mock', which is deterministic and uses no API spend. Use --backend claude or codex to spend real budget for genuine improvement.
How can I verify the skill actually helps?
Run the deterministic experiment: python -m skillopt_sleep.experiments.run_experiment --persona researcher --assert-improves (or programmer) to prove held-out lift and gate blocking.
🤖 Overview, features, install steps and FAQ were generated from the project's SKILL.md on Sep 4, 2026. Always check the original source before running commands.