Minimalist, monochrome AI writing studio & local-first Markdown knowledge platform.
CortexMD blends a calm, Zen-inspired monochrome AI writing canvas (Carbon Black & Pure White, OS-adaptive) with plain Markdown vaults, inline tracked-changes AI diffs, editorial margin critique, and a zero-key local AI studio — deployable on your homelab or as a native offline desktop app.
Zen Writing Studio · Features · Architecture · AI Studio · Quick Start · Security
Tip
Zero API Keys Required: CortexMD ships with a built-in local-hybrid writing & RAG engine (offline proofreader, editorial critique analyzer, SQLite FTS5 BM25 + 384-dimension semantic embeddings). Your notes stay on your disk and never leave your machine unless you explicitly enable an external LLM provider.
Designed for deep, distraction-free writing with restrained Carbon Black (#0a0a0a / #111111) and Pure White (#ffffff / #fafafa) aesthetics:
- Automatic Windows / OS Theme Sync: Defaults to
Auto(prefers-color-scheme+ ElectronnativeTheme), switching live between Carbon Black and Pure White whenever you toggle OS dark/light mode — including the native frameless WindowstitleBarOverlay. - 6 Self-Hosted Minimalist Brutalist & Editorial Fonts (bundled offline via
next/font/google):- Space Grotesk (Neo-Brutalist Sans) · IBM Plex Sans (Swiss Editorial) · IBM Plex Mono (Technical Mono) · Space Mono (Architectural Brutalist) · JetBrains Mono (Crisp Code Mono) · Newsreader (Optical Literary Serif)
- Live Markdown Typography While Typing: Headings,
**bold**,*italic*,`code`,> quotes, links,[[WikiLinks]], and---dividers style live in the editor with dimmed syntax markers and zero caret drift. - True Paragraph Focus & Typewriter Centering: Dim surrounding prose to 25% opacity while keeping your active paragraph razor-sharp, and optionally lock the cursor line vertically centered as you type.
- Inline Tracked-Changes AI Diffing: Review streaming AI rewrites at word, sentence, or character granularity directly in prose with per-change Accept/Reject (
Tab/Y/N), inline code/WikiLink/URL protection, and a quick AI Engine Switcher inside theAI Editmenu. - Editorial Critique / Margin Comments: Run an editorial pass (
POST /api/ai/critique) to surface concise margin notes on wordiness, passive voice, repeated words, long sentences, and glossary violations — each with a 1-clickFix Inlinebutton that opens directly into tracked diff review. - In-Note Find & Replace (
Ctrl+F/Ctrl+H): Floating monochrome bar with live match highlights, counter, case sensitivity (Aa), regular expressions (.*), Replace, and Replace All. - Version History Visual Diff & Note Compare: Compare your live draft against any past snapshot or any other workspace note using the same word/sentence/char tracked-changes viewer to cherry-pick edits.
- Writing Targets Hairline & Focus Sprint Timer: Set a word target (
500/1000/2000) to display a razor-thin2pxmonochrome progress hairline across the top of the canvas, paired with a discreet15m/25msprint timer in the footer. - Open Any Local
.mdFile Directly (Desktop): Open and save standalone.md/.markdownfiles anywhere on disk viaCtrl+Shift+O, sidebar button, or OS "Open with CortexMD" file association without importing into a vault.
|
|
|
|
| Capability | Local-First Sync Tools | Cloud SaaS Editors | CortexMD |
|---|---|---|---|
| Data Ownership | Plain .md on disk |
Proprietary cloud DB | Plain .md + direct local file opening |
| AI Editing UX | Chat sidebar copy/paste | Opaque full-doc rewrites | Streaming inline word/sentence/char diffs + margin critique |
| AI & RAG | Paid plugins & API keys | Cloud-only | Zero-key local-hybrid built-in + BYO LLM |
| AI Access Control | Unrestricted file reads | Vendor-managed | Per-folder ACLs (allow/deny) + diff approval |
| Export & Collab | Community plugins | Locked formats | Native .docx/PDF/HTML export + two-way Google Docs sync |
| Deployment | Desktop only | Hosted only | Offline Desktop + Docker / Proxmox + PWA |
flowchart LR
subgraph Clients["Clients & Capture"]
Web["Web & Mobile PWA\n(Carbon/White · IndexedDB Mirror)"]
Desktop["Electron Desktop App\n(Frameless Titlebar · Direct .md Open)"]
Webhook["Quick Capture API\nPOST /api/capture"]
end
subgraph Core["CortexMD Monolith (Next.js 15 + Node 22/24)"]
API["REST + SSE Layer\n(RBAC · CSRF · SHA-256 Sync)"]
Zen["Zen Writing Engine\n(Prose Diff · Critique · Export · GDrive)"]
Index["Indexer & Graph Engine\n(WikiLinks · Transclusions · Queries)"]
AI["Grounded AI Studio\n(FTS5 BM25 + 384-dim Vectors + ACLs)"]
end
subgraph Storage["Local-First Storage"]
Vaults["Plain Markdown Vaults\n(Inbox · Projects · Areas · Resources · Archive)"]
SQLite["SQLite WAL Index\n(FTS5 · Embeddings · Versions · Prompts)"]
end
Clients --> API
API --> Zen
API --> Index
API --> AI
Index <--> Vaults
Index <--> SQLite
Zen <--> SQLite
AI --> SQLite
Choose zero-key offline intelligence by default, or switch engines anytime right inside the AI Edit dropdown or Settings:
| Provider | Execution | Requirements |
|---|---|---|
local-hybrid (Default) |
Embedded proofreader, editorial critique, FTS5 + 384-dim vectors | None — 100% offline, zero API keys |
ollama |
Self-hosted local models | OLLAMA_BASE_URL, OLLAMA_MODEL |
gemini-cli |
Local CLI (Google OAuth 2.0) | Local Gemini CLI login |
github-copilot |
GitHub OAuth pass-through | COPILOT_GITHUB_TOKEN |
jetbrains-junie |
Headless CLI / BYOK | JUNIE_API_KEY |
gemini-api |
Google Gemini Cloud API | GEMINI_API_KEY |
Important
CortexMD is engineered with defense-in-depth for both self-hosted homelabs and agentic AI workflows.
- Pre-Retrieval Folder ACLs: Restricted directories (such as
Private/) are filtered before chunks ever enter RAG retrieval, inline rewrites, critique passes, or external LLM prompts. - Prompt Injection Isolation: Indexed note content is wrapped in
<untrusted_note_data>boundaries before being forwarded to any external model. - Human-in-the-Loop Mutations: AI edits and agent proposals open as reviewable diffs — no file on disk is ever modified without explicit user approval.
- Encrypted Credentials & Hardened Auth: Google Drive OAuth tokens and provider API keys are encrypted at rest with
APP_SECRET;scryptper-user salted password hashing,HttpOnlysessions, CSRF tokens, optional reverse-proxy SSO (TRUSTED_PROXY_AUTH_HEADER), and workspaceadmin/editor/viewerroles.
Run CortexMD 100% offline with zero Docker, automatic single-user login, native Carbon/White window chrome, direct .md file opening, and vaults stored in Documents/CortexMD/vaults/.
- Pre-built Installers: Download
.exe/.zip(Windows),.dmg/.zip(macOS Apple Silicon & Intel), or.AppImage/.deb/.tar.gz(Linux) from GitHub Releases. - Run or package from source:
git clone https://github.com/LukaG712/CortexMD.git cd CortexMD npm install npm run desktop # Launch desktop app locally npm run dist:win # Build Windows (.exe, .zip) npm run dist:mac # Build macOS (.dmg, .zip x64 + arm64) npm run dist:linux # Build Linux (.AppImage, .deb, .tar.gz)
git clone https://github.com/LukaG712/CortexMD.git
cd CortexMD
cp .env.example .env
# Edit .env to set strong ADMIN_PASSWORD and APP_SECRET (32+ chars)
docker compose -f docker/docker-compose.yml up -d --buildOpen http://localhost:3000 (default .env.example credentials: admin / cortex-admin-change-me).
Persistent vaults and SQLite data live outside the container at ./data and ./backups.
git clone https://github.com/LukaG712/CortexMD.git
cd CortexMD
cp .env.example .env
npm install
npm run devVerification Scripts & Mobile PWA Setup
npm run dev # Start Next.js development server
npm run lint # Run TypeScript compiler check (tsc --noEmit)
npm test # Run Vitest end-to-end platform & Zen Studio suites (27 tests)
npm run build # Build production Next.js bundle
npm start # Serve production buildMobile PWA: Open your CortexMD URL in Chrome/Firefox (Android) or Safari (iOS) and tap Install App / Add to Home Screen for full-screen offline access via IndexedDB and native Web Share Target support.
Keyboard Shortcuts, Live Queries & Flashcard Syntax
| Shortcut | Action |
|---|---|
Ctrl+K / Cmd+K |
Faceted Command Palette (Hybrid FTS5 + semantic search) |
Ctrl+I / Cmd+I |
Inline AI Rewrite (opens streaming tracked-changes diff) |
Ctrl+F / Cmd+F |
In-Note Find (highlights, case-sensitive Aa, regex .*) |
Ctrl+H / Cmd+H |
In-Note Find & Replace |
Ctrl+S / Cmd+S |
Save current vault note or standalone local .md file |
Ctrl+Shift+Z / Cmd+Shift+Z |
Toggle distraction-free fullscreen Zen Mode |
Tab / Y / N |
(In Inline Diff Review) Jump hunk / Accept / Reject |
Ctrl+Shift+O / Cmd+Shift+O |
(Desktop) Open any local .md file directly from disk |
Ctrl+O / Cmd+O |
(Desktop) Open Vault directory in OS File Explorer / Finder |
Live Embedded Queries (cortex-query):
```cortex-query
tag: #homelab
status: active
sort: updated desc
view: table
limit: 10
```SM-2 Flashcards:
Q: What isolates Proxmox LXC backups?
A: Separate HDD dataset and incremental snapshots.
SM-2 :: SuperMemo-2 spaced repetition algorithm.
### Default Hash Algorithm #card
scryptSync with per-user 16-byte random salt.Quick Capture Webhook (POST /api/capture)
Set CORTEX_CAPTURE_TOKEN in .env to append notes from mobile shortcuts, Home Assistant, or cron jobs:
curl -X POST http://localhost:3000/api/capture \
-H "Authorization: Bearer YOUR_CAPTURE_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"workspaceSlug": "personal",
"title": "Homelab Alert",
"text": "Proxmox nightly backup completed.",
"url": "https://pve.local:8006",
"tags": ["homelab", "backup"],
"target": "inbox"
}'Set "target": "daily" to append to journals/YYYY-MM-DD.md instead of Inbox/Quick Captures.md.
Environment Variables (.env)
| Variable | Description | Default / Example |
|---|---|---|
CORTEX_DATA_DIR |
Directory holding vaults & SQLite index | ./data (/data in Docker) |
ADMIN_USERNAME |
Initial administrator username | admin |
ADMIN_PASSWORD |
Initial administrator password | cortex-admin-change-me |
APP_SECRET |
Session signing & encrypted key secret (32+ chars) | (set in .env) |
CORTEX_CAPTURE_TOKEN |
Bearer token for POST /api/capture |
(empty = disabled) |
GEMINI_API_KEY |
Optional Gemini API key | (optional) |
COPILOT_GITHUB_TOKEN |
Optional GitHub Copilot token | (optional) |
JUNIE_API_KEY |
Optional JetBrains Junie API key | (optional) |
OLLAMA_BASE_URL |
Ollama server endpoint | http://127.0.0.1:11434 |
OLLAMA_MODEL |
Default Ollama model name | llama3.2 |
TRUSTED_PROXY_AUTH_HEADER |
Reverse-proxy OAuth username header | (empty = disabled) |
CortexMD/
├── .github/workflows/ # Automated Windows, macOS & Linux release builds
├── docker/ # Dockerfile & Docker Compose deployment config
├── docs/ # Architecture, Proxmox deployment, research & plans
├── electron/ # Electron desktop shell, frameless chrome & .md file associations
├── scripts/ # Standalone packaging helpers
├── src/
│ ├── app/ # Next.js App Router pages, fonts & REST/SSE API routes
│ ├── components/ # Zen Editor, Inline Diff, Critique, Export/GDrive & PKM views
│ └── lib/ # Prose diff, editor backdrop, DOCX/HTML export, GDrive, RAG & SQLite
└── tests/ # Vitest config & end-to-end platform + Zen Studio test suites (27 tests)
- Architecture Overview
- Proxmox & Docker Deployment Guide
- Research & Ecosystem Comparison
- Implementation Plan
- Implementation Status