fsi-anomaly / tests /test_helix_memory.py
FerrellSyntheticIntelligence's picture
backup all: 100 files (batch)
76b78ee verified
Raw
History Blame Contribute Delete
988 Bytes
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
from research.helix import HelixMemory
def test_helix_recall_bridges_cases_and_keeps_receipts(tmp_path):
memory = HelixMemory(str(tmp_path / "memory.jsonl"))
record = memory.write("The market rose in 1929", "Index record: 1929 rose 4%", "supports", "MEDIUM", "quoted value", case_id="history", source_ids=["doc-a"], tags=["finance", "timeline"])
assert record["id"].startswith("mem-")
assert memory.recall_many("What happened to the market in 1929?", tags=["finance"])[0]["source_ids"] == ["doc-a"]
assert memory.bridges("market 1929", tags=["finance"])
def test_helix_forget_and_stats(tmp_path):
memory = HelixMemory(str(tmp_path / "memory.jsonl"))
record = memory.write("A", "B", "supports", "LOW", "R", case_id="c1")
assert memory.stats()["records"] == 1
assert memory.forget(record_id=record["id"]) == 1
assert memory.stats()["records"] == 0