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

> Step-by-step guide to enriching memory and bridging session content with improve

A minimal guide to running a small improvement pass over existing memory so session-only content becomes part of the permanent dataset. In the current API, that flow goes through `improve()`, which uses memify-style enrichment under the hood.

**Before you start:**

* Complete [Quickstart](/getting-started/quickstart) to understand basic operations
* Ensure you have [LLM Providers](/setup-configuration/llm-providers) configured
* Have an existing dataset or be ready to create one with `remember()`
* Have session content you want to bridge into permanent memory

## What Memify Does

* Enriches an existing dataset instead of re-ingesting all source data
* Bridges session memory into the permanent graph when you pass `session_ids`
* Improves later `recall()` results by adding retrieval-ready structures to the dataset

## Code in Action

### Step 1: Store Permanent Memory

```python theme={null}
await cognee.remember(
    "Einstein developed general relativity.",
    dataset_name=DATASET,
    self_improvement=False,
)
```

This creates durable graph memory in `demo_dataset`. Setting `self_improvement=False` keeps the example focused on the explicit `improve()` call later.

### Step 2: Store Session-only Memory

```python theme={null}
await cognee.remember(
    "Niels Bohr worked on atomic structure.",
    dataset_name=DATASET,
    session_id=SESSION,
    self_improvement=False,
)
```

This writes the Bohr fact into session memory under `demo_session` instead of immediately pushing it into the permanent graph.

### Step 3: Recall Before Improvement

```python theme={null}
answer_before_improve = await cognee.recall(
    "What did Bohr work on?",
    datasets=[DATASET],
)
```

At this point, the permanent dataset may not yet know about the session-only Bohr fact, so the recall result can be empty or incomplete.

### Step 4: Bridge and Enrich with Improve

```python theme={null}
await cognee.improve(dataset=DATASET, session_ids=[SESSION])
```

This runs the improvement pass for `demo_dataset`, bridging the gap between short-term (session) memory and long term (permanent) memory by pulling in the specified session and enriching the graph.

### Step 5: Recall After Improvement

```python theme={null}
answer_after_improve = await cognee.recall(
    "What did Bohr work on?",
    datasets=[DATASET],
)
```

After `improve()` finishes, the permanent dataset can answer from the newly bridged session content.

## What Changed in Your Graph

After `improve()` completes, the dataset can include:

* Session-derived content from `demo_session` persisted into the permanent graph
* Additional derived retrieval structures created during the enrichment pass
* Better downstream recall for facts that were previously only available in the session

<Accordion title="Parameters">
  - **`dataset`** (`str`, default: `"main_dataset"`) — the dataset to improve.
  - **`session_ids`** (`Optional[List[str]]`) — session IDs whose cached memory should be bridged into the permanent graph.
  - **`run_in_background`** (`bool`, default: `False`) — if `True`, returns immediately and runs improvement asynchronously.
  - **`node_name`** (`Optional[List[str]]`) — narrows the improvement pass to specific named nodes or node sets.
  - **`feedback_alpha`** (`float`, default depends on runtime config) — controls how strongly session feedback affects graph weighting when feedback data exists.
</Accordion>

## Customizing Tasks (Optional)

```python theme={null}
await cognee.improve(
    dataset=DATASET,
    session_ids=[SESSION],
    extraction_tasks=[...],
    enrichment_tasks=[...],
)
```

You can override the default extraction and enrichment tasks when you need domain-specific improvement behavior.

## What Happens Under the Hood

When `session_ids` are provided, the improvement flow can:

* apply feedback-based weighting updates to graph elements used during retrieval
* persist session memory into the permanent graph
* run the enrichment pass on the target dataset
* sync new graph context back into the session cache

`improve()` uses memify for its enrichment stage, which is why this quickstart now demonstrates the current way to trigger that workflow.

## Additional examples

Additional examples about improve and memify-style enrichment are available in the updated `tests/guides/improve_quickstart.py` guide script.

<Accordion title="Troubleshooting">
  * **No visible change after `improve()`** — make sure the session ID you pass actually contains session memory and that `self_improvement=False` did not leave the content unbridged.
  * **Empty recall results after improvement** — verify that you are recalling against the same dataset you improved.
  * **Error: no graph data found** — create the base dataset first with `cognee.remember(..., dataset_name=...)`.
  * **LLM errors** — verify that your LLM provider is configured correctly. See [LLM Providers](/setup-configuration/llm-providers).
  * **Permission errors** — the user must have write access to the target dataset. See [Permissions](/core-concepts/multi-user-mode/permissions-system/datasets).
</Accordion>

## Full Example

<Accordion title="Latest guide">
  ```python theme={null}
  import asyncio
  import cognee

  DATASET = "demo_dataset"
  SESSION = "demo_session"


  async def main():
      await cognee.forget(everything=True)

      await cognee.remember(
          "Einstein developed general relativity.",
          dataset_name=DATASET,
          self_improvement=False,
      )

      await cognee.remember(
          "Niels Bohr worked on atomic structure.",
          dataset_name=DATASET,
          session_id=SESSION,
          self_improvement=False,
      )

      answer_before_improve = await cognee.recall(
          "What did Bohr work on?",
          datasets=[DATASET],
      )

      await cognee.improve(dataset=DATASET, session_ids=[SESSION])

      answer_after_improve = await cognee.recall(
          "What did Bohr work on?",
          datasets=[DATASET],
      )
      print("Before improve:", answer_before_improve)

      print("After improve:", answer_after_improve)


  if __name__ == "__main__":
      asyncio.run(main())
  ```
</Accordion>

<Accordion title="Legacy guide">
  ```python theme={null}
  import asyncio
  import cognee
  from cognee.modules.search.types import SearchType

  async def main():
      # 1) Add two short chats and build a graph
      await cognee.add([
          "We follow PEP8. Add type hints and docstrings.",
          "Releases should not be on Friday. Susan must review PRs.",
      ], dataset_name="rules_demo")
      await cognee.cognify(datasets=["rules_demo"])  # builds graph

      # 2) Enrich the graph (uses default memify tasks)
      await cognee.memify(dataset="rules_demo")

      # 3) Query the new coding rules
      rules = await cognee.search(
          query_type=SearchType.CODING_RULES,
          query_text="List coding rules",
          node_name=["coding_agent_rules"],
      )
      print("Rules:", rules)

  if __name__ == "__main__":
      asyncio.run(main())
  ```
</Accordion>

<Note>
  This updated example uses one permanent fact and one session-only fact for demonstration. In practice, you can bridge larger sessions and then run additional enrichment on the same dataset.
</Note>

<Columns cols={3}>
  <Card title="Improve" icon="sparkles" href="/core-concepts/main-operations/improve">
    Understand the current improvement workflow
  </Card>

  <Card title="Remember" icon="brain" href="/core-concepts/main-operations/remember">
    Store permanent and session memory
  </Card>

  <Card title="Sessions" icon="message-square" href="/guides/sessions">
    Learn how session memory behaves before improvement
  </Card>
</Columns>
