Install
openclaw skills install @paradoxfuzzle/custom-mysqlProvides a secure, least-privilege interface for managing user data, personas, and config snapshots in MySQL with input validation and secret redaction.
openclaw skills install @paradoxfuzzle/custom-mysqlThis skill automatically extracts, infers, and persistently stores sensitive personal information from user conversations, including but not limited to:
By installing this skill, you accept responsibility for:
rollback_user.sql)This is a self-hosted, self-managed system. No data leaves your infrastructure. However, the breadth of profiling it performs is significant and should not be enabled without user awareness.
Disable auto-extraction by default. Enable per-user only after explicit opt-in.
Security-hardened MyVector MySQL profile storage with capability bounding for OpenClaw. Tracks interactions, relationships, context, skill usage, notes, preferences, media, food, personas, mood states, engagement patterns, proactive reminders, agent learnings, community sentiment, trending topics, and community events. Now includes HindSight (post-conversation consolidation), HoloGraphic (multi-dimensional tagging), and Hancho (knowledge graph reasoning) memory systems. v4.0.0 integrates with the memory_consolidation.py script for automated heartbeat-based memory maintenance. All SQL is routed through docker exec into the MyVector container. Requires a dedicated least-privilege MySQL user — root/admin accounts are rejected.
5.0.1 – 2026-05-27 (security audit response)
VectorClaw v5.0.0 makes MyVector self-sufficient. It includes three memory enhancement systems (v4) plus auto-extraction and native knowledge graph reasoning (v5):
user_context (categories: discovery, behavioral, emotional)user_context (category: metadata)user_context (categories: reasoning, social_graph)| Type | Table | Description |
|---|---|---|
| Episodic | user_context | Specific events/experiences with timestamps |
| Semantic | user_context | General facts and knowledge |
| Procedural | user_context | How-to knowledge and habits |
| Emotional | user_mood | Emotional states with triggers and intensity |
| Preference | user_preferences | Explicit preferences with confidence |
| Synaptic | synaptic_memory | Key-value memory with priority and decay |
| HoloGraphic | user_context (metadata) | Multi-dimensional tags (emotion, context, urgency, people) |
| HindSight | user_context (discovery) | Post-conversation consolidation findings |
| Auto-Extracted | memories (v5.0.0) | LLM-extracted facts with source='auto', deduped on insert |
| Graph-Derived | memory_relations (v5.0.0) | Knowledge graph edges: mentions, implies, contradicts, same_entity, related_to |
| Extraction Log | extraction_log (v5.0.0) | Quality metrics for empirical prompt tuning |
All memories in the memories table now track their provenance:
| Source | Description | Initial Confidence |
|---|---|---|
manual | Written explicitly by agent | 0.9 |
auto | Extracted by local LLM hook | 0.6-0.7 |
consolidation | Derived from consolidation pass | 0.7 |
import | Imported from external system | 0.5 |
Auto-extracted memories can be promoted via verified_by_human = TRUE when grounding confirms accuracy.
The auto-extraction hook uses a local LLM to extract atomic facts from conversation text and insert them directly into MyVector. This replaces Mem0's zero-effort capture with full ownership.
Script: scripts/auto-extract.py
# Extract from text
python3 scripts/auto-extract.py "conversation text here" --user <discord_id>
# Extract from file
python3 scripts/auto-extract.py --file /path/to/conversation.txt --user <discord_id>
# Dry run (preview without inserting)
python3 scripts/auto-extract.py "text" --user <id> --dry-run
# Output as JSON
python3 scripts/auto-extract.py "text" --user <id> --dry-run --json
Pipeline:
source='auto' for quality trackingextraction_logPrompt design: Uses string concatenation (not f-strings) to avoid curly brace issues with JSON examples. Strict key name requirements in prompt.
Fallback: Regex-based extraction when LLM is unavailable.
Native MySQL knowledge graph that replaces Hancho's external reasoning.
Table: memory_relations
fact_id, related_fact_id → FK to memories.idrelation_type: mentions, implies, contradicts, same_entity, related_toconfidence: 0.0-1.0source: auto, manual, consolidationConsolidation script: scripts/hancho-consolidate.py
# Consolidate recent memories (default: last 6 hours)
python3 scripts/hancho-consolidate.py --user <discord_id>
# Lookback window
python3 scripts/hancho-consolidate.py --user <id> --hours 24
# Dry run
python3 scripts/hancho-consolidate.py --user <id> --dry-run
Pipeline:
memory_relationsGraph traversal: Pre-computed view memory_graph_1hop for fast retrieval.
Tracks auto-extraction quality for empirical tuning:
Table: extraction_log
memory_consolidation.py at ~/.openclaw/workspace/scripts/memory_consolidation.pypython3 memory_consolidation.py --user <discord_id>
python3 memory_consolidation.py --all-users
python3 memory_consolidation.py --user <id> --dry-run
python3 memory_consolidation.py --user <id> --hindisght-only
python3 memory_consolidation.py --user <id> --holohraphic-only
python3 memory_consolidation.py --user <id> --hancho-only
docker exec.env files for credentials (parsed as KEY=VALUE, never shell-sourced)sql_safe_exec.sh for safetyquery command is SELECT-onlysql_safe_exec.sh rejects DROP, TRUNCATE, CREATE, ALTER, GRANT, REVOKE from agent-facing commands)upgrade_vX_to_vY.sql) use DDL (ALTER TABLE, CREATE TABLE IF NOT EXISTS) and must be run by a human administrator using docker exec directly — NOT through the agent-facing sql_safe_exec.sh wrapper. This is intentional: schema evolution requires DDL, but day-to-day agent operations do not./* */, --, #)memory_relations table replacing Hancho (v5.0.0)memory_graph_1hop view for retrieval-time graph expansionextraction_log table for empirical prompt tuningscripts/auto-extract.py. Run in parallel for 7-10 days to validate quality, then retire.memory_relations table + scripts/hancho-consolidate.py. Native MySQL graph is tighter and fully owned.| Option | Default | Notes |
|---|---|---|
MYSQL_USER | required | Dedicated least-privilege account (NOT root) |
MYSQL_PASSWORD | required | Store in .env (chmod 600) |
MYSQL_PORT | 3310 | MyVector Docker port mapping |
DATABASE | mysqlclaw | Target database |
MyVector Docker container must be running:
docker run -d --name myvector-db -p 3310:3306 \
-e MYSQL_ROOT_PASSWORD=<root_pw> \
-e MYSQL_DATABASE=mysqlclaw \
ghcr.io/askdba/myvector:mysql8.4
⚠️ Before installation: Review the PRIVACY & CONSENT NOTICE above. Obtain explicit opt-in from all users before enabling auto-extraction or memory profiling.
# 1. Start MyVector container (if not running)
docker run -d --name myvector-db -p 3310:3306 \
-e MYSQL_ROOT_PASSWORD=<root_pw> \
-e MYSQL_DATABASE=mysqlclaw \
ghcr.io/askdba/myvector:mysql8.4
# 2. Create a dedicated least-privilege user inside MyVector
docker exec -it myvector-db mysql -u root -p<root_pw> -e "
CREATE USER IF NOT EXISTS 'mysqlclaw'@'%' IDENTIFIED BY '<strong_password>';
GRANT SELECT, INSERT, UPDATE, DELETE ON mysqlclaw.* TO 'mysqlclaw'@'%';
FLUSH PRIVILEGES;
"
# 3. Create .env file with the dedicated user's credentials
cat > .env <<'EOF'
MYSQL_USER=mysqlclaw
MYSQL_PASSWORD=<strong_password>
MYSQL_PORT=3310
DATABASE=mysqlclaw
EOF
chmod 600 .env
# 4. Apply schema with setup wizard
cd ~/.openclaw/workspace/skills/custom-mysql
./setup_wizard.sh
# 5. Run initial consolidation (DRY RUN first, then live)
cd ~/.openclaw/workspace
python3 scripts/memory_consolidation.py --user <your_discord_id> --dry-run
python3 scripts/memory_consolidation.py --user <your_discord_id>
Auto-extraction is DISABLED by default. To enable per-user after explicit opt-in:
export MYSQL_USER=mysqlclaw
export MYSQL_PASSWORD=<your_password>
python3 scripts/auto-extract.py --file /path/to/conversation.txt --user <discord_id> --dry-run
# Review output, then run without --dry-run
# Query (SELECT-only)
custom_mysql.sh query "SELECT * FROM users LIMIT 5"
# Execute script (DML requires interactive confirmation)
custom_mysql.sh exec --file /path/to/scripts.sql
# Convenience commands:
custom_mysql.sh insert_interaction <uid> <dir> <topic> <summary> [sentiment] [is_important]
custom_mysql.sh insert_note <uid> <note> [category] [is_pinned]
custom_mysql.sh insert_context <uid> <key> <value> [type] [importance] [expires_at]
custom_mysql.sh insert_skill_usage <uid> <skill_name> [action] [status] [duration_ms] [error_type]
custom_mysql.sh insert_relationship <uid> <related_uid> <type> [strength] [trust] [notes]
custom_mysql.sh insert_mood <uid> <mood> [intensity] [trigger_topic] [confidence]
custom_mysql.sh insert_reminder <uid> <trigger_type> <condition> <text> [priority]
custom_mysql.sh insert_thought <uid> <thought> [type] [channel_id]
custom_mysql.sh insert_learning <type> <title> <description> [priority] [user] [skill]
custom_mysql.sh insert_event <type> <title> [description] [channel_id]
# Memory consolidation (v4.0.0):
python3 ~/.openclaw/workspace/scripts/memory_consolidation.py --user <uid>
python3 ~/.openclaw/workspace/scripts/memory_consolidation.py --all-users
data_retention_policy table, v5.0.1)All retention defaults are configurable. Run SELECT * FROM data_retention_policy; to review.
| Data Type | Default Retention | Table |
|---|---|---|
| User interactions | 30 days | user_interactions |
| Mood states | 90 days | user_mood |
| HoloGraphic metadata | 30 days | user_context |
| Consolidation-derived | 90 days | user_context |
| Agent reasoning (thought_stream) | 7 days | thought_stream |
| Synaptic memory | 365 days (with decay) | synaptic_memory |
| Community sentiment/trends | 90 days | community_sentiment, trending_topics |
| Activity heatmap | 90 days | user_activity_heatmap |
| Auto-extracted memories | 30 days | memories where source='auto' |
| Manual memories | 365 days | memories where source='manual' |
| Extraction quality logs | 30 days | extraction_log |
| Audit logs | 365 days | audit_log |
| Notes, relationships, preferences | Until explicitly deleted | user_notes, user_relationships, etc. |
| Reminders | Auto-deactivate after max_triggers | proactive_reminders |
⚠️ Agent reasoning logs (thought_stream) default to 7-day retention. Chain-of-thought data is sensitive and should not be retained long-term. Configure in data_retention_policy.
rollback_user.sql covers all user-data tablesaudit_log (v5.0.1)extraction_config table)agent_learnings affecting behavior must be reviewed before activationdocker execos.environ. Shell scripts (.sh) load from .env file.--defaults-extra-file with chmod 600 for shell commands..env parsed safely: KEY=VALUE line parsing only — never evaluated as shell code.query command is SELECT-only (no DML through query).sql_safe_exec.sh prevents DDL (DROP, TRUNCATE, CREATE, ALTER, GRANT, REVOKE) for agent-facing commands.upgrade_vX.sql) must be run directly via docker exec by an administrator with root privileges, not through the agent-facing wrappers.audit_log table: Tracks all data access and modification for accountability (v5.0.1).extraction_config table: Enforces per-user opt-in for auto-extraction (v5.0.1).data_retention_policy table: Configurable retention limits for all data types (v5.0.1).user_interactions.sentiment (enum) + sentiment_score (float, -1 to 1)community_sentiment aggregated by time periodmood_impact field)**: The agent_config_files` table and related commands removedSee changelog.md for full version history.
For step-by-step instructions, see SETUP_GUIDE.md.
Visit https://clawhub.ai/paradoxfuzzle/custom-mysql for live updates.