No slash command · from agent-memory
Persistent memory system using session dump, QMD vault search, and context re-injection across compactions. Helps debug context loss and understand memory architecture.
Ships in agent-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.
None: SKILL.md is the whole skill.
This plugin provides persistent memory across context compactions using three components:
Before Claude Code compacts context, the hook dumps the full conversation to a markdown file at $SESSIONS_DIR/{session_id}.md. It tracks how many lines have been processed so subsequent compactions append incrementally.
Configuration: Set SESSIONS_DIR env var (defaults to ~/sessions). Works best pointed at a directory inside a markdown vault so the notes become searchable.
QMD indexes your markdown vault locally (BM25 keyword search, semantic vector search, hybrid rerank). Runs entirely on-device using Metal GPU. The MCP server exposes search tools Claude can use during sessions.
Requires: qmd installed (bun install -g @tobilu/qmd or npm install -g @tobilu/qmd), vault indexed (qmd index /path/to/vault).
After compaction, this hook extracts key terms from the dumped session, queries QMD for relevant vault notes, and injects the results back into Claude's context. The agent maintains continuity without manual re-prompting.
Only fires after compaction (matcher: "compact"), not on fresh session starts.
Session active → context fills up → PreCompact dumps to markdown →
Claude compacts → SessionStart fires → QMD searches vault →
relevant context re-injected → session continues with memory
| Variable | Default | Purpose |
|---|---|---|
SESSIONS_DIR | ~/sessions | Where session dumps are written |
bun install -g @tobilu/qmdqmd index /path/to/vaultSESSIONS_DIR to a directory inside your vault (recommended)SESSIONS_DIR at a vault subdirectory (e.g., ~/notes/sessions/) so session dumps become searchable by QMDqmd index /path/to/vault &What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub k3nnethfrancis/agent-utils --plugin agent-memoryOther plugins' skills for the same job