#2582·mempalace

bug(daemon): sweep and sync submitted with a relative path run against the daemon's cwd

Author: mvalentsevCreated Sep 23, 2026Updated Sep 23, 2026

What happened?

mempalace sweep <target> and mempalace sync [dir] [--root R] put a relative path into the daemon job as typed. The daemon keeps the working directory of the command that started it, so the path is resolved there and not where the user ran the command. #2441 was this bug for mine, and #2467 fixed that one field. #2467's description and the merge note on #2033 both named sync's raw dir as a follow-up; sweep, which #2033 routed to the daemon, has the same shape.

Measured on develop @ c4d3711e through the real CLI. <w> holds a/ and b/, each with a session.jsonl (different sessions) and a mined proj/ whose gone.md was then deleted. The daemon was started from <w>/a, and every command below ran from <w>/b.

run from b/ result
sweep session.jsonl --daemon Swept <w>/a/session.jsonl: +2 new, exit 0. a's session went in, b's never did
sweep . --daemon Swept 1/1 files from <w>/a, exit 0
sync proj --daemon --apply Top sources removed: <w>/a/proj/gone.md, exit 0. The drawer of b/proj/gone.md stays
sweep later.jsonl with MEMPALACE_CLI_WRITE_ROUTING=prefer Not a file or directory: <w>/a/later.jsonl, exit 1

The sync row removed a drawer of a project nobody named. Its source file is gone, so it cannot be mined back.

What did you expect?

The path resolved against the caller's cwd before it goes into the job, as mine does since #2467: b/session.jsonl swept, b/proj/gone.md's drawer removed, a/ untouched.

How to reproduce:

With <p> a scratch palace and a/, b/ set up as above:

  1. cd a && mempalace --palace <p> daemon start
  2. cd ../b && mempalace --palace <p> sweep session.jsonl --daemon reports Swept <w>/a/session.jsonl
  3. mempalace --palace <p> sync proj --daemon --apply reports Top sources removed: <w>/a/proj/gone.md

Environment:

  • OS: Linux (WSL2)
  • Python version: 3.12.3
  • MemPal version: develop @ c4d3711e