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-idto 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:rememberreturns once the entry is stored. It is skipped whenimprove.auto_enabledis off (IMPROVE_AUTO_ENABLED=false) or animprove.*setting is invalid, and debounced byimprove.debounce_entries/improve.debounce_seconds(state kept in the session as an internalauto_improve_debouncerow; see Configuration: improve). The CLI waits for it before exiting and a binding’sclose()before closing the handle (cognee::wait_for_background_tasks; bindings-commonops::lifecycle::wait_for_background_tasks). A detached task that panics is logged aterror. - Permanent graph memory — omit
--session-idand the input is persisted as permanent, graph-backed memory. Its self-improvement pass runsimprove()on the dataset (it used to run memify), and follows the same gate: off whenimprove.auto_enabledis off or animprove.*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.
forgetof 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_setis ignored. The CLI builds neither an LLM nor an embedding engine unless--index-vectorsasks for one; a bindings handle has built both already and leaves them unused. index_vectors = true(CLI--index-vectors, bindingsindexVectors) also embeds the code nodes the call writes (each node’snameinto{type}_name, its structural edges’ texts intoEdgeType_relationship_name) for the semantic and completion retrievers. It needs an embedding provider (InvalidArgumentfromremember_codewhen 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, fromvalidate_remember_options, which the CLI and bindings run): an unknown content type,index_vectors(in the bindings, evenfalse) orrepo_credentialswithoutcontent_type = "code",branchwith a content type (pass the repository URL instead), andsession_idwithcontent_type = "code". The bindings’rememberalso refusesbranchwithout a content type, as a validation error: pass it toadd.content_type = "skills"is not supported yet. The CLI also refuses--content-type codewith--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 withApiError::CodeRepositoryForbidden. - Remote git URLs (
https://,http://,git@,ssh://) are shallow-cloned undercode_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(bindingsrepoCredentials) 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 followALLOW_HTTP_REQUESTS(allow_http_requests; allowed when unset outside an HTTP server; a refusal isApiError::CodeRepositoryForbidden) and an http(s) host must not be internal. Cloning needsgitonPATH. - 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 nextcognify.
{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.
Related
Recall
Query what you stored
Improve
The enrichment pass remember runs
Sessions
Session memory vs permanent memory