Skip to content

Include Claude Desktop local-agent usage#1922

Merged
steipete merged 4 commits into
steipete:mainfrom
Zihao-Qi:codex/claude-desktop-local-agent-usage
Jul 5, 2026
Merged

Include Claude Desktop local-agent usage#1922
steipete merged 4 commits into
steipete:mainfrom
Zihao-Qi:codex/claude-desktop-local-agent-usage

Conversation

@Zihao-Qi

@Zihao-Qi Zihao-Qi commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Include Claude Desktop local-agent session logs when calculating Claude local cost usage.
  • Discover embedded .claude/projects roots under both Claude Desktop session stores.
  • Keep current Desktop Code/Cowork sessions covered through their shared ~/.claude/projects CLI logs.
  • Keep discovery bounded to known session layouts and skip heavy workspace folders like .git, node_modules, build, DerivedData, target, and outputs.
  • Update no-data messaging, docs, and tests for the new Claude Desktop source.

Why

Claude Desktop local-agent mode can write usage logs outside the usual Claude CLI paths (~/.config/claude/projects and ~/.claude/projects). When that happens, CodexBar can miss real Claude usage from today and show no local usage even though Claude was used.

This change teaches CodexBar to also look in the Desktop local-agent session stores, while avoiding recursive scans through user project workspaces. Metadata-only claude-code-sessions directories do not enable cost history by themselves.

Validation

  • swift test --filter 'CostUsageScannerClaudeDesktopTests|SettingsStoreCoverageTests'
  • make check
  • make test (all 48 shards)
  • Live Mac Studio QA (redacted): a current Claude Desktop cliSessionId matched its shared ~/.claude/projects JSONL, and the branch CLI returned a nonzero refreshed local cost report.

Screenshot

before
Screenshot 2026-07-05 at 13 51 59

after
Screenshot 2026-07-05 at 13 19 37

@clawsweeper

clawsweeper Bot commented Jul 5, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed July 5, 2026, 5:22 PM ET / 21:22 UTC.

Summary
The PR adds bounded Claude Desktop local-agent project discovery to Claude local cost scanning and source detection, with no-data copy, docs, changelog, and regression tests.

Reproducibility: yes. Source inspection shows current main scans only the existing Claude roots, so a Desktop local-agent-only project store under Application Support/Claude is not included; the PR tests model that missing path.

Review metrics: 1 noteworthy metric.

  • Changed surface: 10 files, +418/-15 vs PR base. The PR spans scanner code, source detection, docs, changelog, and tests, so review needs to cover both runtime scanning and first-run source detection.

Merge readiness
Overall: 🦞 diamond lobster
Proof: 🦞 diamond lobster ✨ media proof bonus
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Risk before merge

  • [P1] I did not run the Swift test suite because this review is read-only; the PR body reports focused tests, make check, and the full 48-shard make test run.
  • [P1] The branch is based on an older main, but GitHub reports it mergeable and merge-tree inspection preserved the current-main performance work; final merge/check gates should still run on the merge result.

Maintainer options:

  1. Decide the mitigation before merge
    Land the focused locator/scanner/source-detection update after normal maintainer checks, keeping discovery bounded to known Claude Desktop stores and preserving the existing CLAUDE_CONFIG_DIR override.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • No ClawSweeper repair lane is needed; the remaining action is normal maintainer merge/check handling.

Security
Cleared: The diff adds bounded local file discovery under known Claude Desktop session folders and does not add dependencies, scripts, secrets handling, or remote code execution paths.

Review details

Best possible solution:

Land the focused locator/scanner/source-detection update after normal maintainer checks, keeping discovery bounded to known Claude Desktop stores and preserving the existing CLAUDE_CONFIG_DIR override.

Do we have a high-confidence way to reproduce the issue?

Yes. Source inspection shows current main scans only the existing Claude roots, so a Desktop local-agent-only project store under Application Support/Claude is not included; the PR tests model that missing path.

Is this the best way to solve the issue?

Yes. A shared bounded locator is the narrowest maintainable path because it keeps scanner and source-detection behavior aligned, preserves existing overrides, and avoids arbitrary workspace recursion.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8cbe84873c52.

Label changes

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes redacted live Mac Studio QA plus before/after screenshots showing the local Claude cost card changing after the Desktop source was included.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The PR body includes redacted live Mac Studio QA plus before/after screenshots showing the local Claude cost card changing after the Desktop source was included.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): The PR body includes redacted live Mac Studio QA plus before/after screenshots showing the local Claude cost card changing after the Desktop source was included.

Label justifications:

  • P2: This is a normal-priority provider cost-history improvement with limited blast radius and no blocking correctness finding.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): The PR body includes redacted live Mac Studio QA plus before/after screenshots showing the local Claude cost card changing after the Desktop source was included.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes redacted live Mac Studio QA plus before/after screenshots showing the local Claude cost card changing after the Desktop source was included.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The PR body includes redacted live Mac Studio QA plus before/after screenshots showing the local Claude cost card changing after the Desktop source was included.
Evidence reviewed

What I checked:

Likely related people:

  • steipete: Git blame shows the existing Claude cost-root scanner and token-cost source detection came from the current-main cost-usage implementation, and steipete also authored the follow-up commits that completed Desktop discovery on this PR. (role: introduced behavior and recent area contributor; confidence: high; commits: e437044c32ba, 30e62dd22568, d5ab9b6ded93; files: Sources/CodexBarCore/Vendored/CostUsage/CostUsageScanner+Claude.swift, Sources/CodexBar/SettingsStore+TokenCost.swift, Sources/CodexBarCore/Providers/Claude/ClaudeDesktopProjectsLocator.swift)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (1 earlier review cycle)
  • reviewed 2026-07-05T18:59:52.019Z sha fedc7f2 :: needs maintainer review before merge. :: none

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fedc7f2d12

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/CodexBarCore/Vendored/CostUsage/CostUsageScanner+Claude.swift Outdated
@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal priority bug or improvement with limited blast radius. labels Jul 5, 2026
@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed proof: sufficient Contributor real behavior proof is sufficient. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Jul 5, 2026
@steipete steipete merged commit ba378a2 into steipete:main Jul 5, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants