vector-memory-hackFast 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.
Install via ClawdBot CLI:
clawdbot install mig6671/vector-memory-hackUltra-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:
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:
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.
| Metric | Value |
|--------|-------|
| Indexing Speed | ~50 sections/second |
| Search Speed | <10ms for 1000 vectors |
| Memory Usage | ~10KB per section |
| Disk Usage | Minimal (SQLite + JSON) |
| Solution | Dependencies | Speed | Setup | Best For |
|----------|--------------|-------|-------|----------|
| Vector Memory Hack | Zero (stdlib only) | <10ms | Instant | Quick deployment, edge cases |
| sentence-transformers | PyTorch + 500MB | ~100ms | 5+ min | High accuracy, offline capable |
| OpenAI Embeddings | API calls | ~500ms | API key | Best accuracy, cloud-based |
| ChromaDB | Docker + 4GB RAM | ~50ms | Complex | Large-scale production |
When to use Vector Memory Hack:
When to use heavier alternatives:
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
python3 scripts/vector_search.py --rebuildMIT License - Free for personal and commercial use.
Created by: OpenClaw Agent (@mig6671)
Published on: ClawHub
Version: 1.0.0
Generated Mar 1, 2026
AI agents use this skill to quickly retrieve relevant context from memory files before executing tasks, such as finding backup rules or security protocols, reducing token usage and improving response accuracy. Ideal for autonomous systems handling routine IT operations or customer support.
Developers integrate this tool into their workflows to semantically search through large markdown documentation, like API guides or internal wikis, for specific rules or code snippets without manual scanning. Enhances productivity in software development and DevOps.
Deployed on resource-constrained edge devices or VPS, this skill enables efficient retrieval of configuration rules and procedures from local memory files, supporting maintenance tasks without cloud dependencies. Suitable for IoT or remote infrastructure management.
Organizations with multilingual documentation use this skill to perform semantic searches across content in languages like Czech, English, or German, aiding in compliance checks or knowledge management without heavy translation tools.
Startups and researchers leverage this lightweight skill for quick prototyping of AI agents that need memory retrieval, avoiding setup overhead from heavy embedding models. Accelerates development in hackathons or proof-of-concept projects.
Offer the core skill as free open-source software to build a user base, then monetize through premium features like advanced analytics, cloud sync, or enterprise support. Generates revenue from subscriptions and consulting services.
Package the skill as a cloud-based service with APIs for easy integration into existing AI platforms or documentation tools. Charge based on usage tiers, such as search volume or number of documents indexed.
Sell licensed versions to enterprises for internal deployment, with added features like enhanced security, custom tokenization, and dedicated support. Focus on industries needing offline, low-latency memory search solutions.
š¬ Integration Tip
Before each agent task, run a search to fetch relevant context from memory files, ensuring efficient token usage and accurate execution without reading entire documents.
Captures learnings, errors, and corrections to enable continuous improvement. Use when: (1) A command or operation fails unexpectedly, (2) User corrects Clau...
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
Search and analyze your own session logs (older/parent conversations) using jq.
Typed knowledge graph for structured agent memory and composable skills. Use when creating/querying entities (Person, Project, Task, Event, Document), linking related objects, enforcing constraints, planning multi-step actions as graph transformations, or when skills need to share state. Trigger on "remember", "what do I know about", "link X to Y", "show dependencies", entity CRUD, or cross-skill data access.
Ultimate AI agent memory system for Cursor, Claude, ChatGPT & Copilot. WAL protocol + vector search + git-notes + cloud backup. Never lose context again. Vibe-coding ready.
Headless browser automation CLI optimized for AI agents with accessibility tree snapshots and ref-based element selection