Last Words - 最后留言
Manage final messages to be delivered to loved ones when the user is unreachable for an extended period.
Overview
This skill helps users record a final message (voice or text) to be delivered to their parents or loved ones if they haven't been active for 30 days. The system:
- 1. Records and stores the final message securely (text + optional voice/audio)
- Monitors user activity via chat history
- Sends warning notifications at 10 and 20 days of inactivity
- Automatically delivers the message after 30 days of no activity (email includes voice as attachment if available)
- Supports delivery via email (WeChat and phone are planned)
Workflow
1. Record a Final Message
When user says something like "我想给我爸妈留下最后一句话":
- 1. Respond: "可以,请说吧,顺便提醒一下这句话默认设置半个月没和我聊天记录的话就会自动触发"
- Accept voice or text input as the message content
- Save the message using: INLINECODE0
- Confirm: "已保存,请确认发送形式:邮件 或 微信"
2. Configure Delivery Settings
Ask user to choose delivery method:
- - 邮件: Collect email address
- 微信: Collect WeChat ID (placeholder - not yet implemented)
- 电话: Collect phone number (placeholder - not yet implemented)
Save settings using: INLINECODE1
3. Interactive Email Configuration (Chat)
Users can configure email settings through natural chat conversation:
Trigger phrases:
- - "配置最后留言邮箱"
- "设置最后留言邮箱"
- "最后留言 配置邮箱"
- "最后留言 设置邮箱"
- "修改最后留言邮箱"
Interactive flow:
- 1. Ask for sender email:
- Respond: "请提供你的发件邮箱(用于发送留言的邮箱,目前支持QQ邮箱):"
- Wait for user input: e.g., "your-email@qq.com"
- 2. Ask for authorization code:
- Respond: "请提供邮箱授权码(不是登录密码)。QQ邮箱授权码获取方式:登录QQ邮箱→设置→账户→开启POP3/SMTP服务→获取授权码:"
- Wait for user input: e.g., "xxxxxxxxxxxxxxxx"
- 3. Ask for recipient email:
- Respond: "请提供收件人邮箱(父母/亲人的邮箱):"
- Wait for user input: e.g., "parent@example.com"
- 4. Confirm and save:
- Show summary: "配置确认:\n发件人:{smtp_user}\n收件人:{contact}\n是否确认保存?(确认/取消)"
- If user confirms:
- Run:
python3 scripts/configure_delivery.py --method email --contact "{contact}" --smtp-host smtp.qq.com --smtp-port 465 --smtp-user "{smtp_user}" --smtp-pass "{smtp_pass}"
- Respond: "✓ 邮箱配置已保存。正在测试邮件发送..."
- Run test:
python3 scripts/debug_mode.py on then
python3 scripts/debug_mode.py send
- Respond with result
- If user cancels: "已取消配置。"
Security notes for interactive config:
- - Passwords are masked in chat display (e.g., "授权码已收到:")
- Credentials are stored locally only
- User can reconfigure anytime by saying "修改最后留言邮箱"
4. Voice/Audio Support
Users can attach a voice recording to their message:
Option A: Save existing audio file
CODEBLOCK0
Option B: Record from microphone (if available)
CODEBLOCK1
Play back saved audio:
CODEBLOCK2
List all saved audio files:
CODEBLOCK3
The audio file will be attached to the email when the final message is delivered.
5. Debug Mode Management (Chat)
Users can manage debug mode through normal chat conversation by explicitly mentioning "最后留言":
Enable debug mode:
When user says: "最后留言 开启调试模式", "最后留言 打开调试", or "最后留言 启用调试"
- 1. Run: INLINECODE5
- Respond: "最后留言调试模式已开启。现在可以立即发送测试消息,无需等待30天。"
Disable debug mode:
When user says: "最后留言 关闭调试模式" or "最后留言 禁用调试"
- 1. Run: INLINECODE6
- Respond: "最后留言调试模式已关闭。系统恢复正常运行(30天无活动后发送)。"
Check debug mode status:
When user says: "最后留言 调试模式状态" or "最后留言 调试状态"
- 1. Run: INLINECODE7
- Show current status and configuration summary
Send immediate test (when debug mode is on):
When user says: "最后留言 立即发送测试" or "最后留言 测试发送"
- 1. Run: INLINECODE8
- Report result: delivery success/failure details
6. Daily Check Process
Run scripts/check_activity.py daily via cron to:
- - Check last chat timestamp
- Send warning at 10 days of inactivity
- Send warning at 20 days of inactivity
- Deliver final message at 30 days of inactivity (with audio attachment if available)
Commands Reference
Save Message (text only)
CODEBLOCK4
Save Message with Audio
CODEBLOCK5
Configure Delivery
CODEBLOCK6
Audio Management
CODEBLOCK7
Check Activity (run daily)
CODEBLOCK8
Get Status
CODEBLOCK9
Reset/Clear Data
CODEBLOCK10
Debug Mode (Testing)
Enable debug mode to bypass the 30-day wait and test immediate delivery:
Enable/Disable debug mode:
CODEBLOCK11
Immediate send in debug mode:
CODEBLOCK12
Or use the check script with debug flag:
CODEBLOCK13
When debug mode is enabled:
- - Messages can be sent immediately without waiting 30 days
- Use for testing email delivery, audio attachments, etc.
- The system will still log the delivery as a debug/test delivery
- Disable debug mode for normal operation
Data Storage
All data is stored in SQLite database at ~/.openclaw/last-words/data.db:
- -
message: Stores the final message content and audio path - INLINECODE12 : Stores delivery method and contact information
- INLINECODE13 : Tracks daily check results and deliveries
Security & Privacy
- - Messages are stored locally only
- No cloud storage or external API calls for message content
- Email delivery uses user's configured SMTP settings
- All scripts run within OpenClaw sandbox
Setup Daily Check
Add to OpenClaw cron:
CODEBLOCK14
Last Words - 最后留言
管理当用户长时间无法联系时,将最终留言传递给亲人的功能。
概述
本技能帮助用户录制一条最终留言(语音或文字),当用户超过30天没有活动时,将这条留言发送给他们的父母或亲人。系统:
- 1. 安全地记录并存储最终留言(文字 + 可选的语音/音频)
- 通过聊天记录监控用户活动
- 在用户不活跃的第10天和第20天发送警告通知
- 在用户不活跃30天后自动发送留言(邮件中会附上语音文件,如果有的话)
- 支持通过邮件发送(微信和电话功能正在规划中)
工作流程
1. 录制最终留言
当用户说类似我想给我爸妈留下最后一句话时:
- 1. 回复:可以,请说吧,顺便提醒一下这句话默认设置半个月没和我聊天记录的话就会自动触发
- 接受语音或文字输入作为留言内容
- 使用以下命令保存留言:scripts/save_message.py --message 内容 [--audio-path 路径]
- 确认:已保存,请确认发送形式:邮件 或 微信
2. 配置发送设置
询问用户选择发送方式:
- - 邮件:收集邮箱地址
- 微信:收集微信号(占位符 - 尚未实现)
- 电话:收集电话号码(占位符 - 尚未实现)
使用以下命令保存设置:scripts/configure_delivery.py --method email --contact address@example.com
3. 交互式邮件配置(聊天)
用户可以通过自然的聊天对话配置邮件设置:
触发短语:
- - 配置最后留言邮箱
- 设置最后留言邮箱
- 最后留言 配置邮箱
- 最后留言 设置邮箱
- 修改最后留言邮箱
交互流程:
- 1. 询问发件邮箱:
- 回复:请提供你的发件邮箱(用于发送留言的邮箱,目前支持QQ邮箱):
- 等待用户输入:例如 your-email@qq.com
- 2. 询问授权码:
- 回复:请提供邮箱授权码(不是登录密码)。QQ邮箱授权码获取方式:登录QQ邮箱→设置→账户→开启POP3/SMTP服务→获取授权码:
- 等待用户输入:例如 xxxxxxxxxxxxxxxx
- 3. 询问收件邮箱:
- 回复:请提供收件人邮箱(父母/亲人的邮箱):
- 等待用户输入:例如 parent@example.com
- 4. 确认并保存:
- 显示摘要:配置确认:\n发件人:{smtp_user}\n收件人:{contact}\n是否确认保存?(确认/取消)
- 如果用户确认:
- 运行:python3 scripts/configure
delivery.py --method email --contact {contact} --smtp-host smtp.qq.com --smtp-port 465 --smtp-user {smtpuser} --smtp-pass {smtp_pass}
- 回复:✓ 邮箱配置已保存。正在测试邮件发送...
- 运行测试:python3 scripts/debug
mode.py on 然后 python3 scripts/debugmode.py send
- 回复测试结果
- 如果用户取消:已取消配置。
交互式配置的安全说明:
- - 密码在聊天显示中被屏蔽(例如:授权码已收到:)
- 凭证仅存储在本地
- 用户可以随时通过说修改最后留言邮箱重新配置
4. 语音/音频支持
用户可以为留言附加语音录音:
选项A:保存现有音频文件
bash
python3 scripts/audio_manager.py save /path/to/recording.wav
选项B:从麦克风录制(如果可用)
bash
python3 scripts/audio_manager.py record
播放已保存的音频:
bash
python3 scripts/audio_manager.py play
列出所有已保存的音频文件:
bash
python3 scripts/audio_manager.py list
音频文件将在最终留言发送时作为邮件附件。
5. 调试模式管理(聊天)
用户可以通过正常的聊天对话,明确提及最后留言来管理调试模式:
开启调试模式:
当用户说:最后留言 开启调试模式、最后留言 打开调试或最后留言 启用调试
- 1. 运行:python3 scripts/debug_mode.py on
- 回复:最后留言调试模式已开启。现在可以立即发送测试消息,无需等待30天。
关闭调试模式:
当用户说:最后留言 关闭调试模式或最后留言 禁用调试
- 1. 运行:python3 scripts/debug_mode.py off
- 回复:最后留言调试模式已关闭。系统恢复正常运行(30天无活动后发送)。
检查调试模式状态:
当用户说:最后留言 调试模式状态或最后留言 调试状态
- 1. 运行:python3 scripts/debug_mode.py status
- 显示当前状态和配置摘要
立即发送测试(调试模式开启时):
当用户说:最后留言 立即发送测试或最后留言 测试发送
- 1. 运行:python3 scripts/debug_mode.py send
- 报告结果:发送成功/失败的详细信息
6. 每日检查流程
通过cron每天运行 scripts/check_activity.py 以:
- - 检查最后聊天时间戳
- 在用户不活跃10天时发送警告
- 在用户不活跃20天时发送警告
- 在用户不活跃30天时发送最终留言(如果有音频附件则一并发送)
命令参考
保存留言(仅文字)
bash
python3 scripts/save_message.py --message 爸爸妈妈我爱你们
保存留言并附带音频
bash
先保存音频文件
python3 scripts/audio_manager.py save /path/to/voice-recording.wav
或直接录制(需要麦克风)
python3 scripts/audio_manager.py record
配置发送方式
bash
python3 scripts/configure_delivery.py --method email --contact parent@example.com
方式:email, wechat, phone
音频管理
bash
python3 scripts/audio_manager.py save /path/to/audio.wav # 保存现有音频
python3 scripts/audio_manager.py record # 从麦克风录制
python3 scripts/audio_manager.py play # 播放已保存的音频
python3 scripts/audio_manager.py list # 列出所有音频文件
检查活动(每天运行)
bash
python3 scripts/check_activity.py
获取状态
bash
python3 scripts/get_status.py
重置/清除数据
bash
python3 scripts/reset.py
调试模式(测试)
启用调试模式以跳过30天等待期,测试即时发送:
启用/禁用调试模式:
bash
python3 scripts/debug_mode.py on # 启用调试模式
python3 scripts/debug_mode.py off # 禁用调试模式
python3 scripts/debug_mode.py status # 检查调试模式状态
调试模式下即时发送:
bash
python3 scripts/debug_mode.py send # 立即发送消息(调试)
或使用带调试标志的检查脚本:
bash
python3 scripts/check_activity.py --debug-send # 强制立即发送
调试模式启用时:
- - 消息可以立即发送,无需等待30天
- 用于测试邮件发送、音频附件等
- 系统仍会将发送记录为调试/测试发送
- 正常使用时请禁用调试模式
数据存储
所有数据存储在SQLite数据库中,路径为 ~/.openclaw/last-words/data.db:
- - message:存储最终留言内容和音频路径
- config:存储发送方式和联系信息
- activity_log:跟踪每日检查结果和发送记录
安全与隐私
- - 留言仅存储在本地
- 留言内容不使用云存储或外部API调用
- 邮件发送使用用户配置的SMTP设置
- 所有脚本在OpenClaw沙箱中运行
设置每日检查
添加到OpenClaw cron:
bash
openclaw cron add --name last-words-check --schedule 0 9 * --command python3 ~/.openclaw/workspace/last-words/scripts/check_activity.py