Skip to content

manage_adr (MCP/CLI) and the UI /api/adr endpoints use separate storage backends #256

@bschrib

Description

@bschrib

The MCP tool manage_adr writes/reads ADRs as files at <root>/.codebase-memory/adr.md. The HTTP UI's /api/adr endpoints read/write SQLite via cbm_store_adr_get / cbm_store_adr_store. Writes via either interface are invisible to the other.

Reproduction (v0.6.0, macOS arm64):

# write via CLI
codebase-memory-mcp cli manage_adr '{"project":"<name>","mode":"update","content":"## PURPOSE\ntest\n"}'

# CLI roundtrips
codebase-memory-mcp cli manage_adr '{"project":"<name>","mode":"get"}'   # -> returns content
cat <repo>/.codebase-memory/adr.md                                         # -> content present

# UI endpoint
curl http://localhost:9749/api/adr?project=<name>                          # -> {"has_adr": false}

The UI's + ADR button stays + ADR because hasAdr comes from that /api/adr response (graph-ui/src/components/StatsTab.tsx:111).

Code pointers:

  • src/mcp/mcp.c:3498-3555handle_manage_adr, file-backed at <root>/.codebase-memory/adr.md.
  • src/ui/http_server.c:449-559handle_adr_get / handle_adr_save, SQLite-backed via cbm_store_adr_* (src/store/store.c:4537,4560).

Expected: one canonical backend. The file-on-disk path is likely the right target since it's committable and lives with the repo; the SQLite-backed UI handlers would need to switch to reading/writing the file.

Impact: ADRs created by agents via MCP don't surface in the graph UI. ADRs created by humans in the UI aren't readable by agents.

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