Skip to content

Repository files navigation

🧠 Agent Memory Graph

Turn your AI agent's conversations into a living knowledge graph

Version License OpenClaw

✨ What is this?

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.


🎯 Why you need this

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

πŸš€ Quick Start

Installation

# Install from npm
npm install agent-memory-graph

# Or install from GitHub
npm install https://github.com/LightHaru/agent-memory-graph

OpenClaw Configuration

Add 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
        }
      }
    }
  }
}

Usage

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
})

🎨 Features

πŸ”„ Conversation Context Buffer

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

πŸ” Hybrid Search

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)

🌍 Multilingual Embedding

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

πŸ€– Auto-Extraction

Automatically detects and extracts:

  • πŸ”— URLs and links
  • πŸ’° Prices and financial data
  • πŸ“§ @mentions and handles
  • πŸ“… Dates and timestamps
  • 🏷️ Hashtags and tags

πŸ“Š Rich Entity Properties

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"
  }
}

πŸ“– Use Cases

πŸ§‘β€πŸ’» Developer Agent Memory

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 gateway

🀝 Team Collaboration

Remember 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 infrastructure

πŸ“š Research & Learning

Build 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?"
})

πŸ’Ό Project Management

Track dependencies and relationships:

memory_graph_path({
  from: "TinGameFi",
  to: "OpenClaw"
})

// Returns:
// TinGameFi -[USES]-> AiraCM -[RUNS_ON]-> OpenClaw

πŸ› οΈ Configuration

Full Configuration Schema

{
  "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

Domain Hints (Optional)

Improve extraction accuracy for specific domains:

{
  "domains": [
    {
      "name": "software-development",
      "entityHints": ["repository", "commit", "pull request", "issue"],
      "relationHints": ["FIXES", "IMPLEMENTS", "DEPENDS_ON"]
    }
  ]
}

πŸ“Š Tools Reference

memory_graph_ingest

Manually extract entities from text.

memory_graph_ingest({
  text: string,
  source?: string
})

memory_graph_search

Hybrid keyword + semantic search.

memory_graph_search({
  query: string,
  limit?: number,
  type?: string
})

memory_graph_query

Natural language queries.

memory_graph_query({
  question: string
})

memory_graph_path

Find shortest path between entities.

memory_graph_path({
  from: string,
  to: string,
  maxHops?: number
})

memory_graph_stats

Get database statistics.

memory_graph_stats()

πŸ§ͺ Testing

# Run all tests
npm test

# Run with coverage
npm test -- --coverage

# Watch mode
npm run test:watch

Test Coverage: 100% βœ…

  • Database operations
  • Embedding generation
  • Entity extraction
  • Integration tests

πŸ”§ Development

Build

npm run build

Lint

npm run lint

Project Structure

agent-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

πŸ“ˆ Performance

  • 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

🀝 Contributing

Contributions welcome! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing)
  5. Open a Pull Request

πŸ“ Changelog

v0.21.0 (2026-06-02)

  • ✨ 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

v0.19.x

  • Initial release
  • Basic entity extraction
  • Semantic search
  • SQLite storage

πŸ“œ License

MIT License - see LICENSE for details.


πŸ’¬ Support


🌟 Acknowledgments

Built with:


Made with ❀️ by LightHaru
Powering intelligent agents since 2026

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages