Skip to content

feat(cline): add extension and CLI usage adapter - #1977

Merged
ryoppippi merged 10 commits into
mainfrom
feat/cline-adapter
Nov 10, 2026
Merged

ryoppippi merged 10 commits into
mainfrom
feat/cline-adapter

Conversation

@ryoppippi

@ryoppippi ryoppippi commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Adds ccusage cline daily|weekly|monthly|session and Cline aggregation in all-source reports. Discovers Cline task files for VS Code, Insiders, Cursor, Windsurf, and VSCodium on macOS/Linux/Windows, modern CLI session transcripts, and legacy CLI task files. CLINE_DATA_DIR accepts comma-separated roots.

Only self-contained per-request data is counted. Each accepted request must record its own valid timestamp and nonempty model ID, together with explicit input, output, cache-read, and cache-write counters as non-negative integer JSON numbers. Missing counters are never filled with zero, and models are never inferred from task metadata or conversation history. Explicit zero buckets remain valid when the request contains usage; known model IDs without a pricing entry remain available for pricing overrides and missing-pricing reporting.

Excluded data, documented in the Cline guide:

  • Requests with missing, invalid, fractional, string-valued, or overflowing token counters.
  • Requests with missing, blank, or unknown model IDs, including records whose model is available only in task metadata.
  • Requests with missing or invalid timestamps, unfinished records missing required fields, extension messages explicitly marked partial: true, cost-only records, and all-zero usage placeholders.
  • Every deleted_api_reqs and subagent_usage rollup, even if it contains token totals: these are not individual requests with their original timestamps.
  • CLI records whose cache-read/write sum exceeds cache-inclusive input or cannot be represented safely. Valid CLI input is normalized by subtracting its separately recorded cache buckets.

Reports intentionally cover eligible requests only; excluded historical data is not reconstructed. A recorded cost never rescues an ineligible record. The shared auto, display, and calculate cost modes continue to apply to accepted records, including valid recorded zero costs. Kilo/Roo extension data and the Pino log source proposed in #1871 remain out of scope.

Task requests require a non-negative integer epoch-millisecond ts in the supported timestamp range. CLI messages use their own integer ts, or a timezone-qualified ISO timestamp string with whole seconds or exactly three fractional digits when ts is absent. An invalid present ts is not rescued by another timestamp, a sidecar file, or file modification time; unsupported timestamp forms are skipped.

Fixtures and regression tests cover each exclusion, metadata-only models, explicit zero buckets, malformed data, cache consistency, and exact accepted token/cost/model/session totals. JSON and table snapshots cover all four focused and unified reports.

Validation (pinned Nix environment):

  • just fmt
  • just typecheck
  • just test — 1,105 Rust tests and 35 Node tests passed (4 Rust tests/examples ignored).
  • cargo clippy --manifest-path rust/Cargo.toml --workspace --all-targets -- -D warnings
  • just check — all 12 host flake checks passed on aarch64-darwin.

Validation is fixture-based; no local Cline installation was available for a real-data smoke test. No pricing snapshot files were changed.

Reviewed prior PR #1642 and credited Rushikesh Gaikwad (@Wraient) as a co-author. Format references: Cline message types, CodeBurn CLI parser, and legacy CLI task storage.

Closes #243
Refs #1871
Refs #1642

Summary by CodeRabbit

  • New Features
    • Added experimental Cline usage reports with daily, weekly, monthly, and session views in the focused and unified CLI.
    • Reports support both table and JSON output, and Cline data is detected from supported editor locations or custom directories set with CLINE_DATA_DIR.
    • Added configuration options for Cline reports, including shared defaults and report-specific settings.
  • Documentation
    • Added Cline setup and usage guidance, and updated source lists, configuration references, and command examples.

Read Cline editor tasks, CLI session transcripts, and legacy CLI tasks
through a dedicated Rust adapter. Preserve reported costs and request
model history, normalize CLI cache-inclusive input, and expose focused
and unified reports with configuration, documentation, and fixtures.

Builds on the investigation and prior implementation in #1642.

Co-authored-by: Rushikesh Gaikwad <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

This change adds an experimental Cline source adapter. It discovers extension and CLI data, parses usage records, and supports daily, weekly, monthly, and session reports. It registers Cline with focused and unified commands, adds configuration support, and updates documentation and integration tests.

Changes: Cline usage source

