Generated banner for CortexDB
Generated logo for CortexDB

CortexDB

Memory framework

First committed by liliang-cn

Published in liliang-cn/cortexdb. Publisher page

478 GitHub stars

What it is

Local-first AI agent memory with a knowledge graph, ontology constraints, and traceable reasoning—all in one SQLite file.
— the description by liliang-cn

AutoGineer overview, from the brain’s own files

CortexDB is a memory framework designed for AI agents that provides persistent, structured, and traceable storage. It integrates a knowledge graph with vector and full-text search capabilities, allowing agents to store and retrieve information with semantic context. The system supports complex data types, including media, and maintains a history of changes to the graph and ontology. It is built to be portable, operating as a pure Go library or a service, and supports multi-agent environments through shared gRPC connections. With features like SHACL-based ontology governance and traceable reasoning, it enables agents to manage project context, session history, and durable facts effectively.

How it works

Memory model: Hybrid

AutoGineer overview, from the brain’s own files

CortexDB stores all memory and knowledge graph data in a single SQLite file. It uses a hybrid retrieval approach that combines vector search, full-text search, and graph traversal. Agents interact with the database through a set of tools that allow them to remember facts, recall information, and manage an ontology. The system tracks the history of every change, including additions, replacements, and retractions, and provides a live 3D view for visualizing the graph and monitoring agent activity.

Folders
FolderRoleFiles
.githubagent-config6
docsdocs54
examplesexamples41
pkgsource-code1671
scriptsscripts2
skillsagent-instructions6
.agentsfolder3
.claude-pluginfolder1
clientsfolder72
cmdfolder85
deployfolder10
internalfolder8
pluginsfolder79
protofolder9

The agent reads

Requirements

Runtimes: Go

Databases: PostgreSQL, SQLite

API keys (by name): CORTEXDB_EMBED_API_KEY, CORTEXDB_GRPC_TOKEN, CORTEXDB_MEDIA_EMBED_API_KEY, CORTEXDB_MEDIA_TRANSCRIBE_API_KEY, OPENAI_API_KEY

Works with: Claude Code

Set it up

  1. This brain runs code automatically: 4 hooks (codex). Review plugins/cortexdb/hooks/hooks.json before opening the folder in Claude Code. No step below turns a hook on for you.

    • plugins/cortexdb/hooks/hooks.json: ${CLAUDE_PLUGIN_ROOT}/bin/cortexdb-session-start
    • plugins/cortexdb/hooks/hooks.json: ${CLAUDE_PLUGIN_ROOT}/bin/cortexdb-recall
    • plugins/cortexdb/hooks/hooks.json: ${CLAUDE_PLUGIN_ROOT}/bin/cortexdb-file-context
    • plugins/cortexdb/hooks/hooks.json: ${CLAUDE_PLUGIN_ROOT}/bin/cortexdb-session-end
  2. Not scanned by AutoGineerThe author’s README also describes installing it as a Claude Code plugin marketplace. Read its install section: AutoGineer did not scan that path. https://github.com/liliang-cn/cortexdb/blob/d39714c86784edd23d42ce152a0243464ad2b15a/README.md#install
  3. Not scanned by AutoGineerThe author’s README also describes installing it with go install. Read its install section: AutoGineer did not scan that path. https://github.com/liliang-cn/cortexdb/blob/d39714c86784edd23d42ce152a0243464ad2b15a/README.md#install
  4. First committed by liliang-cn. Published in liliang-cn/cortexdb. Licence: MIT License.

Usage

AutoGineer overview, from the brain’s own files

  • Integrating persistent memory into AI agents via Go, Python, Rust, or Node.js clients.
  • Sharing a centralized knowledge base across multiple agents or machines using the gRPC server.
  • Managing project-specific context and session history for coding agents like Claude Code.
  • Visualizing and auditing agent memory and reasoning through a live 3D graph interface.
“Remember that Alice prefers tabs.”
The agent saves the fact 'Alice prefers tabs' into the user-scoped knowledge memory.
“What does Alice prefer?”
The agent retrieves the stored preference from the knowledge memory and provides the answer.

Documentation by liliang-cn

CortexDB

Image: Go Reference Image: CI Image: codecov Image: License: MIT

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

Image: The CortexDB live view: two recalls light up the graph, then the Recalls, Ontology and Library pages

Install

