Delete & Cleanup
Remove sensitive or unwanted commands from your history and keep your database lean with garbage collection and vacuuming.
Deleting Commands
Use suv delete to bulk-delete commands that match a given pattern. By default the pattern is matched as a substring against every command in your history.
suv delete <PATTERN> Suvadu will show you how many commands match and ask for confirmation before deleting. Use --dry-run to preview without deleting, or -y to skip the confirmation prompt. The pattern cannot be empty: a blank pattern is refused before anything else is checked, so to delete by date alone, name the text too, as in suv delete "docker" --before 2024-01-01. Deleting a command also deletes its kept failure output.
Flags
| Flag | Description |
|---|---|
--regex | Treat the pattern as a regular expression instead of a plain substring match. |
--dry-run | Show which commands would be deleted without actually removing them. Always recommended as a first step. |
-y, --yes | Skip the interactive confirmation prompt and delete immediately. Use with caution. |
--before <DATE> | Only delete commands recorded before the specified date or relative time (e.g., "30 days ago", "2024-01-01"). Since 0.5.1 a date it cannot read stops with could not read --before … as a date and the accepted formats. |
--no-backup | Skip the automatic database snapshot taken before deleting (see below). |
Automatic Backup Before Deleting
Because deletion is irreversible, Suvadu writes a consistent snapshot of your database to the backups directory before deleting, and aborts the delete if that snapshot can't be written. Pass --no-backup to skip it. You can also take a snapshot anytime with suv backup.
Examples
# Preview which commands contain "secret"
suv delete "secret" --dry-run
# Delete all commands starting with "test" that are older than 30 days
suv delete "^test" --regex --before "30 days ago" -y
# Delete commands containing a specific token
suv delete "ghp_abc123" -y
# Remove all curl commands from before 2024
suv delete "curl" --before "2024-01-01"
# The example suv delete --help shows (its earlier empty-pattern example was refused)
suv delete "docker" --before 2024-01-01 Deleting from the Search TUI
While browsing your history in the interactive search interface (suv search or Ctrl+R), you can delete individual entries on the spot:
- Navigate to the command you want to remove.
- Press Ctrl+D to delete it.
- Suvadu will ask for confirmation before removing the entry.
This is useful for one-off removals — for bulk operations, use suv delete from the command line.
Garbage Collection
Over time, deleting commands can leave orphaned metadata (tags, notes, or session references that no longer point to any command). Use suv gc to clean these up. Since 0.5.1 it also removes failure output left without its command and agent git snapshots a day old whose session left no other record, and rebuilds the search index when it no longer matches your history (suv doctor reports when it does not).
suv gc Flags
| Flag | Description |
|---|---|
--dry-run | Show what would be cleaned up without making any changes. |
--vacuum | After garbage collection, run SQLite's VACUUM command to compact the database file and reclaim disk space. |
--failure-output | Since 0.5.1: also delete the output stored for every failed command ([capture] failure_output), keeping the commands themselves. Add --vacuum to also reclaim the pages it used. |
Examples
# Preview orphaned data
suv gc --dry-run
# Clean up and compact the database
suv gc --vacuum
# Delete every stored failure output, keeping the commands
suv gc --failure-output Secrets Protection
Suvadu automatically redacts common secret patterns — API keys, tokens, passwords, and credentials — before writing commands to the database. This happens at capture time, so most sensitive data never reaches disk.
Redaction only applies to what is recorded after a rule exists. To mask secrets in history you already have, after an upgrade adds rules or after you add your own patterns, use suv redact: it keeps each command, masks just the secret, and also reaches agent sessions and the backups.
suv redact --dry-run # list what would be masked
suv redact # mask, after a question If something slipped through that no rule recognises (an unusual token format, or a password passed inline), or you want the whole command gone, use suv delete to remove it:
# Find and remove commands containing a leaked secret
suv delete "sk-proj-abc123" --dry-run
suv delete "sk-proj-abc123" -y --no-backup), so you can recover — but still use --dry-run first to verify the match before committing.
Recommended Workflow
- Preview first — always run with
--dry-runto see what will be deleted. - Delete — once you have verified the matches, run without
--dry-run. - Garbage collect — run
suv gcto clean up any orphaned data left behind. - Compact — optionally run
suv gc --vacuumto reclaim disk space from the SQLite file.
suv redact once to apply them to what is already stored. Either way, rotate a leaked secret that is still in use.