Sleep Snooze

v1.0.2

Snooze incoming notifications during your sleep window and receive a morning digest when you wake up. Supports Telegram, WhatsApp, and any provider OpenClaw...

1· 368·0 current·0 all-time
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Suspicious
medium confidence
Purpose & Capability
Name/description match the code: hooks intercept incoming messages, messages are queued in a local SQLite DB, and a morning digest is generated. Declared dependencies (node, better-sqlite3, node-cron) are appropriate for the functionality.
!
Instruction Scope
SKILL.md tells callers to use status.js to check isSleeping before sending, but the runtime hooks and gate.js call lib/sleep-check.loadSleepState() (which computes state from current time). status.js returns the stored state.isSleeping value from state.json (which can be stale). This is an inconsistency that could cause incorrect behavior. The docs also suggest using `date +%Z` to detect timezone (which yields an abbreviation, not an IANA name the code expects). Aside from these mismatches, the instructions direct only local reads/writes under ~/.openclaw/skills/sleep-snooze/, which is within scope.
Install Mechanism
Install uses npm packages (better-sqlite3 and node-cron) — no remote arbitrary downloads or unknown hosts. Note: better-sqlite3 is a native module that may require build tools; the install spec is proportionate to the task.
Credentials
The skill declares no required credentials and stores data locally. SKILL.md and references mention optional environment variables (SLEEP_START, WAKE_TIME, TIMEZONE) as alternative config — those are optional, which explains their absence from requires.env. No unrelated credentials are requested.
!
Persistence & Privilege
sleep-init.js will register cron jobs by editing the user's crontab and writes files under ~/.openclaw/skills/sleep-snooze/data/ (state.json, queue.db, vip-contacts.json). Modifying the user's crontab is a persistent system change and should be made explicit to the user; hooks also inject bootstrap files into agent contexts, affecting other agents' behavior. These privileges are coherent with scheduling, but are significant and warrant user review.
What to consider before installing
This skill appears to implement the advertised snooze/digest features and stores everything locally, but review these points before installing: 1) The installer (sleep-init.js) will modify your crontab to schedule sleep/wake jobs — check the exact cron lines it will add and prefer a manual crontab install if you want control. 2) The skill writes persistent files under ~/.openclaw/skills/sleep-snooze/data/ (including the SQLite queue containing message text); ensure you are comfortable with queued messages being stored locally and review file permissions. 3) There is an inconsistency: SKILL.md recommends using scripts/status.js to check isSleeping, but the code paths that actually gate sends use lib/sleep-check.loadSleepState() (which computes sleep from current time). status.js reads the stored flag and can be stale — rely on gate.js/loadSleepState for accurate checks. 4) The setup suggests detecting timezone with `date +%Z` but the code expects an IANA zone (e.g., America/New_York) — pick a proper IANA timezone when configuring. 5) If you accept, inspect the code (present in the package) and consider running sleep-init with cron registration disabled or manually add cron entries. If you need lower risk, consider asking for a build/install log or running the skill in a sandboxed account first.

Like a lobster shell, security has layers — review code before you run it.

Runtime requirements

🌙 Clawdis
Binsnode

Install

Node
Bins: node
npm i -g better-sqlite3
Node
Bins: node
npm i -g node-cron
latestvk978zthr3begbgk9mpgsfqswa582azqy
368downloads
1stars
3versions
Updated 1mo ago
v1.0.2
MIT-0

Sleep Snooze

You have a sleep notification snooze system available. When the user is in their sleep window, incoming messages should be silently queued rather than delivered immediately. At wake time, a morning digest is automatically sent summarising all queued messages.

Sleep Schedule

The user's sleep schedule is configured via environment variables:

  • SLEEP_START — time to begin snoozing (24h format, e.g. 22:00)
  • WAKE_TIME — time to deliver the digest and resume normal notifications (e.g. 06:00)
  • TIMEZONE — IANA timezone (e.g. Asia/Kolkata, America/New_York, Europe/London)

Slash Commands

Users can invoke these slash commands directly in chat:

  • /sleep — manually activate sleep mode immediately (overrides schedule)
  • /wake — manually deactivate sleep mode and trigger the morning digest now
  • /snooze-status — show whether sleep mode is active, how many messages are queued, and what time the digest will be sent
  • /snooze-setup — interactively configure sleep start time, wake time, and timezone
  • /snooze-history — show the last 7 days of digest summaries

