← 返回
未分类 中文

Graph-RAG Memory

Graph-RAG memory system using Graphiti temporal knowledge graph + FalkorDB + local Ollama embeddings. Provides persistent, queryable long-term memory for Ope...
Graph‑RAG 记忆系统,使用 Graphiti 时序知识图谱、FalkorDB 与本地 Ollama 嵌入,为操作提供持久、可查询的长期记忆
jebadiahgreenwood jebadiahgreenwood 来源
未分类 clawhub v0.1.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 322
下载
💾 0
安装
1
版本
#embeddings#falkordb#graphiti#knowledge-graph#latest#local-llm#memory#moe#ollama#rag

概述

Graph-RAG Memory Skill

Persistent, queryable agent memory via a temporal knowledge graph. Facts are extracted from

episodes (conversations, documents, notes), stored as typed entities and relationships in

FalkorDB, and retrieved via hybrid BM25 + cosine similarity search with domain-expert routing.

Architecture Overview

Write path:  content → DomainRouter → expert embedder → Graphiti.add_episode()
                                             ↓
                                      FalkorDB (workspace graph)
                                      39+ nodes, 73+ RELATES_TO edges
                                      fact_embedding: 768-dim cosine index

Read path:   query → DomainRouter → expert embedder → query_vector
                                             ↓
                                    graphiti_search() [BM25 + cosine RRF]
                                             ↓
                                    ranked EntityEdge objects with .fact

Routing layers:

  1. Hard routing (metadata/source_type → domain, confidence=1.0)
  2. Centroid routing (cosine similarity to domain centroids, threshold=0.02)
  3. Fanout fallback (parallel expert queries + RRF fusion)

Domains: personal, episodic, project, technical, research, meta, general

Prerequisites

See references/setup.md for full installation and environment details.

Quick check:

# Verify services (write to a temp script, don't use python3 -c inline)
import falkordb, httpx
r = falkordb.FalkorDB(host='172.18.0.1', port=6379)
print("FalkorDB OK:", r.list_graphs())
# nomic-embed-text must be loaded on NVIDIA Ollama

Python packages (reinstall after container restart — ephemeral layer):

export PATH=$PATH:/home/node/.local/bin
curl -sS https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py
python3 /tmp/get-pip.py --user --break-system-packages
pip3 install --user --break-system-packages graphiti-core falkordb sentence-transformers

File Layout

All skill scripts live at: memory-upgrade/ (workspace root)

memory-upgrade/
  config.py             # Service URLs + model names
  embedder.py           # OllamaEmbedderClient + expert registry
  router.py             # DomainRouter (hard + centroid + fanout)
  setup_graphiti.py     # Graphiti factory (defaults to 'workspace' graph)
  write_path.py         # ingest_memory(), ingest_workspace_memories()
  read_path.py          # query_memory() — hybrid BM25+vector
  phase3_ingest.py      # Seed ingestion (checkpoint-aware, re-runnable)
  phase4_query_test.py  # Read path validation (7 test queries)
  phase6_full_ingest.py # Full workspace ingestion + centroid recalibration
  checkpoints/          # Phase state (JSON, safe to re-run)
  scripts/              # Skill scripts (install, ingest, query, status)

Common Tasks

Query memory

# Write to a .py file, then run it
import asyncio, sys
sys.path.insert(0, '/path/to/memory-upgrade')
from setup_graphiti import init_graphiti
from read_path import query_memory
from router import DomainRouter

async def main():
    g = await init_graphiti("workspace")
    router = DomainRouter(ollama_base_url="http://172.18.0.1:11436")
    edges, routing = await query_memory(g, router, "your question here",
                                         group_ids=["workspace"], limit=5)
    for e in edges:
        print(e.fact)
    await g.close()

asyncio.run(main())

Or use the convenience script:

python3 memory-upgrade/scripts/query_memory.py "your question here"

Ingest new content

python3 memory-upgrade/scripts/ingest.py --file path/to/file.md --domain project
python3 memory-upgrade/scripts/ingest.py --text "Jebadiah decided X because Y" --domain personal

Check system status

python3 memory-upgrade/scripts/status.py

Re-seed from workspace memory files

python3 memory-upgrade/phase3_ingest.py    # daily notes + MEMORY.md
python3 memory-upgrade/phase6_full_ingest.py  # broader workspace docs

Configuration

Edit memory-upgrade/config.py to change endpoints or models:

OLLAMA_URL     = "http://172.18.0.1:11436"   # NVIDIA — embeddings
AMD_OLLAMA_URL = "http://172.18.0.1:11437"   # AMD — LLM (gemma4:e4b)
LLM_MODEL      = "gemma4:e4b"                # entity extraction LLM
EMBED_GENERAL  = "nomic-embed-text"          # 768-dim general embedder

Known Gotchas

  • Data graph name = group_id: Graphiti names the FalkorDB graph after the group_id

passed to add_episode(). Always use group_id="workspace" and init_graphiti("workspace").

  • sim_min_score must be 0.0: The default 0.6 blocks almost all results. Always set to 0.0.
  • No python3 -c inline: OpenClaw's obfuscation detector fires on it. Write to a temp file.
  • Packages reinstall needed: /home/node/.local is ephemeral. Re-run pip install after restart.
  • Vector index: Created in Phase 5. If the workspace graph is reset, re-run phase5_vector_index.py.

Research Foundations

See references/research.md for full citations. Key papers:

  • RouterRetriever (Zhuang et al., AAAI 2025) — centroid-based expert routing
  • Graphiti (Rasmussen et al., 2024) — temporal knowledge graph for agents
  • MoE routing literature — confidence thresholding + fanout fusion

ClawHub Publishing

See references/clawhub.md for packaging and publishing instructions.

版本历史

共 1 个版本

  • v0.1.0 当前
    2026-05-07 18:23 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-agent

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,406 📥 324,647
ai-agent

Find Skills

guipi888
场景驱动+关键词双模式技能发现工具。当用户用自然语言描述场景/需求(如"我想做一个海报""帮我分析股票"),或明确说"安装技能/find skills/找个skill"时,自动从官方内置、本地已安装、SkillHub、虾评、GitHub、C
★ 1,490 📥 554,868
ai-agent

Agent Browser

rez0
用于 AI 代理的浏览器自动化 CLI。当用户需要与网站交互(包括浏览页面、填写表单、点击按钮、截图等)时使用。
★ 843 📥 323,278