diff --git a/README.md b/README.md index dcf61cf..ccc1fa2 100644 --- a/README.md +++ b/README.md @@ -174,6 +174,30 @@ After that, the sleep cycle runs every night automatically. The morning report i Opt in at install time with `./install.sh --with-sleep-sync` (TTY-only). Governed by RULE 0.15 in `~/.claude/rules/sleep-layer.md`. +### Sleep on it (incubation, v0.12.0) + +Defer a hard question or research task to the nightly remote agent: run `/sleep-on-it`, fill in one free-text field plus three clicks (type / priority / format), submit. The task lands in `sync-repo/sleep-queue/` and the nightly agent processes it before REM consolidation. + +Priority maps to a wall-clock budget. Pick the one that matches the task's difficulty: + +| Priority | Budget | When to pick | +|---|---|---| +| Quick | 15 min, this night | Simple questions, fast lookups | +| Standard | 60 min, this night | Default, medium research | +| Deep | 4 hours, this night | Serious derivations, thorough prior-art | +| Marathon | Full night (up to 8 h), **1 task only** | Hard equations, full autonomy; Phase B REM skipped that night | +| Weekly batch | 60 min, next Sunday UTC | Non-urgent research | + +Checkpointing: Standard / Deep / Marathon runs commit a `.partial.md` every 20–30 minutes, so if the cloud session is cut short you still get the partial on morning pull. + +Typical use: +- "Should I use CfC for memory re-ranker?" → deep-research → architectural recommendation by morning +- "Compare SvelteKit vs Astro vs Next.js App Router for the kit's landing" → comparative study +- "Derive closed form for the CfC attractor on Stiefel V(p,k=2)" → marathon mode, full night of autonomous derivation +- "What patterns in audit-backlog have highest impact?" → pattern analysis + +Results in `sync-repo/sleep-results/.md`, linked from the next morning's REM report. Biological analog: the REM-sleep "sleep on it" effect (Wagner et al. 2004, *Nature*). Queue mutations go through the `kei-sleep-queue` helper, which runs `genesis-scan` on submit as a second line of defense against patent-sensitive prompts leaking to the cloud agent. + ## Primitives (Rust) `_primitives/_rust/` is a Cargo workspace with 9 single-binary crates. `install.sh` builds `--release` and drops binaries at `~/.claude/agents/_primitives/_rust/target/release/`. diff --git a/_primitives/templates/sleep-trigger-prompt.md b/_primitives/templates/sleep-trigger-prompt.md index d8bf0e3..d13aab4 100644 --- a/_primitives/templates/sleep-trigger-prompt.md +++ b/_primitives/templates/sleep-trigger-prompt.md @@ -14,7 +14,27 @@ Clone: {REPO_URL} Branch: main Time: 03:00 local (UTC cron: {UTC_CRON}) -## Task +## Cycle order (v0.12.0+) + +1. **Phase A — Incubation ("sleep on it")** — process user-submitted + tasks in `sync-repo/sleep-queue/`. See + `sleep-incubation-prompt.md` (shipped in the same `templates/` dir) + for the full spec. Phase A writes results to + `sync-repo/sleep-results/.md` (plus optional intermediate + `.partial.md` checkpoints) and commits at least once. +2. **Phase B — REM consolidation** (this document). Phase B analyses + new traces and commits its own `REM: consolidation ` + commit. Normally two commits per night, one per phase. + +If `sync-repo/sleep-queue/` is empty or missing, Phase A is a silent +no-op. Phase B runs regardless of Phase A outcome **except when Phase +A selected a `marathon: true` task** — in that case Phase B is +SKIPPED for the night so the marathon task owns the full window. +Phase B resumes the next night; a single skipped night does not lose +traces (they stay in `traces/` and will be consolidated on the next +run). + +## Phase B — Task 1. Clone the memory repo shallow. 2. Identify NEW traces in `traces/` since the last consolidation by diff --git a/install.sh b/install.sh index 2086605..474fe3f 100755 --- a/install.sh +++ b/install.sh @@ -1005,10 +1005,11 @@ mkdir -p "$AGENTS_DIR/_primitives" cp -f "$KIT_DIR/_primitives/MANIFEST.toml" "$AGENTS_DIR/_primitives/MANIFEST.toml" 2>/dev/null || true cp -f "$KIT_DIR/_primitives/README.md" "$AGENTS_DIR/_primitives/" 2>/dev/null || true -# v0.11 sleep-sync scripts — NOT listed in MANIFEST because they're always -# available regardless of profile (zero binary deps; enabled only when the -# user opts in via /sleep-setup). Copy them every install. -for sleep_sh in kei-sleep-setup.sh kei-sleep-sync.sh; do +# v0.11 sleep-sync + v0.12 sleep-on-it queue scripts — NOT listed in MANIFEST +# because they're always available regardless of profile (zero binary deps; +# enabled only when the user opts in via /sleep-setup + /sleep-on-it). Copy +# them every install. +for sleep_sh in kei-sleep-setup.sh kei-sleep-sync.sh kei-sleep-queue.sh; do src="$KIT_DIR/_primitives/$sleep_sh" if [ -f "$src" ]; then cp -f "$src" "$AGENTS_DIR/_primitives/$sleep_sh"