memorix icon indicating copy to clipboard operation
memorix copied to clipboard

HTTP/stdio without projectRoot still binds $HOME and can create a decoy ~/memorix.db

Open RaviTharuma opened this issue 3 months ago • 2 comments

Description

Follow-up to #198 (closed). HTTP and stdio clients that omit projectRoot still bind the server cwd. LaunchAgents and Cursor's stdio plugin often start with cwd $HOME. Memorix then:

  1. Treats $HOME as the project (No git project could be resolved from "/Users/…" / "/home/…").
  2. Can create an empty decoy $HOME/memorix.db (4096 bytes, 0 observations) while the real store is ~/.memorix/data/memorix.db.

Agents then search an empty store and conclude "Memorix has no memories".

Steps to Reproduce

  1. Start memorix serve or serve-http with cwd $HOME (LaunchAgent default, or Cursor plugin without workspace root).
  2. Call memorix_search / memorix_project_context without memorix_session_start({ projectRoot }).
  3. ls -l $HOME/memorix.db and compare to ~/.memorix/data/memorix.db.

Expected Behavior

No decoy DB in $HOME. Project-scoped tools fail closed with a bind instruction, or inherit the last git project / MEMORIX_PROJECT_ROOT. Never create ~/memorix.db.

Actual Behavior

Observed on Linux 2026-08-17: empty ~/memorix.db (0 observations) while ~/.memorix/data/memorix.db had 64k rows. Cursor plugin in this workspace answered "Cannot search the current project yet" from /Users/<user> until memorix_session_start({ projectRoot: "…/memorix-workspace" }).

Environment

  • Memorix 1.6.0
  • Cursor stdio plugin + HTTP 127.0.0.1:3211/mcp
  • macOS and Linux

Additional Context

Local watchdog now refuses to start from $HOME and reads ~/.memorix/last-project-root. That is a host seatbelt, not an upstream fix. #198's client-projectRoot requirement is still the common failure for Grok / Cursor / OpenCode Autopilot.

Related: #198, #214.

RaviTharuma avatar Aug 17 '26 13:08 RaviTharuma

Implementation is in PR https://github.com/AVIDS2/memorix/pull/230 (not #214).

HTTP / stdio / background / CLI refuse $HOME as a project root. Unresolved control-plane launches open the shared store at ~/.memorix/data, never ~/memorix.db. getDatabase() throws if asked to create a DB directly in $HOME. Launch-from-home can inherit MEMORIX_PROJECT_ROOT or ~/.memorix/last-project-root.

Leaving this open until #230 merges.

RaviTharuma avatar Aug 17 '26 17:08 RaviTharuma

This is now released in v1.6.3. Project binding and SQLite use one HOME boundary across HTTP, stdio, background mode, and Windows HOME/USERPROFILE resolution. A real Windows launch from an isolated HOME returned healthy and created no ~/memorix.db.

AVIDS2 avatar Aug 18 '26 12:08 AVIDS2