Sleep-cycle memory for agents: capture while awake, distill while asleep Sleep, a new memory system for coding agents, adds a reviewable memory cycle to Pi, OmO and Claude Code that captures observations during a session, consolidates them into provisional memory afterward, and requires explicit human approval before any memory becomes permanent. The tool ships as the npm package pi-sleep-agent (version 0.1.0) and requires Python 3.10 or newer plus the Claude Code CLI for model-backed consolidation and replay; its installer runs the test suite first and creates backups before configuration changes. Sleep redacts secrets, quarantines hostile text, and blocks machine-generated prompts from claiming user provenance, with a nightly pass that mines repeated preferences without a model call and measures memory effects by replaying the same task with memory off and on. Give your coding agents useful memory without giving memory control. Capture while agents work. Consolidate when they stop. Promote only what you approve. Sleep adds a reviewable memory cycle to Pi, OmO, and Claude Code. It records useful observations during a session, turns them into provisional memory after the session, and keeps permanent memory behind an explicit human approval step. - Automatic capture. Hooks and the Pi extension collect useful observations while you work. - Budgeted consolidation. Sleep runs only after the record and time gates pass. - Review before permanence. New memories stay provisional until you promote or refuse them. - Nightly dream cycle. Mine repeated preferences, consolidate recent observations, and measure memory effects while you are away. - Measured replay. Run the same task with memory off and on before deciding whether a memory helps. - Repeated preference detection. mine finds instructions you gave in multiple sessions without a model call. - Project isolation. A project's provisional memory is injected only into that project. - Safety gates. Secrets are redacted, hostile text is quarantined, and machine-generated prompts cannot claim user provenance. Requirements: - Python 3.10 or newer - Claude Code CLI for model-backed consolidation and replay - Pi, OmO, Claude Code, or any combination of them ./install.sh --dry-run show every change without writing ./install.sh install the shared skill and Claude Code hooks ./install.sh --extension also install the Pi/OmO extension ./install.sh --launchd also schedule the nightly pass on macOS The installer runs the test suite first, creates backups before configuration changes, and is safe to run again. Pi and OmO require Sleep's user-installed extension for automatic integration: ./install.sh --extension The installer links this repository's extension/ directory to: ~/.omo/agent/extensions/sleep The extension loads on the next Pi or OmO session and performs three jobs: - captures user messages and relevant tool activity into T0, - injects matching T1 provisional memory into the agent context, - wakes the sleep policy after the agent settles. Verify that it loaded: omo -p 'hi' /dev/null 2 &1 tail -4 ~/.sleep/logs/extension.log The log should contain session start , publish , and agent settled entries. Without this extension, the Sleep CLI still works when you run commands manually, and Claude Code can still use its own hooks. Pi and OmO, however, will not capture sessions, inject provisional memory, or trigger sleep automatically. Sleep also ships as the npm package pi-sleep-agent , so Pi and OmO can use the extension without cloning the repository. Install it through the pi install package flow: pi install npm:pi-sleep-agent or, for a specific published version pi install npm:pi-sleep-agent@0.1.0 The package contains the extension pi.extensions , the Sleep skill pi.skills , and the Python runtime behind it, so the CLI works from the installed package too. Pi manages the package under its own directory; do not guess that path. The extension resolves its own runtime from the package and records it in the log, so the verification below proves it loaded the installed copy rather than a checkout: omo -p 'hi' /dev/null 2 &1 tail -4 ~/.sleep/logs/extension.log session start, publish, agent settled Those three log lines are the proof that the packaged extension loaded and its Python runtime ran. If they do not appear, reload the extension pi install it again, or restart the session ; do not dig under the package directory and guess a path. Verify the tarball contract locally without publishing: npm run pack:check what npm pack would ship, as JSON npm run smoke:package install the tarball into an isolated Pi home and prove it loads To remove Sleep and restore the backed-up configuration: ./uninstall.sh Check the installation: ./sleep.py status -v ./sleep.py doctor ./sleep.py sleep --dry-run Capture a useful observation manually when needed: ./sleep.py capture --text "The staging gateway requires X-Route: blue." --kind fact --source user Run a consolidation pass: ./sleep.py sleep --dry-run ./sleep.py sleep --force Review the resulting candidate before making it permanent: ./sleep.py status -v ./sleep.py show