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

# memify()

> Enrich an existing knowledge graph with custom tasks

# cognee.memify()

```python theme={null}
async def memify(
    extraction_tasks: Sequence[Task | str] | None = None,
    enrichment_tasks: Sequence[Task | str] | None = None,
    data: Any | None = None,
    dataset: str | UUID = 'main_dataset',
    user: User = None,
    node_type: type | None = NodeSet,
    node_name: list[str] | None = None,
    vector_db_config: dict | None = None,
    graph_db_config: dict | None = None,
    run_in_background: bool = False,
)
```

> [!WARNING]
>
> **Deprecated.** `cognee.memify()` will be removed in the next release, and every call raises a `FutureWarning`. Triplet embeddings were removed, and with them the default tasks memify used to run. Use [`improve()`](https://docs.cognee.ai/python-api/improve) to enrich a dataset, or [`run_custom_pipeline()`](https://docs.cognee.ai/python-api/custom-pipeline) to run your own tasks.
>
> * A call **without tasks runs nothing** and returns `{}` (after it has resolved and authorized the dataset, so an unknown or unauthorized dataset still raises).
> * Named or given tasks still run as before.
> * `POST /api/v1/memify` is marked deprecated in the OpenAPI schema and logs a warning on every request.
> * Importing `cognee.memify_pipelines.memify_task_registry` raises a `FutureWarning`; that path goes away with `memify()`.
> * `add_data_points(embed_triplets=...)` is accepted but ignored, with a `FutureWarning`.

## Description

Runs the given extraction and enrichment tasks over a dataset. If no data is provided, the existing knowledge graph (filtered by `node_type`/`node_name`) is passed to the first task; custom data can be provided instead.

Args:
extraction\_tasks: List of Cognee Tasks to execute for graph/data extraction.
Entries may be Task instances or names of built-in memify tasks
(see Supported task names below).
enrichment\_tasks: List of Cognee Tasks to handle enrichment of provided graph/data from extraction tasks.
Entries may be Task instances or names of built-in memify tasks.
data: The data to ingest. Can be anything when custom extraction and enrichment tasks are used.
Data provided here will be forwarded to the first extraction task in the pipeline as input.
If no data is provided the whole graph (or subgraph if node\_name/node\_type is specified) will be forwarded
dataset: Dataset name or dataset uuid to process.
user: User context for authentication and data access. Uses default if None.
node\_type: Filter graph to specific entity types (for advanced filtering). Used when no data is provided.
node\_name: Filter graph to specific named entities (for targeted search). Used when no data is provided.
vector\_db\_config: Custom vector database configuration for embeddings storage.
graph\_db\_config: Custom graph database configuration for relationship storage.
run\_in\_background: If True, starts processing asynchronously and returns immediately.
If False, waits for completion before returning.
Background mode recommended for large datasets (>100MB).
Use pipeline\_run\_id from return value to monitor progress.

## Parameters

**extraction\_tasks** `Sequence[Task | str] | None` (default: None)

Task objects and/or [supported task names](#supported-task-names) for graph/data extraction. The two forms can be mixed in one list.

**enrichment\_tasks** `Sequence[Task | str] | None` (default: None)

Task objects and/or [supported task names](#supported-task-names) for graph enrichment. The two forms can be mixed in one list.

**data** `Any | None` (default: None)

Data to ingest. If not provided, operates on existing knowledge graph.

**dataset** `str | UUID` (default: 'main\_dataset')

Dataset name or UUID to operate on.

**user** `User` (default: None)

User performing the operation.

**node\_type** `type | None` (default: NodeSet)

Filter to specific entity types in the graph.

**node\_name** `list[str] | None` (default: None)

Filter to specific named entities.

**vector\_db\_config** `dict | None` (default: None)

Override vector database configuration.

**graph\_db\_config** `dict | None` (default: None)

Override graph database configuration.

**run\_in\_background** `bool` (default: False)

If true, return immediately and process in background.

## Supported task names

`extraction_tasks` and `enrichment_tasks` accept `Task` instances, task names as plain strings, or a mix of both in the same list. Names are resolved against a curated registry that only exposes tasks runnable without required keyword arguments. Every call builds a fresh `Task` instance per name, so resolved tasks are never shared between runs.

The registry is shared by both parameters. These names are typically used for extraction:

| Name | Task |
| - | - |
| `extract_subgraph` | Yield the edges of the incoming subgraphs |
| `extract_subgraph_chunks` | Pull document chunks from the incoming subgraphs |
| `extract_user_sessions` | Extract not-yet-persisted Q\&A entries from the session cache |
| `extract_agent_trace_feedbacks` | Extract step-level agent trace content for the current user |
| `detect_entity_duplicates` | Find semantically near-duplicate `Entity` nodes |
| `extract_code_docs` | Read the docstrings of the dataset's code graph as `DocumentChunk`s (no LLM). It reads the code graph itself, so when no `data` is given it gets a placeholder instead of the projected graph |

And these for enrichment:

| Name | Task |
| - | - |
| `cognify_session` | Cognify session windows into the knowledge graph |
| `cognify_agent_trace_feedback` | Cognify agent trace session text into the knowledge graph |
| `apply_feedback_weights` | Update graph-element weights from feedback scores (`batch_size=100`) |
| `merge_entity_duplicates` | Merge the duplicates found by `detect_entity_duplicates` |
| `index_data_points` | Index datapoints in the vector DB (`batch_size=100`) |
| `cognify_code_doc_chunks` | Run cognify's LLM entity extraction and summaries over docstring chunks, one `chunks_per_batch` slice at a time |
| `add_data_points` | Store datapoints in the graph and vector DBs (`batch_size` = cognify's `chunks_per_batch`, 2000 when unset) |
| `add_code_doc_edges` | Link docstring chunks to their code symbols with `describes` edges and remove chunks a run no longer produces |

`extract_code_docs` reads the code graph itself, so a call that names only it as extraction task and passes no `data` skips projecting the graph. Pair it with `["add_data_points", "add_code_doc_edges"]` (embed-only) or `["cognify_code_doc_chunks", "add_data_points", "add_code_doc_edges"]` (with LLM entity extraction). This is the same pipeline as `cognify_code_docs_pipeline()`; see [Store Docstrings as Searchable Memory](https://docs.cognee.ai/guides/code-graph.md#advanced-usage).

`get_triplet_datapoints` was removed together with triplet embeddings and is rejected (see [Invalid task names](#invalid-task-names)).

Each name is constructed with the same defaults the dedicated memify pipelines use, shown in parentheses above. To use different arguments, pass a `Task` instance instead of a name.

> [!NOTE]
>
> Tasks that require call-specific parameters are not in the registry and stay SDK-only. For example, `extract_feedback_qas` requires `session_ids`, so it must be passed as `Task(extract_feedback_qas, session_ids=[...])` rather than by name.

### Invalid task names

Names are resolved before any setup or database work happens, so a bad name fails fast without starting a pipeline run.

* **Python SDK** — an unknown name, the removed name `get_triplet_datapoints`, or an entry that is neither a `Task` nor a `str`, raises `CogneeValidationError`. The message for an unknown name lists every supported name.
* **REST (`POST /api/v1/memify`)** — the same condition returns **422 Unprocessable Content**; for an unknown name, the error body lists the supported names. Previously any non-empty task-name list failed with a 500.

## How memify() differs from cognify()

| | `cognify()` | `memify()` |
| - | - | - |
| **Purpose** | Build knowledge graph from raw data | Enrich an existing graph |
| **Input** | Raw text/files | Existing graph or new data |
| **Pipeline** | Fixed (chunk → extract → build) | Customizable extraction + enrichment tasks |
| **Use case** | Initial processing | Iterative refinement, entity consolidation |

## Examples

```python theme={null}
import cognee

# Without tasks nothing runs: this returns {}
await cognee.memify(dataset="my_dataset")

# Custom extraction and enrichment
from cognee.modules.pipelines import Task

await cognee.memify(
    extraction_tasks=[my_extractor_task],
    enrichment_tasks=[my_enrichment_task],
    dataset="my_dataset",
)

# Select built-in tasks by name
await cognee.memify(
    extraction_tasks=["detect_entity_duplicates"],
    enrichment_tasks=["merge_entity_duplicates"],
    dataset="my_dataset",
)

# Mix task names with Task instances (here, a dry-run merge)
from cognee.tasks.memify.consolidate_entities import merge_entity_duplicates

await cognee.memify(
    extraction_tasks=["detect_entity_duplicates"],
    enrichment_tasks=[Task(merge_entity_duplicates, config={"dry_run": True})],
    dataset="my_dataset",
)

# Filter the graph passed to the tasks to specific node sets
await cognee.memify(
    extraction_tasks=["extract_subgraph_chunks"],
    enrichment_tasks=[my_enrichment_task],
    node_name=["Person", "Organization"],
)
```

See the [Memify pipeline guides](https://docs.cognee.ai/guides/memify-session-persistence.md) for lower-level enrichment walkthroughs, or the [Self-Improving Memory Quickstart](https://docs.cognee.ai/guides/self-improving-memory-quickstart.md) for the v1.0 user-facing flow.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.