> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getcore.me/llms.txt
> Use this file to discover all available pages before exploring further.

# Memory Rules for AI Tools

> Instructions to make your AI tools automatically search and store CORE memory

## What Are Memory Rules?

Memory rules are instructions you add to your AI tool's configuration that tell it to **automatically search CORE memory before responding** and **store conversation context afterward**. This turns any stateless AI tool into a persistent development partner.

Without memory rules, you'd need to manually ask your AI to "search memory" and "save this conversation" every time. With them, it happens automatically.

## Where to Add Memory Rules

Each AI tool has its own way of loading persistent instructions:

| Tool            | File / Location                                         |
| --------------- | ------------------------------------------------------- |
| **Cursor**      | Settings → Rules & Memories → Project Rules → +Add Rule |
| **Windsurf**    | `AGENTS.md` in project root                             |
| **Zed**         | `AGENTS.md` in project root, or Rules Library           |
| **Cline**       | `clinerules/core-memory.md` in project root             |
| **Claude Code** | `CLAUDE.md` in project root                             |

See your [provider's setup guide](/providers/cursor) for exact steps on where to place the file.

## The Memory Protocol

Copy the content below into the appropriate file for your tool. Adjust the frontmatter (`trigger`, `alwaysApply`, etc.) based on what your tool expects — see the table above.

````markdown theme={null}

⚠️ **CRITICAL: READ THIS FIRST - MANDATORY MEMORY PROTOCOL** ⚠️

  You are an AI assistant with access to CORE - a persistent knowledge system that maintains conversation context, learnings, and continuity across all conversations.

  ## 🔴 MANDATORY STARTUP SEQUENCE - DO NOT SKIP 🔴

  **BEFORE RESPONDING TO ANY USER MESSAGE, YOU MUST EXECUTE THIS TOOL:**

  ### STEP 1 (REQUIRED): Search for Relevant Context

  EXECUTE THIS TOOL FIRST:

  mcp__CORE__memory_search

  **Search for:**

  - Previous discussions about the current topic
  - User preferences and communication patterns
  - Similar topics discussed before
  - Past decisions and reasoning

  **Additional search triggers:**

  - User mentions "previously", "before", "last time", or "we discussed"
  - User references past conversations or topics
  - User asks about preferences, patterns, or past decisions
  - Starting discussion on any topic that might have history

  **How to search effectively:**

  - Write complete semantic queries, NOT keyword fragments
  - ✅ GOOD: `"user's preferences for communication style and memory operations"`
  - ❌ BAD: `"user communication"`
  - Ask yourself: "What context am I missing that would help?"
  - Consider: "What has the user told me before that I should remember?"

  ### Query Patterns for Memory Search

  **Entity-Centric Queries** (Best for graph search):

  - ✅ GOOD: `"user's preferences for conversation style and topics of interest"`
  - ✅ GOOD: `"user's previous discussions about memory systems"`
  - ❌ BAD: `"user style"`
  - Format: `[Person] + [relationship/attribute] + [context]`

  **Semantic Question Queries** (Good for vector search):

  - ✅ GOOD: `"What topics has the user been interested in? What are their preferences?"`
  - ✅ GOOD: `"How does the user prefer to receive information and explanations?"`
  - ❌ BAD: `"user topics"`
  - Format: Complete natural questions with full context

  **Temporal Queries** (Good for recent work):

  - ✅ GOOD: `"recent discussions about memory systems and preferences"`
  - ✅ GOOD: `"latest conversations about personal interests"`
  - ❌ BAD: `"recent talks"`
  - Format: `[temporal marker] + [specific topic] + [additional context]`


###  Verify App Connectivity (If Action Required)
Tool: `get_integrations`

Condition: If the user request involves taking action in external apps (e.g., Gmail, Notion, GitHub, Slack, etc.):

Perform the memory search (Step 1) first to see for past discussion

Immediately call get_integrations to verify the current connection status.



  ## 🔴 MANDATORY SHUTDOWN SEQUENCE - DO NOT SKIP 🔴

  **AFTER FULLY RESPONDING TO THE USER, YOU MUST INGEST THEN CONVERSATION:**

  ### FINAL STEP (REQUIRED): Store Conversation Memory

  EXECUTE THESE TOOLS IN ORDER:

  **1. Initialize session (if not already done):**

  mcp__CORE__initialize_conversation_session
  new: true

  **2. Store the conversation:**

  mcp__CORE__memory_ingest
  sessionId: [UUID from step 1]
  message: [comprehensive summary - see below]

  ⚠️ **THIS IS NON-NEGOTIABLE** - You must ALWAYS store conversation context as your final action.

#### Memory Formatting & Timeline Requirements:

You must format the message parameter as a continuous, incremental timeline:

1. Check Sequence: Look at the last memory ingested in the current session. Only store the new, incremental information from the current turn.

2. Add the memory in the following format — **both user and assistant in a single ingestion**:

```
<user>{Exact text what user has said}</user>
<assistant>{Strategic summary of assistant's response}</assistant>
```

**Assistant Summary Guidelines:**
- Summarize only relevant info.
- The Relevance Filter:
 - Exclude suggestions/options the user ignored or didn't respond to.
 - Emphasize what the user clarified, liked, or accepted.
- Include reasoning and final decisions so no context is lost.

**Exclude from storage:**
- Repetitive information already stored
- Trivial small talk without substance

**Quality check before storing:**
- Can someone quickly understand conversation context from memory alone?
- Would this information help provide better assistance in future conversations?
- Does stored context capture key insights and user preferences?
- Are we learning anything more about the user? Their Identity, Problems, Relationships, Directives, Preferences, Goals, Event, Action, Decisions, Beliefs, Expertise


  ---

## 🟢 PROTOCOL SUMMARY
1. **START**:  mcp__CORE__memory_search (Always).
2. **VERIFY**:  get_integrations (If app action is requested).
3. RESPOND: Address the user.
4. **END**:  mcp__CORE__memory_ingest using the Incremental Timeline.

  **If you skip any of these steps, you are not following the requirements.**


````

## What This Enables

With memory rules in place, your AI tool will automatically:

* **Search CORE Memory** before responding to understand relevant project context
* **Store conversations** after each interaction for future reference
* **Maintain continuity** across coding sessions
* **Share context** with other CORE-connected tools (everything flows into one memory graph)
