1jehuang / 1jehuang/jcode

Maximize memory graph utilization for retrieval: graph everywhere, learned edge weights, active clusters

Open
#1,107 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

autonomous: no enhancement tech-debt triage: needs-decision
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

  1. search doesn't use the graph at all. Only recall cascade mode runs BFS traversal (find_similar_with_cascade_scoped). memory search is pure substring over search_text.
  2. 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).
  3. Cluster auto-discovery is "future". graph.rs header comments say cluster nodes are "automatic grouping (future)". HDBSCAN clustering mentioned in MEMORY_ARCHITECTURE.md isn't wired to active retrieval.
  4. Some edge types rarely used. DerivedFrom (procedural knowledge derived from facts) and InCluster have 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

  1. 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.
  2. Learn edge weights: strengthen edges on co-retrieval (reinforcement), decay on rejection — like agentmemory confidence / post-retrieval maintenance already in the design doc.
  3. Activate clusters: wire auto-discovery (HDBSCAN or similar) into indexing + retrieval (InCluster edge traversal already has a weight).
  4. Use all edge types: create DerivedFrom edges for procedures extracted from facts; surface Contradicts pairs 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.