fix(mem0-plugin): remove noisy session-state dumps, match openclaw pattern

- Remove all background REST API transcript dumps (on_pre_compact.py,
  capture_compact_summary.py, on_pre_commit.py calls) that were creating
  noisy session_state and commit_context memories automatically
- Rewrite pre-compaction prompt to extract individual durable facts
  (decisions, learnings, anti-patterns) instead of session summary blobs
- Agent now decides what to store, matching openclaw's triage pattern:
  "Most sessions produce zero memory operations. That is correct."
- Fix auto_import.py to search git repo root for CLAUDE.md/AGENTS.md
  (was only searching plugin cwd, missing files in parent directory)
- Fix health check session tracker to check stats file directly instead
  of depending on CLAUDE_PLUGIN_ROOT env var
- Fix session-end report to print in SessionEnd hook (Stop hook output
  doesn't render on /exit)
- Update v2 API endpoint to v3 in git commit capture search
- Keep auto_import.py as only direct REST write path (project profiles,
  idempotent, hash-gated)
This commit is contained in:
kartik-mem0
2026-05-22 16:20:31 +05:30
parent c2290299cf
commit 271c7c23c5
10 changed files with 99 additions and 123 deletions
@@ -28,18 +28,11 @@ esac
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
if [ ! -f "$SCRIPT_DIR/on_pre_commit.py" ]; then
exit 0
fi
API_KEY="${MEM0_API_KEY:-${CLAUDE_PLUGIN_OPTION_MEM0_API_KEY:-}}"
if [ -z "$API_KEY" ]; then
exit 0
fi
# Background: capture staged changes as memory
git diff --cached --stat 2>/dev/null | python3 "$SCRIPT_DIR/on_pre_commit.py" &
# Foreground: search for relevant memories about changed files
CHANGED_FILES=$(git diff --cached --name-only 2>/dev/null | head -10 | tr '\n' ', ' | sed 's/,$//')
if [ -z "$CHANGED_FILES" ]; then