fix(mem0-plugin): sanitize marker path, add pre-compact REST backup, fix cross-tool gaps

- Sanitize project_id in onboard marker path (tr '/:' '--') to handle
  slashes from env var overrides
- Fire on_pre_compact.py REST backup from PreCompact hook (was only
  called from Stop hooks — crash before Stop = data loss)
- Source _identity.sh in on_stop_codex.sh and on_stop_cursor.sh so
  MEM0_PROJECT_ID + API key fallback are available
- Note dream --schedule is Claude Code-only (Codex/Cursor lack schedule)
This commit is contained in:
kartik-mem0
2026-05-21 17:43:40 +05:30
parent 63641f5573
commit 82ab253f2c
5 changed files with 15 additions and 2 deletions
+7
View File
@@ -15,6 +15,13 @@ if [ -n "${MEM0_DEBUG:-}" ]; then
mkdir -p "$HOME/.mem0" && exec 2>>"$HOME/.mem0/hooks.log"
fi
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
INPUT=$(cat)
# Fire REST API transcript backup in background (safety net if agent
# can't complete the add_memory call before compaction finishes)
echo "$INPUT" | python3 "$SCRIPT_DIR/on_pre_compact.py" --source=pre-compaction 2>/dev/null &
cat <<'EOF'
## CRITICAL: Pre-Compaction Session Summary