basic-memory icon indicating copy to clipboard operation
basic-memory copied to clipboard

Refuse a missing `project_id` when more than one project is visible, and reject an unknown workspace qualifier

Open pharaoh1st opened this issue 2 weeks ago • 2 comments

Observed behavior

On a shared local Basic Memory server with eight visible projects and a global default_project set:

  1. read_note(identifier="<title>") with project_id and project omitted did not refuse. It resolved through the server default/hierarchy and returned notes from a different project.
  2. read_note(project="bogus-workspace/homelab") did not refuse. The unknown workspace qualifier was ignored and the note from the homelab project was returned.
  3. read_note(project="<other-name>", project_id="<exact-homelab-uuid>") correctly returned the homelab note, so project_id precedence works.
  4. An invalid UUID and an invalid project name both returned Project not found: '<value>'. No wrong-project write was observed.

Expected behavior

The tool contract should fail closed for project selection:

  • If project_id is omitted and more than one project is visible, refuse with a readable error instead of resolving a default.
  • If a workspace qualifier is unknown, refuse once instead of silently ignoring it.
  • If a project name is ambiguous, refuse and name the exact IDs or ask for project_id.
  • A valid exact project_id continues to win.

Why it matters

This server is shared by multiple agents and projects. A caller that forgets project_id currently reads a different project without any error. That is a silent cross-project read, and it undermines a one-project-per-agent binding contract. A wrong-project write was not demonstrated, but the read path is not fail-closed.

Suggested change

Add a strict project-binding mode (ideally the default for a multi-project server) that enforces the rules above at the tool boundary, and return a stable typed error plus the candidate project IDs. A config switch is acceptable if the strict behavior is reachable without a code fork.

Repro notes

No secrets, customer content, or credentials are needed. The behavior reproduces with any two visible projects and an omitted project_id.

pharaoh1st avatar Nov 11 '26 23:11 pharaoh1st

The missing-project half is fixed in 1.0: the bm_* tools require project. The unknown-workspace half needs Cloud, because only Cloud knows which workspace was routed. Tracked in https://github.com/basicmachines-co/basic-memory-cloud/issues/3124.

phernandez avatar Nov 12 '26 05:11 phernandez

Closing. The missing-project half shipped in 1.0, and the unknown-workspace half is tracked in Cloud: https://github.com/basicmachines-co/basic-memory-cloud/issues/3124

phernandez avatar Nov 12 '26 21:11 phernandez