What Just Happened
Description
When the gateway comes back online, check recent logs and post a short message about what happened (restart, SIGUSR1, auth change, reconnect). User sees the response in TUI or Telegram.
What Just Happened
Standalone skill with its own GitHub repo and OpenClaw/ClawHub page. After a gateway restart or reconnect, it summarizes what happened by reading recent gateway logs (and optionally gateway-guard restart logs) and posts a short, user-facing message. The user should see the response in their TUI or Telegram.
Usage
- - Gateway just came back online and you want the user to see what happened (use watcher or cron).
- User asks "what happened to the gateway?" or "why did it reconnect?"
- You want a brief summary of recent restarts/errors and a proposed solution (e.g. gateway-guard).
Commands
CODEBLOCK0
- - --minutes N — Look at log lines from the last N minutes (default 5).
- --json — Emit a single JSON object with keys like
summary, restart, reason, suggestGatewayGuard.
Output is a short paragraph suitable for posting. When the cause is auth/config, the script includes a tip with the ClawHub link: clawhub install gateway-guard — https://clawhub.ai/skills/gateway-guard. ClawHub: Update this link when the new instance is live.
Two ways to run
- 1. Every time the gateway comes back online (recommended)
You
must install the
gateway-back watcher or it will never auto-trigger. Run once (from the skill dir):
CODEBLOCK1
The install script loads a LaunchAgent that runs every 15s. When it sees the gateway go from down → up, it triggers the summary to TUI or Telegram. Verify it's loaded: launchctl list com.openclaw.what-just-happened (should show a PID). If you see "not loaded", run the install script again.
To stop: INLINECODE6
- 2. Cron (periodic)
A cron job runs every 2 minutes. When it runs, the agent checks the last 5 minutes of logs and, if a restart happened, announces to the user. Good as a fallback; for immediate feedback on reconnect, use the watcher above.
- 3. Manual
User says
"what just happened?" or "I restarted the gateway" and the orchestrator runs the script and replies in chat.
How it works
Reads OPENCLAW_HOME/logs/gateway.log and optionally gateway-guard.restart.log. Looks for recent shutdown/restart/SIGUSR1/reload lines and produces a plain-language summary. Suggests gateway-guard (with ClawHub install link) when the cause was auth or config change.
Delivery (TUI or Telegram)
- - Gateway-back watcher and cron both trigger an agent turn with announce (deliver). The OpenClaw gateway delivers that to the configured channel(s)—typically the last-used channel (TUI webchat) and/or Telegram if configured. The user sees the summary in their TUI or Telegram.
- Manual "what just happened?" is replied to in the current chat (TUI).
Integration summary
| Trigger | How | User sees response |
|---|
| Gateway comes back online | Install install_gateway_back_watcher.sh (LaunchAgent every 15s) | TUI or Telegram (announce) |
| Cron every 2 min |
OpenClaw cron job with announce | TUI or Telegram (announce) |
|
Manual | User says "what just happened?" | Current chat (TUI) |
刚才发生了什么
描述
当网关重新上线时,检查最近的日志并发布一条简短消息,说明发生了什么(重启、SIGUSR1、认证变更、重新连接)。用户可在TUI或Telegram中看到响应。
刚才发生了什么
独立技能,拥有自己的 GitHub仓库 和 OpenClaw/ClawHub页面。在网关重启或重新连接后,通过读取最近的网关日志(以及可选的gateway-guard重启日志)总结所发生的事件,并发布一条面向用户的简短消息。用户应在其TUI或Telegram中看到响应。
使用方法
- - 网关刚刚重新上线,您希望用户看到发生了什么(使用监视器或cron)。
- 用户询问网关发生了什么?或为什么重新连接了?
- 您希望获得最近重启/错误的简要摘要以及建议的解决方案(例如gateway-guard)。
命令
bash
python3 /skills/what-just-happened/scripts/reportrecentlogs.py [--minutes N] [--json]
- - --minutes N — 查看最近N分钟内的日志行(默认5分钟)。
- --json — 输出单个JSON对象,包含summary、restart、reason、suggestGatewayGuard等键。
输出为适合发布的简短段落。当原因为认证/配置时,脚本会包含带有ClawHub链接的提示:clawhub install gateway-guard — https://clawhub.ai/skills/gateway-guard。ClawHub: 新实例上线时更新此链接。
两种运行方式
- 1. 每次网关重新上线时(推荐)
您
必须安装 gateway-back监视器,否则它永远不会自动触发。运行一次(从技能目录):
bash
cd workspace/skills/what-just-happened
./scripts/installgatewayback_watcher.sh
安装脚本会加载一个每15秒运行一次的LaunchAgent。当它检测到网关从离线→在线时,会触发向TUI或Telegram发送摘要。验证是否已加载: launchctl list com.openclaw.what-just-happened(应显示PID)。如果显示not loaded,请重新运行安装脚本。
停止:launchctl unload ~/Library/LaunchAgents/com.openclaw.what-just-happened.plist
- 2. Cron(定时任务)
一个cron任务每2分钟运行一次。运行时,代理检查最近5分钟的日志,如果发生重启,则向用户通知。作为备用方案;如需在重新连接时立即获得反馈,请使用上述监视器。
- 3. 手动
用户说
刚才发生了什么?或我重启了网关,编排器运行脚本并在聊天中回复。
工作原理
读取OPENCLAW_HOME/logs/gateway.log以及可选的gateway-guard.restart.log。查找最近的关闭/重启/SIGUSR1/重新加载行,并生成通俗易懂的摘要。当原因为认证或配置变更时,建议安装gateway-guard(附带ClawHub安装链接)。
交付方式(TUI或Telegram)
- - Gateway-back监视器和cron都会触发代理通过announce(交付)进行操作。OpenClaw网关将消息交付到配置的渠道——通常是最后使用的渠道(TUI网页聊天)和/或Telegram(如果已配置)。用户在其TUI或Telegram中看到摘要。
- 手动刚才发生了什么?在当前聊天(TUI)中回复。
集成摘要
| 触发方式 | 如何操作 | 用户看到响应 |
|---|
| 网关重新上线 | 安装installgatewayback_watcher.sh(每15秒的LaunchAgent) | TUI或Telegram(announce) |
| Cron每2分钟 |
OpenClaw cron任务配合announce | TUI或Telegram(announce) |
|
手动 | 用户说刚才发生了什么? | 当前聊天(TUI) |