agentleFS
LuciowayLucioway/way-stack/skills/dream/SKILL.md

dream

Skill0 starsChanged 2 months agoMITView on GitHub

Memory consolidation for Claude Code auto-memory (claude-mem). Merges duplicate memory files, resolves contradictions, converts relative dates to absolute, prunes stale entries, and shrinks MEMORY.md index under the 24.4KB load limit. Replicates Anthropic's Dream feature. Use when user says "/dream", "consolidate memory", "clean memory", "memory bloated", or when MEMORY.md is truncated / over the load limit.

40 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use ingest, resume and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • JaimeGBASkill

    ingest

    Digest an external source (article, paper, transcript, URL, book chapter) and integrate its content into the knowledge base

    Also in 4 projects that use this

  • genomewalkerSkill

    resume

    Resume a thread by loading its ~800-token context capsule

    Also in 3 projects that use this

  • MicrosoftSkill

    init

    Also in 4 projects that use this

  • Hugging FaceSkill

    simplify

    Refactor code after tests pass. The "Refactor" phase of Red-Green-Refactor.

    Also in 3 projects that use this

  • SentrySkill

    deslop

    Strip AI-generated noise from the diff before pushing — extra comments a human wouldn't write, defensive try/catch in trusted code paths, casts to any, inline imports in Python, and other style inconsistencies with the surrounding file. Use this immediately before commit so the diff stays clean.

    Also in 3 projects that use this

  • AnthropicSkill

    start

    Set up your bio-research environment and explore available tools. Use when first getting oriented with the plugin, checking which literature, drug-discovery, or visualization MCP servers are connected, or surveying available analysis skills before starting a new project.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 39 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read $MEMDIR/MEMORY.md (the index)

    line 43
  2. Very specific:

    Read the last ~5 session transcripts: ~/.claude/projects/<slug>/*.jsonl (newest by mtime)

    line 47
  3. Distinctive:

    Fix: all relative dates → absolute (today = run date)

    line 67
  4. Distinctive:

    Never: delete a topic file whose fact is still live just to save bytes — trim the index line instead.

    line 76

“Common” is measured: kept by at least 6 in 10 of the 39 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Dream — Memory consolidation

Replicate Anthropic's Dream feature. Consolidate the auto-memory so Claude gets smarter the longer it runs, not noisier.

Scope

DEFAULT  → current project's memory dir
all      → every project memory dir under ~/.claude/projects/*/memory/
<slug>   → a specific project, e.g. /dream -Users-you-Code-myproject

Memory lives per-project (no user-global memory.md in this setup):

MEMDIR="$HOME/.claude/projects/<project-slug>/memory"

Resolve current project slug from cwd: replace / with - in the absolute path (e.g. /Users/you/Code/myproject → -Users-you-Code-myproject).

The hard constraint

MEMORY.md is loaded into context every session. The harness truncates it past a ~24.4KB byte limit (NOT a line count).

Truncation already observed: "MEMORY.md is 34.3KB (limit: 24.4KB) — only part of it was loaded."

Primary win = get MEMORY.md under 24KB by shortening over-long index lines and moving detail into topic files. Each index entry: one line, under ~150 chars.

Procedure — 4 steps

1. Read existing memory

  • Read $MEMDIR/MEMORY.md (the index)
  • List $MEMDIR/*.md topic files; read any whose index line is suspect (duplicate/stale/contradiction candidates) — don't blind-read all if the dir is huge

2. Ground-truth against recent sessions

  • Read the last ~5 session transcripts: ~/.claude/projects/<slug>/*.jsonl (newest by mtime)
  • Skim for: facts that changed, decisions reversed, projects gone dormant, paths that moved
  • Goal: does memory match what the user actually does now?

3. Identify issues (report before changing)

Classify every problem found:

TypeExampleAction
Near-duplicatetwo files same topicmerge into one, keep richest
Contradiction"use X" vs "never X"keep the newer (check transcript dates), delete old
Staleproject marked active but dormant 60d+prune or mark paused
Relative date"by next Friday"convert to absolute (e.g. 2026-06-26)
Wrong-bucketcode convention / path in memoryremove (derivable from repo)
Verbose index line>150 chars in MEMORY.mdtrim; push detail to topic file
Dead pointerindex points to missing filefix or remove

4. Consolidate

  • Merge duplicate topic files; update/remove their index lines
  • Resolve contradictions (newer wins; cite transcript evidence in the kept file)
  • Fix all relative dates → absolute (today = run date)
  • Prune stale/wrong-bucket files (delete file + index line)
  • Trim MEMORY.md index: every line one-liner <150 chars, detail lives in topic .md
  • Re-check byte size: wc -c "$MEMDIR/MEMORY.md" must be < 24400 bytes. If still over, keep trimming the longest index lines.

Safety

  • Self-edit prompt: editing files inside .claude/ triggers a settings-edit permission ask even on bypass — expected, allow it.
  • Never invent facts to "fill gaps" — consolidate only what exists.
  • Never delete a topic file whose fact is still live just to save bytes — trim the index line instead.
  • Show the issue list (step 3) to the user before destructive merges/prunes if running interactively. In autonomous/cron runs, proceed and report.
  • Back up first: cp -r "$MEMDIR" "$MEMDIR.bak-$(date +%Y%m%d-%H%M)" then prune the .bak after the user confirms.

Output (terse)

Dream — <project-slug>
MEMORY.md: 34.3KB → 22.1KB (under 24.4KB limit ✓)
- merged: N files
- contradictions resolved: N
- dates fixed: N
- pruned: N
- index lines trimmed: N
Backup: memory.bak-YYYYMMDD-HHMM

Frequency

On-the-margin play — run when MEMORY.md nears the limit, or monthly. Optional cron:

0 9 1 * * cd <your-main-project> && claude --no-interactive "/dream"

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.