feat(mem0-plugin): add PostHog telemetry across all hooks
Wire fire-and-forget PostHog telemetry into every lifecycle hook (session_start, stop, pre_compact, task_completed, user_prompt, post_tool_use) matching the same project key, endpoint, and payload structure used by the Python SDK, CLI, and OpenClaw. - 10% sampling on ALL events to keep PostHog costs predictable - Anonymous distinct_id: MD5(api_key) or SHA-256(username) - Opt-out via MEM0_TELEMETRY=false - Platform detection: Claude Code / Cursor / Codex - Never sends user content, API keys, or raw identifiers - 16 new tests (110 total passing)
This commit is contained in:
@@ -21,6 +21,7 @@ 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 &
|
||||
python3 "$SCRIPT_DIR/telemetry.py" pre_compact 2>/dev/null &
|
||||
|
||||
cat <<'EOF'
|
||||
## CRITICAL: Pre-Compaction Session Summary
|
||||
|
||||
Reference in New Issue
Block a user