Install
openclaw skills install resume-after-gateway-restartReliably resume work after `openclaw gateway restart` (or when you must restart the OpenClaw gateway mid-task). Uses durable one-shot cron `agentTurn` jobs (isolated session + explicit delivery) so the agent comes back after restart and replies to the same chat (Discord/Telegram/etc), usually with the same model/thinking as the requesting session. Use when: user asks for a gateway restart; you need to restart to apply config/updates; or you must ensure a post-restart follow-up message happens automatically.
openclaw skills install resume-after-gateway-restartGateway restarts kill the current agent process. If you need to restart mid-task, you must create a durable wakeup before restarting.
This skill uses cron + isolated agentTurn + explicit delivery route (not systemEvent) so it:
Send a short message in the current chat before you schedule the restart:
Keep this as its own message (don’t bundle it with other info).
Common failure mode: writing a plan but forgetting to actually schedule the cron + restart. If you don’t run Steps 3–4, the gateway won’t go down and you won’t come back.
Do not require a user 'go' message. Instead, schedule the restart to occur ~15s in the future (see Step 4) so this message has time to deliver before the gateway is killed.
Write memory/post-restart-task.md:
# Post-restart: <brief description>
- Channel: <where to reply>
- Was doing: <what was in progress>
- Next step: <what to do next on resume>
- Status: pending
From the current chat/session, capture:
sessionKey (e.g. agent:main:discord:channel:<id> or agent:main:telegram:direct:<id>)deliveryChannel (e.g. discord, telegram)deliveryTo:
channel:<channelId>user:<userId>-100…:topic:<id>modelProvider + model for the session (e.g. openai-codex + gpt-5.2)thinkingLevel for the sessionTip: openclaw sessions --active 240 --json includes these fields.
Use the bundled script (Option B: it infers route + model from the session store):
skills/gateway-resume/scripts/schedule-resume-cron.sh \
--back-delay 75s \
--delay 90s \
--session-key "<sessionKey>"
The script will:
openclaw sessions --json to infer modelProvider/model and thinking levelmemory/post-restart-task.md and completes the next stepNotes:
--delay 90s (or more) so the job fires well after the gateway finishes restarting.Do not restart immediately (it can kill the process before the pre-restart message delivers). Instead schedule a restart a few seconds in the future using systemd-run:
skills/gateway-resume/scripts/delayed-gateway-restart.sh 15
This schedules a systemctl --user restart openclaw-gateway.service in a transient user unit.
The scheduled jobs should:
memory/post-restart-task.mdNext stepDo not include raw markers like BACK_FROM_RESTART in user-facing text.
openclaw cron listsessionKey pattern.
--session-key.--active window.
schedule-resume-cron.sh to use a larger --active range or no filter.systemEvent?systemEvent targets the main session, which may be a different model/provider and may fail (or respond in the wrong place). Isolated agentTurn + explicit delivery is deterministic.