v0.8.6+: How search connects your memory islands.
The Problem
Your brain lives in models/private/ - thousands of files with learnings, decisions, context. When you search, it has to scan all of them. That’s slow.
Without optimization:
Query "python"
→ Scan 1000s files
→ Parse each for relevance
→ Re-hydrate full content
→ Return results
= SLOW (seconds)
Solution: 3-Layer Speed
| Layer | What | Speed |
|---|---|---|
| Cache | Store results per-session | Instant |
| Compact | Skip re-hydration, return summaries | ~100ms |
| Lazy Load | Defer heavy module loading | Fast boot |
Layer 1: Session Cache
Same search runs repeatedly? Cache it.
Cache stores results per session. Same query = instant return from cache.
// First call - slow
const r1 = await search.hybrid('python');
// Second call - instant (cached)
const r2 = await search.hybrid('python');
- Key: MD5 hash of query (handles special chars)
- Max: 50 entries per session
- Eviction: LRU (least recently used)
Layer 2: Compact Mode
Don’t need full file content? Just summaries.
Compact returns summaries only. Skip re-hydration for speed.
// Full search + rehydrate
const { results, context } = await search.query('python');
// context: Full file contents (~50KB max)
// Compact - summaries only
const { results, context } = await search.query('python', { compact: true });
// context: "- Learned X\n- Decided Y..."
When to use:
- Quick RAG checks
- Building context for another agent
- Debugging search results
Layer 3: Lazy Load
Heavy modules slow boot? Load on-demand.
Lazy load delays heavy module loading until first use. Fast boot.
// Before: loaded at startup
const search = require('vant').search; // ~2s load
// After: loaded on first use (~50ms boot)
The search-hybrid module loads only when you call search.hybrid() or search.query().
Islands Architecture
Concept: Your memories are islands of context. Search connects them.
Query → Find islands → Re-hydrate context
↓ ↓ ↓
Bridge Discovery Full content
Each brain file (models/private/*.md) is an island:
- Contains specific learnings
- Connected to other islands via topics
- Discoverable via search
Why it scales:
| Memories | Traditional | Islands |
|---|---|---|
| 100 | ~1s | ~100ms |
| 1000 | ~10s | ~200ms |
| 10000 | timeout | ~500ms |
The LTC (Long Term Core) index is the “map”. Git history is the “archive”. Search uses the map to find islands, then re-hydrates from the archive.
API
Search module exposes all methods.
const search = require('vant').search;
// Cache management
search.getCacheStats(); // { size: N, max: 50 }
search.clearCache(); // Clear session cache
// Search modes
search.searchLTC('python'); // Text search (fast)
search.query('python'); // RAG: search + rehydrate
search.hybrid('python'); // BM25 + Vector + RRF
search.query('python', { compact: true }); // Summaries only
# CLI
vant search python -l 3
vant search python --mode rag --compact
MCP tool available as vant_search - call it with
{ "query": "python", "compact": true }.
Security
Unchanged limits:
- Query: 500 chars max
- Re-hydrate: 50KB max
- Compression threshold: 5KB
- Only reads from
models/vX/directory
Related
- Hybrid Search - BM25 + Vector + RRF
- Brain - Memory islands
- CLI - Search command
- MCP - Search tool