Xpersona
M

Memory Dreaming

CLAWHUB · Unverified

Autonomous memory consolidation for OpenClaw agents — like REM sleep. Periodically gathers signal from daily logs, session transcripts, and learnings; consol... Skill: Memory Dreaming Owner: oryanmoshe Summary: Autonomous memory consolidation for OpenClaw agents — like REM sleep. Periodically gathers signal from daily logs, session transcripts, and learnings; consol... Tags: latest:0.2.0 Version history: v0.2.0 | 2026-03-26T14:02:49.328Z | user Plan tracking rewrite: concrete bash commands, file templates, step-by-step Obsidian sync logic. Dream prompt is now fully executabl

62
Rank
84
Safety
1.0k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1K downloads reported by the source. Last updated 10/11/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s173d33jefbwvxy0sjxr97pvpn83kphx:memory-dreaming
  1. Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-oryanmoshe-memory-dreaming/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

44,300 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: memory-dreaming
description: "Autonomous memory consolidation for OpenClaw agents — like REM sleep. Periodically gathers signal from daily logs, session transcripts, and learnings; consolidates into MEMORY.md; syncs structured knowledge to an Obsidian vault (or any markdown knowledge base); tracks plans; prunes stale entries. Use when: (1) setting up periodic memory maintenance, (2) manually triggering a dream cycle, (3) configuring Obsidian vault sync, (4) agent memory is getting noisy/contradictory and needs consolidation."
---

# Memory Dreaming

Autonomous memory consolidation ("dreaming") for OpenClaw agents. Runs as a cron job, consolidates scattered daily notes into curated long-term memory, and syncs structured knowledge to an Obsidian vault.

## Quick Start

1. Install: `clawhub install oryanmoshe/memory-dreaming`
2. Configure your vault path (optional): edit `dreaming-config.json` in your workspace
3. Set up the cron: run `scripts/setup-cron.sh`
4. Done — the agent dreams automatically every 8 hours

To trigger a dream manually, tell the agent: "Run a dream cycle now."

## How It Works

The dream cycle has 4 phases, inspired by biological REM sleep and Claude Code's AutoDream:

### Phase 1: Orient
Read current memory state — MEMORY.md, recent daily logs, learnings, dreaming log. Build a map of what exists and when it was last touched.

### Phase 2: Gather Signal
Search for high-value information added since the last dream:
- **Daily logs** (`memory/YYYY-MM-DD.md`) since last dream
- **Learnings** (`.learnings/*.md`) — pending corrections, errors, best practices
- **Session transcripts** — grep for corrections ("actually...", "no that's wrong"), decisions ("let's do X"), proper nouns, preferences
- **Plan files** — scan workspace for `task_plan.md` files

Key: grep narrowly for high-signal patterns. Don't read full transcripts — that burns tokens for marginal value.

### Phase 3: Consolidate
Update MEMORY.md with gathered signal:
- **Merge** duplicate entries (same fact from 3 sessions → one entry)
- **Absolute dates** — convert "yesterday" → "2026-03-25"
- **Delete** contradicted facts (if preference changed, remove old one)
- **Remove** stale entries (references to deleted files, completed tasks)
- **Promote** high-priority learnings from `.learnings/` to MEMORY.md

### Phase 4: Sync
Push consolidated knowledge to external targets:
- **Obsidian vault** (opt-in) — create/update notes with tags, wikilinks, full depth
- **Plan tracking** — ensure every `task_plan.md` has a corresponding `Plans/<name>.md` in the vault
- **Dreaming log** — write what changed, tokens used, duration

## Gate

The cron fires on schedule but the dream cycle only executes if **≥6 hours** have passed since the last dream (checked via `dreaming-log.md` timestamp). This prevents wasted runs when nothing has changed.

## Configuration

Create `dreaming-config.json` in your workspace root to customize. All fields are optional — sensible defaults are used.

_meta.json

{
  "ownerId": "kn74sq1swt14adfpb9bycz0bnn83jy3w",
  "slug": "memory-dreaming",
  "version": "0.2.0",
  "publishedAt": 1774533769328
}

references/architecture.md

# Architecture — Memory Dreaming

## The Biological Analogy

