Skip to main content

cognee.remember()

Description

remember() is the main ingestion entry point in Cognee v1.0.
  • Without session_id, it stores permanent memory by running the ingestion pipeline for you.
  • With session_id, it stores session memory in the cache for fast short-term retrieval.
  • When self_improvement=True, Cognee also runs improve() to enrich the graph or bridge session content into permanent memory.
Because permanent memory is built through cognify(), the cognify feature flags apply to remember() too. Notably, setting CONTRADICTION_DETECTION=true makes every remember() call check the facts it just stored against the ones already in the graph and record each conflict as a contradicts edge — see Contradiction detection. Off by default. For the full behavior walkthrough, see Remember.

Parameters

Union[BinaryIO, list[BinaryIO], str, list[str], DataItem, list[DataItem], MemoryEntry]
required
Content to store. Supports text, file paths, URLs, file-like objects, DataItem values, lists of supported inputs, and typed session-memory entries.
str
default:"'main_dataset'"
Target dataset for permanent memory or for session-to-graph bridging.
Optional[str]
default:"None"
Enables session-memory mode. When set, content is written to the session cache instead of going straight into the permanent graph.
Optional[int]
default:"None"
Maximum chunk size for permanent ingestion. When omitted, Cognee uses its default chunking behavior.
Optional[Any]
default:"None"
Custom chunking strategy for permanent ingestion.
Optional[str]
default:"None"
Overrides the prompt used during graph extraction.
bool
default:"False"
Starts the work asynchronously and returns a RememberResult you can await later.
bool
default:"True"
When enabled, runs improve() automatically after storage to enrich the graph or bridge session content.
Optional[List[str]]
default:"None"
Session IDs to sync newly enriched graph knowledge back into during the improvement pass.
bool
default:"False"
When true, return a DryRunEstimate of LLM token usage and rough cost instead of ingesting data. No LLM calls are made, no data is ingested, and no graph is written. See Dry-run cost estimation.

Dry-run cost estimation

Pass dry_run=True to preview the LLM token usage and rough USD cost of a permanent remember() run without ingesting data, making LLM calls, or writing the graph:
The call returns a DryRunEstimate with a stage-level breakdown (structured_graph_extraction and chunk_summarization). Its operation field is "remember"; the full field reference is documented under cognify() → Dry-run cost estimation. Supported inputs: raw text, local text files, and file:// URIs. Dataset resolution for the estimate is read-only. The estimator mirrors real ingestion routing, so a bare path string is only read from disk when that file exists. An absolute-looking string that does not exist (for example "/remember to call the dentist") is priced as raw text instead of failing, matching what a real run would ingest and bill. Local path inputs are also subject to ACCEPT_LOCAL_FILE_PATH, and the estimator detects absolute paths the same way real ingestion does — including Windows drive-letter paths such as C:\notes.txt. When the flag is disabled, a file:// URI or a string pointing at an existing absolute local file raises rather than being estimated; an existing relative path, and any string that is not an existing file, are still priced as raw text. Rejected inputs (raise a ValueError rather than being silently mis-estimated):
  • session_id (session memory) — dry run only supports the permanent add+cognify path
  • Typed MemoryEntry values and MemorySource imports
  • Any content_type override, including content_type="skills" and content_type="code"
  • Remote (serve()) mode — call cognee.disconnect() to estimate locally
  • Remote URLs (http/https/s3), directories, and binary formats (PDF, images, audio, Office documents) that a real run would fetch, walk, or transcribe
The estimate excludes the extra LLM calls that improve() makes when self_improvement=True (the default), as well as embedding costs.

Additional keyword options

These power-user options are forwarded to the underlying ingestion and graph-building steps.

Return value

remember() returns:
  • RememberResult for normal ingestion runs. You can inspect fields like status, dataset_name, session_ids, elapsed_seconds, and raw_result, or await the result when background mode is enabled.
  • DryRunEstimate when dry_run=True, with aggregate token/cost totals plus the per-stage breakdown described above.

Examples

See also add() and cognify() if you need direct control over the legacy pipeline steps.