docs/public/usage/getting-started.mdx
Claude-Mem works automatically once installed. No manual intervention required!
Every time Claude uses a tool, claude-mem captures it:
The worker service processes tool observations and extracts:
When Claude finishes responding (triggering the Stop hook), a summary is automatically generated with:
When you start a new Claude Code session, the SessionStart hook:
Summary Display Logic:
The most recent summary's full details appear at the end of the context display only when the summary was generated after the most recent observation. This ensures you see summary details when they represent the latest state of your project, but not when new observations have been captured since the last summary.
For example:
This prevents showing stale summaries when new work has been captured but not yet summarized.
This means Claude "remembers" what happened in previous sessions!
The worker auto-starts on the first SessionStart hook, so you usually don't need these commands. They're handy for diagnostics.
# Start worker service (optional - auto-starts automatically)
npm run worker:start
# Stop worker service
npm run worker:stop
# Restart worker service
npm run worker:restart
# View worker logs
npm run worker:logs
# Check worker status
npm run worker:status
# Run all tests
npm test
# Test context injection
npm run test:context
# Verbose context test
npm run test:context:verbose
# Build hooks and worker
npm run build
# Build only hooks
npm run build:hooks
# Publish to NPM (maintainers only)
npm run publish:npm
Context is stored in SQLite database at ~/.claude-mem/claude-mem.db.
Query the database directly:
# Open database
sqlite3 ~/.claude-mem/claude-mem.db
# View recent sessions
SELECT session_id, project, created_at, status
FROM sdk_sessions
ORDER BY created_at DESC
LIMIT 10;
# View session summaries
SELECT session_id, request, completed, learned
FROM session_summaries
ORDER BY created_at DESC
LIMIT 5;
# View observations for a session
SELECT tool_name, created_at
FROM observations
WHERE session_id = 'YOUR_SESSION_ID';
Context injection uses progressive disclosure for efficient token usage:
This ensures efficient token usage while maintaining access to complete history when needed.
/clear BehaviorClaude-Mem supports sessions that span multiple user prompts:
/clearWhen you use /clear, the session doesn't end - it continues with a new prompt number. This means:
source: "clear")The /clear command clears the conversation context visible to Claude AND re-injects fresh context from recent sessions, while the underlying session continues tracking observations.
Claude-Mem provides MCP tools for querying your project history. Simply ask naturally:
"What bugs did we fix last session?"
"How did we implement authentication?"
"What changes were made to worker-service.ts?"
"Show me recent work on this project"
Claude automatically recognizes your intent and invokes the MCP search tools, which use a 3-layer workflow (search → timeline → get_observations) for efficient token usage.