@cognee/cognee-ts provides Node.js bindings for the
cognee-rs AI-memory SDK, built with
Neon. It is published on npm as
@cognee/cognee-ts.remember (ingest + extract in one call) →
recall (source-aware retrieval). These wrap the lower-level
add → cognify → search stages, which remain available when you
need finer control.
Installation
Quick start
Constructor
settings is an optional object (or JSON string) that overrides env-derived
defaults. Keys are the canonical Settings field names (llmModel,
embeddingProvider, vectorDbProvider, etc.). Absent keys keep their
env-variable or compiled-in default.
Config
Usec.config to change settings after construction. Granular setters are
synchronous and take effect immediately (the engines are lazily rebuilt on the
next pipeline call).
Core Memory API
Use these operations first. They are the high-level memory API in the TypeScript SDK.remember
Store content as permanent graph memory, or as session memory when you passsessionId.
recall
Retrieve from session and graph memory. Withscope: "auto", session memory is
checked before graph memory.
improve
Run the session-to-graph bridge and graph enrichment pipeline.forget
Remove permanent memory by item, dataset, or everything.rememberEntry
Store a typed memory entry ("qa", "trace", or "feedback") in a session.
Resource managers
Datasets
Sessions
Notebooks
Users and pipeline-run admin
Maintenance operations
Legacy pipeline operations
Use these lower-level operations when you need explicit staged control over the pipeline. For most applications, preferremember() and recall().
add
Ingest one or more data items into a named dataset.cognify
Extract entities and relationships into the knowledge graph.addAndCognify
Ingest and extract in a single call.search
Query the knowledge graph directly. Defaults toGRAPH_COMPLETION.
GRAPH_COMPLETION, SUMMARIES, CHUNKS, RAG_COMPLETION, TRIPLET_COMPLETION,
GRAPH_SUMMARY_COMPLETION, CYPHER, NATURAL_LANGUAGE, GRAPH_COMPLETION_COT,
GRAPH_COMPLETION_CONTEXT_EXTENSION, FEELING_LUCKY, FEEDBACK, TEMPORAL,
CODING_RULES, CHUNKS_LEXICAL.
memify
Index triplet embeddings from the existing knowledge graph. EnablesTRIPLET_COMPLETION search. Idempotent.
Cloud: serve / disconnect
serve and disconnect are module-level functions (not instance methods)
because they operate on global cloud state.
Visualisation
visualization feature compiled into the native addon.
Initialisation and observability
await c.ownerId(), returning the owner UUID used for
deterministic, per-tenant ID generation.
Set COGNEE_BINDING_SUPPRESS_LOGS=1 before requireing the module to skip the
auto-installed stderr subscriber if your host manages the logging pipeline.
Environment variables
| Variable | Purpose |
|---|---|
OPENAI_URL | LLM API base URL (OpenAI-compatible endpoint). |
OPENAI_TOKEN | LLM API key. |
OPENAI_MODEL | LLM model name (default: gpt-4o-mini). |
EMBEDDING_PROVIDER | Embedding provider: openai, ollama, onnx, mock. |
EMBEDDING_MODEL | Embedding model name. |
EMBEDDING_DIMENSIONS | Embedding vector dimensions. |
EMBEDDING_ENDPOINT | Embedding API base URL (falls back to OPENAI_URL). |
EMBEDDING_API_KEY | Embedding API key (falls back to OPENAI_TOKEN). |
MOCK_EMBEDDING | Set true to use zero-vector mock embeddings (no model download). |
COGNEE_BINDING_SUPPRESS_LOGS | Suppress the auto-installed stderr fmt subscriber. |
COGNEE_HOST_SDK | Suppress binding-armed analytics when the host is an embedding SDK. |
TELEMETRY_DISABLED, ENV | Standard analytics opt-outs for setupTelemetryAnalytics(). |
RUST_LOG, LOG_LEVEL | tracing-subscriber env-filter level overrides. |
COGNEE_LOG_*, LOG_FILE_NAME | Consumed by setupLogging(). |
OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_SERVICE_NAME, OTEL_* | Consumed by setupTelemetry(). |
Low-level pipeline API
The original pipeline engine API is available under thepipeline namespace:
@cognee/cognee-ts:
Next Steps
@cognee/cognee-ts on npm
Package page, versions, and the full README with runnable examples.
Rust SDK
The underlying cognee-rs engine and its CLI.