Skip to content

Sleep System (Dreamy)

Dreamy is the nightly memory maintenance agent. After bedtime, it processes the day's conversations — extracting memories, writing summaries, checking contradictions, and optionally putting the hardware to sleep.

How it triggers

  1. BED_TIME passes (default: 02:00)
  2. Bridge waits for quiet — no messages for BED_QUIET_TICKS consecutive heartbeat ticks (default: 6 ticks = 30 min)
  3. Dreamy spawns as a subagent (same process, separate session)

If the bridge restarts and sleep hasn't run today, it catches up on next quiet period.

Pipeline (15 steps)

#StepWhat it does
1daily-summarySummarizes today's conversations
2retrospectiveReflects on the day, appends to daily summary
3extract-memoriesPulls facts, preferences, decisions from transcripts
4retro-deriveGenerates agent_notes + core knowledge updates
5feedbackSelf-assessment of interaction quality
6contradictionChecks new memories against existing ones
7graphUpdates relationship/topic graph (daily)
8–15curation (weekly)topic-assignment, core-promotion, merge, translation, skill-review, consolidation, emotion-context, rem-synthesis

Steps 8–15 only run on curation days (configurable).

Quality levels

LevelLLM callsUse case
basic1Testing
budget~3–5Low-cost providers
normal~7–15Default
ultimate~15 nightlyFull processing

Configuration

bash
# ~/.abtars/config/.env
BED_TIME=02:00
BED_QUIET_TICKS=6
SLEEP_QUALITY=normal
SLEEP_MAX_LLM_CALLS=15
HARDWARE_SLEEP_AFTER_DREAMY=false

Hardware sleep (optional)

When HARDWARE_SLEEP_AFTER_DREAMY=true:

  1. Dreamy completes → announces "going to sleep in ~5 minutes"
  2. 5-minute grace period — if user messages, hardware sleep is cancelled
  3. No message → pmset sleepnow (Mac) or systemctl suspend (Linux)
  4. Morning wake → watchdog detects stale heartbeat → bridge restarts fresh

Commands

CommandDescription
/sleepShow sleep status (last run, next scheduled)
/sleep nowForce sleep cycle immediately
/sleep skipSkip tonight's cycle

Guard logic

hasSleepAuditToday() prevents double-runs:

  • completed or suspended in lock file → no spawn
  • ongoing + process alive → already running
  • failed → retry allowed

Budget cap: if SLEEP_MAX_LLM_CALLS exhausted → status set to suspended, no retry until tomorrow.

Auto-skill creation (step 15)

Dreamy reviews conversations for skill-worthy patterns (trial-and-error, user corrections, multi-step workflows) and creates skills in ~/.abtars/skills/self/ via the abtars-skill CLI.