360 Secure SkillHub
360 安全技能中心

Sleep Channel

该 Skill 面向 Discord 专用睡眠频道,通过 scripts/tracker.py 提供新增睡眠事件、修正最新条目、删除最新条目和渲染睡眠日志四类操作,强调使用来源消息时间戳并按 SLEEP_TIMEZONE 转换时区,禁止编造时间、日期或条目。需配置 SLEEP_TIMEZONE,可选 WORKSPACE;lint 提示存在前后矛盾的操作约束与破坏性操作。

cdmichaelb
cdmichaelb
热度 41.80
最近更新 2026-05-11 17:40:12
分类:生活依赖:代码执行 / 读写文件应用场景:健康 / 工作流 / 自动化脚本

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add sleep-channel
Metadata
name
sleep-channel
version
1.1.0
description
Handle messages in a Discord sleep-tracking channel by grounding all sleep logging and summaries on the real sleep tracker and source Discord metadata. Use when working in a dedicated sleep channel, especially for adding sleep entries, correcting the latest entry, deleting the latest entry, or rendering the current sleep log without hallucinating timestamps, dates, or entries.
env
{"SLEEP_TIMEZONE":{"required":true,"description":"IANA timezone string (e.g. America/Los_Angeles, Europe/Berlin)"},"WORKSPACE":{"required":false,"description":"Workspace root path. Defaults to ~/.openclaw/workspace"}}

Sleep Channel

Deterministic sleep tracker for Discord channel-based sleep logging.

Configuration

Set the following environment variables before use:

Variable Required Description
SLEEP_TIMEZONE Yes IANA timezone string (e.g. America/Los_Angeles, Europe/Berlin)
WORKSPACE No Workspace root path. Defaults to $HOME/.openclaw/workspace

Core Rules

  • Treat the configured channel as the dedicated sleep channel.
  • Prefer scripts/tracker.py for all log mutations and rendering.
  • Never write now as a logged time.
  • Never derive event time from the model turn time.
  • Use the source Discord message timestamp unless the user explicitly gives a different time.
  • Convert displayed times to the user's local timezone (SLEEP_TIMEZONE).
  • Never invent entries, dates, or file contents.
  • If showing the sleep log, render from the real tracker/file output.

Commands

Add a new sleep event

For messages like: going to bed, still awake, fell asleep, awake now, resting, nap, back to sleep.

python3 scripts/tracker.py add \
  "$MESSAGE_TEXT" \
  "$CHANNEL_ID" \
  "$MESSAGE_ID" \
  "$AUTHOR_ID" \
  "$TIMESTAMP_UTC"

Correct the latest entry

When the user is clearly correcting the previous sleep event.

python3 scripts/tracker.py correct-latest \
  "$MESSAGE_TEXT" \
  "$CHANNEL_ID" \
  "$MESSAGE_ID" \
  "$AUTHOR_ID" \
  "$TIMESTAMP_UTC"

Delete the latest entry

When the user explicitly wants the latest sleep entry removed.

python3 scripts/tracker.py delete-latest

Render the sleep log

Display the current sleep log/summary.

python3 scripts/tracker.py render

Classification Hints

The tracker handles common phrases: fell asleep, awake now, got up, still awake, laying in bed, going to bed, trying to sleep, going back to sleep. Pass raw text to the tracker instead of re-parsing.

If Uncertain

Ask a short clarifying question only when intent is ambiguous:

  • Correction vs new event?
  • Delete the latest entry?
  • Explicit time override?

Files

File Purpose
scripts/tracker.py Canonical sleep tracker (self-contained, stdlib only)
references/CHANNEL_RULES.md Channel setup guide (optional)
references/README.md System documentation (optional)