/session-tools:dreamfrom Session & Memory
Consolidates Claude Code's memory files and optional Second Brain vector database: supersedes outdated facts, decays stale entries, prunes noise, promotes important patterns, and rebuilds the memory graph. No new input required.
Ships in Session & Memory. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You are performing a dream — a reflective pass over your memory files AND the Second Brain database. Synthesize what you've learned recently into durable, well-organized memories so that future sessions can orient quickly.
Memory directory: ~/.claude/projects/C--Users-<твой-логин>/memory/
(имя папки Claude Code кодирует из пути проекта — посмотри ls ~/.claude/projects/)
Second Brain — отдельный компонент, в пак он НЕ входит. Это локальная векторная база памяти со своим CLI (
~/.brain/brain_sleeptime.py) и MCP-серверомsecond-brain. Проверить одной командой:ls ~/.brain/brain_sleeptime.py. Нет — пропускай Фазы 0, 6, 7 целиком: файловая консолидация (Фазы 1–5) самодостаточна и это законный полный прогон dream. В отчёте так и напиши: «Second Brain не установлен, фазы 0/6/7 пропущены».
Boundary with
memory-agent,save-knowledge-base,graph-memory— all four work the same store. What sets dream apart is that it needs no new input from the user: it only reworks what is already written — supersede, decay, prune, promote, TOP-INSTINCTS, brain sleeptime — and it rebuilds the graph (memory_graph.py build) thatgraph-memorythen queries. Writing needs a different skill: a ready document plus named trigger words →save-knowledge-base; an observation with no obvious home →memory-agentpicks the layer. Asking about connections or chronology →graph-memory(read-only). Rule of thumb: nothing to add, just tidy up → dream; anything that adds new content → one of the other three.
Full v2 regulation (frontmatter schema, supersede protocol, decay/prune/promote formulas, TOP-INSTINCTS block format): references/memory-v2.md. Read it before Phases 2–5.
Related pattern (reference only, not installed): references/pi-llm-wiki-layered-pattern.md — 4-layer wiki architecture (immutable source packets / editable pages / auto metadata / config) mapped against our own bi-temporal system; flags one low-cost addition worth considering (append-only events.jsonl audit log for dream's own actions).
supersedes:, old note gets status: superseded / superseded_by: / invalid_at:. Only the index (MEMORY.md) swaps pointers freely.MEMORY.md ≤200 lines and ≤~25KB; index lines ≤~200 chars.status: pending, не канон.Capture brain state BEFORE consolidation so we can report the delta.
brain_stats MCP tool (server: second-brain)ls the memory directory to see what already existsMEMORY.md to understand the current indexПервый запуск — баз ещё нет, и это нормально. Пак приезжает без чужой памяти: каталога
~/.claude/projects/<project>/memory/нет,MEMORY.mdнет, графа~/.claude/memory-graph/graph.dbнет, индекса чатов~/.claude/chats.dbнет. Ничего скачивать не надо — всё это создаётся из твоих же данных:
- каталог памяти и
MEMORY.md— создай при первой же записи (обычныйmkdir+ файл с заголовком# Memory); дальше их ведёт сам dream;graph.db— соберётся из заметок командойpython ~/.claude/scripts/memory_graph.py build(Фаза 5). На пустом каталоге заметок она отработает и вернёт пустой граф — это не ошибка;chats.db— соберётся из твоих транскриптов командойpython ~/.claude/tools/search_chats.py index. Пока её не запускал, Фаза 2b искать негде — пропусти её и напиши в отчёте «индекс чатов не собран».Пустая память = «консолидировать нечего», а не сбой. Отчёт всё равно верни.
Look for new information worth persisting and old information that drifted. Sources in priority order:
Don't exhaustively read everything. Look only for things you already suspect matter.
For every conflict found — mark it for the supersede protocol in Phase 3. Do NOT resolve conflicts by deleting or rewriting the older note.
Фазы 1-2 смотрят только на то, что УЖЕ записано. Отдельный слой сырья — транскрипты прошлых сессий: там лежат уроки, которые в заметки не попали вовсе. Запускай этот проход, когда dream вызван с фокусом («dream по проекту X», «что я вынес за неделю») или когда сессий прошло много, а новых заметок почти нет.
search_chats.py search "<тема>" --days N → timeline <id> → get <id,id> только по отобранным якорям. Тот же принцип, что и с любыми большими данными: сузить, потом читать.status: pending. Ссылку на сессию-источник клади в evidence.Кандидатный слой для крупной реорганизации. Если проход переписывает не пару файлов, а перекладывает структуру памяти — пиши сначала в _candidate/, сравни с живыми файлами, и только после просмотра принимай (принятое переносится, отклонённый кандидат удаляется целиком). Для точечных правок это лишняя церемония — там действует anti-churn.
For each thing worth updating:
id, valid_at, supersedes: [old-id]); in the old note set only status: superseded, superseded_by:, invalid_at: — body stays intact. Trivial typos/paths may be fixed in place without ceremony.id, type, status, trigger, action, confidence, evidence, valid_at/invalid_at, last_confirmed, discovery_tokens — see references/memory-v2.md §1). Never migrate untouched notes in bulk.evidence, set last_confirmed, optionally +0.05 confidence (cap 0.98)Apply the lifecycle math from references/memory-v2.md §3–5:
effective_confidence = confidence − 0.02 × weeks_since(last_confirmed || valid_at), floor 0.05. Compute in-flight; persist into a file only if you're writing it anyway or the value crosses an action threshold (anti-churn).status: pending + older than 30 days + effective confidence < 0.3 → move file to _archive/, drop its index line. Never prune superseded notes (they are history) or live references.project note confirmed in ≥3 distinct sessions AND genuinely cross-project → copy to global memory dir as user/feedback, index it globally, mark the project copy status: promoted.Rebuild TOP-INSTINCTS (no hook — dream itself does this every pass):
type: feedback, status: active notes; rank by effective (decayed) confidence, tie-break by newer last_confirmed; take top K=7 (5–10 ok)<!-- TOP-INSTINCTS:BEGIN --> and <!-- TOP-INSTINCTS:END --> markers in MEMORY.md (insert the marked block after the intro if missing). Line format: N. `conf` trigger → action — [id](file.md). Exact format and idempotency rules: references/memory-v2.md §6Then update the rest of MEMORY.md so it stays under 200 lines AND ~25KB:
RULES — ALWAYS APPLY section stays hand-curated — TOP-INSTINCTS complements it, doesn't replace itRebuild memory graph (Layer 1 — after note/link/supersede changes settle): python ~/.claude/scripts/memory_graph.py build, then dangling + orphans — dangling [[links]] (target has no note) and high-degree orphans are hygiene signals: create the missing note, fix a name mismatch, or link the orphan. The graph (~/.claude/memory-graph/graph.db) powers recall routing «что связано с / хронология / что заместило».
After file-based consolidation, run the Second Brain sleeptime pipeline.
Нет ~/.brain/brain_sleeptime.py — фаза пропускается, это не ошибка.
python ${HOME}/.brain/brain_sleeptime.py run
This executes the full consolidation pipeline:
python ${HOME}/.brain/brain_sleeptime.py insights
This produces data-driven insights: hot entities, frequent memories, contact patterns, memory growth, pending vectorization.
Second Brain sleeptime can be run manually:
cd ${HOME}/.brain python brain_sleeptime.py run python brain_sleeptime.py insights
Без Second Brain отчёт состоит из одной секции «File Memory (Phases 1-5)», а секции «Second Brain Sleeptime» и «Brain Stats Delta» опускаются.
brain_stats MCP tool again to capture post-consolidation stateFile Memory (Phases 1-5):
Second Brain Sleeptime (Phase 6):
Brain Stats Delta:
| Metric | Before | After | Delta |
|---|---|---|---|
| Memories | X | Y | +/-Z |
| Contacts | X | Y | +/-Z |
| Chunks pending | X | Y | +/-Z |
| Commitments | X | Y | +/-Z |
| Awaiting | X | Y | +/-Z |
Return the full Dream Report above. If file memories were already tight, say so — that is a valid outcome (anti-churn). If brain sleeptime had errors in any step, report which steps succeeded and which failed.
What SKILL.md sets; muted values are Claude Code's defaults
8 skills in this plugin
/away-summaryПересказ «пока тебя не было»: на чём остановились и что сделано в сессии. Триггеры: «где остановился», «recap», «while you were away»./btwБыстрый ответ на побочный вопрос — коротко и назад к основной задаче. Триггеры: «кстати», «/btw», «side question»./memory-agentОркестратор 4 слоёв памяти: файлы, граф, чаты, семантика. Триггеры: «запомни», «что решали про». НЕ: готовый документ→save-knowledge-base; уборка→dream; связи→graph-memory./save-knowledge-baseСохраняет долговременную инструкцию/справочник в 4 уровня памяти под триггеры будущих сессий. Триггеры: «запомни эту инструкцию», «чтобы не забыл»./self-reflectРазбор недавних ошибок и паттернов, генерация правок для rules/skills. Триггеры: «проанализируй себя», «какие ошибки повторяются»./session-mentorЛокальный анализ сессий Claude Code → HTML-отчёт «как ты работаешь». Триггеры: «как я работаю», «где теряю время». НЕ поиск по чатам→/search-chats.npx claudepluginhub jhamidun/claude-code-config-pack --plugin session-toolsOther plugins' skills for the same job