← 返回
未分类 Key 中文

Memory Dreaming

A Markdown + JSON memory framework with conversation archiving for AI agents. Provides persistent long-term memory with biologically-inspired decay, recall b...
一种 Markdown + JSON 记忆框架,支持对话存档,为 AI 代理提供持久化长期记忆,具备生物启发的衰减机制和召回功能。
ptburkis ptburkis 来源
未分类 clawhub v0.1.2 1 版本 100000 Key: 需要
★ 0
Stars
📥 354
下载
💾 0
安装
1
版本
#dreaming#latest#memory

概述

Memory Dreaming

Agent-native memory and dreaming framework. Plain Markdown and JSON — no RAG,

no vector store, no graph database. Just files your human can read and edit.

> References (load when needed):

> - references/architecture.md — data model, biological inspiration, design decisions

> - references/dream-cycle.md — full dream cycle procedure with examples

> - references/cold-start.md — starting from zero memories

> - references/cron-templates.md — ready-to-use OpenClaw cron definitions


Setup

1. Copy scripts to your workspace

cp skills/memory-dreaming/scripts/*.js scripts/

Scripts use path.resolve(__dirname, '..') for workspace root — they must

live in /scripts/.

2. Bootstrap (if you have an existing MEMORY.md)

node scripts/memory-bootstrap.js          # seed memory-meta.json
node scripts/conversation-archive.js --discover  # see available channels

Starting from scratch? See references/cold-start.md.

3. Set up conversation archiving (optional)

Create archives/archive-config.json to label your groups:

{
  "agentName": "YourName",
  "groups": { "<group-id>": { "name": "my-group", "label": "My Group" } },
  "topicNames": { "<group-id>": { "1": "General" } }
}

Then archive and summarise:

node scripts/conversation-archive.js --all
node scripts/conversation-summarise.js --all

Two Layers

Layer 1: Core Memory

Your curated knowledge — facts, preferences, decisions, people.

FilePurpose
---------------
MEMORY.mdLong-term memory (human-readable, agent-edited)
memory/YYYY-MM-DD.mdDaily notes (raw session logs)
memory/memory-meta.jsonDecay metadata per entry
memory/dream-log.mdDream cycle audit trail
memory/archive/YYYY-MM.mdArchived (forgotten) entries

Layer 2: Conversational Memory

Context from group chats, channels, topics — archived and summarised.

FilePurpose
---------------
archives///raw/Full conversation transcripts
archives///summaries/AI-generated topic summaries
archives///DIGEST.mdCross-topic master digest
archives///INDEX.mdTopic index with message counts

Memory Tiers

TierAgeDecays?Notes
---------------------------
hot<48hYesNew entries
warm<30dYesRecent
cold<365dYesLong-term
archivedRemovedscore<0.1 + recalls<2
crystallisedNever20+ recalls

Structural entries (IPs, people, URLs, passwords) never decay below 0.3.

Decay Formula

baseDecay    = 1.0 - (daysSinceCreated / maxAgeDays)
recallBoost  = min(recallCount × 0.05, 0.5)
recencyBoost = lastRecalled ≤7d → 0.2 | ≤30d → 0.1 | else → 0
decayScore   = clamp(base + recall + recency, 0.0, 1.0)

Scripts (6)

Core Memory

ScriptPurposeWhen to run
------------------------------
memory-bootstrap.jsSeed meta from MEMORY.mdSetup + after adding entries
memory-decay.jsRecalculate scores, tier transitionsStart of dream cycle
memory-recall-logger.jsLog recall events, boost scoresAfter every memory search
memory-supersede.jsCreate temporal fact chainsWhen facts change

Conversation Memory

ScriptPurposeWhen to run
------------------------------
conversation-archive.jsArchive channel transcriptsNightly (before summarise)
conversation-summarise.jsAI-summarise topics + digestNightly (after archive)

Usage Examples

# Core memory
node scripts/memory-decay.js --verbose
node scripts/memory-recall-logger.js --query "dev server IP" --matches "Dev server: user@203.0.113.10"
node scripts/memory-supersede.js --old "Status: pending" --new "Status: accepted"

# Conversation memory
node scripts/conversation-archive.js --discover     # list available sessions
node scripts/conversation-archive.js --all           # archive everything
node scripts/conversation-archive.js --channel telegram --group my-group
node scripts/conversation-summarise.js --all         # summarise all archived
node scripts/conversation-summarise.js --force       # re-summarise everything

Daily Workflow

Every session

  1. Load MEMORY.md for context.
  2. After searching memory, log recalls:

```bash

node scripts/memory-recall-logger.js --query "" --matches ""

```

When you learn something new

  • Add to MEMORY.md under the right section.
  • If it replaces an old fact, run memory-supersede.js.

Daily notes

  • Create memory/YYYY-MM-DD.md with what happened.
  • Bullet points. Decisions, contacts, technical details, anything worth keeping.

Dream Cycle

Agent-orchestrated consolidation. Run nightly or during quiet heartbeats.

  1. Decaynode scripts/memory-decay.js
  2. Review — Read recent memory/YYYY-MM-DD.md files
  3. Integrate — Move significant items into MEMORY.md
  4. Prune — Remove stale entries (low score, not structural)
  5. Supersede — Chain any changed facts
  6. Log — Append summary to memory/dream-log.md
  7. Re-bootstrapnode scripts/memory-bootstrap.js (picks up new entries)

Full procedure with worked examples: references/dream-cycle.md.

Cron job definitions: references/cron-templates.md.


Conversation Context Loading

When receiving a message from a group/topic, load context before responding:

  1. Check archives///summaries/topic-.md for topic context
  2. For cross-topic awareness, skim DIGEST.md
  3. If summary seems stale, re-run archive + summarise for that group

This prevents the "I don't know what you're talking about" problem in

long-running group conversations.


Limitations

  • No semantic search. Recall matching is hash → substring → Jaccard word overlap.

Good for exact/close matches. Won't find conceptually related entries.

  • Bootstrap hash is fragile. Based on first 20 chars — editing the start of

an entry creates a new hash and loses history.

  • Dream cycles need judgment. The scripts provide mechanics; you provide

the editorial sense of what's worth keeping.

  • Summarisation costs money. Uses LLM API calls. Free-tier models work

but quality varies. Configure summariseModel in archive-config.json.

  • MEMORY.md is ground truth. Meta tracks metadata; Markdown is what you read.

Keep them in sync.

This is a work in progress. Start simple, observe what works, add complexity

when the simple thing breaks.


Credentials & Privacy

Required credentials

Core memory scripts (4): No credentials needed. These are pure local

file operations — read/write Markdown and JSON in your workspace.

Conversation summariser: Requires an LLM API key. Set one of:

  • OPENROUTER_API_KEY in .env.openrouter or environment
  • OPENAI_API_KEY in .env.openai or environment

The summariser sends conversation transcripts to the configured LLM provider

for summarisation. **This means your chat content is sent to a third-party

API.** Use a self-hosted model or review transcripts before summarising if

this is a concern.

Conversation archiver: No credentials. Reads local OpenClaw session

transcripts and writes local Markdown files.

What gets read

  • MEMORY.md and memory/ files (your workspace)
  • OpenClaw session transcripts (sessions.json + .jsonl files)
  • .env.openrouter or .env.openai (for API keys, summariser only)
  • archives/archive-config.json (optional config you create)

What gets written

  • memory/memory-meta.json, memory/dream-log.md, memory/archive/
  • archives/// (raw transcripts, summaries, digests)

What gets sent externally

  • Only conversation-summarise.js sends data externally (to your

configured LLM API for summarisation). All other scripts are fully local.

  • Raw conversation text is sent to the LLM. If your transcripts contain

sensitive information, credentials, or private messages, those will be

included unless you filter them first.

版本历史

共 1 个版本

  • v0.1.2 当前
    2026-05-07 08:28 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-agent

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,441 📥 327,988
ai-agent

self-improving agent

pskoett
记录自身发现以实现自我改进的技能
★ 4,161 📥 931,018
ai-agent

Find Skills

root
帮助用户发现和安装智能体技能,当用户询问如「如何做X」、「找X的技能」、「有能做...的吗」等问题时
★ 1,516 📥 570,947