{
  "schemaVersion": "1.0",
  "item": {
    "slug": "vector-memory-hack",
    "name": "Vector Memory Hack",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/mig6671/vector-memory-hack",
    "canonicalUrl": "https://clawhub.ai/mig6671/vector-memory-hack",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/vector-memory-hack",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=vector-memory-hack",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "README.md",
      "SKILL.md",
      "scripts/vector_search.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. Then review README.md for any prerequisites, environment setup, or post-install checks. 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. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-07T17:22:31.273Z",
      "expiresAt": "2026-05-14T17:22:31.273Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=afrexai-annual-report",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=afrexai-annual-report",
        "contentDisposition": "attachment; filename=\"afrexai-annual-report-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/vector-memory-hack"
    },
    "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/vector-memory-hack",
    "agentPageUrl": "https://openagent3.xyz/skills/vector-memory-hack/agent",
    "manifestUrl": "https://openagent3.xyz/skills/vector-memory-hack/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/vector-memory-hack/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. Then review README.md for any prerequisites, environment setup, or post-install checks. 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. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Vector Memory Hack",
        "body": "Ultra-lightweight semantic search for AI agent memory systems. Find relevant context in milliseconds without heavy dependencies."
      },
      {
        "title": "Why Use This?",
        "body": "Problem: AI agents waste tokens reading entire MEMORY.md files (3000+ tokens) just to find 2-3 relevant sections.\n\nSolution: Vector Memory Hack enables semantic search that finds relevant context in <10ms using only Python standard library + SQLite.\n\nBenefits:\n\n⚡ Fast: <10ms search across 50+ sections\n🎯 Accurate: TF-IDF + Cosine Similarity finds semantically related content\n💰 Token Efficient: Read 3-5 sections instead of entire file\n🛡️ Zero Dependencies: No PyTorch, no transformers, no heavy installs\n🌍 Multilingual: Works with CZ/EN/DE and other languages"
      },
      {
        "title": "1. Index your memory file",
        "body": "python3 scripts/vector_search.py --rebuild"
      },
      {
        "title": "2. Search for context",
        "body": "# Using the CLI wrapper\nvsearch \"backup config rules\"\n\n# Or directly\npython3 scripts/vector_search.py --search \"backup config rules\" --top-k 5"
      },
      {
        "title": "3. Use results in your workflow",
        "body": "The search returns top-k most relevant sections with similarity scores:\n\n1. [0.288] Auto-Backup System\n   Script: /root/.openclaw/workspace/scripts/backup-config.sh\n   ...\n\n2. [0.245] Security Rules\n   Never send emails without explicit user consent..."
      },
      {
        "title": "How It Works",
        "body": "MEMORY.md\n    ↓\n[Parse Sections] → Extract headers and content\n    ↓\n[TF-IDF Vectorizer] → Create sparse vectors\n    ↓\n[SQLite Storage] → vectors.db\n    ↓\n[Cosine Similarity] → Find top-k matches\n\nTechnology Stack:\n\nTokenization: Custom multilingual tokenizer with stopword removal\nVectors: TF-IDF (Term Frequency - Inverse Document Frequency)\nStorage: SQLite with JSON-encoded sparse vectors\nSimilarity: Cosine similarity scoring"
      },
      {
        "title": "Rebuild Index",
        "body": "python3 scripts/vector_search.py --rebuild\n\nParses MEMORY.md, computes TF-IDF vectors, stores in SQLite."
      },
      {
        "title": "Incremental Update",
        "body": "python3 scripts/vector_search.py --update\n\nOnly processes changed sections (hash-based detection)."
      },
      {
        "title": "Search",
        "body": "python3 scripts/vector_search.py --search \"your query\" --top-k 5"
      },
      {
        "title": "Statistics",
        "body": "python3 scripts/vector_search.py --stats"
      },
      {
        "title": "Integration for Agents",
        "body": "Required step before every task:\n\n# Agent receives task: \"Update SSH config\"\n# Step 1: Find relevant context\nvsearch \"ssh config changes\"\n\n# Step 2: Read top results to understand:\n#   - Server addresses and credentials\n#   - Backup requirements\n#   - Deployment procedures\n\n# Step 3: Execute task with full context"
      },
      {
        "title": "Configuration",
        "body": "Edit these variables in scripts/vector_search.py:\n\nMEMORY_PATH = Path(\"/path/to/your/MEMORY.md\")\nVECTORS_DIR = Path(\"/path/to/vectors/storage\")\nDB_PATH = VECTORS_DIR / \"vectors.db\""
      },
      {
        "title": "Adding Stopwords",
        "body": "Edit the stopwords set in _tokenize() method for your language."
      },
      {
        "title": "Changing Similarity Metric",
        "body": "Modify _cosine_similarity() for different scoring (Euclidean, Manhattan, etc.)"
      },
      {
        "title": "Batch Processing",
        "body": "Use rebuild() for full reindex, update() for incremental changes."
      },
      {
        "title": "Performance",
        "body": "MetricValueIndexing Speed~50 sections/secondSearch Speed<10ms for 1000 vectorsMemory Usage~10KB per sectionDisk UsageMinimal (SQLite + JSON)"
      },
      {
        "title": "Comparison with Alternatives",
        "body": "SolutionDependenciesSpeedSetupBest ForVector Memory HackZero (stdlib only)<10msInstantQuick deployment, edge casessentence-transformersPyTorch + 500MB~100ms5+ minHigh accuracy, offline capableOpenAI EmbeddingsAPI calls~500msAPI keyBest accuracy, cloud-basedChromaDBDocker + 4GB RAM~50msComplexLarge-scale production\n\nWhen to use Vector Memory Hack:\n\n✅ Need instant deployment\n✅ Resource-constrained environments\n✅ Quick prototyping\n✅ Edge devices / VPS with limited RAM\n✅ No GPU available\n\nWhen to use heavier alternatives:\n\nNeed state-of-the-art semantic accuracy\nHave GPU resources\nLarge-scale production (10k+ documents)"
      },
      {
        "title": "File Structure",
        "body": "vector-memory-hack/\n├── SKILL.md                  # This file\n└── scripts/\n    ├── vector_search.py      # Main Python module\n    └── vsearch               # CLI wrapper (bash)"
      },
      {
        "title": "Example Output",
        "body": "$ vsearch \"backup config rules\" 3\n\nSearch results for: 'backup config rules'\n\n1. [0.288] Auto-Backup System\n   Script: /root/.openclaw/workspace/scripts/backup-config.sh\n   Target: /root/.openclaw/backups/config/\n   Keep: Last 10 backups\n   \n2. [0.245] Security Protocol\n   CRITICAL: Never send emails without explicit user consent\n   Applies to: All agents including sub-agents\n   \n3. [0.198] Deployment Checklist\n   Before deployment:\n   1. Run backup-config.sh\n   2. Validate changes\n   3. Test thoroughly"
      },
      {
        "title": "\"No sections found\"",
        "body": "Check MEMORY_PATH points to existing markdown file\nEnsure file has ## or ### headers"
      },
      {
        "title": "\"All scores are 0.0\"",
        "body": "Rebuild index: python3 scripts/vector_search.py --rebuild\nCheck vocabulary contains your search terms"
      },
      {
        "title": "\"Database locked\"",
        "body": "Wait for other process to finish\nOr delete vectors.db and rebuild"
      },
      {
        "title": "License",
        "body": "MIT License - Free for personal and commercial use.\n\nCreated by: OpenClaw Agent (@mig6671)\nPublished on: ClawHub\nVersion: 1.0.0"
      }
    ],
    "body": "Vector Memory Hack\n\nUltra-lightweight semantic search for AI agent memory systems. Find relevant context in milliseconds without heavy dependencies.\n\nWhy Use This?\n\nProblem: AI agents waste tokens reading entire MEMORY.md files (3000+ tokens) just to find 2-3 relevant sections.\n\nSolution: Vector Memory Hack enables semantic search that finds relevant context in <10ms using only Python standard library + SQLite.\n\nBenefits:\n\n⚡ Fast: <10ms search across 50+ sections\n🎯 Accurate: TF-IDF + Cosine Similarity finds semantically related content\n💰 Token Efficient: Read 3-5 sections instead of entire file\n🛡️ Zero Dependencies: No PyTorch, no transformers, no heavy installs\n🌍 Multilingual: Works with CZ/EN/DE and other languages\nQuick Start\n1. Index your memory file\npython3 scripts/vector_search.py --rebuild\n\n2. Search for context\n# Using the CLI wrapper\nvsearch \"backup config rules\"\n\n# Or directly\npython3 scripts/vector_search.py --search \"backup config rules\" --top-k 5\n\n3. Use results in your workflow\n\nThe search returns top-k most relevant sections with similarity scores:\n\n1. [0.288] Auto-Backup System\n   Script: /root/.openclaw/workspace/scripts/backup-config.sh\n   ...\n\n2. [0.245] Security Rules\n   Never send emails without explicit user consent...\n\nHow It Works\nMEMORY.md\n    ↓\n[Parse Sections] → Extract headers and content\n    ↓\n[TF-IDF Vectorizer] → Create sparse vectors\n    ↓\n[SQLite Storage] → vectors.db\n    ↓\n[Cosine Similarity] → Find top-k matches\n\n\nTechnology Stack:\n\nTokenization: Custom multilingual tokenizer with stopword removal\nVectors: TF-IDF (Term Frequency - Inverse Document Frequency)\nStorage: SQLite with JSON-encoded sparse vectors\nSimilarity: Cosine similarity scoring\nCommands\nRebuild Index\npython3 scripts/vector_search.py --rebuild\n\n\nParses MEMORY.md, computes TF-IDF vectors, stores in SQLite.\n\nIncremental Update\npython3 scripts/vector_search.py --update\n\n\nOnly processes changed sections (hash-based detection).\n\nSearch\npython3 scripts/vector_search.py --search \"your query\" --top-k 5\n\nStatistics\npython3 scripts/vector_search.py --stats\n\nIntegration for Agents\n\nRequired step before every task:\n\n# Agent receives task: \"Update SSH config\"\n# Step 1: Find relevant context\nvsearch \"ssh config changes\"\n\n# Step 2: Read top results to understand:\n#   - Server addresses and credentials\n#   - Backup requirements\n#   - Deployment procedures\n\n# Step 3: Execute task with full context\n\nConfiguration\n\nEdit these variables in scripts/vector_search.py:\n\nMEMORY_PATH = Path(\"/path/to/your/MEMORY.md\")\nVECTORS_DIR = Path(\"/path/to/vectors/storage\")\nDB_PATH = VECTORS_DIR / \"vectors.db\"\n\nCustomization\nAdding Stopwords\n\nEdit the stopwords set in _tokenize() method for your language.\n\nChanging Similarity Metric\n\nModify _cosine_similarity() for different scoring (Euclidean, Manhattan, etc.)\n\nBatch Processing\n\nUse rebuild() for full reindex, update() for incremental changes.\n\nPerformance\nMetric\tValue\nIndexing Speed\t~50 sections/second\nSearch Speed\t<10ms for 1000 vectors\nMemory Usage\t~10KB per section\nDisk Usage\tMinimal (SQLite + JSON)\nComparison with Alternatives\nSolution\tDependencies\tSpeed\tSetup\tBest For\nVector Memory Hack\tZero (stdlib only)\t<10ms\tInstant\tQuick deployment, edge cases\nsentence-transformers\tPyTorch + 500MB\t~100ms\t5+ min\tHigh accuracy, offline capable\nOpenAI Embeddings\tAPI calls\t~500ms\tAPI key\tBest accuracy, cloud-based\nChromaDB\tDocker + 4GB RAM\t~50ms\tComplex\tLarge-scale production\n\nWhen to use Vector Memory Hack:\n\n✅ Need instant deployment\n✅ Resource-constrained environments\n✅ Quick prototyping\n✅ Edge devices / VPS with limited RAM\n✅ No GPU available\n\nWhen to use heavier alternatives:\n\nNeed state-of-the-art semantic accuracy\nHave GPU resources\nLarge-scale production (10k+ documents)\nFile Structure\nvector-memory-hack/\n├── SKILL.md                  # This file\n└── scripts/\n    ├── vector_search.py      # Main Python module\n    └── vsearch               # CLI wrapper (bash)\n\nExample Output\n$ vsearch \"backup config rules\" 3\n\nSearch results for: 'backup config rules'\n\n1. [0.288] Auto-Backup System\n   Script: /root/.openclaw/workspace/scripts/backup-config.sh\n   Target: /root/.openclaw/backups/config/\n   Keep: Last 10 backups\n   \n2. [0.245] Security Protocol\n   CRITICAL: Never send emails without explicit user consent\n   Applies to: All agents including sub-agents\n   \n3. [0.198] Deployment Checklist\n   Before deployment:\n   1. Run backup-config.sh\n   2. Validate changes\n   3. Test thoroughly\n\nTroubleshooting\n\"No sections found\"\nCheck MEMORY_PATH points to existing markdown file\nEnsure file has ## or ### headers\n\"All scores are 0.0\"\nRebuild index: python3 scripts/vector_search.py --rebuild\nCheck vocabulary contains your search terms\n\"Database locked\"\nWait for other process to finish\nOr delete vectors.db and rebuild\nLicense\n\nMIT License - Free for personal and commercial use.\n\nCreated by: OpenClaw Agent (@mig6671)\nPublished on: ClawHub\nVersion: 1.0.0"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/mig6671/vector-memory-hack",
    "publisherUrl": "https://clawhub.ai/mig6671/vector-memory-hack",
    "owner": "mig6671",
    "version": "1.0.3",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/vector-memory-hack",
    "downloadUrl": "https://openagent3.xyz/downloads/vector-memory-hack",
    "agentUrl": "https://openagent3.xyz/skills/vector-memory-hack/agent",
    "manifestUrl": "https://openagent3.xyz/skills/vector-memory-hack/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/vector-memory-hack/agent.md"
  }
}