Skip to main content

cctrail

version py versions downloads license donate

cctrail is a small CLI that reads local Claude Code and Codex history and reports token usage, estimated cost, active time, and project statistics.

Install

Run the latest version without installing it:

uvx cctrail usage

Or install the command persistently:

uv tool install cctrail

Usage

Show usage by local calendar day:

cctrail usage
cctrail usage today
cctrail usage this-month
cctrail usage --by week
cctrail usage --models
cctrail usage --json

Show statistics grouped by configured project, group, or raw working directory:

cctrail stats
cctrail stats this-month
cctrail stats --by group
cctrail stats --by workdir
cctrail stats --no-config
cctrail stats --json

Both commands accept --provider claude|codex and custom inclusive date ranges:

cctrail usage --provider codex --since 2026-08-01 --until 2026-08-31

Named periods are today, yesterday, this-week, last-week, this-month, last-month, and all. Weeks start on Monday.

Projects

Projects are configured in ~/.config/cctrail/config.toml. XDG_CONFIG_HOME changes the config root and CCTRAIL_CONFIG overrides the complete path.

[projects]
"env/dotfiles" = [
  "~/Code/dotfiles",
  "~/Code/scripts",
  "~/Code/skills",
]
"oss/cctrail" = ["~/Code/vibe/cctrail"]

Each key must have the <group>/<project> form. A configured path includes all descendant working directories; when paths overlap, the longest match wins. Unconfigured directories appear under @unmapped. Use the global --no-config flag before or after stats to skip the file and show raw working directories.

Tables use color when stdout is a terminal. JSON always contains unabridged paths and token counts.

Claude history is read from ~/.claude/projects and Codex history from ~/.codex/sessions plus ~/.codex/archived_sessions. CLAUDE_CONFIG_DIR and CODEX_HOME override those roots.

Claude Code deletes session files older than 30 days at startup by default. To preserve a long-term history, increase cleanupPeriodDays before the default cleanup removes those transcripts.

Active time treats every user or assistant event as a five-minute window. Overlapping windows are merged, and simultaneous activity is divided between the names selected by stats --by.

Costs are estimates based on the pricing catalog included in the installed package. Run cctrail update-pricing to download the latest catalog to ~/.cache/cctrail/pricing.json; the downloaded catalog takes precedence over the bundled one.

License

Distributed under the MIT License.

Release files for cctrail 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cctrail 0.2.1
File Size Uploaded
cctrail-0.2.1.tar.gz 60.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cctrail 0.2.1
File Interpreter ABI Platform
cctrail-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 86.8 kB

Release files / cctrail-0.2.1.tar.gz

Download URL cctrail-0.2.1.tar.gz
Size 60.1 kB
Tags Source
SHA-256 checksum
How to use checksums
12058d7354e4682312badec07a6dfb1d54efc633bc8599dcd2b0f90963d1702f
BLAKE2b-256 checksum
How to use checksums
6f4385c08e33a49a3643e2ddcba7a1cf14cd8e796b93e776e14a799bba97508d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.

Transparency log

Release files / cctrail-0.2.1-py3-none-any.whl

Download URL cctrail-0.2.1-py3-none-any.whl
Size 26.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fe35ed5166e62d376636fd46114912437d92a397f442ba55703c2f7a700b5084
BLAKE2b-256 checksum
How to use checksums
1609526d8028225bf79a74c023e73feff04dbfbf38caf6c3298dacb72fb5d527
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page