Skip to content
ruvnet avatar

Cost Track

Captures per-session Claude Code token usage and USD cost into the cost-tracking namespace for reporting.

CCM score
73 of 100
skills.sh installs
685
GitHub stars
82.6K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers reading the active session jsonl, tallying assistant-message usage per model, and computing cost from pricing tables
  • Includes a track.mjs script with env overrides for session pinning (TRACK_SESSION), dry runs (TRACK_DRY_RUN), and output paths
  • Persists one record per session under the session-<sessionId> key with per-model and per-tier cost breakdowns
  • Designed as the data producer feeding cost-report and cost-optimize, and suited to session-end or periodic runs

Install

$ npx -y skills add ruvnet/ruflo --skill cost-track -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Cost Track

Reads the active Claude Code session jsonl (~/.claude/projects/<encoded-cwd>/<session>.jsonl), tallies assistant-message usage per model, computes USD cost using REFERENCE.md pricing, and writes a structured record to the cost-tracking AgentDB namespace. This is the producer that gives cost-report and cost-optimize real data to consume.

When to use

  • After a meaningful chunk of work, to capture spend for the report.
  • At session-end to persist the final tally.
  • Periodically during long sessions (cron-friendly — see /loop 30m).

Steps

  1. Run the tracker from the project root:

    node plugins/ruflo-cost-tracker/scripts/track.mjs
    

    The script auto-discovers the session jsonl from the current working directory. To pin a specific session: TRACK_SESSION=/path/to/session.jsonl. To dry-run (no memory write): TRACK_DRY_RUN=1.

  2. Inspect the markdown summary — total cost, per-model and per-tier breakdowns, and the persisted memory key.

Details

Repository
github.com/ruvnet/ruflo
Categories
Agent Workflow & Planning, Finance & Trading
First seen
Jun 3, 2026

Questions

What does the cost-track skill do?

The cost-track skill reads the active Claude Code session jsonl file and tallies assistant message usage per model. It computes USD cost using the REFERENCE.md pricing and writes a structured record to the cost-tracking AgentDB namespace.

How do I install the cost-track skill?

Run npx -y skills add ruvnet/ruflo --skill cost-track -y in your project. The skill then lets the agent capture per-session token spend for the cost-report and cost-optimize skills to use.

Which category does cost-track belong to, and which skills lead it?

The cost-track skill sits in the Agent Workflow & Planning category on Claude Marketplaces, alongside grill-me, grill-with-docs, setup-matt-pocock-skills, grilling and prototype. It is the producer of token cost data that cost-report and cost-optimize read.

How do I check that cost-track saved a session record?

Run a memory search for the query session- in the cost-tracking namespace using the ruflo-core memory_search tool. The new session record should appear in the results, and cost-report step 1 reads from this same namespace.

Can cost-track run as a dry run or on a chosen session?

Yes, setting TRACK_DRY_RUN=1 skips the memory store call, and TRACK_SESSION=/path/to/session.jsonl pins a specific session file. Without these, the script uses the most recent session jsonl in the current project directory.

More from ruvnet/ruflo

All 236

Similar to Cost Track

More Agent Workflow & Planning