← bsozudogru.com

Cortex AI

Project · 2025-2026

Most AI memory tools are filing cabinets. Cortex AI is a brain. It consolidates today's signals while you sleep, models what you have forgotten, surfaces what is conspicuously absent from your current work, and explains every retrieval with a glass-box attribution graph. Local on macOS, no cloud, no telemetry.


Cortex AI runs as a Model Context Protocol server and continuously indexes the user's macOS environment: calendar, screen OCR, git, shell, browser. Five connectors feed a normalized SQLite store that AI coding assistants query for ranked context, without manual prompting.

Where it differs from other context tools is the cognitive layer above the store. Four primitives borrowed from neuroscience and the calibration literature turn passive recall into something closer to working memory: idle-time consolidation, theory-of-mind tracking of the user's knowledge state, dual-of-recall absence detection, and calibrated retrieval probabilities backed by a Brier reliability diagram.

All data stays local in ~/.cortex/. Nothing leaves the machine.


Architecture

Five layers: connectors that ingest from macOS sources, a normalized SQLite store with FTS5 and migration-versioned schema, a relevance engine, a cognitive layer that adds biologically-motivated primitives on top, and the MCP interface plus a portfolio-grade visualization.

CONNECTORS Calendar Screen Git Shell Browser STORAGE SQLite + FTS5 + 21 migrations RELEVANCE Scorer / Entities / Work Streams / Memory Threads COGNITIVE LAYER Hippocampal consolidation Theory-of-Mind user model Negative space retrieval Introspection + calibration INTERFACE MCP Server (56 tools) Constellation viz

Cognitive Primitives

The four systems that turn the relevance store into a brain-shaped memory.

Primitive Mechanism Reference
Hippocampal consolidation During idle windows, episodes consolidate into semantic capsules and procedural rules. Interleaved replay at 4:1 novel-to-familiar ratio prevents catastrophic forgetting. Three memory tiers: episodic, semantic, procedural. McClelland 1995
Buhry 2011
Liu 2025
Theory-of-Mind user model Tracks per-entity exposure history, applies an Ebbinghaus-style forgetting curve, and surfaces entities that the user is statistically likely to have forgotten. Entities reinforced by user activity decay slower than entities seen only via passive retrieval. ToM-SWE
arXiv:2510.21903
Negative-space retrieval The dual of recall. Surfaces entities conspicuously absent from current work given historical co-occurrence. P(B | A) computed against a separately-tracked window-count denominator to avoid the collapsed-to-1.0 trap. Original
Introspection + calibration Every retrieval ships with a glass-box attribution graph: per-signal contribution + counterfactual ablation per signal. Raw scores map to calibrated probabilities via Platt scaling or isotonic regression with persistent self-recalibration; reliability bins backed by Brier score. Platt 1999
Zadrozny 2002
Brier 1950

Constellation View

The cognitive layer is rendered as a gravitational system. Each entity is a body whose mass encodes importance, orbital period encodes recurrence interval, distance from the central star encodes recency, and color encodes memory tier (episodic / semantic / procedural). Time-scrubbable across a 90-day window.

Pure HTML5 Canvas2D with no runtime dependencies. The minified bundle is 8.7 KB. The page degrades gracefully to a frozen-frame layout when prefers-reduced-motion is set, and the 56 entities reflow into a usable layout below 768 px.


Connectors

Five connectors continuously sync data from macOS sources into a normalized schema. Each connector exposes a probe() method that distinguishes "available, disabled in config" from "unavailable" with a concrete reason.

Source Method Data Captured
Calendar JXA (macOS native) Events, attendees, times
Screen screenpipe OCR Active apps, visible text
Git CLI Commits, branches, diffs
Shell History file Recent commands
Browser SQLite DBs URLs, titles, timestamps

MCP Tools

Fifty-six tools across eight functional groups. AI coding assistants call them to query context, invoke consolidation, request explanations, or trigger maintenance.

Group Sample tools
Context retrieval get_context, search, briefing, timeline, related
Connector data get_schedule, get_activity, get_git, get_shell, get_browser
Memory tiers consolidate, memory_tiers, memory_threads, memory_health
Theory of mind what_am_i_missing, belief_history, predicted_context
Introspection introspect, calibration_status, calibration_export
Visualization constellation_export
Patterns work_streams, find_entity, rhythms, learning_status
Admin status, sync, feedback, snapshot, purge, rebuild_cooccurrence

Engineering posture

The cognitive layer is implemented entirely with deterministic algorithms (clustering, statistics, regression). No external LLM is called for distillation, divergence detection, or calibration. This preserves the all-local, no-cloud, no-Python identity of the project at the cost of some recall in the belief-extraction heuristics.

Strict TypeScript with exactOptionalPropertyTypes. Each cognitive primitive ships with its own evaluation harness: regression-eval for consolidation (catastrophic-forgetting + compression ratio), Brier reliability diagram for calibration, attribution-sum invariant for introspection. The CI runs on macOS so the JXA-dependent and process-lifecycle tests are exercised against the real platform.