shift-runnerlisted
Install: claude install-skill Tommyapi/ai-employee-skills
# Shift runner
Unattended work needs three guarantees: it starts when due, it never runs twice, and a crashed shift does not block tomorrow. This skill answers "which shift is due?" and manages the lock; your scheduler launches the agent.
## Steps
1. Write `shifts.json`:
```json
{"shifts": [{"name": "morning", "at": "09:00", "window_min": 90, "max_per_day": 1},
{"name": "evening", "at": "19:30", "days": [0,1,2,3,4]}],
"quiet_hours": ["23:00", "07:00"]}
```
2. Schedule this every 10 minutes (cron / Task Scheduler):
```
name=$(python scripts/shift_runner.py --config shifts.json --state state.json due) \
&& python scripts/shift_runner.py --config shifts.json --state state.json lock --ttl-min 120 \
&& run-your-agent "$name" ; \
python scripts/shift_runner.py --config shifts.json --state state.json done "$name"
```
3. The agent's first action should be to read its runbook; its last should be to write a handoff note, then `done`.
## Behaviour
- `due` prints the shift name (exit 0) only inside `[at, at + window_min)`, not past `max_per_day`, not in quiet hours, on allowed weekdays (Monday = 0).
- `lock` fails (exit 1) while another shift holds a lock younger than `--ttl-min`; an older lock is treated as a crashed shift and taken over.
- `done` records the run and clears the lock. `unlock` clears the lock without recording a run.
## Tips
- Put the shift's judgement in a runbook file, not in the scheduler: the runbook is where