From agent-memory
Provides persistent memory for Claude Code across context compactions using session dumps to markdown, QMD vault search, and re-injection. Use for memory architecture discussions, context loss debugging, or agent-memory explanations.
How this skill is triggered — by the user, by Claude, or both
Slash command
/agent-memory:session-memoryThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
This plugin provides persistent memory across context compactions using three components:
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 &npx claudepluginhub k3nnethfrancis/agent-utils --plugin agent-memoryExplains how claude-mem captures observations, injects relevant memory across sessions, and stores data locally in SQLite.
Persistent memory system for Claude Code with hot cache, knowledge wiki, and end-of-day synthesis. Prevents context loss across sessions.
Captures Claude Code sessions, extracts decisions and lessons via the Claude Agent SDK, and compiles them into structured knowledge articles for persistent memory across sessions.