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.0

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.0
File Size Uploaded
cctrail-0.2.0.tar.gz 58.1 kB Details

Built distribution (wheel)

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

Total release size: 83.5 kB

Release files / cctrail-0.2.0.tar.gz

Download URL cctrail-0.2.0.tar.gz
Size 58.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5fb3a478d5e0239c1710eeb7610a1454841c0838b7a2c93efb833ef512486aaf
BLAKE2b-256 checksum
How to use checksums
4f6d4069aa79decdd3ecb0f9c4b4d308c89ae9586a7fbd5dd9f23a99e3ba7977
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 29, 2026.

Transparency log

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

Download URL cctrail-0.2.0-py3-none-any.whl
Size 25.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4ff3fdb977b033a212f08347b1a25f87cb8e24d6ad01ab0dc4b62bc58bdd52ea
BLAKE2b-256 checksum
How to use checksums
7040293a73cf68eff2c47fbf8e98e458fdf45d8cddc68ec6f4db2888ade96f92
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 29, 2026.

Transparency log

Release history Release notifications | RSS feed

0.2.1

2 release files

This release

0.2.0 This release

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