Verified memory for AI agents - Detect lies, prevent forgetting
Claw-Memory solves two critical problems with AI agents:
| Problem | What happens | Solution |
|---|---|---|
| π€₯ Lying | Agent claims "done" but didn't actually do it | Verify claims against real evidence |
| π΅ Forgetting | Agent loses context across conversations | Persistent memory with semantic search |
One command to install:
curl -fsSL https://raw.githubusercontent.com/tuantabit/claw-memory/main/install.sh | bashOne command to uninstall:
curl -fsSL https://raw.githubusercontent.com/tuantabit/claw-memory/main/uninstall.sh | bash# Clone and build
git clone https://github.com/tuantabit/claw-memory.git
cd claw-memory
npm install
npm run build
# Install to OpenClaw
npm run install-plugin- OpenClaw (any version)
- Node.js 22.5.0+ (uses built-in
node:sqlite) - npm or yarn
After installation, the plugin is automatically configured in ~/.openclaw/openclaw.json:
{
"plugins": {
"allow": ["claw-memory"],
"load": {
"paths": ["~/.openclaw/plugins/claw-memory/claw-memory.js"]
},
"entries": {
"claw-memory": {
"enabled": true,
"config": {
"autoVerify": true
}
}
}
}
}| Option | Type | Default | Description |
|---|---|---|---|
enabled |
boolean | true |
Enable/disable plugin |
autoVerify |
boolean | true |
Auto-verify after each response |
enableLLM |
boolean | false |
Use LLM for claim extraction |
trustWarningThreshold |
number | 70 |
Trust score warning threshold (0-100) |
trustBlockThreshold |
number | 30 |
Trust score block threshold (0-100) |
retry.enabled |
boolean | true |
Auto-retry contradicted claims |
retry.maxRetries |
number | 2 |
Max retry attempts |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ANTI-LYING (Verification) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Agent: "I created file.ts" β
β β β
β 1. Extract claim (type: file_created) β
β β β
β 2. Collect evidence (fs.existsSync, git status) β
β β β
β 3. Verify: claim vs evidence β verified/contradicted β
β β β
β 4. If contradicted β retry (max 2 times) β
β β β
β 5. Warn user: β
VERIFIED or β CONTRADICTED β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ANTI-FORGETTING (Memory) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Storage: β
β β’ vectorStore.store() β Semantic embeddings β
β β’ graphService.addEntity() β Knowledge graph β
β β’ timelineService.add() β Temporal timeline β
β β
β Recall: β
β β’ vectorStore.search() β "Find auth-related claims" β
β β’ graphService.findPath() β "How are A and B related?" β
β β’ timelineService.query() β "What did I do yesterday?" β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Claim Type | Example | Evidence Source |
|---|---|---|
file_created |
"I created src/app.ts" | file system check |
file_modified |
"I updated config" | file hash comparison |
file_deleted |
"I removed old.ts" | file existence check |
command_executed |
"I ran npm install" | command output |
test_passed |
"All tests pass" | test runner output |
test_failed |
"Test X fails" | test runner output |
code_added |
"I added function X" | code content search |
code_fixed |
"I fixed the bug" | file + command check |
task_completed |
"Task done" | action verification |
The plugin provides tools that the AI agent can use:
| Tool | Description |
|---|---|
claw-memory_verify |
Verify a specific claim or search claims |
claw-memory_audit |
Get verification history and statistics |
claw-memory_expand |
Expand claim with evidence details |
claw-memory_compact |
Trigger database compaction |
// Store with embedding
const embedding = await embeddingService.embed("Created auth service");
await vectorStore.store(memoryId, sessionId, embedding, "local");
// Search semantically
const results = await vectorStore.search(queryEmbedding, { limit: 5 });
// Returns: [{ memoryId, similarity: 0.85 }, ...]// Entity types: file, function, class, component, command, package, test, error
// Relationships: CONTAINS, IMPORTS, DEPENDS_ON, CALLS, TESTS, FIXES
await graphService.addEntity({ type: "file", name: "src/auth.ts" });
const path = await graphService.findPath(fileId, testId);// Supported: "today", "yesterday", "last week", "3 days ago"
const events = await timelineService.queryByTimeExpression(sessionId, "last week");CLAW_MEMORY_ENABLED=true # Enable/disable plugin
CLAW_MEMORY_AUTO_VERIFY=true # Auto-verify claims
CLAW_MEMORY_ENABLE_LLM=false # Use LLM extraction
CLAW_MEMORY_RETRY_ENABLED=true # Auto-retry on contradiction
CLAW_MEMORY_MAX_RETRIES=2 # Max retry attemptsData is stored in SQLite at ~/.openclaw/claw-memory.db:
-- Claims and verification
claims, evidence, verifications
-- Memory storage
memory_vectors, entities, relationships, temporal_events
-- Context management
messages, summaries, memory_entriesOptional Go-based TUI for database inspection:
cd tui
make build
./claw-memory-tui -db ~/.openclaw/claw-memory.db| Key | Action |
|---|---|
q |
Quit |
j/k |
Navigate |
Enter |
Select |
e |
Evidence |
s |
Search |
Quick uninstall:
curl -fsSL https://raw.githubusercontent.com/tuantabit/claw-memory/main/uninstall.sh | bashOptions:
# Keep database (preserve memory data)
curl -fsSL .../uninstall.sh | bash -s -- --keep-data
# Skip confirmation
curl -fsSL .../uninstall.sh | bash -s -- --forceManual uninstall:
- Remove plugin directory:
rm -rf ~/.openclaw/plugins/claw-memory - Remove from config: Edit
~/.openclaw/openclaw.jsonand remove claw-memory entries - (Optional) Remove database:
rm ~/.openclaw/claw-memory.db
npm install # Install dependencies
npm run build # Build plugin
npm run dev # Watch mode
npm run typecheck # Type check
# Local install (for testing)
./install.sh --local