blob: 10a4d378aa769ddf9b8cc796c99a9a4b01853f96 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
# Claude Code CLI — Continue Reminder
Concrete example: Claude Code CLI running in a tmux pane hits a **session rate limit** and presents a `/rate-limit-options` menu.
## Scenario
- tmux session: `ior`
- Window: `0`
- Pane: `0.0` (Claude Code blocked)
- Message: *"You've hit your session limit · resets 1:10pm (Europe/Sofia)"*
- Menu option 1: **"Stop and wait for limit to reset"**
- Resume command after reset: **`continue`**
## What the Blocked Pane Looks Like
```
❯ 1. Stop and wait for limit to reset
2. Upgrade your plan
3. Upgrade to Team plan
Enter to confirm · Esc to cancel
```
## Steps Taken
1. **Capture the pane** to confirm state:
```bash
tmux capture-pane -t ior:0.0 -p
```
2. **Create the resume script** at `~/.local/bin/ior-tmux-resume.sh`:
```bash
#!/bin/bash
set -euo pipefail
TMUX_SOCKET="/tmp/tmux-$(id -u)/default"
TARGET="ior:0.0"
tmux -S "$TMUX_SOCKET" has-session -t "$TARGET" || {
echo "Target pane $TARGET not found"; exit 1;
}
# Select option 1: "Stop and wait for limit to reset"
tmux -S "$TMUX_SOCKET" send-keys -t "$TARGET" Enter
# Wait 5 minutes past the advertised reset time
sleep 300
# Resume the Claude session
tmux -S "$TMUX_SOCKET" send-keys -t "$TARGET" "continue" Enter
```
3. **Create the systemd user service** at `~/.config/systemd/user/ior-resume.service`:
```ini
[Unit]
Description=Resume Claude in ior tmux pane after rate-limit reset
[Service]
Type=oneshot
ExecStart=/home/paul/.local/bin/ior-tmux-resume.sh
Environment="PATH=/usr/local/bin:/usr/bin:/bin"
```
4. **Create the systemd user timer** at `~/.config/systemd/user/ior-resume.timer`:
```ini
[Unit]
Description=One-off timer for ior tmux resume at 13:10 today
[Timer]
OnCalendar=2026-06-11 13:10:00
AccuracySec=1s
Persistent=false
[Install]
WantedBy=timers.target
```
5. **Make executable and enable**:
```bash
chmod +x ~/.local/bin/ior-tmux-resume.sh
systemctl --user daemon-reload
systemctl --user enable --now ior-resume.timer
systemctl --user status ior-resume.timer
```
## Verification
Check timer state:
```bash
systemctl --user status ior-resume.timer
```
Expected output:
```
Trigger: Thu 2026-06-11 13:10:00 EEST; 4h 3min left
Triggers: ● ior-resume.service
```
## Key Details
| Item | Value |
|------|-------|
| Rate-limit reset time | Shown in the Claude banner (tz-aware) |
| TMUX socket | `/tmp/tmux-$(id -u)/default` |
| First keystroke | `Enter` confirms menu option 1 |
| Buffer sleep | `300` seconds (5 min) past reset time |
| Resume command | `continue` |
| Command suffix | `Enter` |
## Caveats
- The `continue` command is specific to Claude Code CLI; other agents use different resume verbs.
- If Claude changes its rate-limit UI (e.g., adds a countdown instead of a menu), update the first `send-keys` accordingly.
- `tmux send-keys` injects literal keystrokes; if the pane has scrolled or lost focus, the keys may land in the wrong place. Consider pinning the pane or using `tmux select-pane` first.
|