feat: Graphiti/Mem0 export dialects + per-memory forgetting-rate (v0.12.0)#6
Merged
Merged
Conversation
β¦ting-rate (v0.12.0) Phase 15 β two orthogonal features with pre-sprint lint cleanup. **Graphiti/Mem0 export dialects** (P2 completion): - `MemoryGraph.to_graphiti()` / `to_graphiti_json()` β nodes β episodes, edges β relations (similar_to, weight=cosine). Graphiti-compatible shape. - `MemoryGraph.to_mem0()` / `to_mem0_json()` β nodes β memory records with 16-char SHA-256 hash, score (decay_weight or 1.0). Mem0-compatible shape. - `MemoryGraphExporter.save_graphiti()` / `save_mem0()` β atomic file writes. - `GET /export/graph/graphiti` and `GET /export/graph/mem0` on the unified API. **Per-memory forgetting-rate override** (P3): - `MemoryMetadata.forgetting_rate: Optional[float]` β validated > 0. - `salience()` uses `effective_half_life = half_life_days / forgetting_rate` when set; rates > 1 accelerate decay, < 1 slow it. Default path unchanged. - `EnrichedMemoryStore.store(..., forgetting_rate=...)` + API `POST /memories/store`. **Pre-sprint cleanup**: 6 ruff lint violations fixed; PLAN.md version header corrected from stale v0.10.0 β v0.11.0. 445 tests passing (35 new: 16 test_graphiti_mem0 + 10 test_forgetting_rate + 9 API). https://claude.ai/code/session_01JDunGDgWBNwSHjHYvLppF6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MemoryGraph.to_graphiti()/to_mem0()methods emit graph data in the shapes Graphiti and Mem0 expect, so external graph tools can ingest kohaku memories without translation. Two new API endpoints:GET /export/graph/graphitiandGET /export/graph/mem0.MemoryMetadata.forgetting_rate: Optional[float]lets callers tune decay per-memory at store time.salience()useseffective_half_life = half_life_days / forgetting_rate; rates > 1 accelerate forgetting, < 1 slow it. Exposed viaPOST /memories/store.PLAN.mdversion header corrected.Test plan
python -m pytest python/tests/ api/ -qβ 445 passed, 0 failedruff check .β cleancargo testβ 9 Rust unit tests greencargo clippy -- -D warningsβ cleanGET /export/graph/graphitireturnsformat: "graphiti"withepisodesandrelationskeysGET /export/graph/mem0returnsformat: "mem0"withmemoriesarray and 16-charhashper entryPOST /memories/storewithforgetting_rate: 0.5accepted;forgetting_rate: 0.0returns 422https://claude.ai/code/session_01JDunGDgWBNwSHjHYvLppF6
Generated by Claude Code