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

# Core Concepts Overview

> Understand the fundamental building blocks of Recallr AI

## Understanding Recallr AI

Recallr AI is built around a few core concepts that work together to provide persistent memory for AI applications. This page introduces these concepts and shows how they relate to each other.

## The Four Main Components

<CardGroup cols={2}>
  <Card title="Users" icon="user" href="/concepts/users">
    Individual people using your application, each with isolated memory
  </Card>

  <Card title="Sessions" icon="comments" href="/concepts/sessions">
    Conversations or interactions that contain messages
  </Card>

  <Card title="Memories" icon="brain" href="/concepts/memories">
    Extracted facts and knowledge stored long-term
  </Card>

  <Card title="Merge Conflicts" icon="code-merge" href="/concepts/merge-conflicts">
    Intelligent handling of contradictory information
  </Card>
</CardGroup>

## How They Work Together

Think of Recallr AI like a personal assistant's notebook:

```mermaid theme={null}
graph TB
    A[User] --> B[Has Many Sessions]
    B --> C[Session 1: Monday Chat]
    B --> D[Session 2: Wednesday Chat]
    B --> E[Session 3: Friday Chat]
    C --> F[Process]
    D --> F
    E --> F
    F --> G[Memories Extracted]
    G --> H[User Memory Graph]
    H --> I[Used for Future Context]
```

<Steps>
  <Step title="A User represents a person">
    Each individual using your app (customer, player, student, etc.) is a **User**. They have:

    * A unique ID (you provide this)
    * Metadata (name, email, preferences, etc.)
    * A collection of memories (automatically extracted from conversation **sessions**)
    * Can have multiple sessions over time
  </Step>

  <Step title="Sessions contain conversations">
    When a User interacts with your app, it happens in a **Session**. A session:

    * Contains messages (back-and-forth dialogue)
    * Has a status (pending, processing, processed)
    * Will be processed to extract memories
    * Represents one conversation or interaction
  </Step>

  <Step title="Memories are extracted knowledge">
    When you process a session, Recallr AI analyzes the conversation and creates **Memories**:

    * Structured facts about the user
    * Categorized automatically
    * Versioned (track changes over time)
    * Semantically searchable
  </Step>

  <Step title="Merge Conflicts handle contradictions">
    Sometimes new information conflicts with existing memories, creating **Merge Conflicts**:

    * Detect contradictions automatically (e.g., "I love coffee" vs. "I hate coffee")
    * **Disabled by default** - must be enabled in project settings
    * When enabled, generates clarifying questions sent via webhooks
    * You provide answers to resolve conflicts and update memories
    * Preserves accuracy by requiring human clarification for contradictions
  </Step>
</Steps>

## Real-World Analogy

Imagine you're a human assistant taking notes about your clients:

| Recallr AI Concept | Real-World Equivalent                                            |
| ------------------ | ---------------------------------------------------------------- |
| **User**           | A specific client you work with                                  |
| **Session**        | One meeting or phone call with that client                       |
| **Messages**       | The back-and-forth conversation during the meeting               |
| **Memories**       | Important facts you write in your notebook about the client      |
| **Merge Conflict** | When the client says something that contradicts your notes       |
| **Process**        | After the meeting, reviewing your notes and updating them        |
| **Get Context**    | Before a meeting, reviewing your notes to remember what you know |

## FAQs

### Users

