π Drop-in replacement for broken built-in memory_search | Fix "API key not found" errors
β memory_search failed: OpenAI API key not found
β memory_search error: Google API key missing
β memory_search tool failed with status 500
β Cannot search memory files - API key required
β memory_search not working in OpenClaw
β All fixed with QMS Memory Search - works offline, no API keys needed!
OpenClaw's built-in memory_search fails when OpenAI/Google API keys are missing, leaving agents unable to search their memory files. Common issues include:
- memory_search failing with API key errors
- Cannot search memory files due to missing credentials
- memory_search tool failed in OpenClaw installations
- memory search not working without external API setup
This affects many users who don't have or want to configure external API keys for basic memory search functionality.
QMS Memory Search provides a local, offline alternative using TF-IDF ranking for intelligent search relevance. No API keys required!
- π TF-IDF Search Ranking - Smart relevance scoring, not just keyword matching
- β‘ Lightning Fast - <10ms queries vs 500ms+ API calls
- π Auto-Indexing - Rebuilds when memory files change
- π Fully Offline - No API keys or external dependencies required
- π Compatible API - Drop-in replacement, same result format
- π― Context-Aware - Returns line numbers and snippets for precise results
-
Install the skill:
# Download or clone this repo to your OpenClaw skills directory git clone https://github.com/bsharpe/openclaw-qms-memory.git skills/qms-memory -
Test installation:
cd skills/qms-memory node test.js -
Use in your agent:
import { searchMemory } from './skills/qms-memory/index.js'; // Search memory files const results = await searchMemory("security best practices"); // Each result contains: // { // path: "/path/to/memory/file.md", // score: 0.234, // lineNumbers: [15, 16, 17], // snippets: ["Context around matches..."] // }
Automatically finds and indexes:
MEMORY.md(main memory file)memory/*.md(daily notes and organized memories)- Any markdown files in memory directories
// OLD: Failing built-in version
const results = await memory_search("query");
// NEW: Working QMS version
import { searchMemory } from './skills/qms-memory/index.js';
const results = await searchMemory("query");Disable the broken built-in search to stop API key errors:
{
"memorySearch": {
"sources": []
}
}Then restart OpenClaw:
openclaw gateway restart| Metric | Built-in memory_search | QMS Memory Search |
|---|---|---|
| Reliability | β Fails without API keys | β Always works |
| Speed | β 500ms+ API calls | β <10ms queries |
| Ranking | β Simple text matching | β TF-IDF relevance |
| Dependencies | β External APIs required | β Fully offline |
| Setup | β API key configuration | β Zero configuration |
import { searchMemory, getMemorySearchStatus, rebuildMemoryIndex } from './skills/qms-memory/index.js';
// Check system status
const status = await getMemorySearchStatus();
console.log(status);
// { ready: true, docCount: 12, indexSize: 1500, watching: true }
// Search with automatic relevance ranking
const results = await searchMemory("prompt injection security");
console.log(`Found ${results.length} relevant documents`);
// Force index rebuild if needed
await rebuildMemoryIndex();Search memory files with TF-IDF ranking.
Parameters:
query(string) - Search queryoptions(object, optional)limit(number) - Max results to return (default: 10)scoreThreshold(number) - Minimum relevance score (default: 0.01)
Returns: Array of search results with path, score, lineNumbers, snippets
Get current system status.
Returns: Object with ready, docCount, indexSize, watching
Force rebuild of search index.
Returns: Object with success status and updated stats
- Replace built-in memory_search with QMS:
import { searchMemory } from './skills/qms-memory/index.js'; - Disable broken built-in:
{"memorySearch": {"sources": []}}
- QMS Memory Search requires no API keys - works completely offline
- Zero configuration needed - just install and use
- Ensure memory files exist (
MEMORY.md,memory/*.md) in workspace root - Check that files contain the terms you're searching for
- Try
await rebuildMemoryIndex()to force refresh
- File watcher auto-rebuilds with 2s debounce
- Restart OpenClaw if file watching seems stuck
- Manual rebuild:
await rebuildMemoryIndex()
- Ensure write access to skill directory for index file
- Check Node.js file system permissions
Privacy: Your memory files never leave your machine
Reliability: No network dependencies or API rate limits
Speed: Local TF-IDF indexing beats remote API calls
Cost: No API usage fees or token consumption
Control: Full control over indexing and search behavior
OpenClaw memory search broken | memory_search failing | memory search fix | OpenClaw API key error | memory_search not working | local memory search | offline memory search | TF-IDF search OpenClaw | memory_search alternative | no API key memory search | OpenClaw memory search replacement | memory search without API keys
Contributions welcome! This skill helps the entire OpenClaw community.
- Report bugs via GitHub Issues
- Suggest features for memory search improvements
- Submit PRs for optimizations and fixes
- Share usage patterns that could benefit others
MIT License - Free for personal and commercial use.
- OpenClaw: https://openclaw.ai
- Documentation: https://docs.openclaw.ai
- Community: https://discord.com/invite/clawd
- Skills Hub: https://clawhub.com
π Enjoy reliable, fast memory search without API dependencies!
Built by the OpenClaw community, for the OpenClaw community.