← ClaudeAtlas

setup-cost-trackinglisted

Install genuine per-session cost tracking for Claude Code by wiring bundled logger scripts into the user's statusline — preserving any existing statusline and hooks. Use when the user asks to set up, install, enable, or repair cost tracking / cost logging / session cost capture. Idempotent; safe to re-run.
foyzulkarim/skills · ★ 42 · Data & Documents · score 73
Install: claude install-skill foyzulkarim/skills
# Setup Cost Tracking Installs genuine cost capture for every Claude Code session on this machine. Cost data (`cost.total_cost_usd` etc.) is computed by Claude Code itself and is available **only** in the statusline payload — hooks never receive it. So this skill wires a logger into the statusline path while preserving whatever statusline and hooks the user already has. ## What gets installed Bundled in this skill's `scripts/` directory, copied to `~/.claude/scripts/`: | Script | Role | |---|---| | `cost-logger.js` | Capture engine. Silent, crash-proof. Writes the log files below. | | `statusline-wrapper.js` | Used when the user already has a statusline: logs cost, then delegates the payload to their original command and passes its output through untouched. | | `statusline-command.js` | Used when the user has no statusline: full display (model, context bar, cost, cache stats) that also logs. | | `turn-logger.js` | Stop hook: stamps turn boundaries so cost samples can later be grouped into turns for analytics. No cost data itself. | Log outputs (created lazily, no setup needed): - `~/.claude/cost-log.jsonl` — one row per session, exact cumulative totals (upserted). - `~/.claude/projects/<mapped-dir>/<session>.cost.jsonl` — cost samples at ~5s resolution during activity. - `~/.claude/projects/<mapped-dir>/<session>.turn-boundaries.jsonl` — one row per turn end, with `transcript_path` for deep-dive analytics. ## Installation procedure Follow these steps exactly. Use real