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.
What is the forget operation
The.forget operation is the unified deletion command in Cognee v1.0.
- Single data item deletion: remove one data item from a dataset.
- Dataset deletion: remove an entire dataset and its graph/vector data.
- Full cleanup: remove everything the current user can delete.
- Memory-only reset: delete only graph/vector memory for a dataset or a single file, preserving raw files so the dataset can be re-cognified with different settings.
- User-scoped deletion:
forget()covers the main v1.0 deletion cases, but it does not replace low-level destructivepruneoperations.
Where forget fits
- Use
forget()when you want to remove memory. - Use it to clean up test data, reset a dataset, or fully wipe a local user’s memory.
- Use dataset-level forgetting for most operational cleanup.
- Use
pruneonly for destructive developer resets that must wipe underlying storage or system metadata directly.
What happens under the hood
Forget a specific data item
- Requires both
data_idanddataset. - Resolves the dataset by name or UUID with delete-permission checks.
- Deletes that item from the dataset with
delete_dataset_if_empty=False. - Leaves the dataset itself intact.
Forget a dataset
- Resolves the dataset by name or UUID with delete-permission checks.
- Deletes the dataset’s relational records and contained data items.
- Deletes graph nodes and edges for that dataset.
- Deletes vector embeddings for that dataset.
- Does not currently target session cache entries by dataset.
Forget everything
- Deletes all datasets the current user can delete.
- Removes graph, vector, and relational data for those datasets.
- Also prunes the session cache when caching or usage logging is enabled.
- Does not wipe raw uploaded files or bypass permission checks the way
prunedoes.
Forget memory only (dataset)
- Requires
dataset.memory_only=Truecannot be used without a dataset. - Resolves the dataset by name or UUID with delete-permission checks.
- Deletes all graph nodes and edges for the dataset.
- Deletes all vector embeddings for the dataset.
- Resets
pipeline_statuson all data records in the dataset, allowingcognifyto re-process them. - Does not remove raw files or the dataset/data relational records.
Forget memory only (single file)
- Requires both
datasetanddata_id, plusmemory_only=True. - Resolves the dataset by name or UUID with delete-permission checks.
- Deletes the graph nodes and edges associated with that single data item.
- Deletes the vector embeddings for that data item.
- Resets the
cognify_pipelinestatus entry for that data record, allowing re-processing. - Does not remove the raw file or the data record itself.
After forget finishes
- Single-item forget: the specified item is removed from the dataset, while the dataset remains.
- Dataset forget: the dataset’s relational, graph, and vector data are removed.
- Everything forget: all datasets the current user can delete are removed, and session cache is also pruned when caching is enabled.
- Memory-only (dataset): graph, vector, and pipeline status are cleared; the dataset, data records, and raw files remain intact and can be re-cognified.
- Memory-only (single file): graph nodes/edges and vector embeddings for that file are removed; the data record and raw file are preserved.
Examples and details
Forget a single data item
Forget a single data item
Forget an entire dataset
Forget an entire dataset
Forget everything for the current user
Forget everything for the current user
Forget only memory for a dataset (keep raw files)
Forget only memory for a dataset (keep raw files)
Use this when you want to re-cognify a dataset with different settings (e.g. a new graph model or custom prompt) without removing the original files.Graph nodes/edges and vector embeddings are deleted and the pipeline status is reset.
Raw files and the dataset/data records are preserved.
Forget only memory for a single file
Forget only memory for a single file
Clears just the graph and vector memory for one file, without touching the rest of the dataset.
Return values
Return values
forget() returns a summary dictionary.- Item deletion returns fields like
data_id,dataset_id, andstatus. - Dataset deletion returns the resolved
dataset_idandstatus. - Full deletion returns the number of datasets removed plus
status. - Memory-only dataset reset returns
dataset_id,data_records_reset(count of data records in the dataset), andstatus. - Memory-only single-file reset returns
data_id,dataset_id, andstatus.
Deletion scope by mode
Deletion scope by mode
| Mode | Relational data | Graph data | Vector data | Pipeline status | Raw files | Session cache |
|---|---|---|---|---|---|---|
data_id + dataset | removes the targeted item | removed for that item | removed for that item | unchanged | preserved | unchanged |
dataset | removed | removed | removed | removed | preserved | unchanged |
everything=True | removed for all owned datasets | removed for all owned datasets | removed for all owned datasets | removed | preserved | pruned when caching is enabled |
dataset + memory_only=True | preserved | removed | removed | reset (cognify re-runs) | preserved | unchanged |
dataset + data_id + memory_only=True | preserved | removed for that item | removed for that item | reset for that item | preserved | unchanged |
forget(dataset=...) and forget(everything=True) feel different: only the full wipe also clears session cache, and neither mode is a raw-storage/system-metadata reset like prune. The memory_only modes are the only modes that preserve relational records while clearing derived knowledge.User context and ownership
User context and ownership
forget() always runs in a user context.- If you do not pass
user, Cognee resolves the default user. - Deletion scope is based on what that user owns or has delete access to.
everything=Truemeans “everything the current user can delete,” not “everything in the whole system.”- This is why the
userparameter matters in multi-user or permissioned setups.
Parameters
Parameters
- Basic Parameters
- Advanced Parameters
| Option | What it does |
|---|---|
dataset | Deletes an entire dataset by name or UUID. |
data_id | Deletes one specific data item, but only when dataset is also provided. |
everything | Deletes all datasets and data the current user can delete. |
memory_only | When True, deletes only memory (graph + vector) and resets pipeline status for the given dataset, preserving raw files. Requires dataset. Combine with data_id to target a single file. |
Permissions and safety
Permissions and safety
- Deleting a specific item or dataset requires delete access to that dataset.
data_idcannot be used alone; it must be paired withdataset.memory_only=Truerequiresdatasetto be specified; omitting it raises aValueError.memory_onlyoperations check delete permission on the dataset before removing any graph or vector data.everything=Trueignoresdata_idanddatasetand wipes all data the current user can delete.- Dataset deletion does not currently clean only the matching session cache entries because sessions are not keyed by dataset.
forget()is not a substitute forprune_data()orprune_system(...), which are lower-level destructive maintenance tools.
Under the hood — legacy operations
Under the hood — legacy operations
forget() wraps the Delete and dataset-deletion APIs under the hood, extending them with a unified interface and session cache cleanup.Use legacy Delete directly only when maintaining older integrations or referencing older documentation. For destructive storage resets that bypass normal deletion logic, use prune rather than forget().Inspect what you've stored before forgetting
Inspect what you've stored before forgetting
To find the dataset name or See datasets API reference for the full set of listing and management methods.
data_id needed for forget(), list your datasets and their contents first:Remember
Add new permanent or session memory
Recall
Verify what memory is currently retrievable