telegram_unattended_mode
Enables continuous remote task execution by waiting for user instructions between automated operations, sending only task results to reduce notification noise while maintaining persistent workflow control.
Instructions
进入无人值守模式 - 智能远程任务循环
工作流程:
1. 执行当前任务
2. 根据情况智能选择通知方式:
- 默认:使用 telegram_notify 发送总结
- 遇到关键问题/错误:使用 telegram_send_code 展示问题代码
- 用户明确要求:使用 telegram_send_file 发送文件
3. 调用 telegram_unattended_mode 等待下一步指令(静默等待,不发送额外提示)
4. 收到指令后执行,重复循环
⚠️ 重要:
- 完成任务后必须调用 telegram_notify 发送结果
- telegram_unattended_mode 本身不发送消息,只等待
- 这样用户每次只收到任务结果,不会有重复的等待提示
📋 通知内容最佳实践:
✅ 优先发送总结:
- "修复了 auth.py 的空指针异常,测试通过"
- "创建了 3 个文件:main.py, utils.py, test.py"
- "代码重构完成,性能提升 30%"
⚠️ 仅在必要时发送代码:
- 遇到无法自动修复的错误,需要展示错误代码
- 修复了关键 bug,展示修复前后对比
- 用户明确要求:"查看 main.py"、"发送代码给我"
🎯 智能判断示例:
- 创建新文件 → telegram_notify("创建了 config.json")
- 修复 bug → telegram_notify("修复了登录异常") + 如果复杂就 telegram_send_code
- 用户问"文件内容是什么" → telegram_send_file
退出方式:
- Telegram 发送 "退出" 或 "exit"
- Claude Code 按 Ctrl+C 或 ESC
轮询策略:
- 前10分钟:每30秒检查一次
- 10分钟-1小时:每60秒检查一次
- 1小时以上:每120秒检查一次
参数:
- current_status: 当前任务状态的简短总结(1-2句话)
- max_wait: 每次等待的最长时间(秒),默认604800(7天)
- silent: 静默模式(不发送等待提示,默认 false)
- 首次进入时使用 false(发送提示)
- 后续循环使用 true(减少噪音)
返回:
- next_instruction: 用户的下一步指令
- should_exit: 是否应该退出无人值守模式
- interrupted: 是否被用户中断(Ctrl+C/ESC)
Input Schema
Name | Required | Description | Default |
---|---|---|---|
current_status | No | 当前任务状态描述 | |
max_wait | No | 最长等待时间(秒),默认604800(7天) |
Input Schema (JSON Schema)
{
"properties": {
"current_status": {
"description": "当前任务状态描述",
"type": "string"
},
"max_wait": {
"default": 604800,
"description": "最长等待时间(秒),默认604800(7天)",
"type": "integer"
}
},
"required": [],
"type": "object"
}