Skip to content

Add delete-note CLI command (bm tool delete-note) #879

Description

@groksrc

Problem

There's no way to delete a note from the CLI. bm tool surfaces write-note, read-note, edit-note, build-context, recent-activity, search-notes, etc., but delete-note is missing — even though the underlying delete capability is fully implemented everywhere else:

  • MCP tool: src/basic_memory/mcp/tools/delete_note.py (registered in mcp/tools/__init__.py)
  • API: DELETE /v2/projects/{project_id}/knowledge/entities/{entity_id} and POST .../delete-directory (api/v2/routers/knowledge_router.py)
  • Service: entity_service.delete_entity() / delete_entity_by_file_path() / delete_directory()
  • Tests: test-int/mcp/test_delete_note_integration.py

The CLI entry point was simply never wired up.

Proposed solution

Add a delete_note command to src/basic_memory/cli/commands/tool.py, following the existing edit_note / write_note command pattern (around tool.py:182). It should delegate to the existing delete_note MCP tool so behavior matches the agent path exactly.

Suggested surface:

  • bm tool delete-note "Note Title" (by title or permalink)
  • --is-directory flag to delete a directory (the MCP tool already supports is_directory)
  • --project / --project-id options, matching the other bm tool commands
  • --output-format text|json, consistent with the rest

Notes

  • This is purely a CLI wiring task — no service/API changes needed.
  • Worth confirming whether move-note is similarly missing from the CLI while we're here (it appears not to be surfaced either), though that's out of scope for this issue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions