StackMap
Subscribe
Explore / cortexdb
liliang-cn

cortexdb

Agent memory plus a knowledge graph with ontology constraints in one SQLite file: pure Go, no server, no embedding model required. Plugins for Claude Code, Codex, dsh and Obsidian.

475 27 Go MITupdated yesterday
View on GitHubDispute this mapping →
Curator's take

Use it when you want local, inspectable memory that is more structured than notes (typed entities, ontology rules, traceable recall) but don't want to run Postgres or Neo4j. Embeds as a Go library, with clients for Rust, Python and Node. Skip it for team-scale shared memory under heavy concurrent writes, or if you just want plain Markdown you can read and edit by hand.

Mapped by ShipWithAI editors · links verified

Continue your stack

What teams reach for next — and why each earns a place beside cortexdb. Ranked by curator confidence.

pairs wellalternativealternativealternativealternativedeepseek-harnessengrimagent-memorylatticedbgraphiclecortexdb
pairs wellalternativebuilt withpick a node for the why · open it from the panel
Weekly digest
README.md2 min read

CortexDB

Go Reference CI codecov License: MIT

AI memory and a knowledge graph in one SQLite file. Pure Go, no service to run, works without an embedding model.

The CortexDB live view

Install

Go library go get github.com/liliang-cn/cortexdb/v2
Claude Code /plugin marketplace add liliang-cn/cortexdb, then /plugin install cortexdb@cortexdb
Codex codex plugin marketplace add liliang-cn/cortexdb && codex plugin add cortexdb@cortexdb
Claude Code mod (optional) /plugin install cortexdb-live@cortexdb
DeepSeek Harness dsh plugin --profile web add "github:liliang-cn/cortexdb#semver:^2&path:/plugins/dsh-cortexdb-memory" (guide)
Obsidian unzip a release's cortexdb-obsidian.zip into <vault>/.obsidian/plugins/ (guide)
Shared-brain server go install github.com/liliang-cn/cortexdb/v2/cmd/cortexdb-grpc@latest
Clients cargo add cortexdb-client · pip install cortexdb-client · npm install cortexdb-client

Use

db, _ := cortexdb.Open(cortexdb.DefaultConfig("brain.db"))
defer db.Close()
brain := db.KnowledgeMemory()
_, _ = brain.Remember(ctx, cortexdb.KnowledgeMemoryRememberRequest{MemoryID: "alice-tabs", UserID: "alice", Scope: "user", Content: "Alice prefers tabs."})
rec, _ := brain.Recall(ctx, cortexdb.KnowledgeMemoryRecallRequest{Query: "what does Alice prefer?", UserID: "alice"})
fmt.Println(rec.ContextPack.Text)

The plugin gives Claude Code and Codex one global brain at ~/.cortexdb/cortexdb.db, /remember, /recall and an auto-recall hook. A session starts with an index of what the brain knows about its project, an agent about to open a file is told what happened to it before, and a session's durable facts are captured with <private> text and credentials kept out. Point several agents or machines at one cortexdb-grpc and they share the same memory and graph.

In Codex, review and trust the plugin hooks in /hooks to activate automatic recall. See the plugin guide for setup and cortexdb-mcp --doctor --self-test diagnostics (v2.119.0+).

Claude Code mod

cortexdb-live is an optional mod that runs inside Claude Code on top of the cortexdb plugin. Install it after the plugin:

/plugin install cortexdb-live@cortexdb

The mod calls three of the plugin's tools itself, and a hook gets no permission prompt, so allow them once in ~/.claude/settings.json (not needed in bypass mode):

"permissions": {
  "allow": [
    "mcp__plugin_cortexdb_cortexdb__knowledge_memory_recall",
    "mcp__plugin_cortexdb_cortexdb__graph_statistics",
    "mcp__plugin_cortexdb_cortexdb__memory_save"
  ]
}

Without them the status line names the missing rules.

  • Planned recall. Before the brain is searched, haiku turns each prompt into keywords in Chinese and English, aliases, entity names and a retrieval mode. A bare "ok" or "go ahead" searches nothing. The band above the prompt shows what was recalled; expand it to see the plan and every hit. Hide lasts until the next recall; /cortexdb-show brings the hidden one back.
  • Status line. Which brain the session uses, its node count and how long the last recall took, or why the brain can't be reached.
  • Capture. 90 seconds after a session goes idle, haiku distils the new part of the