Skip to content

mempalace_status returns "No palace found" on valid but empty palace (cold-start ChromaDB collection) #830

@hkevinchu

Description

@hkevinchu

Summary

mempalace_status (and by extension the MCP mempalace_status tool) returns {"error": "No palace found", "hint": "Run: mempalace init <dir> && mempalace mine <dir>"} even when the palace is correctly configured, as long as no drawers have ever been added. The hint is misleading because mempalace init has already been run successfully.

Reproduction

  1. mempalace init <vault_dir> --yes (produces mempalace.yaml, creates ~/.mempalace/config.json and ~/.mempalace/palace/chroma.sqlite3)
  2. Register the MCP server: claude mcp add mempalace --scope user -- /path/to/venv/bin/python -m mempalace.mcp_server
  3. From a Claude Code session, call mempalace_status.
  4. Observe: {"error": "No palace found", "hint": "Run: mempalace init <dir> && mempalace mine <dir>"}
  5. Call mempalace_add_drawer with any content.
  6. Call mempalace_status again. Now returns a normal response with total_drawers: 1.

Root cause

tool_status() in mempalace/mcp_server.py:261 calls _get_collection() with the default create=False. That helper at mcp_server.py:181 calls client.get_collection(_config.collection_name), which raises when the collection does not yet exist in ChromaDB (the zero-drawer state). The exception is swallowed and _get_collection returns None, so status falls through to _no_palace() at mcp_server.py:201.

The palace is actually fine: config.json, mempalace.yaml, and chroma.sqlite3 are all present and valid. The ChromaDB collection just hasn't been created yet because nothing has been stored. The first mempalace_add_drawer call bootstraps the collection (via get_or_create_collection in the write path) and status then works correctly.

Impact

  • For users following an "accrete from live conversations" seeding strategy (no mempalace mine), the first status call after setup is misleading. It suggests the palace is broken and that init needs to be re-run, when in fact everything is wired correctly.
  • The MCP protocol doc (in the PALACE_PROTOCOL constant shown in the status response) tells the AI to call mempalace_status on wake-up. On a fresh palace, that first call returns an error the AI then has to reason around.

Suggested fix

Either:

  1. In tool_status(), call _get_collection(create=True) so an empty collection is created on first status call, then report total_drawers: 0 normally. Low risk, matches what add_drawer already does.
  2. Or distinguish "no palace config" (truly uninitialized — config.json missing, palace_path does not exist) from "palace configured but collection empty" and return a dedicated response for the latter, e.g. {"status": "empty", "palace_path": ..., "total_drawers": 0} with guidance to add a drawer or run mine.

Option 1 is the smaller change. Option 2 is clearer for tooling that wants to distinguish the two states.

Environment

  • MemPalace installed from git (editable install)
  • Python 3.13 (Homebrew), dedicated venv
  • macOS 15.4 (Darwin 25.4.0)
  • MCP server registered globally via Claude Code, no --palace arg (defaults to ~/.mempalace/palace/ via config.json)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/mcpMCP server and toolsbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions