Back to list
danshapiro

long-waits

by danshapiro

Long waits and delayed execution for Claude Code

1🍴 0📅 Jan 22, 2026

SKILL.md


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

Long Waits

Overview

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.

When to Use

  • "Wait until the checkin that fixes the widgets hits main, then rebase onto it, merge, and deploy"
  • "Implement the spec after my tokens reset at 1am"
  • "Run the live tests when the new version arrives on staging"
  • Any delay >10 minutes or condition that takes indefinite time

Implementation

Calculate Intervals

Total wait ÷ 10 minutes = Number of intervals
4 hours = 240 min ÷ 10 = 24 intervals

Start First Interval

sleep 600  # With run_in_background: true

Returns immediately with task ID. Sleep runs asynchronously.

Handle Notifications

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)"

Execute

After final notification, perform the scheduled task.

Wall Clock / Calendar Times

When the user specifies a target time (e.g., "at 3pm", "tomorrow at noon"):

  1. Check system time: date
  2. Assume user's time zone matches system. Don't ask.
  3. Calculate with Python:
python3 -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}')
"
  1. Verify the output makes sense (positive, reasonable magnitude).
  2. Tell the user: "I'm going to wait 3 hours, 25 minutes until 3:00 PM PT, then [task]."
  3. Convert to intervals and execute.

Condition-Based Waiting ("Do This After...")

For conditions like "after the deploy succeeds" or "after the file appears":

Pattern:

check condition → false? → sleep 600 (background) → notification → check again → true? → execute
  1. Translate to concrete check:
User saysCheck
"commit that fixes tests"git log for message or CI status
"file contains 'ready'"grep -q "ready" ~/file.txt
  1. Establish baseline for relative conditions ("two new versions").
  2. Tell the user: "I'll check every 10 minutes for [condition]."
  3. Poll loop: Check → if false, sleep 600 (background) → on notification, repeat.
  4. Execute when condition is true.

Track: "Polling for [condition] - check #5 (started 50 min ago)"

Quick Reference

Wait TimeIntervals
30 min3 × sleep 600
1 hour6 × sleep 600
2 hours12 × sleep 600
4 hours24 × sleep 600

Common Mistakes

MistakeFix
Foreground sleep >10minBash timeout is 600,000ms max. Use background.
Missing run_in_background: trueSleep blocks conversation. Always use background.
Not tracking progressUser has no visibility. Use TodoWrite.
Forgetting to verify time calculationCheck Python output before starting intervals.

Score

Total Score

45/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

0/5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon