Help users create scheduled/periodic tasks: regularly organize files, periodically generate reports, summarize information every morning.
Use Cases
- The user says "Help me organize my emails every morning at 8 AM" or "Generate a work report for this week every Friday"
- The user says "Remind me to take my medicine every day" or "Organize invoices on the 1st of every month"
- The user says "Show me what scheduled tasks I have" or "Cancel that weekly task"
Execution Method
Use the operating system's native scheduler to create scheduled tasks.
macOS: launchd
# 创建 plist 文件
cat > ~/Library/LaunchAgents/com.xiaodazi.task.weekly-report.plist << 'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.xiaodazi.task.weekly-report</string>
<key>ProgramArguments</key>
<array>
<string>/bin/bash</string>
<string>-c</string>
<string>echo "generate weekly report" >> ~/xiaodazi_tasks.log</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Weekday</key>
<integer>5</integer>
<key>Hour</key>
<integer>17</integer>
<key>Minute</key>
<integer>0</integer>
</dict>
</dict>
</plist>
EOF
# 加载任务
launchctl load ~/Library/LaunchAgents/com.xiaodazi.task.weekly-report.plist
Linux: cron
# 编辑 crontab
# 格式: 分 时 日 月 周 命令
# 每周五 17:00
(crontab -l 2>/dev/null; echo "0 17 * * 5 echo 'weekly report' >> ~/xiaodazi_tasks.log") | crontab -
Windows: Task Scheduler
# 创建定时任务
schtasks /create /tn "XiaodaziWeeklyReport" /tr "echo weekly report" /sc weekly /d FRI /st 17:00
View Existing Tasks
# macOS
ls ~/Library/LaunchAgents/com.xiaodazi.task.* 2>/dev/null
# Linux
crontab -l | grep xiaodazi
# Windows
# schtasks /query /tn "Xiaodazi*"
Delete Tasks
# macOS
launchctl unload ~/Library/LaunchAgents/com.xiaodazi.task.weekly-report.plist
rm ~/Library/LaunchAgents/com.xiaodazi.task.weekly-report.plist
# Linux
crontab -l | grep -v "weekly report" | crontab -
Safety Rules
- All scheduled tasks use a unified prefix: on macOS use
com.xiaodazi.task.*, for Linux cron add a# xiaodazi:comment marker - Confirm before creating: show task details for the user to confirm
- Do not create root-level tasks: only operate the user-level scheduler
- Task action restrictions: only perform operations the user explicitly requests
Output Specifications
- After creation, confirm task details (name, frequency, next execution time)
- When listing tasks, display them in a table
- Confirm the task name before deletion