# Feature Guide Template

Use this when you introduce or deepen a single Mem0 capability (Graph Memory, Advanced Retrieval, etc.). Aim for crisp problem framing, a walkthrough of how the feature works, and practical configuration guidance with clear exits.

## Reader Promise

- Understand the pain the feature solves and when to reach for it.
- See how to enable, configure, and observe the feature in action.
- Know the next conceptual deep dive and a hands-on example to try.

## Start → Middle → End Pattern

### 1. **Start: Why this feature exists**

- Frontmatter stays outcome-driven: `title`, `description`, `icon`, optional `badge` (e.g., “Advanced”).
- Opening paragraph = two sentences: problem, then payoff. Keep energy high right from the start.
- Include an `<Info>` block titled “You’ll use this when…” with 3 bullets (user persona, workload, expected benefit).
- When reshaping legacy feature docs, carry over existing diagrams, tables, and gotchas. Organize them under these headings rather than replacing them unless the product has changed.
- If there’s a known caveat (pricing, performance), surface it early in a `<Warning>` so readers don’t get surprised later.
- Optional but encouraged: add a Mermaid diagram right after the intro to show how components connect; delete it if the story is obvious without visuals.
- Add a `## Configure access` snippet (even if it’s “Confirm your Mem0 API key is already configured”) so contributors never forget to mention the baseline setup.

### 2. **Middle: How it works**

- Create three predictable sections:
1. **Feature anatomy**: Diagram or bullet list of moving parts. Use a table if you need to compare modes (platform vs OSS).
2. **Configure it**: Step-by-step enabling instructions with `<CodeGroup>` or JSON/YAML snippets. Follow each code block with a short explanation of why it matters.
3. **See it in action**: End-to-end example (often reusing operation snippets). Pair code with `<Info icon="check">` for expected results and `<Tip>` for optimization hints.
- Insert `<Note>` blocks for cross-links (e.g., “Also available via REST endpoint `/v1/...`”).
- Keep the tone instructive but light. No long manifestos.

### 3. **End: Evaluate and go deeper**

- Add an `## Verify the feature is working` section with bullets (metrics, logs, dashboards).
- Follow with `## Best practices` or `## Tuning tips` (3–4 bullets max).
- Close with the standard two-card CTA pair: left card = related concept or architecture page, right card = cookbook/application. Keep the comment reminder to double-check links.
- If providers differ meaningfully, summarize them in a final accordion (`<AccordionGroup>` with one `<Accordion>` per provider) so readers can expand what they need without scrolling walls of configuration.

## Markdown Skeleton

````
---
title: Advanced Retrieval
description: Increase relevance with reranking, criteria filters, and context windows.
icon: "sparkles"
badge: "Advanced"
---

# Advanced Retrieval

Mem0’s advanced retrieval elevates search accuracy when basic keyword matches aren’t enough. Turn it on when you need precise context for high-stakes conversations.

<Info>
  **You’ll use this when…**
  - You need semantic ranking across long-running agents
  - Compliance requires tight control over returned memories
  - Personalization hinges on precise filters
</Info>

<Warning>
  Advanced retrieval currently applies to managed Platform projects only. Self-hosted users should rely on the OSS reranker configuration.
</Warning>

{/* Optional: remove if no diagram is needed */}
```mermaid
%% Diagram the moving parts (delete when you fill this out)
graph TD
A[Input] --> B[Feature]
B --> C[Output]
````

## Feature anatomy

- Outline the moving parts (retriever, reranker, filters).
- Add a table comparing default vs advanced behavior.

## Configure it

Python

```
client = Client(...)
client.memories.search(criteria={...})
```

TypeScript

```
const memories = await mem0.memories.search({ criteria: { ... } });
```

Explain which knobs matter (e.g., `rerank_top_k`, `criteria`, `filters`).

OSS users can mirror this by enabling the reranker in `config.yaml`. Link to the integration guide if relevant.

## See it in action

Walk through a real request/response. Include sample payloads and highlight notable fields.

Expect the top memory to match the user persona you set earlier. If not, revisit your filters.

## Provider setup

[Provider name]

Outline configuration or link to provider docs here.

## Verify the feature is working

- Watch the dashboard analytics for retrieval latency changes.
- Check logs for `reranker_applied: true`.

## Best practices

- Keep criteria minimal. Overfiltering hurts recall.
- Pair with Memory Filters for hybrid scoring.

[**Dive Into Memory Scoring** \
\
Understand how Mem0 ranks memories under the hood.](https://docs.mem0.ai/core-concepts/memory-types)

[**Build a Research Copilot** \
\
See advanced retrieval driving a full knowledge assistant.](https://docs.mem0.ai/cookbooks/operations/deep-research)

```
Stick to this outline. Keep the “why” up front, the “how” in the middle, and the “where to go next” crystal clear at the end.
```
