cognee.forget()
Description
forget() is the unified deletion API in Cognee v1.0.
- Use it to remove a single data item from a dataset.
- Use it to delete an entire dataset.
- Use
everything=Trueto remove all memory owned by the current user. - Use
memory_only=Trueto clear graph and vector memory while keeping raw dataset records so the content can be reprocessed.
Parameters
Optional[UUID]
default:"None"
Specific data item to remove. Requires
dataset to also be set.Optional[Union[str, UUID]]
default:"None"
Dataset name or UUID. When used alone, deletes the whole dataset. When paired with
data_id, deletes only that item from the dataset.bool
default:"False"
Deletes all datasets and memory owned by the current user.
bool
default:"False"
Deletes only graph and vector memory for the target dataset or data item while keeping underlying dataset records.Deletion is driven by provenance, so it only reaches nodes recorded as belonging to the target dataset or data item. Nodes written by a custom pipeline whose payload is not a tracked data item — the code-graph pipeline, for instance, which takes a repository path — carry no provenance and are left in place. To clear those, use
prune instead: code-graph ingestion skips a repository whose snapshot identity still matches the marker on its CodeRepository node, and only removing that node makes the next run reload every fact.Any
default:"None"
Runs the operation under a specific user context instead of the default user.
Return value
forget() returns a summary dictionary. Depending on the mode, it includes fields like status, dataset_id, data_id, or datasets_removed.