Token导航 LogoToken导航TokenDH.com
研究检索权限需确认clawhub未标认证来源可访问clear审计提醒

lancedb-memorylancedb 内存

Agent Skill

lancedb-memory 用于查找、检索和筛选相关信息,适合在 OpenClaw 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

174,714

周安装

7,137

GitHub Stars

7

下载量

55,954
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:lancedb-memory(lancedb 内存)
来源仓库:https://github.com/pntrivedy/lancedb-memory
安装命令:
openclaw skills install lancedb-memory
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install lancedb-memory

简介

使用语义向量搜索、类别过滤和详细元数据存储,通过 LanceDB 管理和检索长期记忆。

SKILL.md

#!/usr/bin/env python3 """ LanceDB integration for long-term memory management. Provides vector search and semantic memory capabilities. """

import os import json import lancedb from datetime import datetime from typing import List, Dict, Any, Optional from pathlib import Path

class LanceMemoryDB: """LanceDB wrapper for long-term memory storage and retrieval."""

def __init__(self, db_path: str = "/Users/prerak/clawd/memory/lancedb"): self.db_path = Path(db_path) self.db_path.mkdir(parents=True, exist_ok=True) self.db = lancedb.connect(self.db_path)

# Ensure memory table exists if "memory" not in self.db.table_names(): self._create_memory_table()

def _create_memory_table(self): """Create the memory table with appropriate schema.""" schema = [ {"name": "id", "type": "int", "nullable": False}, {"name": "timestamp", "type": "timestamp", "nullable": False}, {"name": "content", "type": "str", "nullable": False}, {"name": "category", "type": "str", "nullable": True}, {"name": "tags", "type": "str[]", "nullable": True}, {"name": "importance", "type": "int", "nullable": True}, {"name": "metadata", "type": "json", "nullable": True}, ]

self.db.create_table("memory", schema=schema)

def add_memory(self, content: str, category: str = "general", tags: List[str] = None, importance: int = 5, metadata: Dict[str, Any] = None) -> int: """Add a new memory entry.""" table = self.db.open_table("memory")

# Get next ID max_id = table.to_pandas()["id"].max() if len(table) > 0 else 0 new_id = max_id + 1

# Insert new memory memory_data = { "id": new_id, "timestamp": datetime.now(), "content": content, "category": category, "tags": tags or [], "importance": importance, "metadata": metadata or {} }

table.add([memory_data]) return new_id

def search_memories(self, query: str, category: str = None, limit: int = 10) -> List[Dict]: """Search memories using vector similarity.""" table = self.db.open_table("memory")

# Build filter where_clause = [] if category: where_clause.append(f"category = '{category}'")

filter_expr = " AND ".join(where_clause) if where_clause else None

# Vector search results = table.vector_search(query).limit(limit).where(filter_expr).to_list()

return results

def get_memories_by_category(self, category: str, limit: int = 50) -> List[Dict]: """Get memories by category.""" table = self.db.open_table("memory") df = table.to_pandas() filtered = df[df["category"] == category].head(limit) return filtered.to_dict("records")

def get_memory_by_id(self, memory_id: int) -> Optional[Dict]: """Get a specific memory by ID.""" table = self.db.open_table("memory") df = table.to_pandas() result = df[df["id"] == memory_id] return result.to_dict("records")[0] if len(result) > 0 else None

def update_memory(self, memory_id: int, **kwargs) -> bool: """Update a memory entry.""" table = self.db.open_table("memory")

valid_fields = ["content", "category", "tags", "importance", "metadata"] updates = {k: v for k, v in kwargs.items() if k in valid_fields}

if not updates: return False

# Convert to proper types for LanceDB if "tags" in updates and isinstance(updates["tags"], list): updates["tags"] = str(updates["tags"]).replace("'", '"')

table.update(updates, where=f"id = {memory_id}") return True

def delete_memory(self, memory_id: int) -> bool: """Delete a memory entry.""" table = self.db.open_table("memory") current_count = len(table) table.delete(f"id = {memory_id}") return len(table) < current_count

def get_all_categories(self) -> List[str]: """Get all unique categories.""" table = self.db.open_table("memory") df = table.to_pandas() return df["category"].dropna().unique().tolist()

def get_memory_stats(self) -> Dict[str, Any]: """Get statistics about memory storage.""" table = self.db.open_table("memory") df = table.to_pandas()

return { "total_memories": len(df), "categories": len(self.get_all_categories()), "by_category": df["category"].value_counts().to_dict(), "date_range": { "earliest": df["timestamp"].min().isoformat() if len(df) > 0 else None, "latest": df["timestamp"].max().isoformat() if len(df) > 0 else None } }

Global instance

lancedb_memory = LanceMemoryDB()

def add_memory(content: str, category: str = "general", tags: List[str] = None, importance: int = 5, metadata: Dict[str, Any] = None) -> int: """Add a memory to the LanceDB store.""" return lancedb_memory.add_memory(content, category, tags, importance, metadata)

def search_memories(query: str, category: str = None, limit: int = 10) -> List[Dict]: """Search memories using semantic similarity.""" return lancedb_memory.search_memories(query, category, limit)

def get_memories_by_category(category: str, limit: int = 50) -> List[Dict]: """Get memories by category.""" return lancedb_memory.get_memories_by_category(category, limit)

def get_memory_stats() -> Dict[str, Any]: """Get memory storage statistics.""" return lancedb_memory.get_memory_stats()

Example usage

if __name__ == "__main__": # Test the database print("Testing LanceDB memory integration...")

# Add a test memory test_id = add_memory( content="This is a test memory for LanceDB integration", category="test", tags=["lancedb", "integration", "test"], importance=8 ) print(f"Added memory with ID: {test_id}")

# Search for memories results = search_memories("test memory") print(f"Search results: {len(results)} memories found")

# Get stats stats = get_memory_stats() print(f"Memory stats: {stats}")

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

95.48%
按下载量换算53,425

安全审计

VirusTotal

通过

ClawScan

可疑

Static analysis

未展示

权限和风险

权限需确认

当前来源未能明确判断权限范围,默认进入异常复核队列。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills