Skip to main content
@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.
Cognee transforms raw text, files, and URLs into a persistent, queryable knowledge graph. The high-level API is remember (ingest + extract in one call) → recall (source-aware retrieval). These wrap the lower-level addcognifysearch 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

Use c.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 pass sessionId.

recall

Retrieve from session and graph memory. With scope: "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, prefer remember() 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.
Query the knowledge graph directly. Defaults to GRAPH_COMPLETION.
All 15 search types are supported (SCREAMING_SNAKE_CASE): 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. Enables TRIPLET_COMPLETION search. Idempotent.

Cloud: serve / disconnect

serve and disconnect are module-level functions (not instance methods) because they operate on global cloud state.

Visualisation

Requires the visualization feature compiled into the native addon.

Initialisation and observability

Each handle also exposes 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

Low-level pipeline API

The original pipeline engine API is available under the pipeline namespace:
All pipeline symbols are also available as flat re-exports at the top level of @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.