Layer / File(s) Summary
Discover and parse Cline data
rust/adapters/cline/src/paths.rs, rust/adapters/cline/src/parser.rs, rust/adapters/cline/tests/fixtures/*
The adapter discovers supported task and session layouts from default roots or CLINE_DATA_DIR. It parses eligible extension and CLI records and validates model data, timestamps, token counters, cache accounting, and costs.
Build Cline entries and reports
rust/adapters/cline/src/lib.rs, rust/adapters/cline/src/loader.rs, rust/adapters/cline/src/report.rs, rust/adapters/cline/Cargo.toml, rust/Cargo.toml, nix/cargo-artifacts.nix
The adapter loads and prices entries, groups them into daily, weekly, monthly, or session reports, and emits JSON or table output. The workspace and artifact configuration include the new adapter crate.
Register focused commands and configuration
rust/crates/ccusage-cli-parser/src/*, rust/crates/ccusage-cli/src/*, rust/crates/ccusage-config/src/*, apps/ccusage/config-schema.json, rust/crates/ccusage/src/*, rust/crates/ccusage/tests/cline_cli.rs
The CLI accepts Cline report commands and dispatches them to the adapter. Cline options are added to configuration and schema support. Tests cover parsing, date windows, timezone handling, and focused CLI output.
Add Cline to unified reports
rust/crates/ccusage-adapter-all/*, rust/crates/ccusage/tests/codex_cli.rs, rust/crates/ccusage/tests/copilot_cli.rs
The unified loader includes Cline and labels its reports as Cline. Tests cover unified outputs and isolate CLINE_DATA_DIR.
Document Cline support
docs/guide/cline/index.md, docs/guide/*, docs/.vitepress/config.ts, apps/ccusage/README.md, rust/adapters/cline/README.md
The guides and READMEs describe Cline commands, storage locations, configuration, record eligibility, and cost handling. The guide sidebar links to the Cline page.

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant ClineCLI
  participant ClineAdapter
  participant ClineFiles
  participant ReportBuilder
  User->>ClineCLI: Run a Cline report command
  ClineCLI->>ClineAdapter: Dispatch report options
  ClineAdapter->>ClineFiles: Discover and read source files
  ClineFiles-->>ClineAdapter: Provide usage records
  ClineAdapter->>ReportBuilder: Group and summarize entries
  ReportBuilder-->>ClineCLI: Return report rows
  ClineCLI-->>User: Print JSON or table output
Loading

Possibly related PRs

  • ccusage/ccusage#1959: Adds per-source options to unified loading and configuration resolution, which Cline registration and configuration tests use.
  • ccusage/ccusage#2006: Changes agent-and-report configuration precedence and schema support for the command forms added for Cline.
Merge Risk: Minimal · up to f2864

No actionable issue is established from the available evidence; the change is mergeable after normal checks.

Pre-merge checks: Passed 5

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly summarizes the main change: adding a Cline usage adapter for extension and CLI data.
Linked Issues check Passed Issue #243 is closed and provides historical context only. No active directly linked issue remains, so no linked-issue coding requirements apply.
Out of Scope Changes check Passed The changes add Cline discovery, parsing, reports, CLI/configuration integration, documentation, and tests. The shared report-list update and adapter documentation changes support the integration. The…
Docstring Coverage Passed Docstring coverage is inconclusive: files from earlier reviews still need to be rechecked within the check's analysis limits. Not blocking.
Full details: Out of Scope Changes check

Explanation

The changes add Cline discovery, parsing, reports, CLI/configuration integration, documentation, and tests. The shared report-list update and adapter documentation changes support the integration. The summary reports no Kilo/Roo or Pino implementation.

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

Clippy (1.99.1)

Clippy execution failed

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d6ad763f-6613-4997-8939-d218f52c3416
Commits

Reviewing files that changed from the base of the PR and between c9946e8 and f2864b8.

Files ignored due to path filters: 24

  • rust/Cargo.lock is excluded by !**/*.lock
  • rust/adapters/cline/src/snapshots/ccusage_adapter_cline__report__tests__cline_daily_json_report.snap is excluded by !**/*.snap
  • rust/adapters/cline/src/snapshots/ccusage_adapter_cline__report__tests__cline_monthly_json_report.snap is excluded by !**/*.snap
  • rust/adapters/cline/src/snapshots/ccusage_adapter_cline__report__tests__cline_session_json_report.snap is excluded by !**/*.snap
  • rust/adapters/cline/src/snapshots/ccusage_adapter_cline__report__tests__cline_weekly_json_report.snap is excluded by !**/*.snap
  • rust/crates/ccusage-adapter-all/src/snapshots/ccusage_adapter_all__tests__cline_fixture_daily_unified_json.snap is excluded by !**/*.snap
  • rust/crates/ccusage-adapter-all/src/snapshots/ccusage_adapter_all__tests__cline_fixture_daily_unified_table.snap is excluded by !**/*.snap
  • rust/crates/ccusage-adapter-all/src/snapshots/ccusage_adapter_all__tests__cline_fixture_monthly_unified_json.snap is excluded by !**/*.snap
  • rust/crates/ccusage-adapter-all/src/snapshots/ccusage_adapter_all__tests__cline_fixture_monthly_unified_table.snap is excluded by !**/*.snap
  • rust/crates/ccusage-adapter-all/src/snapshots/ccusage_adapter_all__tests__cline_fixture_session_unified_json.snap is excluded by !**/*.snap
  • rust/crates/ccusage-adapter-all/src/snapshots/ccusage_adapter_all__tests__cline_fixture_session_unified_table.snap is excluded by !**/*.snap
  • rust/crates/ccusage-adapter-all/src/snapshots/ccusage_adapter_all__tests__cline_fixture_weekly_unified_json.snap is excluded by !**/*.snap
  • rust/crates/ccusage-adapter-all/src/snapshots/ccusage_adapter_all__tests__cline_fixture_weekly_unified_table.snap is excluded by !**/*.snap
  • rust/crates/ccusage-cli-parser/src/snapshots/ccusage_cli_parser__tests__root_help.snap is excluded by !**/*.snap
  • rust/crates/ccusage-cli-parser/src/snapshots/ccusage_cli_parser__tests__snapshots_representative_cli_parse_shapes.snap is excluded by !**/*.snap
  • rust/crates/ccusage-config/src/snapshots/ccusage_config__config_schema__tests__snapshots_schema_agent_specific_option_edges.snap is excluded by !**/*.snap
  • rust/crates/ccusage/tests/snapshots/cline_cli__cline_cli_daily_json.snap is excluded by !**/*.snap
  • rust/crates/ccusage/tests/snapshots/cline_cli__cline_cli_daily_table.snap is excluded by !**/*.snap
  • rust/crates/ccusage/tests/snapshots/cline_cli__cline_cli_monthly_json.snap is excluded by !**/*.snap
  • rust/crates/ccusage/tests/snapshots/cline_cli__cline_cli_monthly_table.snap is excluded by !**/*.snap
  • rust/crates/ccusage/tests/snapshots/cline_cli__cline_cli_session_json.snap is excluded by !**/*.snap
  • rust/crates/ccusage/tests/snapshots/cline_cli__cline_cli_session_table.snap is excluded by !**/*.snap
  • rust/crates/ccusage/tests/snapshots/cline_cli__cline_cli_weekly_json.snap is excluded by !**/*.snap
  • rust/crates/ccusage/tests/snapshots/cline_cli__cline_cli_weekly_table.snap is excluded by !**/*.snap
Files selected for processing: 3

  • rust/crates/ccusage-adapter-all/src/loader.rs
  • rust/crates/ccusage-adapter-all/src/tests.rs
  • rust/crates/ccusage/tests/codex_cli.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

@ryoppippi

Copy link
Copy Markdown
Member Author

@coderabbitai @cubic-dev-ai Please review the Cline adapter implementation, including source-format parsing, cache accounting, historical model attribution, cost modes, and focused/unified report coverage.

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai @cubic-dev-ai Please review the Cline adapter implementation, including source-format parsing, cache accounting, historical model attribution, cost modes, and focused/unified report coverage.

@ryoppippi I have started the AI code review. It will take a few minutes to complete.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
ccusage-guide f2864b8 Commit Preview URL

Branch Preview URL
Nov 10 2026, 05:35 PM

@ryoppippi ryoppippi closed this Oct 26, 2026
@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

@ryoppippi I’ll review the Cline adapter with these checks:

  • Source-format parsing for the extension, current CLI transcripts, and legacy CLI task files.
  • Cache-token accounting and unfinished-request handling.
  • Historical model and provider attribution.
  • Cost modes, including recorded zero costs and unknown or unpriced usage.
  • Focused and unified report coverage for daily, weekly, monthly, and session reports.

🧠 Learnings used
Learnt from: CR
Repo: ccusage/ccusage PR: 0
File: rust/adapters/README.md:0-0
Timestamp: 2026-10-14T20:33:20.330Z
Learning: Applies to rust/adapters/README.md : Applicability reference:
rust/adapters/AGENTS.md: # AGENTS.md - Agent Source Architecture
`README.md` covers adapter architecture, the shared-vs-source boundary, and the crate module shape;
`rust/adapters/opencode/src/` is a compact example of it. This file adds the workflow rules for
changing or adding an adapter.

Source excerpt:
# Agent Adapters

Each agent adapter owns source-specific log discovery, parsing, token mapping,
model mapping, source metadata, and source-specific pricing behavior. Shared
report rendering, date handling, progress, pricing fetcher lifecycle, file
walking, dedupe, and aggregation should stay in `ccusage-core` or
`ccusage-adapter-common` when the source data allows it.
Learnt from: ryoppippi
Repo: ccusage/ccusage PR: 0
File: :0-0
Timestamp: 2026-08-10T19:47:29.939Z
Learning: In `rust/crates/ccusage-core/src/pricing.rs`, `PricingMap::find` and `PricingMap::context_limit` use a fuzzy fallback that selects the longest matching key. Models.dev pricing snapshots must retain published pricing keys so known IDs resolve exactly. Separately priced tier IDs and unversioned IDs must be excluded from this fuzzy fallback through `PricingMap::exact_only`; otherwise they can incorrectly price a related model identifier.
⚠️ Action not completed

Pull request is closed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: e150831aec47
Base SHA: 154e13bb6658

This compares the Rust PR release binary against the configured base package on the same CI runner.

Package runtime diagnostics

Compares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
All rows run --offline --json, measured by hyperfine with 0 warmups and 1 runs. This isolates wrapper overhead from the installed native optional dependency and the workspace release binary built on the runner.

Command Runtime Input Median Throughput Samples
claude --offline --json Package wrapper 1.01 GiB 574.8ms 1.75 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 492.2ms 2.05 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 213.6ms 4.71 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 191.8ms 5.25 GiB/s 1

Committed fixture performance

Committed small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage.

Fixtures: Claude apps/ccusage/test/fixtures/claude (0.00 MiB, 2 files), Codex apps/ccusage/test/fixtures/codex (0.00 MiB, 1 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published native ccusage binary from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 2 warmups and 7 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude daily --offline --json 0.00 MiB 59.1ms 24.0ms 2.47x 56.25 MiB 25.23 MiB 0.45x 0.03 MiB/s 0.06 MiB/s
claude session --offline --json 0.00 MiB 55.7ms 18.4ms 3.03x 55.75 MiB 25.23 MiB 0.45x 0.03 MiB/s 0.08 MiB/s
codex daily --offline --json 0.00 MiB 47.8ms 17.6ms 2.72x 56.00 MiB 24.98 MiB 0.45x 0.02 MiB/s 0.05 MiB/s
codex session --offline --json 0.00 MiB 49.7ms 17.2ms 2.89x 55.50 MiB 24.98 MiB 0.45x 0.02 MiB/s 0.05 MiB/s

Large real-world-shaped fixture performance

Generated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published native ccusage binary from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude --offline --json 1.01 GiB 460.0ms 435.7ms 1.06x 907.09 MiB 905.10 MiB 1.00x 2.19 GiB/s 2.31 GiB/s
codex --offline --json 1.01 GiB 233.8ms 201.7ms 1.16x 471.44 MiB 465.18 MiB 0.99x 4.31 GiB/s 4.99 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 24.02 KiB 24.98 KiB +0.96 KiB 0.96x
installed native package binary 4886.47 KiB 4939.59 KiB +53.13 KiB 0.99x

Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees.

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: e150831aec47
Base SHA: 154e13bb6658

This compares the PR package against the configured base package on the same CI runner.

Package runtime diagnostics

Compares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
All rows run --offline --json, measured by hyperfine with 0 warmups and 1 runs. This isolates wrapper overhead from the installed native optional dependency and the workspace release binary built on the runner.

Command Runtime Input Median Throughput Samples
claude --offline --json Package wrapper 1.01 GiB 373.6ms 2.69 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 357.7ms 2.81 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 144.3ms 6.98 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 128.6ms 7.83 GiB/s 1

Committed fixture performance

Committed small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage.

Fixtures: Claude apps/ccusage/test/fixtures/claude (0.00 MiB, 2 files), Codex apps/ccusage/test/fixtures/codex (0.00 MiB, 1 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published ccusage package from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 2 warmups and 7 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude daily --offline --json 0.00 MiB 42.0ms 42.9ms 0.98x 55.75 MiB 55.50 MiB 1.00x 0.04 MiB/s 0.04 MiB/s
claude session --offline --json 0.00 MiB 41.6ms 37.0ms 1.12x 56.00 MiB 56.00 MiB 1.00x 0.04 MiB/s 0.04 MiB/s
codex daily --offline --json 0.00 MiB 34.8ms 35.0ms 0.99x 56.00 MiB 55.50 MiB 0.99x 0.02 MiB/s 0.02 MiB/s
codex session --offline --json 0.00 MiB 37.3ms 35.1ms 1.06x 56.00 MiB 55.75 MiB 1.00x 0.02 MiB/s 0.02 MiB/s

Large real-world-shaped fixture performance

Generated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published ccusage package from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude --offline --json 1.01 GiB 374.6ms 375.2ms 1.00x 935.35 MiB 937.36 MiB 1.00x 2.69 GiB/s 2.68 GiB/s
codex --offline --json 1.01 GiB 145.1ms 140.7ms 1.03x 509.43 MiB 517.44 MiB 1.02x 6.94 GiB/s 7.16 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 24.02 KiB 24.98 KiB +0.96 KiB 0.96x
installed native package binary 4886.47 KiB 4939.59 KiB +53.13 KiB 0.99x

Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — two small follow-ups inline.

Reviewed changes

  • Added a Cline adapter reading extension tasks, legacy CLI tasks, and CLI session transcripts, with CLINE_DATA_DIR overrides and task: / cli: session namespacing.
  • Wired ccusage cline daily|weekly|monthly|session, unified all-source loading, config schema, docs, and help snapshots.
  • Added fixture-backed unit, snapshot, and CLI integration tests; verified the extension-vs-CLI token asymmetry against upstream semantics and confirmed session-ID prefixing is opaque to shared consumers.
  • Verified one upstream claim via live sources (extension tokensIn is exclusive of cache; CLI inputTokens is inclusive, so the asymmetric subtraction is correct). Upstream discovery coverage (extension id, layouts, editor list) could not be re-verified live, so the experimental docs label is doing real work here.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using muse-spark-1.3-contributor (free via Pullfrog for OSS) | 𝕏

Comment thread docs/guide/cline/index.md Resolved
Count only requests with explicit integer counters, a recorded model ID,
and a valid request timestamp. Remove task metadata model inference and
exclude deleted-request and subagent rollups instead of assigning them
request timing or model information.

Reject incomplete, partial, unknown-model, all-zero, and inconsistent or
overflowing usage records. Document the exclusions and cover them with
fixtures plus focused and unified report assertions and snapshots.
@ryoppippi ryoppippi reopened this Oct 26, 2026
@pkg-pr-new

pkg-pr-new Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

ccusage

npx https://pkg.pr.new/ccusage@1977

@ccusage/ccusage-darwin-arm64

npx https://pkg.pr.new/@ccusage/ccusage-darwin-arm64@1977

@ccusage/ccusage-darwin-x64

npx https://pkg.pr.new/@ccusage/ccusage-darwin-x64@1977

@ccusage/ccusage-linux-arm64

npx https://pkg.pr.new/@ccusage/ccusage-linux-arm64@1977

@ccusage/ccusage-linux-x64

npx https://pkg.pr.new/@ccusage/ccusage-linux-x64@1977

@ccusage/ccusage-win32-x64

npx https://pkg.pr.new/@ccusage/ccusage-win32-x64@1977

commit: f2864b8

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 80ffd4cff7b4
Base SHA: 154e13bb6658

This compares the Rust PR release binary against the configured base package on the same CI runner.

Package runtime diagnostics

Compares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
All rows run --offline --json, measured by hyperfine with 0 warmups and 1 runs. This isolates wrapper overhead from the installed native optional dependency and the workspace release binary built on the runner.

Command Runtime Input Median Throughput Samples
claude --offline --json Package wrapper 1.01 GiB 391.2ms 2.57 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 371.6ms 2.71 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 149.0ms 6.76 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 119.4ms 8.43 GiB/s 1

Committed fixture performance

Committed small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage.

Fixtures: Claude apps/ccusage/test/fixtures/claude (0.00 MiB, 2 files), Codex apps/ccusage/test/fixtures/codex (0.00 MiB, 1 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published native ccusage binary from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 2 warmups and 7 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude daily --offline --json 0.00 MiB 45.5ms 20.7ms 2.20x 56.25 MiB 25.21 MiB 0.45x 0.03 MiB/s 0.07 MiB/s
claude session --offline --json 0.00 MiB 37.9ms 13.5ms 2.82x 56.00 MiB 24.96 MiB 0.45x 0.04 MiB/s 0.11 MiB/s
codex daily --offline --json 0.00 MiB 40.7ms 13.5ms 3.02x 56.00 MiB 24.96 MiB 0.45x 0.02 MiB/s 0.06 MiB/s
codex session --offline --json 0.00 MiB 37.5ms 14.3ms 2.61x 56.00 MiB 24.96 MiB 0.45x 0.02 MiB/s 0.06 MiB/s

Large real-world-shaped fixture performance

Generated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published native ccusage binary from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude --offline --json 1.01 GiB 379.5ms 371.8ms 1.02x 909.34 MiB 923.34 MiB 1.02x 2.65 GiB/s 2.71 GiB/s
codex --offline --json 1.01 GiB 144.1ms 127.3ms 1.13x 505.44 MiB 501.43 MiB 0.99x 6.99 GiB/s 7.91 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 24.02 KiB 24.98 KiB +0.96 KiB 0.96x
installed native package binary 4886.47 KiB 4932.53 KiB +46.06 KiB 0.99x

Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees.

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 80ffd4cff7b4
Base SHA: 154e13bb6658

This compares the PR package against the configured base package on the same CI runner.

Package runtime diagnostics

Compares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
All rows run --offline --json, measured by hyperfine with 0 warmups and 1 runs. This isolates wrapper overhead from the installed native optional dependency and the workspace release binary built on the runner.

Command Runtime Input Median Throughput Samples
claude --offline --json Package wrapper 1.01 GiB 689.3ms 1.46 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 659.5ms 1.53 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 312.0ms 3.23 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 258.4ms 3.90 GiB/s 1

Committed fixture performance

Committed small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage.

Fixtures: Claude apps/ccusage/test/fixtures/claude (0.00 MiB, 2 files), Codex apps/ccusage/test/fixtures/codex (0.00 MiB, 1 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published ccusage package from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 2 warmups and 7 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude daily --offline --json 0.00 MiB 78.9ms 83.5ms 0.94x 56.25 MiB 55.75 MiB 0.99x 0.02 MiB/s 0.02 MiB/s
claude session --offline --json 0.00 MiB 74.5ms 71.8ms 1.04x 55.75 MiB 55.75 MiB 1.00x 0.02 MiB/s 0.02 MiB/s
codex daily --offline --json 0.00 MiB 79.6ms 76.7ms 1.04x 56.00 MiB 56.25 MiB 1.00x 0.01 MiB/s 0.01 MiB/s
codex session --offline --json 0.00 MiB 76.1ms 73.5ms 1.04x 56.00 MiB 55.75 MiB 1.00x 0.01 MiB/s 0.01 MiB/s

Large real-world-shaped fixture performance

Generated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published ccusage package from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude --offline --json 1.01 GiB 719.0ms 677.1ms 1.06x 911.09 MiB 931.32 MiB 1.02x 1.40 GiB/s 1.49 GiB/s
codex --offline --json 1.01 GiB 330.2ms 349.9ms 0.94x 465.43 MiB 483.42 MiB 1.04x 3.05 GiB/s 2.88 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 24.02 KiB 24.98 KiB +0.96 KiB 0.96x
installed native package binary 4886.47 KiB 4932.53 KiB +46.06 KiB 0.99x

Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 issues found across 74 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="rust/crates/ccusage-cli/src/lib.rs">

<violation number="1" location="rust/crates/ccusage-cli/src/lib.rs:6">
P3: `STANDARD_WEEKLY_AGENT_REPORTS` is newly exported here, but the crate README's exhaustive "Public surface" list in `rust/crates/ccusage-cli/README.md` does not include it. Add `- `types::STANDARD_WEEKLY_AGENT_REPORTS`` after the `STANDARD_AGENT_REPORTS` entry so the docs stay in sync.</violation>
</file>

<file name="rust/crates/ccusage-adapter-all/README.md">

<violation number="1" location="rust/crates/ccusage-adapter-all/README.md:13">
P3: The count is still wrong: `Cargo.toml` depends on 19 adapters (excluding `ccusage-adapter-common`) once Cline is included, so this should read 19. The "Depends on" list also omits `ccusage-adapter-antigravity`, which the crate depends on and uses in `loader.rs`.</violation>
</file>

<file name="rust/crates/ccusage-cli/src/types.rs">

<violation number="1" location="rust/crates/ccusage-cli/src/types.rs:229">
P3: `STANDARD_WEEKLY_AGENT_REPORTS` duplicates the existing `OPENCODE_AGENT_REPORTS` exactly. Reuse `OPENCODE_AGENT_REPORTS` for Cline and drop this constant and its re-export. If a separate name is wanted, make it a distinct name that describes the purpose. Also add it to the public surface list in the crate README if it stays.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread rust/adapters/cline/src/report.rs Resolved
Comment thread rust/crates/ccusage-cli/src/lib.rs Resolved
Comment thread rust/crates/ccusage-cli/src/types.rs Resolved
Comment thread rust/crates/ccusage/tests/cline_cli.rs Resolved
Comment thread rust/adapters/cline/README.md Resolved

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed changes

  • Tightened extension records since the prior review to completed api_req_started events with their own timestamp, model, and all four integer counters; rollups, partial records, all-zero usage, and metadata-only model attribution are now excluded.
  • Tightened CLI records to assistant messages with valid timestamps, complete metrics, and non-unknown models; cache-inconsistent or overflowing totals are skipped via checked arithmetic instead of clamping.
  • Documented the eligible-requests-only coverage and kept fixtures, regression tests, and focused plus unified snapshots aligned with the stricter totals.

ℹ️ No new issues in the incremental delta — prior minor threads remain open.

No new findings in commit 80ffd4c. Two minor threads from the prior review (session-prefix docs note, adapter-count README) are unchanged by these commits and left open for the author, so this review stays non-approving.

Pullfrog  | Fix it ➔ | View workflow run | Using muse-spark-1.3-contributor (free via Pullfrog for OSS) | 𝕏

# Conflicts:
#	rust/crates/ccusage-core/src/lib.rs

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No new issues in the incremental delta — merge-only update verified clean.

Reviewed changes

  • Merged main into the branch, picking up shared refactors (format_date_tz rename, BUILT_IN_AGENT_NAMES move, AgentRows::warnings plumbing, test isolation).
  • Confirmed Cline wiring survived the merge with its report index, loader spec, and date helper signatures intact.
  • Confirmed the two prior minor threads remain open and unchanged by this merge.

No new findings in commit 3bf4230. Two minor threads from the prior review (session-prefix docs note, adapter-count README) are unchanged by these commits and left open for the author, so this review stays non-approving.

Pullfrog  | Fix it ➔ | View workflow run | Using muse-spark-1.3-contributor (free via Pullfrog for OSS) | 𝕏

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 3bf42302c019
Base SHA: 22481062aee5

This compares the PR package against the configured base package on the same CI runner.

Package runtime diagnostics

Compares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
All rows run --offline --json, measured by hyperfine with 0 warmups and 1 runs. This isolates wrapper overhead from the installed native optional dependency and the workspace release binary built on the runner.

Command Runtime Input Median Throughput Samples
claude --offline --json Package wrapper 1.01 GiB 391.1ms 2.57 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 370.1ms 2.72 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 161.9ms 6.22 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 132.3ms 7.61 GiB/s 1

Committed fixture performance

Committed small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage.

Fixtures: Claude apps/ccusage/test/fixtures/claude (0.00 MiB, 2 files), Codex apps/ccusage/test/fixtures/codex (0.00 MiB, 1 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published ccusage package from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 2 warmups and 7 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude daily --offline --json 0.00 MiB 39.0ms 39.5ms 0.99x 55.50 MiB 55.75 MiB 1.00x 0.04 MiB/s 0.04 MiB/s
claude session --offline --json 0.00 MiB 36.3ms 36.5ms 0.99x 56.00 MiB 55.75 MiB 1.00x 0.04 MiB/s 0.04 MiB/s
codex daily --offline --json 0.00 MiB 37.1ms 39.0ms 0.95x 55.75 MiB 56.00 MiB 1.00x 0.02 MiB/s 0.02 MiB/s
codex session --offline --json 0.00 MiB 39.6ms 40.0ms 0.99x 56.00 MiB 56.00 MiB 1.00x 0.02 MiB/s 0.02 MiB/s

Large real-world-shaped fixture performance

Generated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published ccusage package from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude --offline --json 1.01 GiB 393.2ms 389.1ms 1.01x 913.09 MiB 929.10 MiB 1.02x 2.56 GiB/s 2.59 GiB/s
codex --offline --json 1.01 GiB 157.1ms 156.4ms 1.00x 529.44 MiB 521.43 MiB 0.98x 6.41 GiB/s 6.44 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 27.67 KiB 28.77 KiB +1.10 KiB 0.96x
installed native package binary 4994.97 KiB 5045.66 KiB +50.69 KiB 0.99x

Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 3bf42302c019
Base SHA: 22481062aee5

This compares the Rust PR release binary against the configured base package on the same CI runner.

Package runtime diagnostics

Compares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
All rows run --offline --json, measured by hyperfine with 0 warmups and 1 runs. This isolates wrapper overhead from the installed native optional dependency and the workspace release binary built on the runner.

Command Runtime Input Median Throughput Samples
claude --offline --json Package wrapper 1.01 GiB 400.4ms 2.51 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 378.4ms 2.66 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 168.2ms 5.99 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 147.7ms 6.82 GiB/s 1

Committed fixture performance

Committed small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage.

Fixtures: Claude apps/ccusage/test/fixtures/claude (0.00 MiB, 2 files), Codex apps/ccusage/test/fixtures/codex (0.00 MiB, 1 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published native ccusage binary from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 2 warmups and 7 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude daily --offline --json 0.00 MiB 41.3ms 16.3ms 2.53x 56.00 MiB 22.97 MiB 0.41x 0.04 MiB/s 0.09 MiB/s
claude session --offline --json 0.00 MiB 44.0ms 17.3ms 2.55x 56.00 MiB 23.22 MiB 0.41x 0.04 MiB/s 0.09 MiB/s
codex daily --offline --json 0.00 MiB 39.7ms 16.9ms 2.35x 55.75 MiB 27.22 MiB 0.49x 0.02 MiB/s 0.05 MiB/s
codex session --offline --json 0.00 MiB 40.7ms 16.6ms 2.46x 55.75 MiB 27.22 MiB 0.49x 0.02 MiB/s 0.05 MiB/s

Large real-world-shaped fixture performance

Generated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published native ccusage binary from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude --offline --json 1.01 GiB 404.3ms 391.2ms 1.03x 937.10 MiB 931.09 MiB 0.99x 2.49 GiB/s 2.57 GiB/s
codex --offline --json 1.01 GiB 170.7ms 135.2ms 1.26x 523.44 MiB 477.43 MiB 0.91x 5.90 GiB/s 7.44 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 27.67 KiB 28.77 KiB +1.10 KiB 0.96x
installed native package binary 4994.97 KiB 5045.66 KiB +50.69 KiB 0.99x

Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees.

Cline session reports grouped rows with summarize_by_key, which only
tracks token and cost totals, and report_from_rows always passed
include_session_metadata=false. Session JSON therefore never carried
firstActivity, lastActivity, or projectPath, unlike the other session
adapters, and the unified report got no lastActivity metadata for Cline
sessions.

Build session rows with SessionAccumulator, as zcode, qwen, and pi do,
and emit session metadata for session reports. A unit test covers a
session whose entries arrive out of order, and the session snapshots now
include the new fields.
STANDARD_WEEKLY_AGENT_REPORTS was an exact copy of
OPENCODE_AGENT_REPORTS. The copy existed because the original was named
after one agent rather than the report set it describes, so a second
agent with the same reports could not reuse it by name.

Rename OPENCODE_AGENT_REPORTS to ALL_AGENT_REPORTS, since it lists every
AgentReportKind, and use it for both OpenCode and Cline. The matching
arms in agent_report_supported are merged too, and the ccusage-cli
public-surface list is updated to the new name.
ccusage-adapter-all said it depends on "all 18 adapters" and ccusage-cli
said "all 17 adapters". Cargo.toml now lists 19 source adapters, so both
numbers were stale, and a fixed number goes stale again whenever an
adapter is added. Say "every source adapter" / "every adapter" instead.

The ccusage-adapter-all "Depends on" list was also missing
ccusage-adapter-antigravity, which the crate depends on and loads.
Session reports show IDs such as task:<id> and cli:<id>, but the guide
never explained the prefixes. Document that task: marks extension and
legacy CLI tasks and cli: marks CLI session transcripts, so a task and a
CLI session that share an ID stay separate rows.

The adapter README and the guide's storage table read as if each
platform searched only its own config directory. default_roots() checks
every candidate on every platform and skips missing ones. Say so, and
mention the %USERPROFILE%\AppData\Roaming fallback in the README.
The isolation helpers pin HOME and USERPROFILE to the fixture and clear
CLINE_DATA_DIR, but the Cline adapter reads APPDATA before falling back
to USERPROFILE for its Windows extension roots. On a Windows machine
these tests could pick up real Cline data from %APPDATA%.

Clear APPDATA in both helpers so Cline discovery falls back to the
fixture's USERPROFILE.
The shared Cline fixture totals $0.0012, so every cost cell in the table
snapshots renders as $0.00 and a broken table cost path would not change
them. Add a fixture with $1.25 and $2.50 recorded costs and assert that
the Total row of each report kind renders $3.75.
@ryoppippi

Copy link
Copy Markdown
Member Author

Note

🤖 Claude Opus 5.5 responding on behalf of ryoppippi

@coderabbitai @cubic-dev-ai @pullfrog Please re-review the latest push (c9946e8). All nine threads from 2026-10-26 are addressed and resolved:

  • ad1df28: Cline session rows use SessionAccumulator and emit firstActivity, lastActivity, and projectPath.
  • 9e6afbf: the duplicate report-list constant is removed; OPENCODE_AGENT_REPORTS is now ALL_AGENT_REPORTS, shared by OpenCode and Cline.
  • f473e33: crate READMEs no longer hard-code adapter counts; antigravity is added to the dependency list.
  • 813462d: docs explain the task: / cli: session-ID prefixes and that every default root is checked on every platform.
  • c9c729c: test isolation clears APPDATA.
  • c9946e8: a table test asserts that recorded costs render ($3.75).

Validation: just fmt, just test, just check (77 flake checks), just typecheck, and just hawk all pass, and the pre-push clippy and cargo test hooks passed.

@pullfrog

pullfrog Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

No re-review warranted. HEAD (c9946e8) is identical to the prior pullfrog approval (review 5832111405), so there is no incremental delta. Both pullfrog-originated threads from the initial review are marked RESOLVED, and the six fixup commits were already covered by that approval.

Pullfrog  | View workflow run | via Pullfrog | Using muse-spark-1.3-contributor (free via Pullfrog for OSS) | 𝕏

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

[!NOTE]
🤖 Claude Opus 5.5 responding on behalf of ryoppippi

@coderabbitai @cubic-dev-ai @pullfrog Please re-review the latest push (c9946e8). All nine threads from 2026-10-26 are addressed and resolved:

...

@ryoppippi A review is already in progress. Try again after it finishes.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes (since prior pullfrog review at 3bf4230)

  • Fixed session reporting to carry activity bounds and project path via SessionAccumulator, and enabled session metadata in session JSON rows, with a regression test and refreshed snapshots.
  • Consolidated the duplicated weekly report lists into a single ALL_AGENT_REPORTS shared by cline and opencode, and merged the agent_report_supported arms.
  • Documented the task: / cli: session-ID prefixes and the every-platform candidate discovery in the Cline guide and adapter README.
  • Reworded both crate READMEs to avoid hard-coded adapter counts and added the missing antigravity dependency entry.
  • Hardened test isolation by clearing APPDATA in unified loader tests.
  • Added a table-report test asserting recorded costs render in the Total row.

Pullfrog  | Fix it ➔ | View workflow run | Using muse-spark-1.3-contributor (free via Pullfrog for OSS) | 𝕏

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: c9946e8c493d
Base SHA: 22481062aee5

This compares the Rust PR release binary against the configured base package on the same CI runner.

Package runtime diagnostics

Compares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
All rows run --offline --json, measured by hyperfine with 0 warmups and 1 runs. This isolates wrapper overhead from the installed native optional dependency and the workspace release binary built on the runner.

Command Runtime Input Median Throughput Samples
claude --offline --json Package wrapper 1.01 GiB 460.7ms 2.19 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 429.6ms 2.34 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 179.2ms 5.62 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 283.8ms 3.55 GiB/s 1

Committed fixture performance

Committed small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage.

Fixtures: Claude apps/ccusage/test/fixtures/claude (0.00 MiB, 2 files), Codex apps/ccusage/test/fixtures/codex (0.00 MiB, 1 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published native ccusage binary from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 2 warmups and 7 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude daily --offline --json 0.00 MiB 69.9ms 32.6ms 2.14x 55.50 MiB 22.97 MiB 0.41x 0.02 MiB/s 0.05 MiB/s
claude session --offline --json 0.00 MiB 47.0ms 18.6ms 2.52x 55.75 MiB 23.22 MiB 0.42x 0.03 MiB/s 0.08 MiB/s
codex daily --offline --json 0.00 MiB 46.3ms 27.0ms 1.72x 55.75 MiB 25.23 MiB 0.45x 0.02 MiB/s 0.03 MiB/s
codex session --offline --json 0.00 MiB 92.7ms 44.7ms 2.07x 55.50 MiB 25.23 MiB 0.45x 0.01 MiB/s 0.02 MiB/s

Large real-world-shaped fixture performance

Generated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published native ccusage binary from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude --offline --json 1.01 GiB 679.1ms 560.3ms 1.21x 885.09 MiB 937.10 MiB 1.06x 1.48 GiB/s 1.80 GiB/s
codex --offline --json 1.01 GiB 238.6ms 197.7ms 1.21x 483.43 MiB 457.41 MiB 0.95x 4.22 GiB/s 5.09 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 27.67 KiB 28.77 KiB +1.10 KiB 0.96x
installed native package binary 4994.97 KiB 5047.28 KiB +52.31 KiB 0.99x

Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees.

@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

@ryoppippi I’ll request a review of the latest push, including the reported fixes and the Cline adapter checks.

Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: c9946e8c493d
Base SHA: 22481062aee5

This compares the PR package against the configured base package on the same CI runner.

Package runtime diagnostics

Compares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
All rows run --offline --json, measured by hyperfine with 0 warmups and 1 runs. This isolates wrapper overhead from the installed native optional dependency and the workspace release binary built on the runner.

Command Runtime Input Median Throughput Samples
claude --offline --json Package wrapper 1.01 GiB 598.5ms 1.68 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 550.6ms 1.83 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 299.0ms 3.37 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 236.0ms 4.27 GiB/s 1

Committed fixture performance

Committed small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage.

Fixtures: Claude apps/ccusage/test/fixtures/claude (0.00 MiB, 2 files), Codex apps/ccusage/test/fixtures/codex (0.00 MiB, 1 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published ccusage package from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 2 warmups and 7 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude daily --offline --json 0.00 MiB 71.8ms 68.2ms 1.05x 55.75 MiB 55.75 MiB 1.00x 0.02 MiB/s 0.02 MiB/s
claude session --offline --json 0.00 MiB 61.0ms 65.8ms 0.93x 56.00 MiB 56.00 MiB 1.00x 0.03 MiB/s 0.02 MiB/s
codex daily --offline --json 0.00 MiB 79.4ms 78.0ms 1.02x 56.00 MiB 56.00 MiB 1.00x 0.01 MiB/s 0.01 MiB/s
codex session --offline --json 0.00 MiB 61.3ms 66.4ms 0.92x 55.75 MiB 56.25 MiB 1.01x 0.01 MiB/s 0.01 MiB/s

Large real-world-shaped fixture performance

Generated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published ccusage package from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude --offline --json 1.01 GiB 526.0ms 540.1ms 0.97x 913.09 MiB 915.09 MiB 1.00x 1.91 GiB/s 1.86 GiB/s
codex --offline --json 1.01 GiB 268.1ms 265.4ms 1.01x 497.44 MiB 481.44 MiB 0.97x 3.76 GiB/s 3.79 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 27.67 KiB 28.77 KiB +1.10 KiB 0.96x
installed native package binary 4994.97 KiB 5047.28 KiB +52.31 KiB 0.99x

Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees.

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR: f2864b81e617 merged onto Base: 86707db2b88f

Verdict: no significant change (every command within ±10% CPU time and peak RSS).

Fixture: generated Claude logs (1.01 GiB on disk, 2597 files) and Codex logs (295.00 MiB on disk, 2597 files, mostly zstd-compressed) shaped like current real logs; every value is synthetic.

Base and PR are built from source the same way on this runner and run --offline --json in 11 interleaved rounds after 2 warmup rounds; each round runs both binaries once in alternating order. Cells show median (min–max). Ratios are PR/base per round, so below 1.00 is better. A command is flagged when the median CPU-time or peak-RSS ratio moves past 10% and at least four in five rounds agree. Wall time is shown but not judged.

Command CPU base CPU PR CPU ratio Wall base Wall PR RSS base RSS PR RSS ratio Instructions ratio Verdict
claude daily 2.89s 2.91s 0.99 (0.85–1.21) 187ms (179ms–191ms) 189ms (184ms–199ms) 826 MiB 824 MiB 0.99 (0.94–1.04) 1.00 (1.00–1.04) unchanged
claude session 3.10s 3.03s 1.00 (0.95–1.13) 218ms (209ms–228ms) 217ms (211ms–227ms) 863 MiB 866 MiB 1.00 (0.97–1.03) 1.00 (1.00–1.01) unchanged
codex daily 3.67s 3.55s 0.98 (0.89–1.01) 453ms (443ms–487ms) 454ms (439ms–466ms) 627 MiB 626 MiB 1.01 (0.96–1.05) 1.00 (0.97–1.00) unchanged
daily 4.70s 4.67s 0.98 (0.95–1.16) 516ms (499ms–540ms) 516ms (507ms–564ms) 964 MiB 957 MiB 0.99 (0.92–1.17) 1.00 (0.99–1.01) unchanged

Binary size

Artifact Base PR Delta
release binary 4974.97 KiB 5027.78 KiB +52.81 KiB

@ryoppippi
ryoppippi merged commit 3541115 into main Nov 10, 2026
49 checks passed
@ryoppippi
ryoppippi deleted the feat/cline-adapter branch November 10, 2026 17:43
Buster210 added a commit to Buster210/ccusage that referenced this pull request Nov 13, 2026
Upstream tip: 660e07c (2026-11-13,
chore(pricing): update models.dev snapshot)
Previous fork base: 30b653f (the upstream commit this fork was synced to)
Synced 100 upstream commits on top of 30b653f: 53 automated pricing
snapshot refreshes, 23 dependency bumps, 2 releases, and:
  3541115 feat(cline): add extension and CLI usage adapter (ccusage#1977)
  5e5c475 fix(antigravity): report real model names instead of placeholders (ccusage#2071)
  e39ed83 fix(claude): keep the cache TTL split when deduping equal copies (ccusage#2060)
  c17c591 feat(adapter): report 1h cache writes in JSON model breakdowns (ccusage#2059)
  a06f4bc perf(claude): halve `ccusage claude` report time (ccusage#2058)
  de43952 fix(claude): show model breakdowns for session --id (ccusage#2057)
  5f31039 fix(all): count only in-window Claude usage in unified session reports (ccusage#2052)
  e4f0ea9 fix(codex): count spawned subagent requests stamped at the fork instant (ccusage#2051)
  b85b28f fix(opencode): count usage from completed v2 compaction rows (ccusage#2050)
  00fead0 fix(antigravity): deduplicate unkeyed mirror usage (ccusage#2027)
  2248106 fix(opencode): exclude Claude Agent turns by default (ccusage#2022)
  4fb1c0d fix(codex): guard truncated type fields from panicking the parser (ccusage#2034)
  86707db build(perf): make the PR performance comparison catch real regressions (ccusage#2061)
  686a1a8 ci: support a merge queue on main (ccusage#2062)
Fork wins kept: the Codex optimized scanner with its fork-replay instant,
the Antigravity model resolver, the OpenCode retained-ledger cache with its
per-namespace rows, the SQLite on-disk cache, the table renderer, the fork
CI and tag-only release workflow, and the exact `=` dependency pins.
Hand-resolved conflicts:
  rust/adapters/claude/src/lib.rs: the fork's DedupedEntries copy pairs stay
    and take upstream's carries_more_usage_detail tiebreak (speed rank, then
    a cache TTL split); main_thread_session_days reads the recorded session
    of each copy.
  rust/adapters/opencode/{loader,parser}.rs: the fork's retain_via_ledger
    stays beside upstream's v2 compaction scan; SessionMessageKind and
    MessageRowColumns carry the row type through the five-value scan.
  rust/adapters/codex/{replay,parser}.rs: open_rollout_reader_with_capacity
    and CodexForkReplay both land in the shared parser state.
  rust/crates/ccusage-core/src/{cache,pricing}.rs: the opencode-db-compaction
    namespace joins the ledger namespaces; the fork's embedded pricing loader
    and OnceLock path stay.
  rust/crates/ccusage/src/cli/timezone.rs: Cline joins the shared-args arm,
    the ClearCache arm stays unreachable from the parser.
  rust/Cargo.toml: the fork's exact `=` pins stay; jiff 0.2.41,
    schemars 1.2.2, serde 1.0.229, smallvec 1.16.5, toml 1.2.1.
  .github/workflows/{ci,release}.yaml: the fork's design is kept, including
    its own release flow. Upstream's merge-queue, tagpr and pkg.pr.new jobs
    need scripts this fork deleted, so they are not taken; the two
    save-nix-cache inputs upstream passes to the native-package actions are
    dropped because the fork's composite actions declare no such input.
  packages/ccusage-*/package.json (6 files), the contribution-gate scripts,
    sponsors.md, blacksmith.png and rust/adapters/claude/src/daily.rs stay
    deleted; the two Blacksmith SVG logos upstream added are not taken.
Docs: the agent lists take upstream's Cline addition but keep this fork's
`pi` name, because the CLI subcommand is still `pi`; upstream renamed the
docs to `pi-agent` without renaming the command.
Snapshots regenerated for the fork table renderer: the Cline adapter, CLI
and unified reports, codex issue_2046, opencode compaction, claude session
--id and the config schema (new Cline section).
Validation: cargo test --workspace --offline 1297 passed, 0 failed; cargo
clippy --workspace --all-targets clean; rustfmt --check clean.
Version: take upstream's 20.0.50 in package.json, apps/ccusage/package.json
and docs/package.json; the Rust workspace keeps version 0.0.0.
DO NOT push a v20.0.50 tag from this fork: release.yaml would publish fork
bytes under upstream identity.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cool idea - consider making generic for CLINE users also?

1 participant