一键导入
long-waits
// Use when the user asks you to wait longer than 10 minutes before performing an action, implement delayed execution, schedule tasks for a specific time, or do something after a condition becomes true
// Use when the user asks you to wait longer than 10 minutes before performing an action, implement delayed execution, schedule tasks for a specific time, or do something after a condition becomes true
| name | long-waits |
| description | Use when the user asks you to wait longer than 10 minutes before performing an action, implement delayed execution, schedule tasks for a specific time, or do something after a condition becomes true |
Chain sequential background sleeps to wait for extended periods. Bash has a 10-minute (600,000ms) maximum timeout, so longer waits require multiple intervals triggered by completion notifications.
Core insight: Background tasks create an event-driven loop: start timer → receive completion notification → start next timer.
Total wait ÷ 10 minutes = Number of intervals
4 hours = 240 min ÷ 10 = 24 intervals
sleep 600 # With run_in_background: true
Returns immediately with task ID. Sleep runs asynchronously.
When sleep completes, you receive <task-notification>. Start next interval:
sleep 600 # Next interval, run_in_background: true
Track with TodoWrite: "Waiting interval 2/24 (10 min each, ~4 hours total)"
After final notification, perform the scheduled task.
When the user specifies a target time (e.g., "at 3pm", "tomorrow at noon"):
datepython3 -c "
from datetime import datetime
target = datetime(2024, 1, 15, 15, 0, 0) # Jan 15, 3:00 PM
now = datetime.now()
diff = target - now
print(f'Seconds: {int(diff.total_seconds())}')
print(f'Minutes: {diff.total_seconds() / 60:.1f}')
"
For conditions like "after the deploy succeeds" or "after the file appears":
Pattern:
check condition → false? → sleep 600 (background) → notification → check again → true? → execute
| User says | Check |
|---|---|
| "commit that fixes tests" | git log for message or CI status |
| "file contains 'ready'" | grep -q "ready" ~/file.txt |
sleep 600 (background) → on notification, repeat.Track: "Polling for [condition] - check #5 (started 50 min ago)"
| Wait Time | Intervals |
|---|---|
| 30 min | 3 × sleep 600 |
| 1 hour | 6 × sleep 600 |
| 2 hours | 12 × sleep 600 |
| 4 hours | 24 × sleep 600 |
| Mistake | Fix |
|---|---|
| Foreground sleep >10min | Bash timeout is 600,000ms max. Use background. |
Missing run_in_background: true | Sleep blocks conversation. Always use background. |
| Not tracking progress | User has no visibility. Use TodoWrite. |
| Forgetting to verify time calculation | Check Python output before starting intervals. |