Architecture
Architecture Overview
Magneteco system architecture and design principles
Architecture Overview
Magneteco is a multi-tenant memory service designed to provide persistent, domain-aware memory for AI agents across multiple applications. It combines vector similarity search with knowledge graphs to enable both semantic retrieval and precise relationship queries.
Design Principles
- Memory is infrastructure, not a feature — Build once, use everywhere
- Domain-aware extraction — Each app teaches the system what matters
- Events, not just conversations — Memory comes from system events too
- Temporal awareness — Recent information is weighted higher
- Conflict resolution — New facts supersede old, with audit trail
- Graceful degradation — System works even if graph is unavailable
System Architecture
┌──────────────────────────────────────────────────────────────────────────────┐
│ CLIENTS │
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
│ │ App A │ │ App B │ │ App C │ │ Webhook │ │
│ │ (Agent) │ │ (Agent) │ │ (Agent) │ │ Sources │ │
│ └────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘ │
└───────┼────────────┼────────────┼────────────┼───────────────────────────────┘
│ │ │ │
└────────────┴─────┬──────┴────────────┘
│
▼
┌──────────────────────────────────────────────────────────────────────────────┐
│ API GATEWAY │
│ │
│ POST /memorize POST /events POST /webhooks/:source │
│ POST /retrieve GET /context POST /forget │
│ GET /categories GET /entities GET /health │
└──────────────────────────────────────────────────────────────────────────────┘Data Layer
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ PostgreSQL │ │ Neo4j │ │ S3 │
│ + pgvector │ │ (Graph) │ │ (Raw Logs) │
│ │ │ │ │ │
│ • items │ │ • Entities │ │ • Immutable │
│ • categories │ │ • Relations │ │ • Versioned │
│ • checkpoints │ │ • Mentions │ │ • Timestamped │
│ • resources │ │ │ │ │
└─────────────────┘ └─────────────────┘ └─────────────────┘Multi-Tenancy
All data is partitioned by app_id:
- PostgreSQL:
app_idcolumn on all tables, indexed - Neo4j:
app_idproperty on all nodes - S3:
{app_id}/{user_id}/{resource_id}key structure
This enables:
- Complete data isolation between apps
- Per-app domain configurations
- Independent scaling per app if needed
- Simple data deletion per app
Performance Characteristics
Write Path
- Synchronous: S3 write + Postgres resource record + SQS queue (~100ms)
- Asynchronous: Extraction + embedding + graph (~5-10s)
Read Path
- Category selection: ~500ms (LLM call)
- Vector search: ~50ms
- Graph traversal: ~100ms
- Total: ~700ms typical, ~1.5s worst case