Skip to content

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

Closed

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

  1. added
    enhancement
    on Jun 1, 2026
  2. claude commented on Jun 1, 2026

    @claude
    Contributor

    Claude finished @groksrc's task in 2m 33s —— View job


    Analysis & Implementation Plan

    Type: Feature request (CLI wiring — no service/API changes needed)
    Priority: Medium | Component: CLI | Complexity: Simple

    Todo List

    • Analyze issue and classify
    • Add labels for triage
    • Read existing tool.py to understand CLI patterns
    • Read delete_note.py MCP tool to understand parameters
    • Implement delete_note CLI command in tool.py
    • Check if move_note is also missing from CLI — confirmed missing, but out of scope per issue
    • Add tests for delete_note in test_cli_tool_json_output.py
    • Run just fast-check — skipped (no shell execution permissions)
    • Push changes — ❌ push blocked (403 permission denied)

    What Was Implemented

    src/basic_memory/cli/commands/tool.py

    • Added from basic_memory.mcp.tools import delete_note as mcp_delete_note import
    • Added delete_note command registered as "delete-note" on tool_app
    • Supports: identifier (positional), --is-directory, --project, --project-id, --local, --cloud
    • Follows exactly the same pattern as edit_note / write_note — delegates to MCP tool with output_format="json", checks for error key, exits 1 on error

    tests/cli/test_cli_tool_json_output.py

    • Added DELETE_NOTE_RESULT and DELETE_DIRECTORY_RESULT mock data
    • Added 5 tests: JSON output, --is-directory, not-found (deleted=False), error response (exit 1), --project-id passthrough

    Notes

    • move_note is also absent from bm tool (confirmed), but that's a separate issue per the requester
    • Push failed with 403 — the GitHub Actions bot lacks write permission to this branch. The commit is local.
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

    enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions