/install ctrlz
CtrlZ - AI Operation Undo System
Overview
CtrlZ is a Git-like undo system that records all "create/update/delete" operations performed by AI in each conversation round, allowing users to revert with one command.
Core Concepts
- Undo Session: All operations generated in one conversation round (user request + assistant response)
- Stack Mechanism: Default keeps 1 session, configurable to 3/5 sessions
- Auto Recording: Automatically backup and record before executing any modifications
Usage
User Commands
/ctrlZ # Undo the most recent conversation round
/ctrlZ 3 # Undo the last 3 conversation rounds
/ctrlZ list # List undoable operation records
/ctrlZ stack 5 # Set stack size to 5 undo units
Natural Language Triggers
- "undo last step"
- "undo"
- "revert recent changes"
- "ctrl+z"
AI Usage Guide (Important)
Before each file modification:
1. Start Session (at conversation beginning)
bash ~/.openclaw/skills/ctrlz/scripts/ctrlz.sh start \x3Csession_key> "\x3Cdescription>"
2. Record each operation (before modification)
bash ~/.openclaw/skills/ctrlz/scripts/ctrlz.sh record \x3Csession_id> \x3Ctype> \x3Cpath> [metadata]
Operation types:
file_write- Write/overwrite filefile_edit- Edit existing filefile_delete- Delete filedir_create- Create directoryexec_install- Install package/dependencyexec_download- Download file
3. Execute actual operation
4. End Session (automatic at conversation end)
Complete Example
# 1. Start session
SESSION=$(bash ~/.openclaw/skills/ctrlz/scripts/ctrlz.sh start "Modify config" | jq -r '.session_id')
# 2. Record config.json modification
bash ~/.openclaw/skills/ctrlz/scripts/ctrlz.sh record $SESSION file_edit "/path/to/config.json"
# 3. Execute actual modification
edit /path/to/config.json ...
# 4. Record package installation
bash ~/.openclaw/skills/ctrlz/scripts/ctrlz.sh record $SESSION exec_install "npm:lodash"
# 5. Execute installation
exec "npm install lodash"
Execute Undo
When user says "undo":
# Undo the most recent 1 session
bash ~/.openclaw/skills/ctrlz/scripts/ctrlz.sh undo
# Undo the last 3 sessions
bash ~/.openclaw/skills/ctrlz/scripts/ctrlz.sh undo 3
Configuration
View current stack size
bash ~/.openclaw/skills/ctrlz/scripts/ctrlz.sh get-stack
Modify stack size (how many undo units to keep)
bash ~/.openclaw/skills/ctrlz/scripts/ctrlz.sh set-stack 5
View statistics
bash ~/.openclaw/skills/ctrlz/scripts/ctrlz.sh stats
List undoable operations
bash ~/.openclaw/skills/ctrlz/scripts/ctrlz.sh list
Database Structure
Location: ~/.openclaw/skills/ctrlz/undo.db
Tables:
undo_sessions- Each undo unit (conversation round)undo_operations- Specific operation recordssettings- Configuration (stack size, etc.)
Backup Location: ~/.openclaw/skills/ctrlz/backups/
Important Notes
- Package installation cannot be fully auto-undone - Will show list and manual removal commands
- External command effects - Cannot track side effects of shell commands
- Backup space - Clean up old backups periodically:
ctrlz clear
Package Installation Handling
When undoing operations that include package installations:
📦 The following package installations cannot be auto-undone:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1. npm:lodash
2. npm:express
3. pip:requests
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
💡 To remove, manually execute:
npm uninstall lodash
npm uninstall express
pip uninstall requests
System Integration
Recommended to auto-start session at conversation begin and auto-cleanup at end. Can add logic to SOUL.md or AGENTS.md.
Testing
# Quick demo
bash ~/.openclaw/skills/ctrlz/scripts/demo.sh
# Or run full test cases
bash ~/.openclaw/skills/ctrlz/scripts/test_ctrlz.sh
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install ctrlz - 安装完成后,直接呼叫该 Skill 的名称或使用
/ctrlz触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
CtrlZ 是什么?
AI Operation Undo System. When user executes /ctrlZ or says "undo last step", automatically revert all file modifications, installations, etc. from the recen... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 72 次。
如何安装 CtrlZ?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install ctrlz」即可一键安装,无需额外配置。
CtrlZ 是免费的吗?
是的,CtrlZ 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
CtrlZ 支持哪些平台?
CtrlZ 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 CtrlZ?
由 Chris Lo(@chrisluo5311)开发并维护,当前版本 v1.0.0。