Skip to content

feat: Add --no-usage flag to disable usage tracking#64

Open
thoraxe wants to merge 1 commit intovultuk:mainfrom
thoraxe:feature/optional-usage-tracking
Open

feat: Add --no-usage flag to disable usage tracking#64
thoraxe wants to merge 1 commit intovultuk:mainfrom
thoraxe:feature/optional-usage-tracking

Conversation

@thoraxe
Copy link

@thoraxe thoraxe commented Jan 20, 2026

Summary

Adds --no-usage CLI flag to disable usage tracking, which significantly reduces memory usage by avoiding parsing of large JSONL conversation logs.

Problem

Usage tracking parses all conversation JSONL files in ~/.claude/projects/ every time stats are requested. This causes significant memory usage and can lead to heap out of memory crashes during extended runtime.

Solution

  • Add --no-usage CLI flag to disable usage tracking entirely
  • Also adds --cwd option to specify working directory
  • Conditionally create usageReader/usageAnalytics objects
  • Pass usageTracking flag to client on WebSocket connect
  • Update client to skip usage requests when disabled
  • Hide 'Show Token Stats' setting in UI when disabled

Test plan

  • Start server with --no-usage flag
  • Verify no usage polling requests in network tab
  • Verify 'Show Token Stats' checkbox is hidden in settings
  • Verify server memory stays stable

🤖 Generated with Claude Code

Adds --no-usage CLI flag to disable usage tracking, which significantly
reduces memory usage by avoiding parsing of large JSONL conversation logs.

Changes:
- Add --no-usage and --cwd CLI options to bin/cc-web.js
- Conditionally create usageReader/usageAnalytics in server.js
- Pass usageTracking flag to client on WebSocket connect
- Update client to skip usage requests when disabled
- Hide 'Show Token Stats' setting when usage tracking disabled

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

1 participant