360 Secure SkillHub
360 安全技能中心

sessions-manager

该 Skill 提供 sessions_cli.py 脚本,用于列出 OpenClaw 代理会话(显示会话 key、ID、标签、状态、模型、开始时间与时长,-v 增加 channel 信息),并可按会话 ID 或 key 删除会话,删除会同时移除元数据条目和对应的历史文件。会话数据保存在用户目录下的 agents/main/sessions 中,删除操作具有破坏性。

6eanut
6eanut
热度 45.25
最近更新 2026-05-11 17:41:40
分类:自动化依赖:代码执行 / 读写文件应用场景:自动化脚本 / 任务管理 / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add sessions-manager
Metadata
name
sessions-manager
description
Manage OpenClaw agent sessions - list active/completed sessions, view session details, and delete sessions by ID. Use when you need to inspect session state, clean up old sessions, or manage multiple concurrent sessions.

Sessions Manager

Manage OpenClaw agent sessions through CLI commands.

Commands

List Sessions

List all sessions with their status, model, and duration:

python3 ~/.openclaw/workspace/skills/sessions-manager/scripts/sessions_cli.py list

For verbose output (includes channel info):

python3 ~/.openclaw/workspace/skills/sessions-manager/scripts/sessions_cli.py list -v

Delete Session

Delete a session by session ID or session key:

python3 ~/.openclaw/workspace/skills/sessions-manager/scripts/sessions_cli.py delete <session-id-or-key>

Example:

python3 ~/.openclaw/workspace/skills/sessions-manager/scripts/sessions_cli.py delete agent:main:subagent:5adb35d1-d8e3-4ab7-b9b9-c69a7f891fb3

Output Format

The list command shows:

  • 📌 Session key (e.g., agent:main:main, agent:main:subagent:xxx)
  • Session ID (UUID)
  • Label (if set, e.g., "bsv-lsp 常量展开实现")
  • Status (running, completed, timeout, etc.)
  • Model being used
  • Start time
  • Duration

Session Files

Sessions are stored in:

  • Metadata: ~/.openclaw/agents/main/sessions/sessions.json
  • History: ~/.openclaw/agents/main/sessions/<session-id>.jsonl

The delete command removes both the metadata entry and the history file.

Use Cases

  1. Debug stuck sessions - Check which subagents are still running
  2. Clean up old sessions - Remove completed or timed-out sessions
  3. Monitor concurrent work - See what subagents are active
  4. Free resources - Delete sessions that are no longer needed