Skip to content

Cache-miss attribution from the diagnostics field in transcripts #1804

Closed

Description

@CedricConday

Newer Claude Code transcripts carry message.diagnostics.cache_miss_reason on some
assistant records (types seen: previous_message_not_found, messages_changed,
tools_changed, system_changed, model_changed, unavailable). ccusage sums cache creation
and read tokens but does not surface why a cache was rebuilt. I wrote a small standalone
tool that does (https://github.com/CedricConday/cachemiss): per rebuild, the reason, the
tokens rewritten and the write premium, attributed to sub-agents via the subagents/
transcript files. If you would take a "cache misses" column or a --misses report in
ccusage, I would be glad to port the attribution logic; the reader and the inference rules
are about 300 lines with tests.

Activity

  1. pullfrog commented on Sep 26, 2026

    @pullfrog
    Contributor
  2. added
    enhancementNew feature or request
    priority:mediumA normal bug or meaningful improvement.
    triage:maintainableFits the repository's maintainable scope and needs review.
    on Sep 26, 2026
  3. added
    priority:lowMinor polish, documentation, or a low-impact edge case.
    triage:excludedExcluded from the current maintenance scope.
    and removed
    priority:mediumA normal bug or meaningful improvement.
    triage:maintainableFits the repository's maintainable scope and needs review.
    on Sep 26, 2026
  4. github-actions commented on Sep 26, 2026

    @github-actions
    Contributor

    Pullfrog triage: priority:low
    Kind: feature request
    Maintenance fit: excluded
    Confidence: high

    Requests a new cache-misses column or report using diagnostics cache_miss_reason. This is a new presentation surface, not a fix for incorrect reporting, with no maintainer endorsement, so it is an excluded feature request with low priority.

    Decision: closed by the contribution gate.

  5. ryoppippi commented on Sep 27, 2026

    @ryoppippi
    Member

    Thanks for the detailed write-up and for building cachemiss! The data is definitely real: I checked my own logs and message.diagnostics.cache_miss_reason shows up on a couple thousand assistant records across all six reason types you listed.

    That said, we're going to keep this out of ccusage for now, for a few reasons:

    • New public surface. A cache-miss column or --misses report would add a new table/JSON contract that we'd need to keep stable long-term.
    • Undocumented source field. diagnostics is an internal Claude Code transcript field, so its shape can change or disappear without notice.
    • Claude-only. None of the other supported agents expose an equivalent, while ccusage aims to keep reports consistent across sources.
    • Scope. ccusage focuses on usage and cost accounting; explaining why a cache was rebuilt is closer to a cost-tuning diagnostic, which your standalone tool already does well.

    If you'd like more visibility for cachemiss, a PR adding it to docs/guide/community-projects.md would be very welcome. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpriority:lowMinor polish, documentation, or a low-impact edge case.triage:excludedExcluded from the current maintenance scope.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions