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

# Quickstart

> Install Mneno and start adding memories in minutes.

## Installation

Install Mneno `0.4.0` from PyPI:

```bash theme={null}
pip install mneno
```

To install this exact release, use `pip install mneno==0.4.0`.

## Basic Usage

Here is a simple example of how to use Mneno to add memories and search through them.

```python theme={null}
from mneno import MemoryClient

# Initialize the client (defaults to in-memory storage)
client = MemoryClient()

# Add memories
client.add(
    "The user is building Mneno, a Python SDK for explainable AI memory.",
    memory_type="semantic",
    importance=0.9,
    tags=["project", "mneno"],
)

client.add(
    "User prefers lightweight Python-first SDKs.",
    memory_type="preference",
    importance=0.85,
)

# Search memories
results = client.search("What is the user building?")

for result in results:
    print(f"Content: {result.memory.content}")
    print(f"Score: {result.score.total}")
    print(f"Reasons: {result.score.reasons}")
```

## Build Context for Prompts

Mneno builds explainable context for LLM prompts within a token budget.

```python theme={null}
# Build a context package with a 50-token budget
context = client.build_context("What is the user building?", budget=50)

print(context.text)

# See why items were included
for item in context.included:
    print(f"Included: {item.memory_id} (Reason: {item.reason})")
```

## Inspect Decisions

Tracing is local, optional, and disabled by default. Enable it when you need to inspect retrieval or context decisions.

```python theme={null}
traced_client = MemoryClient(trace_enabled=True)
traced_client.add("The user is building Mneno.", importance=0.9)

traced_client.search("What is the user building?")
trace = traced_client.get_trace(traced_client.last_trace_id or "")

if trace is not None:
    for event in trace.events:
        print(event.event_type, event.message)
```

## Evaluate Behavior

Evaluation wrappers return typed, serializable metrics for retrieval, context building, and compaction.

```python theme={null}
result = traced_client.evaluate_context("What is the user building?", budget=1200)

for metric in result.metrics:
    print(metric.name, metric.value, metric.unit)
```

## Next Steps

<CardGroup cols={2}>
  <Card title="Scoring" icon="star" href="/concepts/scoring">
    Learn how Mneno ranks memories.
  </Card>

  <Card title="Compaction" icon="compress" href="/concepts/compaction">
    Prevent context rot with auto-compaction.
  </Card>

  <Card title="Storage" icon="database" href="/concepts/storage">
    Configure persistent storage.
  </Card>

  <Card title="Providers" icon="plug" href="/advanced/providers">
    Integrate with embeddings and rerankers.
  </Card>

  <Card title="Observability" icon="wave-pulse" href="/concepts/observability">
    Inspect local decision traces.
  </Card>

  <Card title="Evaluation" icon="chart-line" href="/advanced/evaluation">
    Measure runtime behavior and export benchmark results.
  </Card>
</CardGroup>