Go librarygo get github.com/liliang-cn/cortexdb/v2
Claude Code/plugin marketplace add liliang-cn/cortexdb, then /plugin install cortexdb@cortexdb
Codexcodex plugin marketplace add liliang-cn/cortexdb && codex plugin add cortexdb@cortexdb
Claude Code mod (optional)/plugin install cortexdb-live@cortexdb
DeepSeek Harnessdsh plugin --profile web add "github:liliang-cn/cortexdb#semver:^2&path:/plugins/dsh-cortexdb-memory" (guide)
Obsidianunzip a release's cortexdb-obsidian.zip into <vault>/.obsidian/plugins/ (guide)
Shared-brain servergo install github.com/liliang-cn/cortexdb/v2/cmd/cortexdb-grpc@latest
Clientscargo 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+).

Live view

A web UI over the brain, local or shared: run cortexdb-mcp-stdio --graph-3d, or ask the agent to call serve_graph_3d.

  • Graph: the knowledge graph in 3D. A recall from any agent or machine lights the records it returned, and the Live feed says who asked what.

  • Recalls: every recall with its plan, its hits and why each ranked (CORTEXDB_RECALL_LOG=1).

  • Changes and Activity: every fact added, replaced or retracted, and the tool calls the brain handled.

  • Ontology: the declared types held against what the records are actually typed as.

  • Library: the same memories as a reading room, shelved by project.

Read-only, light by default, works on a phone, in English or Chinese (the toggle in the top bar). See the guide.

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 conversation into durable memories (auto:<session>:<slug>). Each later pass replaces a memory under the same slug rather than adding a copy. Older memories a new one makes untrue (a host moved, a decision reversed) are marked superseded: kept, but no longer recalled as current. The project's Claude Code file memory (~/.claude/projects/<project>/memory/) is shown to haiku as already recorded, so a capture does not restate a note in other words. A prompt with an image attached is not recalled for.

Haiku runs on Claude Code's own model access, so no API key is needed. Language: /config → cortexdb-live → language (auto, zh, en). The mod honours the plugin's own switches: cortexdb-recall --disable and cortexdb-session-end --disable turn recall and capture off for both. While the mod runs, the plugin's shell recall and capture hooks stand down, so nothing is done twice. Codex keeps those hooks. Mods are an early-access Claude Code feature.

What's inside

  • Vectors (HNSW, IVF, flat, binary codes), FTS5 full-text search, hybrid and graph retrieval

  • EmbeddedConfig for small devices: an SQ8 index, bounded SQLite caches, snapshots that survive a power cut — 100k 768-d vectors open in 0.28 s with a 193 MB heap

  • RAG knowledge, scoped agent memory, context packs with sources — memories say whether they were verified or are a guess, and recall keeps the two apart

  • RDF 1.2 knowledge graph: SPARQL 1.1/1.2, RDFS + OWL 2 RL inference, SHACL Core + SHACL-SPARQL, RDF/XML import — passing the W3C SPARQL 1.1/1.2, RDF 1.2 (Turtle, TriG, N-Triples, N-Quads, RDF/XML) and SHACL test suites; RDFS and OWL 2 RL are covered by the repo's own tests — and read-only Cypher

  • Palantir-style ontology with governed actions

  • 100+ tools, in-process or over MCP

  • serve_graph_3d: a live 3D view to find, ask, query and expand, on desktop or phone, with a Changes page that says in words what was added, replaced or retracted as it happens, and an Entity page with each relation, why its value is in effect and what it replaced; or the same brain as a library, each memory a book on its project's shelf

  • import_agent_memory: bring in what Claude Code, Codex and DeepSeek Harness already remember — memory notes, CLAUDE.md / AGENTS.md, Codex's memories, and optionally past sessions distilled into memories — into a local or shared brain

  • Change feed: every committed write, in order, exactly once

  • Observability: a request id and a W3C trace (traceparent) from MCP through gRPC to the trace and the recall log, recalls that explain themselves and say when they were degraded, embedder health in /metrics and /healthz, and an opt-in recall log with a /recalls page

  • Images, recordings and videos (ingest_media): found by a text question through their caption, visible text and transcript, a hit saying where in the file — with or without an embedder; with a CLIP-style media embedder also by what they show, and by an image (search_media)

  • History of the graph and the ontology: for an entity, relation, triple or schema, every version, when and why it changed, and which one is in effect and why (graph_history, knowledge_graph_history, ontology_history); as_of on SPARQL, find, expand and Cypher; an entity timeline, an As of pin and an ontology version list in the live view

  • SQLite by default, PostgreSQL + pgvector with a postgres:// DSN

Environment

