Getting Started with Claude-Mem
Automatic Operation
Claude-Mem works automatically once installed. No manual intervention required!The Full Cycle
- Start Claude Code - Context from last 10 sessions appears automatically
- Work normally - Every tool execution is captured
- Claude finishes responding - Stop hook automatically generates and saves a summary
- Next session - Previous work appears in context
What Gets Captured
Every time Claude uses a tool, claude-mem captures it:- Read - File reads and content access
- Write - New file creation
- Edit - File modifications
- Bash - Command executions
- Glob - File pattern searches
- Grep - Content searches
- And all other Claude Code tools
What Gets Processed
The worker service processes tool observations and extracts:- Title - Brief description of what happened
- Subtitle - Additional context
- Narrative - Detailed explanation
- Facts - Key learnings as bullet points
- Concepts - Relevant tags and categories
- Type - Classification (decision, bugfix, feature, etc.)
- Files - Which files were read or modified
Session Summaries
When Claude finishes responding (triggering the Stop hook), a summary is automatically generated with:- Request - What you asked for
- Investigated - What Claude explored
- Learned - Key discoveries and insights
- Completed - What was accomplished
- Next Steps - What to do next
Context Injection
When you start a new Claude Code session, the SessionStart hook:- Queries the database for recent observations in your project (default: 50)
- Retrieves recent session summaries for context
- Displays observations in a chronological timeline with session markers
- Shows full summary details (Investigated, Learned, Completed, Next Steps) only if the summary was generated after the last observation
- Injects formatted context into Claude’s initial context
- ✅ Shows summary: Last observation at 2:00 PM, summary generated at 2:05 PM → Summary details appear
- ❌ Hides summary: Summary generated at 2:00 PM, new observation at 2:05 PM → Summary details hidden (outdated)
Manual Commands (Optional)
Worker Management
v4.0+ auto-starts the worker on first session. Manual commands below are optional.Testing
Development
Viewing Stored Context
Context is stored in SQLite database at~/.claude-mem/claude-mem.db.
Query the database directly:
Understanding Progressive Disclosure
Context injection uses progressive disclosure for efficient token usage:Layer 1: Index Display (Session Start)
- Shows observation titles with token cost estimates
- Displays session markers in chronological timeline
- Groups observations by file for visual clarity
- Shows full summary details only if generated after last observation
- Token cost: ~50-200 tokens for index view
Layer 2: On-Demand Details (Skill-Based Search)
- Ask naturally: “What bugs did we fix?” or “How did we implement X?”
- Claude auto-invokes search skill to fetch full details
- Search by concept, file, type, or keyword
- Timeline context around specific observations
- Token cost: ~100-500 tokens per observation fetched
- Skill uses HTTP API (v5.4.0+) for efficient retrieval
Layer 3: Perfect Recall (Code Access)
- Read source files directly when needed
- Access original transcripts and raw data
- Full context available on-demand
Multi-Prompt Sessions & /clear Behavior
Claude-Mem supports sessions that span multiple user prompts:
- prompt_counter: Tracks total prompts in a session
- prompt_number: Identifies specific prompt within session
- Session continuity: Observations and summaries link across prompts
Important Note About /clear
When you use /clear, the session doesn’t end - it continues with a new prompt number. This means:
- ✅ Context is re-injected from recent sessions (SessionStart hook fires with
source: "clear") - ✅ Observations are still being captured and added to the current session
- ✅ A summary will be generated when Claude finishes responding (Stop hook fires)
/clear command clears the conversation context visible to Claude AND re-injects fresh context from recent sessions, while the underlying session continues tracking observations.
Searching Your History (v5.4.0+)
Claude-Mem now uses skill-based search for querying your project history. Simply ask naturally:Next Steps
- Skill-Based Search - Learn how to search your project history
- Architecture Overview - Understand how it works
- Troubleshooting - Common issues and solutions

