{
  "schemaVersion": "1.0",
  "item": {
    "slug": "lancedb-memory",
    "name": "Lancedb Memory",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/pntrivedy/lancedb-memory",
    "canonicalUrl": "https://clawhub.ai/pntrivedy/lancedb-memory",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/lancedb-memory",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=lancedb-memory",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "SKILL.md",
      "clawdbot_memory.py",
      "final_memory.py",
      "lancedb_memory.py",
      "simple_memory.py",
      "working_memory.py"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-30T16:55:25.780Z",
      "expiresAt": "2026-05-07T16:55:25.780Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
        "contentDisposition": "attachment; filename=\"network-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/lancedb-memory"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/lancedb-memory",
    "agentPageUrl": "https://openagent3.xyz/skills/lancedb-memory/agent",
    "manifestUrl": "https://openagent3.xyz/skills/lancedb-memory/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/lancedb-memory/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Global instance",
        "body": "lancedb_memory = LanceMemoryDB()\n\ndef add_memory(content: str, category: str = \"general\", tags: List[str] = None,\nimportance: int = 5, metadata: Dict[str, Any] = None) -> int:\n\"\"\"Add a memory to the LanceDB store.\"\"\"\nreturn lancedb_memory.add_memory(content, category, tags, importance, metadata)\n\ndef search_memories(query: str, category: str = None, limit: int = 10) -> List[Dict]:\n\"\"\"Search memories using semantic similarity.\"\"\"\nreturn lancedb_memory.search_memories(query, category, limit)\n\ndef get_memories_by_category(category: str, limit: int = 50) -> List[Dict]:\n\"\"\"Get memories by category.\"\"\"\nreturn lancedb_memory.get_memories_by_category(category, limit)\n\ndef get_memory_stats() -> Dict[str, Any]:\n\"\"\"Get memory storage statistics.\"\"\"\nreturn lancedb_memory.get_memory_stats()"
      },
      {
        "title": "Example usage",
        "body": "if name == \"main\":\n# Test the database\nprint(\"Testing LanceDB memory integration...\")\n\n# Add a test memory\ntest_id = add_memory(\n    content=\"This is a test memory for LanceDB integration\",\n    category=\"test\",\n    tags=[\"lancedb\", \"integration\", \"test\"],\n    importance=8\n)\nprint(f\"Added memory with ID: {test_id}\")\n\n# Search for memories\nresults = search_memories(\"test memory\")\nprint(f\"Search results: {len(results)} memories found\")\n\n# Get stats\nstats = get_memory_stats()\nprint(f\"Memory stats: {stats}\")"
      }
    ],
    "body": "#!/usr/bin/env python3 \"\"\" LanceDB integration for long-term memory management. Provides vector search and semantic memory capabilities. \"\"\"\n\nimport os import json import lancedb from datetime import datetime from typing import List, Dict, Any, Optional from pathlib import Path\n\nclass LanceMemoryDB: \"\"\"LanceDB wrapper for long-term memory storage and retrieval.\"\"\"\n\ndef __init__(self, db_path: str = \"/Users/prerak/clawd/memory/lancedb\"):\n    self.db_path = Path(db_path)\n    self.db_path.mkdir(parents=True, exist_ok=True)\n    self.db = lancedb.connect(self.db_path)\n    \n    # Ensure memory table exists\n    if \"memory\" not in self.db.table_names():\n        self._create_memory_table()\n\ndef _create_memory_table(self):\n    \"\"\"Create the memory table with appropriate schema.\"\"\"\n    schema = [\n        {\"name\": \"id\", \"type\": \"int\", \"nullable\": False},\n        {\"name\": \"timestamp\", \"type\": \"timestamp\", \"nullable\": False},\n        {\"name\": \"content\", \"type\": \"str\", \"nullable\": False},\n        {\"name\": \"category\", \"type\": \"str\", \"nullable\": True},\n        {\"name\": \"tags\", \"type\": \"str[]\", \"nullable\": True},\n        {\"name\": \"importance\", \"type\": \"int\", \"nullable\": True},\n        {\"name\": \"metadata\", \"type\": \"json\", \"nullable\": True},\n    ]\n    \n    self.db.create_table(\"memory\", schema=schema)\n\ndef add_memory(self, content: str, category: str = \"general\", tags: List[str] = None, \n               importance: int = 5, metadata: Dict[str, Any] = None) -> int:\n    \"\"\"Add a new memory entry.\"\"\"\n    table = self.db.open_table(\"memory\")\n    \n    # Get next ID\n    max_id = table.to_pandas()[\"id\"].max() if len(table) > 0 else 0\n    new_id = max_id + 1\n    \n    # Insert new memory\n    memory_data = {\n        \"id\": new_id,\n        \"timestamp\": datetime.now(),\n        \"content\": content,\n        \"category\": category,\n        \"tags\": tags or [],\n        \"importance\": importance,\n        \"metadata\": metadata or {}\n    }\n    \n    table.add([memory_data])\n    return new_id\n\ndef search_memories(self, query: str, category: str = None, limit: int = 10) -> List[Dict]:\n    \"\"\"Search memories using vector similarity.\"\"\"\n    table = self.db.open_table(\"memory\")\n    \n    # Build filter\n    where_clause = []\n    if category:\n        where_clause.append(f\"category = '{category}'\")\n    \n    filter_expr = \" AND \".join(where_clause) if where_clause else None\n    \n    # Vector search\n    results = table.vector_search(query).limit(limit).where(filter_expr).to_list()\n    \n    return results\n\ndef get_memories_by_category(self, category: str, limit: int = 50) -> List[Dict]:\n    \"\"\"Get memories by category.\"\"\"\n    table = self.db.open_table(\"memory\")\n    df = table.to_pandas()\n    filtered = df[df[\"category\"] == category].head(limit)\n    return filtered.to_dict(\"records\")\n\ndef get_memory_by_id(self, memory_id: int) -> Optional[Dict]:\n    \"\"\"Get a specific memory by ID.\"\"\"\n    table = self.db.open_table(\"memory\")\n    df = table.to_pandas()\n    result = df[df[\"id\"] == memory_id]\n    return result.to_dict(\"records\")[0] if len(result) > 0 else None\n\ndef update_memory(self, memory_id: int, **kwargs) -> bool:\n    \"\"\"Update a memory entry.\"\"\"\n    table = self.db.open_table(\"memory\")\n    \n    valid_fields = [\"content\", \"category\", \"tags\", \"importance\", \"metadata\"]\n    updates = {k: v for k, v in kwargs.items() if k in valid_fields}\n    \n    if not updates:\n        return False\n    \n    # Convert to proper types for LanceDB\n    if \"tags\" in updates and isinstance(updates[\"tags\"], list):\n        updates[\"tags\"] = str(updates[\"tags\"]).replace(\"'\", '\"')\n    \n    table.update(updates, where=f\"id = {memory_id}\")\n    return True\n\ndef delete_memory(self, memory_id: int) -> bool:\n    \"\"\"Delete a memory entry.\"\"\"\n    table = self.db.open_table(\"memory\")\n    current_count = len(table)\n    table.delete(f\"id = {memory_id}\")\n    return len(table) < current_count\n\ndef get_all_categories(self) -> List[str]:\n    \"\"\"Get all unique categories.\"\"\"\n    table = self.db.open_table(\"memory\")\n    df = table.to_pandas()\n    return df[\"category\"].dropna().unique().tolist()\n\ndef get_memory_stats(self) -> Dict[str, Any]:\n    \"\"\"Get statistics about memory storage.\"\"\"\n    table = self.db.open_table(\"memory\")\n    df = table.to_pandas()\n    \n    return {\n        \"total_memories\": len(df),\n        \"categories\": len(self.get_all_categories()),\n        \"by_category\": df[\"category\"].value_counts().to_dict(),\n        \"date_range\": {\n            \"earliest\": df[\"timestamp\"].min().isoformat() if len(df) > 0 else None,\n            \"latest\": df[\"timestamp\"].max().isoformat() if len(df) > 0 else None\n        }\n    }\n\nGlobal instance\n\nlancedb_memory = LanceMemoryDB()\n\ndef 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)\n\ndef 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)\n\ndef get_memories_by_category(category: str, limit: int = 50) -> List[Dict]: \"\"\"Get memories by category.\"\"\" return lancedb_memory.get_memories_by_category(category, limit)\n\ndef get_memory_stats() -> Dict[str, Any]: \"\"\"Get memory storage statistics.\"\"\" return lancedb_memory.get_memory_stats()\n\nExample usage\n\nif name == \"main\": # Test the database print(\"Testing LanceDB memory integration...\")\n\n# Add a test memory\ntest_id = add_memory(\n    content=\"This is a test memory for LanceDB integration\",\n    category=\"test\",\n    tags=[\"lancedb\", \"integration\", \"test\"],\n    importance=8\n)\nprint(f\"Added memory with ID: {test_id}\")\n\n# Search for memories\nresults = search_memories(\"test memory\")\nprint(f\"Search results: {len(results)} memories found\")\n\n# Get stats\nstats = get_memory_stats()\nprint(f\"Memory stats: {stats}\")"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/pntrivedy/lancedb-memory",
    "publisherUrl": "https://clawhub.ai/pntrivedy/lancedb-memory",
    "owner": "pntrivedy",
    "version": "1.0.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/lancedb-memory",
    "downloadUrl": "https://openagent3.xyz/downloads/lancedb-memory",
    "agentUrl": "https://openagent3.xyz/skills/lancedb-memory/agent",
    "manifestUrl": "https://openagent3.xyz/skills/lancedb-memory/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/lancedb-memory/agent.md"
  }
}