Command Manage

/dr-dream

Knowledge base maintenance, organization, and consolidation

Overview

/dr-dream is knowledge base maintenance — like sleep consolidating memory in the brain. The Librarian agent scans the entire datarim/ directory, identifies structural issues, builds cross-references between documents, flags contradictions, and proposes consolidation actions. It can run in three modes: full maintenance, lint-only, or index rebuild.

Usage

/dr-dream
/dr-dream lint
/dr-dream index

Modes

  • /dr-dream (full) — ingest check, lint, build index, consolidate proposals. Takes 2-5 minutes.
  • /dr-dream lint — health check only, no changes. About 1 minute.
  • /dr-dream index — rebuild datarim/index.md only. About 30 seconds.

What It Does

  1. Inventory — scans all .md files in datarim/ recursively. Records path, size, frontmatter, directory, and inbound/outbound links.
  2. Ingest Check — finds files in wrong directories, missing task IDs in filenames, missing frontmatter, broken internal links, and inconsistent naming.
  3. Lint — detects contradictions between documents, stale references (completed tasks marked active), orphan files (no inbound links), duplicates (over 70% overlap), broken cross-references, empty directories, and oversized files.
  4. Build Index — creates or updates datarim/index.md cataloging all documents by type, grouped by tags, with recent activity and knowledge graph metrics.
  5. Consolidate (full mode) — proposes structural improvements: merge duplicates, extract recurring themes into pattern docs, archive stale content, add bidirectional cross-references, fill in missing frontmatter, and fix naming conventions.
  6. Report and Apply — presents the Dream Report with health status, issue counts, and proposals. Waits for approval before applying any changes.

When to Run

  • After many tasks — when datarim/ has grown disorganized
  • After /dr-archive — auto-suggested if over 5 documents were created since last dream
  • Before a new project phase
  • Every 10-15 completed tasks as routine maintenance

Example Session

> /dr-dream

=== KNOWLEDGE BASE INVENTORY ===
Total documents: 42
By type: PRDs: 5, Tasks: 3, Reflections: 8, QA: 4, Archives: 15, Other: 7
With frontmatter: 35/42 (83%)
Orphans (no inbound links): 4

=== LINT ===
  1 contradiction found
  4 orphan files
  2 broken links
  1 duplicate pair (72% overlap)

=== CONSOLIDATION PROPOSALS ===
1. [merge] Merge reflection-API-0001.md and reflection-API-0002.md
2. [archive] Move 3 completed task docs to archive/
3. [cross-ref] Add 6 bidirectional links
4. [frontmatter] Add metadata to 7 documents
5. [rename] Fix naming for 2 files

Which proposals should I apply? (all / none / 1,3,4)

Related Commands

  • /dr-archive — may suggest running /dr-dream after archiving
  • /dr-optimize — optimizes the framework itself, not the knowledge base
  • /dr-init — start next task after cleanup