> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cognee.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# remember()

> Store permanent or session memory with the v1.0 ingestion API

# cognee.remember()

```python theme={null}
async def remember(
    data: Union[
        BinaryIO,
        list[BinaryIO],
        str,
        list[str],
        DataItem,
        list[DataItem],
        MemoryEntry,
    ],
    dataset_name: str = "main_dataset",
    *,
    session_id: Optional[str] = None,
    chunk_size: Optional[int] = None,
    chunker: Optional[Any] = None,
    custom_prompt: Optional[str] = None,
    run_in_background: bool = False,
    self_improvement: bool = True,
    session_ids: Optional[List[str]] = None,
    dry_run: bool = False,
    **kwargs,
) -> Union[RememberResult, DryRunEstimate]
```

## 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](/python-api/cognify#contradiction-detection). Off by default.

For the full behavior walkthrough, see [Remember](/core-concepts/main-operations/remember).

## Parameters

<ParamField path="data" type="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.
</ParamField>

<ParamField path="dataset_name" type="str" default="'main_dataset'">
  Target dataset for permanent memory or for session-to-graph bridging.
</ParamField>

<ParamField path="session_id" type="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.
</ParamField>

<ParamField path="chunk_size" type="Optional[int]" default="None">
  Maximum chunk size for permanent ingestion. When omitted, Cognee uses its default chunking behavior.
</ParamField>

<ParamField path="chunker" type="Optional[Any]" default="None">
  Custom chunking strategy for permanent ingestion.
</ParamField>

<ParamField path="custom_prompt" type="Optional[str]" default="None">
  Overrides the prompt used during graph extraction.
</ParamField>

<ParamField path="run_in_background" type="bool" default="False">
  Starts the work asynchronously and returns a `RememberResult` you can await later.
</ParamField>

<ParamField path="self_improvement" type="bool" default="True">
  When enabled, runs `improve()` automatically after storage to enrich the graph or bridge session content.
</ParamField>

<ParamField path="session_ids" type="Optional[List[str]]" default="None">
  Session IDs to sync newly enriched graph knowledge back into during the improvement pass.
</ParamField>

<ParamField path="dry_run" type="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).
</ParamField>

## 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**:

```python theme={null}
import cognee

estimate = await cognee.remember("Einstein was born in Ulm.", dry_run=True)
print(estimate)                    # human-readable summary table
print(estimate.estimated_cost_usd)
print(estimate.to_dict())          # JSON-serializable dict
```

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](/python-api/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`](/setup-configuration/security#local-file-system-access), 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

<Note>
  The estimate excludes the extra LLM calls that `improve()` makes when `self_improvement=True` (the default), as well as embedding costs.
</Note>

## Additional keyword options

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

| Option                | Type              | What it does                                                                                                                                                                                                                                                             |
| --------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `graph_model`         | `Any`             | Overrides the graph schema/model used during graph building. Defaults to `KnowledgeGraph`; pass a `DataPoint` subclass to constrain extraction to your own fields and relationships. See [Custom Graph Model](/guides/custom-graph-model).                               |
| `node_set`            | `List[str]`       | Tags ingested content with one or more node sets.                                                                                                                                                                                                                        |
| `dataset_id`          | `UUID`            | Targets a specific existing dataset by UUID instead of resolving only by name.                                                                                                                                                                                           |
| `preferred_loaders`   | `list`            | Chooses preferred loaders for source files.                                                                                                                                                                                                                              |
| `importance_weight`   | `float`           | Stores a retrieval-ranking weight on ingested data records.                                                                                                                                                                                                              |
| `incremental_loading` | `bool`            | Reuses existing dataset state and processes only new or changed content when supported.                                                                                                                                                                                  |
| `data_per_batch`      | `int`             | Controls ingestion batching.                                                                                                                                                                                                                                             |
| `chunks_per_batch`    | `int`             | Controls chunk-processing batching during graph building.                                                                                                                                                                                                                |
| `config`              | `Config`          | Overrides the full Cognee config for the graph-building step.                                                                                                                                                                                                            |
| `temporal_cognify`    | `bool`            | Enables temporal-aware graph building during the internal `cognify()` step.                                                                                                                                                                                              |
| `user`                | `object`          | Runs the operation under a specific user context.                                                                                                                                                                                                                        |
| `vector_db_config`    | `dict`            | Overrides vector database configuration for this call.                                                                                                                                                                                                                   |
| `graph_db_config`     | `dict`            | Overrides graph database configuration for this call.                                                                                                                                                                                                                    |
| `llm_config`          | `LLMConfig`       | LLM settings to install into the current async context and forward to both the ingestion and graph-building steps. Uses the active context config or global LLM config when omitted. Import from `cognee.infrastructure.llm.config`.                                     |
| `embedding_config`    | `EmbeddingConfig` | Embedding settings to install into the current async context and forward to both the ingestion and graph-building steps. Uses the active context config or global embedding config when omitted. Import from `cognee.infrastructure.databases.vector.embeddings.config`. |

## 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

```python theme={null}
import cognee

# Permanent memory
result = await cognee.remember(
    "Cognee turns documents into AI memory.",
    dataset_name="docs",
)
print(result.status)

# Session memory
await cognee.remember(
    "The customer prefers weekly updates.",
    session_id="sales_chat_1",
)
```

## Related

See also [add()](/python-api/add) and [cognify()](/python-api/cognify) if you need direct control over the legacy pipeline steps.
