From kb
Consolidates a markdown knowledge base — merges near-duplicates, flags contradictions, prunes stale notes, ingests inbox, and rebuilds the index. Use when KB is noisy or stale, or to forget notes.
How this skill is triggered — by the user, by Claude, or both
Slash command
/kb:dreamThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Dream is the maintenance pass that keeps a markdown knowledge base compact and
Dream is the maintenance pass that keeps a markdown knowledge base compact and
retrievable — the agent equivalent of sleep consolidating the day's memories. Run it when
the KB feels noisy (duplicates, contradictions, sprawl, stale facts), on a schedule, or
to forget specific notes. Everything is proposed as a diff first; nothing changes until
you approve (or you run --auto).
Dream is KB-agnostic and generic. It never assumes a fixed location.
dream [<path>] — consolidate the KB at <path>. If omitted, use $KB_DIR; if that
is unset, ask for the path. Examples: dream ./docs/kb, dream $KB_DIR.dream --auto [<path>] — non-interactive: apply merges and prunes silently, skip
contradictions (they need human judgment), guarded by a lock file.dream forget "<query>" [<path>] — find notes matching a query and propose deletion
(same diff-for-approval flow as consolidation).A note is any *.md file with YAML frontmatter. Map missing fields gracefully:
---
name: type-short-slug # equals the filename stem
description: one line, keyword-front-loaded
type: tech # user | feedback | project | reference | tech | ...
tags: [topic, topic]
sources: ["https://example.com/llms.txt"]
created: 2026-06-01
updated: 2026-06-13
pinned: false # optional — pinned notes are never pruned or merged
confidence: 0.8 # optional — 0..1; low + generic => prune candidate
---
type => unknown. No created/updated => use file mtime. No confidence =>
neutral. No pinned => false.Work in memory until the apply step; modify nothing early.
<path> holds memory/ (notes) and ideally MEMORY.md
(index), raw/inbox/ (captures), raw/ (source docs), and a state file. If the
layout differs, operate on whatever *.md files exist and adapt.raw/inbox/*, source docs, and state.raw/inbox/* into memory/
(create or merge notes). Delete inbox files once distilled (they are ephemeral). Keep
raw/ source docs (immutable ground truth); record processed ones in state.type. Two notes are
near-duplicates when: same type; significant-noun overlap above ~60% (a proxy for
cosine similarity > 0.9); neither is pinned. Draft a merged note that is more
complete and specific than either, keeping the clearest, most recent phrasing.
Lossless of meaning, not of words.--auto.<type>-<slug>.md.name (equals filename stem), description,
type, tags, created, updated. Fix the <type>- filename prefix if the type
changed. No nested metadata: blocks.sources: URL whose updated: is stale
(older than ~30 days) or whose facts look outdated, fetch the source (prefer
llms.txt), update the note, bump updated:. Skip silently when offline.type has a retention policy and it is older than the policy's days (compare
created/updated to today);confidence is below 0.3 AND it has no project-unique info (no paths,
identifiers, or domain nouns);pinned: true. Prefer refreshing (step 8) over deleting merely because
a note is old.[[slug]] references; ensure no orphans (each note links
at least one other); merge tag sprawl into the controlled vocabulary; drop links to
deleted notes.MEMORY.md from surviving notes, grouped by type,
one line each: [Title](file) — hook.state.last_dream to today.Default per-type retention, in days (null means keep forever). Override via a
retention: map in the KB's state or config file.
feedback: 180project: nullreference: nulltech: 365user: nullunknown: 90Print exactly this before any change. Omit any section that has zero items.
## dream — consolidation report
Merges (<N>):
[note:<file1>] + [note:<file2>] -> "<merged summary, ~80 chars>"
Conflicts (<N>):
[note:<fileA>] vs [note:<fileB>] — "<topic>" [A/B/skip]
Prune (<N>):
[note:<file>] — <type>, <age>d old
Inbox ingested (<N>), refreshed (<N>), split (<N>), relinked (<N>).
Proposed: <N> merges, <N> prunes, <N> conflicts. Apply? [Y/n]
If there are zero proposals, print Dream complete. No duplicate, contradictory, or stale notes found. and stop.
A, B, or skip (empty input = skip).Apply? [Y/n]. n or no prints Cancelled. No changes made. and
stops.<type>-<slug>.md; type and updated = today;
confidence = the higher of the two originals; a source: dream marker), delete
both originals, and rewrite inbound links to point at the merged slug.--auto)${TMPDIR:-/tmp}/dream_auto.lock. If it
exists and is less than 10 minutes old, print
[dream --auto] another run in progress — skipping. and stop. Otherwise write the lock
(current timestamp); delete it on every exit path.[dream --auto] kb=<path> merged=<N> pruned=<N> conflicts_skipped=<N>.dream to resolve them. First search for an existing dream-auto reminder
(by source: dream-auto); skip storing if one already exists.dream forget "<query>" [<path>] searches notes by keyword and semantic match, lists
them, and proposes deletion as a diff:
[note:<file>] — "<title>" [Y/n]
Apply only approved deletions (and their index lines). Pinned notes are listed but not deleted unless explicitly confirmed per note.
description lets an agent judge relevance from the index
alone; every note is reachable via tags and [[links]].$KB_DIR; never assumed a fixed location.--auto).[[links]].--auto).DREAM.md or AGENTS.md, read it first and align with its note
format, controlled vocabulary, and sync steps.Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub duyet/codex-claude-plugins