-
Notifications
You must be signed in to change notification settings - Fork 606
Labels
Description
Delete Command Preview (Enhancement)
NOTE: This issue is part of Contribute-to-Win. Please comment first to get assigned. Read the details here
Problem Statement
The cognee delete
command currently removes data as requested (all data, by dataset, or by user). While it works as intended, users don’t get a clear overview of what will be affected before confirming the action.
Adding a preview step would improve usability and safety by helping users understand the scope of deletion before proceeding.
Proposed Solution
Enhance the delete command to include a preview step that summarizes what will be deleted.
The preview should display key metrics so the user can make an informed decision before confirming.
Preview metrics
When the user runs cognee delete
(with any argument), we should show a breakdown like:
- Datasets: How many datasets will be removed
- Data entries: How many individual data items are affected
- Other relevant metrics (e.g., users affected, chunks, embeddings)
Example:
You are about to delete:
- 3 datasets
- 152 data entries
- 1 user
~~~~~
Then confirm before proceeding:
Proceed? (y/N)
Cases
- Delete all
- Show counts across the entire system
- Delete by dataset
- Show counts scoped to that dataset
- Delete by user_id
- Show counts of all datasets and data entries owned by that user
Non-Functional
- If nothing is found to delete → show
No data found to delete.
and exit - Must run efficiently (counts only, not full data scan)
- If metrics can’t be retrieved → log warning and fallback to direct delete
- Default confirmation = No unless explicitly confirmed
- Add
--force
flag to skip preview and delete immediately (useful for automation/CI)
Integration
- Update
cognee delete
command in CLI - Add preview logic before actual delete execution
- Extend tests to cover preview outputs for different argument combinations
Acceptance Criteria
- Running
cognee delete
shows preview metrics before deletion - Preview correctly reflects counts for all, dataset, and user-specific deletes
- Empty or invalid targets return
No data found to delete.
--force
skips preview and deletes immediately- Confirmation prompt defaults to safe (abort unless explicitly confirmed)
- Metrics are logged before deletion begins