> ## 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 derived knowledge via configurable pipelines

<Note>
  `memify()` is a legacy operation. In Cognee v1.0, most users should use [improve()](/core-concepts/main-operations/improve) instead for graph enrichment and session-to-graph bridging.
</Note>

## What is the memify operation

The `.memify` operation runs enrichment pipelines on an existing knowledge graph. It requires a graph built by [Add](/core-concepts/main-operations/legacy-operations/add) and [Cognify](/core-concepts/main-operations/legacy-operations/cognify) — it does not ingest raw data or build the graph from scratch.

Every memify pipeline is composed of two stages:

* **Extraction** — selects or prepares data from the existing graph. For example, pulling document chunks, loading graph triplets, or reading cached sessions.
* **Enrichment** — processes the extracted data and writes new or updated nodes and edges back to the graph. Depending on the pipeline, that can mean indexing triplet datapoints, deriving coding rules, or consolidating entity descriptions.

Memify chains extraction tasks and enrichment tasks into a single pipeline and runs them in sequence. When you call `await cognee.memify()` with no arguments, it runs the default pipeline. You can also call one of the other built-in pipelines directly, or supply your own custom tasks.

<Accordion title="Parameters (cognee.memify)">
  * **`extraction_tasks`** (`List[Task]`, default: config-dependent) — tasks that select or prepare the data to process. By default, memify uses triplet-datapoint extraction when triplet embeddings are enabled; otherwise the default extraction stage can be empty.
  * **`enrichment_tasks`** (`List[Task]`, default: `[Task(index_data_points, task_config={"batch_size": 100})]`) — tasks that create or update nodes and edges from the extracted data. When omitted, memify indexes the default extracted datapoints.
  * **`data`** (`Any`, default: `None`) — input data forwarded to the first extraction task. When `None`, memify loads the graph (or a filtered subgraph) as input.
  * **`dataset`** (`str` or `UUID`, default: `"main_dataset"`) — the dataset to process. The user must have write access.
  * **`node_type`** (`Type`, default: `NodeSet`) — filter the graph to nodes of this type. Only used when `data` is `None`.
  * **`node_name`** (`List[str]`, default: `None`) — filter the graph to nodes with these names. Only used when `data` is `None`.
  * **`run_in_background`** (`bool`, default: `False`) — if `True`, memify starts processing and returns immediately. Use the returned `pipeline_run_id` to monitor progress.
</Accordion>

## Built-in pipelines

Cognee ships a default memify pipeline plus several convenience pipelines. The default pipeline runs when you call `cognee.memify()` with no arguments. Other helpers wrap `cognee.memify()` with their own task sets.

<Accordion title="Default enrichment (triplet datapoints)">
  Runs when you call `await cognee.memify()` with no task arguments.

  * **Extraction** (`get_triplet_datapoints`) — when triplet embeddings are enabled, reads graph triplets (source -> relationship -> target) and converts each to an indexable datapoint
  * **Enrichment** (`index_data_points`) — indexes those datapoints in the vector DB

  **Produces:** indexed triplet datapoints for triplet-style retrieval. This default behavior is driven by the current memify defaults in Cognee's codebase and is what [Improve](/core-concepts/main-operations/improve) uses under the hood for its enrichment stage.

  <Note>
    The default extraction stage is config-dependent. When triplet embeddings are disabled, memify does not run the triplet extraction task automatically.
  </Note>
</Accordion>

<Accordion title="Triplet embeddings">
  Calls `cognee.memify()` with triplet-specific tasks via `await create_triplet_embeddings(user, dataset)`.

  * **Extraction** (`get_triplet_datapoints`) — reads graph triplets (source → relationship → target) and converts each to an embeddable text
  * **Enrichment** (`index_data_points`) — indexes those texts in the vector DB under the `Triplet_text` collection

  **Produces:** a searchable `Triplet_text` vector collection. Enables [`SearchType.TRIPLET_COMPLETION`](/core-concepts/main-operations/legacy-operations/search) queries.

  Guide: [Triplet Embeddings Guide](/guides/memify-triplet-embeddings)
