fix(mem0-plugin): thread cwd to resolvers, add write-path tests, userConfig for API key

- on_pre_compact.py and capture_compact_summary.py now read cwd from
  hook stdin and pass it to resolve_project_id/resolve_branch (monorepo safe)
- 5 new tests verify all write functions use app_id top-level and never
  put project_id in metadata
- plugin.json declares userConfig.MEM0_API_KEY so Claude Code prompts
  for the key at install time (sensitive, stored in system keychain)
This commit is contained in:
kartik-mem0
2026-05-21 16:50:11 +05:30
parent cf6db6ef88
commit 66600565ed
4 changed files with 181 additions and 6 deletions
@@ -153,9 +153,10 @@ def main():
return
session_id = hook_input.get("session_id", "")
cwd = hook_input.get("cwd") or None
user_id = resolve_user_id()
project_id = resolve_project_id()
branch = resolve_branch()
project_id = resolve_project_id(cwd)
branch = resolve_branch(cwd)
lines = tail_lines(transcript_path, MAX_TAIL_LINES)
if not lines:
+3 -2
View File
@@ -234,9 +234,10 @@ def main():
return
session_id = hook_input.get("session_id", "")
cwd = hook_input.get("cwd") or None
user_id = resolve_user_id()
project_id = resolve_project_id()
branch = resolve_branch()
project_id = resolve_project_id(cwd)
branch = resolve_branch(cwd)
lines = tail_lines(transcript_path, MAX_TAIL_LINES)
if not lines: