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

# Memory Operations

> Store, retrieve, validate, and manage memories.

# Memory Operations

Store, retrieve, and maintain high-quality memories in Memanto.

## Memory Fundamentals

### What is a Memory?

A memory in Memanto includes:

* **Content**: The core information.
* **Type**: Semantic category (fact, preference, decision, etc.).
* **Title** (optional): Short label for readability.
* **Confidence** (optional): Reliability score from 0 to 1.
* **Metadata** (optional): Extra structured context.

### Memory Lifecycle

```
Store -> Index (instant) -> Recall -> Conflict detection -> Resolve
```

## Core Operations

Use these commands for most workflows:

* Store a memory: `memanto remember "..." --type fact`
* Batch store: `memanto remember --batch memories.json`
* Recall semantically: `memanto recall "..."`
* Answer from context: `memanto answer "..."`
* Delete a memory: `memanto forget MEMORY_ID`
* Detect contradictions: `memanto conflicts`
* Export memory history: `memanto memory export`

## Uploading Files into Memory

When information already exists in documents, upload files instead of manually adding many individual memories.

### Supported Formats

`.pdf`, `.docx`, `.xlsx`, `.json`, `.txt`, `.csv`, `.md` (up to 5 GB per file).

### CLI

Activate an agent session, then upload:

```bash theme={null}
memanto agent activate customer-support
memanto upload ./customer-profile.pdf
```

Recall uploaded knowledge with normal search:

```bash theme={null}
memanto recall "What is the customer's annual revenue?"
```

### REST API

```python theme={null}
import httpx

with open("customer-profile.pdf", "rb") as f:
    response = httpx.post(
        "http://localhost:8000/api/v2/agents/customer-support/upload-file",
        files={"file": ("customer-profile.pdf", f, "application/pdf")},
        headers={"X-Session-Token": session_token},
    )

result = response.json()
print(f"Status: {result['status']}, File: {result['file_name']}")
```

### Upload vs Remember

| Use `upload` when...             | Use `remember` when...                   |
| -------------------------------- | ---------------------------------------- |
| You have existing documents      | You are storing short atomic facts       |
| Content spans many pages         | You want explicit memory typing per item |
| You ingest structured data files | You want precise confidence per memory   |

## Extracting from Conversations

If you have raw chat logs, Memanto can automatically parse the conversation and use the underlying LLM to extract durable, structured memories (like facts and preferences) while discarding the noise.

### Using the Web UI

The Memanto Web Dashboard features an **Extract** tab in the Playground:

1. Paste a JSON array of conversation turns (`[{"role": "user", "content": "..."}, ...]`).
2. Click **Preview Extraction** to review the memory cards Memanto generated. You can modify types, content, and confidence.
3. Click **Save to Database** to persist the selected facts.
4. (Optional) Use **Extract & Save** to skip the preview and directly persist the memories.

### Using the CLI

You can extract and store memories from a local JSON file containing your chat history:

```bash theme={null}
# Preview what would be extracted
memanto remember --from-conversation chat.json --dry-run

# Extract and persist directly
memanto remember --from-conversation chat.json
```

### Using the REST API

Send your conversation payload to the extract endpoint:

```bash theme={null}
curl -X POST "http://localhost:8000/api/v2/agents/my-agent/remember/extract" \
  -H "X-Session-Token: <your-token>" \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [
      {"role": "user", "content": "I prefer 4 spaces for indentation."},
      {"role": "assistant", "content": "Got it."}
    ],
    "dry_run": true
  }'
```

## Recall Patterns

### Semantic Recall

```bash theme={null}
memanto recall "What do I know about user preferences?"
```

### Filter by Type

```bash theme={null}
memanto recall "How should I contact this user?" --type preference
```

### Limit Result Volume

```bash theme={null}
memanto recall "customer details" --limit 10
```

### Temporal Recall

Use the temporal recall variants (`--as-of`, `--changed-since`, and `--recent`) to query memory across time.

See [Temporal Memory Details](./temporal-memory) for complete patterns and examples.

## Answering and Conflict Management

### Grounded Answers

```bash theme={null}
memanto answer "Based on memory, how should we communicate with this customer?"
```

### Conflict Detection

```bash theme={null}
memanto conflicts
```

When contradictions are found, resolve them by keeping the new memory, the old one, both, removing both, or replacing them with a manual entry. See [List Conflicts](/api-reference/data/list-conflicts) and [Resolve Conflict](/api-reference/data/resolve-conflicts) for the API contract.

## Deleting a Memory

Remove a single memory from the active agent by its ID. Find the ID in the
output of `memanto recall`, then:

```bash theme={null}
memanto forget b7c3cf31-e537-49f1-abc4-c50ac6adeac5
```

This prompts for confirmation. Add `--force` to skip it. See the
[forget command](/cli/data/forget) and [Delete Memory API](/api-reference/data/delete-memory)
for details.

<Note>
  For contradictions, prefer resolving conflicts (keep new/old/both, remove both, or replace) over deleting history. Use `forget` for one-off removals such as a memory stored by mistake.
</Note>

## Migrating from Other Providers

Already have memories in Mem0, Letta, or Supermemory? Import them into a
Memanto agent with `memanto migrate`:

```bash theme={null}
# Preview the mapping and savings report without writing
memanto migrate mem0 --dry-run

# Import into the active agent
memanto migrate mem0
```

See the [migrate command](/cli/migrate/migrate) for providers, options, and output details.

## Export and Sync

### Export to Markdown

```bash theme={null}
memanto memory export
```

### Export to Custom Path

```bash theme={null}
memanto memory export --output /path/to/memory.md
```

### Sync to MEMORY.md

```bash theme={null}
memanto memory sync
```

## Performance Tips

1. Use specific memory types instead of defaulting everything to `fact`.
2. Batch ingest when importing many items.
3. Keep recall limits tight for faster, cleaner responses.
4. Use confidence scoring when information quality varies.

## Best Practices

### <Icon icon="check" /> DO

* Keep memories concise and atomic.
* Record source context in metadata when useful.
* Resolve conflicts explicitly when contradictions arise rather than deleting history.

### <Icon icon="xmark" /> DON'T

* Store the same fact repeatedly.
* Mix multiple unrelated facts in one memory.
* Over-fetch with very high recall limits by default.

## Next Steps

* **CLI**: [Remember](/cli/data/remember), [Recall](/cli/search/recall)
* **API**: [Remember](/api-reference/data/remember), [Recall](/api-reference/search/recall)
* **Temporal Guide**: [Temporal Memory Details](./temporal-memory)

***

Memory operations are the core of Memanto. Keep this flow lean, typed, and conflict-aware for best results.
