Skip to content

Releases: CAOShurong/contextcost

v0.5.3

Choose a tag to compare

@github-actions github-actions released this 26 Aug 13:01

Full Changelog: v0.5.2...v0.5.3

v0.5.2

Choose a tag to compare

@github-actions github-actions released this 26 Aug 03:12

Full Changelog: v0.5.1...v0.5.2

v0.5.1

Choose a tag to compare

@github-actions github-actions released this 25 Aug 14:14

contextcost v0.5.1

Measure what a repository costs an AI coding agent to read — and prove how
much of it is waste by measuring again.

uvx contextcost .          # no install, no config, results in seconds

What it does

  1. Measures the token cost of every file an agent could read (estimate
    with a published ±14% error bound; --accurate gives exact cl100k_base
    counts).
  2. Proposes cuts — only where the filesystem itself proves a file isn't
    hand-written work: lockfiles, minified bundles, vendored deps, generated
    code, recorded fixtures.
  3. Re-measures with the proposal applied, so the saving it reports is an
    observed difference between two walks of your repository — never a sum of
    guesses.

Real numbers from real repositories

Repository Tokens to read Measured saving Waste
moby/buildkit 14.6M 13.1M 89.5%
jesseduffield/lazygit 5.8M 4.5M 77.8%
plotly.js 63.8M 26.8M 42.0%
sharkdp/bat 53.7M 30.0M 55.8%
astral-sh/ruff 20.7M 10.4M 50.2%
astropy 7.9M 212K 2.7%
mikefarah/yq 420K 3.0K 0.7%

The spread is the finding: there is no universal waste percentage — only
your repository's number. Full case studies with per-commit reproduction
commands:

Also in this release

  • contextcost mcp — MCP server mode so Claude Code / Cursor / Codex can ask
    "what does this repo cost and what's wasting it" as a tool call
    (copy-paste configs)
  • GitHub Action that posts the context delta of every pull request
  • --delta main / --delta v4.0.0 — measure a change's context cost against
    any git revision without a second clone
  • --fail-over BUDGET for CI gating (exit 4 when over budget)
  • .contextcostignore — measurement-only exclusions that don't touch git

MIT, Python 3.9+, zero dependencies.
Questions and "this number looks wrong" reports:
Discussions — paste
--accurate --json output and it becomes a checkable claim.

v0.5.0

Choose a tag to compare

@github-actions github-actions released this 25 Aug 08:08

contextcost v0.5.0

Measure what a repository costs an AI coding agent to read — and prove how
much of it is waste by measuring again.

uvx contextcost .          # no install, no config, results in seconds

Highlights

  1. Measures the token cost of every file an agent could read (estimate
    with a published ±14% error bound; --accurate gives exact cl100k_base
    counts).
  2. Proposes cuts — only where the filesystem itself proves a file isn't
    hand-written work: lockfiles, minified bundles, vendored deps, generated
    code, recorded fixtures.
  3. Re-measures with the proposal applied — the saving it reports is an
    observed difference between two walks of your repository, never a sum of
    guesses.

New in v0.5.0

  • GitHub Action (CAOShurong/contextcost/action): posts (and keeps
    updated) a per-PR comment measuring what a pull request does to the
    repository's context budget — "+41,797 tokens, 92% of it a lockfile" as a
    measurement, not a guess from filenames.
  • MCP server mode: contextcost mcp serves estimate(repo) and
    propose(repo) over stdio JSON-RPC so Claude Code, Cursor and Codex can
    call it directly (copy-paste configs).
  • --delta BASE: measure a change's context cost against any git revision —
    contextcost . --delta main, or against a tagged release, no second clone.
  • --fail-over BUDGET: CI gate that exits 4 when the measured total exceeds
    BUDGET tokens.

Real numbers from real repositories

Repository Tokens to read Measured saving Waste
moby/buildkit 14.6M 13.1M 89.5%
jesseduffield/lazygit 5.8M 4.5M 77.8%
plotly.js 63.8M 26.8M 42.0%
astropy 7.9M 212K 2.7%
mikefarah/yq 420K 3.0K 0.7%

The spread is the finding: there is no universal waste percentage — only
your repository's number. Full case studies with per-commit reproduction:
docs/case-studies.

MIT, Python 3.9+, zero dependencies.
Questions: Discussions.

v0.4.0

Choose a tag to compare

@github-actions github-actions released this 25 Aug 01:56

What's Changed

  • chore(deps): bump codeql-action init+analyze together to v4.37.7 by @CAOShurong in #6

Full Changelog: v0.2.0...v0.4.0

ContextCost v0.2.0 — consumer-aware context auditing

Choose a tag to compare

@github-actions github-actions released this 11 Aug 09:51
4a80fbb

ContextCost now measures the file-selection boundary of the AI tool you actually use, instead of assuming every tool sees the same .gitignore view.

Install

python -m pip install --upgrade contextcost
contextcost --consumer cursor

No runtime dependencies; Python 3.9–3.14.

What is new

  • --consumer cursor|aider|repomix|generic applies each consumer's documented ignore inputs.
  • --write-ignore writes the re-measured proposal to .cursorignore, .aiderignore, .repomixignore, or .gitignore.
  • Terminal and JSON output name the selected consumer, active ignore inputs, and write destination.
  • python -m contextcost is now a supported entry point.
  • Write mode refuses symbolic-link destinations rather than following them outside the repository.
  • Public v0.1 dataclass positional construction and --write-gitignore remain compatible.

Important boundary

A consumer profile estimates the text files eligible for context after documented ignore files. It does not reproduce proprietary semantic retrieval, compression, repo maps, tokenizers, prompts, or the bill for one live request. A “candidate context waste” finding is task-dependent: lockfiles can be essential for dependency upgrades even though they are machine-generated.

Verification

  • 110 tests across Linux, Windows, macOS and Python 3.9–3.14
  • CodeQL, lint, format, README generation, package build, and tokenizer calibration passed on the tagged commit
  • published wheel and sdist pass strict metadata checks
  • GitHub and PyPI artifacts are byte-identical
  • SHA256SUMS and GitHub build-provenance attestations are attached

SHA-256:

  • wheel: b980245e22bae4efbf34813937c7d2349ff673b942793120aa7c4e62e4512faf
  • sdist: 2b78f58881fbfb6c2edc0b8962e5d231bb31d15fe6fb4e9781e241e7b28e2a70

Full changelog: v0.1.0...v0.2.0

v0.1.0

Choose a tag to compare

@github-actions github-actions released this 04 Aug 05:46