collect-session for Openclaw

An automated session telemetry hook that captures turns, tool calls, and model costs into searchable Markdown reports.

virtualpaul
v1.0.0
Mar 30, 2026
0
688
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install collect-session

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install collect-session using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is collect-session?

The collect-session skill is a powerful telemetry and archival tool designed for the OpenClaw ecosystem. It bridges the gap between ephemeral AI interactions and persistent knowledge management by automatically capturing session data whenever a user issues a /new or /reset command. By leveraging LiteLLM, it enriches raw logs with human-readable summaries and precise cost tracking.

This skill is essential for developers and teams who need to maintain a verifiable audit trail of agent work. It transforms messy session histories into a structured library of Markdown files, a machine-readable JSONL log, and a centralized index, ensuring that every insight generated by your AI agent is findable and accountable within Openclaw Skills.

collect-session Use Cases

  • Archiving AI research sessions into a permanent personal knowledge base.
  • Monitoring LLM API expenditures and token usage across different models.
  • Generating automated documentation for agentic workflows and tool execution.
  • Performing bulk backfills of historical session data for analytics.
  • Troubleshooting agent behavior by reviewing detailed turn-by-turn telemetry.

How collect-session Works

  1. The user triggers a /new or /reset command within the OpenClaw interface.
  2. The collect-session hook intercepts the command and identifies the most recent session telemetry.
  3. The script communicates with a local LiteLLM instance to calculate costs and generate an LLM-powered session name and summary.
  4. A rich Markdown report is generated containing metadata, tool calls, and model usage statistics.
  5. The skill updates the global SESSION-INDEX.md and appends the entry to a structured session-log.jsonl file for future data analysis.

collect-session Setup

1. Script Deployment

Copy the core logic to your workspace and ensure execution permissions:

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

2. Hook Configuration

Register the hook by creating the handler directory and the required metadata file at ~/.openclaw/hooks/collect-session/HOOK.md with the appropriate events (command:new, command:reset).

3. Enable in OpenClaw

Update your openclaw.json to activate the internal hook:

"hooks": {
  "internal": {
    "entries": {
      "collect-session": {
        "enabled": true
      }
    }
  }
}

collect-session Data Schema & Taxonomy

The skill maintains a structured hierarchy within your designated memory directory to ensure compatibility with other Openclaw Skills:

File / Path Format Purpose
/sessions/YYYY-MM-DD-<slug>.md Markdown Individual session reports with full telemetry and enrichment.
SESSION-INDEX.md Markdown Table A high-level overview of all recorded sessions for quick navigation.
session-log.jsonl JSON Lines Machine-readable records including cost, model, and turn counts.

collect-session Advanced Features

  • LLM-Powered Summarization: Uses Gemini Flash or other models via LiteLLM to create context-aware titles and summaries.
  • Heuristic Fallbacks: Operates gracefully without an LLM by using metadata-based naming if the API is unavailable.
  • Batch Processing: Supports a --sweep flag to process and archive all historical, uncollected sessions at once.
  • Custom Cost Calculation: Includes a MODEL_PRICING table to derive costs even when providers return zero-value telemetry.
  • Flexible Environment Support: Configurable via CLI flags, environment variables, or direct script edits for seamless CI/CD integration.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*