Free to Start
Works with Gemini’s free tier (1,500 req/day) — no subscription required
Automatic Capture
MCP tools, shell commands, and file edits logged without effort
Smart Context
Relevant history injected into every chat session via Cursor Rules
Works Everywhere
With or without a Claude Code subscription
No Claude Code subscription required. Use Gemini (free tier) or OpenRouter as your AI provider.
How It Works
Claude-mem integrates with Cursor through native hooks:- Session hooks capture tool usage, file edits, and shell commands
- AI extraction compresses observations into semantic summaries
- Context injection loads relevant history into each new session via
.cursor/rules/claude-mem-context.mdc - Memory viewer at
http://localhost:37777shows your knowledge base
Prerequisites
macOS
macOS
- Bun:
curl -fsSL https://bun.sh/install | bash - Cursor IDE
jqandcurl:brew install jq curl
Linux
Linux
- Bun:
curl -fsSL https://bun.sh/install | bash - Cursor IDE
jqandcurl:apt install jq curlordnf install jq curl
Windows
Windows
- Bun:
powershell -c "irm bun.sh/install.ps1 | iex" - Cursor IDE
- PowerShell 5.1+ (included in Windows 10/11)
- Git for Windows
Installation Paths
Choose the installation method that fits your setup:- Cursor-Only (No Claude Code)
- Claude Code Users
- Windows
If you are using Cursor without a Claude Code subscription, follow this path.The wizard detects that you do not have Claude Code, helps you choose and configure a free AI provider, installs hooks automatically, and starts the worker service.
Configure your AI provider
Since you do not have Claude Code, you need to configure an AI provider for claude-mem’s summarization engine.Option A: Gemini (Recommended — Free Tier)Gemini offers 1,500 free requests per day, which is plenty for typical individual use.Get your free API key at aistudio.google.com/apikey.Option B: OpenRouter (100+ Models)Free models available on OpenRouter include
google/gemini-2.0-flash-exp:free and xiaomi/mimo-v2-flash:free.Option C: Claude API (API Credits Without Claude Code)Run the interactive setup wizard
npm Scripts Reference
All commands are run from theclaude-mem repository directory:
| Command | Description |
|---|---|
bun run cursor:setup | Interactive setup wizard — configures provider and installs hooks |
bun run cursor:install | Install Cursor hooks for the current project |
bun run cursor:install -- user | Install Cursor hooks for all projects (user-level) |
bun run cursor:uninstall | Remove Cursor hooks |
bun run cursor:status | Check hook installation status |
bun run worker:start | Start the worker service in the background |
bun run worker:stop | Stop the worker service |
bun run worker:restart | Restart the worker service |
bun run worker:status | Check worker status |
bun run worker:logs | View worker logs (last 50 lines) |
Hook Mappings
Thehooks.json file installed in .cursor/ maps Cursor events to bash (or PowerShell) scripts:
| Cursor Hook | Script | Purpose |
|---|---|---|
beforeSubmitPrompt | session-init.sh | Initialize claude-mem session using conversation_id |
beforeSubmitPrompt | context-inject.sh | Ensure worker is running; refresh context file |
afterMCPExecution | save-observation.sh | Capture MCP tool usage |
afterShellExecution | save-observation.sh | Capture shell command execution |
afterFileEdit | save-file-edit.sh | Capture file edits as write_file observations |
stop | session-summary.sh | Generate summary + update context file for next session |
Context Injection
Context is automatically injected via Cursor’s Rules system — no manual steps required after installation.How the Context File Works
The file at.cursor/rules/claude-mem-context.mdc has alwaysApply: true set in its frontmatter, so Cursor includes it in every chat session automatically.
When Context Updates
Context is refreshed at three points per session for maximum freshness:Before each prompt (context-inject.sh)
When you submit a prompt,
context-inject.sh runs. It fetches the latest context from /api/context/inject and rewrites .cursor/rules/claude-mem-context.mdc. Cursor reads this file before passing it to the LLM.After summary completes (worker auto-update)
Immediately after a summary is saved to the database, the worker checks if the project is registered for Cursor and writes the updated context file automatically — no hook involved.
Data Mapping
| Cursor Field | Claude-Mem Field | Notes |
|---|---|---|
conversation_id | contentSessionId | Stable across turns, used as primary session identifier |
generation_id | (fallback) | Used if conversation_id is unavailable |
workspace_roots[0] | Project name | Basename of workspace root directory |
Additional Context Access Methods
MCP Tools
Configure claude-mem’s MCP server in Cursor for
search(query, project, limit), timeline(anchor, depth_before, depth_after), and get_observations(ids) tools.Web Viewer
Browse your full memory at
http://localhost:37777 — search, filter by project, view timelines.Provider Comparison
| Provider | Cost | Rate Limit | Best For |
|---|---|---|---|
| Gemini | Free tier | 1,500 req/day | Individual use, getting started |
| OpenRouter | Pay-per-use + free models | Varies by model | Model variety, high volume |
| Claude SDK | Included with Claude Code | Unlimited | Claude Code subscribers |
Comparison with Claude Code Integration
| Feature | Claude Code | Cursor |
|---|---|---|
| Session initialization | SessionStart hook | beforeSubmitPrompt hook |
| Context injection | additionalContext field (immediate) | Auto-updated .cursor/rules/ file |
| Observation capture | PostToolUse hook | afterMCPExecution, afterShellExecution, afterFileEdit |
| Session summary | Stop hook with transcript | stop hook (no transcript access) |
| MCP search tools | Full support | Full support (if MCP configured) |
| Context persistence | Session only | File-based (persists across IDE restarts) |
Troubleshooting
Worker not starting
Hooks not firing
- Restart Cursor IDE after installation
- Check hooks are installed:
bun run cursor:status - Verify
hooks.jsonexists in.cursor/(project-level) or~/.cursor/(user-level) - Check Cursor Settings → Hooks tab for configuration errors
- Verify scripts are executable:
No context appearing
- Ensure worker is running:
bun run worker:status - Confirm worker responds:
curl http://127.0.0.1:37777/api/readiness - Check for existing observations: visit
http://localhost:37777 - Verify your API key is configured correctly in
~/.claude-mem/settings.json
Observations not being saved
Test the observation endpoint directly:Rate limiting on Gemini free tier
If you hit the 1,500 requests/day limit:- Wait until the next day (limit resets at midnight Pacific)
- Switch to OpenRouter with a paid or free model
- Upgrade to a paid Gemini plan
Windows: “Execution of scripts is disabled”
Run PowerShell as Administrator:Windows: Worker not responding
Check if port 37777 is in use:Next Steps
Gemini Setup Guide
Step-by-step guide to configure Gemini’s free tier
OpenRouter Setup Guide
Configure OpenRouter for 100+ model options
Configuration Reference
All available settings and options
Troubleshooting
Common issues and solutions