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

# Memory & RAG

> Persistent memory with semantic retrieval

PuzldAI includes a memory system that stores conversations, decisions, and code patterns for future retrieval.

> [!TIP]
>
> For codebase indexing and search, see [Indexing & Search](https://docs.puzld.cc/features/indexing.md).

## Memory Types

| Type | Description |
| - | - |
| `conversation` | Q\&A pairs from sessions |
| `decision` | Accepted file edits and explanations |
| `code` | Code snippets and patterns |
| `pattern` | Reusable solutions |

## How It Works

1. **Automatic storage** — When you accept file edits, the decision is stored
2. **Semantic search** — Prompts are matched against stored memories
3. **Context injection** — Relevant memories are injected into agent prompts

## Storage

All memory data is stored in the main database:

```
~/.puzldai/
├── puzldai.db       # SQLite database (memories, sessions, observations)
└── sessions/        # Legacy JSON session files
```

## Embedding Models

When Ollama is available, PuzldAI uses embeddings for semantic search:

| Model | Notes |
| - | - |
| `nomic-embed-text` | Recommended |
| `mxbai-embed-large` | Alternative |
| `all-minilm` | Lightweight |

If no embedding model is available, FTS5 full-text search is used.

## Sessions

Chat history is persisted between sessions:

```bash theme={null}
# TUI
/session                  # Start new session
/resume                   # Resume previous session

# CLI
puzldai session list      # List sessions
puzldai session new       # Create new session
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.