Skip to main content
Give your OpenClaw agents Cognee-backed memory with multi-scope support (company / user / agent), session tracking, and automatic recall. The plugin indexes your Markdown memory files, recalls relevant context before each run, and searches across sessions with natural language.

Why Use This Integration

  • Multi-scope memory: Separate datasets for company-wide knowledge, per-user preferences, and per-agent context, routed automatically by file path
  • Auto-recall: Relevant memories are injected as labeled <cognee_memories> context before every prompt
  • Auto-index: Memory files sync to Cognee (add new, update changed, forget removed, skip unchanged)
  • Session tracking: Each turn is captured in Cognee’s session cache and bridged into the graph on session end
  • 14 search types: From semantic vector search to chain-of-thought graph reasoning
  • One-command setup: openclaw cognee setup configures Cognee as the memory provider

Installation

Once published, pin to an exact version (supply-chain best practice):
Or install locally for development:

Quick Start

1. Start Cognee

Run a local Cognee server with this minimal Docker Compose file:

2. Run setup

3. Configure the connection

Add the Cognee connection to ~/.openclaw/openclaw.json:
OpenClaw ≥ 2026.4.27 blocks non-bundled plugins from registering the agent_end hook unless hooks.allowConversationAccess: true is set. Without it, file sync after each agent turn is silently disabled until the next manual openclaw cognee index or gateway start. Restart the gateway after adding the flag: openclaw gateway stop && openclaw gateway start.
That’s it. Your OpenClaw memory files are now backed by Cognee’s knowledge graph. If you omit apiKey, the plugin auto-logs in with the default local credentials (default_user@example.com / default_password).

Cognee Cloud

To use Cognee Cloud instead of a local instance, set mode to "cloud":
Cloud mode supports remember (new files), recall, and per-item forget. Updating an existing file in place is not supported in cloud mode (PATCH /update is self-hosted only) — delete and re-add the file instead.

Multi-Scope Memory

For production use, enable multi-scope mode by setting any scope-specific dataset name. Memory files are routed to the right dataset by path.
Default routing: memory/company/** → company, memory/user/** → user, memory/** and MEMORY.md → agent (catch-all). Override it with a scopeRouting list of { pattern, scope } rules. During recall, each scope is searched independently and injected with labels:

How It Works

  1. On startup: Health check, then scan memory/ and call /remember (one batched upload per scope). Cognee runs add + cognify + improve server-side.
  2. Before each prompt: Call /recall for each configured scope in parallel, merge results with scope labels, and inject them as context. The session id is passed through so Cognee captures the turn as a session QA.
  3. After each agent run: Re-scan memory files — new files batch into /remember, changed files go through PATCH /update (self-hosted), removed files are dropped via /forget.
  4. On session end: Final sync sweep; with improveOnSessionEnd on, dispatches /improve for the ended session to bridge session QAs into the permanent graph.
State is tracked under ~/.openclaw/memory/cognee/ (datasets.json, scoped-sync-indexes.json, legacy sync-index.json). Files are stored using sanitized relative paths (e.g. MEMORY.md.txt, memory.tools.md.txt).

Configuration Reference

Connection

Automation

Timeouts

Deprecated options (silently ignored if set): maxTokens — use maxResults; autoCognify and autoMemify — now run server-side via /remember; deleteMode/forget is always a soft delete.

Search Types

The plugin supports all of Cognee’s search types, including GRAPH_COMPLETION (default), GRAPH_COMPLETION_COT, GRAPH_COMPLETION_CONTEXT_EXTENSION, GRAPH_SUMMARY_COMPLETION, RAG_COMPLETION, TRIPLET_COMPLETION, CHUNKS, CHUNKS_LEXICAL, SUMMARIES, TEMPORAL, NATURAL_LANGUAGE, CYPHER, CODING_RULES, and FEELING_LUCKY (auto-selects per query). See Search Types for details.

CLI Commands

Troubleshooting

OpenClaw ≥ 2026.4.27 requires hooks.allowConversationAccess: true under the plugin entry for the agent_end hook to register. Add it to ~/.openclaw/openclaw.json, then restart the gateway:
Check connectivity and sync state:
Healthy status shows the dataset ID, indexed file count, and a recent last-sync timestamp. On the Cognee side, confirm the server logs show Backend server has started (Docker: docker compose logs cognee) before starting OpenClaw.
Trigger the same sync autoIndex runs at any time:
If this fails, verify baseUrl points to a reachable Cognee server and that your apiKey (or default credentials) are valid.

GitHub Repository

View source code and examples

Blog Post

Deep dive into building this plugin

OpenClaw Docs

Learn about OpenClaw’s memory system