#2370

Stop/SessionEnd/PreCompact hooks have no remote/Team-Server support (local-import only)

Openjpfreeleyopened 2mo ago

Summary

The Stop/SessionEnd/PreCompact hooks (hooks_cli.py) have no path to a remote/Team-Server deployment at all. Every save/mine operation goes through a direct Python import against whatever MempalaceConfig().palace_path resolves to locally:

  • _save_diary_direct imports mempalace.mcp_server.tool_diary_write directly and calls it in-process.
  • _maybe_auto_ingest / _mine_sync / _ingest_transcript all spawn python -m mempalace mine ... as a local subprocess, or submit to a local daemon (daemon.get_client_if_running).

None of these paths accept a remote MCP HTTP endpoint (MEMPALACE_MCP_HTTP_TOKEN + URL, the documented Remote/Team Server mode) as an alternative target. hook_shell.py's helpers are pure local stdin/JSON parsing utilities with the same assumption baked in.

Impact

Anyone running the documented Remote/Team Server mode (deploy/docker-compose.server.yml, qdrant backend, MCP over HTTPS) gets zero hook-driven auto-save. The periodic diary checkpoint, the session-end flush, the pre-compact emergency save, and automatic transcript/project mining all silently do nothing useful against a remote deployment — enabling the hooks on a machine that also happens to have a local mempalace serve process running would actually make things worse: it writes new content into the local palace instead, which is exactly the kind of drift a remote-cutover is trying to eliminate.

Suggested fix

Let the hooks target a remote instance when one is configured — e.g. MEMPALACE_HOOK_REMOTE_URL / MEMPALACE_HOOK_REMOTE_TOKEN env vars (or equivalent config keys), with the hook doing a plain HTTPS tools/call (mempalace_diary_write, mempalace_add_drawer) instead of the local import when set, falling back to today's local-import behavior otherwise. At minimum, this limitation deserves a callout in the Remote/Team Server docs so it's not discovered the hard way.

Environment

  • mempalace 3.8.0
  • Confirmed by reading hooks_cli.py and hook_shell.py directly — no remote-mode code path exists in either file as of this version.

Activity

0

No activity yet.