Your AI agent doesn't just talk. It remembers who, what, and how things connect.
AgentSense is a knowledge graph memory plugin for OpenClaw. It watches your conversations, extracts the people, projects, tools, and decisions you discuss, and weaves them into a persistent web of relationships your agent can query instantly.
Think of it as giving your agent a second brain β not a pile of notes, but a map of your world.
OpenClaw already has memory. It chunks your markdown files, embeds them, and searches semantically. That's good for "what did we talk about?"
But it can't answer "who's connected to what?"
AgentSense can.
You: Tell me about Alice
graph_search β alice chen [person]
β partner β solar bid tool [project]
β competes_with β buildcost ai [company]
β competes_with β estimate pro [company]
β colleague β bob martinez [person]
One query. Three hops. Relationships your agent never has to re-discover.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Your Conversations β
ββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ
β
ββββββββββββΌβββββββββββ
β Plugin Hooks β
β agent_end β
β before_compaction β β Captures raw text
β message_received β (instant, free)
ββββββββββββ¬βββββββββββ
β
ββββββββββββΌβββββββββββ
β Observations Table β β SQLite buffer
ββββββββββββ¬βββββββββββ
β
ββββββββββββΌβββββββββββ
β Extraction Cron β
β (Haiku, hourly) β β Reads text, finds entities,
ββββββββββββ¬βββββββββββ writes structured data
β
ββββββββββββΌβββββββββββ
β Knowledge Graph β
β ββββββββ ββββββββ β
β βNodes βββEdges β β β People, projects, tools,
β ββββββββ ββββββββ β decisions β all connected
ββββββββββββ¬βββββββββββ
β
βββββββββββββββΌββββββββββββββ
βΌ βΌ βΌ
graph_search /graph cmd auto-recall
(agent tool) (Telegram) (context injection)
Capture is instant and free β hooks buffer raw conversation text. Extraction happens asynchronously via a cron job. Bring your own model. Query is local FTS5 β no API calls, no embedding costs.
git clone https://github.com/fraction12/agentsense.git ~/.openclaw/extensions/agentsense
cd ~/.openclaw/extensions/agentsense
npm installAdd to your openclaw.json:
{
"plugins": {
"allow": ["agentsense"],
"slots": {
"memory": "agentsense"
},
"load": {
"paths": ["~/.openclaw/extensions/agentsense"]
},
"entries": {
"agentsense": {
"enabled": true,
"config": {
"autoCapture": true,
"autoRecall": true
}
}
}
}
}openclaw gateway restartopenclaw status
# Should show: Memory: enabled (plugin agentsense)That's it. AgentSense will start capturing from your conversations immediately.
AgentSense captures text automatically, but extraction requires an LLM. The plugin doesn't call any LLM directly β instead, you set up an OpenClaw cron job that reads pending observations and writes entities.
This is by design. Your model, your cost, your schedule.
Example cron setup (using Haiku under Claude Max β free):
Create a cron via OpenClaw that runs an isolated Haiku session hourly. The session reads pending observations from SQLite, extracts entities, and writes them back. See CRON_SETUP.md for the full prompt template.
Without the cron, observations accumulate but the graph stays empty. The plugin still works β memory_search and memory_get function normally, and you can manually add entities via SQLite.
Your agent gets a new tool for structured entity lookup:
graph_search("Alice")
β alice chen [person]
β partner β solar bid tool [project]
β colleague β bob martinez [person]
/graph β Stats overview
/graph search X β Find entities
/graph recent β Latest additions
/graph connections X β All relationships for an entity
/graph types β Breakdown by entity type
The before_agent_start hook automatically injects relevant entities into your agent's context before every turn. No tool call needed β your agent just knows.
AgentSense replaces memory-core as the memory plugin but re-registers memory_search and memory_get identically. Your existing memory system works exactly as before. The graph is additive.
| Option | Default | Description |
|---|---|---|
autoCapture |
true |
Buffer conversation text via hooks |
autoRecall |
true |
Inject graph context before agent turns |
dbPath |
~/.openclaw/memory/agentsense.db |
SQLite database location |
captureMinMessageLength |
50 |
Minimum text length to capture |
maxRecallEntities |
5 |
Max entities injected per turn |
AgentSense recognizes: person, project, decision, event, idea, preference, place, tool, organization, company
Relationships are freeform strings: works_on, partner, built, uses, decided, prefers, employed_by, located_in, manages, created β whatever the extraction model finds.
SQLite + FTS5, not Neo4j. A knowledge graph doesn't need a graph database. SQLite is single-file, zero-config, fast enough for thousands of nodes, and already a dependency via better-sqlite3.
Cron extraction, not inline. Early versions called Haiku directly from hooks. This required an API key, added latency, and crashed when the key expired. Moving extraction to a cron job means: zero API dependencies in the plugin, no hook failures, batch context for better extraction quality.
Memory plugin slot. AgentSense registers as kind: "memory", replacing memory-core in the plugin slot. This lets it re-register the standard memory tools while adding graph capabilities. Switch back to memory-core anytime β your graph data persists on disk untouched.
Eager DB initialization. The database initializes at plugin registration time, not in the service start() method. This prevents a race condition where hooks fire before the service is ready.
Switch back to the default memory system in 30 seconds:
{
"plugins": {
"slots": {
"memory": "memory-core"
}
}
}openclaw gateway restartYour graph database persists at ~/.openclaw/memory/agentsense.db. Re-enable AgentSense anytime and everything is still there.
- OpenClaw 2026.2.17+
- Node.js 20+
better-sqlite3(installed automatically)
agentsense/
βββ index.ts # Main entry β tools, hooks, commands, services
βββ graph-db.ts # SQLite + FTS5 database layer
βββ config.ts # Plugin configuration schema
βββ types.ts # TypeScript type definitions
βββ extractor.ts # Extraction prompt template + JSON parser
βββ hooks/
β βββ auto-capture.ts # Buffers text on agent_end / before_compaction
β βββ auto-recall.ts # Injects graph context on before_agent_start
β βββ message-capture.ts # Captures individual messages
βββ tools/
β βββ graph-search.ts # graph_search agent tool
βββ cli/
β βββ graph-cli.ts # CLI commands (stats, search, entities)
βββ skill/
β βββ SKILL.md # Agent skill documentation
βββ openclaw.plugin.json # Plugin manifest
At small scale (< 100 nodes), AgentSense is mostly redundant with OpenClaw's built-in memory search. The embedding-based system finds the same information, often with richer context.
The graph earns its keep at scale. When you have hundreds of entities with dense connections, relationship queries β "who connects to what through whom?" β become something keyword and vector search fundamentally cannot do.
The auto-recall injection is useful from day one. Relevant entities pre-loaded into every turn, zero tool calls, zero latency.
Build the graph. Let it grow. The connections compound.
MIT
Built by Dushyant Garg & Jarvis β because an agent that forgets who you know isn't really paying attention.