Behaviour During Sleep Hours

Before sending ANY message to the user — including proactive notifications, summaries, heartbeats, weekly recaps, stock alerts, backup confirmations, or any other automated report — first check sleep state:

node ~/.openclaw/skills/sleep-snooze/scripts/status.js

If isSleeping is true, do NOT send. Queue it instead (see below). This applies to both incoming messages from others AND outgoing messages you are about to send proactively.

Incoming messages during sleep

When a message or notification arrives during the sleep window:

  1. Do not deliver a push notification or respond immediately.
  2. Call node ~/.openclaw/skills/sleep-snooze/scripts/queue-message.js with the message payload to store it in the local queue.
  3. Acknowledge silently — do not send any reply to the sender during sleep hours unless the message is tagged as urgent (see Urgency Rules below).

Outgoing messages you generate during sleep

When you (or any agent) are about to send a proactive message — status updates, recaps, reports, heartbeats — use gate.js instead of sending directly. It handles the sleep check and queuing automatically:

node ~/.openclaw/skills/sleep-snooze/scripts/gate.js \
  --provider <provider> \
  --sender-id <agent-id> \
  --sender-name "<Agent Name>" \
  --message "<full message text>"

Exit codes:

  • 0 — sleeping, message was queued — do NOT send
  • 2 — sleeping but urgent — send with 🚨 prefix
  • 3 — awake — send normally

Use gate.js for ALL outgoing messages. It checks the actual current time against the schedule, so it works even if the sleep-mode cron did not run.

Urgency Rules

Some messages bypass snooze and are delivered immediately regardless of sleep hours. A message is considered urgent if any of the following match:

  • The sender is on the user's VIP contacts list (stored in ~/.openclaw/skills/sleep-snooze/data/vip-contacts.json)
  • The message contains any of these keywords (case-insensitive): urgent, emergency, critical, 911, help me
  • The message was explicitly marked priority by the sending system

For urgent messages: deliver normally, prepend 🚨 [URGENT - received during sleep] to the notification.

Morning Digest

At WAKE_TIME each day, automatically:

  1. Call node ~/.openclaw/skills/sleep-snooze/scripts/digest.js to generate and send the digest.
  2. The digest groups messages by sender, shows count, and includes a brief summary of each conversation thread.
  3. After sending, the queue is cleared.

Digest format (send as a single message per provider):

🌅 Good morning! Here's what arrived while you slept:

📬 3 messages from Alex
  • "Hey are you free tomorrow?"
  • "Also wanted to share this article..."
  • "Never mind, talk later!"

📬 1 message from GitHub Notifications
  • PR #42 was merged into main

📬 2 messages from Server Monitor Bot
  • CPU spike at 03:14 — resolved
  • Disk usage at 78% — check when available

Reply to any sender's name to respond to their messages.

Setup Instructions

When the user runs /snooze-setup for the first time:

  1. Ask for their sleep start time (e.g. "What time do you usually go to bed?")
  2. Ask for their wake time (e.g. "What time do you usually wake up?")
  3. Ask for their timezone (offer to detect it automatically using date +%Z)
  4. Run node ~/.openclaw/skills/sleep-snooze/scripts/sleep-init.js to write config and register cron jobs
  5. Confirm the schedule back to the user: "Sleep snooze is set: 🌙 10:00 PM → ☀️ 6:00 AM (IST). I'll queue notifications overnight and send your digest at 6:00 AM."

State Management

Sleep mode state is stored in ~/.openclaw/skills/sleep-snooze/data/state.json:

{
  "sleepStart": "22:00",
  "wakeTime": "06:00",
  "timezone": "Asia/Kolkata",
  "manualOverride": false,
  "isSleeping": false,
  "lastDigestAt": "2025-01-15T06:00:00.000Z"
}

The message queue is stored in SQLite at ~/.openclaw/skills/sleep-snooze/data/queue.db.

Important Notes

  • Sleep snooze works across all connected providers (Telegram, WhatsApp, Discord, Slack, Signal) simultaneously.
  • If the user asks "did I miss anything?" or similar during sleep hours, check queue size and respond: "You have X messages queued. I'll send your digest at [WAKE_TIME]."
  • If the user sends a message themselves during their sleep window, it means they are awake — temporarily suspend sleep mode for 30 minutes.
  • Never discard messages. If delivery fails, retry at next digest cycle.

Comments

Loading comments...