Cortex – A Local-First Knowledge Graph for Developers

Dev.to / 3/27/2026

💬 OpinionDeveloper Stack & InfrastructureIdeas & Deep AnalysisTools & Practical Usage

Key Points

  • Cortex is a local-first knowledge graph that watches developer project directories and extracts developer knowledge such as decisions, patterns, components, dependencies, and constraints using LLMs.
  • It infers relationships across projects and can detect contradictions when related decisions conflict, helping developers maintain consistent context over time.
  • Users can query the graph in natural language and receive answers grounded in their actual codebase with source citations to reduce hallucinated guesses.
  • The extraction pipeline runs locally and supports configurable LLM providers (OpenAI, Anthropic, Ollama, LM Studio), with cloud/local routing during question answering.
  • Cortex is available as an open-source (MIT) npm package with CLI commands to initialize, watch folders, and query the graph (e.g., npx @gzoo/cortex init / watch / query).

I work on multiple projects. Decisions, patterns, and context end up scattered across hundreds of files. I forget what I decided three months ago. I re-solve problems I already solved in another repo.

So I built Cortex — a local-first knowledge graph for developers.

It watches your project directories, extracts knowledge automatically using LLMs, and gives it back to you when you need it.

What it does

  • Watches your project files (md, ts, js, json, yaml) for changes
  • Extracts entities: decisions, patterns, components, dependencies, constraints
  • Infers relationships between entities across projects
  • Detects contradictions when decisions conflict
  • Queries in natural language with source citations
  • Routes intelligently between cloud and local LLMs

How it works

Cortex runs locally. You point it at your project directories and it builds a knowledge graph in the background. When you query it, you get answers grounded in your actual codebase — not hallucinated guesses.

The extraction pipeline uses configurable LLM providers (OpenAI, Anthropic, Ollama, LM Studio) so you can keep everything local if you want.

Quick start

npx @gzoo/cortex init
npx @gzoo/cortex watch ~/projects
npx @gzoo/cortex query "what patterns am I using for error handling?"

Why I built this

I kept losing context. Not code — context. The reasoning behind decisions, the constraints I discovered, the patterns I settled on. Cortex captures that stuff automatically so I can actually find it later.

It's open source, MIT licensed, and on npm.

GitHub: github.com/gzoonet/cortex
npm: npmjs.com/package/@gzoo/cortex

Would love feedback. What kinds of knowledge do you lose track of across projects?