Back to the list
memx · Rust · kho XS3
memx · honest memory for agents
Better to lose a fact outright than to remember it wrong unnoticed
Prose memory fails silently. One round of summarising drops a qualifier, rounds a number, turns may into will; the sentence still reads well, so there is nothing to make a reader suspicious. Similarity-based stores add a second problem: a question whose answer was never stored still comes back with the nearest thing on file. memx handles both with one structural choice.
Installed software, no public demo.
- Rust
- XS3
- SQLite FTS5
- MCP
- Claude Code hooks
§ 01Algorithm
# Trí nhớ dạng văn xuôi hỏng ÂM THẦM: tóm tắt lại một lần là rơi một định
# ngữ, làm tròn một mã băm — câu vẫn trôi chảy, và người đọc KHÔNG có cách
# nào biết nó đã sai.
fact ::= subject predicate object # XS3: một dòng = một cạnh
^owner ¬ phủ định [] chỉ được nhắc tới @when
dưới hạn mức token:
văn xuôi → diễn đạt lại → sai âm thầm
tập cạnh → rụng nguyên dòng → phần còn lại ĐÚNG TỪNG BYTE
recall(q): # fail-closed
hits ← filter(edges, q) # lọc + đi đồ thị, không phải tìm gần đúng
nếu hits = ∅: return ∅ # KHÔNG trả "phỏng đoán gần nhất"
# ^owner buộc khớp → không mượn dữ kiện của người khác lấp chỗ trống
# ¬ và [] không bao giờ recall ngược thành một khẳng định
tiers: pins.xs3 bất biến — không bao giờ bị đuổi
hot.xs3 cạnh mới, viết lại mỗi lần nén
cold.xs3 CHỈ NỐI THÊM — khôi phục nguyên văn được
# Hook Stop chạy MỖI LƯỢT: tới lúc context bị nén thì mọi dữ kiện đã nằm
# trong kho rồi → nén không mất gì; SessionStart nạp lại phần pin.§ 02Highlights
- One fact is one XS3 edge, deduplicated by exact key instead of fuzzy match
- Under a token budget: whole lines drop and the rest stays byte-exact
- Fail-closed recall, an empty result rather than a plausible guess
- ^owner, ¬, [] and @when enforced at recall, not left to a reminder
- Deterministic: the same facts and the same question give the same answer
- The whole store is plain text, greppable and diffable in git
- Three Claude Code hooks do the remembering, with no manual calls
§ 03Screens