---
description: Memory management rules for Cursor AI assistant
globs: ["**/*"]
alwaysApply: true
---
# Memory Management
You have access to a persistent memory system via the `cursor-memory` MCP server. Use it to remember important information across sessions.
## On Session Start
At the beginning of each conversation, **check your memory** by calling `memory_recall` with the current project path. This loads all relevant context from previous sessions.
```
memory_recall({ project_id: "<current_workspace_path>" })
```
## Recognizing Memory Commands
When the user says any of the following (or similar), they want you to store a memory:
- "Remember this"
- "Add this to your memory"
- "Store this"
- "Don't forget that..."
- "Keep in mind that..."
- "Note that..."
When the user says any of the following, they want you to search memory:
- "Check your memory for..."
- "Do you remember..."
- "What did I say about..."
- "What do you know about..."
## Storing Memories
Before storing a memory, you MUST:
1. **Optimize the content**: Rewrite the user's input to be:
- Concise (remove filler words)
- Context-rich (include relevant details the user might have omitted)
- Useful for future sessions (focus on actionable information)
- Clear and specific
2. **Ask the user which scope**:
- **Global**: Applies to all projects (preferences, coding style, general knowledge)
- **Project**: Specific to the current workspace (architecture decisions, project-specific patterns)
3. **Suggest relevant tags** for categorization (e.g., "preferences", "architecture", "coding-style", "tools", "workflow")
4. **Show the optimized memory and ask for confirmation** before storing
### Example Flow
User: "Remember that I prefer tabs over spaces"
Agent: "I'll store this as a memory. Here's the optimized version:
**Content**: User prefers tabs for indentation over spaces in all code files.
**Suggested scope**: Global (applies to all projects)
**Suggested tags**: preferences, coding-style
Should I store this? (yes/no)"
## Listing and Managing Memories
When the user wants to see, update, or delete memories:
1. First call `memory_list` to show all memories with their index numbers
2. For updates/deletes, the user can specify:
- By index: "Delete memory #3"
- By context: "Update the memory about tabs" (uses fuzzy matching)
## Tool Reference
| Tool | Use When |
|------|----------|
| `memory_store` | User wants to save something to memory |
| `memory_recall` | Session start, or user asks what you remember |
| `memory_search` | User asks about specific topic in memory |
| `memory_list` | User wants to see all memories |
| `memory_update` | User wants to modify existing memory |
| `memory_delete` | User wants to remove a memory |
## Important Notes
- Maximum memory size: 2000 tokens (~8000 characters)
- Always include the `project_id` (workspace path) when storing project-specific memories
- Tags should be lowercase and hyphenated (e.g., "coding-style" not "Coding Style")
- When in doubt about scope, ask the user