Skip to main content
Experimental. Cognee-RS is a Rust port of the Python cognee SDK, built for on-device AI memory (phone, smartwatch, embedded) and aiming for behavioral parity with Python cognee. The source lives at github.com/topoteretes/cognee-rs. There is no pip install / hosted step — you build the CLI from source with Cargo.
Cognee-RS exposes the same four-verb memory API as Python cognee — remember, recall, improve, forget — composing the add → cognify → search pipeline. The fastest way in is the cognee-cli binary.

Prerequisites

  • A Rust toolchain — install via rustup. The repo pins Rust 1.91.1 in rust-toolchain.toml, which rustup selects automatically (edition 2024 / resolver 3; MSRV 1.91.1).
  • Native build tools — the default features compile two bundled C++ trees, so you also need a C/C++ compiler, cmake and protoc:
    On x86-64 Linux the compiler must be GCC 12+ or Clang 16+. Both tools are feature-gated — builds that drop LanceDB need no protoc, and dropping Ladybug and Bedrock too sheds cmake. See build prerequisites for the per-feature breakdown and the GCC 11 workaround.
  • An LLM API key. Every provider except Bedrock (which falls back to AWS/IAM credentials) needs a non-empty LLM_API_KEY: the OpenAI-compatible providers fail with llm_api_key must be configured, and Anthropic with its own missing-key error. A local endpoint (e.g. Ollama) works too — you still pass a dummy key.

Build the CLI

The default feature set wires a fully embedded, no-external-service stack: SQLite (relational), Ladybug (graph), and LanceDB (embedded, persistent vector index). Nothing else to install.

Configure the LLM

A .env file in the working directory is auto-loaded. The only required setting is the LLM API key:
Embeddings need a key by default too. On desktop/server the default embedding provider is OpenAI (text-embedding-3-small), reusing LLM_API_KEY / LLM_ENDPOINT — so setting LLM_API_KEY alone is enough for the full pipeline. To run embeddings fully local, set EMBEDDING_PROVIDER=onnx (or ollama).

Your first memory

  • remember ingests the data, builds the knowledge graph, and runs a self-improvement pass (disable with --no-improve).
  • recall auto-routes the search type for you when --query-type is omitted.
On desktop/server, the default vector index is LanceDB and persistent. The pure-Rust brute-force vector index is in-memory and selected on Android, or when you set VECTOR_DB_URL=:memory:. For Postgres-backed vectors, set VECTOR_DB_PROVIDER=pgvector and point it at a Postgres instance (the CLI’s default feature set already includes pgvector).

Sessions, forgetting, and improving

CLI config is also persisted at <config dir>/cognee-rust/config.json (via cognee-cli config set) — ~/.config/… on Linux, ~/Library/Application Support/… on macOS. Precedence is defaults < JSON config < env vars — explicit env vars always win, but a stale config.json can override .env-implied defaults.

Lower-level pipeline

remember / recall wrap the explicit stages, which exist as separate subcommands for fine-grained control:
Run cognee-cli <command> --help for the full flag list.

Using it from Rust

Depend on the top-level cognee crate (it was renamed from cognee-lib, which remains only as a deprecated re-export shim). For local development against the in-repo sources, use a path dependency: cognee = { path = "crates/lib" }. The high-level cognee::api::{remember, recall, forget, improve} functions mirror the Python ones but are not self-contained: each takes pre-built components (pipelines, LLM, storage, graph/vector DBs, embedding engine, session manager), so you wire the component graph first — the lowest-friction root is ComponentManager. See the upstream examples and Architecture for the canonical wiring.

Language bindings

The ergonomic Cognee class — new(settings) → warm() → remember() / recall() (or the lower-level add() / cognify() / search()) — is exposed by the bindings, which keep the component graph alive across calls in one process:
  • JavaScript/TypeScript (Neon): npm install @cognee/cognee-ts, then import { Cognee } from '@cognee/cognee-ts'
  • Python (PyO3): build from source (maturin develop) — not yet on PyPI; from cognee_py import Cognee
  • C (FFI): build from source; #include "cognee_sdk.h"
  • Java (JNI): io.github.topoteretes:cognee on Maven Central; import ai.cognee.Cognee;
See Language Bindings for details.

Next Steps

Cognee-RS on GitHub

Full README, architecture docs, and the crate-by-crate workspace breakdown.

Python Quickstart

The same remember / recall loop in the Python SDK.