Skip to main content
Every Cursor session starts fresh — your AI does not remember what it worked on yesterday. Claude-mem changes that. Your agent builds cumulative knowledge about your codebase, decisions, and patterns over time.

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:
  1. Session hooks capture tool usage, file edits, and shell commands
  2. AI extraction compresses observations into semantic summaries
  3. Context injection loads relevant history into each new session via .cursor/rules/claude-mem-context.mdc
  4. Memory viewer at http://localhost:37777 shows your knowledge base

Prerequisites

  • Bun: curl -fsSL https://bun.sh/install | bash
  • Cursor IDE
  • jq and curl: brew install jq curl
  • Bun: curl -fsSL https://bun.sh/install | bash
  • Cursor IDE
  • jq and curl: apt install jq curl or dnf install jq curl
  • 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:
If you are using Cursor without a Claude Code subscription, follow this path.
1

Clone and build

2

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)
3

Run the interactive setup wizard

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.
4

Verify installation

Then open http://localhost:37777 in your browser.
5

Restart Cursor

Restart Cursor IDE to load the new hooks. Start a coding session — context will begin being captured automatically.

npm Scripts Reference

All commands are run from the claude-mem repository directory:

Hook Mappings

The hooks.json file installed in .cursor/ maps Cursor events to bash (or PowerShell) scripts:

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:
1

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.
2

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.
3

After session ends (session-summary.sh)

When the agent loop ends, the stop hook runs session-summary.sh, which generates a session summary and then writes a fresh context file as a fallback to ensure nothing was missed.

Data Mapping

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

Start with Gemini’s free tier. It handles typical individual usage well. Switch to OpenRouter or Claude SDK if you need higher limits.

Comparison with Claude Code Integration

Troubleshooting

Worker not starting

Hooks not firing

  1. Restart Cursor IDE after installation
  2. Check hooks are installed: bun run cursor:status
  3. Verify hooks.json exists in .cursor/ (project-level) or ~/.cursor/ (user-level)
  4. Check Cursor Settings → Hooks tab for configuration errors
  5. Verify scripts are executable:

No context appearing

  1. Ensure worker is running: bun run worker:status
  2. Confirm worker responds: curl http://127.0.0.1:37777/api/readiness
  3. Check for existing observations: visit http://localhost:37777
  4. 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