Skip to main content
Give your OpenClaw agents persistent memory via plugin powered by cognee. Automatically index memory files, recall relevant context before each agent run, and search across sessions with natural language.

Why Use This Integration

  • Auto-Index: Memory files sync to Cognee on startup and after each agent run (add new, update changed, delete removed, skip unchanged)
  • Auto-Recall: Relevant memories are injected as context before every prompt
  • Graph Search: Natural language queries powered by knowledge graph traversal
  • Deletion Tracking: Removed memory files are automatically cleaned up from Cognee during indexing
  • Zero Friction: Works with OpenClaw’s native Markdown memory files

Installation

openclaw plugins install @cognee/cognee-openclaw
Or install locally for development:
cd integrations/openclaw
npm install && npm run build
openclaw plugins install -l .

Quick Start

1. Start Cognee

Use the Local Docker setup to run Cognee quickly. You can also use this minimal Docker Compose file.

2. Authentication

Register a user and login to get your bearer token:
# Register a new user
curl -X POST "http://localhost:8000/api/v1/users/register" \
  -H "Content-Type: application/json" \
  -d '{"email": "you@example.com", "password": "your-password"}'

# Login to get your bearer token
curl -X POST "http://localhost:8000/api/v1/users/login" \
  -H "Content-Type: application/json" \
  -d '{"email": "you@example.com", "password": "your-password"}'
The login response contains your bearer token — use this as your COGNEE_API_KEY.
You can also explore the API at http://localhost:8000/docs (Swagger UI) to register and login interactively.If token is not provided, the plugin authenticates via Cognee’s login endpoint (/api/v1/auth/login). By default it uses default_user@example.com / default_password, which works out of the box with a local Cognee instance — no configuration needed.

3. Enable the Plugin

Add to ~/.openclaw/config.yaml:
plugins:
  entries:
    cognee-openclaw:
      enabled: true
      config:
        baseUrl: "http://localhost:8000"
        apiKey: "${COGNEE_API_KEY}"
        datasetName: "my-project"
        searchType: "GRAPH_COMPLETION"
        autoRecall: true
        autoIndex: true
You can omit apiKey entirely — the plugin will auto-login with the default user.
That’s it. Your OpenClaw memory files are now backed by Cognee’s knowledge graph.

How It Works

Memory persists across OpenClaw sessions automatically. The plugin syncs your MEMORY.md and memory/*.md files to Cognee, building a knowledge engine for your Claw that can traverse relationships between documents, concepts and evolve over time.
  1. On Startup: Scans memory directory and syncs files to Cognee (add new, update changed, delete removed, skip unchanged)
  2. Before Agent Run: Searches Cognee for memories relevant to your prompt and injects them as <cognee_memories> context
  3. After Agent Run: Re-scans memory files and syncs any changes the agent made, including detecting deleted files
  4. State Tracking: Maintains sync state at ~/.openclaw/memory/cognee/:
    • datasets.json — dataset ID mapping
    • sync-index.json — per-file content hash and Cognee data IDs
The plugin uses hash-based change detection to minimize API calls. Only new or modified files are synced. For changed files with a known data ID, the plugin uses Cognee’s update endpoint.

Configuration Reference

OptionTypeDefaultDescription
baseUrlstringhttp://localhost:8000Cognee API base URL
apiKeystring$COGNEE_API_KEYBearer token for authentication (optional if using default username/password)
usernamestringdefault_user@example.comCognee login username(if COGNEE_API_KEY is not provided)
passwordstringdefault_passwordCognee login password (if COGNEE_API_KEY is not provided)
datasetNamestringopenclawDataset name for storing memories
searchTypestringGRAPH_COMPLETIONSearch mode (see below)
searchPromptstring""System prompt sent to Cognee to guide search query processing
deleteModestringsoftsoft removes raw data only; hard also removes degree-one graph nodes
maxResultsnumber6Max memories to inject per recall
minScorenumber0Minimum relevance score filter
maxTokensnumber512Token cap for recall context
autoRecallbooleantrueInject memories before each agent run
autoIndexbooleantrueSync memory files on startup and after agent runs
autoCognifybooleantrueRun cognify after new memories are added
requestTimeoutMsnumber60000HTTP timeout for general Cognee requests (ms)
ingestionTimeoutMsnumber300000HTTP timeout for add/update (ingestion) requests (ms)

Search Types

Available search types for the searchType option:
  • GRAPH_COMPLETION — traverses the knowledge graph and generates a completion-style answer
  • CHUNKS — returns matching text chunks from ingested content
  • SUMMARIES — returns summary-level results
You can learn more in Search Types and extend these if you want from the source.

Delete Modes

When memory files are removed from disk, the plugin deletes them from Cognee:
  • soft — removes only the raw data from Cognee (default)
  • hard — also removes degree-one graph nodes connected to the deleted data

CLI Commands

# Manually sync memory files to Cognee
openclaw cognee index

# Check sync status (indexed files, pending changes, dataset info)
openclaw cognee status

GitHub Repository

View source code and examples

Blog Post

Deep dive into building this plugin

OpenClaw Docs

Learn about OpenClaw’s memory system