5.1kā
by clawcolab
clawbrain ā OpenClaw Skill
clawbrain is an OpenClaw Skills integration for coding workflows. Claw Brain - Personal AI Memory System for ClawDBot. Provides memory, personality, bonding, and learning capabilities.
Skill Snapshot
| name | clawbrain |
| description | Claw Brain - Personal AI Memory System for ClawDBot. Provides memory, personality, bonding, and learning capabilities. OpenClaw Skills integration. |
| owner | clawcolab |
| repository | clawcolab/clawbrain |
| language | Markdown |
| license | MIT |
| topics | |
| security | L1 |
| install | openclaw add @clawcolab/clawbrain |
| last updated | Feb 7, 2026 |
Maintainer

name: clawbrain description: "Claw Brain - Personal AI Memory System for ClawDBot. Provides memory, personality, bonding, and learning capabilities." metadata: {"clawdbot":{"emoji":"š§ ","requires":{"files":["clawbrain.py"]},"install":[{"id":"git","kind":"git","url":"https://github.com/clawcolab/clawbrain.git","label":"Install Claw Brain (git)"}]}}
Claw Brain Skill š§
Personal AI Memory System with Soul, Bonding, and Learning for ClawDBot.
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
Installation
Option 1: Git Clone (Recommended for ClawDBot)
# Clone into ClawDBot workspace
git clone https://github.com/clawcolab/clawbrain.git ClawBrain
Option 2: pip install
pip install git+https://github.com/clawcolab/clawbrain.git
ClawDBot Setup
1. Install the Skill
# Clone to your ClawDBot workspace
cd /path/to/your/clawdbot
git clone https://github.com/clawcolab/clawbrain.git ClawBrain
2. Import in Your Bot
Add to your bot's main file (e.g., main.py):
import sys
sys.path.insert(0, "ClawBrain")
from clawbrain import Brain
# Initialize the brain
brain = Brain()
# Make it available globally or pass to handlers
app.brain = brain
3. Use in Message Handlers
def handle_message(message, channel="telegram"):
# Get user context
context = app.brain.get_full_context(
session_key=f"{channel}_{message.chat.id}",
user_id=str(message.chat.id),
agent_id="jarvis",
message=message.text
)
# Generate personalized response
response = generate_response(context)
# Store conversation
app.brain.remember(
agent_id="jarvis",
memory_type="conversation",
content=message.text,
key=f"last_message_{message.chat.id}"
)
return response
Configuration
Environment Variables
# PostgreSQL (optional - auto-detected)
export POSTGRES_HOST=192.168.4.176
export POSTGRES_PORT=5432
export POSTGRES_DB=clawcolab
export POSTGRES_USER=postgres
export POSTGRES_PASSWORD=postgres
# Redis (optional - auto-detected)
export REDIS_HOST=192.168.4.175
export REDIS_PORT=6379
Force Storage Backend
# Force SQLite (zero setup)
brain = Brain({"storage_backend": "sqlite"})
# Force PostgreSQL
brain = Brain({"storage_backend": "postgresql"})
# Auto-detect (default)
brain = Brain()
API Reference
Brain Class
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="jarvis", # 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_responses": [...] # Response suggestions
}
detect_user_mood()
mood = brain.detect_user_mood("I'm so excited about this!")
# Returns: {"mood": "happy", "confidence": 0.9, "emotions": ["joy", "anticipation"]}
detect_user_intent()
intent = brain.detect_user_intent("How does AI work?")
# Returns: "question"
intent = brain.detect_user_intent("Set a reminder for 3pm")
# Returns: "command"
intent = brain.detect_user_intent("I had a great day today")
# Returns: "casual"
Example: Full Integration
import sys
sys.path.insert(0, "ClawBrain")
from clawbrain import Brain
class JarvisBot:
def __init__(self):
self.brain = Brain()
def handle_message(self, message, chat_id):
# Get context
context = self.brain.get_full_context(
session_key=f"telegram_{chat_id}",
user_id=str(chat_id),
agent_id="jarvis",
message=message
)
# Generate response using context
response = self.generate_response(context)
# Learn from interaction
self.brain.learn_user_preference(
user_id=str(chat_id),
pref_type="interest",
value="AI"
)
return response
def generate_response(self, context):
# Use user preferences
name = context["user_profile"].name or "there"
mood = context["mood"]["mood"]
# Personalized response
if mood == "frustrated":
return f"Hey {name}, I'm here to help. Let me assist you."
else:
return f"Hi {name}! How can I help you today?"
def shutdown(self):
self.brain.close()
Storage Backends
SQLite (Default - Zero Setup)
No configuration needed. Data stored in local SQLite database.
brain = Brain({"storage_backend": "sqlite"})
Best for: Development, testing, single-user deployments
PostgreSQL + Redis (Production)
Requires PostgreSQL and Redis servers.
brain = Brain() # Auto-detects
Requirements:
- PostgreSQL 14+
- Redis 6+
- Python packages:
psycopg2-binary,redis
pip install psycopg2-binary redis
Best for: Production, multi-user, high-concurrency
Files
clawbrain.py- Main Brain class with all features__init__.py- Module exportsSKILL.md- This documentationskill.json- ClawdHub metadataREADME.md- Quick start guide
Troubleshooting
ImportError: No module named 'clawbrain'
# Ensure ClawBrain folder is in your path
sys.path.insert(0, "ClawBrain")
PostgreSQL connection failed
# Check environment variables
echo $POSTGRES_HOST
echo $POSTGRES_PORT
# Verify PostgreSQL is running
pg_isready -h $POSTGRES_HOST -p $POSTGRES_PORT
Redis connection failed
# Check Redis is running
redis-cli ping
Using SQLite (fallback)
If PostgreSQL/Redis are unavailable, Claw Brain automatically falls back to SQLite:
brain = Brain({"storage_backend": "sqlite"})
Learn More
- Repository: https://github.com/clawcolab/clawbrain
- README: See README.md for quick start
- Issues: Report bugs at GitHub Issues
Claw Brain š§
Personal AI Memory System for AI Agents
A sophisticated memory and learning system that enables truly personalized AI-human communication.
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
Quick Start
pip install git+https://github.com/clawcolab/clawbrain.git
from clawbrain import Brain
brain = Brain()
context = brain.get_full_context(
session_key="chat_123",
user_id="pranab",
agent_id="jarvis",
message="Hey, how's it going?"
)
Storage Options
Option 1: SQLite (Zero Setup) ā Recommended for development
from clawbrain import Brain
# Automatically uses SQLite
brain = Brain({"storage_backend": "sqlite"})
Requirements: Python 3.10+, no external dependencies
Best for:
- Development and testing
- Single-user deployments
- Quick prototyping
Option 2: PostgreSQL + Redis (Production) š
from clawbrain import Brain
# Auto-detects PostgreSQL and Redis
brain = Brain()
Requirements:
- PostgreSQL 14+ (port 5432)
- Redis 6+ (port 6379)
- Python packages:
psycopg2-binary,redis
Install dependencies:
pip install psycopg2-binary redis
Environment variables (optional):
export POSTGRES_HOST=192.168.4.176
export POSTGRES_PORT=5432
export POSTGRES_DB=clawcolab
export POSTGRES_USER=postgres
export POSTGRES_PASSWORD=postgres
export REDIS_HOST=192.168.4.175
export REDIS_PORT=6379
Best for:
- Production deployments
- High-concurrency environments
- Distributed AI agents
- Multi-user platforms
Auto-Detection Order
- PostgreSQL (if available)
- Redis (if available, used as cache)
- SQLite (fallback)
You can also force a specific backend:
brain = Brain({"storage_backend": "postgresql"}) # Force PostgreSQL
brain = Brain({"storage_backend": "sqlite"}) # Force SQLite
Installation Methods
From GitHub (Recommended)
pip install git+https://github.com/clawcolab/clawbrain.git
From Local Development
cd /root/clawd/brain/public_package
pip install -e .
For ClawDBot
# Install as skill
git clone https://github.com/clawcolab/clawbrain.git ClawBrain
Then in your bot:
import sys
sys.path.insert(0, "ClawBrain")
from clawbrain import Brain
brain = Brain()
API Reference
Core Class
from clawbrain import Brain
brain = Brain()
Methods:
| Method | Description |
|---|---|
get_full_context() | Get all context for personalized responses |
remember() | Store a memory |
recall() | Retrieve memories |
learn_user_preference() | Learn user preferences |
get_user_profile() | Get user profile |
detect_user_mood() | Detect current mood |
detect_user_intent() | Detect message intent |
generate_personality_prompt() | Generate personality guidance |
health_check() | Check backend connections |
close() | Close connections |
Data Classes
from clawbrain import Memory, UserProfile
# Memory
memory = Memory(
id="...",
agent_id="jarvis",
memory_type="fact",
key="job",
content="User works at Walmart",
importance=0.8
)
# User Profile
profile = UserProfile(
user_id="pranab",
name="Pranab",
interests=["AI", "crypto"],
communication_preferences={"style": "casual"}
)
Repository Structure
clawbrain/
āāā clawbrain.py ā Main module
āāā __init__.py ā Exports
āāā SKILL.md ā ClawDBot skill docs
āāā skill.json ā ClawdHub metadata
āāā README.md ā This file
For ClawDBot
Install as a skill via ClawdHub or manually:
git clone https://github.com/clawcolab/clawbrain.git ClawBrain
Usage in your bot:
import sys
sys.path.insert(0, "ClawBrain")
from clawbrain import Brain
brain = Brain()
# Get context for responses
context = brain.get_full_context(
session_key=session_id,
user_id=user_id,
agent_id=agent_id,
message=user_message
)
License
MIT
Permissions & Security
Security level L1: Low-risk skills with minimal permissions. Review inputs and outputs before running in production.
Requirements
- OpenClaw CLI installed and configured.
- Language: Markdown
- License: MIT
- Topics:
Configuration
### Environment Variables ```bash
FAQ
How do I install clawbrain?
Run openclaw add @clawcolab/clawbrain in your terminal. This installs clawbrain into your OpenClaw Skills catalog.
Does this skill run locally or in the cloud?
OpenClaw Skills execute locally by default. Review the SKILL.md and permissions before running any skill.
Where can I verify the source code?
The source repository is available at https://github.com/openclaw/skills/tree/main/skills/clawcolab/clawbrain. Review commits and README documentation before installing.
