Token导航 LogoToken导航TokenDH.com
研究检索敏感数据clawhub未标认证来源可访问clear审计提醒

collect-session收集会话

Agent Skill

collect-session 用于查找、检索和筛选相关信息,适合在 OpenClaw 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

3,090

周安装

125

GitHub Stars

公开资料未说明

下载量

970
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:collect-session(收集会话)
来源仓库:https://github.com/virtualpaul/collect-session
安装命令:
openclaw skills install collect-session
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install collect-session

简介

安装并配置一个挂钩,以捕获和保存详细的 Markdown 会话摘要,以及 /new 或 /reset 命令上的遥测和成本数据。

SKILL.md

name
collect-session
description
Install and configure the collect-session hook for OpenClaw. Automatically captures session telemetry (turns, tool calls, model usage, cost) and generates a named Markdown summary whenever /new or /reset is issued. Use when: (1) setting up session collection for the first time, (2) configuring the output directory or LiteLLM credentials, (3) running a backfill sweep of uncollected sessions, (4) troubleshooting the /new pre-hook not firing. Requires LiteLLM running locally for cost data and LLM-powered session naming/summarization.

collect-session

Captures every session when /new or /reset is issued and writes a rich Markdown summary to disk. Useful for session findability, cost tracking, and building a searchable history of agent work.

What it produces

For each session:

  • <output-dir>/sessions/YYYY-MM-DD-<slug>.md — full session report (turns, tool calls, model usage, cost, LLM-generated name + summary)
  • <output-dir>/SESSION-INDEX.md — append-only table of all collected sessions
  • <output-dir>/session-log.jsonl — machine-readable record for analytics

Prerequisites

  • LiteLLM running locally — required for cost derivation and LLM enrichment. Verify with: curl http://localhost:4000/health
  • Node.jsnode must be in PATH
  • OpenClaw workspace.dir — must be set in openclaw.json so the hook can find the script

Installation

Step 1 — Copy the script

Copy scripts/collect-session.mjs to your workspace scripts directory:

cp collect-session.mjs <workspace-dir>/scripts/collect-session.mjs
chmod +x <workspace-dir>/scripts/collect-session.mjs

Step 2 — Configure the script

Edit the CONFIG block at the top of collect-session.mjs. Three values must be set:

// Agent: set to your workspace memory directory
const OUTPUT_DIR_DEFAULT = process.env.COLLECT_SESSION_OUTPUT_DIR
  || path.join(os.homedir(), 'workspace', 'memory');

// Agent: verify this matches your LiteLLM port (default 4000)
const LITELLM_BASE = process.env.LITELLM_BASE_URL || 'http://localhost:4000';

// Agent: find your LiteLLM virtual key.
// Check your LiteLLM dashboard at http://localhost:4000/ui, or retrieve from 1Password/secrets manager.
// Prefer a low-cost key (cron/batch budget) — enrichment costs ~$0.0001/session with Gemini Flash.
const LITELLM_KEY = process.env.LITELLM_API_KEY || 'YOUR_LITELLM_VIRTUAL_KEY';

Alternatively, set environment variables: COLLECT_SESSION_OUTPUT_DIR, LITELLM_API_KEY, LITELLM_BASE_URL.

Step 3 — Install the hook

Copy scripts/hook-handler.ts to your OpenClaw hooks directory and register it:

mkdir -p ~/.openclaw/hooks/collect-session
cp hook-handler.ts ~/.openclaw/hooks/collect-session/handler.ts

Create ~/.openclaw/hooks/collect-session/HOOK.md:

---
name: collect-session
description: "Collect and persist the current session to memory/sessions/ when /new or /reset is issued"
metadata:
  { "openclaw": { "emoji": "📦", "events": ["command:new", "command:reset"], "requires": { "bins": ["node"], "config": ["workspace.dir"] } } }
---

Then enable it in openclaw.json under hooks.internal.entries:

"collect-session": {
  "enabled": true
}

Restart the gateway after making config changes.

Step 4 — Verify

Issue /new in any session. You should see [collect-session] ✅ Session collected in gateway logs.

To check manually:

node <workspace-dir>/scripts/collect-session.mjs --no-llm

Output path

Default output is ~/workspace/memory/. Override with:

  • Environment variable: COLLECT_SESSION_OUTPUT_DIR=/path/to/dir
  • CLI flag: node collect-session.mjs --output-dir /path/to/dir
  • Edit OUTPUT_DIR_DEFAULT in the script CONFIG block

Backfill sweep

To collect all existing uncollected sessions:

node <workspace-dir>/scripts/collect-session.mjs --sweep

Add --no-llm to skip LLM enrichment (faster, uses heuristic names).

CLI reference

FlagDescription
*(no args)*Collect most recent completed session
<session-id>Collect specific session by ID or path
--currentCollect the currently active session (hook use)
--sweepCollect all uncollected sessions
--no-llmSkip LLM enrichment, use heuristic title
--forceRe-collect even if already in session-log.jsonl
--output-dir <path>Override output directory

Troubleshooting

Hook not firing on /new: Check that collect-session is enabled in openclaw.json and the gateway was restarted. Look for [collect-session] lines in gateway logs.

LITELLM_API_KEY not configured warning: Set LITELLM_API_KEY env var or edit the CONFIG block. The script will fall back to heuristic titles but still write session files.

Sessions directory not found: The default sessions path is ~/.openclaw/agents/main/sessions. If you use a custom agent name, update SESSIONS_DIR in the CONFIG block.

Cost shows $0.0000: LiteLLM returns zero cost for some providers. The script derives cost from token counts using a built-in pricing table. Add missing models to MODEL_PRICING in the CONFIG block.

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

97.7%
按下载量换算948

安全审计

VirusTotal

可疑

ClawScan

可疑

Static analysis

可疑

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills