Guide
How to add persistent memory to Claude apps
Claude is powerful, but your application still needs durable user context. Mnexium adds memory, chat history, profiles, records, and agent state around Claude calls without forcing a custom memory stack.
1. Send Claude-compatible requests
Use Mnexium as the memory-aware API layer and include your Anthropic key in the request headers.
curl -X POST "https://mnexium.com/api/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "x-mnexium-key: $MNX_KEY" \
-H "x-anthropic-key: $ANTHROPIC_API_KEY" \
-d '{
"model": "claude-sonnet-4-20250514",
"messages": [
{ "role": "user", "content": "My name is Alex and I prefer concise answers." }
],
"mnx": {
"subject_id": "user_123",
"chat_id": "chat_abc",
"learn": true,
"recall": true,
"history": true
}
}'2. Use stable IDs
The subject_id should map to the user, customer, account, or entity Claude should remember. The chat_id should map to the conversation thread.
- Use the same
subject_idwhen the same user returns. - Use the same
chat_idwhen continuing a conversation. - Set
learnto capture durable memories from the exchange. - Set
recallto retrieve relevant memories before Claude responds.
3. Add structured context when needed
Memory is useful for preferences and facts. Records and profiles are better for structured application data such as accounts, orders, preferences, saved objects, and workflow state.
{
"mnx": {
"subject_id": "user_123",
"recall": true,
"records": {
"recall": true,
"learn": "auto",
"tables": ["account", "project"]
}
}
}Common mistakes
- Using a new random
subject_idon every request, which prevents continuity. - Saving everything as raw vector text when some context belongs in profiles or records.
- Forgetting to enable recall on requests that should use prior memory.
- Mixing provider keys and Mnexium keys in the wrong headers.