Skip to main content

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 owned by the current user.
  • User-scoped deletion: forget() covers the main v1.0 deletion cases, but it does not replace low-level destructive prune operations.

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 prune only 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_id and dataset.
  • 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 owned by the current user.
  • 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 prune does.

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 owned by the current user are removed, and session cache is also pruned when caching is enabled.

Examples and details

Forget a single data item

await cognee.forget(
    data_id=item_id,
    dataset=dataset_id,
)
await cognee.forget(dataset="scientists")
await cognee.forget(everything=True)
forget() returns a summary dictionary.
  • Item deletion returns fields like data_id, dataset_id, and status.
  • Dataset deletion returns the resolved dataset_id and status.
  • Full deletion returns the number of datasets removed plus status.
ModeRelational dataGraph dataVector dataSession cache
data_id + datasetremoves the targeted itemremoves graph data tied to that item through dataset deletion logicremoves vector data tied to that item through dataset deletion logicunchanged
datasetremovedremovedremovedunchanged
everything=Trueremoved for all owned datasetsremoved for all owned datasetsremoved for all owned datasetspruned when caching is enabled
This is why 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.
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=True means “everything for the current user,” not “everything in the whole system.”
  • This is why the user parameter matters in multi-user or permissioned setups.
OptionWhat it does
datasetDeletes an entire dataset by name or UUID.
data_idDeletes one specific data item, but only when dataset is also provided.
everythingDeletes all datasets and data owned by the current user.
  • Deleting a specific item or dataset requires delete access to that dataset.
  • data_id cannot be used alone; it must be paired with dataset.
  • everything=True ignores data_id and dataset and wipes all data owned by the current user.
  • Dataset deletion does not currently clean only the matching session cache entries because sessions are not keyed by dataset.
  • forget() is not a substitute for prune_data() or prune_system(...), which are lower-level destructive maintenance tools.
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().

Remember

Add new permanent or session memory

Recall

Verify what memory is currently retrievable