# Cost tracking

> Cost tracking is an open-source agent skill for analytics and data. Reports Claude Code token usage and spend from a local cost log. It is available on Claude Code.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code
- **Website:** https://github.com/smartworldarafath/REA_Skill/tree/main/.agents/skills/cost-tracking
- **Repository:** https://github.com/smartworldarafath/rea_skill
- **GitHub stars:** 76
- **License:** MIT
- **Skill name:** cost-tracking
- **Collection:** https://github.com/smartworldarafath/REA_Skill
- **Categories:** [analytics and data](https://ai-powered.com/categories/analytics-and-data)
- **Listing updated:** 2026-12-01

## About

This skill reads the metrics log written by an ECC cost-tracker hook for Claude Code and turns it into spending and usage reports. Each log row is a cumulative snapshot per session, so the skill reduces the log to the latest row for each session before totaling spend, which avoids double counting.

The workflow starts by checking that the log file exists in the user's home metrics folder. If it is missing, the skill tells the user that tracking only begins after a session ends with the hook enabled, rather than inventing figures. When the log is present, it summarizes today's and yesterday's spend, the all-time total, the session count and a breakdown by model, and it can drill into individual sessions or prepare a CSV export. It relies on the precomputed cost field instead of recalculating prices from token counts.

It expects Node.js to run the inline scripts and the ECC cost-tracker hook to have produced the log. No external services or API keys are needed.

## When your agent uses it

> Track and report Claude Code token usage, spending, and budgets from the local ECC cost-tracker metrics log. Use when the user asks about costs, spending, usage, tokens, budgets, or cost breakdowns by model, session, or date.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/smartworldarafath/REA_Skill/tree/HEAD/.agents/skills/cost-tracking)
- [License: MIT](https://github.com/smartworldarafath/REA_Skill/tree/HEAD/.agents/skills/cost-tracking)

## Features

- **Session-level cost totals:** Reduces cumulative log rows to the latest snapshot per session before summing spend.
- **Model breakdown:** Groups spending by the model recorded in each session.
- **Daily spend comparison:** Shows today's and yesterday's spend alongside the all-time total.
- **Missing log handling:** Checks for the metrics file first and reports clearly when no data exists.
- **Session drilldown and CSV export:** Lists individual sessions or exports the underlying rows for further analysis.
- **Token usage fields:** Works with input, output and prompt-cache token counts recorded by the tracker.

## Good for

- How much have I spent on Claude Code today?
- Break down my total usage cost by model.
- Show what the last session cost.
- Export my cost history to CSV.
- Check whether I am close to my token budget.

## Install

### Claude Code

This skill ships in the `rea-skills` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add smartworldarafath/REA_Skill
/plugin install rea-skills@smartworldarafath
```

Or copy only this skill to `~/.claude/skills/cost-tracking`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/cost-tracking &&
cp -R "$tmp/.agents/skills/cost-tracking" ~/.claude/skills/cost-tracking &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/cost-tracking` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/cost-tracking` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/cost-tracking &&
cp -R "$tmp/.agents/skills/cost-tracking" ~/.agents/skills/cost-tracking &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/cost-tracking` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/cost-tracking` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/cost-tracking &&
cp -R "$tmp/.agents/skills/cost-tracking" ~/.cursor/skills/cost-tracking &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/cost-tracking` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/smartworldarafath/REA_Skill.git --path .agents/skills/cost-tracking
```

Or copy the folder to `~/.gemini/skills/cost-tracking` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/cost-tracking`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/cost-tracking &&
cp -R "$tmp/.agents/skills/cost-tracking" ~/.copilot/skills/cost-tracking &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/cost-tracking` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git
```

Then copy `REA_Skill/.agents/skills/cost-tracking` into your agent's skills folder as `cost-tracking`. Agents that support SKILL.md read one folder per skill.

## FAQ

### What does Cost tracking need to run?

It needs Node.js for the inline scripts and a cost log at ~/.claude/metrics/costs.jsonl, which the stop:cost-tracker hook writes after sessions end.

### What happens if no cost log exists?

The skill reports that the log was not found and tells the user that tracking starts after the first session ends with the hook enabled. It does not fabricate usage data.

### Does Cost tracking recalculate prices itself?

No. It prefers the estimated_cost_usd value recorded by the tracker, since model and cache prices change over time.

### Why are rows reduced to the latest per session?

Each row is a cumulative snapshot for its session, so summing every row would count the same spend several times.

### How do I install Cost tracking in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/cost-tracking to use it in all your projects, or to .claude/skills/cost-tracking in one project. Or install the rea-skills plugin, which includes it: /plugin marketplace add smartworldarafath/REA_Skill, then /plugin install rea-skills@smartworldarafath.

### Does Cost tracking run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Cost tracking?

Claude Code. It reads skills in the SKILL.md format; the install steps on this page show where to put the folder.

### What are the best alternatives to Cost tracking?

The closest alternatives to Cost tracking are Cloud logging finops, Product tracking edho ferdian, Conversion tracking, Cost analysis and Gke cost analysis.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Cloud logging finops](https://ai-powered.com/skills/cloud-logging-finops): Cloud logging finops is an open-source agent skill for cloud and infrastructure.
- [Product tracking edho ferdian](https://ai-powered.com/skills/product-tracking-edho-ferdian): Product tracking edho ferdian is an open-source agent skill for analytics and data.
- [Conversion tracking](https://ai-powered.com/skills/conversion-tracking): Conversion tracking is an open-source agent skill for analytics and data.
- [Cost analysis](https://ai-powered.com/skills/cost-analysis): Cost analysis is an open-source agent skill for cloud and infrastructure.
- [Gke cost analysis](https://ai-powered.com/skills/gke-cost-analysis): Gke cost analysis is an open-source agent skill for cloud and infrastructure.

---
Source: https://ai-powered.com/skills/cost-tracking
