Dreaming
Creative, exploratory thinking during quiet hours. Not task-oriented work — freeform associative exploration that gets captured for later review.
Environment Variables
| Variable | Required | Default | Description |
|---|
| INLINECODE0 | No | Skill's parent directory (scripts/..) | Root directory where data/ and memory/ live. Optional — defaults to the skill's parent directory, which is correct for standard workspace layouts. |
Directories Written
The skill writes to these directories (relative to WORKSPACE):
- -
data/dream-state.json — Tracks nightly dream count and last dream date data/dream-config.json — Optional custom topic configuration (user-created)memory/dreams/YYYY-MM-DD.md — Dream output files (written by the agent, not the script)
Setup
1. Configure quiet hours and topics
Edit skills/dreaming/scripts/should-dream.sh to customize:
- - QUIETSTART / QUIETEND — when dreaming can happen (default: 11 PM - 7 AM)
- TOPICS array — categories of exploration (see defaults for examples)
2. Create state and output directories
CODEBLOCK0
3. Add to HEARTBEAT.md
Add this section to your heartbeat routine (during quiet hours):
CODEBLOCK1
How It Works
The skills/dreaming/scripts/should-dream.sh script acts as a gate:
- 1. Checks if current time is within quiet hours
- Checks if we've already hit the nightly dream limit
- Rolls dice based on configured probability
- If all pass: returns a random topic and updates state
- If any fail: exits non-zero (no dream this heartbeat)
State tracked in data/dream-state.json:
CODEBLOCK2
Writing Dreams
When the script returns a topic, write to memory/dreams/YYYY-MM-DD.md:
CODEBLOCK3
Guidelines:
- - One dream = one topic, explored thoughtfully
- Timestamp each entry
- Append if multiple dreams in one night
- Skip if you have nothing worth saying — forced dreams are worthless
- This is for your human to review later, like reading a journal
Customizing Topics
Option A: Config file (recommended) — Create data/dream-config.json:
CODEBLOCK4
CODEBLOCK5
梦境模式
在安静时段进行创造性、探索性的思考。不是面向任务的工作——而是自由形式的联想探索,记录供后续回顾。
环境变量
| 变量 | 必需 | 默认值 | 描述 |
|---|
| WORKSPACE | 否 | 技能的父目录 (scripts/..) | data/ 和 memory/ 所在的根目录。可选——默认为技能的父目录,适用于标准工作区布局。 |
写入目录
技能会写入以下目录(相对于 WORKSPACE):
- - data/dream-state.json — 追踪每晚梦境次数和上次梦境日期
- data/dream-config.json — 可选的自定义主题配置(用户创建)
- memory/dreams/YYYY-MM-DD.md — 梦境输出文件(由智能体写入,而非脚本)
设置
1. 配置安静时段和主题
编辑 skills/dreaming/scripts/should-dream.sh 进行自定义:
- - QUIETSTART / QUIETEND — 可进行梦境的时间段(默认:晚上11点 - 早上7点)
- TOPICS 数组 — 探索类别(参见默认示例)
2. 创建状态和输出目录
bash
mkdir -p data memory/dreams
3. 添加到 HEARTBEAT.md
在心跳例程中添加此部分(在安静时段内):
markdown
梦境模式(仅限安静时段)
检查是否到了做梦的时间:
\\\bash
DREAMTOPIC=$(./skills/dreaming/scripts/should-dream.sh 2>/dev/null) && echo DREAM:$DREAMTOPIC || echo NO_DREAM
\\\
如果设置了 DREAM_TOPIC:
- 1. 解析主题(格式:category:prompt)
- 将深思熟虑的探索写入 memory/dreams/YYYY-MM-DD.md
- 保持真实——不要凑数。如果灵感枯竭,就跳过。
- 如果当晚有多个梦境,追加到文件中
工作原理
skills/dreaming/scripts/should-dream.sh 脚本充当一个门控:
- 1. 检查当前时间是否在安静时段内
- 检查是否已达到每晚梦境上限
- 根据配置的概率掷骰子
- 如果全部通过:返回一个随机主题并更新状态
- 如果任何一项失败:以非零退出(本次心跳无梦境)
状态记录在 data/dream-state.json 中:
json
{
lastDreamDate: 2026-02-03,
dreamsTonight: 1,
maxDreamsPerNight: 1,
dreamChance: 1.0
}
撰写梦境
当脚本返回一个主题时,写入 memory/dreams/YYYY-MM-DD.md:
markdown
梦境 — 2026-02-04
01:23 — X的未来 (category-name)
[在此进行你的探索。保持真实。自由思考。建立联系。
这不是报告——而是大声思考的记录。]
指南:
- - 一个梦境 = 一个主题,进行深思熟虑的探索
- 为每条记录添加时间戳
- 如果一晚有多个梦境,追加记录
- 如果无话可说就跳过——强制的梦境毫无价值
- 这是供你的人类后续回顾的,就像阅读日记一样
自定义主题
选项 A:配置文件(推荐) — 创建 data/dream-config.json:
json
{
topics: [
future:这个项目可能变成什么?,
creative:一个值得探索的大胆想法,
reflection:回顾近期工作
]
}
这样可以将自定义内容保留在技能目录之外(便于技能更新时安全)。
选项 B:直接编辑脚本 — 修改 should-dream.sh 中的 DEFAULT_TOPICS 数组。格式:category:prompt
默认类别:
- - future — [某事物]可能变成什么?
- tangent — 值得探索的有趣技术或概念
- strategy — 长期思考
- creative — 可能疯狂或绝妙的奇思妙想
- reflection — 回顾近期工作
- hypothetical — 假设场景
- connection — 领域间的意外联系
添加与你工作相关的领域特定主题。提示应激发真正的探索,而非应付差事。
调优
在 data/dream-state.json 中:
- - maxDreamsPerNight — 每晚梦境上限(默认:1)
- dreamChance — 每次检查的概率(默认:1.0 = 在限制内必定触发)
降低 dreamChance 可获得更随机的梦境。提高 maxDreamsPerNight 可获得更多产的夜晚。