Skip to main content

Overview

The bd forget command permanently deletes a stored memory from the key-value store. Use this to remove outdated, incorrect, or no longer relevant knowledge. Added in: v0.58.0

Syntax

Arguments

string
required
The exact key of the memory to delete. Keys are case-sensitive.

How It Works

The command:
  1. Looks up the memory by key (kv.memory.<key>)
  2. Verifies it exists (fails if not found)
  3. Deletes it from the database
  4. Confirms deletion with the deleted content (truncated)
The deletion is permanent and syncs via Dolt push/pull like all database changes.

Examples

Basic Deletion

Remove a single memory:
Output:

Long Content Confirmation

When forgetting a long memory:
Output (truncated at 80 chars):

Key Not Found

Attempting to delete a non-existent memory:
Output (stderr):
Exit code: 1

JSON Output

For programmatic use:
Success output:
Not found output:
Exit code: 1 when not found.

Use Cases

Remove Outdated Information

Clean up memories that are no longer accurate:
Note: You can also just update by running bd remember with the same key. Use forget when you want to completely remove the memory, not replace it.

Cleanup Test Data

Remove memories created during testing:

Remove Sensitive Info

If you accidentally stored something sensitive:
This only deletes from the current database. If you’ve already pushed to a Dolt remote, the memory exists in git history. Use dolt sql to rewrite history if needed, or rotate the credential.

Bulk Deletion Script

Delete multiple memories at once:
Or delete all memories matching a pattern:

Safe Deletion with Confirmation

Verify before deleting:

Agent Cleanup

AI agents can clean up after themselves:

Exit Codes

  • 0: Memory deleted successfully
  • 1: Memory key not found (nothing to delete)
Use in scripts:

Finding Keys to Delete

If you don’t remember the exact key:
Or list all keys:

Undo Deletion

There’s no built-in undo for bd forget, but if you have Dolt history:
Or query historical data:
  • bd memories - List all memories to find keys to delete
  • bd recall - View full content before deleting
  • bd remember - Store or update a memory (alternative to delete + recreate)

Tips

Before deleting, recall the content to verify it’s what you think:
Use descriptive keys with prefixes so you can bulk-delete by category:
Deletion is permanent in your local database. However, Dolt tracks all changes. If you need to recover a deleted memory, you can query historical commits.
If you’re using bd forget to remove sensitive data, remember that:
  1. The data remains in Dolt history
  2. If pushed to a remote, it’s in the shared history
  3. Use Dolt’s history rewriting features if true deletion is required
  4. Rotate compromised credentials regardless

Common Patterns

Replace Instead of Delete

Often you want to update, not delete:

Safe Batch Deletion

Delete multiple memories with confirmation:

Audit Before Delete

Log deletions for audit trail: