Consolidates and audits the hippOS memory in Google Drive, the way sleep processes the day's memories. Use with /sleep [area] or $sleep [area], in a scheduled consolidation task, or when asked to organize, consolidate or check an area's memory.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Sleep?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/btrazzini-sleep)
---
name: sleep
description: Consolidates and audits the hippOS memory in Google Drive, the way sleep processes the day's memories. Use with /sleep [area] or $sleep [area], in a scheduled consolidation task, or when asked to organize, consolidate or check an area's memory.
model: opus
effort: medium
---
# hippOS sleep (v0.4.1)
Memory rules: `protocol.md` in this folder (read it in full). Validator: `memory.py` in this folder, with `lookup.py`.
Argument: none, the normal case (step 0 finds what to process), or an area or `core`, to limit itself to it.
`inbox/core/` is part of every sleep, with or without an argument, in a pass of its own, the last.
Sleep works in two phases and never skips the second.
## 0. Prepare
- Only with a shell (Claude Code, Codex); otherwise tell <name> and stop.
- Lock (one sleep at a time): `SLEEP-IN-PROGRESS.md` at the root with `started` under 60 minutes ago: another sleep runs; tell <name> and stop, touching nothing. Older: one got stuck; warn and go on. None: create it before any other step, frontmatter `type: lock`, `started: YYYY-MM-DDTHH:MM`, `origin`, `areas`.
- Local mode (preferred): if `python3 memory.py root` prints a path, work directly in it and use the Drive connector in no step.
- Connector mode (cloud, no local folder): build a local copy of the whole root ("Root" in the protocol; of `archive/`, only the folders) in `<work>/hippOS/`, listing every folder until the pages run out and reading with `download_file_content` (raw text). Save in `<work>/ids.json` the id of every folder and file, by path (`"hippOS/areas/<area>": "<id>"`).
- In the commands below, `<root>` is the local path or `<work>/hippOS`. `<work>` is `~/.cache/hippos-sleep/`, outside the repository and the skill (memory never stays in them); empty it at the start and delete it at the end (step 3.5): it holds a copy of the memory. In both modes, before changing anything, copy to `<work>/before/` the files the run will touch.
- No argument: `python3 memory.py pending <root>` says which areas to process and why. Process one at a time, core last; nothing pending: delete the lock, tell <name> and stop.
- `python3 memory.py validate <root> <area>`: note the errors that already existed before changing anything.
- Fix now the list of captures for this pass (the area's, or those in `inbox/core/` in the core pass, plus each file the validator says is outside the schema). A capture arriving during sleep waits for the next one; only those on the list leave the inbox at the end.
- Size of the run, decided by the list:
- **Light:** up to 3 captures, no decision, no `mode: forget`, no change of initiative state, no format error to fix (step 2.1), no file outside the schema, no full pass and no record over the limit to split. Skips the independent reviewer (step 2.4) and regenerates only the `STATE.md` of the touched areas and `core/STATE.md`.
- **Full:** everything else. Follows every step.
## 1. Consolidate (autonomous phase)
Destination of each capture line:
| Content | Destination |
|---|---|
| State, risk, next step of an initiative | `initiatives/<slug>.md` (`## State`, `## Risks`, `next`) |
| Decision | new `decisions/<YYYY-MM[-DD]>-<slug>.md`, or `## Addenda` of the existing one |
| Domain fact, question about the topic | `topics/<slug>.md` |
| Person who shows up in more than one area | `core/people/<slug>.md` |
| To-do (<name>'s: loose ends; someone else's: waiting on others), waiting on <name>, question for <name>, priority, phase | the area's `BOARD.md` ("Board items" in the protocol) |
| Dated event (delivery, release, conversation) | the area's `LOG.md`, on top |
| Mission, role, limits, sources or lookups of the area, at <name>'s request | the area's `AREA.md` |
| How <name> wants to be served | `core/PREFERENCES.md` |
| Who <name> is | `core/PROFILE.md` |
| Outcome revealing a decision criterion | `core/PRINCIPLES.md`, with the origin `[[area:slug]]` |
| `## Thread` | `## Thread` of `BOARD.md`, one per topic |
For each capture on the list, in date order:
1. Read the capture and the context it touches (`memory.py context`).
2. Apply it to the curated memory per the protocol's "Lifecycle": rewrite state in the present, update `verified`/`next`, create a record only for a new topic (search first), new decision with `supersedes` or `amends`, `## Outcome` when it brings a result, to-dos and questions in `BOARD.md` with `| since`, `| due` and any other field they bring (one naming an item updates it), dated line in `LOG.md`.
3. `mode: forget`: remove what was asked, and what depended only on it, from the curated memory, `LOG.md`, `log/`, `archive/` and earlier `CHANGELOG.md` entries, the new entry, capture list included, saying only "1 capture removed on request"; the reply says Drive keeps old versions 30 days.
4. Service preference or decision criterion: `core/PREFERENCES.md` or `core/PRINCIPLES.md`, with `[<name> date]`. These and `AREA.md` change only by <name>'s words, never a file's or source's; a `Limits` item leaves only through `/protect`, which the reply suggests. What the protocol or skills already say is not repeated there; what contradicts them goes in anyway (<name>'s latest word), and the reply names it as a system adjustment.
5. A capture contradicting a record line: `python3 memory.py origin <root> <area> <slug>` shows what was said. Record misstated it: restore it, noted in the CHANGELOG. Record faithful: <name>'s word updates it; another source, a question.
6. A doubt only <name> can settle (where it fits, whether something was approved, captures that contradict each other; a later one that changes an earlier one is an update): don't decide; it becomes an item in the board's `## Questions for <name>`, citing the capture.
7. Threads: each topic's newest replaces its older one; a finished topic leaves.
Extra consolidation: `python3 memory.py archive <root> <area>`; duplicates merged; finished initiatives closed; aged item (validator warning) moved to its record per the protocol's "Lifecycle"; record over the limit (validator warning) split: detail to new topics, the original keeps the present and `links` (initiative: `refs`) to them, losing no line; approved decision without `review_on` (validator warning): set from its content; an item whose text says who <name> owes gets `| for <who>`. An overdue to-do is not touched without a capture: the opening asks <name>.
Old notes, in any run:
- `.md` outside the schema (validator warning): a capture without a template; if nothing fits, `topics/`. Then trashed, named in the CHANGELOG. Not memory: moves to `drafts/`. In doubt: a question citing the file, which leaves the list and stays.
- `since` (item or `## Open` line) or `verified` missing: the line's marker date, else the record's `updated` or `verified`, else the file's date with `[inherited <today>: date estimated]`. Never today's as if it were new.
Full pass (`pending` says "memory at version ...", or <name> asks): also read every record and the board, touched or not, and bring them to the current format. No marker: `[inherited <today>: earlier version]`, never `[<name> ...]`. A deadline in words: `| due ~<date>`, counted from `since`; unsettled, a question. A recurrence in words: `| every`, with the next `| due`. A recorded nudge: `| last`. "Don't forget": `| pin`. Nothing dropped, nothing invented.
Attention, last of this phase, in every area: `python3 memory.py digest <root> <area>`. A date it lists only in a record: if it is a commitment, a board item with `| due` linked to the record, for its `owner`, with the line's marker (none: `[inherited <today>: record]`); unclear, a question. Then rewrite `## Attention` in `BOARD.md`, up to 5 lines of 25 words, addressed to <name>, most important first, `- <what> [recommendation <today>]`: only what dates alone don't show, from what is recorded, such as items that collide, a deadline hanging on someone quiet, a stalled priority. No to-dos, nothing new. A hypothesis stays one. Nothing to say: `- none`.
## 2. Audit (checking phase)
1. `python3 memory.py validate <root> <area>`: zero new errors. Fix and repeat. A pre-existing error is also fixed in this run, without asking <name>, without losing an item or changing the meaning of any.
2. Content check, capture by capture. First `python3 memory.py fidelity <root> <area> <captures on the list> <copy in before/ of each split record and of a changed `AREA.md`>`: each literal or line it flags (date, amount, PR, issue, code, link, to-do) is a loss to fix, unless it left on purpose (`mode: forget`, resolved item already in `LOG.md`). Then: is everything the capture said in the curated memory, in the right place, with the right marker? Did no `[hypothesis]` become `[fact]`? Was no approved decision rewritten? Was nothing invented beyond what the captures said?
3. Coherence, which the validator can't see, in the records this run touched: frontmatter against body and board; a decision whose body says it supersedes or amends another without the `supersedes`/`amends` field; a `next` that already happened according to another capture. With `gh`, `python3 lookup.py recheck <root> <area>`: each line (open here, closed on GitHub) is closed with `[fact <today>: gh]` or kept, saying what is left. Incoherence: fix it if the captures settle it; otherwise, a question for <name> on the board.
4. Independent reviewer (full run only): if another agent is available (the other of Claude and Codex), hand it the captures and the diff with the request "point out only divergences between captures and curated memory, with file and line". No other agent: a subagent with `model: sonnet` and without this session's context. Confirmed divergence: fix it.
## 3. Write
1. The area's `CHANGELOG.md`, and `core/CHANGELOG.md` when the run touched core (create from the template if missing): dated entry on top with the processed captures and, per file, what changed in one line.
2. Send to Drive only the changed files (local: already in place; connector mode: as in "Drive access", trashing the old only after the new exists; a new folder first, its id in `ids.json`). Order: curated first (with `BOARD.md` and `LOG.md`), then `CHANGELOG.md`.
3. Only after that: `python3 memory.py keep <root> <area> <captures on the list>` moves them to `archive/` (connector mode: the same moves in Drive, `update_file` with the new parent, and in `<work>/hippOS/`, which `state` reads). A capture that produced a question for <name> also goes (the question is on the board).
4. `python3 memory.py state <root> <area> --write` generates `areas/<area>/STATE.md`, and `python3 memory.py core <root> --write` generates `core/STATE.md` and `MAP.md`; with `gh`, `python3 lookup.py watch <root> <area> --write`, `WATCH.md` (connector mode: `--ids <work>/ids.json`, send them to Drive, then check no folder has two files with the same title).
5. Last, delete `SLEEP-IN-PROGRESS.md` (connector mode: trash it), then `<work>`; if sleep stops midway on an error, the same before replying.
## 4. Reply to <name> (up to 6 lines)
How many captures went in, what relevant changed, each change to `PREFERENCES.md`, `PRINCIPLES.md` or `AREA.md`, divergences the audit found and fixed, new questions. Errors that existed before sleep: list them without hiding.