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
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: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:
You can omit
apiKey entirely — the plugin will auto-login with the default user.How It Works
Memory persists across OpenClaw sessions automatically. The plugin syncs yourMEMORY.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.
- On Startup: Scans memory directory and syncs files to Cognee (add new, update changed, delete removed, skip unchanged)
- Before Agent Run: Searches Cognee for memories relevant to your prompt and injects them as
<cognee_memories>context - After Agent Run: Re-scans memory files and syncs any changes the agent made, including detecting deleted files
- State Tracking: Maintains sync state at
~/.openclaw/memory/cognee/:datasets.json— dataset ID mappingsync-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
| Option | Type | Default | Description |
|---|---|---|---|
baseUrl | string | http://localhost:8000 | Cognee API base URL |
apiKey | string | $COGNEE_API_KEY | Bearer token for authentication (optional if using default username/password) |
username | string | default_user@example.com | Cognee login username(if COGNEE_API_KEY is not provided) |
password | string | default_password | Cognee login password (if COGNEE_API_KEY is not provided) |
datasetName | string | openclaw | Dataset name for storing memories |
searchType | string | GRAPH_COMPLETION | Search mode (see below) |
searchPrompt | string | "" | System prompt sent to Cognee to guide search query processing |
deleteMode | string | soft | soft removes raw data only; hard also removes degree-one graph nodes |
maxResults | number | 6 | Max memories to inject per recall |
minScore | number | 0 | Minimum relevance score filter |
maxTokens | number | 512 | Token cap for recall context |
autoRecall | boolean | true | Inject memories before each agent run |
autoIndex | boolean | true | Sync memory files on startup and after agent runs |
autoCognify | boolean | true | Run cognify after new memories are added |
requestTimeoutMs | number | 60000 | HTTP timeout for general Cognee requests (ms) |
ingestionTimeoutMs | number | 300000 | HTTP timeout for add/update (ingestion) requests (ms) |
Search Types
Available search types for thesearchType option:
GRAPH_COMPLETION— traverses the knowledge graph and generates a completion-style answerCHUNKS— returns matching text chunks from ingested contentSUMMARIES— returns summary-level results
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
GitHub Repository
View source code and examples
Blog Post
Deep dive into building this plugin
OpenClaw Docs
Learn about OpenClaw’s memory system