Turn your AI agent's conversations into a living knowledge graph
Agent Memory Graph is an OpenClaw plugin that automatically builds a searchable knowledge graph from your AI conversations. No manual tagging, no complex setup β just install and watch your agent remember everything.
Every message your agent sees is analyzed for:
- π€ Entities (people, projects, tools, locations, events...)
- π Relationships (who works on what, what connects to what...)
- π Properties (versions, dates, statuses, descriptions...)
All stored in a local SQLite database with semantic search and graph traversal β giving your agent true long-term memory.
Before Agent Memory Graph:
- β Your agent forgets everything after the conversation ends
- β You have to repeat context every time
- β No way to query "Who worked on what?" or "What's related to X?"
- β Knowledge scattered across chat logs
After Agent Memory Graph:
- β Auto-extracts entities from every conversation (URLs, people, projects, prices...)
- β Builds relationships between entities automatically
- β Hybrid search (keyword 40% + semantic 60%) finds what you need
- β Conversation context (10 messages buffer) for accurate extraction
- β Natural language queries like "What did Aira upgrade today?"
- β Graph traversal to find how things connect
# Install from npm
npm install agent-memory-graph
# Or install from GitHub
npm install https://github.com/LightHaru/agent-memory-graphAdd to your openclaw.json:
{
"plugins": {
"allow": ["memory-graph"],
"entries": {
"memory-graph": {
"enabled": true,
"hooks": {
"allowConversationAccess": true
},
"config": {
"dbPath": "~/.openclaw/data/memory-graph.db",
"autoIngest": true,
"sessionSummary": true,
"minConfidence": 0.7,
"maxHops": 3
}
}
}
}
}Once installed, the plugin works automatically β no code changes needed!
Manual extraction:
// Extract entities from text
memory_graph_ingest({
text: "Aira upgraded memory-graph to v0.21.0 using multilingual-e5-large model",
source: "manual-entry"
})Search entities:
// Keyword + semantic hybrid search
memory_graph_search({
query: "memory graph plugin",
limit: 10
})Natural language queries:
// Ask questions in plain English
memory_graph_query({
question: "What projects is Aira working on?"
})Find connections:
// Shortest path between two entities
memory_graph_path({
from: "Aira",
to: "OpenClaw",
maxHops: 3
})Sees 10 previous messages when extracting entities β understands pronouns, references, and context like a human.
Before (v0.19):
User: "Fix that bug"
Plugin: β No idea what "that" refers to
After (v0.21):
User: "The memory plugin has a bug"
User: "Fix that bug"
Plugin: β
Extracts: memory plugin -[HAS_ISSUE]-> bug
Combines keyword matching (40%) and semantic similarity (60%) β finds what you mean, not just what you say.
Query: "AI coding assistant"
Results:
β
Claude Code (keyword match)
β
Codex (semantic: similar concept)
β
Cursor (semantic: IDE integration)Upgraded from bge-small-en-v1.5 (384d) β multilingual-e5-large (1024d)
- β Better English understanding
- β Vietnamese support (TiαΊΏng Viα»t)
- β Higher quality semantic vectors
- β More accurate entity relationships
Automatically detects and extracts:
- π URLs and links
- π° Prices and financial data
- π§ @mentions and handles
- π Dates and timestamps
- π·οΈ Hashtags and tags
Every entity can have custom properties:
{
"entity": "memory-graph",
"type": "Tool",
"properties": {
"version": "0.21.0",
"status": "ready",
"embedding_model": "multilingual-e5-large",
"release_date": "2026-06-02"
}
}Track what you've worked on, what bugs you fixed, what libraries you used:
memory_graph_query({
question: "What bugs did I fix in the last week?"
})
// Returns:
// - Fixed ENOENT bug in skill-creator
// - Resolved memory leak in agent-brain
// - Patched authentication issue in gatewayRemember who worked on what project:
memory_graph_query({
question: "Who contributed to the AiraCM dashboard?"
})
// Returns:
// - Aira: built content writer, SEO optimizer
// - SαΊΏp: designed architecture, deployed infrastructureBuild a knowledge base from reading material:
memory_graph_ingest({
text: "Transformers are neural networks with attention mechanisms...",
source: "research-paper"
})
memory_graph_query({
question: "What are transformers used for?"
})Track dependencies and relationships:
memory_graph_path({
from: "TinGameFi",
to: "OpenClaw"
})
// Returns:
// TinGameFi -[USES]-> AiraCM -[RUNS_ON]-> OpenClaw{
"dbPath": "~/.openclaw/data/memory-graph.db",
"autoIngest": true,
"sessionSummary": true,
"minConfidence": 0.7,
"extractionModel": "",
"maxHops": 3,
"domains": []
}| Option | Type | Default | Description |
|---|---|---|---|
dbPath |
string |
~/.openclaw/data/memory-graph.db |
SQLite database location |
autoIngest |
boolean |
true |
Auto-extract from every inbound message |
sessionSummary |
boolean |
true |
Summarize and ingest at session end |
minConfidence |
number |
0.7 |
Min confidence threshold (0.0-1.0) |
extractionModel |
string |
"" |
Model for extraction (empty = use default) |
maxHops |
number |
3 |
Max graph traversal hops for path queries |
domains |
array |
[] |
Domain hints for better extraction |
Improve extraction accuracy for specific domains:
{
"domains": [
{
"name": "software-development",
"entityHints": ["repository", "commit", "pull request", "issue"],
"relationHints": ["FIXES", "IMPLEMENTS", "DEPENDS_ON"]
}
]
}Manually extract entities from text.
memory_graph_ingest({
text: string,
source?: string
})Hybrid keyword + semantic search.
memory_graph_search({
query: string,
limit?: number,
type?: string
})Natural language queries.
memory_graph_query({
question: string
})Find shortest path between entities.
memory_graph_path({
from: string,
to: string,
maxHops?: number
})Get database statistics.
memory_graph_stats()# Run all tests
npm test
# Run with coverage
npm test -- --coverage
# Watch mode
npm run test:watchTest Coverage: 100% β
- Database operations
- Embedding generation
- Entity extraction
- Integration tests
npm run buildnpm run lintagent-memory-graph/
βββ src/
β βββ database.ts # SQLite operations
β βββ embedding.ts # Semantic embeddings
β βββ extractor.ts # Entity extraction
β βββ index.ts # Main plugin entry
β βββ types.ts # TypeScript types
β βββ __tests__/ # Test suite
βββ dist/ # Compiled output
βββ openclaw.plugin.json # Plugin metadata
βββ package.json
βββ README.md
- Database: SQLite with FTS5 full-text search
- Embedding: Lazy-loaded Transformers.js (no startup penalty)
- Memory: ~50MB for 1000 entities with embeddings
- Speed: <100ms for most queries, <500ms for complex graph traversal
Contributions welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing) - Open a Pull Request
- β¨ NEW: Conversation context buffer (10 messages)
- β¨ NEW: Hybrid search (keyword 40% + semantic 60%)
- β¬οΈ UPGRADE: Embedding model β multilingual-e5-large (1024d)
- β¨ NEW: Auto-extraction for URLs, prices, mentions
- π FIX: Entry path correction (dist/index.js)
- β TEST: 100% test coverage
- Initial release
- Basic entity extraction
- Semantic search
- SQLite storage
MIT License - see LICENSE for details.
- π Documentation: GitHub Wiki
- π Bug Reports: GitHub Issues
- π‘ Feature Requests: GitHub Discussions
Built with:
- OpenClaw - AI agent framework
- Transformers.js - In-browser ML models
- better-sqlite3 - Fast SQLite driver
Made with β€οΈ by LightHaru
Powering intelligent agents since 2026