{"id":"c38b7857-4c6c-4013-8f42-5d011d191d1d","entityType":"agent","slug":"clawhub-bluepointdigital-smart-memory","name":"Smart Memory","canonicalUrl":"https://www.xpersona.co/agent/clawhub-bluepointdigital-smart-memory","canonicalPath":"/agent/clawhub-bluepointdigital-smart-memory","generatedAt":"2026-10-09T06:17:13.307Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"editorial-content","verified":true,"confidence":"high","updatedAt":"2026-04-15T00:45:39.800Z","emptyReason":null},"description":"Context-aware memory for AI agents with dual retrieval modes — fast vector search or curated Focus Agent synthesis. SQLite backend, zero configuration, local embeddings. Skill: Smart Memory Owner: BluePointDigital Summary: Context-aware memory for AI agents with dual retrieval modes — fast vector search or curated Focus Agent synthesis. SQLite backend, zero configuration, local embeddings. Tags: latest:2.1.2 Version history: v2.1.2 | 2026-02-06T17:35:01.716Z | user - Added six new JavaScript module files: chunker.js, embed.js, hot_memory.js, memory_bridge.js, search.js, and session_m","descriptionLabel":"Technical summary","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 1.3K downloads reported by the source. Last updated 4/15/2026.","installCommand":"clawhub skill install kn79jnjmwnh2n88m8qh12jdhcn80jh1m:smart-memory","sourceUrl":"https://clawhub.ai/BluePointDigital/smart-memory","homepage":"https://clawhub.ai/BluePointDigital/smart-memory","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/BluePointDigital/smart-memory","kind":"source"}],"safetyScore":84,"overallRank":62,"popularityScore":62,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"Context-aware memory for AI agents with dual retrieval modes — fast vector search or curated Focus Agent synthesis. SQLite backend, zero configuration, local em"},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-04-15T00:45:39.800Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[],"verifiedCount":0,"selfDeclaredCount":1,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile"}},"adoption":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-04-15T00:45:39.800Z","emptyReason":null},"stars":null,"forks":null,"downloads":1281,"packageName":null,"latestVersion":"2.1.2","tractionLabel":"1.3K downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-02-28T23:15:04.174Z","emptyReason":null},"lastUpdatedAt":"2026-04-15T00:45:39.800Z","lastCrawledAt":"2026-02-28T23:15:04.174Z","lastIndexedAt":null,"nextCrawlAt":"2026-03-01T23:15:04.174Z","lastVerifiedAt":null,"highlights":[{"version":"2.1.2","createdAt":"2026-02-06T17:35:01.716Z","changelog":"- Added six new JavaScript module files: chunker.js, embed.js, hot_memory.js, memory_bridge.js, search.js, and session_memory.js. - Enhanced project codebase by separating functionality into dedicated modules for chunking, embedding, searching, and memory management. - No user-facing changes documented; update increases maintainability and modularity.","fileCount":24,"zipByteSize":44980},{"version":"1.0.1","createdAt":"2026-02-06T17:19:03.710Z","changelog":"- Added curated retrieval via Focus Agent, enabling multi-pass context synthesis for complex queries - Introduced dual search modes: fast (direct) and focus (curated), with live toggling support - Improved hybrid search combining FTS5 keyword (BM25) and semantic vector similarity - Provided CLI and JS API for mode switching and retrieval with detailed examples - Enhanced performance and scalability with optional sqlite-vec native vector search - Expanded documentation with installation, usage, environment variables, and feature comparison","fileCount":18,"zipByteSize":32355}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install kn79jnjmwnh2n88m8qh12jdhcn80jh1m:smart-memory","setupComplexity":"medium","setupSteps":["Setup complexity is MEDIUM. Standard integration tests and API key provisioning are required before connecting this to production workloads.","Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-bluepointdigital-smart-memory/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-bluepointdigital-smart-memory/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-bluepointdigital-smart-memory/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-bluepointdigital-smart-memory/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-bluepointdigital-smart-memory/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-bluepointdigital-smart-memory/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-09T06:17:13.306Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-bluepointdigital-smart-memory/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-bluepointdigital-smart-memory/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-bluepointdigital-smart-memory/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-bluepointdigital-smart-memory/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"high","updatedAt":"2026-04-15T00:45:39.800Z","emptyReason":null},"readme":"Skill: Smart Memory\n\nOwner: BluePointDigital\n\nSummary: Context-aware memory for AI agents with dual retrieval modes — fast vector search or curated Focus Agent synthesis. SQLite backend, zero configuration, local embeddings.\n\nTags: latest:2.1.2\n\nVersion history:\n\nv2.1.2 | 2026-02-06T17:35:01.716Z | user\n\n- Added six new JavaScript module files: chunker.js, embed.js, hot_memory.js, memory_bridge.js, search.js, and session_memory.js.\n- Enhanced project codebase by separating functionality into dedicated modules for chunking, embedding, searching, and memory management.\n- No user-facing changes documented; update increases maintainability and modularity.\n\nv1.0.1 | 2026-02-06T17:19:03.710Z | user\n\n- Added curated retrieval via Focus Agent, enabling multi-pass context synthesis for complex queries\n- Introduced dual search modes: fast (direct) and focus (curated), with live toggling support\n- Improved hybrid search combining FTS5 keyword (BM25) and semantic vector similarity\n- Provided CLI and JS API for mode switching and retrieval with detailed examples\n- Enhanced performance and scalability with optional sqlite-vec native vector search\n- Expanded documentation with installation, usage, environment variables, and feature comparison\n\nArchive index:\n\nArchive v2.1.2: 24 files, 44980 bytes\n\nFiles: AGENTS.md (2400b), CHANGELOG.md (1690b), install.sh (2307b), MEMORY_STRUCTURE.md (2371b), README.md (7452b), SKILL.md (8098b), skills/vector-memory/README.md (5473b), skills/vector-memory/skill.json (1955b), smart-memory/chunker.js (3979b), smart-memory/db.js (10621b), smart-memory/embed.js (3573b), smart-memory/focus_agent.js (10033b), smart-memory/hot_memory.js (7345b), smart-memory/memory_bridge.js (2697b), smart-memory/memory_mode.js (4143b), smart-memory/memory.js (8237b), smart-memory/package.json (483b), smart-memory/references/integration.md (3028b), smart-memory/references/pgvector.md (1082b), smart-memory/search.js (5617b), smart-memory/session_memory.js (10349b), smart-memory/smart_memory.js (11109b), smart-memory/vector_memory_local.js (10016b), _meta.json (131b)\n\nFile v2.1.2:SKILL.md\n\n---\nname: smart-memory\ndescription: Context-aware memory for AI agents with dual retrieval modes — fast vector search or curated Focus Agent synthesis. SQLite backend, zero configuration, local embeddings.\n---\n\n# Smart Memory v2.1 - Focus Agent Edition\n\n**Drop-in replacement for OpenClaw's memory system** with superior search quality and optional curated retrieval via Focus Agent.\n\n## Features\n\n- **Hybrid Search**: Combines FTS5 keyword search (BM25) with semantic vector search\n- **Focus Agent**: Multi-pass curation for complex queries (retrieve → rank → synthesize)\n- **Dual Modes**: Fast (direct) or Focus (curated) — toggle anytime\n- **SQLite Backend**: Single-file database, no external services\n- **100% Local**: Embeddings run locally with Transformers.js (no API keys)\n- **Auto-Optimization**: Uses sqlite-vec when available for native vector ops\n- **Zero Configuration**: Works immediately after install\n\n## Installation\n\n```bash\nnpx clawhub install smart-memory\n```\n\nOr from ClawHub: https://clawhub.ai/BluePointDigital/smart-memory\n\n## Quick Start\n\n### 1. Sync Memory\n```bash\nnode smart-memory/smart_memory.js --sync\n```\n\n### 2. Search (Fast Mode - Default)\n```bash\nnode smart-memory/smart_memory.js --search \"James values principles\"\n```\n\n### 3. Enable Focus Mode (Curated Retrieval)\n```bash\nnode smart-memory/smart_memory.js --focus\nnode smart-memory/smart_memory.js --search \"complex decision about project direction\"\n```\n\n### 4. Disable Focus Mode\n```bash\nnode smart-memory/smart_memory.js --unfocus\n```\n\n## Search Modes\n\n### Fast Mode (Default)\nDirect vector similarity search. Best for:\n- Simple lookups\n- Quick fact retrieval\n- Routine queries\n\n```bash\nnode smart-memory/smart_memory.js --search \"git remote\"\n```\n\n### Focus Mode (Curated)\nMulti-pass curation via Focus Agent. Best for:\n- Complex decisions\n- Multi-fact synthesis\n- Planning and strategy\n- Comparing options\n\n```bash\nnode smart-memory/smart_memory.js --focus\nnode smart-memory/smart_memory.js --search \"What did we decide about BluePointDigital architecture?\"\n```\n\n**How Focus Mode Works:**\n1. **Retrieve** 20+ chunks (broad net)\n2. **Rank** by weighted relevance (vector + term matching + source boost)\n3. **Synthesize** into coherent narrative\n4. **Deliver** structured context with confidence scores\n\n## How It Works\n\n### Hybrid Search Algorithm\n\n1. **FTS5** finds exact keyword matches (BM25 ranking)\n2. **Vector search** finds semantic matches (cosine similarity)\n3. **Merged results** using weighted scoring:\n   - 70% vector score + 30% keyword score\n   - Catches both \"what you mean\" and \"exact tokens\"\n\n### Focus Agent Curation\n\nWhen enabled, searches go through additional processing:\n\n```\nQuery: \"What did we decide about BluePointDigital?\"\n\n┌─────────────────┐\n│  Retrieve 20+   │  ← Vector similarity\n│    chunks       │\n└────────┬────────┘\n         ▼\n┌─────────────────┐\n│   Weighted      │  ← Term matching\n│    Ranking      │    Source boosting\n│                 │    Recency boost\n└────────┬────────┘\n         ▼\n┌─────────────────┐\n│   Select Top 5  │  ← Threshold filtering\n└────────┬────────┘\n         ▼\n┌─────────────────┐\n│   Synthesize    │  ← Group by source\n│   Narrative     │    Extract key facts\n└────────┬────────┘\n         ▼\n    Structured output with confidence\n```\n\n## Tools\n\n### memory_search\n```javascript\nmemory_search({\n    query: \"deployment configuration\",\n    maxResults: 5\n})\n```\n\nReturns (Fast Mode):\n```json\n{\n    \"query\": \"deployment configuration\",\n    \"mode\": \"fast\",\n    \"results\": [\n        {\n            \"path\": \"MEMORY.md\",\n            \"from\": 42,\n            \"lines\": 8,\n            \"score\": 0.89,\n            \"snippet\": \"...\"\n        }\n    ]\n}\n```\n\nReturns (Focus Mode):\n```json\n{\n    \"query\": \"deployment configuration\",\n    \"mode\": \"focus\",\n    \"confidence\": 0.87,\n    \"sources\": [\"MEMORY.md\", \"memory/2026-02-05.md\"],\n    \"synthesis\": \"Relevant context for: \\\"deployment configuration\\\"\\n\\nFrom MEMORY.md:\\n  • Docker setup uses docker-compose...\\n  • Production deployment on AWS...\\n\\nFrom memory/2026-02-05.md:\\n  • Decided to use Railway instead...\",\n    \"facts\": [\n        {\n            \"content\": \"Docker setup uses docker-compose...\",\n            \"source\": \"MEMORY.md\",\n            \"lines\": \"42-50\",\n            \"confidence\": 0.89\n        }\n    ]\n}\n```\n\n### memory_get\n```javascript\nmemory_get({\n    path: \"MEMORY.md\",\n    from: 42,\n    lines: 10\n})\n```\n\n### memory_mode (Focus Toggle)\n```javascript\nmemory_mode('focus')    // Enable curated retrieval\nmemory_mode('fast')     // Disable curated retrieval\nmemory_mode()           // Get current mode status\n```\n\n## CLI Commands\n\n```bash\n# Sync memory files\nnode smart_memory.js --sync\n\n# Search (uses current mode)\nnode smart_memory.js --search \"query\" [--max-results N]\n\n# Search with mode override\nnode smart_memory.js --search \"query\" --focus\nnode smart_memory.js --search \"query\" --fast\n\n# Toggle modes\nnode smart_memory.js --focus      # Enable focus mode\nnode smart_memory.js --unfocus    # Disable focus mode\nnode smart_memory.js --fast       # Same as --unfocus\n\n# Check status\nnode smart_memory.js --status     # Database stats + current mode\nnode smart_memory.js --mode       # Current mode details\n\n# Focus agent only\nnode focus_agent.js --search \"query\"\nnode focus_agent.js --suggest \"query\"  # Check if focus recommended\n\n# Mode management\nnode memory_mode.js focus\nnode memory_mode.js unfocus\nnode memory_mode.js status\n```\n\n## Performance\n\n| Feature | Fallback | With sqlite-vec |\n|---------|----------|-----------------|\n| Keyword search | FTS5 (native) | FTS5 (native) |\n| Vector search | JS cosine | Native KNN |\n| Focus curation | +50-100ms | +50-100ms |\n| Speed | ~100 chunks/sec | ~10,000 chunks/sec |\n| Memory | All in RAM | DB handles it |\n\n## When to Use Focus Mode\n\nUse `--focus` or enable focus mode when:\n- Query involves multiple related concepts\n- You need synthesized context, not raw chunks\n- Making decisions that require understanding relationships\n- Summarizing project history\n- Comparing options mentioned in different files\n\nDon't use focus mode when:\n- Quick fact lookup (phone number, command syntax)\n- You need exact text matches\n- Latency matters more than context quality\n\n## Installation: sqlite-vec (Optional)\n\nFor best performance, install sqlite-vec:\n\n```bash\n# macOS\nbrew install sqlite-vec\n\n# Ubuntu/Debian\n# Download from https://github.com/asg017/sqlite-vec/releases\n# Place vec0.so in ~/.local/lib/ or /usr/local/lib/\n```\n\nWithout it: Works fine, just slower on large databases.\n\n## File Structure\n\n```\nsmart-memory/\n├── smart_memory.js      # Main CLI\n├── focus_agent.js       # Curated retrieval engine\n├── memory_mode.js       # Mode toggle commands\n├── memory.js            # OpenClaw wrapper\n├── db.js                # SQLite layer\n├── search.js            # Hybrid search\n├── chunker.js           # Token-based chunking\n├── embed.js             # Transformers.js embeddings\n└── vector-memory.db     # SQLite database (auto-created)\n```\n\n## Environment Variables\n\n```bash\nMEMORY_DIR=/path/to/memory        # Default: ./memory\nMEMORY_FILE=/path/to/MEMORY.md    # Default: ./MEMORY.md\nMEMORY_DB_PATH=/path/to/db.sqlite # Default: ./vector-memory.db\n```\n\n## Comparison: v1 vs v2 vs v2.1\n\n| | v1 (JSON) | v2 (SQLite) | v2.1 (Focus Agent) |\n|--|-----------|-------------|-------------------|\n| Search | Vector only | Hybrid (BM25 + Vector) | Hybrid + Focus Curation |\n| Storage | JSON file | SQLite | SQLite |\n| Scale | ~1000 chunks | Unlimited | Unlimited |\n| Keyword match | Weak | Strong (FTS5) | Strong (FTS5) |\n| Context curation | No | No | Yes (toggle) |\n| Setup | Zero config | Zero config | Zero config |\n\n## License\n\nMIT\n\nFile v2.1.2:README.md\n\n# Smart Memory for OpenClaw\n\n**Context-aware memory system with dual retrieval modes** — fast vector search when you need speed, curated Focus Agent when you need depth.\n\n```bash\n# Install and it just works\nnpx clawhub install smart-memory\n\n# Optional: sync for better quality\nnode smart-memory/smart_memory.js --sync\n```\n\n## ✨ The Magic\n\n**Same function call. Two modes. You choose.**\n\n```javascript\n// Fast mode (default): Direct vector search\nmemory_search(\"User principles values\")\n\n// Focus mode: Multi-pass curation for complex decisions\nmemory_mode('focus')\nmemory_search(\"What did we decide about the architecture?\")\n```\n\n| Mode | Best For | How It Works |\n|------|----------|--------------|\n| **Fast** | Quick lookups, facts | Direct vector similarity (~10ms) |\n| **Focus** | Decisions, synthesis | Retrieve → Rank → Synthesize (~100ms) |\n\n## 🚀 Quick Start\n\n### From ClawHub (Recommended)\n```bash\nnpx clawhub install smart-memory\n```\nDone. `memory_search` now works with automatic mode selection.\n\n### From GitHub\n```bash\ncurl -sL https://raw.githubusercontent.com/BluePointDigital/smart-memory/main/install.sh | bash\n```\n\n### Manual\n```bash\ngit clone https://github.com/BluePointDigital/smart-memory.git\ncd smart-memory/smart-memory && npm install\n```\n\n## 🎯 How It Works\n\n### Dual Retrieval Modes\n\n```\nUser searches\n      │\n      ▼\n┌─────────────┐\n│  Fast Mode? │\n└──────┬──────┘\n   Yes │    │ No (Focus Mode)\n      ▼     ▼\n┌────────┐ ┌─────────────┐\n│ Vector │ │ Retrieve 20+│\n│ Search │ │ chunks      │\n└────┬───┘ └──────┬──────┘\n     │            ▼\n     │     ┌─────────────┐\n     │     │ Rank &      │\n     │     │ Synthesize  │\n     │     └──────┬──────┘\n     │            ▼\n     │     ┌─────────────┐\n     │     │ Curated     │\n     │     │ Narrative   │\n     └─────┴──────┬──────┘\n                  ▼\n           ┌────────────┐\n           │  Results   │\n           └────────────┘\n```\n\n### Zero Config Philosophy\n1. **Install** → Works immediately (built-in fallback)\n2. **Sync** → Gets better (vector embeddings)\n3. **Choose mode** → Fast for speed, Focus for depth\n4. **Use** → Always best available\n\n## 🎛️ Toggle Modes\n\n```bash\n# Enable Focus mode (curated retrieval)\nnode smart-memory/smart_memory.js --focus\n\n# Disable Focus mode (back to fast)\nnode smart-memory/smart_memory.js --unfocus\n\n# Check current mode\nnode smart-memory/smart_memory.js --mode\n```\n\n## 📊 Before & After\n\n| Query | Without Skill | With Skill (Fast) | With Skill (Focus) |\n|-------|--------------|-------------------|-------------------|\n| \"User collaboration style\" | ⚠️ Weak | ✅ Better | ✅ \"work with me, not just for me\" + context |\n| \"What did we decide?\" | ⚠️ Scattered | ✅ Related chunks | ✅ Synthesized decision narrative |\n| \"Compare options A and B\" | ⚠️ Manual work | ✅ Related hits | ✅ Structured comparison with sources |\n\n## 🛠️ Usage\n\n### In OpenClaw\n\n```javascript\n// Fast search (default)\nconst results = await memory_search(\"deployment config\", 5);\n\n// Enable focus for complex queries\nmemory_mode('focus');\nconst deepResults = await memory_search(\"architecture decisions\", 5);\n// Returns: { synthesis, facts, sources, confidence }\n```\n\n### CLI\n\n```bash\n# Search (uses current mode)\nnode smart-memory/smart_memory.js --search \"your query\"\n\n# Search with mode override\nnode smart-memory/smart_memory.js --search \"your query\" --focus\nnode smart-memory/smart_memory.js --search \"your query\" --fast\n\n# Toggle modes\nnode smart-memory/smart_memory.js --focus      # Enable focus\nnode smart-memory/smart_memory.js --unfocus    # Disable focus\n\n# Check status\nnode smart-memory/smart_memory.js --status\n```\n\n## 📁 What's Included\n\n```\nsmart-memory/\n├── smart_memory.js        ← Main entry (auto-selects mode)\n├── focus_agent.js         ← Curated retrieval engine\n├── memory_mode.js         ← Mode toggle commands\n├── db.js                  ← SQLite + hybrid search\n├── memory.js              ← OpenClaw wrapper\n├── package.json           ← Dependencies\n└── references/\n    ├── integration.md     ← Setup guide\n    └── pgvector.md        ← Scale guide\n\nskills/\n└── vector-memory/         ← OpenClaw skill manifest\n    ├── skill.json\n    └── README.md\n```\n\n## 🔧 Requirements\n\n- Node.js 18+\n- ~80MB disk space (for model, cached after download)\n- OpenClaw (or any Node.js agent)\n\n## 🎛️ Tools\n\n| Tool | Purpose |\n|------|---------|\n| `memory_search` | Smart search with mode awareness |\n| `memory_get` | Retrieve full content |\n| `memory_sync` | Index for vector search |\n| `memory_mode` | Toggle fast/focus modes |\n| `memory_status` | Check mode and database stats |\n\n## 🔄 Auto-Sync (Optional)\n\nAdd to `HEARTBEAT.md`:\n```bash\nif [ -n \"$(find memory MEMORY.md -newer smart-memory/.last_sync 2>/dev/null)\" ]; then\n    node smart-memory/smart_memory.js --sync && touch smart-memory/.last_sync\nfi\n```\n\n## 📈 Performance\n\n| Mode | Quality | Speed | Best For |\n|------|---------|-------|----------|\n| Fast | ⭐⭐⭐⭐ | ~10ms | Quick lookups, facts |\n| Focus | ⭐⭐⭐⭐⭐ | ~100ms | Decisions, synthesis, planning |\n\n## 🐛 Troubleshooting\n\n| Issue | Solution |\n|-------|----------|\n| **\"Vector not ready\"** | Run: `node smart_memory.js --sync` |\n| **No results found** | Check that MEMORY.md exists; try broader query |\n| **First sync slow** | Normal - downloading ~80MB model; subsequent syncs fast |\n| **Focus mode too slow** | Switch to fast: `node smart_memory.js --unfocus` |\n| **Want pure built-in?** | Don't sync - built-in always available as fallback |\n\n## 🧪 Verify Installation\n\n```bash\nnode smart-memory/smart_memory.js --status\n```\n\nChecks: dependencies, vector index, search functionality, memory files, current mode.\n\n## 📋 For Agent Developers\n\nAdd to your `AGENTS.md`:\n```markdown\n## Memory Recall\nBefore answering about prior work, decisions, preferences:\n1. Run memory_search with relevant query\n2. Use memory_get for full context\n3. Enable focus mode for complex decisions: memory_mode('focus')\n4. If low confidence, say you checked\n```\n\nSee full template in `AGENTS.md`.\n\n## 🗂️ Suggested Memory Structure\n\n```\nworkspace/\n├── MEMORY.md              # Curated long-term memory\n└── memory/\n    ├── logs/              # Daily activity (YYYY-MM-DD.md)\n    ├── projects/          # Project-specific notes\n    ├── decisions/         # Important choices\n    └── lessons/           # Mistakes learned\n```\n\nSee `MEMORY_STRUCTURE.md` for templates.\n\n## 🔗 Links\n\n- **GitHub**: https://github.com/BluePointDigital/smart-memory\n- **ClawHub**: https://clawhub.ai/BluePointDigital/smart-memory\n- **Issues**: https://github.com/BluePointDigital/smart-memory/issues\n\n## 📜 License\n\nMIT\n\n## 🙏 Acknowledgments\n\n- Embeddings: [Xenova Transformers](https://github.com/xenova/transformers.js)\n- Model: `sentence-transformers/all-MiniLM-L6-v2`\n- Inspired by OpenClaw's memory system and Cognee's knowledge graphs\n\nFile v2.1.2:skills/vector-memory/README.md\n\n# Vector Memory Skill\n\nSmart memory search with **zero configuration**. Automatically uses semantic vector embeddings when available, falls back to built-in search otherwise.\n\n## 🎯 How It Works\n\n```\n┌─────────────────┐\n│  User searches  │\n└────────┬────────┘\n         │\n    ┌────▼────┐\n    │ Vector  │ ←── Semantic understanding\n    │ ready?  │     (synonyms, concepts)\n    └────┬────┘\n    Yes  │  No\n    ┌────┘  └────┐\n    ▼            ▼\n┌────────┐  ┌──────────┐\n│ Vector │  │ Built-in │ ←── Keyword matching\n│ Search │  │ Search   │     (fallback)\n└────────┘  └──────────┘\n    │            │\n    └──────┬─────┘\n           ▼\n    ┌──────────────┐\n    │ Return results│\n    └──────────────┘\n```\n\n**No setup required.** Install the skill and `memory_search` immediately works—just better when you sync.\n\n## 🚀 Installation\n\n### From ClawHub\n```bash\nnpx clawhub install vector-memory\n```\n\n### From GitHub\n```bash\ncurl -sL https://raw.githubusercontent.com/YOUR_USERNAME/vector-memory-openclaw/main/install.sh | bash\n```\n\n### Manual\n```bash\ngit clone https://github.com/YOUR_USERNAME/vector-memory-openclaw.git\ncd vector-memory-openclaw/vector-memory && npm install\n```\n\n## ✨ What You Get\n\n### Immediate (No Sync Required)\n- `memory_search` works with built-in keyword search\n- `memory_get` retrieves full content\n- All standard memory operations functional\n\n### After First Sync (Recommended)\n```bash\nnode vector-memory/smart_memory.js --sync\n```\n\n- **Semantic search** - \"principles\" finds \"values\"\n- **Concept matching** - \"values\" finds \"principles\"\n- **Better relevance** - Neural embeddings understand meaning\n\n## 🛠️ Tools\n\n### memory_search\n**Automatically selects best method**\n\n```javascript\n// Works immediately (uses built-in)\nmemory_search(\"James values\")\n\n// Works better after sync (uses vector)\nmemory_search(\"James values\")  // Same call, better results!\n```\n\n**Parameters:**\n- `query` (string): What to search for\n- `max_results` (number): Max results (default: 5)\n\n**Returns:** Array of matches with path, lines, score, snippet\n\n### memory_get\nGet full content from a file.\n\n```javascript\nmemory_get(\"MEMORY.md\", 1, 20)  // Get lines 1-20\n```\n\n### memory_sync\nIndex memory files for vector search.\n\n```bash\nnode vector-memory/smart_memory.js --sync\n```\n\nRun this after editing memory files.\n\n### memory_status\nCheck which method is active.\n\n```bash\nnode vector-memory/smart_memory.js --status\n```\n\n## 📊 Comparison\n\n| Query | Before (Built-in) | After (Vector) |\n|-------|------------------|----------------|\n| \"James principles\" | ⚠️ Weak matches | ✅ \"What He Values\" section |\n| \"Nyx origin\" | ⚠️ Literal match | ✅ \"The Transfer\" section |\n| \"values beliefs\" | ⚠️ Weak match | ✅ Strong semantic match |\n\n**Same function call. Better results after sync.**\n\n## 🔧 How to Use\n\n### In OpenClaw\nJust use `memory_search` normally:\n\n```javascript\n// This automatically uses best available method\nconst results = await memory_search(\"what did we discuss about projects\");\n```\n\n### CLI\n```bash\n# Search (auto-selects method)\nnode vector-memory/smart_memory.js --search \"your query\"\n\n# Force check status\nnode vector-memory/smart_memory.js --status\n\n# Sync for better results\nnode vector-memory/smart_memory.js --sync\n```\n\n## 🔄 Auto-Sync (Optional)\n\nAdd to `HEARTBEAT.md`:\n```bash\n# Sync memory if files changed\nif [ -n \"$(find memory MEMORY.md -newer vector-memory/.last_sync 2>/dev/null)\" ]; then\n    node vector-memory/smart_memory.js --sync\n    touch vector-memory/.last_sync\nfi\n```\n\n## 📁 File Structure\n\n```\nvector-memory/\n├── smart_memory.js           ← Main entry (auto-selects method)\n├── vector_memory_local.js    ← Vector implementation\n├── memory.js                 ← OpenClaw wrapper\n└── package.json\n```\n\n**You only need to call `smart_memory.js`** - it handles everything.\n\n## 🎯 Zero-Config Philosophy\n\n1. **Install** → Works immediately (built-in fallback)\n2. **Sync** → Gets better (vector embeddings)\n3. **Use** → Always best available method\n\nNo configuration files. No environment variables. No manual switching.\n\n## 🐛 Troubleshooting\n\n**\"Vector not ready\" in status**\n- Normal on first install. Run `--sync` to index.\n\n**Search returns few results**\n- May be using built-in fallback. Run `--sync` for vector search.\n\n**First sync is slow**\n- Downloads ~80MB model. Subsequent syncs are fast.\n\n**Want to force built-in search?**\n- Just don't sync. Built-in is always available as fallback.\n\n## 📈 Performance\n\n| Method | Quality | Speed | Requirements |\n|--------|---------|-------|--------------|\n| Vector | ⭐⭐⭐⭐⭐ | ~100ms | Synced index |\n| Built-in | ⭐⭐⭐ | ~10ms | None (fallback) |\n\nVector is used automatically when available. Built-in is instant fallback.\n\n## 📝 Version History\n\n- **v2.1.0** - Smart wrapper with automatic fallback\n- **v2.0.0** - 100% local embeddings\n- **v1.0.0** - Initial release\n\n## 🤝 Contributing\n\nPRs welcome! Particularly:\n- Better fallback algorithms\n- Additional storage backends\n- Framework integrations\n\n## 📜 License\n\nMIT\n\nFile v2.1.2:_meta.json\n\n{\n  \"ownerId\": \"kn79jnjmwnh2n88m8qh12jdhcn80jh1m\",\n  \"slug\": \"smart-memory\",\n  \"version\": \"2.1.2\",\n  \"publishedAt\": 1770399301716\n}\n\nFile v2.1.2:smart-memory/references/integration.md\n\n# Integration Guide\n\n## For OpenClaw Agents\n\n### Method 1: Skill Installation\n\n1. Copy `skills/vector-memory/` to your agent's `skills/` directory\n2. Copy `vector-memory/` implementation folder\n3. Install dependencies: `cd vector-memory && npm install`\n4. Index memory: `node vector_memory_local.js --sync`\n5. Use via skill system\n\n### Method 2: Direct Tool Replacement\n\nReplace built-in `memory_search` with:\n\n```javascript\n// In your agent's tools configuration\n{\n  \"name\": \"memory_search\",\n  \"command\": \"node /path/to/vector-memory/vector_memory_local.js --search {{query}} --max-results {{max_results}}\"\n}\n```\n\n### Method 3: Programmatic\n\n```javascript\nimport { memorySearch, memoryGet, memorySync } from './vector-memory/memory.js';\n\n// Search\nconst results = await memorySearch(\"James values\", 5);\n\n// Get full content\nconst content = memoryGet(\"MEMORY.md\", 1, 20);\n\n// Sync after edits\nmemorySync();\n```\n\n## For Other Frameworks\n\n### LangChain (Python)\n\n```python\nfrom sentence_transformers import SentenceTransformer\nfrom langchain_community.vectorstores import FAISS\n\nmodel = SentenceTransformer('all-MiniLM-L6-v2')\nembeddings = model.encode(texts)\nvectorstore = FAISS.from_embeddings(embeddings, texts)\n```\n\n### N8N\n\nUse Function node with `@xenova/transformers`:\n```javascript\nconst { pipeline } = require('@xenova/transformers');\nconst embedder = await pipeline('feature-extraction', 'Xenova/all-MiniLM-L6-v2');\nconst embedding = await embedder(query, { pooling: 'mean' });\n```\n\n### Custom Agents\n\nCore pattern:\n1. Load model: `SentenceTransformer('all-MiniLM-L6-v2')`\n2. Embed chunks: `model.encode(chunks)`\n3. Store: JSON, SQLite, or vector DB\n4. Search: Cosine similarity between query and stored embeddings\n5. Return: Full content from source files\n\n## Environment Setup\n\n### Required\n- Node.js 18+ (for OpenClaw version)\n- npm or yarn\n\n### Optional\n- Docker (for pgvector version)\n- OpenAI API key (for pgvector version)\n\n## Directory Structure\n\n```\nworkspace/\n├── skills/\n│   └── vector-memory/          # Skill manifest\n│       ├── skill.json\n│       └── README.md\n├── vector-memory/              # Implementation\n│   ├── vector_memory_local.js  # Local embeddings\n│   ├── memory.js               # OpenClaw wrapper\n│   ├── package.json\n│   └── node_modules/\n├── memory/                     # Your memory files\n│   └── *.md\n└── MEMORY.md                   # Main memory file\n```\n\n## Sharing Between Agents\n\nShareable:\n- `skill.json`\n- `vector_memory_local.js`\n- `memory.js`\n- `package.json`\n\nNot shareable (agent-specific):\n- `vectors_local.json` (rebuild per agent)\n- `node_modules/` (reinstall per agent)\n- `.cache/transformers/` (model downloads per agent)\n\n## Auto-Sync\n\nAdd to heartbeat or cron:\n```bash\n# Sync if memory files changed\nif [ -n \"$(find memory MEMORY.md -newer vector-memory/.last_sync 2>/dev/null)\" ]; then\n    node vector-memory/vector_memory_local.js --sync\n    touch vector-memory/.last_sync\nfi\n```\n\nFile v2.1.2:smart-memory/references/pgvector.md\n\n# pgvector Version\n\nFor large-scale deployments (>1000 chunks) or team use, use the pgvector version with PostgreSQL.\n\n## Prerequisites\n\n- Docker\n- OpenAI API key (for embeddings)\n\n## Setup\n\n```bash\n# Start pgvector\ndocker-compose -f docker-compose.yml up -d\n\n# Sync memory\nnode vector_memory.js --sync\n```\n\n## Configuration\n\nEnvironment variables:\n```bash\nexport PG_HOST=localhost\nexport PG_PORT=5433\nexport PG_DATABASE=memory\nexport PG_USER=openclaw\nexport PG_PASSWORD=openclaw_memory_2025\nexport OPENAI_API_KEY=sk-...\n```\n\n## Usage\n\nSame CLI as local version:\n```bash\nnode vector_memory.js --search \"query\"\nnode vector_memory.js --sync\nnode vector_memory.js --status\n```\n\n## When to Use\n\n| Scenario | Use |\n|----------|-----|\n| Personal agent | Local version |\n| Team/shared | pgvector version |\n| > 1000 memory chunks | pgvector version |\n| Need real-time sync | pgvector version |\n\n## Migration\n\nTo migrate from local to pgvector:\n1. Set up pgvector (see above)\n2. Run `node vector_memory.js --sync`\n3. Point skill.json to `vector_memory.js` instead of `vector_memory_local.js`\n\nFile v2.1.2:AGENTS.md\n\n## Memory Recall - Vector Memory Skill\n\nBefore answering questions about prior work, decisions, dates, people, preferences, or todos:\n\n1. **Run memory_search** with relevant query\n   ```javascript\n   const results = await memory_search(\"what we discussed about projects\", 5);\n   ```\n\n2. **Use memory_get** to pull full context if needed\n   ```javascript\n   const fullContent = memory_get(\"MEMORY.md\", 1, 20);\n   ```\n\n3. **If low confidence after search**, say you checked\n   > \"I searched my memory but don't see specific notes about this topic.\"\n\n### When to Search\n\n**Always search before:**\n- Answering questions about past conversations\n- Referencing previous decisions\n- Recalling user preferences\n- Continuing work on prior projects\n- Summarizing what was discussed\n\n**Search queries should be:**\n- Natural language (e.g., \"James values and principles\")\n- Conceptual (e.g., \"Nyx origin story\")\n- Not just keywords (semantic search understands meaning)\n\n### How It Works\n\nThis agent uses **vector memory** with automatic fallback:\n\n1. **If synced:** Uses neural embeddings for semantic search\n   - Finds conceptually related content\n   - Understands synonyms (\"principles\" finds \"values\")\n   - Better relevance, more context\n\n2. **If not synced:** Uses built-in keyword search\n   - Works immediately after install\n   - No configuration needed\n   - Graceful fallback\n\n3. **Sync to improve:**\n   ```bash\n   node vector-memory/smart_memory.js --sync\n   ```\n\n### Memory Structure\n\n```\nworkspace/\n├── MEMORY.md              # Curated long-term memory\n└── memory/\n    ├── logs/              # Daily logs (YYYY-MM-DD.md)\n    ├── projects/          # Project-specific notes\n    ├── decisions/         # Important choices\n    └── lessons/           # Mistakes learned\n```\n\n### Verification\n\nTest that memory is working:\n```bash\nnode vector-memory/smart_memory.js --test\n```\n\nExpected: Shows vector status, chunk count, and confirms search functional.\n\n### Troubleshooting\n\n| Issue | Solution |\n|-------|----------|\n| \"Vector not ready\" | Run: `node vector-memory/smart_memory.js --sync` |\n| No results | Check that MEMORY.md or memory/ files exist |\n| First sync slow | Normal - downloading ~80MB model |\n| Search irrelevant | Sync again after editing memory files |\n\n---\n\n*Part of Vector Memory skill for OpenClaw*\n*100% local semantic search with zero configuration*\n\nFile v2.1.2:CHANGELOG.md\n\n# Changelog\n\n## [2.1.2] - 2026-02-06\n\n### Security\n- **CRITICAL**: Fixed path traversal vulnerabilities in multiple files:\n  - `memory.js`: `memoryGet()` function\n  - `vector_memory_local.js`: `getFullContent()` function\n- Added path resolution validation to ensure all file access stays within workspace\n- Added allowlist check to restrict access to `MEMORY.md`, `memory/*.md`, and `.hot_memory.md` only\n- Blocks attempts like `../../../etc/passwd` or nested traversal patterns\n\n## [2.1.1] - 2026-02-05\n\n### Added\n- AGENTS.md template for memory recall instructions\n- MEMORY_STRUCTURE.md with directory organization guide\n- Test script (`--test` command) for verification\n- Troubleshooting table in README\n- Better onboarding documentation\n\n## [2.1.0] - 2026-02-04\n\n### Added\n- Smart wrapper with automatic fallback (vector → built-in)\n- Zero-configuration philosophy\n- Graceful degradation when vector not ready\n\n## [2.0.0] - 2026-02-04\n\n### Added\n- 100% local embeddings using `all-MiniLM-L6-v2` via Transformers.js\n- No API calls required\n- Semantic chunking (by headers, not just lines)\n- Cosine similarity scoring\n- JSON storage for personal-scale use\n- OpenClaw skill manifest\n- Programmatic API wrapper (`memory.js`)\n\n### Changed\n- Replaced word-frequency embeddings with neural embeddings\n- Improved retrieval quality significantly\n- Better chunking strategy (semantic boundaries)\n\n## [1.0.0] - 2026-02-04\n\n### Added\n- Initial version with word-frequency embeddings\n- Simple JSON storage\n- Basic CLI interface\n- pgvector support (Docker-based)\n\n### Notes\n- Word-frequency method works but has limited semantic understanding\n- Neural embeddings (v2) recommended for production use\n\nFile v2.1.2:MEMORY_STRUCTURE.md\n\n# Suggested Memory Structure\n\nKeep your memory organized for better retrieval:\n\n```\nworkspace/\n├── MEMORY.md                 # Curated long-term (the good stuff)\n│   ├── Origin Story\n│   ├── Core Values/Principles\n│   ├── Active Projects\n│   ├── Important Decisions\n│   └── Key Relationships\n│\n└── memory/\n    ├── logs/                 # Daily activity logs\n    │   └── YYYY-MM-DD.md\n    │\n    ├── projects/             # Project-specific context\n    │   ├── project-alpha.md\n    │   └── website-redesign.md\n    │\n    ├── decisions/            # Important choices made\n    │   └── YYYY-MM-decisions.md\n    │\n    ├── lessons/              # Mistakes and learnings\n    │   └── mistakes-learned.md\n    │\n    └── people/               # Contact preferences, context\n        └── contacts.md\n```\n\n## Quick Templates\n\n### Daily Log (memory/logs/YYYY-MM-DD.md)\n```markdown\n# 2026-02-05 — Daily Log\n\n## 09:00 — Project Kickoff\n- Discussed architecture with James\n- Decision: Use React for frontend\n- Follow-up: Research state management\n\n## 14:00 — Code Review\n- Reviewed PR #42\n- Learned: Prefer async/await over callbacks\n```\n\n### Project Note (memory/projects/[name].md)\n```markdown\n# Project Alpha\n\n## Goal\nBuild X to solve Y\n\n## Decisions\n- Tech stack: React + Node\n- Hosting: Vercel\n\n## Status\nIn progress - 60% complete\n\n## Next Steps\n- [ ] Implement auth\n- [ ] Design database schema\n```\n\n### Decision Log (memory/decisions/YYYY-MM.md)\n```markdown\n# February 2026 Decisions\n\n## 2026-02-05 — Frontend Framework\n**Decision:** Use React instead of Vue\n**Context:** Team has more React experience\n**Consequences:** Faster development, easier hiring\n```\n\n## Why This Structure?\n\n| Directory | Purpose | Search Benefit |\n|-----------|---------|----------------|\n| `logs/` | Raw daily activity | \"What did we do Tuesday?\" |\n| `projects/` | Project context | \"What's the status of Alpha?\" |\n| `decisions/` | Important choices | \"Why did we choose React?\" |\n| `lessons/` | Mistakes learned | \"What went wrong last time?\" |\n| `people/` | Contact context | \"What's James's preference?\" |\n\n## Sync After Organizing\n\nAfter restructuring:\n```bash\nnode vector-memory/smart_memory.js --sync\n```\n\nThis re-indexes everything for optimal search.\n\nFile v2.1.2:skills/vector-memory/skill.json\n\n{\n  \"name\": \"smart-memory\",\n  \"version\": \"2.1.1\",\n  \"description\": \"Smart memory with hybrid search (BM25 + vectors) and Focus Agent for curated retrieval. SQLite backend, zero configuration, local embeddings.\",\n  \"author\": \"Nyx\",\n  \"tools\": [\n    {\n      \"name\": \"memory_search\",\n      \"description\": \"Search memory files with automatic method selection. Uses vector embeddings (semantic search) if indexed, otherwise falls back to built-in keyword search. Supports Focus Mode for complex queries.\",\n      \"command\": \"node {{workspace}}/smart-memory/smart_memory.js --search \\\"{{query}}\\\" --max-results {{max_results|5}}\",\n      \"args\": {\n        \"query\": {\n          \"type\": \"string\",\n          \"description\": \"The search query - natural language, concepts, or keywords\",\n          \"required\": true\n        },\n        \"max_results\": {\n          \"type\": \"number\",\n          \"description\": \"Maximum number of results to return\",\n          \"default\": 5\n        }\n      }\n    },\n    {\n      \"name\": \"memory_sync\",\n      \"description\": \"Sync memory files to vector index for better search quality. Run after editing memory files.\",\n      \"command\": \"node {{workspace}}/smart-memory/smart_memory.js --sync\"\n    },\n    {\n      \"name\": \"memory_status\",\n      \"description\": \"Check memory system status - vector index ready, chunks indexed, last sync time, current mode.\",\n      \"command\": \"node {{workspace}}/smart-memory/smart_memory.js --status\"\n    },\n    {\n      \"name\": \"memory_mode\",\n      \"description\": \"Toggle between Fast mode (direct search) and Focus mode (curated retrieval with synthesis).\",\n      \"command\": \"node {{workspace}}/smart-memory/smart_memory.js --mode {{mode}}\",\n      \"args\": {\n        \"mode\": {\n          \"type\": \"string\",\n          \"description\": \"Search mode: 'fast' for direct vector search, 'focus' for curated multi-pass retrieval\",\n          \"enum\": [\"fast\", \"focus\"],\n          \"required\": true\n        }\n      }\n    }\n  ]\n}\n\nFile v2.1.2:smart-memory/package.json\n\n{\n  \"name\": \"smart-memory\",\n  \"version\": \"2.1.2\",\n  \"description\": \"Smart memory with SQLite backend and hybrid search (FTS5 + vectors)\",\n  \"type\": \"module\",\n  \"main\": \"smart_memory.js\",\n  \"scripts\": {\n    \"sync\": \"node smart_memory.js --sync\",\n    \"search\": \"node smart_memory.js --search\",\n    \"status\": \"node smart_memory.js --status\"\n  },\n  \"dependencies\": {\n    \"@xenova/transformers\": \"^2.17.2\",\n    \"better-sqlite3\": \"^11.5.0\"\n  },\n  \"engines\": {\n    \"node\": \">=18.0.0\"\n  }\n}\n\nArchive v1.0.1: 18 files, 32355 bytes\n\nFiles: AGENTS.md (2400b), CHANGELOG.md (1223b), install.sh (2307b), MEMORY_STRUCTURE.md (2371b), README.md (7452b), SKILL.md (8098b), skills/vector-memory/README.md (5473b), skills/vector-memory/skill.json (2222b), smart-memory/db.js (10621b), smart-memory/focus_agent.js (10033b), smart-memory/memory_mode.js (4143b), smart-memory/memory.js (4299b), smart-memory/package.json (254b), smart-memory/references/integration.md (3028b), smart-memory/references/pgvector.md (1082b), smart-memory/smart_memory.js (9574b), smart-memory/vector_memory_local.js (9112b), _meta.json (131b)\n\nFile v1.0.1:SKILL.md\n\n---\nname: smart-memory\ndescription: Context-aware memory for AI agents with dual retrieval modes — fast vector search or curated Focus Agent synthesis. SQLite backend, zero configuration, local embeddings.\n---\n\n# Smart Memory v2.1 - Focus Agent Edition\n\n**Drop-in replacement for OpenClaw's memory system** with superior search quality and optional curated retrieval via Focus Agent.\n\n## Features\n\n- **Hybrid Search**: Combines FTS5 keyword search (BM25) with semantic vector search\n- **Focus Agent**: Multi-pass curation for complex queries (retrieve → rank → synthesize)\n- **Dual Modes**: Fast (direct) or Focus (curated) — toggle anytime\n- **SQLite Backend**: Single-file database, no external services\n- **100% Local**: Embeddings run locally with Transformers.js (no API keys)\n- **Auto-Optimization**: Uses sqlite-vec when available for native vector ops\n- **Zero Configuration**: Works immediately after install\n\n## Installation\n\n```bash\nnpx clawhub install smart-memory\n```\n\nOr from ClawHub: https://clawhub.ai/BluePointDigital/smart-memory\n\n## Quick Start\n\n### 1. Sync Memory\n```bash\nnode smart-memory/smart_memory.js --sync\n```\n\n### 2. Search (Fast Mode - Default)\n```bash\nnode smart-memory/smart_memory.js --search \"James values principles\"\n```\n\n### 3. Enable Focus Mode (Curated Retrieval)\n```bash\nnode smart-memory/smart_memory.js --focus\nnode smart-memory/smart_memory.js --search \"complex decision about project direction\"\n```\n\n### 4. Disable Focus Mode\n```bash\nnode smart-memory/smart_memory.js --unfocus\n```\n\n## Search Modes\n\n### Fast Mode (Default)\nDirect vector similarity search. Best for:\n- Simple lookups\n- Quick fact retrieval\n- Routine queries\n\n```bash\nnode smart-memory/smart_memory.js --search \"git remote\"\n```\n\n### Focus Mode (Curated)\nMulti-pass curation via Focus Agent. Best for:\n- Complex decisions\n- Multi-fact synthesis\n- Planning and strategy\n- Comparing options\n\n```bash\nnode smart-memory/smart_memory.js --focus\nnode smart-memory/smart_memory.js --search \"What did we decide about BluePointDigital architecture?\"\n```\n\n**How Focus Mode Works:**\n1. **Retrieve** 20+ chunks (broad net)\n2. **Rank** by weighted relevance (vector + term matching + source boost)\n3. **Synthesize** into coherent narrative\n4. **Deliver** structured context with confidence scores\n\n## How It Works\n\n### Hybrid Search Algorithm\n\n1. **FTS5** finds exact keyword matches (BM25 ranking)\n2. **Vector search** finds semantic matches (cosine similarity)\n3. **Merged results** using weighted scoring:\n   - 70% vector score + 30% keyword score\n   - Catches both \"what you mean\" and \"exact tokens\"\n\n### Focus Agent Curation\n\nWhen enabled, searches go through additional processing:\n\n```\nQuery: \"What did we decide about BluePointDigital?\"\n\n┌─────────────────┐\n│  Retrieve 20+   │  ← Vector similarity\n│    chunks       │\n└────────┬────────┘\n         ▼\n┌─────────────────┐\n│   Weighted      │  ← Term matching\n│    Ranking      │    Source boosting\n│                 │    Recency boost\n└────────┬────────┘\n         ▼\n┌─────────────────┐\n│   Select Top 5  │  ← Threshold filtering\n└────────┬────────┘\n         ▼\n┌─────────────────┐\n│   Synthesize    │  ← Group by source\n│   Narrative     │    Extract key facts\n└────────┬────────┘\n         ▼\n    Structured output with confidence\n```\n\n## Tools\n\n### memory_search\n```javascript\nmemory_search({\n    query: \"deployment configuration\",\n    maxResults: 5\n})\n```\n\nReturns (Fast Mode):\n```json\n{\n    \"query\": \"deployment configuration\",\n    \"mode\": \"fast\",\n    \"results\": [\n        {\n            \"path\": \"MEMORY.md\",\n            \"from\": 42,\n            \"lines\": 8,\n            \"score\": 0.89,\n            \"snippet\": \"...\"\n        }\n    ]\n}\n```\n\nReturns (Focus Mode):\n```json\n{\n    \"query\": \"deployment configuration\",\n    \"mode\": \"focus\",\n    \"confidence\": 0.87,\n    \"sources\": [\"MEMORY.md\", \"memory/2026-02-05.md\"],\n    \"synthesis\": \"Relevant context for: \\\"deployment configuration\\\"\\n\\nFrom MEMORY.md:\\n  • Docker setup uses docker-compose...\\n  • Production deployment on AWS...\\n\\nFrom memory/2026-02-05.md:\\n  • Decided to use Railway instead...\",\n    \"facts\": [\n        {\n            \"content\": \"Docker setup uses docker-compose...\",\n            \"source\": \"MEMORY.md\",\n            \"lines\": \"42-50\",\n            \"confidence\": 0.89\n        }\n    ]\n}\n```\n\n### memory_get\n```javascript\nmemory_get({\n    path: \"MEMORY.md\",\n    from: 42,\n    lines: 10\n})\n```\n\n### memory_mode (Focus Toggle)\n```javascript\nmemory_mode('focus')    // Enable curated retrieval\nmemory_mode('fast')     // Disable curated retrieval\nmemory_mode()           // Get current mode status\n```\n\n## CLI Commands\n\n```bash\n# Sync memory files\nnode smart_memory.js --sync\n\n# Search (uses current mode)\nnode smart_memory.js --search \"query\" [--max-results N]\n\n# Search with mode override\nnode smart_memory.js --search \"query\" --focus\nnode smart_memory.js --search \"query\" --fast\n\n# Toggle modes\nnode smart_memory.js --focus      # Enable focus mode\nnode smart_memory.js --unfocus    # Disable focus mode\nnode smart_memory.js --fast       # Same as --unfocus\n\n# Check status\nnode smart_memory.js --status     # Database stats + current mode\nnode smart_memory.js --mode       # Current mode details\n\n# Focus agent only\nnode focus_agent.js --search \"query\"\nnode focus_agent.js --suggest \"query\"  # Check if focus recommended\n\n# Mode management\nnode memory_mode.js focus\nnode memory_mode.js unfocus\nnode memory_mode.js status\n```\n\n## Performance\n\n| Feature | Fallback | With sqlite-vec |\n|---------|----------|-----------------|\n| Keyword search | FTS5 (native) | FTS5 (native) |\n| Vector search | JS cosine | Native KNN |\n| Focus curation | +50-100ms | +50-100ms |\n| Speed | ~100 chunks/sec | ~10,000 chunks/sec |\n| Memory | All in RAM | DB handles it |\n\n## When to Use Focus Mode\n\nUse `--focus` or enable focus mode when:\n- Query involves multiple related concepts\n- You need synthesized context, not raw chunks\n- Making decisions that require understanding relationships\n- Summarizing project history\n- Comparing options mentioned in different files\n\nDon't use focus mode when:\n- Quick fact lookup (phone number, command syntax)\n- You need exact text matches\n- Latency matters more than context quality\n\n## Installation: sqlite-vec (Optional)\n\nFor best performance, install sqlite-vec:\n\n```bash\n# macOS\nbrew install sqlite-vec\n\n# Ubuntu/Debian\n# Download from https://github.com/asg017/sqlite-vec/releases\n# Place vec0.so in ~/.local/lib/ or /usr/local/lib/\n```\n\nWithout it: Works fine, just slower on large databases.\n\n## File Structure\n\n```\nsmart-memory/\n├── smart_memory.js      # Main CLI\n├── focus_agent.js       # Curated retrieval engine\n├── memory_mode.js       # Mode toggle commands\n├── memory.js            # OpenClaw wrapper\n├── db.js                # SQLite layer\n├── search.js            # Hybrid search\n├── chunker.js           # Token-based chunking\n├── embed.js             # Transformers.js embeddings\n└── vector-memory.db     # SQLite database (auto-created)\n```\n\n## Environment Variables\n\n```bash\nMEMORY_DIR=/path/to/memory        # Default: ./memory\nMEMORY_FILE=/path/to/MEMORY.md    # Default: ./MEMORY.md\nMEMORY_DB_PATH=/path/to/db.sqlite # Default: ./vector-memory.db\n```\n\n## Comparison: v1 vs v2 vs v2.1\n\n| | v1 (JSON) | v2 (SQLite) | v2.1 (Focus Agent) |\n|--|-----------|-------------|-------------------|\n| Search | Vector only | Hybrid (BM25 + Vector) | Hybrid + Focus Curation |\n| Storage | JSON file | SQLite | SQLite |\n| Scale | ~1000 chunks | Unlimited | Unlimited |\n| Keyword match | Weak | Strong (FTS5) | Strong (FTS5) |\n| Context curation | No | No | Yes (toggle) |\n| Setup | Zero config | Zero config | Zero config |\n\n## License\n\nMIT\n\nFile v1.0.1:README.md\n\n# Smart Memory for OpenClaw\n\n**Context-aware memory system with dual retrieval modes** — fast vector search when you need speed, curated Focus Agent when you need depth.\n\n```bash\n# Install and it just works\nnpx clawhub install smart-memory\n\n# Optional: sync for better quality\nnode smart-memory/smart_memory.js --sync\n```\n\n## ✨ The Magic\n\n**Same function call. Two modes. You choose.**\n\n```javascript\n// Fast mode (default): Direct vector search\nmemory_search(\"User principles values\")\n\n// Focus mode: Multi-pass curation for complex decisions\nmemory_mode('focus')\nmemory_search(\"What did we decide about the architecture?\")\n```\n\n| Mode | Best For | How It Works |\n|------|----------|--------------|\n| **Fast** | Quick lookups, facts | Direct vector similarity (~10ms) |\n| **Focus** | Decisions, synthesis | Retrieve → Rank → Synthesize (~100ms) |\n\n## 🚀 Quick Start\n\n### From ClawHub (Recommended)\n```bash\nnpx clawhub install smart-memory\n```\nDone. `memory_search` now works with automatic mode selection.\n\n### From GitHub\n```bash\ncurl -sL https://raw.githubusercontent.com/BluePointDigital/smart-memory/main/install.sh | bash\n```\n\n### Manual\n```bash\ngit clone https://github.com/BluePointDigital/smart-memory.git\ncd smart-memory/smart-memory && npm install\n```\n\n## 🎯 How It Works\n\n### Dual Retrieval Modes\n\n```\nUser searches\n      │\n      ▼\n┌─────────────┐\n│  Fast Mode? │\n└──────┬──────┘\n   Yes │    │ No (Focus Mode)\n      ▼     ▼\n┌────────┐ ┌─────────────┐\n│ Vector │ │ Retrieve 20+│\n│ Search │ │ chunks      │\n└────┬───┘ └──────┬──────┘\n     │            ▼\n     │     ┌─────────────┐\n     │     │ Rank &      │\n     │     │ Synthesize  │\n     │     └──────┬──────┘\n     │            ▼\n     │     ┌─────────────┐\n     │     │ Curated     │\n     │     │ Narrative   │\n     └─────┴──────┬──────┘\n                  ▼\n           ┌────────────┐\n           │  Results   │\n           └────────────┘\n```\n\n### Zero Config Philosophy\n1. **Install** → Works immediately (built-in fallback)\n2. **Sync** → Gets better (vector embeddings)\n3. **Choose mode** → Fast for speed, Focus for depth\n4. **Use** → Always best available\n\n## 🎛️ Toggle Modes\n\n```bash\n# Enable Focus mode (curated retrieval)\nnode smart-memory/smart_memory.js --focus\n\n# Disable Focus mode (back to fast)\nnode smart-memory/smart_memory.js --unfocus\n\n# Check current mode\nnode smart-memory/smart_memory.js --mode\n```\n\n## 📊 Before & After\n\n| Query | Without Skill | With Skill (Fast) | With Skill (Focus) |\n|-------|--------------|-------------------|-------------------|\n| \"User collaboration style\" | ⚠️ Weak | ✅ Better | ✅ \"work with me, not just for me\" + context |\n| \"What did we decide?\" | ⚠️ Scattered | ✅ Related chunks | ✅ Synthesized decision narrative |\n| \"Compare options A and B\" | ⚠️ Manual work | ✅ Related hits | ✅ Structured comparison with sources |\n\n## 🛠️ Usage\n\n### In OpenClaw\n\n```javascript\n// Fast search (default)\nconst results = await memory_search(\"deployment config\", 5);\n\n// Enable focus for complex queries\nmemory_mode('focus');\nconst deepResults = await memory_search(\"architecture decisions\", 5);\n// Returns: { synthesis, facts, sources, confidence }\n```\n\n### CLI\n\n```bash\n# Search (uses current mode)\nnode smart-memory/smart_memory.js --search \"your query\"\n\n# Search with mode override\nnode smart-memory/smart_memory.js --search \"your query\" --focus\nnode smart-memory/smart_memory.js --search \"your query\" --fast\n\n# Toggle modes\nnode smart-memory/smart_memory.js --focus      # Enable focus\nnode smart-memory/smart_memory.js --unfocus    # Disable focus\n\n# Check status\nnode smart-memory/smart_memory.js --status\n```\n\n## 📁 What's Included\n\n```\nsmart-memory/\n├── smart_memory.js        ← Main entry (auto-selects mode)\n├── focus_agent.js         ← Curated retrieval engine\n├── memory_mode.js         ← Mode toggle commands\n├── db.js                  ← SQLite + hybrid search\n├── memory.js              ← OpenClaw wrapper\n├── package.json           ← Dependencies\n└── references/\n    ├── integration.md     ← Setup guide\n    └── pgvector.md        ← Scale guide\n\nskills/\n└── vector-memory/         ← OpenClaw skill manifest\n    ├── skill.json\n    └── README.md\n```\n\n## 🔧 Requirements\n\n- Node.js 18+\n- ~80MB disk space (for model, cached after download)\n- OpenClaw (or any Node.js agent)\n\n## 🎛️ Tools\n\n| Tool | Purpose |\n|------|---------|\n| `memory_search` | Smart search with mode awareness |\n| `memory_get` | Retrieve full content |\n| `memory_sync` | Index for vector search |\n| `memory_mode` | Toggle fast/focus modes |\n| `memory_status` | Check mode and database stats |\n\n## 🔄 Auto-Sync (Optional)\n\nAdd to `HEARTBEAT.md`:\n```bash\nif [ -n \"$(find memory MEMORY.md -newer smart-memory/.last_sync 2>/dev/null)\" ]; then\n    node smart-memory/smart_memory.js --sync && touch smart-memory/.last_sync\nfi\n```\n\n## 📈 Performance\n\n| Mode | Quality | Speed | Best For |\n|------|---------|-------|----------|\n| Fast | ⭐⭐⭐⭐ | ~10ms | Quick lookups, facts |\n| Focus | ⭐⭐⭐⭐⭐ | ~100ms | Decisions, synthesis, planning |\n\n## 🐛 Troubleshooting\n\n| Issue | Solution |\n|-------|----------|\n| **\"Vector not ready\"** | Run: `node smart_memory.js --sync` |\n| **No results found** | Check that MEMORY.md exists; try broader query |\n| **First sync slow** | Normal - downloading ~80MB model; subsequent syncs fast |\n| **Focus mode too slow** | Switch to fast: `node smart_memory.js --unfocus` |\n| **Want pure built-in?** | Don't sync - built-in always available as fallback |\n\n## 🧪 Verify Installation\n\n```bash\nnode smart-memory/smart_memory.js --status\n```\n\nChecks: dependencies, vector index, search functionality, memory files, current mode.\n\n## 📋 For Agent Developers\n\nAdd to your `AGENTS.md`:\n```markdown\n## Memory Recall\nBefore answering about prior work, decisions, preferences:\n1. Run memory_search with relevant query\n2. Use memory_get for full context\n3. Enable focus mode for complex decisions: memory_mode('focus')\n4. If low confidence, say you checked\n```\n\nSee full template in `AGENTS.md`.\n\n## 🗂️ Suggested Memory Structure\n\n```\nworkspace/\n├── MEMORY.md              # Curated long-term memory\n└── memory/\n    ├── logs/              # Daily activity (YYYY-MM-DD.md)\n    ├── projects/          # Project-specific notes\n    ├── decisions/         # Important choices\n    └── lessons/           # Mistakes learned\n```\n\nSee `MEMORY_STRUCTURE.md` for templates.\n\n## 🔗 Links\n\n- **GitHub**: https://github.com/BluePointDigital/smart-memory\n- **ClawHub**: https://clawhub.ai/BluePointDigital/smart-memory\n- **Issues**: https://github.com/BluePointDigital/smart-memory/issues\n\n## 📜 License\n\nMIT\n\n## 🙏 Acknowledgments\n\n- Embeddings: [Xenova Transformers](https://github.com/xenova/transformers.js)\n- Model: `sentence-transformers/all-MiniLM-L6-v2`\n- Inspired by OpenClaw's memory system and Cognee's knowledge graphs\n\nFile v1.0.1:skills/vector-memory/README.md\n\n# Vector Memory Skill\n\nSmart memory search with **zero configuration**. Automatically uses semantic vector embeddings when available, falls back to built-in search otherwise.\n\n## 🎯 How It Works\n\n```\n┌─────────────────┐\n│  User searches  │\n└────────┬────────┘\n         │\n    ┌────▼────┐\n    │ Vector  │ ←── Semantic understanding\n    │ ready?  │     (synonyms, concepts)\n    └────┬────┘\n    Yes  │  No\n    ┌────┘  └────┐\n    ▼            ▼\n┌────────┐  ┌──────────┐\n│ Vector │  │ Built-in │ ←── Keyword matching\n│ Search │  │ Search   │     (fallback)\n└────────┘  └──────────┘\n    │            │\n    └──────┬─────┘\n           ▼\n    ┌──────────────┐\n    │ Return results│\n    └──────────────┘\n```\n\n**No setup required.** Install the skill and `memory_search` immediately works—just better when you sync.\n\n## 🚀 Installation\n\n### From ClawHub\n```bash\nnpx clawhub install vector-memory\n```\n\n### From GitHub\n```bash\ncurl -sL https://raw.githubusercontent.com/YOUR_USERNAME/vector-memory-openclaw/main/install.sh | bash\n```\n\n### Manual\n```bash\ngit clone https://github.com/YOUR_USERNAME/vector-memory-openclaw.git\ncd vector-memory-openclaw/vector-memory && npm install\n```\n\n## ✨ What You Get\n\n### Immediate (No Sync Required)\n- `memory_search` works with built-in keyword search\n- `memory_get` retrieves full content\n- All standard memory operations functional\n\n### After First Sync (Recommended)\n```bash\nnode vector-memory/smart_memory.js --sync\n```\n\n- **Semantic search** - \"principles\" finds \"values\"\n- **Concept matching** - \"values\" finds \"principles\"\n- **Better relevance** - Neural embeddings understand meaning\n\n## 🛠️ Tools\n\n### memory_search\n**Automatically selects best method**\n\n```javascript\n// Works immediately (uses built-in)\nmemory_search(\"James values\")\n\n// Works better after sync (uses vector)\nmemory_search(\"James values\")  // Same call, better results!\n```\n\n**Parameters:**\n- `query` (string): What to search for\n- `max_results` (number): Max results (default: 5)\n\n**Returns:** Array of matches with path, lines, score, snippet\n\n### memory_get\nGet full content from a file.\n\n```javascript\nmemory_get(\"MEMORY.md\", 1, 20)  // Get lines 1-20\n```\n\n### memory_sync\nIndex memory files for vector search.\n\n```bash\nnode vector-memory/smart_memory.js --sync\n```\n\nRun this after editing memory files.\n\n### memory_status\nCheck which method is active.\n\n```bash\nnode vector-memory/smart_memory.js --status\n```\n\n## 📊 Comparison\n\n| Query | Before (Built-in) | After (Vector) |\n|-------|------------------|----------------|\n| \"James principles\" | ⚠️ Weak matches | ✅ \"What He Values\" section |\n| \"Nyx origin\" | ⚠️ Literal match | ✅ \"The Transfer\" section |\n| \"values beliefs\" | ⚠️ Weak match | ✅ Strong semantic match |\n\n**Same function call. Better results after sync.**\n\n## 🔧 How to Use\n\n### In OpenClaw\nJust use `memory_search` normally:\n\n```javascript\n// This automatically uses best available method\nconst results = await memory_search(\"what did we discuss about projects\");\n```\n\n### CLI\n```bash\n# Search (auto-selects method)\nnode vector-memory/smart_memory.js --search \"your query\"\n\n# Force check status\nnode vector-memory/smart_memory.js --status\n\n# Sync for better results\nnode vector-memory/smart_memory.js --sync\n```\n\n## 🔄 Auto-Sync (Optional)\n\nAdd to `HEARTBEAT.md`:\n```bash\n# Sync memory if files changed\nif [ -n \"$(find memory MEMORY.md -newer vector-memory/.last_sync 2>/dev/null)\" ]; then\n    node vector-memory/smart_memory.js --sync\n    touch vector-memory/.last_sync\nfi\n```\n\n## 📁 File Structure\n\n```\nvector-memory/\n├── smart_memory.js           ← Main entry (auto-selects method)\n├── vector_memory_local.js    ← Vector implementation\n├── memory.js                 ← OpenClaw wrapper\n└── package.json\n```\n\n**You only need to call `smart_memory.js`** - it handles everything.\n\n## 🎯 Zero-Config Philosophy\n\n1. **Install** → Works immediately (built-in fallback)\n2. **Sync** → Gets better (vector embeddings)\n3. **Use** → Always best available method\n\nNo configuration files. No environment variables. No manual switching.\n\n## 🐛 Troubleshooting\n\n**\"Vector not ready\" in status**\n- Normal on first install. Run `--sync` to index.\n\n**Search returns few results**\n- May be using built-in fallback. Run `--sync` for vector search.\n\n**First sync is slow**\n- Downloads ~80MB model. Subsequent syncs are fast.\n\n**Want to force built-in search?**\n- Just don't sync. Built-in is always available as fallback.\n\n## 📈 Performance\n\n| Method | Quality | Speed | Requirements |\n|--------|---------|-------|--------------|\n| Vector | ⭐⭐⭐⭐⭐ | ~100ms | Synced index |\n| Built-in | ⭐⭐⭐ | ~10ms | None (fallback) |\n\nVector is used automatically when available. Built-in is instant fallback.\n\n## 📝 Version History\n\n- **v2.1.0** - Smart wrapper with automatic fallback\n- **v2.0.0** - 100% local embeddings\n- **v1.0.0** - Initial release\n\n## 🤝 Contributing\n\nPRs welcome! Particularly:\n- Better fallback algorithms\n- Additional storage backends\n- Framework integrations\n\n## 📜 License\n\nMIT\n\nFile v1.0.1:_meta.json\n\n{\n  \"ownerId\": \"kn79jnjmwnh2n88m8qh12jdhcn80jh1m\",\n  \"slug\": \"smart-memory\",\n  \"version\": \"1.0.1\",\n  \"publishedAt\": 1770398343710\n}\n\nFile v1.0.1:smart-memory/references/integration.md\n\n# Integration Guide\n\n## For OpenClaw Agents\n\n### Method 1: Skill Installation\n\n1. Copy `skills/vector-memory/` to your agent's `skills/` directory\n2. Copy `vector-memory/` implementation folder\n3. Install dependencies: `cd vector-memory && npm install`\n4. Index memory: `node vector_memory_local.js --sync`\n5. Use via skill system\n\n### Method 2: Direct Tool Replacement\n\nReplace built-in `memory_search` with:\n\n```javascript\n// In your agent's tools configuration\n{\n  \"name\": \"memory_search\",\n  \"command\": \"node /path/to/vector-memory/vector_memory_local.js --search {{query}} --max-results {{max_results}}\"\n}\n```\n\n### Method 3: Programmatic\n\n```javascript\nimport { memorySearch, memoryGet, memorySync } from './vector-memory/memory.js';\n\n// Search\nconst results = await memorySearch(\"James values\", 5);\n\n// Get full content\nconst content = memoryGet(\"MEMORY.md\", 1, 20);\n\n// Sync after edits\nmemorySync();\n```\n\n## For Other Frameworks\n\n### LangChain (Python)\n\n```python\nfrom sentence_transformers import SentenceTransformer\nfrom langchain_community.vectorstores import FAISS\n\nmodel = SentenceTransformer('all-MiniLM-L6-v2')\nembeddings = model.encode(texts)\nvectorstore = FAISS.from_embeddings(embeddings, texts)\n```\n\n### N8N\n\nUse Function node with `@xenova/transformers`:\n```javascript\nconst { pipeline } = require('@xenova/transformers');\nconst embedder = await pipeline('feature-extraction', 'Xenova/all-MiniLM-L6-v2');\nconst embedding = await embedder(query, { pooling: 'mean' });\n```\n\n### Custom Agents\n\nCore pattern:\n1. Load model: `SentenceTransformer('all-MiniLM-L6-v2')`\n2. Embed chunks: `model.encode(chunks)`\n3. Store: JSON, SQLite, or vector DB\n4. Search: Cosine similarity between query and stored embeddings\n5. Return: Full content from source files\n\n## Environment Setup\n\n### Required\n- Node.js 18+ (for OpenClaw version)\n- npm or yarn\n\n### Optional\n- Docker (for pgvector version)\n- OpenAI API key (for pgvector version)\n\n## Directory Structure\n\n```\nworkspace/\n├── skills/\n│   └── vector-memory/          # Skill manifest\n│       ├── skill.json\n│       └── README.md\n├── vector-memory/              # Implementation\n│   ├── vector_memory_local.js  # Local embeddings\n│   ├── memory.js               # OpenClaw wrapper\n│   ├── package.json\n│   └── node_modules/\n├── memory/                     # Your memory files\n│   └── *.md\n└── MEMORY.md                   # Main memory file\n```\n\n## Sharing Between Agents\n\nShareable:\n- `skill.json`\n- `vector_memory_local.js`\n- `memory.js`\n- `package.json`\n\nNot shareable (agent-specific):\n- `vectors_local.json` (rebuild per agent)\n- `node_modules/` (reinstall per agent)\n- `.cache/transformers/` (model downloads per agent)\n\n## Auto-Sync\n\nAdd to heartbeat or cron:\n```bash\n# Sync if memory files changed\nif [ -n \"$(find memory MEMORY.md -newer vector-memory/.last_sync 2>/dev/null)\" ]; then\n    node vector-memory/vector_memory_local.js --sync\n    touch vector-memory/.last_sync\nfi\n```\n\nFile v1.0.1:smart-memory/references/pgvector.md\n\n# pgvector Version\n\nFor large-scale deployments (>1000 chunks) or team use, use the pgvector version with PostgreSQL.\n\n## Prerequisites\n\n- Docker\n- OpenAI API key (for embeddings)\n\n## Setup\n\n```bash\n# Start pgvector\ndocker-compose -f docker-compose.yml up -d\n\n# Sync memory\nnode vector_memory.js --sync\n```\n\n## Configuration\n\nEnvironment variables:\n```bash\nexport PG_HOST=localhost\nexport PG_PORT=5433\nexport PG_DATABASE=memory\nexport PG_USER=openclaw\nexport PG_PASSWORD=openclaw_memory_2025\nexport OPENAI_API_KEY=sk-...\n```\n\n## Usage\n\nSame CLI as local version:\n```bash\nnode vector_memory.js --search \"query\"\nnode vector_memory.js --sync\nnode vector_memory.js --status\n```\n\n## When to Use\n\n| Scenario | Use |\n|----------|-----|\n| Personal agent | Local version |\n| Team/shared | pgvector version |\n| > 1000 memory chunks | pgvector version |\n| Need real-time sync | pgvector version |\n\n## Migration\n\nTo migrate from local to pgvector:\n1. Set up pgvector (see above)\n2. Run `node vector_memory.js --sync`\n3. Point skill.json to `vector_memory.js` instead of `vector_memory_local.js`\n\nFile v1.0.1:AGENTS.md\n\n## Memory Recall - Vector Memory Skill\n\nBefore answering questions about prior work, decisions, dates, people, preferences, or todos:\n\n1. **Run memory_search** with relevant query\n   ```javascript\n   const results = await memory_search(\"what we discussed about projects\", 5);\n   ```\n\n2. **Use memory_get** to pull full context if needed\n   ```javascript\n   const fullContent = memory_get(\"MEMORY.md\", 1, 20);\n   ```\n\n3. **If low confidence after search**, say you checked\n   > \"I searched my memory but don't see specific notes about this topic.\"\n\n### When to Search\n\n**Always search before:**\n- Answering questions about past conversations\n- Referencing previous decisions\n- Recalling user preferences\n- Continuing work on prior projects\n- Summarizing what was discussed\n\n**Search queries should be:**\n- Natural language (e.g., \"James values and principles\")\n- Conceptual (e.g., \"Nyx origin story\")\n- Not just keywords (semantic search understands meaning)\n\n### How It Works\n\nThis agent uses **vector memory** with automatic fallback:\n\n1. **If synced:** Uses neural embeddings for semantic search\n   - Finds conceptually related content\n   - Understands synonyms (\"principles\" finds \"values\")\n   - Better relevance, more context\n\n2. **If not synced:** Uses built-in keyword search\n   - Works immediately after install\n   - No configuration needed\n   - Graceful fallback\n\n3. **Sync to improve:**\n   ```bash\n   node vector-memory/smart_memory.js --sync\n   ```\n\n### Memory Structure\n\n```\nworkspace/\n├── MEMORY.md              # Curated long-term memory\n└── memory/\n    ├── logs/              # Daily logs (YYYY-MM-DD.md)\n    ├── projects/          # Project-specific notes\n    ├── decisions/         # Important choices\n    └── lessons/           # Mistakes learned\n```\n\n### Verification\n\nTest that memory is working:\n```bash\nnode vector-memory/smart_memory.js --test\n```\n\nExpected: Shows vector status, chunk count, and confirms search functional.\n\n### Troubleshooting\n\n| Issue | Solution |\n|-------|----------|\n| \"Vector not ready\" | Run: `node vector-memory/smart_memory.js --sync` |\n| No results | Check that MEMORY.md or memory/ files exist |\n| First sync slow | Normal - downloading ~80MB model |\n| Search irrelevant | Sync again after editing memory files |\n\n---\n\n*Part of Vector Memory skill for OpenClaw*\n*100% local semantic search with zero configuration*\n\nFile v1.0.1:CHANGELOG.md\n\n# Changelog\n\n## [2.1.1] - 2026-02-05\n\n### Added\n- AGENTS.md template for memory recall instructions\n- MEMORY_STRUCTURE.md with directory organization guide\n- Test script (`--test` command) for verification\n- Troubleshooting table in README\n- Better onboarding documentation\n\n## [2.1.0] - 2026-02-04\n\n### Added\n- Smart wrapper with automatic fallback (vector → built-in)\n- Zero-configuration philosophy\n- Graceful degradation when vector not ready\n\n## [2.0.0] - 2026-02-04\n\n### Added\n- 100% local embeddings using `all-MiniLM-L6-v2` via Transformers.js\n- No API calls required\n- Semantic chunking (by headers, not just lines)\n- Cosine similarity scoring\n- JSON storage for personal-scale use\n- OpenClaw skill manifest\n- Programmatic API wrapper (`memory.js`)\n\n### Changed\n- Replaced word-frequency embeddings with neural embeddings\n- Improved retrieval quality significantly\n- Better chunking strategy (semantic boundaries)\n\n## [1.0.0] - 2026-02-04\n\n### Added\n- Initial version with word-frequency embeddings\n- Simple JSON storage\n- Basic CLI interface\n- pgvector support (Docker-based)\n\n### Notes\n- Word-frequency method works but has limited semantic understanding\n- Neural embeddings (v2) recommended for production use\n\nFile v1.0.1:MEMORY_STRUCTURE.md\n\n# Suggested Memory Structure\n\nKeep your memory organized for better retrieval:\n\n```\nworkspace/\n├── MEMORY.md                 # Curated long-term (the good stuff)\n│   ├── Origin Story\n│   ├── Core Values/Principles\n│   ├── Active Projects\n│   ├── Important Decisions\n│   └── Key Relationships\n│\n└── memory/\n    ├── logs/                 # Daily activity logs\n    │   └── YYYY-MM-DD.md\n    │\n    ├── projects/             # Project-specific context\n    │   ├── project-alpha.md\n    │   └── website-redesign.md\n    │\n    ├── decisions/            # Important choices made\n    │   └── YYYY-MM-decisions.md\n    │\n    ├── lessons/              # Mistakes and learnings\n    │   └── mistakes-learned.md\n    │\n    └── people/               # Contact preferences, context\n        └── contacts.md\n```\n\n## Quick Templates\n\n### Daily Log (memory/logs/YYYY-MM-DD.md)\n```markdown\n# 2026-02-05 — Daily Log\n\n## 09:00 — Project Kickoff\n- Discussed architecture with James\n- Decision: Use React for frontend\n- Follow-up: Research state management\n\n## 14:00 — Code Review\n- Reviewed PR #42\n- Learned: Prefer async/await over callbacks\n```\n\n### Project Note (memory/projects/[name].md)\n```markdown\n# Project Alpha\n\n## Goal\nBuild X to solve Y\n\n## Decisions\n- Tech stack: React + Node\n- Hosting: Vercel\n\n## Status\nIn progress - 60% complete\n\n## Next Steps\n- [ ] Implement auth\n- [ ] Design database schema\n```\n\n### Decision Log (memory/decisions/YYYY-MM.md)\n```markdown\n# February 2026 Decisions\n\n## 2026-02-05 — Frontend Framework\n**Decision:** Use React instead of Vue\n**Context:** Team has more React experience\n**Consequences:** Faster development, easier hiring\n```\n\n## Why This Structure?\n\n| Directory | Purpose | Search Benefit |\n|-----------|---------|----------------|\n| `logs/` | Raw daily activity | \"What did we do Tuesday?\" |\n| `projects/` | Project context | \"What's the status of Alpha?\" |\n| `decisions/` | Important choices | \"Why did we choose React?\" |\n| `lessons/` | Mistakes learned | \"What went wrong last time?\" |\n| `people/` | Contact context | \"What's James's preference?\" |\n\n## Sync After Organizing\n\nAfter restructuring:\n```bash\nnode vector-memory/smart_memory.js --sync\n```\n\nThis re-indexes everything for optimal search.\n\nFile v1.0.1:skills/vector-memory/skill.json\n\n{\n  \"name\": \"vector-memory\",\n  \"version\": \"2.1.1\",\n  \"description\": \"Smart memory search with automatic vector fallback. Uses semantic embeddings when available, falls back to built-in search otherwise. Zero configuration - works immediately after install.\",\n  \"author\": \"Nyx\",\n  \"tools\": [\n    {\n      \"name\": \"memory_search\",\n      \"description\": \"Search memory files with automatic method selection. Uses vector embeddings (semantic search) if indexed, otherwise falls back to built-in keyword search. Zero configuration required.\",\n      \"command\": \"node {{workspace}}/vector-memory/smart_memory.js --search \\\"{{query}}\\\" --max-results {{max_results|5}}\",\n      \"args\": {\n        \"query\": {\n          \"type\": \"string\",\n          \"description\": \"The search query - natural language, concepts, or keywords\",\n          \"required\": true\n        },\n        \"max_results\": {\n          \"type\": \"number\",\n          \"description\": \"Maximum number of results to return\",\n          \"default\": 5\n        }\n      }\n    },\n    {\n      \"name\": \"memory_get\",\n      \"description\": \"Get full content from a memory file by path and line range.\",\n      \"command\": \"node {{workspace}}/vector-memory/smart_memory.js --get \\\"{{file_path}}\\\" {{from_line}} {{line_count}}\",\n      \"args\": {\n        \"file_path\": {\n          \"type\": \"string\",\n          \"description\": \"Path to memory file (e.g., MEMORY.md or memory/2026-02-04.md)\",\n          \"required\": true\n        },\n        \"from_line\": {\n          \"type\": \"number\",\n          \"description\": \"Starting line number (1-indexed)\",\n          \"required\": true\n        },\n        \"line_count\": {\n          \"type\": \"number\",\n          \"description\": \"Number of lines to retrieve\",\n          \"required\": true\n        }\n      }\n    },\n    {\n      \"name\": \"memory_sync\",\n      \"description\": \"Sync memory files to vector index for better search quality. Run after editing memory files.\",\n      \"command\": \"node {{workspace}}/vector-memory/smart_memory.js --sync\"\n    },\n    {\n      \"name\": \"memory_status\",\n      \"description\": \"Check memory system status - vector index ready, chunks indexed, last sync time.\",\n      \"command\": \"node {{workspace}}/vector-memory/smart_memory.js --status\"\n    }\n  ]\n}\n\nFile v1.0.1:smart-memory/package.json\n\n{\n  \"name\": \"vector-memory-local\",\n  \"version\": \"1.0.0\",\n  \"description\": \"100% local vector memory using transformers.js embeddings\",\n  \"main\": \"vector_memory_local.js\",\n  \"type\": \"module\",\n  \"dependencies\": {\n    \"@xenova/transformers\": \"^2.17.2\"\n  }\n}","readmeExcerpt":"Skill: Smart Memory Owner: BluePointDigital Summary: Context-aware memory for AI agents with dual retrieval modes — fast vector search or curated Focus Agent synthesis. SQLite backend, zero configuration, local embeddings. Tags: latest:2.1.2 Version history: v2.1.2 | 2026-02-06T17:35:01.716Z | user - Added six new JavaScript module files: chunker.js, embed.js, hot_memory.js, memory_bridge.js, search.js, and session_m","codeSnippets":[],"executableExamples":[{"language":"bash","snippet":"npx clawhub install smart-memory"},{"language":"bash","snippet":"node smart-memory/smart_memory.js --sync"},{"language":"bash","snippet":"node smart-memory/smart_memory.js --search \"James values principles\""},{"language":"bash","snippet":"node smart-memory/smart_memory.js --focus\nnode smart-memory/smart_memory.js --search \"complex decision about project direction\""},{"language":"bash","snippet":"node smart-memory/smart_memory.js --unfocus"},{"language":"bash","snippet":"node smart-memory/smart_memory.js --search \"git remote\""}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: smart-memory\ndescription: Context-aware memory for AI agents with dual retrieval modes — fast vector search or curated Focus Agent synthesis. SQLite backend, zero configuration, local embeddings.\n---\n\n# Smart Memory v2.1 - Focus Agent Edition\n\n**Drop-in replacement for OpenClaw's memory system** with superior search quality and optional curated retrieval via Focus Agent.\n\n## Features\n\n- **Hybrid Search**: Combines FTS5 keyword search (BM25) with semantic vector search\n- **Focus Agent**: Multi-pass curation for complex queries (retrieve → rank → synthesize)\n- **Dual Modes**: Fast (direct) or Focus (curated) — toggle anytime\n- **SQLite Backend**: Single-file database, no external services\n- **100% Local**: Embeddings run locally with Transformers.js (no API keys)\n- **Auto-Optimization**: Uses sqlite-vec when available for native vector ops\n- **Zero Configuration**: Works immediately after install\n\n## Installation\n\n```bash\nnpx clawhub install smart-memory\n```\n\nOr from ClawHub: https://clawhub.ai/BluePointDigital/smart-memory\n\n## Quick Start\n\n### 1. Sync Memory\n```bash\nnode smart-memory/smart_memory.js --sync\n```\n\n### 2. Search (Fast Mode - Default)\n```bash\nnode smart-memory/smart_memory.js --search \"James values principles\"\n```\n\n### 3. Enable Focus Mode (Curated Retrieval)\n```bash\nnode smart-memory/smart_memory.js --focus\nnode smart-memory/smart_memory.js --search \"complex decision about project direction\"\n```\n\n### 4. Disable Focus Mode\n```bash\nnode smart-memory/smart_memory.js --unfocus\n```\n\n## Search Modes\n\n### Fast Mode (Default)\nDirect vector similarity search. Best for:\n- Simple lookups\n- Quick fact retrieval\n- Routine queries\n\n```bash\nnode smart-memory/smart_memory.js --search \"git remote\"\n```\n\n### Focus Mode (Curated)\nMulti-pass curation via Focus Agent. Best for:\n- Complex decisions\n- Multi-fact synthesis\n- Planning and strategy\n- Comparing options\n\n```bash\nnode smart-memory/smart_memory.js --focus\nnode smart-memory/smart_memory.js --search \"What did we decide about BluePointDigital architecture?\"\n```\n\n**How Focus Mode Works:**\n1. **Retrieve** 20+ chunks (broad net)\n2. **Rank** by weighted relevance (vector + term matching + source boost)\n3. **Synthesize** into coherent narrative\n4. **Deliver** structured context with confidence scores\n\n## How It Works\n\n### Hybrid Search Algorithm\n\n1. **FTS5** finds exact keyword matches (BM25 ranking)\n2. **Vector search** finds semantic matches (cosine similarity)\n3. **Merged results** using weighted scoring:\n   - 70% vector score + 30% keyword score\n   - Catches both \"what you mean\" and \"exact tokens\"\n\n### Focus Agent Curation\n\nWhen enabled, searches go through additional processing:\n\n```\nQuery: \"What did we decide about BluePointDigital?\"\n\n┌─────────────────┐\n│  Retrieve 20+   │  ← Vector similarity\n│    chunks       │\n└────────┬────────┘\n         ▼\n┌─────────────────┐\n│   Weighted      │  ← Term matching\n│    Ranking      │    Source boosting\n│                 │    Recency boost\n└────────┬─────"},{"path":"README.md","content":"# Smart Memory for OpenClaw\n\n**Context-aware memory system with dual retrieval modes** — fast vector search when you need speed, curated Focus Agent when you need depth.\n\n```bash\n# Install and it just works\nnpx clawhub install smart-memory\n\n# Optional: sync for better quality\nnode smart-memory/smart_memory.js --sync\n```\n\n## ✨ The Magic\n\n**Same function call. Two modes. You choose.**\n\n```javascript\n// Fast mode (default): Direct vector search\nmemory_search(\"User principles values\")\n\n// Focus mode: Multi-pass curation for complex decisions\nmemory_mode('focus')\nmemory_search(\"What did we decide about the architecture?\")\n```\n\n| Mode | Best For | How It Works |\n|------|----------|--------------|\n| **Fast** | Quick lookups, facts | Direct vector similarity (~10ms) |\n| **Focus** | Decisions, synthesis | Retrieve → Rank → Synthesize (~100ms) |\n\n## 🚀 Quick Start\n\n### From ClawHub (Recommended)\n```bash\nnpx clawhub install smart-memory\n```\nDone. `memory_search` now works with automatic mode selection.\n\n### From GitHub\n```bash\ncurl -sL https://raw.githubusercontent.com/BluePointDigital/smart-memory/main/install.sh | bash\n```\n\n### Manual\n```bash\ngit clone https://github.com/BluePointDigital/smart-memory.git\ncd smart-memory/smart-memory && npm install\n```\n\n## 🎯 How It Works\n\n### Dual Retrieval Modes\n\n```\nUser searches\n      │\n      ▼\n┌─────────────┐\n│  Fast Mode? │\n└──────┬──────┘\n   Yes │    │ No (Focus Mode)\n      ▼     ▼\n┌────────┐ ┌─────────────┐\n│ Vector │ │ Retrieve 20+│\n│ Search │ │ chunks      │\n└────┬───┘ └──────┬──────┘\n     │            ▼\n     │     ┌─────────────┐\n     │     │ Rank &      │\n     │     │ Synthesize  │\n     │     └──────┬──────┘\n     │            ▼\n     │     ┌─────────────┐\n     │     │ Curated     │\n     │     │ Narrative   │\n     └─────┴──────┬──────┘\n                  ▼\n           ┌────────────┐\n           │  Results   │\n           └────────────┘\n```\n\n### Zero Config Philosophy\n1. **Install** → Works immediately (built-in fallback)\n2. **Sync** → Gets better (vector embeddings)\n3. **Choose mode** → Fast for speed, Focus for depth\n4. **Use** → Always best available\n\n## 🎛️ Toggle Modes\n\n```bash\n# Enable Focus mode (curated retrieval)\nnode smart-memory/smart_memory.js --focus\n\n# Disable Focus mode (back to fast)\nnode smart-memory/smart_memory.js --unfocus\n\n# Check current mode\nnode smart-memory/smart_memory.js --mode\n```\n\n## 📊 Before & After\n\n| Query | Without Skill | With Skill (Fast) | With Skill (Focus) |\n|-------|--------------|-------------------|-------------------|\n| \"User collaboration style\" | ⚠️ Weak | ✅ Better | ✅ \"work with me, not just for me\" + context |\n| \"What did we decide?\" | ⚠️ Scattered | ✅ Related chunks | ✅ Synthesized decision narrative |\n| \"Compare options A and B\" | ⚠️ Manual work | ✅ Related hits | ✅ Structured comparison with sources |\n\n## 🛠️ Usage\n\n### In OpenClaw\n\n```javascript\n// Fast search (default)\nconst results = await memory_search(\"deployment config\", 5);\n\n// Enable focus for complex queries\nm"},{"path":"skills/vector-memory/README.md","content":"# Vector Memory Skill\n\nSmart memory search with **zero configuration**. Automatically uses semantic vector embeddings when available, falls back to built-in search otherwise.\n\n## 🎯 How It Works\n\n```\n┌─────────────────┐\n│  User searches  │\n└────────┬────────┘\n         │\n    ┌────▼────┐\n    │ Vector  │ ←── Semantic understanding\n    │ ready?  │     (synonyms, concepts)\n    └────┬────┘\n    Yes  │  No\n    ┌────┘  └────┐\n    ▼            ▼\n┌────────┐  ┌──────────┐\n│ Vector │  │ Built-in │ ←── Keyword matching\n│ Search │  │ Search   │     (fallback)\n└────────┘  └──────────┘\n    │            │\n    └──────┬─────┘\n           ▼\n    ┌──────────────┐\n    │ Return results│\n    └──────────────┘\n```\n\n**No setup required.** Install the skill and `memory_search` immediately works—just better when you sync.\n\n## 🚀 Installation\n\n### From ClawHub\n```bash\nnpx clawhub install vector-memory\n```\n\n### From GitHub\n```bash\ncurl -sL https://raw.githubusercontent.com/YOUR_USERNAME/vector-memory-openclaw/main/install.sh | bash\n```\n\n### Manual\n```bash\ngit clone https://github.com/YOUR_USERNAME/vector-memory-openclaw.git\ncd vector-memory-openclaw/vector-memory && npm install\n```\n\n## ✨ What You Get\n\n### Immediate (No Sync Required)\n- `memory_search` works with built-in keyword search\n- `memory_get` retrieves full content\n- All standard memory operations functional\n\n### After First Sync (Recommended)\n```bash\nnode vector-memory/smart_memory.js --sync\n```\n\n- **Semantic search** - \"principles\" finds \"values\"\n- **Concept matching** - \"values\" finds \"principles\"\n- **Better relevance** - Neural embeddings understand meaning\n\n## 🛠️ Tools\n\n### memory_search\n**Automatically selects best method**\n\n```javascript\n// Works immediately (uses built-in)\nmemory_search(\"James values\")\n\n// Works better after sync (uses vector)\nmemory_search(\"James values\")  // Same call, better results!\n```\n\n**Parameters:**\n- `query` (string): What to search for\n- `max_results` (number): Max results (default: 5)\n\n**Returns:** Array of matches with path, lines, score, snippet\n\n### memory_get\nGet full content from a file.\n\n```javascript\nmemory_get(\"MEMORY.md\", 1, 20)  // Get lines 1-20\n```\n\n### memory_sync\nIndex memory files for vector search.\n\n```bash\nnode vector-memory/smart_memory.js --sync\n```\n\nRun this after editing memory files.\n\n### memory_status\nCheck which method is active.\n\n```bash\nnode vector-memory/smart_memory.js --status\n```\n\n## 📊 Comparison\n\n| Query | Before (Built-in) | After (Vector) |\n|-------|------------------|----------------|\n| \"James principles\" | ⚠️ Weak matches | ✅ \"What He Values\" section |\n| \"Nyx origin\" | ⚠️ Literal match | ✅ \"The Transfer\" section |\n| \"values beliefs\" | ⚠️ Weak match | ✅ Strong semantic match |\n\n**Same function call. Better results after sync.**\n\n## 🔧 How to Use\n\n### In OpenClaw\nJust use `memory_search` normally:\n\n```javascript\n// This automatically uses best available method\nconst results = await memory_search(\"what did we discuss about projects\");\n```\n\n### CLI\n```ba"},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn79jnjmwnh2n88m8qh12jdhcn80jh1m\",\n  \"slug\": \"smart-memory\",\n  \"version\": \"2.1.2\",\n  \"publishedAt\": 1770399301716\n}"},{"path":"smart-memory/references/integration.md","content":"# Integration Guide\n\n## For OpenClaw Agents\n\n### Method 1: Skill Installation\n\n1. Copy `skills/vector-memory/` to your agent's `skills/` directory\n2. Copy `vector-memory/` implementation folder\n3. Install dependencies: `cd vector-memory && npm install`\n4. Index memory: `node vector_memory_local.js --sync`\n5. Use via skill system\n\n### Method 2: Direct Tool Replacement\n\nReplace built-in `memory_search` with:\n\n```javascript\n// In your agent's tools configuration\n{\n  \"name\": \"memory_search\",\n  \"command\": \"node /path/to/vector-memory/vector_memory_local.js --search {{query}} --max-results {{max_results}}\"\n}\n```\n\n### Method 3: Programmatic\n\n```javascript\nimport { memorySearch, memoryGet, memorySync } from './vector-memory/memory.js';\n\n// Search\nconst results = await memorySearch(\"James values\", 5);\n\n// Get full content\nconst content = memoryGet(\"MEMORY.md\", 1, 20);\n\n// Sync after edits\nmemorySync();\n```\n\n## For Other Frameworks\n\n### LangChain (Python)\n\n```python\nfrom sentence_transformers import SentenceTransformer\nfrom langchain_community.vectorstores import FAISS\n\nmodel = SentenceTransformer('all-MiniLM-L6-v2')\nembeddings = model.encode(texts)\nvectorstore = FAISS.from_embeddings(embeddings, texts)\n```\n\n### N8N\n\nUse Function node with `@xenova/transformers`:\n```javascript\nconst { pipeline } = require('@xenova/transformers');\nconst embedder = await pipeline('feature-extraction', 'Xenova/all-MiniLM-L6-v2');\nconst embedding = await embedder(query, { pooling: 'mean' });\n```\n\n### Custom Agents\n\nCore pattern:\n1. Load model: `SentenceTransformer('all-MiniLM-L6-v2')`\n2. Embed chunks: `model.encode(chunks)`\n3. Store: JSON, SQLite, or vector DB\n4. Search: Cosine similarity between query and stored embeddings\n5. Return: Full content from source files\n\n## Environment Setup\n\n### Required\n- Node.js 18+ (for OpenClaw version)\n- npm or yarn\n\n### Optional\n- Docker (for pgvector version)\n- OpenAI API key (for pgvector version)\n\n## Directory Structure\n\n```\nworkspace/\n├── skills/\n│   └── vector-memory/          # Skill manifest\n│       ├── skill.json\n│       └── README.md\n├── vector-memory/              # Implementation\n│   ├── vector_memory_local.js  # Local embeddings\n│   ├── memory.js               # OpenClaw wrapper\n│   ├── package.json\n│   └── node_modules/\n├── memory/                     # Your memory files\n│   └── *.md\n└── MEMORY.md                   # Main memory file\n```\n\n## Sharing Between Agents\n\nShareable:\n- `skill.json`\n- `vector_memory_local.js`\n- `memory.js`\n- `package.json`\n\nNot shareable (agent-specific):\n- `vectors_local.json` (rebuild per agent)\n- `node_modules/` (reinstall per agent)\n- `.cache/transformers/` (model downloads per agent)\n\n## Auto-Sync\n\nAdd to heartbeat or cron:\n```bash\n# Sync if memory files changed\nif [ -n \"$(find memory MEMORY.md -newer vector-memory/.last_sync 2>/dev/null)\" ]; then\n    node vector-memory/vector_memory_local.js --sync\n    touch vector-memory/.last_sync\nfi\n```"}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":"Context-aware memory for AI agents with dual retrieval modes — fast vector search or curated Focus Agent synthesis. SQLite backend, zero configuration, local embeddings. Skill: Smart Memory Owner: BluePointDigital Summary: Context-aware memory for AI agents with dual retrieval modes — fast vector search or curated Focus Agent synthesis. SQLite backend, zero configuration, local embeddings. Tags: latest:2.1.2 Version history: v2.1.2 | 2026-02-06T17:35:01.716Z | user - Added six new JavaScript module files: chunker.js, embed.js, hot_memory.js, memory_bridge.js, search.js, and session_m","editorialQuality":{"score":100,"threshold":65,"status":"ready","wordCount":1310,"uniquenessScore":45,"reasons":[]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-04-15T00:45:39.800Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-04-15T00:45:39.800Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-09T06:17:13.307Z","emptyReason":null},"items":[{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-10T18:48:31.762Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/clawhub","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}