Context & Memory
Mesachat maintains conversation context so AI agents can provide relevant, coherent responses over time.
Context Window
The context window determines how much conversation history is included with each AI request. This is configurable at multiple levels:
| Scope | Description |
|---|---|
| Global | Default for all conversations |
| Tenant | Override for a specific tenant |
| Bot | Override for a specific bot |
| User | Override for a specific user |
Resolution follows the most-specific-wins pattern: User > Bot > Tenant > Global.
How Context is Assembled
For each incoming message, Mesachat:
- Retrieves recent messages from hot storage (PostgreSQL)
- If needed, fetches archived messages from cold storage
- Assembles the context within the configured window size
- Includes system prompts and agent instructions
Semantic Memory
Beyond raw conversation history, Mesachat supports semantic memory — AI-indexed memories that persist across conversations:
- Long-term facts the user has shared
- Preferences expressed over time
- Key decisions from past conversations
Hot & Cold Storage
Mesachat uses a tiered storage architecture for optimal performance:
- Hot tier (PostgreSQL) — Recent messages for fast context assembly
- Cold tier (Object Storage) — Archived messages for long-term retention
Messages are automatically archived based on configurable retention policies.
GDPR Compliance
Mesachat supports GDPR data management:
- Per-tenant encryption keys for crypto-shredding
- Deletion requests tracked in an immutable audit log
- Message tombstones for logical deletion