VariableMeaning
CORTEXDB_PATHDatabase file (default ~/.cortexdb/cortexdb.db)
CORTEXDB_REMOTEUse a shared cortexdb-grpc at host:port (plaintext) or https://host (TLS, behind a proxy) instead of a local file
CORTEXDB_GRPC_TOKENBearer token for that server
CORTEXDB_GRPC_ADDRServer listen address (default 127.0.0.1:47821)
CORTEXDB_EMBED_BASE_URL / CORTEXDB_EMBED_API_KEYcortexdb-mcp-stdio: OpenAI-compatible embeddings endpoint and its key (fall back to OPENAI_BASE_URL / OPENAI_API_KEY); unset = lexical mode
OPENAI_BASE_URL / OPENAI_API_KEYServer: the embeddings endpoint and key (cortexdb-grpc reads only these, not CORTEXDB_EMBED_BASE_URL); unset = lexical mode
CORTEXDB_EMBED_MODEL / CORTEXDB_EMBED_DIMEmbedding model and dimension, for both (default text-embedding-3-small / 1536)
CORTEXDB_VECTOR_INDEX / CORTEXDB_BINARY_OVERSAMPLEServer: hnsw (default) or, on a SQLite store, binary (1-bit codes in memory, 1/32 of the vectors, each search rescored from the stored vectors, no snapshot); the oversample is the binary shortlist multiplier, from 1 to 1000 (default 8)
CORTEXDB_REVIEW_GATEServer and cortexdb-mcp-stdio: 1 leaves proposed and rejected documents and memories out of search and recall (default off; a curation filter, not access control)
CORTEXDB_SLOW_MSServer: log calls slower than this, with the time each stage took (default 1000, 0 = none)
CORTEXDB_TRACE / CORTEXDB_TRACE_FILEServer: log every call; also append the records to a JSON-lines file
CORTEXDB_LOG_FORMAT / CORTEXDB_LOG_LEVELServer: text (logfmt, default) or json; debug, info (default), warn, error
CORTEXDB_TRACE_MAX_MB / CORTEXDB_TRACE_KEEP / CORTEXDB_TRACE_MAX_AGE_DAYSServer: rotate the trace file at this size (100), keep this many old files (5) for at most this many days (30)
CORTEXDB_EMBED_PROBE_SECONDSServer: probe the embedder this often, for /healthz and /metrics (default 60, 0 = off)
CORTEXDB_RECALL_LOGServer and cortexdb-mcp-stdio: 1 keeps a log of recalls — queries included — for the /recalls page and the recall_log_* tools (default off)
CORTEXDB_RECALL_LOG_DAYS / CORTEXDB_RECALL_LOG_MAX_ROWSHow long (30 days) and how many (100000) recalls the log keeps
CORTEXDB_MEDIA_VISION_URL / CORTEXDB_MEDIA_VISION_MODELServer and cortexdb-mcp-stdio: an Ollama vision model that captions images and video frames for ingest_media (e.g. http://localhost:11434 / qwen3.5:4b)
CORTEXDB_MEDIA_TRANSCRIBE_URL / CORTEXDB_MEDIA_TRANSCRIBE_MODEL / CORTEXDB_MEDIA_TRANSCRIBE_API_KEYAn OpenAI-compatible …/v1 transcription endpoint for audio and the sound of videos (OpenAI, or whisper.cpp's whisper-server --inference-path /v1/audio/transcriptions --convert)
CORTEXDB_MEDIA_EMBED_URL / CORTEXDB_MEDIA_EMBED_MODEL / CORTEXDB_MEDIA_EMBED_API_KEYA CLIP-style embedding endpoint (infinity's /embeddings with modality) that puts images, video frames and text in one space, so an image is found by what it shows and search_media takes an image as the query
CORTEXDB_MEDIA_EMBED_AUDIO / CORTEXDB_MEDIA_EMBED_MIN_SCORE1 when that model embeds sound too (CLAP); the cosine a media vector must reach to be a hit (0.2)
CORTEXDB_MEDIA_FRAME_INTERVAL / CORTEXDB_MEDIA_MAX_BYTESSeconds between the video frames captioned (10, 0 = none; needs ffmpeg), and the size cap of one file (32 MiB)

Docs

Website · Guide (full feature reference) · Examples · Changelog · 中文

License

MIT

docs/LAUNCH_KIT.md

CortexDB Launch Kit

Last updated: 2026-06-24

This is the copy bank for launching CortexDB in developer communities. Keep the tone concrete, technical, and demo-led: one file, pure Go, local-first AI memory, knowledge graph, MCP tools, and no required vector database service.

Core Positioning

One-liner: CortexDB is a pure-Go, single-file AI memory and knowledge graph library for local-first agents.

Longer hook: SQLite is the kernel: one file holds vectors, lexical/RAG search, scoped agent memory, RDF/SPARQL/RDFS/SHACL knowledge graph data, and MCP tools. It runs without an embedder in lexical mode, or with any OpenAI-compatible embeddings endpoint when semantic search is needed.

Best launch angle: CortexDB already works as cross-session memory storage for Claude Code and Codex: durable local memory plus a queryable knowledge graph, without running a separate vector DB, graph DB, or MCP service stack.

What to show first:

  • go get github.com/liliang-cn/cortexdb/v2

  • A 10-line Go snippet that saves/searches knowledge in lexical mode.

  • Plugin install commands for Claude Code and Codex.

  • A 30-second demo of import -> desensitize -> query -> graph reasoning.

Show HN

Title Options
  1. Show HN: CortexDB - a single-file AI memory and knowledge graph for Go agents

  2. Show HN: CortexDB - cross-session memory for Claude Code/Codex in one file

  3. Show HN: I built a pure-Go SQLite-backed memory + knowledge graph for AI agents

Use option 2 if the launch is centered on the Claude Code/Codex plugin and cross-session memory. Use option 1 for the broader Go-agent launch.

Post Body

Hi HN,

I built CortexDB, a pure-Go embedded library that I am now using as cross-session memory storage for Claude Code and Codex.

The idea is simple: instead of running a vector database, a graph database, and a separate MCP service, keep the agent's durable memory in one SQLite file. That file can hold vectors, lexical/RAG search, scoped agent memory, RDF/SPARQL/RDFS/SHACL graph data, and MCP tools.

It works in two modes:

  • no embedder required: lexical retrieval with SQLite/FTS-style search

  • semantic mode: bring any OpenAI-compatible embeddings endpoint

The part I am most excited about is the Claude Code/Codex plugin. It packages the MCP server and skill so an agent can save/search memory, query the knowledge graph, and build context from a local project database across sessions. For Claude Code, there is also an optional auto-recall hook that injects relevant stored memories into prompts when a real CortexDB file exists.

Useful links:

Things it is not trying to be: a distributed vector database, a full enterprise RDF server, or a hosted memory API. The target is embedded agent infrastructure: one file, inspectable storage, Go APIs, and enough graph semantics to build real workflows.

I would love feedback on the API shape, the plugin install flow, and which demo would make the value clearest.

First Comment

Some implementation details that may be interesting:

  • The top-level pkg/cortexdb facade exposes vectors, text/RAG search, knowledge, memory, KG, tools, and MCP.

  • pkg/graph includes RDF triples/quads, import/export, a practical SPARQL subset, RDFS-lite materialized inference, and SHACL-lite validation.

  • pkg/memoryflow handles transcript ingest, recall, wake-up layers, and promotion for agent memory.

  • pkg/importflow and pkg/connector can import CSV/SQL/live Postgres/MySQL data into RAG + KG with PII masking and CDC sync paths.

  • cortexdb-grpc exposes the facade to Rust, Python, and Node clients.

The easiest thing to try is the lexical path because it needs no API key:

go get github.com/liliang-cn/cortexdb/v2
go run ./examples/02_rag

For agent-tool use:

/plugin marketplace add liliang-cn/cortexdb
/plugin install cortexdb@cortexdb

or in Codex:

codex plugin marketplace add liliang-cn/cortexdb
codex plugin add cortexdb@cortexdb

Reddit: r/LocalLLaMA

Title

I built a local-first AI memory + knowledge graph in one SQLite file

Body

I have been working on CortexDB, a pure-Go embedded memory/KG library for local agents.

The pitch for this community: it gives an agent durable local memory without requiring a separate vector DB service. In lexical mode it needs no embeddings API at all. If you do want semantic retrieval, it can use any OpenAI-compatible embeddings endpoint, including local providers.

What is in the same SQLite file:

  • vector collections

  • lexical/RAG search

  • scoped agent memory

  • RDF/SPARQL/RDFS/SHACL knowledge graph data

  • MCP tools for agent access

The most practical path is the Claude Code/Codex plugin: install it, point it at a project-local CortexDB file, and the agent can save/search memory and query graph facts through MCP tools.

Repo: https://github.com/liliang-cn/cortexdb

I am looking for feedback from people running local agents: would you rather see a demo around personal coding memory, project documentation Q&A, or importing a small operational database into a graph-backed support brain?

Reddit: r/golang

Title

CortexDB: pure-Go embedded AI memory and knowledge graph on SQLite

Body

I built CortexDB, a Go library for embedding AI memory, RAG search, and a knowledge graph in a single SQLite-backed file.

It is meant for Go developers building local-first agents or copilots who do not want to run a separate vector database, graph database, and MCP server stack.

Highlights:

  • pure Go public API

  • one local database file

  • lexical mode works without an embedder/API key

  • optional OpenAI-compatible embeddings

  • RDF triples/quads, SPARQL subset, RDFS-lite inference, SHACL-lite validation

  • tool/MCP surfaces for agent integrations

  • gRPC sidecar plus Rust/Python/Node clients

Repo: https://github.com/liliang-cn/cortexdb

The API I want feedback on most is the top-level facade in pkg/cortexdb: whether it feels idiomatic enough for Go while still covering memory, RAG, and KG workflows.

Reddit: r/ClaudeAI

Title

I made a Claude Code plugin for local memory + a queryable knowledge graph

Body

I built a CortexDB plugin for Claude Code and Codex.

It packages a local MCP server plus a shared skill, so Claude/Codex can save/search project memory, query a knowledge graph, and build context from a single SQLite-backed database file. It runs in lexical mode by default, so there is no API key required.

The Claude Code version also has an optional auto-recall hook: when a real CortexDB file exists in the project, it can search for relevant memories on each prompt and inject a small bounded set into context.

Install:

/plugin marketplace add liliang-cn/cortexdb
/plugin install cortexdb@cortexdb

Repo/plugin docs: https://github.com/liliang-cn/cortexdb/tree/main/plugins/cortexdb

I would love feedback on whether this should feel more like "project memory", "agent knowledge graph", or "local RAG for coding agents" in the docs.

30-Second Demo Script

Goal: Make the value obvious without asking viewers to understand the whole architecture.

  1. Open with the problem: an agent forgets project facts unless they are pasted into context.

  2. Install the plugin for Claude Code or Codex.

  3. Save two or three project facts into CortexDB through MCP tools.

  4. Query them back with lexical search, no API key.

  5. Add graph facts, then run a SPARQL query that returns a relationship the agent can cite.

  6. Show the .db file in the project directory.

  7. Close with the line: "Local agent memory and a queryable knowledge graph, in one SQLite file."

Launch Sequence

  1. Tighten README first 200 lines and add a demo GIF.

  2. Publish Show HN with the broad single-file AI memory/KG angle.

  3. Reply to every technical comment for the first 12 hours.

  4. Two or three days later, post the Claude Code/Codex plugin angle to r/ClaudeAI.

  5. Post the local-first/no-vector-DB angle to r/LocalLLaMA.

  6. Post the Go API angle to r/golang after the README has concrete Go snippets and examples.

  7. Turn the best questions into README FAQ entries and comparison docs.

Launch Checklist

  • [ ] README has the positioning table above the install section.

  • [ ] README includes a short demo GIF or terminal recording.

  • [ ] examples/02_rag and examples/06_tools_mcp run cleanly from a fresh clone.

  • [ ] Plugin install instructions work for Claude Code and Codex.

  • [ ] A short pinned issue or discussion exists for launch feedback.

  • [ ] The first HN comment includes implementation details and honest non-goals.

  • [ ] Reddit posts are spaced out, not cross-posted all at once.

  • [ ] Follow-up README changes are made from real community questions.

512 files · 501 not served here

Advantages

Limitations

Security

Risk level: Medium risk

This brain runs

Agent instructions that run or fetch something (86)

  • .agents/skills/cortexdb/SKILL.md: Run with `GOMEMLIMIT` set below the device's memory so the garbage collector works before the kernel does.
  • .agents/skills/cortexdb/SKILL.md: The live view (`serve_graph_3d`) can be asked, not only looked at: find any node in the store, ask a question and see what the answer names, run read-only Cypher, expand a node's neighbours past the drawn core.
  • .agents/skills/cortexdb/SKILL.md: From a shell: `cortexdb-mcp --import-agent-memory [--sessions] [--since 30d] [--max N] [--dry-run]`.
  • .agents/skills/cortexdb/SKILL.md: re-run the rules after a manual full refresh, which clears them.
  • .agents/skills/cortexdb/SKILL.md: Results are explainable inferred triples named `shacl_triple_rule:*`, and the shapes passed are the whole rule set: a rule left out is retracted on the next run.
  • .agents/skills/cortexdb/SKILL.md: An agent's record of its own run, as graph records: `StartRun`, `BeginStep` / `EndStep` (a step is written as running, with `TRIGGERED` edges from the steps it consumed, before its work runs), `RecordStep`, `FinishRun`;
  • .agents/skills/cortexdb/SKILL.md: read back with `GetRun`, `ListRuns`, `RunSteps`, `SummarizeRun`, `StepLineage` and `ReplayRun` (the run as of any instant).
  • .agents/skills/cortexdb/SKILL.md: go run ./examples/01_core
  • .agents/skills/cortexdb/SKILL.md: go run ./examples/02_rag
  • .agents/skills/cortexdb/SKILL.md: go run ./examples/03_memoryflow
  • .agents/skills/cortexdb/SKILL.md: go run ./examples/04_knowledge_graph
  • .agents/skills/cortexdb/SKILL.md: go run ./examples/05_graphflow
  • .agents/skills/cortexdb/SKILL.md: go run ./examples/06_tools_mcp
  • .agents/skills/cortexdb/SKILL.md: When changing CortexDB, run:
  • SKILL.md: | Scenario | Start with | What it really does | | --- | --- | --- | | Store vectors, FTS5, or run simple TopK retrieval | `pkg/cortexdb` `Quick()`;
  • SKILL.md: | | Import external CSV or MySQL/PG SQL dumps into RAG + knowledge graph | `pkg/importflow` `New().Run()` / `AutoImport()` | Parses a source into records, routes columns via a `MappingPlan` to RAG content and KG entities/relations, with optional AI mapping inference and triple extraction.
  • SKILL.md: Codebase knowledge graph: `graphflow.Pipeline.Run`
  • SKILL.md: Run with `GOMEMLIMIT` set below the device's memory so the garbage collector works before the kernel does.
  • SKILL.md: `PostgresStore` satisfies the same `BrainStore` contract as `SQLiteStore`: vectors, hybrid search, memory, RDF graph, SPARQL, ontology and the tool surface all run on either.
  • SKILL.md: without it the run skips them, naming what is uncovered (`pkg/connector`'s source/CDC tests take their own `CONNECTOR_PG_DSN` / `CONNECTOR_PG_REPL_DSN` / `CONNECTOR_MYSQL_*`).
  • SKILL.md: past it the document is left out of every search, chunk tool, graph walk and aggregate, and `sweep_expired` / `cortexdb-mcp-stdio --sweep-expired [--dry-run]` deletes expired documents and memories.
  • SKILL.md: re-run the rules after a manual full refresh, which clears them.
  • SKILL.md: Results are explainable inferred triples named `shacl_triple_rule:*`, and the shapes passed are the whole rule set: a rule left out is retracted on the next run.
  • SKILL.md: // Which nodes those edges run through — what is wrong.
  • SKILL.md: An agent's own record of a task: one `AgentRun` node per run and one node per step — `LLMCall`, `ToolCall`, `Retrieval`, `DecisionPoint`, `Validation` or a kind of your own, which is also the node type and Cypher label — joined by `HAS_STEP` (run → step), `TRIGGERED` (a step → a step th …[+67 chars]
  • SKILL.md: run, _ := db.StartRun(ctx, cortexdb.RunStart{Task: "checkout p99 alert", Agent: "devops-agent"})
  • SKILL.md: plan, _ := db.RecordStep(ctx, cortexdb.StepStart{RunID: run.ID, Kind: cortexdb.StepKindLLMCall, Name: "plan"},
  • SKILL.md: st, _ := db.BeginStep(ctx, cortexdb.StepStart{RunID: run.ID, Kind: cortexdb.StepKindToolCall, Name: "restart_pool", Parents: []string{plan.ID}})
  • SKILL.md: _, _ = db.FinishRun(ctx, run.ID, cortexdb.RunEnd{Outcome: "resolved"})
  • SKILL.md: sum, _ := db.SummarizeRun(ctx, run.ID) // tokens, cost, open/failed steps, critical path, least confident step
  • SKILL.md: then, _ := db.ReplayRun(ctx, run.ID, someInstant) // the run as it stood then, from history
  • SKILL.md: Every write fails before writing anything when the run is not running, a parent does not exist, the kind cannot be a label, or an attribute reuses a name the graph writes itself.
  • SKILL.md: a run finishes once.
  • SKILL.md: // Dry run first; with neither rule_ids nor rules, every enabled rule runs.
  • SKILL.md: rep, _ := im.Run(ctx, src, plan) // rep.RowsRead/ChunksIndexed/TriplesCreated/UnparsedStatements
  • SKILL.md: With an inferer, `im.AutoImport(ctx, src, importflow.Goal{BuildRAG: true, BuildKG: true})` does plan + run in one step.
  • SKILL.md: Review the plan, then feed it to `im.Run` / the connector to build the graph.
  • SKILL.md: plan.Sign("you", time.Now()) // Run refuses an unsigned plan
  • SKILL.md: rep, _ := importflow.New(db).Run(ctx, connector.Desensitized(src, d), mapping)
  • SKILL.md: **Library API only** — `w.Run(ctx)` does one pass and the caller schedules it (loop / cron).
  • SKILL.md: _ = w.Run(ctx) // schedule on an interval; resumes from the checkpoint
  • SKILL.md: **Route B-PG (Postgres logical replication, `NewPostgresCDCSource`):** a true CDC source over `pgoutput` that **captures hard deletes** and **streams continuously** — `w.Run(ctx)` blocks until ctx is cancelled and resumes by LSN from the checkpoint (`Checkpoint.Position`).
  • SKILL.md: go w.Run(ctx) // streams insert/update/delete continuously; resumes by LSN
  • SKILL.md: Like Route B-PG it **captures hard deletes** and **streams continuously** — `w.Run(ctx)` blocks until ctx is cancelled and resumes by binlog position (`Checkpoint.Position`).
  • SKILL.md: go w.Run(ctx) // streams insert/update/delete; resumes by binlog position
  • SKILL.md: Wire via `connector.NewMCPServer(tb, opts)` / `connector.RunMCPStdio(ctx, tb, opts)`, `connector.RegisterMCPTools(server, tb)` to ride another server, or run `cmd/cortexdb-connector-mcp`.
  • SKILL.md: Transport is plaintext by design — run it over loopback, a trusted LAN, or Tailscale, or publish it as `https://host` behind a TLS-terminating proxy (`CORTEXDB_REMOTE=https://host`;
  • SKILL.md: the latter two need direct database access, so they run where the database lives.
  • SKILL.md: From a shell: `cortexdb-mcp --import-agent-memory [--sessions] [--since 30d] [--max N] [--dry-run]`.
  • SKILL.md: With an active ontology, a capture is told its object types: the active schema is read once per run (on a shared brain through `ontology_list`), each declared type's `api_name`, a one-line description and its aliases are listed in the prompt — at most 60 types, 160-character descriptio …[+152 chars]
  • SKILL.md: graphflow's `LLMExtractor` does the same under `Pipeline.Run` (undeclared → `graphflow_node`).
  • SKILL.md: Python — `clients/python/` (PyPI): `pip install cortexdb-client`;
  • SKILL.md: Node — `clients/node/` (npm): `npm install cortexdb-client`;
  • SKILL.md: Published to ClawHub (`clawhub skill install cortexdb-agent-memory`) and installable from git / skills.sh (`hermes skills install git:liliang-cn/cortexdb@main`, `npx skills add liliang-cn/cortexdb`).
  • SKILL.md: go run ./examples/01_core
  • SKILL.md: go run ./examples/02_rag
  • SKILL.md: go run ./examples/03_memoryflow
  • SKILL.md: go run ./examples/04_knowledge_graph
  • SKILL.md: go run ./examples/05_graphflow
  • SKILL.md: go run ./examples/06_tools_mcp
  • SKILL.md: go run ./examples/07_importflow
  • SKILL.md: go run ./examples/08_self_knowledge_graph # docs -> graphflow -> KG of this project; qa_test.go answers from graph edges
  • SKILL.md: go run ./examples/16_ontology # typed object types, actions, object sets, typed tools, schema diff
  • SKILL.md: When changing CortexDB, run:
  • plugins/cortexdb/skills/cortexdb/SKILL.md: Run with `GOMEMLIMIT` set below the device's memory so the garbage collector works before the kernel does.
  • plugins/cortexdb/skills/cortexdb/SKILL.md: The live view (`serve_graph_3d`) can be asked, not only looked at: find any node in the store, ask a question and see what the answer names, run read-only Cypher, expand a node's neighbours past the drawn core.
  • plugins/cortexdb/skills/cortexdb/SKILL.md: From a shell: `cortexdb-mcp --import-agent-memory [--sessions] [--since 30d] [--max N] [--dry-run]`.
  • plugins/cortexdb/skills/cortexdb/SKILL.md: re-run the rules after a manual full refresh, which clears them.
  • plugins/cortexdb/skills/cortexdb/SKILL.md: Results are explainable inferred triples named `shacl_triple_rule:*`, and the shapes passed are the whole rule set: a rule left out is retracted on the next run.
  • plugins/cortexdb/skills/cortexdb/SKILL.md: An agent's record of its own run, as graph records: `StartRun`, `BeginStep` / `EndStep` (a step is written as running, with `TRIGGERED` edges from the steps it consumed, before its work runs), `RecordStep`, `FinishRun`;
  • plugins/cortexdb/skills/cortexdb/SKILL.md: read back with `GetRun`, `ListRuns`, `RunSteps`, `SummarizeRun`, `StepLineage` and `ReplayRun` (the run as of any instant).
  • plugins/cortexdb/skills/cortexdb/SKILL.md: Wire via `connector.NewToolbox(db, opts)` + `connector.NewMCPServer(tb, opts)` / `connector.RunMCPStdio(ctx, tb, opts)`, `connector.RegisterMCPTools(server, tb)` to ride another server, or run `cmd/cortexdb-connector-mcp`.
  • plugins/cortexdb/skills/cortexdb/SKILL.md: go run ./examples/01_core
  • plugins/cortexdb/skills/cortexdb/SKILL.md: go run ./examples/02_rag
  • plugins/cortexdb/skills/cortexdb/SKILL.md: go run ./examples/03_memoryflow
  • plugins/cortexdb/skills/cortexdb/SKILL.md: go run ./examples/04_knowledge_graph
  • plugins/cortexdb/skills/cortexdb/SKILL.md: go run ./examples/05_graphflow
  • plugins/cortexdb/skills/cortexdb/SKILL.md: go run ./examples/06_tools_mcp
  • plugins/cortexdb/skills/cortexdb/SKILL.md: When changing CortexDB, run:
  • skills/cortexdb-memory-hermes/SKILL.md: # install the binary (or download a prebuilt release)
  • skills/cortexdb-memory-hermes/SKILL.md: go install github.com/liliang-cn/cortexdb/v2/cmd/cortexdb-grpc@latest
  • skills/cortexdb-memory-hermes/SKILL.md: For automatic pre-turn recall and completed-turn synchronization, install the native Hermes `MemoryProvider` at `plugins/hermes-cortexdb-memory` and set `memory.provider: cortexdb`.
  • skills/cortexdb-memory-hermes/SKILL.md: Hermes also speaks MCP — if you prefer, run `cortexdb-mcp-stdio` and connect it as an MCP server instead of (or alongside) this skill.
  • skills/cortexdb-memory-openclaw/SKILL.md: # install the binary (or download a prebuilt release)
  • skills/cortexdb-memory-openclaw/SKILL.md: go install github.com/liliang-cn/cortexdb/v2/cmd/cortexdb-grpc@latest
  • skills/cortexdb-memory-openclaw/SKILL.md: For automatic OpenClaw memory lifecycle integration, install the native plugin at `plugins/openclaw-cortexdb-memory` and select `cortexdb-memory` in `plugins.slots.memory`.

MCP servers (1)

  • plugins/cortexdb/.mcp.json (cortexdb): ${CLAUDE_PLUGIN_ROOT}/bin/cortexdb-mcp

Hooks (4)

  • plugins/cortexdb/hooks/hooks.json (SessionStart): ${CLAUDE_PLUGIN_ROOT}/bin/cortexdb-session-start
  • plugins/cortexdb/hooks/hooks.json (UserPromptSubmit): ${CLAUDE_PLUGIN_ROOT}/bin/cortexdb-recall
  • plugins/cortexdb/hooks/hooks.json (PreToolUse): ${CLAUDE_PLUGIN_ROOT}/bin/cortexdb-file-context
  • plugins/cortexdb/hooks/hooks.json (SessionEnd): ${CLAUDE_PLUGIN_ROOT}/bin/cortexdb-session-end
  • Medium risk: exfil-endpoint (.agents/skills/cortexdb/SKILL.md:301)
  • Medium risk: exfil-endpoint (plugins/cortexdb/skills/cortexdb/SKILL.md:308)
  • Low risk: network-instructions (SKILL.md:1379)
  • Low risk: network-instructions (skills/cortexdb-memory-hermes/SKILL.md:49)

Attribution and licence

First committed by
GitHub avatar of liliang-cnliliang-cn
Publisher
Liang Li (Community)
Source
liliang-cn/cortexdb · commit d39714c
Licence
MIT License (files served here)
  • ATTRIBUTION.md (written by AutoGineer)
Synced
Contributors
liliang-cn, lfoletti

AutoGineer is not affiliated with or endorsed by liliang-cn.

Install from source

501 of its files are not served here, so there is no ZIP. liliang-cn/cortexdb at d39714c