AI Memory Rule
Defines how an AI agent stores, updates, and consults project-specific knowledge in a dedicated memory file to maintain consistency.
What this file does
Defines how an AI agent stores, updates, and consults project-specific knowledge in a dedicated memory file to maintain consistency.
When to use it
- Setting up AI memory management for a Cursor-based project
- Standardizing how AI learns user preferences and technical decisions
- Preventing repeated questions about project conventions
- Documenting learned facts for multi-session AI interactions
Assumes this stack
trigger: manual
trigger: model_decision description: This rule defines how the AI agent should manage and utilize memory improve coding consistency.
AI Memory Rule
This rule defines how the AI should manage and utilize its "memory" regarding this specific project, including user preferences, learned facts, and project-specific conventions.
Purpose
The AI's memory helps maintain consistency and adapt to specific project needs or user preferences discovered during interactions. It prevents the AI from repeatedly asking for the same information or making suggestions contrary to established patterns.
Storage
All learned project-specific knowledge and preferences should be stored and referenced in the learned-memories.mdc file located in .cursor/rules.
Updating Memory
When new information relevant to the project's conventions, user preferences, or specific technical details is learned (either explicitly told by the user or inferred through conversation), the AI should:
- Identify Key Information: Determine the core piece of knowledge to be stored.
- Check Existing Memory: Review
learned-memories.mdcto see if this information contradicts or updates existing entries. - Propose Update: Suggest an edit to
learned-memories.mdcto add or modify the relevant information. Keep entries concise and clear.
Using Memory
Before proposing solutions, code changes, or answering questions, the AI should consult learned-memories.mdc to ensure its response aligns with the recorded knowledge and preferences.
Example Scenario
User: "We've decided to use Tailwind v4 for this project, not v3."
AI Action:
-
Recognize this as a project-specific technical decision.
-
Check
learned-memories.mdcfor existing Tailwind version information. -
Propose adding or updating an entry in
learned-memories.mdc:## Technical Decisions - **CSS Framework:** Tailwind v4 is used. Ensure usage aligns with v4 documentation and practices, noting differences from v3. -
In subsequent interactions involving Tailwind, the AI will refer to this entry and consult v4 documentation if necessary.
Memory File (.cursor/rules/learned-memories.mdc)
The basic structure:
# Project Memory
This file stores project-specific knowledge, conventions, and user preferences learned by the AI assistant.
## User Preferences
- [Preference 1]
- [Preference 2]
## Technical Decisions
- [Decision 1]
- [Decision 2]
## Project Conventions
- [Convention 1]
- [Convention 2]
What's inside
4 sections: Purpose, Storage, Updating Memory, Using Memory, plus an example scenario and a memory file template.
Change this for your project
- Replace
.cursor/ruleswith your own rules directory path - Replace
learned-memories.mdcwith your actual memory file name - Replace
Tailwind v4with your project's actual tech decision example
Where it goes
Keep it in your repository where the agent or team that needs it will read it.
Worth borrowing
- Separating learned knowledge from static rules for easier updates
- Proposing memory updates before acting, not after
Related Documents
Zig 0.16.0 Context Document for LLMs
Documents breaking changes from Zig 0.13/0.14 to 0.16.0, covering syntax, I/O, build system, and standard library updates.
绘制对比图片 KITTI
Documents the topic remapping and data flow needed to connect Fast-LIO2 frontend with SC-PGO backend for KITTI evaluation.
Beads Workflow Context
Guides when to use bd graph-based issue tracker versus TodoWrite for session vs multi-session work, with commands and workflows.
EPIC: usda-data-crush-stats
Maps a multi-year USDA grape crush data pipeline from raw downloads through bronze, silver, and gold layers to final CSV fact and dimension tables.