During waking hours, the brain absorbs raw sensory input as short-term memories. During REM sleep, it replays the day's events, strengthens important connections, discards noise, and organizes everything into long-term memory.

OpenClaw agents have the "waking" part:
- `memory/YYYY-MM-DD.md` daily logs (auto-flushed before compaction)
- `.learnings/` structured error/correction capture
- Session transcripts (30-day retention)
- QMD indexes everything for search

But without consolidation, daily notes accumulate noise — contradictions, stale references, duplicate entries. The signal-to-noise ratio degrades over time, exactly like a sleep-deprived brain.

**Memory dreaming is the REM sleep cycle.** It replays recent sessions, strengthens what matters, discards what's stale, and organizes the rest.

## The 4-Phase Cycle

### Phase 1: Orient
**Input:** Current memory state
**Output:** Mental map of what exists

Read:
- `MEMORY.md` — current long-term memory
- `memory/YYYY-MM-DD.md` — recent daily logs (since last dream)
- `.learnings/*.md` — pending corrections, errors, best practices
- `memory/dreaming-log.md` — when was the last dream, what changed
- Obsidian vault state (if configured) — what's already synced

This phase answers: "What do I already know, and what's new since last time?"

### Phase 2: Gather Signal
**Input:** Session transcripts, daily logs, learnings
**Output:** List of high-value new information

The key insight from Claude Code's AutoDream: **grep narrowly, don't read full transcripts.** Exhaustively reading hundreds of session files burns tokens for diminishing returns. Instead, search for specific high-signal patterns:

**Correction patterns** (highest value — the human told us we were wrong):
- "no, that's wrong", "actually...", "I meant...", "not X, Y"
- "that's outdated", "you're wrong about"

**Decision patterns** (durable facts):
- "let's do X", "go with Y", "use Z instead"
- "we decided", "the plan is"

**Save patterns** (explicit memory requests):
- "remember this", "save to memory", "don't forget"

**Entity patterns** (proper nouns worth tracking):
- Names, project names, URLs, API keys mentioned
- New tools, services, repos discovered

**Plan patterns** (scan for task_plan.md files):
- New plans that need Obsidian tracking
- Plan status changes (phases completed)

### Phase 3: Consolidate
**Input:** Gathered signal + current MEMORY.md
**Output:** Updated MEMORY.md

Operations:
1. **Merge duplicates** — same fact noted in 3 sessions → one clean entry
2. **Absolute dates** — "yesterday we decided X" → "On 2026-03-25 we decided X"
3. **Delete contradictions** — if user corrected a fact, remove the old version
4. **Remove stale** — references to deleted files, completed tasks, resolved issues
5. **Promote learnings** — high-priority pending items from `.learnings/` → MEMORY.md sections
6. **Size management** — keep MEMORY.md focused; archive very old sections if

references/dream-prompt.md

# Dream Prompt

This is the instruction set sent to the isolated cron agent. It must be self-contained — the agent wakes up with no context and only this prompt + workspace access.

---

## The Prompt

