Skip to content

PERF: ~5 second CLI startup latency per tool call #18

Closed

Description

@bm-clawd

Problem

Every bm CLI invocation takes ~5 seconds just to start (Python/uv import overhead), before doing any actual work. Since the plugin shells out to the CLI for each tool call, this adds significant latency.

Measurements

bm status --project claw     → 5.4s total
bm tool search-notes ...      → 6.7s total  
bm tool read-note ...         → 6.2s total
bm project list               → 5.0s total

Most of the time is Python startup + importing dependencies (FastAPI, SQLAlchemy, fastembed, etc.).

Impact

Medium-High. Each plugin tool call has a 5s floor. For a composited memory_search that queries 3 sources, that's potentially 15s+ of CLI overhead. Users perceive this as sluggishness. For comparison, a raw SQLite query would take <100ms.

Possible Fixes

  1. Long-running daemon: Instead of CLI per-call, have the plugin talk to the MCP server or a lightweight API
  2. Lazy imports: Only import heavy deps (fastembed, etc.) when actually needed
  3. Pre-warmed process pool: Keep a bm process alive between calls
  4. Direct DB access: For simple reads/searches, bypass CLI entirely and query SQLite directly from the TypeScript plugin

Notes

  • This is a BM CLI issue more than a plugin issue, but the plugin architecture amplifies it
  • The MCP server approach (if the plugin connected to it instead of shelling out) would eliminate this entirely

Upstream Tracking (basic-memory)

Activity

  1. added
    enhancement
    on Feb 18, 2026
  2. bm-clawd commented on Feb 22, 2026

    @bm-clawd
    ContributorAuthor

    Superseded — plugin 1.0 uses persistent MCP server over stdio. No more ~5s CLI cold starts per tool call.

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