Persistent memory for Cursor using mem0.ai - remembers context across conversations.
- Auto-Save Every Prompt: Each prompt is automatically saved to mem0
- Automatic Memory Retrieval: Relevant memories are injected before each prompt
- Conversation Storage: Full conversations saved when sessions end
- Semantic Search: Vector-based search for intelligent memory retrieval
cp -r .cursor /path/to/your/project/Or for global installation:
cp -r .cursor ~/.cursor/pip install mem0aiCreate a .env file in your project or globally in ~/.cursor/.env:
MEM0_API_KEY=your-api-key-here
MEM0_USER_ID=cursor-user
# Optional
MEM0_TOP_K=5
MEM0_THRESHOLD=0.3
MEM0_AUTO_SAVE=truePriority: Project .env overrides global ~/.cursor/.env
Get your API key from app.mem0.ai
The hooks will be active after restart.
.cursor/
├── hooks.json # Hook configuration
└── hooks/
├── memory_retrieve.py # Memory retrieval + auto-save
└── memory_save.py # Session-end save
- Searches mem0 for relevant memories
- Injects them as context
- Auto-saves the prompt to mem0
- Extracts recent messages from conversation
- Saves them to mem0 for future retrieval
| Variable | Description | Default |
|---|---|---|
MEM0_API_KEY |
Your mem0 API key (required) | - |
MEM0_USER_ID |
User identifier | cursor-user |
MEM0_TOP_K |
Memories to retrieve | 5 |
MEM0_THRESHOLD |
Similarity threshold | 0.3 |
MEM0_AUTO_SAVE |
Auto-save prompts | true |
MEM0_SAVE_MESSAGES |
Messages to save on stop | 10 |
Run the test suite:
pip install pytest
python -m pytest tests/ -vMIT