how-it-works
thedotmack/claude-mem
Auto-capture observations from reads, edits, and bash commands; inject relevant context into future sessions.
What is how-it-works?
claude-mem automatically records observations from your file reads, edits, and bash commands, summarizes them at session end, and injects relevant context into future sessions so you start with prior work context. Use it to avoid re-explaining codebases and re-discovering decisions across sessions.
- Captures observations from every Read, Edit, and Bash command Claude makes
- Compresses and summarizes observations at the end of each session
- Auto-injects relevant past observations into future prompts
- Optionally front-loads entire repository context with /learn-codebase command
- Stores all data locally in ~/.claude-mem with no data leaving your machine except for compression API calls
How to install how-it-works
npx skills add https://github.com/thedotmack/claude-mem --skill how-it-worksHow to use how-it-works
- 1.Install the skill with: npx skills add https://github.com/thedotmack/claude-mem --skill how-it-works
- 2.Complete your first session in a project to seed memory
- 3.Start a second session; relevant observations will auto-inject into prompts
- 4.Optionally run /learn-codebase to front-load entire repository context (~5 minutes)
Use cases
- Starting a second session in a project and receiving auto-injected context from prior work
- Avoiding re-explanation of codebase structure and architecture across multiple sessions
- Recovering context about past decisions and changes without manual notes
- Front-loading a new project's entire codebase into memory for faster subsequent sessions
- Maintaining project continuity when switching between different coding tasks
- Developers working on multi-session projects
- Teams using Claude Code or Cursor for extended codebases
- Anyone wanting persistent context across separate coding sessions
how-it-works FAQ
Memory injection begins on your second session in a project. The first session seeds the memory; subsequent sessions receive auto-injected context.
All data lives locally in ~/.claude-mem on your machine. Nothing leaves your machine except API calls to your configured AI provider (Claude, OpenRouter, or Gemini) for compression.
Every Read, Edit, and Bash command Claude makes is captured and turned into a compressed observation.
Yes, run /learn-codebase to front-load the entire repository into memory in a single pass, which takes approximately 5 minutes.
Yes, running npx claude-mem uninstall cleanly removes the SQLite database, vector index, logs, and all settings from ~/.claude-mem.
Full instructions (SKILL.md)
Source of truth, from thedotmack/claude-mem.
name: how-it-works description: Explain how claude-mem captures observations, when memory injection kicks in, and where data lives. Use when the user asks "how does claude-mem work?" or "what is this thing doing?".
How claude-mem works
What it does
Every Read, Edit, and Bash that Claude makes turns into a compressed observation. Observations get summarized at session end. Relevant ones get auto-injected into future prompts so the next session starts with context from the last one — no re-explaining the codebase, no re-discovering decisions.
When it kicks in
Memory injection starts on your second session in a project.
The first session in a fresh project seeds memory; subsequent sessions receive auto-injected context for relevant past work. Run /learn-codebase if you want to front-load the entire repo into memory in a single pass (~5 minutes, optional).
Where data lives
Everything stays in ~/.claude-mem on this machine.
Nothing leaves your machine except calls to whichever AI provider you configured for compression (Claude / OpenRouter / Gemini). The SQLite database, vector index, logs, and settings all live under that directory and are removed cleanly on npx claude-mem uninstall.
Related skills
More from thedotmack/claude-mem and the wider catalog.

knowledge-agent
Build and query AI-powered knowledge bases from your observation history to create focused "brains" on specific topics.

learn-codebase
Systematically read every source file to build deep codebase understanding.

make-plan
Create detailed, phased implementation plans with documentation discovery before execution.

mem-search
Search persistent cross-session memory to find previous solutions and past work.

oh-my-issues
Cluster GitHub issues by root cause into plan-master issues and ship atomic fixes per cluster.

pathfinder
Map codebases into feature flowcharts, identify duplication, and propose unified architecture.