Repository navigation
Conversation
Antigravity stores usage in per-conversation SQLite databases under `~/.gemini/antigravity-cli/conversations/`, with the token counts held in protobuf blobs. Antigravity publishes no `.proto` files, so `proto.rs` decodes them by field number, recovered from the `FileDescriptorProto` blobs embedded in the `agy` binary rather than guessed from the data. Decoding by number is safe here because Antigravity has to read the same blobs back after an upgrade, so it cannot renumber a field without breaking its own persistence. A hand-rolled wire reader keeps `prost` and its build-time codegen out of the dependency graph; only the fields ccusage needs are decoded. Token mapping follows `ModelUsageStats`. `input_tokens` and `cache_read_tokens` are disjoint, which a real record proves by carrying an `input_tokens` of 4050 against a `cache_read_tokens` of 16275, so neither needs adjusting to fit ccusage's split. `output_tokens` already contains `thinking_output_tokens`, so the thinking count is only used to rebuild a missing total. Usage comes from two tables. `steps` is primary and holds one row per invocation, including the background calls nothing else records. `gen_metadata` is read because it is the only place a human-readable model name appears, and because it keeps usage visible for a step that has since been pruned. Every invocation is deduplicated on `response_id`, falling back to `provider_assigned_message_id` then `message_id`. One call can be recorded in more than one place: `retry_infos` repeats the attempt that succeeded alongside those that failed, and a sub-conversation may repeat a call its parent already recorded. Deduplicating on the server-assigned id counts the failed attempts, which consumed tokens of their own, without recounting the successful one — and it holds whether or not Antigravity repeats the successful attempt in its retry list. Antigravity leaves `model_cost`, `credit_cost` and `consumed_credits` unset on consumer accounts, so cost is calculated from LiteLLM rates and is an equivalent public API cost rather than a billed amount. Invocations `gen_metadata` never named are reported under `antigravity-model-<id>`: the model id is opaque and the shipped descriptor only names those as `MODEL_PLACEHOLDER_M<n>`, so their tokens are counted while they surface as missing pricing. Tests synthesise their protobuf blobs. A captured conversation database would embed absolute paths, user prompts and Antigravity's own system prompt, none of which belong in this repository.
Wires the adapter into the CLI: `ccusage antigravity daily|monthly| session`, the `--last` window, and the unified report, which now picks Antigravity up whenever conversation databases are detected. Antigravity takes the next index in `BUILT_IN_AGENT_NAMES` so the all-agents loader spec, the agent label lookup, and the parser's allowlists stay in step with each other.
Lets `ccusage.json` set Antigravity defaults and per-report overrides the same way the other sources can, and regenerates the published schema.
Adds the Antigravity guide and lists the source across the READMEs, the getting-started and all-reports pages, the environment variable reference, and the VitePress sidebar. The guide states the limitations rather than leaving them implied: cost is an equivalent public API cost and never a billed amount, unnamed model ids cannot be priced, `--offline` has no Gemini rates to use, and the retry, subagent and model-comparison paths are handled by design but have not yet been exercised against real data. Antigravity was previously listed as investigated and unsupported, because it stored conversations as opaque `.pb` payloads that needed an unpublished schema. It now writes SQLite databases whose protobuf field numbers can be recovered from the descriptors in its own binary, so that entry moves to a new section recording how the blocker was resolved.
|
@coderabbitai full review |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds experimental Antigravity support to ccusage, including read-only SQLite/protobuf ingestion, token and pricing handling, daily/monthly/session reports, CLI and configuration integration, unified loading, and documentation. ChangesAntigravity source support
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant CLI
participant AntigravityAdapter
participant SQLiteDatabases
participant Reports
User->>CLI: ccusage antigravity daily
CLI->>AntigravityAdapter: dispatch AgentCommandArgs
AntigravityAdapter->>SQLiteDatabases: read conversation databases
SQLiteDatabases-->>AntigravityAdapter: steps and gen_metadata blobs
AntigravityAdapter->>Reports: summarize dated usage entries
Reports-->>User: usage table or JSON report
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
✅ Action performedFull review finished. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
ccusage-guide | baa4715 | Commit Preview URL Branch Preview URL |
Jul 29 2026, 09:06 PM |
There was a problem hiding this comment.
Reviewed changes — new ccusage-adapter-antigravity crate that reads Antigravity CLI usage from per-conversation SQLite databases, exposing ccusage antigravity daily|monthly|session and unified report inclusion.
- Hand-rolled protobuf wire reader for
ModelUsageStats/CortexStepMetadatablobs — decodes by field number recovered fromFileDescriptorProtoblobs embedded in theagybinary, with 10 tests covering decoding, retry parsing, timestamps, identity fallback, gen_metadata wrapper discovery, and malformed-input tolerance. - Loader reading
steps(primary) andgen_metadata(model names + pruned-step backstop) — deduplicates byresponse_id→provider_assigned_message_id→message_id; 10 tests covering naming, pricing, retry dedupe, cross-database dedupe, pruned steps, background calls, corrupt blobs, and missing tables. - Token mapping and pricing —
input_tokens/cache_read_tokensare disjoint;output_tokensalready includes thinking; cost calculated from LiteLLM rates with provider-qualified candidate lookups by model family; unnamed models surface asantigravity-model-<id>;--mode displaycorrectly reports zero. - Standard adapter wiring —
BUILT_IN_AGENT_NAMES,Command::Antigravity,parse_basic_agent_command,STANDARD_AGENT_REPORTS, CLI commands JSON, config schema namespace, progress tracking, and the full all-agents loader/report integration. - Documentation — new
docs/guide/antigravity/guide with accuracy notes, VitePress sidebar, README tables, env-var reference, all-reports, getting-started paths, and source-support-qa reversal documenting the previously-unsupported-to-now-supported transition.
✅ No new issues found.
@v0 or keep the SHA fresh with Dependabot | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
The docs state that every source-specific path variable can hold comma-separated directories, so a current profile and an archive can be reported together. Antigravity was taking the whole value as a single path, which made that claim untrue for this source.
`collect_records` reads two tables, and each read was opening its own read-only connection. Opening once and sharing it halves the connections per conversation, which matters because Antigravity writes one database per conversation rather than one for the whole history.
ccusage
@ccusage/ccusage-darwin-arm64
@ccusage/ccusage-darwin-x64
@ccusage/ccusage-linux-arm64
@ccusage/ccusage-linux-x64
@ccusage/ccusage-win32-x64
commit: |
ccusage performance comparisonPR SHA: This compares the Rust PR release binary against the configured base package on the same CI runner. Package runtime diagnosticsCompares 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
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated 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
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
ccusage performance comparisonPR SHA: This compares the PR package against the configured base package on the same CI runner. Package runtime diagnosticsCompares 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
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated 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
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — two follow-up commits on the Antigravity adapter: a performance fix that opens each conversation database once instead of twice, and comma-separated data directory support matching every other source-specific path variable.
- Reused the SQLite connection across both
read_blobscalls —collect_recordsopens the database once and passes&connectionto theANTIGRAVITY_GENERATION_QUERYandANTIGRAVITY_STEP_QUERYreads, halving the per-database open cost. Error handling is identical; thesqlite::Connection::open_with_flagsguard and the per-tablepreparefallback remain unchanged. - Accepted comma-separated
ANTIGRAVITY_DATA_DIRvalues —antigravity_rootssplits on,, trims, and filters empty entries, so a current profile and an archive directory can be reported together. A new test validates two-database discovery.
@v0 or keep the SHA fresh with Dependabot | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (2)
rust/crates/ccusage-adapter-all/Cargo.toml (1)
13-17: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDependency line inserted out of alphabetical order.
ccusage-adapter-antigravityis placed betweencopilotandgoose, but the file otherwise follows alphabetical order (and the siblinglib.rs/adapter/mod.rsre-exports correctly placeantigravityright afteramp). Consider moving it to keep the list scannable.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@rust/crates/ccusage-adapter-all/Cargo.toml` around lines 13 - 17, Reorder the workspace dependency entries so ccusage-adapter-antigravity appears in alphabetical order relative to the other ccusage-adapter entries, matching the ordering used by the related re-exports.rust/adapters/antigravity/src/proto.rs (1)
149-154: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDoc comments describe the wrong dedup fallback order.
The field docs say the fallback order is
response_id→message_id(first fallback) →provider_assigned_message_id(second fallback), butidentity()actually checksprovider_message_idbeforemessage_id— and the testfalls_back_through_the_identity_fields(Line 417) confirms this is the intended, tested behavior (provider-awins overmessage-a). Update the comments to match the actual/tested precedence so future readers of this hand-rolled decoder aren't misled about dedup semantics.📝 Proposed doc fix
- /// `message_id` — dedup fallback when `response_id` is absent. + /// `message_id` — dedup fallback when `response_id` and + /// `provider_assigned_message_id` are both absent. pub(crate) message_id: Option<String>, - /// `provider_assigned_message_id` — second dedup fallback. + /// `provider_assigned_message_id` — first dedup fallback when + /// `response_id` is absent. pub(crate) provider_message_id: Option<String>,Also applies to: 176-188
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@rust/adapters/antigravity/src/proto.rs` around lines 149 - 154, Update the doc comments for response_id, provider_message_id, and message_id to document the actual identity() precedence: response_id first, provider_message_id as the first fallback, and message_id as the second fallback. Keep the implementation and tested behavior in falls_back_through_the_identity_fields unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/guide/antigravity/index.md`:
- Around line 68-72: Clarify the cost-mode explanation in the guide surrounding
the antigravity example: explicitly state that --mode calculate is the
alternative used to estimate cost, while --mode display shows only precomputed
costs. Keep the existing command example consistent with that explanation and
update any relevant guide examples affected by this wording.
In `@docs/guide/index.md`:
- Around line 75-97: Propagate Antigravity support through all documentation
inventories: in docs/guide/index.md (lines 75-97), add antigravity to
introductory source lists and focused-command examples; in
docs/guide/all-reports.md (lines 49-66), add it to unified-source lists and
focused examples; in docs/guide/environment-variables.md (line 20), include
ANTIGRAVITY_DATA_DIR in the export example; and in docs/guide/getting-started.md
(lines 179-200), include ANTIGRAVITY_DATA_DIR in comma-separated directory
examples.
In `@rust/adapters/antigravity/README.md`:
- Around line 83-88: Update the “Public surface” section in the antigravity
README to remove report::report_from_rows, since it is only pub(crate). Keep the
genuinely externally public items—loader::load_entries,
report::summarize_entries, and run—listed.
In `@rust/adapters/antigravity/src/paths.rs`:
- Around line 80-86: Update the test ignores_a_blank_data_dir_override to also
guard the home-directory environment variable(s) used by antigravity_roots,
setting them to a valid temporary or deterministic value before calling
antigravity_db_paths(). Preserve the existing blank override assertion while
ensuring the test does not depend on the process environment's real HOME or
USERPROFILE.
---
Nitpick comments:
In `@rust/adapters/antigravity/src/proto.rs`:
- Around line 149-154: Update the doc comments for response_id,
provider_message_id, and message_id to document the actual identity()
precedence: response_id first, provider_message_id as the first fallback, and
message_id as the second fallback. Keep the implementation and tested behavior
in falls_back_through_the_identity_fields unchanged.
In `@rust/crates/ccusage-adapter-all/Cargo.toml`:
- Around line 13-17: Reorder the workspace dependency entries so
ccusage-adapter-antigravity appears in alphabetical order relative to the other
ccusage-adapter entries, matching the ordering used by the related re-exports.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: a7e853f8-c70d-4dc7-8dd8-910f8e2c9724
⛔ Files ignored due to path filters (3)
rust/Cargo.lockis excluded by!**/*.lockrust/crates/ccusage-cli-parser/src/snapshots/ccusage_cli_parser__tests__root_help.snapis excluded by!**/*.snaprust/crates/ccusage-config/src/snapshots/ccusage_config__config_schema__tests__snapshots_schema_agent_specific_option_edges.snapis excluded by!**/*.snap
📒 Files selected for processing (33)
apps/ccusage/README.mdapps/ccusage/config-schema.jsondocs/.vitepress/config.tsdocs/guide/all-reports.mddocs/guide/antigravity/index.mddocs/guide/environment-variables.mddocs/guide/getting-started.mddocs/guide/index.mddocs/guide/source-support-qa.mdnix/cargo-artifacts.nixrust/Cargo.tomlrust/adapters/antigravity/Cargo.tomlrust/adapters/antigravity/README.mdrust/adapters/antigravity/src/lib.rsrust/adapters/antigravity/src/loader.rsrust/adapters/antigravity/src/parser.rsrust/adapters/antigravity/src/paths.rsrust/adapters/antigravity/src/proto.rsrust/adapters/antigravity/src/report.rsrust/crates/ccusage-adapter-all/Cargo.tomlrust/crates/ccusage-adapter-all/src/lib.rsrust/crates/ccusage-adapter-all/src/loader.rsrust/crates/ccusage-adapter-all/src/report.rsrust/crates/ccusage-cli-parser/src/cli-commands.jsonrust/crates/ccusage-cli-parser/src/parser.rsrust/crates/ccusage-cli-parser/src/tests.rsrust/crates/ccusage-cli/src/types.rsrust/crates/ccusage-config/src/config_schema.rsrust/crates/ccusage-core/src/lib.rsrust/crates/ccusage/Cargo.tomlrust/crates/ccusage/src/adapter/mod.rsrust/crates/ccusage/src/cli/last_window.rsrust/crates/ccusage/src/main.rs
ccusage performance comparisonPR SHA: This compares the PR package against the configured base package on the same CI runner. Package runtime diagnosticsCompares 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
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated 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
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
ccusage performance comparisonPR SHA: This compares the Rust PR release binary against the configured base package on the same CI runner. Package runtime diagnosticsCompares 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
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated 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
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/guide/antigravity/index.md`:
- Around line 31-40: The Antigravity guide currently documents only one data
root and direct conversation files. Update the `ANTIGRAVITY_DATA_DIR`
documentation to state that it accepts comma-separated roots and that ccusage
recursively discovers `.db` files beneath each root’s `conversations/`
directory, including archived or nested files; adjust the example path wording
accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: f5b90431-36da-44b6-8c8a-313ffaf2248b
⛔ Files ignored due to path filters (3)
rust/Cargo.lockis excluded by!**/*.lockrust/crates/ccusage-cli-parser/src/snapshots/ccusage_cli_parser__tests__root_help.snapis excluded by!**/*.snaprust/crates/ccusage-config/src/snapshots/ccusage_config__config_schema__tests__snapshots_schema_agent_specific_option_edges.snapis excluded by!**/*.snap
📒 Files selected for processing (33)
apps/ccusage/README.mdapps/ccusage/config-schema.jsondocs/.vitepress/config.tsdocs/guide/all-reports.mddocs/guide/antigravity/index.mddocs/guide/environment-variables.mddocs/guide/getting-started.mddocs/guide/index.mddocs/guide/source-support-qa.mdnix/cargo-artifacts.nixrust/Cargo.tomlrust/adapters/antigravity/Cargo.tomlrust/adapters/antigravity/README.mdrust/adapters/antigravity/src/lib.rsrust/adapters/antigravity/src/loader.rsrust/adapters/antigravity/src/parser.rsrust/adapters/antigravity/src/paths.rsrust/adapters/antigravity/src/proto.rsrust/adapters/antigravity/src/report.rsrust/crates/ccusage-adapter-all/Cargo.tomlrust/crates/ccusage-adapter-all/src/lib.rsrust/crates/ccusage-adapter-all/src/loader.rsrust/crates/ccusage-adapter-all/src/report.rsrust/crates/ccusage-cli-parser/src/cli-commands.jsonrust/crates/ccusage-cli-parser/src/parser.rsrust/crates/ccusage-cli-parser/src/tests.rsrust/crates/ccusage-cli/src/types.rsrust/crates/ccusage-config/src/config_schema.rsrust/crates/ccusage-core/src/lib.rsrust/crates/ccusage/Cargo.tomlrust/crates/ccusage/src/adapter/mod.rsrust/crates/ccusage/src/cli/last_window.rsrust/crates/ccusage/src/main.rs
There was a problem hiding this comment.
All reported issues were addressed
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
Re-trigger cubic
The guide inventories that enumerate every source still stopped at Copilot CLI and Gemini CLI, so the introduction, the unified-report source list, the focused-command examples and the data directory export examples contradicted the tables that already listed Antigravity. Also drops report::report_from_rows from the adapter README's public surface; it is re-exported as pub(crate) and only used by run. Co-authored-by: Codesmith <[email protected]>
ignores_a_blank_data_dir_override only overrode ANTIGRAVITY_DATA_DIR, so the fallback still read the real HOME and the assertion failed wherever it is unset. Pinning it at a fixture also lets the test assert the fallback finds no databases rather than merely that it returned Ok. Both variables go through one EnvVarsGuard because EnvVarGuard holds the same non-reentrant global env lock, so taking a second guard in one test deadlocks. Co-authored-by: Codesmith <[email protected]>
The session branch grouped by key and then moved the group key into session_id, which left last_activity, first_activity and project_path unset: the session table had no Last Activity column and the JSON exposed none of the session metadata every other timestamped adapter reports. Accumulating with SessionAccumulator, as qwen, pi, opencode and openclaw already do, carries the activity range and project path onto the row, and the JSON report now asks for session metadata for the session kind. Co-authored-by: Codesmith <[email protected]>
google.protobuf.Timestamp constrains nanos to a single second, but a corrupt blob carrying more than that was normalized into the millisecond total, which reported the invocation up to four seconds late and near midnight moved it into the next day's report. The seconds field is still trusted, so the invocation is kept rather than dropped along with its tokens. Co-authored-by: Codesmith <[email protected]>
ccusage performance comparisonPR SHA: This compares the PR package against the configured base package on the same CI runner. Package runtime diagnosticsCompares 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
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated 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
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
ccusage performance comparisonPR SHA: This compares the Rust PR release binary against the configured base package on the same CI runner. Package runtime diagnosticsCompares 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
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated 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
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
ccusage performance comparisonPR SHA: This compares the PR package against the configured base package on the same CI runner. Package runtime diagnosticsCompares 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
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated 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
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@rust/adapters/antigravity/README.md`:
- Around line 19-20: Update the README discovery examples to use recursive
conversations/**/*.db patterns, and document that the configured data directory
may contain comma-separated roots for the loader to search. Audit the relevant
guide pages and cross-links for the same discovery-path documentation and update
them consistently.
- Around line 1-15: Expand the Antigravity adapter README with a concise usage
section containing representative `ccusage antigravity ...` commands, and add
links to the Antigravity guide and related report documentation. Ensure the
corresponding guide content and VitePress navigation entries are added or
updated in the same change, using the repository’s existing documentation
structure and naming conventions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 117c68e2-3c91-4e4f-b5b7-386957d98b51
⛔ Files ignored due to path filters (3)
rust/Cargo.lockis excluded by!**/*.lockrust/crates/ccusage-cli-parser/src/snapshots/ccusage_cli_parser__tests__root_help.snapis excluded by!**/*.snaprust/crates/ccusage-config/src/snapshots/ccusage_config__config_schema__tests__snapshots_schema_agent_specific_option_edges.snapis excluded by!**/*.snap
📒 Files selected for processing (33)
apps/ccusage/README.mdapps/ccusage/config-schema.jsondocs/.vitepress/config.tsdocs/guide/all-reports.mddocs/guide/antigravity/index.mddocs/guide/environment-variables.mddocs/guide/getting-started.mddocs/guide/index.mddocs/guide/source-support-qa.mdnix/cargo-artifacts.nixrust/Cargo.tomlrust/adapters/antigravity/Cargo.tomlrust/adapters/antigravity/README.mdrust/adapters/antigravity/src/lib.rsrust/adapters/antigravity/src/loader.rsrust/adapters/antigravity/src/parser.rsrust/adapters/antigravity/src/paths.rsrust/adapters/antigravity/src/proto.rsrust/adapters/antigravity/src/report.rsrust/crates/ccusage-adapter-all/Cargo.tomlrust/crates/ccusage-adapter-all/src/lib.rsrust/crates/ccusage-adapter-all/src/loader.rsrust/crates/ccusage-adapter-all/src/report.rsrust/crates/ccusage-cli-parser/src/cli-commands.jsonrust/crates/ccusage-cli-parser/src/parser.rsrust/crates/ccusage-cli-parser/src/tests.rsrust/crates/ccusage-cli/src/types.rsrust/crates/ccusage-config/src/config_schema.rsrust/crates/ccusage-core/src/lib.rsrust/crates/ccusage/Cargo.tomlrust/crates/ccusage/src/adapter/mod.rsrust/crates/ccusage/src/cli/last_window.rsrust/crates/ccusage/src/main.rs
🚧 Files skipped from review as they are similar to previous changes (29)
- rust/crates/ccusage/src/adapter/mod.rs
- rust/adapters/antigravity/Cargo.toml
- rust/crates/ccusage-adapter-all/src/lib.rs
- docs/.vitepress/config.ts
- rust/crates/ccusage-cli/src/types.rs
- rust/Cargo.toml
- rust/crates/ccusage/src/cli/last_window.rs
- docs/guide/getting-started.md
- rust/crates/ccusage-cli-parser/src/tests.rs
- rust/adapters/antigravity/src/lib.rs
- docs/guide/all-reports.md
- rust/crates/ccusage-cli-parser/src/cli-commands.json
- rust/crates/ccusage/Cargo.toml
- nix/cargo-artifacts.nix
- apps/ccusage/README.md
- rust/adapters/antigravity/src/parser.rs
- rust/crates/ccusage-config/src/config_schema.rs
- docs/guide/index.md
- rust/crates/ccusage-adapter-all/Cargo.toml
- rust/adapters/antigravity/src/report.rs
- docs/guide/environment-variables.md
- rust/crates/ccusage-adapter-all/src/report.rs
- rust/crates/ccusage/src/main.rs
- rust/crates/ccusage-cli-parser/src/parser.rs
- rust/crates/ccusage-adapter-all/src/loader.rs
- rust/adapters/antigravity/src/loader.rs
- apps/ccusage/config-schema.json
- docs/guide/source-support-qa.md
- rust/adapters/antigravity/src/proto.rs
CI Fix InvestigationDiagnosisThe check suite (#82630698630) logs have expired and cannot be retrieved. I checked out the PR branch and ran all local CI checks:
All 15 flake checks pass locally. The CI failure appears to have been transient (check suite from an older commit with expired workflow runs). Attempted FixCreated an empty retrigger commit ( Push ResultPush failed with permission error: The branch Task list (1/6 completed)
|
… README Co-authored-by: Codesmith <[email protected]>
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — six follow-up commits on the Antigravity adapter: two behavioral fixes, a test environment hardening, and three documentation rounds that propagate Antigravity to every shared inventory and document recursive database discovery.
- Discarded out-of-range protobuf timestamp nanos —
proto.rsnow drops nanos ≥ 1e9 instead of normalizing them, which prevents a corrupt blob from shifting an invocation across a day boundary. A new test exercises the guard. - Reported session activity and project path — session reports now use
SessionAccumulator, sofirst_activity,last_activity, andproject_pathappear in the session table and JSON output. - Pinned
HOMEin the blank-override test —ignores_a_blank_data_dir_overridenow guardsHOMEalongside the blankANTIGRAVITY_DATA_DIR, so the test no longer depends on the process environment's real home directory. - Documented recursive database discovery — the crate README and user guide now describe
**/*.dbpatterns, comma-separatedANTIGRAVITY_DATA_DIR, and recursive sub-conversation database collection matching whatcollect_files_with_extensionactually does. - Propagated Antigravity to shared documentation inventories — added to
source-support-qa(removed from unsupported, added to now-supported),all-reports,getting-started,environment-variables, and the root guide.
@v0 or keep the SHA fresh with Dependabot | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
ccusage performance comparisonPR SHA: This compares the Rust PR release binary against the configured base package on the same CI runner. Package runtime diagnosticsCompares 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
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated 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
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
ccusage performance comparisonPR SHA: This compares the PR package against the configured base package on the same CI runner. Package runtime diagnosticsCompares 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
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated 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
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
The config namespaces list stopped at `gemini`, so the page did not mention the namespace the schema already accepts.
ccusage performance comparisonPR SHA: This compares the PR package against the configured base package on the same CI runner. Package runtime diagnosticsCompares 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
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated 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
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
ccusage performance comparisonPR SHA: This compares the Rust PR release binary against the configured base package on the same CI runner. Package runtime diagnosticsCompares 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
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated 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
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
The crate README described internals only, so anyone landing there had no route to the commands or to the guide that documents what the numbers mean. Found by CodeRabbit on #1544.
|
Addressed the README finding: the crate README now opens with the The other parts of that documentation contract were already covered elsewhere in |
ccusage performance comparisonPR SHA: This compares the Rust PR release binary against the configured base package on the same CI runner. Package runtime diagnosticsCompares 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
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated 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
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
ccusage performance comparisonPR SHA: This compares the PR package against the configured base package on the same CI runner. Package runtime diagnosticsCompares 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
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated 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
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
…#1569) revert: "feat(antigravity): add Antigravity CLI usage adapter (#1544)" This reverts commit 50614f1. Temporary, so that v20.0.20 does not ship a half-finished adapter. The intent is to reapply Antigravity support, not to drop it — see #1488. #1544 landed while the contribution proposal in #1488 was still open, and it covers less ground than @sambitcreate's #1487: - It reads only `~/.gemini/antigravity-cli`, missing `antigravity`, `antigravity-ide` and `antigravity-backup`, so IDE users get nothing. - Opaque model ids stay as `antigravity-model-<id>` with no alias table, so they cannot be priced and cost is silently understated. - The offline pricing snapshot has no Gemini rates, so `--offline` reports no cost for Gemini models. - It was validated against three chat turns in one CLI conversation. - Retries, subagents and model comparison ship unexercised. The first three are already solved in #1487, which is the better base to build on. Reverting now keeps the release clean while that is sorted out, and costs nothing: the adapter has not been released, so no user has it. Nothing about the reverse engineering is lost. The recovered field numbers and the reasoning behind the dedupe are written up in #1488.

