Architecture
Cortex is a Local-First Knowledge Infrastructure designed to preserve technical truth and eliminate technical amnesia.
The Core 5 Primitives
Cortex allows you to compose 5 core primitives to manage AI context:
1. ctx/store
Save memories (facts, decisions, code patterns) into the local SQLite database.
2. ctx/route
Find the most relevant context for a given task or query using hybrid search (FTS5 + Semantic).
3. ctx/get
Retrieve specific items by type or tags for manual context injection.
4. ctx/guard
Sanitize and validate AI outputs to ensure compliance and security.
5. ctx/scan
Analyze project structure to extract deep architectural context automatically.
Relationship with MCP
Cortex implements the Model Context Protocol (MCP), acting as a standardized server that exposes these primitives as tools to any compliant AI client.