Live data from Hacker News

Show HN: Codesession-CLI – Teach your AI agent to track its own token costs

news.ycombinator.com

1–2 of 2 posts

Show HN: Codesession-CLI – Teach your AI agent to track its own token costs

#1
I built a CLI that gives AI coding agents cost visibility.

Problem: Agents like OpenClaw burn tokens with no per-task cost tracking. You see an aggregate bill, not "this refactor cost $3.20 and that bug fix cost $0.12."

Solution: codesession-cli is a CLI + OpenClaw skill. The agent calls `cs start` at task beginning, `cs log-ai` after each API call (cost auto-calculated from a built-in pricing table of 17+ models), and `cs end` when done. File changes and git commits are tracked via git diff.

Setup: npm i -g codesession-cli clawhub install codesession

No manual work after install the agent follows the skill instructions.

Tech: TypeScript, SQLite (WAL mode, better-sqlite3), Commander.js. All data local (~/.codesession). JSON output on every command for machine consumption. Structured errors, schema versioning for forward compat.

MIT. Looking for feedback on what stats/queries would be most useful.

GitHub: https://github.com/brian-mwirigi/codesession-cli