Architecture
cortex-engine is a cognitive layer between your AI agent and its persistent memory. It handles storage, embeddings, retrieval, and tool routing.
Overview
Your Agent (Claude, GPT, Gemini, etc.)
|
v
+---------------------------+
| cortex-engine SDK |
| observe, query, validate |
| evolve, wander, believe |
+--------+--------+--------+
| |
Storage Embeddings
(SQLite/ (Ollama/
Firestore) Vertex/OpenAI)
| |
v v
+---------------------------+
| MCP Server |
| Tools exposed via Model |
| Context Protocol |
+---------------------------+
Storage Providers
- SQLite (default) — Local file storage. Zero config. Good for single-agent setups and development.
- Firestore — Cloud-native. Real-time sync. Good for production and multi-device agents.
Embedding Engines
- Ollama (default) — Local embeddings via
nomic-embed-textor similar. Free, private, no API keys. - Vertex AI — Google Cloud embeddings. Production-grade, scalable.
- OpenAI — OpenAI embeddings API. Requires API key.
MCP Integration
cortex-engine exposes all tools via the Model Context Protocol. This means any MCP-compatible client (Claude Code, Cursor, custom agents) can use cortex tools natively.
The MCP server is started with npx fozikio serve and can be pointed at by any client via stdio or SSE transport.
Namespaces
Each agent operates in a namespace — a scoped partition of the memory store. Namespaces ensure agents don't read or write each other's memories. This is the foundation of multi-agent support.
Memory Model
Memories are stored as observations with:
- Content — The text of the observation
- Embedding — Vector representation for semantic search
- Salience — FSRS-based score that decays over time and strengthens with retrieval
- Metadata — Timestamps, source, tags