```
AUTONOMOUS DREAM CYCLE — Memory consolidation.

You are running a memory consolidation cycle ("dreaming"). You have no prior context — read files to orient yourself.

IMPORTANT: You are an isolated agent. Do NOT message anyone. Do NOT announce anything. Just read, consolidate, write, and reply NO_REPLY.

## GATE CHECK (do this first)

Read memory/dreaming-log.md (if it exists). Find the most recent "## YYYY-MM-DD HH:MM" heading.
Parse the date. Calculate hours since that timestamp.
If the last dream was less than 6 hours ago, reply NO_REPLY and stop immediately.
If the file doesn't exist or has no entries, proceed (this is the first dream).

## PHASE 1: ORIENT

Read these files in order:
1. Read `MEMORY.md` — understand what's already in long-term memory
2. Run: `ls -lt memory/*.md | head -10` — identify recent daily logs
3. Run: `ls .learnings/*.md` — check what learning files exist
4. Read `dreaming-config.json` (workspace root) — get Obsidian vault path and settings
5. Read `memory/dreaming-log.md` — find the date of the last dream to know what's "new"

Record the last dream date. Everything after that date is "new signal."

## PHASE 2: GATHER SIGNAL

### 2a: Read daily logs since last dream
For each `memory/YYYY-MM-DD.md` file dated AFTER the last dream date, read it fully. Extract:
- New facts, decisions, preferences stated by the user
- People mentioned with new context (role, team, relationship)
- Projects with status changes (started, completed, blocked)
- Tools configured, installed, or discovered
- Corrections (things that were wrong and got fixed)
- New plans created or plan phases completed

### 2b: Grep session transcripts for corrections and decisions
Run these greps to find high-signal sessions — only read the MATCHED lines, not full files:

```bash
# Find sessions with corrections (highest value signal)
grep -l "actually\|no.*that's wrong\|not.*it's\|I meant\|that's outdated" ~/.openclaw/agents/main/sessions/*.jsonl 2>/dev/null | tail -5

# Find sessions with decisions
grep -l "let's do\|go with\|use.*instead\|we decided\|the plan is" ~/.openclaw/agents/main/sessions/*.jsonl 2>/dev/null | tail -5
```

For each file found, grep the specific pattern to extract just the relevant context line. Do NOT read entire session files.

### 2c: Check learnings
Read `.learnings/LEARNINGS.md` — note entries with `Status: pending` (especially `Priority: high`).
Read `.learnings/ERRORS.md` — note entries with `Status: pending`.

### 2d: Scan for plans
Run:
```bash
find ~/.openclaw/workspace -name "task_plan.md" -not -path "*/node_modules/*" -not -path "*/skills/*/task_plan.md" 2>/dev/null
```
Also check:
```bash
find ~/.openclaw/workspace/plans -name "task_plan.md" 2>/dev/null
```

For each task_plan.md found, read just the first 30 lines to get

references/obsidian-sync.md

# Obsidian Sync — How It Works

## Overview

When `obsidian.enabled: true` in config, Phase 4 of the dream cycle syncs consolidated knowledge to an Obsidian vault. The vault becomes the human-browsable, phone-accessible source of truth for structured knowledge.

## What Gets Synced

| Source | Target Folder | When |
|---|---|---|
| People mentioned in memory | `People/` | New person discovered or info updated |
| Projects/repos in memory | `Projects/` | New project or status change |
| Plans (task_plan.md files) | `Plans/` | New plan or phase status change |
| Tools/services configured | `Tools/` | New tool or config change |
| Key decisions | `Decisions/` | New decision from consolidation |

## Formatting Rules

All Obsidian notes follow these rules (configurable via `obsidian.formatting`):

1. **Tags on first line** — `#person #shapes #engineering` before the title
2. **Wikilinks** — `[[Related Note]]` to connect concepts
3. **Full depth** — never summarize or dilute; write the complete information
4. **YAML frontmatter** — optional, with aliases when a topic has multiple names

Example:
```markdown
#person #shapes #engineering #rnd

# Gal Peer

## Role & Organization
- **Title:** Full Stack Engineer
- **Team:** R&D
- **Reports To:** [[David Virtser]]

## Links
- **GitHub:** [GalPeer33](https://github.com/GalPeer33)

## Related
- [[Shapes Atlas]] — contributor
- [[Shapes Ecosystem]]
```

## Plan Tracking

The dreaming skill scans the workspace for `task_plan.md` files. For each:

1. Extract plan name from the parent directory name
2. Check if `Plans/<name>.md` exists in the vault
3. If not, create it with: status, phases table, key decisions, links to related notes
4. If exists, update: phase statuses, any new decisions
5. Update `Projects/Active Plans.md` dashboard with current plan list

This ensures **every plan created anywhere in the workspace automatically appears in Obsidian**.

## Sync Behavior

- **Create:** New vault notes are created from scratch with full formatting
- **Update:** Existing notes are updated — new sections appended, status fields changed. Content is never removed from vault notes during sync (only dreaming's consolidation phase removes contradictions from MEMORY.md)
- **Never delete:** Vault notes are never deleted by the dreaming skill
- **Idempotent:** Running sync twice with no new information changes nothing

## Conflict Handling

If a vault note was edited manually (by the human via Obsidian):
- The dreaming skill **appends** new information but does not overwrite manual edits
- Manual sections are preserved
- If there's a genuine conflict (e.g., status field differs), the dreaming log notes it for human review

Sponsored

Ads related to Memory Dreaming and adjacent AI workflows.