Registry / ai-ml / agent-memory-graph

agent-memory-graph

JSON →
library0.19.6jsnpmunverified

Domain-agnostic knowledge graph memory for AI agents, v0.19.6. Persists structured entity-relationship graphs from conversations using local SQLite with FTS5. Supports zero-config offline mode with rule-based extraction, optional LLM-fallback for complex entities, natural language queries, and path finding. Ships TypeScript types. Active development with weekly releases. Key differentiators: fully local-first (no API keys needed), temporal facts with confidence decay, OpenClaw plugin integration, MCP server support, and relation normalization.

npm install agent-memory-graph
INSTALL
IMPORT
SIG · AGENT-MEMORY-GRAPH
A
agent-memory-graph
ai-mljavascriptv0.19.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

MemoryGraph
import { MemoryGraph } from 'agent-memory-graph'
import MemoryGraph from 'agent-memory-graph'
Named export since v0.10. Default import never existed.
type MemoryGraphOptions
import type { MemoryGraphOptions } from 'agent-memory-graph'
import { MemoryGraphOptions } from 'agent-memory-graph'
Use type-only import for TypeScript interfaces to avoid runtime overhead.
MemoryGraph (CommonJS)
const { MemoryGraph } = require('agent-memory-graph')
const MemoryGraph = require('agent-memory-graph')
CommonJS must destructure. Module uses named exports.

Creates a local graph, ingests a sentence, and queries it by natural language.

import { MemoryGraph } from 'agent-memory-graph'; const graph = new MemoryGraph(); await graph.ingest( "Alice is the CTO of TechCorp. She leads the Platform team " + "and uses Kubernetes, Go, and PostgreSQL." ); const result = await graph.ask("What does Alice use?"); console.log(result); // "Alice: USES → Kubernetes, Go, PostgreSQL" graph.close();
Debug
Known issues
breakingMemoryGraph constructor no longer accepts dbPath as first argument — use options object
fix
new MemoryGraph({ dbPath: './memory.db' }) instead of new MemoryGraph('./memory.db')
affects: >=0.15.0
breakingingest() now returns Promise<void> instead of Promise<number>
fix
Remove reliance on the returned entity/relation count. Use graph.stats() if needed.
affects: >=0.18.0
deprecatedfindPath() returns null instead of empty array when no path found since v0.16
fix
Check for null: const path = graph.findPath('A', 'B'); if (path) { ... }
affects: >=0.16.0
gotchaRequires Node 18+ but Node 24 needs native build tools for better-sqlite3
fix
On Node 24, install gcc, make, python3, or use prebuilt binaries from better-sqlite3 releases.
affects: >=0.1.0
gotchagraph.ask() is case-sensitive when matching entity names
fix
Normalize casing before querying, or use findPath with regex.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'better-sqlite3'
Missing native SQLite binding (requires compilation)
fix
Run 'npm rebuild better-sqlite3' or install build tools: on Ubuntu 'sudo apt install build-essential python3'
TypeError: MemoryGraph is not a constructor
Used default import instead of named import
fix
Use import { MemoryGraph } from 'agent-memory-graph'
Error: dbPath option must be a string or undefined
Passed dbPath as first positional argument in v0.15+
fix
Wrap dbPath in options object: new MemoryGraph({ dbPath: './mydb.sqlite' })
Upgrade
Version history
0.19.6latest on npm
Audit
Dependencies
@anthropic-ai/sdkoptionalLLM provider for extraction fallback
@sinclair/typeboxoptionalRuntime schema validation
openclawoptionalOpenClaw plugin integration
Agent activity
52 hits · last 30 days
node
46
OpenAI (training)
1
Resources
agent-memory-graph — npm install agent-memory-graph · libregistry