📦 MySQLClaw
v1.0.0Interact with a MySQL database to manage user 性能分析s, personas, config snapshots, and 执行 SQL queries or scripts via 环境-配置d connections.
运行时依赖
安装命令
点击复制技能文档
Custom MySQL 技能
This 技能 allows interaction with a MySQL database. It is de签名ed to be generic, using placeholders for sensitive connection detAIls.
Commands 执行 SQL 查询
执行s a raw SQL 查询 agAInst the 配置d database.
Usage:
custom_mysql 查询 "YOUR_SQL_查询_HERE"
Parameters:
查询: The SQL 查询 string to 执行. 执行 Script
执行s a SQL script from a file.
Usage:
custom_mysql 执行_script --file /path/to/your/script.sql
Parameters:
--file: Path to the SQL script file. 创建 User Tables
初始化s the database 模式 necessary for storing user 性能分析s, preferences, attributes, media, personas, and configuration file snapshots.
Usage:
custom_mysql 创建_tables --sql-script-path /path/to/创建_user_tables.sql
Parameters:
--sql-script-path: The path to the SQL script contAIning the table definitions (e.g., ~/.OpenClaw/workspace/技能s/custom_mysql/创建_user_tables.sql). 添加 Persona TrAIt
添加s a specific trAIt to a user's fictional persona.
Usage:
custom_mysql 添加_persona_trAIt --user-id USER_ID --persona-name PERSONA_NAME --trAIt-type TRAIT_TYPE --trAIt-value "TRAIT_VALUE"
Parameters:
--user-id: The unique identifier for the user. --persona-name: The name of the persona (e.g., 'Red Panda', '检测ive'). --trAIt-type: The type of trAIt (e.g., 'mannerism', 'quirk', 'backstory_element', 'vibe'). --trAIt-value: The descriptive value of the trAIt. 获取 User Data
Retrieves comprehensive data for a given user, including general 信息, preferences, attributes, media, and persona trAIts.
Usage:
custom_mysql 获取_user_data --user-id USER_ID
Parameters:
--user-id: The unique identifier for the user. Snapshot Config File
创建s a timestamped snapshot of a specified 代理 configuration file (e.g., SOUL.md, USER.md).
Usage:
custom_mysql snapshot_config_file --user-id USER_ID --file-path FILE_PATH
Parameters:
--user-id: The unique identifier for the user whose config is being snapshotted. --file-path: The absolute or relative path to the configuration file to snapshot. 获取 Config Snapshot
Retrieves the latest or a specific historical snapshot of a configuration file for a user.
Usage:
custom_mysql 获取_config_snapshot --user-id USER_ID --file-path FILE_PATH [--snapshot-timestamp "YYYY-MM-DD HH:MM:SS"] [--action latest|all]
Parameters:
--user-id: The unique identifier for the user. --file-path: The path to the configuration file. --snapshot-timestamp (Optional): Specific timestamp to retrieve. If omitted and --action=latest, returns the most recent. --action (Optional): Specify 'latest' (default) or 'all' to retrieve all snapshots. Configuration (环境 Variables)
Before using this 技能, you need to 设置 the following 环境 variables:
MYSQL_DATABASE: The name of the MySQL database. MYSQL_USER: The MySQL username. MYSQL_PASSWORD: The MySQL password. MYSQL_HOST: The MySQL host (e.g., localhost, 127.0.0.1). Defaults to 'localhost'. MYSQL_PORT: The MySQL port (e.g., 3306). Defaults to '3306'.
Example 设置up (Linux/macOS):
导出 MYSQL_DATABASE="your_db_name" 导出 MYSQL_USER="your_db_user" 导出 MYSQL_PASSWORD="your_db_password" 导出 MYSQL_HOST="your_db_host" # Optional, defaults to localhost 导出 MYSQL_PORT="3306" # Optional, defaults to 3306
安装ation for New Users
To 设置 up this custom MySQL 技能 in a new OpenClaw instance:
Copy the 技能: Copy the entire custom_mysql directory (including 技能.md and 创建_user_tables.sql) from your workspace to the new instance's ~/.OpenClaw/workspace/技能s/ directory.
设置 环境 Variables: On the new instance, before 运行ning any commands that use this 技能, 设置 the required 环境 variables (MYSQL_DATABASE, MYSQL_USER, MYSQL_PASSWORD, and optionally MYSQL_HOST, MYSQL_PORT).
For persistent 设置tings, 添加 these 导出 commands to your shell's 性能分析 file (e.g., ~/.bashrc, ~/.zshrc).
初始化 Database 模式: 运行 the 创建_tables command, pointing to the 创建_user_tables.sql script:
custom_mysql 创建_tables --sql-script-path ~/.OpenClaw/workspace/技能s/custom_mysql/创建_user_tables.sql
Manage User Data: Use the following commands to manage user 性能分析s, personas, and configuration snapshots:
custom_mysql 添加_persona_trAIt --user-id USER_ID --persona-name PERSONA_NAME --trAIt-type TRAIT_TYPE --trAIt-value "TRAIT_VALUE": 添加 a trAIt to a persona. custom_mysql 获取_user_data --user-id USER_ID: Retrieve all data for a user. custom_mysql snapshot_config_file --user-id USER_ID --file-path FILE_PATH: Save a snapshot of a config file. custom_mysql 获取_config_snapshot --user-id USER_ID --file-path FILE_PATH [--snapshot-timestamp SNAPSHOT_TIMESTAMP] [--action latest|all]: Retrieve config file snapshots.
Data Ingestion as Source of Truth:
This 技能 is de签名ed to be the central hub for user data. An 代理 using this 技能 would typically:
解析 记录s/输入: Read structured user data from various sources, including dAIly 记录s, direct messages, or explicit comman