Skip to content

Bug: isInitialized() fails because --palace is passed after subcommand #1

Description

@mantzas

Description

isInitialized() in mempalace-cli.ts always returns false because it passes --palace after the status subcommand:

await executeMempalace(['status', '--palace', palacePath]);
// Produces: mempalace status --palace /path/to/palace

However, --palace is a global flag in the mempalace CLI's argparse and must precede the subcommand:

mempalace --palace /path/to/palace status   # ✅ works
mempalace status --palace /path/to/palace   # ❌ argparse error

Impact

Since isInitialized() always returns false:

  1. The plugin thinks the palace doesn't exist
  2. It triggers initialize(dir) which runs mempalace init --yes <workspace_dir>
  3. For large workspace dirs (e.g. home directory), this times out at 5s
  4. The plugin stays stuck in initializing state
  5. Wake-up injection never fires — users get [MemPalace]: The memory system is being built asynchronously forever

Suggested Fix

Drop --palace entirely from the isInitialized() call. The mempalace CLI resolves the palace path automatically from ~/.mempalace/config.json or the MEMPALACE_PALACE_PATH env var:

await executeMempalace(['status']);

I've submitted a PR with this fix: see #linked PR.

Reproduction

# This is what the plugin does — fails
mempalace status --palace ~/.mempalace/palace
# error: unrecognized arguments: --palace ~/.mempalace/palace

# This works
mempalace status

Environment

  • mempalace 3.1.0
  • opencode-plugin-mempalace 1.2.1
  • Python 3.13.13
  • macOS

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions