Skip to content

Feature: Delete individual memories/observations #659

Description

@jellydn

What

Add the ability to delete individual memories (observations) from claude-mem.

Scope

  • Viewer UI: Delete button/icon on observation cards in the memory viewer
  • API endpoint: DELETE /api/observations/:id for programmatic access
  • MCP tool: mem-delete skill for Claude Code to delete memories conversationally

Target users

  • Users who want to remove accidental or sensitive recordings
  • Users who need to clean up test/debug observations
  • Users requiring privacy/data retention management

Why

Currently, users have no way to delete individual memories:

  • Manual SQL commands are the only option (not user-friendly)
  • Users cannot remove accidental recordings with private/sensitive content
  • No data retention management capability exists
  • This is a common expectation for any memory/notes system

How

Implementation approach

1. API Layer (src/services/worker-service.ts)

  • Add DELETE /api/observations/:id endpoint
  • Validate ownership and existence before deletion
  • Return appropriate error codes if observation not found

2. SQLite (src/services/sqlite/ObservationStore.ts)

  • Add deleteById(id: string) method
  • Use existing DELETE trigger for audit trail in observation_audit table

3. Viewer UI (src/ui/viewer/components/)

  • Add delete button to observation card component
  • Show confirmation dialog before deletion
  • Optimistic UI update after successful API response
  • Handle errors gracefully with toast notifications

4. MCP Tool (plugin/skills/mem-search/)

  • Add mem-delete tool definition
  • Accept observation ID or search criteria
  • Return confirmation of deletion

Database schema

No schema changes needed - SQLite supports DELETE natively. The existing observation_audit trigger already captures deleted records.

Related files

  • src/services/sqlite/ - ObservationStore.ts (new delete method)
  • src/services/worker-service.ts - API route handler
  • src/ui/viewer/ - React components
  • plugin/skills/mem-search/ - MCP tool definition

Out of scope (future work)

  • Bulk delete (multiple IDs)
  • Soft delete with archive
  • Delete by date range or filters
  • Undo capability

Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions