Requirements
- Target platform
- OpenClaw
- Install method
- Manual import
- Extraction
- Extract archive
- Prerequisites
- OpenClaw
- Primary doc
- SKILL.md
Fast semantic search for AI agent memory files using TF-IDF and SQLite. Enables instant context retrieval from MEMORY.md or any markdown documentation. Use when the agent needs to (1) Find relevant context before starting a task, (2) Search through large memory files efficiently, (3) Retrieve specific rules or decisions without reading entire files, (4) Enable semantic similarity search instead of keyword matching. Lightweight alternative to heavy embedding models - zero external dependencies, <10ms search time.
Fast semantic search for AI agent memory files using TF-IDF and SQLite. Enables instant context retrieval from MEMORY.md or any markdown documentation. Use when the agent needs to (1) Find relevant context before starting a task, (2) Search through large memory files efficiently, (3) Retrieve specific rules or decisions without reading entire files, (4) Enable semantic similarity search instead of keyword matching. Lightweight alternative to heavy embedding models - zero external dependencies, <10ms search time.
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
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.
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.
Ultra-lightweight semantic search for AI agent memory systems. Find relevant context in milliseconds without heavy dependencies.
Problem: AI agents waste tokens reading entire MEMORY.md files (3000+ tokens) just to find 2-3 relevant sections. Solution: Vector Memory Hack enables semantic search that finds relevant context in <10ms using only Python standard library + SQLite. Benefits: โก Fast: <10ms search across 50+ sections ๐ฏ Accurate: TF-IDF + Cosine Similarity finds semantically related content ๐ฐ Token Efficient: Read 3-5 sections instead of entire file ๐ก๏ธ Zero Dependencies: No PyTorch, no transformers, no heavy installs ๐ Multilingual: Works with CZ/EN/DE and other languages
python3 scripts/vector_search.py --rebuild
# Using the CLI wrapper vsearch "backup config rules" # Or directly python3 scripts/vector_search.py --search "backup config rules" --top-k 5
The search returns top-k most relevant sections with similarity scores: 1. [0.288] Auto-Backup System Script: /root/.openclaw/workspace/scripts/backup-config.sh ... 2. [0.245] Security Rules Never send emails without explicit user consent...
MEMORY.md โ [Parse Sections] โ Extract headers and content โ [TF-IDF Vectorizer] โ Create sparse vectors โ [SQLite Storage] โ vectors.db โ [Cosine Similarity] โ Find top-k matches Technology Stack: Tokenization: Custom multilingual tokenizer with stopword removal Vectors: TF-IDF (Term Frequency - Inverse Document Frequency) Storage: SQLite with JSON-encoded sparse vectors Similarity: Cosine similarity scoring
python3 scripts/vector_search.py --rebuild Parses MEMORY.md, computes TF-IDF vectors, stores in SQLite.
python3 scripts/vector_search.py --update Only processes changed sections (hash-based detection).
python3 scripts/vector_search.py --search "your query" --top-k 5
python3 scripts/vector_search.py --stats
Required step before every task: # Agent receives task: "Update SSH config" # Step 1: Find relevant context vsearch "ssh config changes" # Step 2: Read top results to understand: # - Server addresses and credentials # - Backup requirements # - Deployment procedures # Step 3: Execute task with full context
Edit these variables in scripts/vector_search.py: MEMORY_PATH = Path("/path/to/your/MEMORY.md") VECTORS_DIR = Path("/path/to/vectors/storage") DB_PATH = VECTORS_DIR / "vectors.db"
Edit the stopwords set in _tokenize() method for your language.
Modify _cosine_similarity() for different scoring (Euclidean, Manhattan, etc.)
Use rebuild() for full reindex, update() for incremental changes.
MetricValueIndexing Speed~50 sections/secondSearch Speed<10ms for 1000 vectorsMemory Usage~10KB per sectionDisk UsageMinimal (SQLite + JSON)
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 When to use Vector Memory Hack: โ Need instant deployment โ Resource-constrained environments โ Quick prototyping โ Edge devices / VPS with limited RAM โ No GPU available When to use heavier alternatives: Need state-of-the-art semantic accuracy Have GPU resources Large-scale production (10k+ documents)
vector-memory-hack/ โโโ SKILL.md # This file โโโ scripts/ โโโ vector_search.py # Main Python module โโโ vsearch # CLI wrapper (bash)
$ vsearch "backup config rules" 3 Search results for: 'backup config rules' 1. [0.288] Auto-Backup System Script: /root/.openclaw/workspace/scripts/backup-config.sh Target: /root/.openclaw/backups/config/ Keep: Last 10 backups 2. [0.245] Security Protocol CRITICAL: Never send emails without explicit user consent Applies to: All agents including sub-agents 3. [0.198] Deployment Checklist Before deployment: 1. Run backup-config.sh 2. Validate changes 3. Test thoroughly
Check MEMORY_PATH points to existing markdown file Ensure file has ## or ### headers
Rebuild index: python3 scripts/vector_search.py --rebuild Check vocabulary contains your search terms
Wait for other process to finish Or delete vectors.db and rebuild
MIT License - Free for personal and commercial use. Created by: OpenClaw Agent (@mig6671) Published on: ClawHub Version: 1.0.0
Code helpers, APIs, CLIs, browser automation, testing, and developer operations.
Largest current source with strong distribution and engagement signals.