Skip to content

Audit CLI tool calls: ensure all commands have clean --format json #6

@bm-clawd

Description

@bm-clawd

Context

The plugin shells out to bm tool ... for all operations. Some commands output clean JSON natively, others need --format json (PR basic-memory#553), and some have no JSON output at all.

The parseJsonOutput() function in bm-client.ts exists to strip non-JSON junk (warnings, Rich markup) from CLI output. Once all commands support clean --format json, this workaround can be removed.

Current state

Command Method JSON support Notes
search-notes execToolNativeJson ✅ Native JSON Works clean
build-context execToolNativeJson ✅ Native JSON Works clean
read-note execTool + --format json ⚠️ Needs PR #553 Also needs frontmatter stripping
write-note execTool + --format json ⚠️ Needs PR #553 Response used to confirm write
recent-activity execTool + --format json ⚠️ Needs PR #553
project add execRaw ❌ No JSON Output ignored, errors silenced

Goal

  1. Confirm PR #553 covers read-note, write-note, recent-activity with clean JSON
  2. Once merged, verify all commands return parseable JSON without prefix junk
  3. Remove parseJsonOutput() workaround — replace with direct JSON.parse()
  4. Collapse execTool / execToolNativeJson into a single method (all commands become native JSON)
  5. Decide: does project add need JSON output? (currently fire-and-forget)

Longer term: writes via markdown files

Per architecture discussion: write operations (write-note, edit) should eventually write markdown files directly to the project path and let BM's filewatcher index them. This removes the CLI dependency for writes entirely. Reads stay on CLI with --format json.

Depends on

  • basic-memory PR #553 (--format json for CLI tools)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions