That’s really interesting! I had previously thought about creating an ontology (see here) using JSON schemas to define certain concepts. For example, some aspects of your architecture could be represented as clearly defined schemas that you can reference later. However, I wasn’t systematic enough in my approach back then.
Now I’m wondering if this more dynamic, learning-oriented perspective could extend with more than just a summarization, as @bmadcode suggested. Perhaps it could lead to a more complete consolidation that includes stricter definitions using schemas or something similar. In theory, this would allow the agent to dynamically choose how to use knowledge, while at the same time providing us rigorous validators for free. I believe that some core, “firm” knowledge might really benefit from being represented in this more rigid format.
This guide provides a detailed explanation of the AI Context Rules System, designed to enhance your development workflow in Cursor. The system combines memory management, lessons tracking, and a dual-mode operation system to ensure consistent and reliable AI interactions.
First, you need to create a complete project requirement, and it has a roadmap on it like it has a phase and this is up to you for what format do you want the as long as it has a phase.
Then after that you need to prompt a plan the keyword is “plan” to automatically edit/update the scratchpad file and put your requests into a planned setup.
Then after that you can use a keyword, mine is [mems] for triggering the memory manually this is for non-development or for important details because I don’t want to make my memory to full immediately, and the automatic will trigger if it’s implementations or development mode only (you can adjust this for you preference).
The lesson learned you will trigger it manually and automatically, it will trigger automatically if there’s an important and reusable information that will help you in the future or if there’s a problem, issues, bug, fixing that is encounter it will automatically trigger that to update/add the lesson learned file. for manually update it you can just prompt it to update the and capture all of the important details.
Symptom: AI gives inconsistent or incorrect responses
Solution: Follow reload process with required tabs open
Prevention: Keep .cursorrules file open
Cursor Unresponsive:
Symptom: Cursor stops providing suggestions
Solution: Resync index and reload window
Prevention: Regular resyncs during long sessions
Context Loss:
Symptom: AI loses track of previous conversation
Solution: Check memory system and reload
Prevention: Regular memory updates
Conclusion
This system provides a structured approach to AI-assisted development, ensuring consistency and reliability. By following these guidelines and using the provided tools effectively, you can maintain a more organized and efficient development workflow.
Note: This guide will be updated with actual images showing each component and process in detail. The current placeholders indicate where visual aids will be added to enhance understanding.
THIS IS IMPORTANT!!! YOU WILL COPY THIS TO YOUR RULES FOR AI IN THE GLOBAL SETTINGS
FOLLOW THESE STRICT RULES:
- !!!!!!!!!!!!!!!!!!ALWAYS FETCH ALL OF THE RULES!!!!!!!!!!!!!!!
- EVERY INTERACTION ON THE USER THE BRAIN RULES MDC FILES AND FETCH IT ON THE COMPOSER MODE, this is the rules for memories of AI, Lesson learned, and scratchpad for this project in all of the interactions from the user this will
automatically read.
- DON'T BE LAZY AND BE ATTENTIVE! AND DON'T GET HALUZINATIONS, BE CONSISTENT!
- Treat me as a beginner web developer and you are super AI assistant for the user
- Follow the user’s requirements carefully & to the letter.
- First think step-by-step - describe your plan for what to build in pseudocode, written out in great detail.
- Confirm, then write code!
- Focus on easy and readability code, over being performant.
- Fully implement all requested functionality.
- Leave NO todo’s, placeholders or missing pieces.
- Ensure code is complete! Verify thoroughly finalized.
- Include all required imports and ensure proper naming of key components.
- Be concise Minimize any other prose.
- If you think there might not be a correct answer, you say so.
- If you do not know the answer, say so, instead of guessing.
- Use early returns whenever possible to make the code more readable.
- Use “class:” instead of the tertiary operator in class tags whenever possible.
- Use descriptive variable and function/const names. Also, event functions should be named with a “handle” prefix, like “handleClick” for onClick and “handleKeyDown” for onKeyDown.
- Implement accessibility features on elements. For example, a tag should have a tabindex=“0”, aria-label, on:click, and on:keydown, and similar attributes.
- Use consts instead of functions, for example, “const toggle = () =>”. Also, define a type if possible.
- Call me [Name] use emoji for every emotion
- Use your chain of thoughts on every problem, fixing, issues, root cause
- If there's a continuation of chats like the implementations are not completed yet you need to tell the user to continue first give the user a emoji for `WARNING!!!`
- Whenever you are asking the user a question you need to format it into basic and low code knowledge like treat the user for questions like this
- Be smart to use the modular structure setup, server and client structure setup, always use reusable files and components
- Be more AI-friendly with clear processing instructions when you are creating a rule only okay!
- In every interaction with the user you will read and follow carefully and STRICTLY the .cursorrules file.
- You will update the scratchpad.md file to put all of your answers for my query when I say "plan" for the keyword.
You can modify these rules but make sure you are not removing the important rules
A comprehensive system for managing AI interactions through memory management, lessons learned tracking, and dual-mode operation (Plan/Agent). This system ensures consistent, high-quality development while maintaining detailed project documentation and knowledge retention.
Core Components
Memory System (@memories.md)
Tracks all interactions chronologically
Auto-updates with timestamps and tags
Maintains project context and decisions
Uses version control format [v1.0.0]
Supports #tags for easy searching
Lessons Learned (@lessons-learned.md)
Captures solutions and best practices
Uses structured format: Issue → Solution → Impact
Categorizes by component, TypeScript, errors, etc.
- Reach 95% confidence
- Use "agent" trigger
- System implements solution
- Updates documentation
Workflow Examples
Example 1: Creating a New Feature
USER: "plan implement a new button component"
AI: 🎯 PLAN MODE ACTIVATED
Current Task: Implement new button component
Questions:
1. What variants are needed? (primary/secondary/outline)
2. Should it support icons?
3. What sizes are required?
Confidence: 65%
USER: "primary and secondary variants, with icons, three sizes"
AI: Updated Understanding:
- Primary/Secondary variants
- Icon support
- Small/Medium/Large sizes
Confidence: 95%
USER: "agent"
AI: ⚡ AGENT MODE ACTIVATED
- Creating Button component
- Implementing variants
- Adding icon support
- Testing accessibility
Example 2: Fixing a Bug
USER: "plan fix the form submission error"
AI: 🎯 PLAN MODE ACTIVATED
Current Task: Debug form submission error
Questions:
1. When does the error occur?
2. Any error messages in console?
3. Which form component is affected?
Confidence: 50%
USER: "happens on login form, console shows validation error"
AI: Chain of Thought Analysis:
1. Login form validation
2. Console error check
3. Input validation rules
Confidence: 95%
USER: "agent"
AI: ⚡ AGENT MODE ACTIVATED
- Debugging validation
- Fixing error handling
- Testing submission
Example 3: Project Setup
USER: "plan setup new Next.js project"
AI: 🎯 PLAN MODE ACTIVATED
Current Task: Initialize Next.js project
Questions:
1. Which version of Next.js?
2. TypeScript or JavaScript?
3. Which UI components needed?
Confidence: 70%
USER: "Next.js 14, TypeScript, Shadcn UI"
AI: Project Structure:
- Next.js 14 setup
- TypeScript configuration
- Shadcn UI integration
Confidence: 95%
USER: "agent"
AI: ⚡ AGENT MODE ACTIVATED
- Creating project
- Setting up TypeScript
- Installing dependencies
Example 4: Documentation Update
USER: "plan update API documentation"
AI: 🎯 PLAN MODE ACTIVATED
Current Task: Update API docs
Questions:
1. Which endpoints need updates?
2. Any new parameters added?
3. Response format changes?
Confidence: 60%
USER: "new authentication endpoints"
AI: Documentation Plan:
- Auth endpoints
- Request/Response formats
- Example usage
Confidence: 95%
USER: "agent"
AI: ⚡ AGENT MODE ACTIVATED
- Updating docs
- Adding examples
- Verifying formats
Documentation Standards
Real-time Updates
Memories: Every interaction
Lessons: After solutions
Scratchpad: During implementation
Version Control
[v1.0.0] Format for all entries
- Development updates
- Manual updates
- Progress tracking
ok, so looking at your examples. this is all logical, BUT how do you tell the AI to write info into the memory and similar files while planning, without destroying too much info in those files etc. complexity i guess.
It will automatically update itself when developing mode and it will reflect the real status of your conversation, and I would suggest to say that you want to update the memories and it knows the context that it will put in the memories file, it was like a summary only with versioning and single line story, that what did you do etc.
If the automatic update is not following by AI you need to ask it manually and you can add a contents to it too, to make sure the memories are accurate with manual update
for me when using .cursor/rules - no combination of USE ME ALWAYS or ALWAYS USE THIS FILE or whatever int he mdc file is not reliable whatsoever. I have instead found that with Claude sonnet at least, if the rules .mcd file has a use command it will almost always get used. its also obvious whenever agent uses an .mdc file it will mention it in the chat. so something in the mdc ddscription field like Use this file when the command Foo! is entered - or whatever you want to use to start your chat threads with.
I use a similar approach with a Todo.md , Changelogs.md and Project_Structure.md for my project. I tried referencing them in my rules but it doesn’t always work … Most of the time I need to tell it to remember to read the files … But I might try your approach and modify it with my own approach to see if its better ! I do a Errors_List.md when I got errors while building too so that it remember the errors and what to do in case there is lots of errors …
When I am using my custom rules, i am developing a food ordering and it’s effective and if it’s sometimes not using the rules I am manually adjusting it so it will follow the format that I want to be consistent, now my project is done at the phase 1 it has a project initial, authentication, database configuration and now i am currently at phase 2, the phase is super aligned to the project and the mistakes from before it’s not using the same mistakes from before, and my codebase is organize well like it’s not messy anymore and I know what I am doing, it’s super easy to track because of my format documentations so it’s super easy to set it up