codesession for Openclaw

A comprehensive session tracker for AI agents that monitors token usage, API costs, and git activity via a CLI and web dashboard.

brian-mwirigi
v2.5.1
Mar 7, 2026
3
4.2k
0

Install & Download

1. ClawHub CLI

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

npx clawhub@latest install codesession

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 codesession 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 codesession?

codesession is a specialized CLI utility designed to bring transparency and financial control to AI-assisted development. By integrating with Openclaw Skills, it allows users and agents to monitor real-time API expenditure, token counts, and file modifications. The tool bridges the gap between raw LLM usage and project-level activity, ensuring that every automated task is accounted for within a local SQLite database.

This skill is particularly valuable for developers who need to maintain strict budgets while using high-performance models like Claude 3.5 Sonnet or GPT-4o. It provides agents with the ability to self-monitor their spending and report detailed analytics through a structured JSON interface, making it an essential component of any robust agentic workflow.

codesession Use Cases

  • Tracking expenditures during long-running autonomous agent sessions
  • Performing cost attribution across different agents in a multi-agent system
  • Auditing file changes and git commits associated with specific AI tasks
  • Enforcing strict budget limits to prevent unexpected API billing spikes

How codesession Works

  1. Initialize a new session to track a specific task and capture the initial repository state.
  2. Log AI API usage data, including provider and token metrics, manually or via the built-in proxy.
  3. Monitor session health and current spend using the status command for real-time budget awareness.
  4. Conclude the session to finalize git activity tracking and generate a complete work summary.
  5. Launch the local web dashboard to visualize cost trends, file hotspots, and project insights.

codesession Setup

First, install the CLI globally using npm:

npm install -g codesession-cli

Next, add the skill to your agent environment:

clawhub install codesession

Ensure your system has Node.js 18+ and appropriate C/C++ build tools (like build-essential or xcode-select) installed to compile the local database module. Once installed, the Openclaw Skills framework can automatically leverage the CLI for session tracking.

codesession Data Schema & Taxonomy

The skill manages its data locally to ensure privacy and speed.

Data Component Description
Sessions Records task descriptions, start/end times, and completion notes.
AI Logs Stores token usage, model names, and provider-specific cost calculations.
Git Metadata Tracks modified files and git commit history per session.
Database A persistent SQLite store located at ~/.codesession/sessions.db.
JSON Schema All outputs include schemaVersion for reliable programmatic parsing.

codesession Advanced Features

  • Proxy Mode: Automatically track tokens by routing API requests through a local endpoint without code changes.
  • Budget Alarms: Set spending thresholds with browser and audio notifications via the web dashboard.
  • Multi-Agent Attribution: Tag logs with specific agent names to compare performance and costs across different bots.
  • Interactive File Watcher: Live tracking of file changes and git commits for human-in-the-loop sessions.
  • Export Options: Native support for JSON and CSV exports for external reporting and data analysis.

SKILL.md


Loading

Related Openclaw Skills

Featured*