Maximize memory graph utilization for retrieval: graph everywhere, learned edge weights, active clusters
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 19.9k
- Forks
- 2.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 30
Description
Summary
jcode's memory graph has a good structure (nodes: Memory/Tag/Cluster; edges: HasTag, InCluster, RelatesTo, Supersedes, Contradicts, DerivedFrom; BFS cascade retrieval) but it's underutilized: search never touches the graph, edge weights are static, cluster auto-discovery is still marked "future", and some edge types are rarely used.
Current behavior
searchdoesn't use the graph at all. Onlyrecallcascade mode runs BFS traversal (find_similar_with_cascade_scoped).memory searchis pure substring over search_text.- Edge weights are static.
EdgeKind::traversal_weight()returns fixed values (HasTag 0.8, InCluster 0.6, RelatesTo weight, Supersedes 0.9, Contradicts 0.3, DerivedFrom 0.7). No learning from usage frequency or reinforcement (crates/jcode-memory-types/src/graph.rs:113-125). - Cluster auto-discovery is "future".
graph.rsheader comments say cluster nodes are "automatic grouping (future)". HDBSCAN clustering mentioned in MEMORY_ARCHITECTURE.md isn't wired to active retrieval. - Some edge types rarely used.
DerivedFrom(procedural knowledge derived from facts) andInClusterhave no active creation path in normal flow.
Why it matters
The 11-systems comparison shows graph usage is a differentiator for good agent memory: Graphiti/Zep (temporal KG), Mem0 (entity graph + entity boost), total-agent-memory (graph expansion stage in 6-stage retrieval), Cognee (KG + ontology), A-MEM (Zettelkasten note linking). jcode has the graph primitives but doesn't realize their value in retrieval.
Proposed enhancement
- Graph everywhere: make
search(and the hybrid path from #1103) also traverse graph edges — seed hits expand via cascade, so tag/relation-connected memories surface even when lexical/embedding miss. - Learn edge weights: strengthen edges on co-retrieval (reinforcement), decay on rejection — like agentmemory confidence / post-retrieval maintenance already in the design doc.
- Activate clusters: wire auto-discovery (HDBSCAN or similar) into indexing + retrieval (InCluster edge traversal already has a weight).
- Use all edge types: create
DerivedFromedges for procedures extracted from facts; surfaceContradictspairs with both versions flagged (per #1104).
References
- Parity: agentmemory (confidence/lifecycle), Graphiti (temporal edges), Cognee (ontology), A-MEM (Zettelkasten linking), total-agent-memory (graph expansion stage).
crates/jcode-memory-types/src/graph.rs(EdgeKind,traversal_weight,cascade_retrieve)crates/jcode-base/src/memory.rs(find_similar_with_cascade_scoped)docs/MEMORY_ARCHITECTURE.md(clusters, post-retrieval maintenance)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with crates/jcode-memory-types/src/graph.rs, crates/jcode-base/src/memory.rs, and docs/MEMORY_ARCHITECTURE.md; trace cascade retrieval and the current search path before choosing a narrowly defined increment. Done requires an agreed scope, implementation coverage for that scope, and tests showing graph-connected memories are retrieved as intended.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- ai, backend, search
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100