dream

A command for cleaning up long-term agent memory files. It removes outdated references, combines duplicates, resolves conflicts, and rebuilds the main index.

In plain words
What is it for?
Use it for scheduled or preview-only memory maintenance; use a separate memory command when adding or searching entries.
Why use it?
It keeps stored information accurate and easier to navigate after many sessions have added or changed memories.

Command

Part of the ork plugin — 35 commands, 15 agents shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/yonatangross/orchestkit/dream
Clone the repo
git clone --depth 1 https://github.com/yonatangross/orchestkit

Or install ork, the plugin that ships this one along with the rest of its 35 commands, 15 agents.

Per session 55 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 5,266 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00055 $0.05266
Opus 5 $0.00028 $0.02633
Sonnet 5 $0.00011 $0.01053
Haiku 4.5 $0.00006 $0.00527

Measured 3d ago against content hash aaee491627b6, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

dream scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

grep -l -i "<topic-key>" ~/.claude/projects/*/memory/MEMORY.md \
plugins/ork/.cursor-plugin/commands/dream.md · 479 lines

How it starts

The opening of the file, as written. The whole thing — 479 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Auto-generated from skills/dream/SKILL.md

Source: https://github.com/yonatangross/orchestkit

Dream - Memory Consolidation

Deterministic memory maintenance: detect stale entries, merge duplicates, resolve contradictions, rebuild the MEMORY.md index. All pruning decisions are based on verifiable checks (file exists? function exists? duplicate content?), not LLM judgment.

Argument Resolution

DRY_RUN = "--dry-run" in "$ARGUMENTS"  # Preview changes without writing

Overview

Memory files accumulate across sessions. Over time they develop problems:

  • Stale references — memories pointing to files, functions, or classes that no longer exist
  • Duplicates — multiple memories covering the same topic with overlapping content
  • Contradictions — newer memories superseding older ones without cleanup
  • Index drift — MEMORY.md index out of sync with actual memory files

This skill fixes all four problems using deterministic checks only.

Cadence (CC 2.1.142+): Reactive compaction now sizes its first summarize attempt to the actual overflow, so long sessions stall mid-turn far less often. The "run nightly" cadence can relax toward "run when memory files accumulate" — consolidation is no longer needed to head off compaction inefficiency.

STEP 1: Discover Memory Files

# Find the memory directory (agent-specific or project-level)
# Agent memory lives in: .claude/agent-memory/<agent-id>/
# Project memory lives in: .claude/projects/<hash>/memory/
# Also check: .claude/memory/

memory_dirs = []
Glob(pattern=".claude/agent-memory/*/MEMORY.md")
Glob(pattern=".claude/projects/*/memory/MEMORY.md")
Glob(pattern=".claude/memory/MEMORY.md")

# For each discovered MEMORY.md, glob all *.md files in that directory
for dir in memory_dirs:
    Glob(pattern=f"{dir}/../*.md")  # All memory files alongside MEMORY.md

Read every discovered memory file. Parse frontmatter (name, description, type) and body content. Build an in-memory inventory:

Read the full file on GitHub · 479 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 479 lines · 55 tokens per session scan B aaee491627b6

Subscribe to this mod's changes

dream is a command published in the GitHub repository yonatangross/orchestkit (224 stars, last pushed 3d ago), licensed MIT. It adds 55 tokens to every session and 5,266 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.