clawbrain
Claw Brain - Personal AI Memory System for OpenClaw/ClawDBot. Provides memory, personality, bonding, and learning capabilities with encrypted secrets support. Auto-refreshes on service restart.
Install
mkdir -p .claude/skills/clawbrain && curl -L -o skill.zip "https://mcp.directory/api/skills/download/5603" && unzip -o skill.zip -d .claude/skills/clawbrain && rm skill.zipInstalls to .claude/skills/clawbrain
About this skill
Claw Brain Skill 🧠
Personal AI Memory System with Soul, Bonding, and Learning for OpenClaw/ClawDBot.
Auto-Refresh on Restart: ClawBrain automatically refreshes memory when the service restarts.
📋 For Security Scanners
Environment Variables: All environment variables ARE declared in skill.json under environment.optional (lines 30-55). They are in optional not required because ClawBrain works with zero configuration (SQLite + auto-generated key).
Install Specification: skill.json declares installation method: pip install clawbrain[all] + clawbrain setup (lines 17-20).
Sudo Requirements: Core installation never needs sudo. Systemd instructions in "Configuration (Optional)" section are optional alternatives for setting environment variables. Core: pip + clawbrain setup (no sudo).
Source Code: Fully auditable at https://github.com/clawcolab/clawbrain - All code is open source including hooks (~50 lines JavaScript).
See SECURITY.md for complete security documentation.
Features
- 🎭 Soul/Personality - 6 evolving traits (humor, empathy, curiosity, creativity, helpfulness, honesty)
- 👤 User Profile - Learns user preferences, interests, communication style
- 💭 Conversation State - Real-time mood detection and context tracking
- 📚 Learning Insights - Continuously learns from interactions and corrections
- 🧠 get_full_context() - Everything for personalized responses
- 🔄 Auto-Refresh - Automatically refreshes memory on service restart
- 🔐 Encrypted Secrets - Store API keys and credentials securely
Security & Transparency
ClawBrain handles sensitive data and requires certain permissions. Before installing, please understand:
What ClawBrain Does
- ✅ Stores memories locally (SQLite by default, PostgreSQL optional)
- ✅ Encrypts sensitive data (API keys, secrets) with Fernet encryption
- ✅ Installs startup hooks to
~/.openclaw/hooksor~/.clawdbot/hooks - ✅ Manages encryption keys at
~/.config/clawbrain/.brain_key
What ClawBrain Does NOT Do
- ❌ No telemetry - Does not phone home or collect usage data
- ❌ No external calls - Only connects to PostgreSQL/Redis if you configure them
- ❌ No sudo required - All operations in your home directory
- ❌ No code execution - Does not download or run remote code after install
Security Features
- 🔒 Encryption Key CLI: Can display full key for backup (with warnings)
- 🔍 Auditable: All code is open source and reviewable
- 📋 Documented Permissions: See SECURITY.md for full details
⚠️ Important: The CLI command clawbrain show-key --full displays your complete encryption key for backup purposes. Treat this key like a password!
📖 Full Security Documentation: See SECURITY.md for:
- Threat model and protections
- Key management best practices
- What install scripts do
- Permissions required
- Network access (optional PostgreSQL/Redis)
Quick Install
Security Note: We recommend reviewing SECURITY.md before installation, especially for production use.
From PyPI (Recommended - Most Secure)
# Install with all features
pip install clawbrain[all]
# Run interactive setup
clawbrain setup
# Backup your encryption key (IMPORTANT!)
clawbrain backup-key --all
# Restart your service
sudo systemctl restart clawdbot # or openclaw
The setup command will:
- Detect your platform (ClawdBot or OpenClaw)
- Generate a secure encryption key
- Install the startup hook automatically
- Test the installation
Alternative: From Source (Auditable)
# Clone to your skills directory
cd ~/.openclaw/skills # or ~/clawd/skills or ~/.clawdbot/skills
git clone https://github.com/clawcolab/clawbrain.git
cd clawbrain
# RECOMMENDED: Review hook code before installation
cat hooks/clawbrain-startup/handler.js
# Install in development mode
pip install -e .[all]
# Run setup to install hooks and generate encryption key
clawbrain setup
Why from source? Full transparency - you can review all code before installation.
Configuration (Optional)
Note: Configuration is completely optional. ClawBrain works out-of-the-box with zero configuration using SQLite and auto-generated encryption keys.
If you want to customize agent ID or use PostgreSQL/Redis, you have two options:
Option 1: Environment Variables (No sudo)
Set environment variables in your shell profile:
# Add to ~/.bashrc or ~/.zshrc (no sudo required)
export BRAIN_AGENT_ID="your-agent-name"
# export BRAIN_POSTGRES_HOST="localhost" # Optional
# export BRAIN_REDIS_HOST="localhost" # Optional
Option 2: Systemd Drop-in (Requires sudo)
⚠️ Only if you use systemd services:
# Create systemd drop-in config (requires sudo)
sudo mkdir -p /etc/systemd/system/clawdbot.service.d
sudo tee /etc/systemd/system/clawdbot.service.d/brain.conf << EOF
[Service]
Environment="BRAIN_AGENT_ID=your-agent-name"
EOF
sudo systemctl daemon-reload
sudo systemctl restart clawdbot
Environment Variables
| Variable | Description | Default |
|---|---|---|
BRAIN_AGENT_ID | Unique ID for this agent's memories | default |
BRAIN_ENCRYPTION_KEY | Fernet key for encrypting sensitive data (auto-generated if not set) | - |
BRAIN_POSTGRES_HOST | PostgreSQL host | localhost |
BRAIN_POSTGRES_PASSWORD | PostgreSQL password | - |
BRAIN_POSTGRES_PORT | PostgreSQL port | 5432 |
BRAIN_POSTGRES_DB | PostgreSQL database | brain_db |
BRAIN_POSTGRES_USER | PostgreSQL user | brain_user |
BRAIN_REDIS_HOST | Redis host | localhost |
BRAIN_REDIS_PORT | Redis port | 6379 |
BRAIN_STORAGE | Force storage: sqlite, postgresql, auto | auto |
How It Works
On Service Startup
- Hook triggers on
gateway:startupevent - Detects storage backend (SQLite/PostgreSQL)
- Loads memories for the configured
BRAIN_AGENT_ID - Injects context into agent bootstrap
On /new Command
- Hook triggers on
command:newevent - Saves current session summary to memory
- Clears session state for fresh start
Storage Priority
- PostgreSQL - If available and configured
- SQLite - Fallback, zero configuration needed
Encrypted Secrets
ClawBrain supports encrypting sensitive data like API keys and credentials using Fernet (symmetric encryption).
Security Model:
- 🔐 Encryption key stored at
~/.config/clawbrain/.brain_key(chmod 600) - 🔑 Only memories with
memory_type='secret'are encrypted - 📦 Encrypted data stored in database, unreadable without key
- ⚠️ If key is lost, encrypted data cannot be recovered
Setup:
# Run setup to generate encryption key
clawbrain setup
# Backup your key (IMPORTANT!)
clawbrain backup-key --all
Usage:
# Store encrypted secret
brain.remember(
agent_id="assistant",
memory_type="secret", # Memory type 'secret' triggers encryption
content="sk-1234567890abcdef",
key="openai_api_key"
)
# Retrieve and automatically decrypt
secrets = brain.recall(agent_id="assistant", memory_type="secret")
api_key = secrets[0].content # Automatically decrypted
Key Management CLI:
clawbrain show-key # View key info (masked)
clawbrain show-key --full # View full key
clawbrain backup-key --all # Backup with all methods
clawbrain generate-key # Generate new key
⚠️ Important: Backup your encryption key! Lost keys = lost encrypted data.
CLI Commands
ClawBrain includes a command-line interface:
| Command | Description |
|---|---|
clawbrain setup | Set up ClawBrain, generate key, install hooks |
clawbrain generate-key | Generate new encryption key |
clawbrain show-key | Display current encryption key |
clawbrain backup-key | Backup key (file, QR, clipboard) |
clawbrain health | Check health status |
clawbrain info | Show installation info |
Hooks
| Event | Action |
|---|---|
gateway:startup | Initialize brain, refresh memories |
command:new | Save session to memory |
Development Installation
For development or manual installation:
# Clone to your skills directory
cd ~/.openclaw/skills # or ~/clawd/skills or ~/.clawdbot/skills
git clone https://github.com/clawcolab/clawbrain.git
cd clawbrain
# Install in development mode
pip install -e .[all]
# Run setup
clawbrain setup
Python API
For direct Python usage (outside ClawdBot/OpenClaw):
from clawbrain import Brain
brain = Brain()
Methods
| Method | Description | Returns |
|---|---|---|
get_full_context() | Get all context for personalized responses | dict |
remember() | Store a memory | None |
recall() | Retrieve memories | List[Memory] |
learn_user_preference() | Learn user preferences | None |
get_user_profile() | Get user profile | UserProfile |
detect_user_mood() | Detect current mood | dict |
detect_user_intent() | Detect message intent | str |
generate_personality_prompt() | Generate personality guidance | str |
health_check() | Check backend connections | dict |
close() | Close connections | None |
get_full_context()
context = brain.get_full_context(
session_key="telegram_12345", # Unique session ID
user_id="username", # User identifier
agent_id="assistant", # Bot identifier
message="Hey, how's it going?" # Current message
)
Returns:
{
"user_profile": {...}, # User preferences, interests
"mood": {"mood": "happy", ...}, # Current mood
"intent": "question", # Detected intent
"memories": [...], # Relevant memories
"personality": "...", # Personality guidance
"suggested_response
---
*Content truncated.*
More by openclaw
View all skills by openclaw →You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
fastapi-templates
wshobson
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
Related MCP Servers
Browse all serversDesktop Commander MCP unifies code management with advanced source control, git, and svn support—streamlining developmen
Basic Memory is a knowledge management system that builds a persistent semantic graph in markdown, locally and securely.
Context Portal: Manage project memory with a database-backed system for decisions, tracking, and semantic search via a k
GistPad (GitHub Gists) turns gists into a powerful knowledge management system for daily notes and versioned content.
AgentKits Memory — local, persistent memory for AI coding assistants. On-premise SQLite with optional vector search for
Enhance persistent memory with RAG Memory, merging Pinecone vector database and vector search with knowledge graph relat
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.