improve(), which uses memify-style enrichment under the hood.
Before you start:
- Complete Quickstart to understand basic operations
- Ensure you have 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
demo_dataset. Setting self_improvement=False keeps the example focused on the explicit improve() call later.
Step 2: Store Session-only Memory
demo_session instead of immediately pushing it into the permanent graph.
Step 3: Recall Before Improvement
Step 4: Bridge and Enrich with Improve
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
improve() finishes, the permanent dataset can answer from the newly bridged session content.
What Changed in Your Graph
Afterimprove() completes, the dataset can include:
- Session-derived content from
demo_sessionpersisted 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
Parameters
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) — ifTrue, 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.
Customizing Tasks (Optional)
What Happens Under the Hood
Whensession_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 updatedtests/guides/improve_quickstart.py guide script.
Troubleshooting
Troubleshooting
- No visible change after
improve()— make sure the session ID you pass actually contains session memory and thatself_improvement=Falsedid 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.
- Permission errors — the user must have write access to the target dataset. See Permissions.
Full Example
Latest guide
Latest guide
Legacy guide
Legacy guide
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.
Improve
Understand the current improvement workflow
Remember
Store permanent and session memory
Sessions
Learn how session memory behaves before improvement