cognee.prune
Static class with methods for cleaning up Cognee data and system state.
Methods
prune.prune_data()
await cognee.prune.prune_data()
Removes all raw data files from the file storage backend (local disk or S3,
configured via DATA_ROOT_DIRECTORY). Does not remove database records —
use prune_system(metadata=True) for that.
prune.prune_system()
await cognee.prune.prune_system(
graph: bool = True,
vector: bool = True,
metadata: bool = False,
cache: bool = True,
)
Cleans up system database resources selectively. Does not delete files
from storage — call prune_data() first if you also need to wipe raw files.
Delete all data from the graph database (e.g., Kuzu, Neo4j).
Delete all data from the vector store (e.g., LanceDB, Qdrant).
Delete the relational metadata database (datasets, data records, pipeline state). Defaults to False to prevent accidental loss of metadata.
prune_system has no permission checks and will wipe all graph and vector
data regardless of which user or dataset it belongs to. Only use it in local
development or test environments.
Examples
import cognee
# Full reset: remove raw files, databases, and metadata
await cognee.prune.prune_data() # wipes raw files from disk / S3
await cognee.prune.prune_system(metadata=True) # wipes graph, vector, relational DB, and cache
# Partial reset: clear graph and vector stores only (keep metadata and files)
await cognee.prune.prune_system(graph=True, vector=True, metadata=False, cache=False)
# Clear only the pipeline cache
await cognee.prune.prune_system(graph=False, vector=False, metadata=False, cache=True)