codesession
codesession (codesession-cli, code session, code-session) — Track AI agent session costs, tokens, file changes, and git commits. Works with Claude Code, OpenClaw, Codex, GPT, Cursor, Windsurf, Cline & any AI agent. Budget enforcement, auto-pricing, MCP server, web dashboard, alerts, insights. v2.5.1.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/brian-mwirigi/codesessionWhat This Skill Does
The codesession skill is an essential observability tool for AI-driven development. It acts as a bridge between your AI agent's actions and real-world cost and productivity metrics. By integrating directly into your terminal environment, it tracks token consumption, API spend, file modifications, and Git commits in real-time. Whether you are using Claude Code, Cursor, Windsurf, or OpenClaw, this skill ensures you maintain full transparency over your infrastructure usage. It features built-in budget enforcement to prevent runaway API costs, automatic pricing calculations for various LLM models, and a comprehensive web-based dashboard to visualize your project's history and efficiency over time.
Installation
Installation is a two-step process requiring both the global CLI and the OpenClaw agent bridge.
- Ensure you have Node.js 18+ and native build tools installed on your system.
- Run
npm install -g codesession-clito install the core engine. - Execute
clawhub install openclaw/skills/skills/brian-mwirigi/codesessionwithin your OpenClaw environment to register the skill.
Data is securely persisted in ~/.codesession/sessions.db, so ensure your environment has read/write permissions for that directory.
Use Cases
- Cost Governance: Set hard budget limits on specific coding tasks to avoid surprise cloud billing.
- Performance Auditing: Analyze how many tokens are consumed by specific architectural refactors or feature implementations.
- Work Log Automation: Automatically generate audit trails of file changes and Git commits mapped to specific AI agent sessions.
- Resource Management: Recover stale sessions automatically if your IDE or agent crashes mid-task, ensuring no data loss.
Example Prompts
- "Start a new code session named 'Refactor Authentication Module' and check if we are within the current month's budget."
- "Show me the dashboard for my recent AI sessions so I can review the total cost of the last three features we built."
- "End the current session, summarize the changes made to the codebase, and report the total token usage for this task."
Tips & Limitations
- Use
--jsonfor Agents: Always append the--jsonflag when callingcs startorcs endfrom within an automated script to ensure the agent parses the output correctly. - Build Tools: This skill compiles a native SQLite module. If you encounter installation errors, verify that
build-essentialor your OS equivalent (Xcode/VS Build Tools) is correctly configured. - Budgeting: Set your budget caps early in the session lifecycle to allow the agent to self-regulate during heavy refactoring tasks. Note that this tool tracks local activity; ensure you provide your API credentials to the underlying LLM provider for accurate billing reflection.
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-brian-mwirigi-codesession": {
"enabled": true,
"auto_update": true
}
}
}Tags(AI)
Flags: file-read, file-write, code-execution