LightRAG Memory for Openclaw

A high-performance semantic memory system for AI agents that combines vector embeddings with knowledge graphs for precise, context-aware information retrieval.

ogi98rus
v1.0.1
Apr 11, 2026
1
879
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install lightrag-memory

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install lightrag-memory using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is LightRAG Memory?

LightRAG Memory is a sophisticated long-term storage solution designed for autonomous AI entities. By leveraging the power of LightRAG, this skill moves beyond simple keyword matching, offering a hybrid approach that integrates traditional vector search with structured knowledge graph relationships. This architecture allows agents to understand context and entity connections far more effectively than standard text-based memory.

Using Openclaw Skills like LightRAG Memory significantly reduces token consumption. Instead of re-reading massive memory files on every request—which can easily exceed 30K tokens—this system retrieves only the most relevant 1-3K tokens. This makes agent operations faster, more cost-effective, and more contextually aware across long-running sessions and complex workflows.

LightRAG Memory Use Cases

  • Implementing persistent long-term memory for autonomous AI assistants.
  • Performing semantic search over large, unstructured documentation or personal notes.
  • Building complex knowledge graphs from continuous agent-user interactions.
  • Reducing LLM context window pressure by retrieving only relevant facts instead of full files.
  • Developing agents that need to understand relationships between different entities in a workspace.

How LightRAG Memory Works

  1. The system ingests Markdown files or raw text strings from the agent's workspace.
  2. An embedding model (defaulting to text-embedding-3-small) generates vector representations of the text chunks.
  3. A language model (such as gpt-4o-mini) performs entity extraction to identify key concepts and their relationships.
  4. Extracted data is stored in a dual-layer system: a JSON-based vector database and a GraphML knowledge graph.
  5. When the agent issues a query, the skill searches both the vector space and the graph based on the chosen mode (naive, local, global, or hybrid).
  6. The most relevant context is returned to the agent, providing it with grounded facts for its response.

LightRAG Memory Setup

To install this skill, navigate to the skill directory and install the necessary Python dependencies:

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

Configure your environment by setting your API credentials. You can export these in your shell or use a .env file:

export OPENAI_API_KEY="your-key"
# Optional: Override the default OpenAI base URL
export OPENAI_BASE_URL="https://your-api-endpoint/v1"

Finally, initialize your memory by indexing your current workspace files:

python3 scripts/rag.py index

LightRAG Memory Data Schema & Taxonomy

The system organizes memory data into a specialized storage directory, ensuring persistence and fast retrieval.

Component Technical Detail Storage Location
Vector DB JSON-based embeddings (1536 dim) ~/.openclaw/workspace/lightrag_storage/
Knowledge Graph GraphML-formatted entities and relationships ~/.openclaw/workspace/lightrag_storage/
Source Tracking Metadata linking text chunks to source files Internal Index
State Management Last-indexed timestamp for incremental updates memory/lightrag-last-index.txt

LightRAG Memory Advanced Features

  • Four Query Modes: Choose between Naive (vector only), Local (entities), Global (community context), and Hybrid for maximum flexibility.
  • Incremental Indexing: Automatically detects and processes only the files modified since the last indexing session to save time and API costs.
  • Multi-Source Ingestion: Supports adding data via local file paths, direct text strings, or piped stdin input.
  • Customizable Storage: Use the LIGHTRAG_WORKING_DIR environment variable to point to specific storage locations for different agent instances.
  • Async Processing: Utilizes concurrent async requests and batching (8 items per batch) for high-speed embedding generation.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*