360 Secure SkillHub
360 安全技能中心

Lite Session Cleaner

该 Skill 通过 openclaw 的会话列表查询接口识别活跃会话,比较各会话最后活动时间与当前时间,对超过 3600 秒无活动的会话先向目标频道发送“当前会话已经结束”消息,再调用终止命令关闭会话,并在每日日志中记录清理动作,适合以定时任务方式周期运行。

分类:自动化
artwebs
artwebs
热度 31.94
最近更新 2026-05-11 17:44:55

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add artwebs/lite-session-cleaner
兼容性
OpenClaw 专属
联网要求
联网要求未确认
数据出网
数据出网未确认
Metadata
name
session-cleaner
description
Automatically cleans up inactive sessions (older than 1 hour) and sends a notification.
metadata
{"openclaw":{"requires":{"bins":["openclaw"]}}}

Session Cleaner Skill

This skill is designed to be run via a cron job or periodic task to monitor and prune stale sessions.

Usage

The skill relies on openclaw sessions_list to identify old sessions and openclaw sessions_kill to terminate them. It can be integrated into a TaskFlow or run as a standalone script via exec.

Implementation Logic

  1. Identify: Use sessions_list to retrieve all active sessions.
  2. Filter: Compare the last_activity timestamp of each session with the current time.
  3. Action: For sessions where current_time - last_activity > 3600 seconds:
    • Send a message to the session's target channel (e.g., via message tool) stating: "当前会话已经结束".
    • Execute sessions_kill <session_id>.
  4. Log: Record the cleaning action in the daily log.

Requirements

  • openclaw CLI installed and accessible.
  • Access to session metadata.