Skip to main content

What is the remember operation

remember is the main write entry point of the memory API. It stores inline text and/or files as memory in one call. Where the turn goes depends on whether you pass a session id: without one, it runs add, then cognify, then (by default) the improve enrichment pass; with one, it stores the turn in the session and starts improve for that session in the background.

What happens under the hood

Stores input as memory: it runs add + cognify and then, by default, the improve enrichment pass. Accepts inline text and/or file paths.
  • Session memory — pass a --session-id to scope the turn to a session (session-backed QA history). The improve that bridges the session into the graph runs as a detached background task: remember returns once the entry is stored. It is skipped when improve.auto_enabled is off (IMPROVE_AUTO_ENABLED=false) or an improve.* setting is invalid, and debounced by improve.debounce_entries / improve.debounce_seconds (state kept in the session as an internal auto_improve_debounce row; see Configuration: improve). The CLI waits for it before exiting and a binding’s close() before closing the handle (cognee::wait_for_background_tasks; bindings-common ops::lifecycle::wait_for_background_tasks). A detached task that panics is logged at error.
  • Permanent graph memory — omit --session-id and the input is persisted as permanent, graph-backed memory. Its self-improvement pass runs improve() on the dataset (it used to run memify), and follows the same gate: off when improve.auto_enabled is off or an improve.* setting is invalid.

Code repositories

content_type = "code" (CLI --content-type code, bindings contentType: "code"; rustdoc api::remember_code, RememberCodeParams) indexes each input, a local repository path or a remote git URL, as a deterministic code graph with no LLM. Each repository is stored as its one code-repo item without its documents (AddPipeline::add_code_repository, which stores the repository’s canonical path: a relative path is resolved and symlinks are followed, so the stored repo_path does not depend on the working directory; a repository first added through a symlink, such as /tmp/repo on macOS, is stored as a new row under its resolved path when added again after upgrading), and its graph is built by one code_graph_pipeline run over that item (the same enola builder as cognify’s CODE_REPO route), which also stamps it complete for cognify_pipeline, so a later cognify of the dataset does not rebuild it. It needs the enola binary (Configuration: code graph).
  • Incremental. An unchanged repository (same enola snapshot) writes nothing to the graph (it still records its ledger rows and completion stamps), and a changed one writes only changed facts and removes what left it. forget of a code-repo item removes only that repository’s graph.
  • Keyless. No LLM is validated on this path, so a missing key does not fail it, and node_set is ignored. The CLI builds neither an LLM nor an embedding engine unless --index-vectors asks for one; a bindings handle has built both already and leaves them unused.
  • index_vectors = true (CLI --index-vectors, bindings indexVectors) also embeds the code nodes the call writes (each node’s name into {type}_name, its structural edges’ texts into EdgeType_relationship_name) for the semantic and completion retrievers. It needs an embedding provider (InvalidArgument from remember_code when a Rust caller passes no engine; the CLI fails while building one), and applies to the call’s own repositories only: the dataset’s other repositories, rebuilt with them, stay graph-only. Only nodes the call writes are embedded: an unchanged repository embeds nothing, and a repository first built graph-only gets vectors only for nodes that change later. Off by default.
  • Refused options (InvalidArgument, from validate_remember_options, which the CLI and bindings run): an unknown content type, index_vectors (in the bindings, even false) or repo_credentials without content_type = "code", branch with a content type (pass the repository URL instead), and session_id with content_type = "code". The bindings’ remember also refuses branch without a content type, as a validation error: pass it to add. content_type = "skills" is not supported yet. The CLI also refuses --content-type code with --extractor.
  • Local repository paths must lie under allowed_local_file_roots (COGNEE_ALLOWED_LOCAL_FILE_ROOTS) when it is set; a path outside them, existing or not, is refused with ApiError::CodeRepositoryForbidden.
  • Remote git URLs (https://, http://, git@, ssh://) are shallow-cloned under code_graph.clones_dir (default ~/.cognee/repos) and reused, refreshed, on later calls (an HTTP API request refuses a clone it could not refresh). repo_credentials (bindings repoCredentials) is a token for private https remotes that reaches git through its environment only; an empty one is no token. A token in the URL is redacted from the item, the clone’s directory and remote, logs and errors. Remote repositories follow ALLOW_HTTP_REQUESTS (allow_http_requests; allowed when unset outside an HTTP server; a refusal is ApiError::CodeRepositoryForbidden) and an http(s) host must not be internal. Cloning needs git on PATH.
  • Several repositories in one dataset are extracted together as one enola cluster, which gives the edges between them (a frontend call to the backend route that serves it): the dataset’s other repositories, up to five (CLUSTER_INLINE_REBUILD_LIMIT), are rebuilt with the new ones by one enola run, each still under its own item and run; beyond five only the new ones are built and the rest are marked for the next cognify.
The result has one item per repository, {kind: "code_repository", source, path, id, pipeline_run_id} (source without URL credentials). With raise_on_error = false (bindings raiseOnError) a failed repository is reported on its item (status: "errored", error) and the rest go on. A failure of a repository already in the dataset is reported in the result’s error, never raised. Telemetry event: cognee.remember.code_graph.

What remember returns

The bindings’ selfImprovement option now defaults to true; pass false to skip the improve. The returned RememberResult reports the automatic improve: improve (the ImproveResult), improve_error (the error improve() returned, or its errored stages; the remember itself succeeds and error stays unset), after_run_error (always unset: Rust has no such step) and improve_skipped, each serialized only when set. A session-mode improve runs detached, so improve stays unset there; the Rust-only improve_launched flag, which is not serialized, says it was started. A host can decline the automatic improve with a reason through register_auto_improve_admission / clear_auto_improve_admission; the reason is reported as improve_skipped. remember ≈ add + cognify + improve. rustdoc: api::remember.

Recall

Query what you stored

Improve

The enrichment pass remember runs

Sessions

Session memory vs permanent memory