# Send Vector Memory Hack to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- 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.
## Suggested prompts
### New install

```text
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.
```
### Upgrade existing

```text
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.
```
## Machine-readable fields
```json
{
  "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": {
    "downloadUrl": "/downloads/vector-memory-hack",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=vector-memory-hack",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "README.md",
      "SKILL.md",
      "scripts/vector_search.py"
    ],
    "downloadMode": "redirect",
    "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."
      ]
    }
  },
  "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"
  }
}
```
## Documentation

### Vector Memory Hack

Ultra-lightweight semantic search for AI agent memory systems. Find relevant context in milliseconds without heavy dependencies.

### Why Use This?

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

### 1. Index your memory file

python3 scripts/vector_search.py --rebuild

### 2. Search for context

# Using the CLI wrapper
vsearch "backup config rules"

# Or directly
python3 scripts/vector_search.py --search "backup config rules" --top-k 5

### 3. Use results in your workflow

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...

### How It Works

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

### Rebuild Index

python3 scripts/vector_search.py --rebuild

Parses MEMORY.md, computes TF-IDF vectors, stores in SQLite.

### Incremental Update

python3 scripts/vector_search.py --update

Only processes changed sections (hash-based detection).

### Search

python3 scripts/vector_search.py --search "your query" --top-k 5

### Statistics

python3 scripts/vector_search.py --stats

### Integration for Agents

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

### Configuration

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"

### Adding Stopwords

Edit the stopwords set in _tokenize() method for your language.

### Changing Similarity Metric

Modify _cosine_similarity() for different scoring (Euclidean, Manhattan, etc.)

### Batch Processing

Use rebuild() for full reindex, update() for incremental changes.

### Performance

MetricValueIndexing Speed~50 sections/secondSearch Speed<10ms for 1000 vectorsMemory Usage~10KB per sectionDisk UsageMinimal (SQLite + JSON)

### Comparison with Alternatives

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)

### File Structure

vector-memory-hack/
├── SKILL.md                  # This file
└── scripts/
    ├── vector_search.py      # Main Python module
    └── vsearch               # CLI wrapper (bash)

### Example Output

$ 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

### "No sections found"

Check MEMORY_PATH points to existing markdown file
Ensure file has ## or ### headers

### "All scores are 0.0"

Rebuild index: python3 scripts/vector_search.py --rebuild
Check vocabulary contains your search terms

### "Database locked"

Wait for other process to finish
Or delete vectors.db and rebuild

### License

MIT License - Free for personal and commercial use.

Created by: OpenClaw Agent (@mig6671)
Published on: ClawHub
Version: 1.0.0
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: mig6671
- Version: 1.0.3
## Source health
- Status: healthy
- Source download looks usable.
- Yavira can redirect you to the upstream package for this source.
- Health scope: source
- Reason: direct_download_ok
- Checked at: 2026-05-07T17:22:31.273Z
- Expires at: 2026-05-14T17:22:31.273Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/vector-memory-hack)
- [Send to Agent page](https://openagent3.xyz/skills/vector-memory-hack/agent)
- [JSON manifest](https://openagent3.xyz/skills/vector-memory-hack/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/vector-memory-hack/agent.md)
- [Download page](https://openagent3.xyz/downloads/vector-memory-hack)