Cursor Architecture: Rules (.mdc) vs. Skills vs. MCP Persistent Memory
| Mechanism | Scope & Timing | Mutability & State | Context Window Impact | Primary Role |
|---|---|---|---|---|
| Cursor Rules (.mdc) | Applied on matching file globs | Static markdown with YAML frontmatter | Injected into prompt system preamble | Coding style, naming conventions, and file headers |
| Cursor Agent Skills | Invoked when intent matches trigger | Static markdown instructions with tool scripts | Loaded into conversation turn when triggered | Step-by-step procedural playbooks (e.g., deployments) |
| Memoreal MCP Memory | Queried dynamically on-demand | Dynamic read-write graph with belief revision | Zero token tax until specific tools are invoked | Cross-session memory, architecture decisions, and bug history |
| Legacy .cursorrules | Always loaded in global context | Unstructured flat text file (deprecated) | Burns input tokens on every turn | Deprecated legacy pattern replaced by .mdc and MCP |
The Triad of Cursor Context: Rules, Skills, and Memory
Cursor has evolved from a simple code completion extension into a comprehensive autonomous agent environment. To steer Cursor Composer and Agent mode effectively, developers must distinguish between three distinct architectural abstractions: Rules, Skills, and Memory.
Rules specify static invariants like code styling, formatting standards, and required imports. Skills represent procedural workflows—such as executing a canary deployment or generating a PRD—that guide the agent through sequential steps. Finally, Memory provides stateful awareness, allowing Cursor to recall past bugs, architectural decisions, and teammate preferences across multiple chat threads.
- Rules define the boundaries of acceptable code generation (what code must look like).
- Skills define the execution recipe for complex operations (how multi-step tasks are performed).
- Memory stores historical truth and learned project context (why decisions were made).
Migrating from Deprecated .cursorrules to Modern .mdc Files
In early versions of Cursor, developers dumped all project instructions into a single root .cursorrules file. As projects expanded, this monolithic file grew to thousands of tokens, consuming context window capacity on every single keystroke and confusing the agent with irrelevant instructions.
Cursor introduced .mdc files located inside .cursor/rules/ to solve this problem. Each .mdc file includes YAML frontmatter defining specific file globs and trigger conditions. For instance, React component rules only load when an engineer opens a .tsx file, saving thousands of tokens during backend Python development.
- Monolithic .cursorrules files waste prompt tokens and degrade model attention on irrelevant tasks.
- .mdc files enable fine-grained glob matching, loading context strictly when matching files are edited.
- Frontmatter metadata allows teams to designate rules as always-on or conditionally activated.
Why Dynamic MCP Memory Completes the Context Puzzle
While .mdc rules and Skills manage static prompts and procedural playbooks, neither provides a writable runtime state. Once a Cursor chat session closes, any nuanced technical understanding the model uncovered about an elusive race condition or legacy API quirk is permanently lost.
By adding Memoreal MCP server to Cursor (~/.cursor/mcp.json), Cursor gains dynamic memory capabilities. The agent can invoke tools like encode_memory to save architectural decisions, recall_memories to pull historical context, and impact to analyze symbol blast radius—without polluting your static repository files.
- Dynamic memory prevents repetitive debugging sessions when working on complex legacy systems.
- Memoreal MCP enables Cursor to share knowledge seamlessly with Claude Code and Codex CLI.
- Zero token tax is incurred until Cursor explicitly invokes a memory retrieval tool.
Configuring a Modern Cursor .mdc Rule Integrated with Memoreal MCP
markdown---
description: Database architecture and migration guidelines
globs: ["src/models/**/*.ts", "migrations/**/*.sql"]
alwaysApply: false
---
# Database Architecture Rules
1. Before altering any existing schema, query Memoreal persistent memory:
- Call `tools.memoreal.recall_memories({ query: "entity schema invariants" })`
2. Never execute raw destructive SQL migrations without dry-run validation.
3. Record all schema changes into Memoreal:
- Call `tools.memoreal.encode_memory({ content: "Added user_tier column to users", type: "semantic" })`
Frequently Asked Questions
When should I create a Cursor Rule (.mdc) instead of an Agent Skill?
Use a Cursor Rule (.mdc) for static invariants like code style, naming conventions, and file structures. Use an Agent Skill when you need a procedural, step-by-step workflow with multiple tool actions or commands.
Can Cursor Agent Skills directly invoke Memoreal MCP memory tools?
Yes, Cursor Agent Skills can explicitly instruct the model to call Memoreal MCP tools like recall_memories or encode_memory at designated stages of a workflow.
Does using Memoreal MCP increase token costs in Cursor Composer?
No, Memoreal MCP does not inject unsolicited tokens into the prompt preamble. It exposes structured tools that Cursor calls on demand, saving up to 65% in token costs compared to large static prompt files.
Install Persistent Memory for Your Coding Agent
Sub-15ms deterministic recall, AST symbol navigation, and 70%+ token savings across Claude Code, Cursor, Codex CLI, and Windsurf.
npx -y @kolivri/memoreal-mcp setup