Cursor IDE
Cursor IDE uses a two-component approach for AutoMem integration:
- MCP server config (
~/.cursor/mcp.json) — connects Cursor to AutoMem via the Model Context Protocol - Rule file (
.cursor/rules/automem.mdc) — instructs Cursor’s AI when and how to use memory tools
Unlike automated hook systems, Cursor uses a declarative rule-based approach: the AI reads instructions from the .mdc file and decides when to invoke memory tools. This follows the philosophy: “Trust Claude + good instructions > automated hooks that guess significance.”
Installation
Section titled “Installation”Method 1: One-Click Deeplink
Section titled “Method 1: One-Click Deeplink”Use Cursor’s deeplink URL scheme to install the MCP server in one click:
cursor://anysphere.cursor-deeplink/mcp/install?name=memory&config=eyJ...The base64-encoded config contains your endpoint and API key. Find the current deeplink in the AutoMem README.
Method 2: CLI Installer (Recommended)
Section titled “Method 2: CLI Installer (Recommended)”The CLI installer handles both the rule file and validates your MCP config:
# Install with auto-detected project namenpx @verygoodplugins/mcp-automem cursor
# Specify project name manuallynpx @verygoodplugins/mcp-automem cursor --name my-project
# Preview changes without writingnpx @verygoodplugins/mcp-automem cursor --dry-run
# Skip interactive prompts (for CI)npx @verygoodplugins/mcp-automem cursor --yesCLI options:
| Flag | Description | Default |
|---|---|---|
--name <project> | Project name for memory tags | Auto-detected from package.json or git |
--dir <path> | Custom target directory | .cursor/rules |
--dry-run | Preview changes without writing files | Off |
--yes / -y | Skip interactive prompts | Off |
--quiet | Suppress output | Off |
The installer:
- Detects project name from
package.json, git remote, or directory name - Checks version of any existing
.mdcfile and prompts for update if newer version available - Detects your MCP server name from
~/.cursor/mcp.json(looks formemory,automem, or any server with AutoMem signatures) - Generates
.cursor/rules/automem.mdcwith your project name and correct tool prefix - Creates a
.bakbackup before overwriting any existing file
MCP Server Configuration
Section titled “MCP Server Configuration”Manually edit or create ~/.cursor/mcp.json:
{ "mcpServers": { "memory": { "command": "npx", "args": ["-y", "@verygoodplugins/mcp-automem"], "env": { "AUTOMEM_ENDPOINT": "http://127.0.0.1:8001", "AUTOMEM_API_KEY": "your-token-here" } } }}For local development (no API key needed):
{ "mcpServers": { "memory": { "command": "npx", "args": ["-y", "@verygoodplugins/mcp-automem"], "env": { "AUTOMEM_ENDPOINT": "http://127.0.0.1:8001" } } }}Tool Naming Convention
Section titled “Tool Naming Convention”Cursor exposes MCP tools with underscore-delimited prefixes: mcp_<server>_<tool>. The server name is sanitized — hyphens become underscores.
| Server name in config | Tool prefix | Example tool |
|---|---|---|
memory | mcp_memory_ | mcp_memory_recall_memory |
auto-mem | mcp_auto_mem_ | mcp_auto_mem_recall_memory |
The CLI installer automatically detects the server name and generates the .mdc file with the correct prefix.
Rule File Structure
Section titled “Rule File Structure”After running the installer, .cursor/rules/automem.mdc is created with alwaysApply: true so Cursor applies the rules to all conversations in the project.
Three-Phase Memory Pattern
Section titled “Three-Phase Memory Pattern”The rule file prescribes a three-phase memory workflow:
Phase 1: Conversation Start
Recall context for most questions. Skip only for:
- Pure syntax questions (“How does Array.map work?”)
- Trivial edits (typos, formatting)
- Direct factual queries about current code
Always recall for:
- Project context and architecture questions
- Feature planning and design discussions
- Debugging (search for similar past errors)
- Performance optimization
- Refactoring (understand why current structure exists)
Adaptive recall logic:
- If files are open → recall memories tagged with those components
- If error messages present → search similar error patterns
- If multiple related files → recall architectural decisions
Phase 2: During Conversation — Storage Triggers
| Type | Importance | Use Case | Example |
|---|---|---|---|
| Decision | 0.9 | Architecture choices, library selections | ”Chose Redis for caching due to sub-millisecond latency requirements” |
| Insight | 0.8 | Root cause discoveries, problem resolutions | ”UserAuth failing on null input. Root: missing validation. Added checks” |
| Pattern | 0.7 | Reusable patterns, best practices | ”Using early returns for validation. Reduces nesting, improves readability” |
| Preference | 0.6–0.8 | Configuration choices, style preferences | ”Using Prettier with 2-space indents and single quotes” |
| Context | 0.5–0.7 | General information, new features | ”Added JWT authentication with refresh tokens” |
Phase 3: Conversation End — Summary
Summarize when:
- Multiple files were modified
- Significant refactoring occurred
- New features were implemented
- Important decisions were made
Available MCP Tools
Section titled “Available MCP Tools”All six AutoMem tools are available via the mcp_memory_* prefix (assuming server named memory):
store_memory — Save memories with structured metadata
content(required): 150–300 char target, 500 max (auto-summarized), 2000 hard limittype(optional): Decision, Pattern, Insight, Preference, Style, Habit, Contextconfidence(optional): 0.0–1.0 (default 0.9 if type provided)tags(optional): Array for categorizationimportance(optional): 0.0–1.0 (default 0.5)metadata(optional): Custom structured data
recall_memory — Hybrid search
- Basic:
query,queries,tags,limit - Time filters:
time_query,start,end - Tag matching:
tag_mode(any/all),tag_match(exact/prefix) - Graph expansion:
expand_entities,expand_relations,auto_decompose - Expansion filters:
expand_min_importance,expand_min_strength(v0.8.0+) - Context hints:
language,active_path,context_types,priority_ids
associate_memories — Create typed relationships between memories
- 11 relationship types:
RELATES_TO,LEADS_TO,EVOLVED_INTO,DERIVED_FROM,EXEMPLIFIES,CONTRADICTS,REINFORCES,INVALIDATED_BY,OCCURRED_BEFORE,PART_OF,PREFERS_OVER strength: 0.0–1.0 association weight
update_memory — Modify existing memory fields
delete_memory — Remove memory by ID
check_database_health — Verify FalkorDB and Qdrant connections
Tagging Conventions
Section titled “Tagging Conventions”Project-specific memories (code, architecture, decisions):
{{PROJECT_NAME}}— Detected frompackage.jsonor gitcursor— Platform tagYYYY-MM— Current month- Component tag — Specific area (auth, api, frontend)
Personal/cross-project memories (preferences, style):
personal— Use instead of project tag for portabilityYYYY-MM— Current month- Category tag (health, preferences, workflow)
Using personal instead of the project name ensures style preferences and personal notes are discoverable across all projects, not buried under project-specific memories.
Content Size Governance
Section titled “Content Size Governance”| Limit | Size | Behavior |
|---|---|---|
| Target | 150–300 chars | Optimal for embedding quality |
| Soft limit | 500 chars | Auto-summarized by backend (requires OPENAI_API_KEY) |
| Hard limit | 2000 chars | Rejected by MCP server |
Format: "Brief title. Context and details. Impact/outcome."
If more detail is needed:
- Split into multiple atomic memories
- Use
metadatafor structured data (files, error signatures) - Create associations between related memories
Global User Rules (Optional)
Section titled “Global User Rules (Optional)”For memory-first behavior across all Cursor projects, add rules to Cursor Settings > General > Rules for AI instead of per-project .mdc files.
Error Handling
Section titled “Error Handling”The rule file prescribes graceful degradation:
- Recall fails or empty — Continue without historical context. Do not announce failure.
- Store fails — Complete the task normally. Memory is an enhancement, not a requirement.
- Service unavailable — Focus on solving the immediate problem.
Troubleshooting
Section titled “Troubleshooting”Tools not available in Cursor
Section titled “Tools not available in Cursor”- Check that
~/.cursor/mcp.jsonexists and is valid JSON - Restart Cursor after editing
mcp.json - Verify the server name in
mcp.jsonmatches the prefix in.cursor/rules/automem.mdc - Run
npx @verygoodplugins/mcp-automem cursoragain to regenerate the rule file with the detected server name
Rule file not updating
Section titled “Rule file not updating”The installer creates a backup at automem.mdc.bak before overwriting. If you need to force update:
npx @verygoodplugins/mcp-automem cursor --yesMemory not recalling project context
Section titled “Memory not recalling project context”Ensure memories are tagged with the project name. Check by running a recall query in Cursor:
Recall memories tagged with [your-project-name]If empty, memories may have been stored without the project tag. Update the .mdc rule file to use the correct project name and re-run the installer.