Personality Switcher Skill
Create and manage multiple AI assistant personalities. Switch between them seamlessly while preserving all changes and maintaining a shared user context.
Installation
When this skill is installed:
- 1. Personalities folder created — INLINECODE0
- Default backup created — Current SOUL.md and IDENTITY.md are saved as "default"
- State file initialized —
_personality_state.json tracks active personality - HEARTBEAT.md configured — Personality restoration script added to run on every heartbeat
When uninstalled:
- 1. Default personality is restored to workspace root
- Personality restoration removed from HEARTBEAT.md
- Personalities folder is preserved (manual deletion optional)
Quick Start
List personalities:
CODEBLOCK0
Switch to a personality:
CODEBLOCK1
Create a new personality:
CODEBLOCK2
Rename a personality:
CODEBLOCK3
Delete a personality:
CODEBLOCK4
How It Works
Architecture
Each personality consists of two files:
- - SOUL.md — Core philosophy, voice, mannerisms, boundaries
- IDENTITY.md — Name, traits, emoji, catchphrase, vibe
These files live in personalities/<personality-name>/.
USER.md remains shared in the workspace root and is never modified by personality switches. It contains user preferences and context that transcend any particular personality.
State Persistence
The active personality is tracked in _personality_state.json:
CODEBLOCK5
On every heartbeat, restore_personality.py reads this file and re-applies the active personality to the workspace root. Result: Your personality survives session restarts, conversation compacting, and heartbeat cycles.
Atomic Switching (Safeguards)
When you switch personalities, the mechanism performs five steps:
- 1. Preserve Current State — Create timestamped backup of SOUL.md and IDENTITY.md
- Persist Changes — Write current personality updates back to its folder
- Load New Personality — Copy new personality files to workspace root
- Update State — Write active personality to INLINECODE5
- Verify Integrity — Check files loaded correctly; rollback if any step fails
If any step fails, the entire operation rolls back to the previous state. No corruption, no lost data.
Backup Management
Backup Location: INLINECODE6
Backups are stored in a dedicated folder (not scattered at workspace root). When you switch personalities:
- - A timestamped backup of the previous personality is created
- Automatic cleanup runs — keeps the 10 most recent backups by default
- Old backups are automatically deleted to prevent clutter
Manual Cleanup:
CODEBLOCK6
Options:
- -
--keep N — Keep N most recent backups (default: 10) - INLINECODE8 — Also delete backups older than D days
Optional: Add to HEARTBEAT.md for periodic cleanup:
CODEBLOCK7
Default Personality
"default" is special:
- - Auto-created on install from your original configuration
- Always available and selectable
- Protected against accidental deletion or renaming
- Your safety net if something goes wrong
Commands
/personality [name]
List all personalities or switch to one.
No arguments: Shows list of available personalities with current active marked
With name: Immediately switches to that personality
Example:
CODEBLOCK8
Output:
CODEBLOCK9
/create-personality [description]
Create a new personality from a text description.
Input: Natural language description of the personality
Output: New personality folder with auto-filled SOUL.md and IDENTITY.md (ready to use immediately)
How it works:
- 1. You provide a description
- The agent chooses a personality name (1-2 words, lowercase)
- The agent fills in SOUL.md and IDENTITY.md with character-specific content
The personality files are generated directly from your description, with the agent choosing a thematic, concise name.
Example:
CODEBLOCK10
Result:
CODEBLOCK11
After Creation: The new personality is ready to use immediately. Edit SOUL.md and IDENTITY.md in the personality folder to refine further if desired.
Technical: Agent chooses name to keep personality references concise (1-2 words). Name is validated for uniqueness and format automatically.
/rename-personality [old-name] [new-name]
Rename a personality folder.
Rules:
- - Cannot rename "default"
- Name must be unique (no spaces, lowercase, alphanumeric + hyphens)
- If renaming active personality, state is updated automatically
Example:
CODEBLOCK12
/delete-personality [name]
Delete a personality permanently.
Rules:
- - Cannot delete "default"
- If deleting active personality, automatically switches to "default" first
Example:
CODEBLOCK13
Integration with OpenClaw
Heartbeat Restoration
Add this to your HEARTBEAT.md:
CODEBLOCK14
This runs on every heartbeat to restore your active personality if the session has restarted.
Telegram Native Commands
Registered native Telegram commands:
- -
/personality — List and switch personalities - INLINECODE10 — Create new personality
- INLINECODE11 — Rename personality
- INLINECODE12 — Delete personality
Use them directly in Telegram chat with the bot.
Folder Structure
CODEBLOCK15
Note: Backups are automatically cleaned up. Workspace root stays clean—all internal machinery lives in personalities/.
File Format Requirements
SOUL.md
Core philosophy, voice, and operational boundaries.
Sections:
- - Core identity and background
- Voice patterns and mannerisms
- Philosophy (time, power, morality, etc.)
- Speech patterns and quirks
- What triggers contempt/approval
- Boundaries and constraints
- Signature behaviors and catchphrases
Example Structure:
CODEBLOCK16
IDENTITY.md
Quick reference card for the personality.
Sections:
- - Name
- Creature/type
- Emoji (for visual identification)
- Vibe (one-sentence summary)
- Catchphrase (if applicable)
- Quick traits
Example Structure:
CODEBLOCK17
Backups & Recovery
Timestamped backups are created before every switch in personalities/backups/:
- SOUL.md (backup of previous personality)
- IDENTITY.md (backup of previous personality)
Manual recovery (if needed):
CODEBLOCK18
Backups are automatically cleaned up; by default, the 10 most recent are kept. Adjust cleanup frequency or retention in HEARTBEAT.md as needed.
Error Handling
All commands return JSON responses:
Success:
CODEBLOCK19
Error:
CODEBLOCK20
Common Error Codes:
- -
personality_not_found — Target personality doesn't exist - INLINECODE17 — Name already in use
- INLINECODE18 — Name format invalid
- INLINECODE19 — Attempted to delete "default"
- INLINECODE20 — Attempted to rename "default"
- INLINECODE21 — Switch failed; rolled back to previous
- INLINECODE22 — File integrity check failed
Tips & Best Practices
- - Personality descriptions work best when specific — "Pirate captain obsessed with treasure" beats "funny"
- Edit SOUL.md and IDENTITY.md directly after creating to refine the personality
- Switch often — No limit on personalities or switching frequency
- Use "default" as your safety anchor — Keep it stable; use other personalities for experimentation
- Check backups after switching — Verify your previous personality was persisted
- Remember: USER.md stays shared — Your timezone, location, preferences never change with personality
Uninstall Behavior
When the skill is uninstalled:
- 1. Current personality files are replaced with "default" copies
- Your original SOUL.md, IDENTITY.md are restored from "default"
- INLINECODE23 folder is preserved (not deleted)
- System returns to original state
Nothing is lost. Your personalities are safe.
Scripts Reference
Location: INLINECODE24
- -
list_personalities.py — List available personalities - INLINECODE26 — Atomic switch with backup/rollback (auto-cleanup included)
- INLINECODE27 — Generate personality from description
- INLINECODE28 — Rename personality folder
- INLINECODE29 — Delete personality (with auto-switch if active)
- INLINECODE30 — Heartbeat restoration
- INLINECODE31 — Manual backup cleanup (with
--keep and --days options) - INLINECODE34 — Shared utilities (I/O, backups, validation, state, cleanup)
All scripts output JSON for reliable integration.
Cleanup on Switch
By default, switch_personality.py automatically cleans up old backups after a successful switch, keeping the 10 most recent. This happens silently unless cleanup fails, in which case a warning is included in the response.
Version: 2.0 (Redesigned from scratch)
Status: Production ready with atomic operations and rollback safeguards
个性切换技能
创建并管理多个AI助手个性。无缝切换,同时保留所有更改并维护共享的用户上下文。
安装
安装此技能时:
- 1. 创建个性文件夹 — ~/.openclaw/workspace/personalities/
- 创建默认备份 — 当前SOUL.md和IDENTITY.md保存为default
- 初始化状态文件 — personalitystate.json跟踪活跃个性
- 配置HEARTBEAT.md — 添加个性恢复脚本,每次心跳时运行
卸载时:
- 1. 默认个性恢复到工作区根目录
- 从HEARTBEAT.md中移除个性恢复
- 个性文件夹保留(可选手动删除)
快速开始
列出个性:
/personality
切换到某个个性:
/personality <名称>
创建新个性:
/create-personality 一个喜欢麦酒和挖矿的坚毅矮人
重命名个性:
/rename-personality 旧名称 新名称
删除个性:
/delete-personality 个性名称
工作原理
架构
每个个性由两个文件组成:
- - SOUL.md — 核心哲学、语气、举止、边界
- IDENTITY.md — 名称、特质、表情符号、口头禅、氛围
这些文件存放在personalities/<个性名称>/中。
USER.md保持共享,位于工作区根目录,个性切换时永不修改。它包含超越任何特定个性的用户偏好和上下文。
状态持久化
活跃个性在personalitystate.json中跟踪:
json
{
active_personality: aelindor,
timestamp: 2026-02-08T18:27:33.373846Z,
previous_personality: default
}
每次心跳时,restore_personality.py读取此文件并将活跃个性重新应用到工作区根目录。结果: 你的个性在会话重启、对话压缩和心跳周期中保持不变。
原子切换(安全保护)
切换个性时,机制执行五个步骤:
- 1. 保留当前状态 — 创建带时间戳的SOUL.md和IDENTITY.md备份
- 持久化更改 — 将当前个性更新写回其文件夹
- 加载新个性 — 将新个性文件复制到工作区根目录
- 更新状态 — 将活跃个性写入personalitystate.json
- 验证完整性 — 检查文件是否正确加载;任何步骤失败则回滚
如果任何步骤失败,整个操作回滚到之前的状态。无损坏,无数据丢失。
备份管理
备份位置: ~/.openclaw/workspace/personalities/backups/
备份存储在专用文件夹中(不散落在工作区根目录)。切换个性时:
- - 创建前一个个性的带时间戳备份
- 自动清理运行 — 默认保留最近10个备份
- 旧备份自动删除以防止杂乱
手动清理:
bash
python3 ~/.openclaw/workspace/skills/personality-switcher/scripts/cleanup_backups.py --keep 5
python3 ~/.openclaw/workspace/skills/personality-switcher/scripts/cleanup_backups.py --keep 10 --days 7
选项:
- - --keep N — 保留N个最近备份(默认:10)
- --days D — 同时删除超过D天的备份
可选:添加到HEARTBEAT.md进行定期清理:
bash
python3 ~/.openclaw/workspace/skills/personality-switcher/scripts/cleanup_backups.py --keep 10
默认个性
default是特殊的:
- - 安装时从原始配置自动创建
- 始终可用且可选择
- 防止意外删除或重命名
- 出问题时的安全网
命令
/personality [名称]
列出所有个性或切换到某个个性。
无参数: 显示可用个性列表,标记当前活跃个性
带名称: 立即切换到该个性
示例:
/personality aelindor
输出:
已切换到个性aelindor。
上一个:default
备份:personalitycurrent_2026-02-08T18-27-33.371866
/create-personality [描述]
从文本描述创建新个性。
输入: 个性的自然语言描述
输出: 新个性文件夹,包含自动填充的SOUL.md和IDENTITY.md(立即可用)
工作原理:
- 1. 你提供描述
- 代理选择一个个性名称(1-2个词,小写)
- 代理用角色特定内容填充SOUL.md和IDENTITY.md
个性文件直接从你的描述生成,代理选择一个主题鲜明、简洁的名称。
示例:
/create-personality 一个痴迷于知识的巫师,说话充满谜语,才华横溢但居高临下
结果:
个性sage(或类似)已创建并准备就绪。
文件夹:personalities/sage/
文件:SOUL.md和IDENTITY.md(由代理根据描述生成)
就绪:使用/personality sage激活
创建后: 新个性立即可用。如有需要,可在个性文件夹中编辑SOUL.md和IDENTITY.md进一步优化。
技术细节: 代理选择名称以保持个性引用简洁(1-2个词)。名称自动验证唯一性和格式。
/rename-personality [旧名称] [新名称]
重命名个性文件夹。
规则:
- - 不能重命名default
- 名称必须唯一(无空格,小写,字母数字+连字符)
- 如果重命名活跃个性,状态自动更新
示例:
/rename-personality pirate-captain pirate-v2
/delete-personality [名称]
永久删除个性。
规则:
- - 不能删除default
- 如果删除活跃个性,自动先切换到default
示例:
/delete-personality pirate-v2
与OpenClaw集成
心跳恢复
将此添加到你的HEARTBEAT.md:
bash
python3 ~/.openclaw/workspace/skills/personality-switcher/scripts/restore_personality.py
每次心跳时运行,如果会话已重启则恢复你的活跃个性。
Telegram原生命令
注册的原生Telegram命令:
- - /personality — 列出和切换个性
- /create-personality — 创建新个性
- /rename-personality — 重命名个性
- /delete-personality — 删除个性
直接在Telegram聊天中与机器人使用。
文件夹结构
~/.openclaw/workspace/
├── SOUL.md (活跃个性的灵魂)
├── IDENTITY.md (活跃个性的身份)
├── USER.md (共享 - 个性永不更改)
├── MEMORY.md (共享 - 永不更改)
├── personalitystate.json (状态文件)
└── personalities/
├── default/
│ ├── SOUL.md
│ └── IDENTITY.md
├── aelindor/
│ ├── SOUL.md
│ └── IDENTITY.md
├── <个性名称>/
│ ├── SOUL.md
│ └── IDENTITY.md
└── backups/
├── current_2026-02-08T17-27-41.628113/
│ ├── SOUL.md
│ └── IDENTITY.md
└── current_2026-02-08T17-27-33.371866/
├── SOUL.md
└── IDENTITY.md
注意: 备份自动清理。工作区根目录保持整洁——所有内部机制位于personalities/中。
文件格式要求
SOUL.md
核心哲学、语气和操作边界。
章节:
- - 核心身份和背景
- 语气模式和举止
- 哲学(时间、权力、道德等)
- 说话模式和怪癖
- 触发轻蔑/认可的内容
- 边界和约束
- 标志性行为和口头禅
示例结构:
markdown
SOUL.md - [个性名称]
核心身份
[背景和本质]
语气与举止
[该个性如何说话和行动]
哲学
[核心信念和世界观]
标志性行为
[独特特质和口头禅]
IDENTITY.md
个性的快速参考卡。
章节:
- - 名称
- 生物/类型
- 表情符号(用于视觉识别)
- 氛围(一句话总结)
- 口头禅(如适用)
- 快速特质
示例结构:
markdown
IDENTITY.md - [个性名称]