Skip to content

Add --context-source flag to bypass broken context_window data. #769

@motlin

Description

@motlin

The context_window field from Claude Code is currently broken (anthropics/claude-code#13783) - it reports cumulative session tokens instead of current context usage, producing impossible readings like 170% after compaction.

Request: Add --context-source flag similar to the existing --cost-source:

  • auto (default): prefer context_window, fall back to transcript
  • ccusage: always calculate from transcript
  • cc: always use Claude Code data

Workaround: jq 'del(.context_window)' before piping to ccusage forces transcript calculation.

Ref: #749 comment by @shailendher

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions