← 返回 Skills 市场
ogi98rus

LightRAG Memory

作者 Gorikon · GitHub ↗ · v1.0.1 · MIT-0
cross-platform ✓ 安全检测通过
128
总下载
1
收藏
1
当前安装
2
版本数
在 OpenClaw 中安装
/install lightrag-memory
功能描述
LightRAG-based semantic memory system for AI agents. Provides efficient long-term knowledge storage and retrieval using vector embeddings and knowledge graph...
使用说明 (SKILL.md)

LightRAG Memory

Semantic memory system with vector search + knowledge graph. Replaces reading entire memory files on every request with targeted retrieval (~1-3K tokens vs 30K+).

Quick Setup

cd skills/lightrag-memory
pip install -r requirements.txt

Set environment variables:

export OPENAI_API_KEY="your-key"
export OPENAI_BASE_URL="https://your-api-endpoint/v1"  # optional, defaults to OpenAI

Or create a .env file in the skill directory.

Commands

Index memory files

Index MEMORY.md and memory/*.md from workspace:

python3 scripts/rag.py index

Insert content

# From file
python3 scripts/rag.py insert --file /path/to/file.md --source "filename"

# From text
python3 scripts/rag.py insert --text "Important fact" --source "manual"

# From stdin
echo "Some text" | python3 scripts/rag.py insert --source "stdin"

Query

# Hybrid search (best results, costs more API calls)
python3 scripts/rag.py query "What do I know about the user?" --mode hybrid

# Local search (entities + relationships, balanced)
python3 scripts/rag.py query "What projects were discussed?" --mode local

# Naive search (simple vector lookup, cheapest)
python3 scripts/rag.py query "Any notes about deployment?" --mode naive

# Global search (broad context, expensive)
python3 scripts/rag.py query "Summarize everything" --mode global

Query Modes

Mode What it searches Cost Best for
naive Vector embeddings only Lowest Quick fact lookup
local Entities + relationships Low Specific entities
global Community-level context High Broad understanding
hybrid Local + global Highest Comprehensive answers

Storage

Data stored in ~/.openclaw/workspace/lightrag_storage/ by default. Override with LIGHTARG_WORKING_DIR env var.

Integration Pattern

For agent memory systems, index files on change and query on demand:

# Check if reindex needed (files modified since last index)
find MEMORY.md memory/ -name '*.md' -newer memory/lightrag-last-index.txt

# Reindex if needed
python3 scripts/rag.py index
touch memory/lightrag-last-index.txt

# Query when context needed
python3 scripts/rag.py query "user preferences" --mode naive

Architecture

  • Embeddings: text-embedding-3-small (1536 dim) via OpenAI-compatible API
  • LLM: gpt-4o-mini for entity extraction and answer generation
  • Storage: JSON-based vector DB + GraphML knowledge graph
  • Batching: 8 items per embedding batch, 4 concurrent async requests

Troubleshooting

OPENAI_API_KEY not set: Ensure env vars are exported or .env exists.

numpy RuntimeError (X86_V2): On older CPUs lacking AVX2, install pip install "numpy\x3C2.0".

Slow first index: Initial indexing processes all files. Subsequent updates are incremental.

Reset storage: rm -rf \x3Cstorage_dir>/* && python3 scripts/rag.py index

安全使用建议
This skill appears to do what it claims: local indexing and querying via an OpenAI-compatible API. Before installing: (1) review the third-party PyPI package 'lightrag-hku' (source/repo) because pip installs run arbitrary code; (2) run the package in an isolated environment (virtualenv/container) if you want to limit blast radius; (3) keep your OPENAI_API_KEY secret and consider using a dedicated key with limited scope and billing alerts; (4) be careful when running index with a custom --workspace path since it can read and index files you point it at; (5) if you set OPENAI_BASE_URL, ensure it points to a trusted endpoint because embeddings and texts will be sent there. If you want extra assurance, review the source of 'lightrag-hku' and the LightRAG implementation before installing.
能力评估
Purpose & Capability
Name/description, required binaries (python3, pip), required env var (OPENAI_API_KEY), and included files (requirements.txt, scripts/rag.py) all align with a semantic memory/embedding tool that calls an OpenAI-compatible API.
Instruction Scope
Instructions and the script operate on MEMORY.md and memory/*.md by default and store data under ~/.openclaw/workspace/lightrag_storage; the index command accepts a workspace path so a user could point it at any directory (and thus index other files) if they run it with a custom path. The code loads an optional .env from the skill directory and uses only OPENAI_API_KEY/OPENAI_BASE_URL for remote calls.
Install Mechanism
No installer that downloads arbitrary archives is present; install is via pip -r requirements.txt which will pull PyPI packages (including an external package named 'lightrag-hku'). Installing pip packages executes third-party code at install time, so review the package provenance before installing. The SKILL.md includes an 'install' metadata block, while the registry said 'No install spec' — minor metadata inconsistency.
Credentials
Only OPENAI_API_KEY is required (OPENAI_BASE_URL is optional). These are appropriate for a tool that sends text to an OpenAI-compatible embeddings/LLM service. The skill stores data locally; it does not request unrelated credentials or config paths.
Persistence & Privilege
always is false and the skill is user-invocable. It creates a local working directory for storage under the user's home; it does not modify other skills or request elevated agent privileges.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install lightrag-memory
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /lightrag-memory 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.1
- Added Openclaw integration metadata, specifying required binaries (python3, pip), necessary environment variables (OPENAI_API_KEY), and pip install instructions. - No changes to skill functionality or commands.
v1.0.0
Initial release — LightRAG-based semantic memory with vector search and knowledge graph. Index, insert, and query agent memory files efficiently (~1-3K tokens vs 30K+).
元数据
Slug lightrag-memory
版本 1.0.1
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 2
常见问题

LightRAG Memory 是什么?

LightRAG-based semantic memory system for AI agents. Provides efficient long-term knowledge storage and retrieval using vector embeddings and knowledge graph... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 128 次。

如何安装 LightRAG Memory?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install lightrag-memory」即可一键安装,无需额外配置。

LightRAG Memory 是免费的吗?

是的,LightRAG Memory 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

LightRAG Memory 支持哪些平台?

LightRAG Memory 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 LightRAG Memory?

由 Gorikon(@ogi98rus)开发并维护,当前版本 v1.0.1。

💬 留言讨论