Cortex turns a folder of Markdown into persistent memory for AI agents. A native macOS app (Cortex.app) shows the whole knowledge graph as a live constellation, an MCP server gives any agent search plus full read/write, and an agent skill teaches the agent when to recall and when to record. Everything runs locally.
The problem
Every AI assistant starts each conversation from zero. Project context is scattered across notes, files and chats, and the assistants that do offer memory keep it inside one product, in the cloud, where you can't read or edit it. Plain RAG only retrieves: nothing writes decisions back, so the knowledge base goes stale the moment you stop maintaining it by hand.
The approach
Keep ordinary Markdown as the source of truth and build everything else as a derived view. A background watcher re-embeds changed notes within about two seconds using local Ollama embeddings and a single sqlite-vec file. One engine then serves three faces: an MCP server that works in any agent, with hybrid search, transactional writes, graph tools, a project-state engine and undo; Cortex.app, a native SwiftUI app with the live constellation graph, a reader with a local-graph mini-map and ⌘K search; and an agent skill that tells the agent to recall before answering and record after deciding.
- 01Watch
Markdown stays the source of truth; changed notes are picked up within ~2 s.
- 02Embed
Chunks are embedded locally with Ollama into one sqlite-vec file.
- 03Retrieve
Semantic, hybrid (BM25 ⊕ vector), literal and frontmatter search.
- 04Connect
Wiki-link graph: hubs, clusters, shortest paths and unlinked-but-related bridges.
- 05Record
Transactional writes with a journal, provenance log and one-call undo.
The notes remain ordinary Markdown; the index can be deleted and rebuilt at any time.
What made it hard
Memory is only useful if it stays correct without babysitting. The watcher has to re-embed edits, prune deleted notes and survive crashes; a health check catches a silently dead watcher before it serves stale answers. Writes had to be all-or-nothing, so multi-file updates go through a journal that rolls back to byte-identical on failure, and every change is logged with a diff and undo. Shell access is powerful and dangerous, so it is off by default and gated behind an explicit flag.
What it showed
Cortex is the memory I use every day: every project session recalls from it and records back to it, over a vault of about 180 notes and 2,859 chunks. The public repository ships the MCP server and the macOS app, which auto-updates from GitHub releases, and the agent skill packages the recall-and-record workflow for any agent that supports skills. What sets it apart: it works in every MCP client rather than one app, it reads and writes rather than only retrieving, it is fully local, and its moving parts are one process and one sqlite file. No retrieval-accuracy benchmark or user-adoption figure is claimed.
| Cortex | Plain RAG | In-editor plugins | |
|---|---|---|---|
| Works in | Every MCP client | One app or integration | The editor only |
| Reads and writes | Full transactional CRUD | Retrieval only | Partial |
| Privacy | 100% local | Often cloud | Varies |
| Moving parts | One sqlite file, one process | Vector DB plus service | Editor plus plugin |
What didn't work
- It could go stale without saying so
If the watcher or Ollama died, search quietly returned old results. A health check now reports watcher heartbeat, disk-versus-index counts and code drift.
- The transactional write surface has gaps
Moving a note and creating one from a template still go through older single-purpose tools, outside the all-or-nothing write path.
- Shell access is a sharp edge
The persistent terminal is not scoped to the vault, so the flag that enables it is the only barrier. It is off by default and must never run on a remote server.
- No accuracy benchmark exists
There is no retrieval-accuracy figure or adoption number. The evidence is daily personal use.