When working with AI agents in Cursor, you might notice that the context from one task can bleed into another. A "memory project" set in one chat will remain active even when you start a new conversation. This persistence, managed by an underlying MCP (Model Context Protocol) server, is powerful but can lead to confusion and errors—like writing notes or files to the wrong project—if you're not aware of it.
This lesson dives into how this persistence works, shows you how to inspect the underlying configuration and logs, and demonstrates the most critical best practice for working with multiple memory projects: always start your task by explicitly telling the AI which project to use. By adopting this simple habit, you can prevent context-switching errors and ensure your AI agents work reliably and predictably across all your projects.
The Problem
The state of the active "memory project" is cached and persists across different chat sessions. If you switch from working on "Project A" to "Project B" without explicitly changing the memory project, the AI might still operate within the context of "Project A," causing it to save files or access information from the wrong place.
The Solution
To ensure the AI always operates in the correct context, make it a habit to start any multi-step prompt, rule, or script with a clear, explicit command to switch to the desired memory project. This simple first step prevents ambiguity and ensures your actions are always applied to the correct target.
How it's demonstrated in this lesson:
- Switching and verifying the current memory project using chat commands.
 - Observing how the project state persists in a new chat session.
 - Inspecting the 
mcp.jsonconfiguration to see how the default project is set. - Viewing the 
MCP Logsin the Output panel to understand the server's lifecycle. - A practical example of creating a file in the wrong project due to a persistent context.
 - The correct workflow: prepending a "switch project" command to ensure the file is created in the right place.
 
Prompts
Commands
Code Snippets
This mcp.json configuration shows the basic-memory server being started with a default --project of script-generator.