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

# Rust SDK Forget

> forget in cognee-rust: remove a data item, a dataset, everything, or only a dataset's graph and vector memory.

## What is the forget operation

`forget` is the delete entry point of the memory API. It removes memory at the scope you name and keeps the stores consistent with each other.

## What happens under the hood

Removes memory: a whole dataset, a specific data item, or everything. Cascades
across the relational, graph, and vector backends and file storage. rustdoc:
`api::forget`.

## What you can forget

The Rust API takes a `ForgetTarget` (`cognee::api::forget`):

| Target | What it removes |
| - | - |
| `Item { data_id, dataset }` | One data item in a dataset |
| `Dataset { dataset }` | A whole dataset |
| `All` | Every dataset the owner has in the caller's tenant, one after another by id. It stops at the first failure with `DeleteError::Partial`. It does not prune the session cache. |
| `DatasetMemoryOnly { dataset }` | The dataset's graph and vector data. The files and the `Data` / `Dataset` rows stay, and only the cognify pipeline status is reset, so the dataset can be cognified again. |
| `DataItemMemoryOnly { data_id, dataset }` | The same, for one data item |

A dataset is named by `DatasetRef::Name` or `DatasetRef::Id`. Either way it must be the owner's dataset in the caller's tenant: a name never reaches a dataset in another tenant, and an id of another owner's dataset fails as `Dataset <id> not found`, the same answer as an unknown id. The resolved dataset is then deleted by id.

`forget` is a thin wrapper over `DeleteService` ([`cognee-delete`](https://github.com/topoteretes/cognee-rs/blob/main/crates/delete/)) and always deletes in soft mode: the data, its chunks and their graph and vector entries are removed, but entity nodes left orphaned by the deletion are not swept. To sweep them, use [delete](#delete) in hard mode (`cognee-cli delete --mode hard`, or `DeleteMode::Hard` on `DeleteService`). The returned `ForgetResult` carries a `target` label and the `DeleteResult`.

The CLI's `cognee-cli forget` takes `--dataset-name` (`-d`), `--data-id` (needs `--dataset-name`) or `--all`, plus `--tenant-id`. The bindings' `forget` takes a target object whose `kind` is `item`, `dataset` or `all`; any other kind is rejected. The memory-only targets are available from the Rust API only. For a dry-run preview of what a delete would remove, use [delete](#delete) directly.

## delete

The lower-level **delete** behind `forget` cascades removal of data and datasets across relational → graph → vector → file storage, with a dry-run preview. Entry: `DeleteService` in [`cognee-delete`](https://github.com/topoteretes/cognee-rs/blob/main/crates/delete/); CLI `cognee-cli delete`, bindings `delete*()`.

## Related

> [card] [Datasets](https://docs.cognee.ai/rust/core-concepts/further-concepts/datasets.md)
>
> The scope forget works in

> [card] [Remember](https://docs.cognee.ai/rust/core-concepts/main-operations/remember.md)
>
> Store memory

> [card] [Operations](https://docs.cognee.ai/rust/core-concepts/main-operations/overview.md)
>
> Every operation and interface


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.