Summary
Adds an
antigravityadapter that reads Antigravity CLI usage from theper-conversation SQLite databases it writes under
~/.gemini/antigravity-cli/conversations/, and exposesccusage antigravity daily|monthly|sessionplus inclusion in the unified report.Antigravity was previously documented as investigated and unsupported. That entry
described a storage format it has since replaced, and the blocker it named is now
solvable — see Why this is now possible.
What Changed
rust/adapters/antigravitywithproto.rs,paths.rs,loader.rs,parser.rsandreport.rs.ccusage antigravity daily|monthly|session,--lastsupport, theANTIGRAVITY_DATA_DIRoverride, and the unified all-agents report.antigravitynamespace inccusage.json, with the published schemaregenerated.
docs/guide/antigravity/guide, listed across the READMEs,getting-started, all-reports, the environment variable reference and the
VitePress sidebar.
Why this is now possible
Antigravity ships no
.protofiles, which is what made it look unreadablebefore. Two things changed:
conversations/<id>.pbpayloads.FileDescriptorProtoblobs embedded in theagybinary, so they are upstreamnumbers rather than guesses.
Decoding by field number is durable here because Antigravity has to read the same
blobs back after an upgrade, so it cannot renumber a field without breaking its
own persistence. A hand-rolled wire reader keeps
prostand its build-timecodegen out of the dependency graph.
Token mapping
Follows
ModelUsageStats. Two details matter:input_tokensandcache_read_tokensare disjoint, which a real record provesby carrying an
input_tokensof 4050 against acache_read_tokensof 16275.Neither needs adjusting to fit ccusage's split.
output_tokensalready containsthinking_output_tokens, so the thinking countis only used to rebuild a missing total.
Usage comes from two tables.
stepsis primary and holds one row per invocation,including background calls nothing else records.
gen_metadatais read because itis the only place a human-readable model name appears, and because it keeps usage
visible for a step that has since been pruned.
Dedupe
Every invocation is deduplicated on
response_id, falling back toprovider_assigned_message_idthenmessage_id. One call can be recorded in morethan one place:
retry_infosrepeats the attempt that succeeded alongside thosethat failed, and a sub-conversation may repeat a call its parent already recorded.
Deduplicating on the server-assigned id counts the failed attempts, which consumed
tokens of their own, without recounting the successful one. It holds whether or not
Antigravity repeats the successful attempt in its retry list, which is what makes
it safe to ship before that path has been seen in real data.
Cost
Antigravity leaves
model_cost,credit_costandconsumed_creditsunset onconsumer accounts, so there is nothing precomputed to read and
--mode displayreports zero. Cost is calculated from LiteLLM rates and is an equivalent public API
cost, not an amount billed — Antigravity is quota-based.
Invocations
gen_metadatanever named are reported underantigravity-model-<id>. The model id is opaque and Antigravity's own descriptoronly names those as
MODEL_PLACEHOLDER_M<n>, so their tokens are counted whilethey surface as missing pricing. Token totals stay complete; the cost total is
understated by that model's share.
Testing
just check— 15 flake checks pass (clippy, hawk, treefmt, schema drift,gitleaks, oxlint, publint).
just test— full Rust workspace plus Node tests pass. 32 new tests cover thewire decoder, path discovery, retry dedupe, cross-database dedupe, unnamed
models, pruned steps, and malformed blobs.
44,463 input / 456 output / 16,275 cache read / $0.07239375 matches a hand
calculation from the raw protobuf to the cent, with the only difference being
the $0.000162 belonging to the model that cannot be priced.
Tests synthesise their protobuf blobs rather than committing a captured database,
which would embed absolute paths, user prompts and Antigravity's own system prompt.
Review notes
Two places worth extra attention:
docs/guide/source-support-qa.mdreverses a previously documented decision.docs/guide/antigravity/index.mdstates the limitations explicitly: cost is anestimate, unnamed model ids cannot be priced,
--offlinehas no Gemini rates,and the retry, subagent and model-comparison paths are handled by design but have
not yet been exercised against real data.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is enabled.Summary by cubic
Adds Antigravity CLI support to
ccusage, withccusage antigravity daily|monthly|sessionand inclusion in unified reports. Reads per‑conversation SQLite databases and estimates costs viaLiteLLM, opening each DB once for better performance.New Features
ccusage-adapter-antigravityloads~/.gemini/antigravity-cli/conversations/**/*.db(override with comma‑separatedANTIGRAVITY_DATA_DIR) via a minimal protobuf reader.--last, robust retry/sub‑conversation dedupe, and unnamed models asantigravity-model-<id>.project_path. Newantigravityconfig namespace inccusage.json; docs updated, and the adapter README links to commands and the Antigravity guide.Bug Fixes
project_path).Written for commit baa4715. Summary will update on new commits.
Summary by CodeRabbit
New Features
daily,monthly, andsessionusage reports, including automatic inclusion in unified reports when supported local data is found.antigravitycommand and added Antigravity configuration support, includingANTIGRAVITY_DATA_DIRand pricing override behavior for display vs calculated cost modes (with optional offline pricing).Documentation
Chores