Files
CyberGril/spike/hel857/step0_child.py
T
zonggongandmultica-agent e31ae2d946 HEL-857: approved Mem0 isolation spike - zero-model gates all pass, A/B synthetic scenarios within 26/60 real-call budget
- Fixed mem0 source commit 2c81af3 (2.2.1) in isolated venv, qdrant embedded + fastembed local zh embeddings (95.3MB, within 500MB cap)
- Gate0 transport-level persistent debit ledger: 61st call blocked pre-send, failures count, cross-process persistence, retries disabled+counted (fake transport, zero network)
- Gate1 qdrant embedded checks: keyword_search functional (Chinese segmentation gap recorded honestly), restart subprocess, clean-copy restore, no telemetry collections
- Gate2 privacy with stub LLM: P1-P5 zero leak, first-share timing F1-F6 (failed/cancel/unconfirmed no migration, ack+judged migrates told content with anchors, duplicate receipt idempotent), full backup incl. unshared internal memories restores clean
- A/B same-material same-criteria: Mem0 paraphrase recall strictly better than current lexical path (S3, model answers in Chinese), S1-S9 all pass, no regression
- Headline findings: Chinese input extracted as English memories (default upstream prompt), BM25 lexical channel inert for Chinese, ADD-only infer confirmed with our update orchestration, custom metadata needs direct payload read
- 26/60 real outbound via persistent ledger (incl. one parse-failure retry), usage/latency per row; embeddings 28/500; HEL-835 quota untouched
- Experiment branch only: no merge to main/product, no deploy, no real-profile access; handoff JSON + dual-base requirement checks pass

Co-authored-by: multica-agent <github@multica.ai>
2026-10-25 23:19:26 +08:00

34 lines
1017 B
Python

#!/usr/bin/env python3
"""Q0c 子进程:重新挂载同一路径,验证重启持久化。"""
from __future__ import annotations
import json
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
from spike.hel857.common import close_memory, mem_config # noqa: E402
from mem0 import Memory # noqa: E402
def main() -> int:
tmp = Path(sys.argv[1])
m = Memory.from_config(mem_config("test", vec_root=tmp, hist_root=tmp))
items = m.get_all(filters={"user_id": "u1"})
texts = [it["memory"] for it in (items.get("results") or [])]
sem = m.search("诗集", filters={"user_id": "u1"})
sem_n = len(sem.get("results") or []) if isinstance(sem, dict) else len(sem)
close_memory(m)
print(json.dumps({
"restarted_ok": len(texts) == 3 and sem_n >= 1,
"items": len(texts),
"semantic_hits": sem_n,
"first": texts[:1],
}, ensure_ascii=False))
return 0
if __name__ == "__main__":
raise SystemExit(main())