</Accordion>

<Accordion title="Coding rules (custom workflow)">
  Coding-rule extraction still exists, but it is no longer the default memify pipeline.

  * **Extraction** (`extract_subgraph_chunks`) — pulls document chunk texts from the existing graph
  * **Enrichment** (`add_rule_associations`) — sends chunks to the LLM, which derives coding-rule associations

  **Produces:** `Rule` nodes connected to source chunks via `rule_associated_from` edges, grouped under the `coding_agent_rules` [node set](/core-concepts/further-concepts/node-sets). Enables [`SearchType.CODING_RULES`](/core-concepts/main-operations/legacy-operations/search) queries.

  Guide: [Memify Quickstart](/guides/memify-quickstart)
</Accordion>

<Accordion title="Session persistence">
  Calls `cognee.memify()` with session-specific tasks via `await persist_sessions_in_knowledge_graph_pipeline(user, session_ids)`. Requires [caching to be enabled](/core-concepts/sessions-and-caching).

  * **Extraction** (`extract_user_sessions`) — reads Q\&A data from the session cache for the specified session IDs
  * **Enrichment** (`cognify_session`) — processes session data through `cognee.add` + `cognee.cognify`

  **Produces:** new graph nodes from the session content, grouped under the `user_sessions_from_cache` [node set](/core-concepts/further-concepts/node-sets).

  Guide: [Session Persistence Guide](/guides/memify-session-persistence)
</Accordion>

<Accordion title="Entity consolidation">
  Calls `cognee.memify()` with entity-consolidation tasks via `await consolidate_entity_descriptions_pipeline()`. Useful when entity descriptions are fragmented or repetitive across chunks after [cognify](/core-concepts/main-operations/legacy-operations/cognify).

  * **Extraction** (`get_entities_with_neighborhood`) — loads `Entity` nodes along with their edges and neighbors
  * **Enrichment** (`generate_consolidated_entities` → `add_data_points`) — sends each entity and its neighborhood to the LLM, which returns a refined description

  **Produces:** updated `Entity` descriptions written back in place — no new nodes are created.

  Guide: [Entity Consolidation Guide](/guides/memify-entity-consolidation)
</Accordion>

<Accordion title="cognify vs memify: which to use">
  |                         | `cognify()`                                                                    | `memify()`                                                                                       |
  | ----------------------- | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ |
  | **Purpose**             | Build a knowledge graph from raw data                                          | Enrich an existing knowledge graph                                                               |
  | **Requires**            | Data added via [`add()`](/core-concepts/main-operations/legacy-operations/add) | A graph already built by [`cognify()`](/core-concepts/main-operations/legacy-operations/cognify) |
  | **Pipeline**            | Fixed: classify → chunk → extract → summarize → store                          | Customizable extraction + enrichment tasks                                                       |
  | **Pipeline cache**      | `True` — skips already-processed data by default                               | `False` — always re-processes                                                                    |
  | **Incremental loading** | `True` by default                                                              | Not applicable                                                                                   |
  | **When to use**         | Initial graph construction or adding new documents                             | Derive new facts, index triplets, consolidate entities                                           |

  **Use `cognify`** when you have new raw documents to turn into a knowledge graph.

  **Use `memify`** when you already have a graph and want to enrich it — for example, to index [triplet embeddings](/guides/memify-triplet-embeddings), extract coding rules, or [consolidate entity descriptions](/guides/memify-entity-consolidation) — without re-ingesting source data.
</Accordion>

<Columns cols={3}>
  <Card title="Cognify" icon="brain-cog" href="/core-concepts/main-operations/legacy-operations/cognify">
    Build the knowledge graph that memify enriches
  </Card>

  <Card title="Memify Quickstart" icon="brain" href="/guides/memify-quickstart">
    Run the default memify pipeline step by step
  </Card>

  <Card title="Search" icon="search" href="/core-concepts/main-operations/legacy-operations/search">
    Query the enriched graph with specialized search types
  </Card>
</Columns>
