Skip to content

CLI --format json improvements for OpenClaw plugin integration #553

@bm-clawd

Description

@bm-clawd

Context

The openclaw-basic-memory plugin shells out to bm tool commands and parses JSON output. PR #552 adds --format json to read-note, write-note, and recent-activity. A few improvements would make the CLI a more reliable integration surface.

Issues

1. _write_note_json double round-trip

  • Currently writes via mcp_write_note.fn(), then re-resolves the entity via API client to get metadata back
  • The MCP tool could return entity metadata (title, permalink, file_path) directly, avoiding the second lookup
  • Not blocking, but doubles the work for every write

2. _read_note_json identifier handling

  • Uses memory_url_path(identifier) which may assume the input is a memory URL or permalink
  • If a plain title is passed (e.g. "My Note" instead of "my-note" or "memory://my-note"), does memory_url_path resolve it correctly?
  • Plugin users will pass titles, permalinks, and memory URLs interchangeably

3. _recent_activity_json hardcoded pagination

  • page_size=50 is hardcoded with no CLI passthrough
  • Should expose --page and --page-size options consistent with other commands

4. --project support on recent-activity

5. Consider --format json on build-context

  • build-context always outputs JSON (no format flag). This is fine and consistent, but adding the flag for symmetry would make the CLI surface more predictable for integrators.

Related

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