<AccordionGroup>
  <Accordion title="When to create a new User?" icon="user-plus">
    Create a user when:

    * A new person signs up for your app
    * A first-time visitor starts a conversation
    * You need to track someone's preferences

    Example: E-commerce customer, game player, student
  </Accordion>

  <Accordion title="What makes a good User ID?" icon="id-card">
    Good user IDs are:

    * Unique and stable (don't change over time)
    * From your existing system (database ID, email, UUID)
    * Easy to retrieve when needed

    ✅ Good: `user_12345`, `john@example.com`, `player_uuid_...`

    ❌ Bad: Changing usernames, timestamps, random numbers
  </Accordion>
</AccordionGroup>

### Sessions

<AccordionGroup>
  <Accordion title="When to start a new Session?" icon="comment-dots">
    Start a session when:

    * User opens a chat window
    * User begins a new conversation
    * Significant time has passed since last interaction

    Example: New customer support ticket, new game level, new tutoring session
  </Accordion>

  <Accordion title="When to process a Session?" icon="gear">
    Process a session when:

    * Chat window is closed
    * Extended period of inactivity
  </Accordion>
</AccordionGroup>

### Memories

<AccordionGroup>
  <Accordion title="What becomes a Memory?" icon="brain">
    Recallr AI automatically extracts:

    * User preferences and dislikes
    * Personal information shared
    * Goals and plans
    * Factual statements about the user
    * Important context from conversations

    Example memories:

    * "User's birthday is March 15th"
    * "User is learning Python"
  </Accordion>

  <Accordion title="How are Memories categorized?" icon="tags">
    ...
  </Accordion>
</AccordionGroup>

### Merge Conflicts

<AccordionGroup>
  <Accordion title="When do Merge Conflicts happen?" icon="triangle-exclamation">
    Conflicts occur when:

    * New information contradicts existing memories
    * User changes their mind or preferences
    * Ambiguous or unclear statements are made

    **Example conflict:**

    * Existing memory: "User is vegetarian"
    * New message: "I ate chicken last night"
    * -> Merge Conflict created!
  </Accordion>

  <Accordion title="How to resolve Merge Conflicts?" icon="handshake">
    Conflicts are resolved through webhook notifications:

    1. **Enable merge conflicts** in your project settings
    2. **Add webhook URL** to receive conflict events
    3. **Receive webhook** with conflict details and clarifying questions
    4. **Provide answers** via API to resolve the conflict
    5. **Memories update** automatically based on your answers

    See the [Merge Conflicts guide](/concepts/merge-conflicts) for implementation details.
  </Accordion>

  <Accordion title="Why are Merge Conflicts disabled by default?" icon="toggle-off">
    Merge conflicts require webhook setup and human intervention, so they're disabled by default to:

    * Keep the default experience simple
    * Avoid overwhelming new users with complexity
    * Allow gradual adoption as your use case requires it

    Enable them when accuracy is critical and you can handle webhook responses.
  </Accordion>
</AccordionGroup>

## Architecture Diagram

Here's how data flows through Recallr AI:

```mermaid theme={null}
sequenceDiagram
    participant App as Your Application
    participant SDK as Recallr AI SDK
    participant API as Recallr AI API
    participant LLM as Your LLM
    
    App->>SDK: Create user
    SDK->>API: POST /users
    API-->>SDK: User created
    
    App->>SDK: Start session
    SDK->>API: POST /sessions
    API-->>SDK: Session created
    
    App->>SDK: Add message
    SDK->>API: POST /messages
    
    App->>SDK: Get context
    SDK->>API: GET /context
    API-->>SDK: Relevant memories
    SDK-->>App: Context text
    
    App->>LLM: Generate response with context
    LLM-->>App: Personalized response
    
    App->>SDK: Process session
    SDK->>API: POST /process
    API-->>SDK: Memories extracted
```

## Next Steps

Now that you understand the core concepts, dive deeper into each component:

<CardGroup cols={2}>
  <Card title="Users" icon="user" href="/concepts/users">
    Learn about user management and metadata
  </Card>

  <Card title="Sessions" icon="comments" href="/concepts/sessions">
    Understand session lifecycle and states
  </Card>

  <Card title="Memories" icon="brain" href="/concepts/memories">
    Explore memory structure and versioning
  </Card>

  <Card title="Merge Conflicts" icon="code-merge" href="/concepts/merge-conflicts">
    Handle contradictory information
  </Card>

  <Card title="Recall Strategies" icon="sliders" href="/concepts/recall-strategies">
    Optimize memory retrieval
  </Card>

  <Card title="Webhooks" icon="webhook" href="/concepts/webhooks">
    Get notified of events
  </Card>
</CardGroup>
