Skip to content

feat: Add Sonnet quota tracking feature#2

Open
youngbinkim0 wants to merge 4 commits intoignitedvisions:mainfrom
youngbinkim0:feat/sonnet-quota-tracking
Open

feat: Add Sonnet quota tracking feature#2
youngbinkim0 wants to merge 4 commits intoignitedvisions:mainfrom
youngbinkim0:feat/sonnet-quota-tracking

Conversation

@youngbinkim0
Copy link
Copy Markdown

@youngbinkim0 youngbinkim0 commented Feb 25, 2026

Summary

  • Add end-to-end tracking for the Claude seven_day_sonnet (Sonnet weekly window) quota alongside existing Session (5-hour) and Weekly (7-day) windows
  • Sonnet card appears conditionally in the Compose UI only when data exists, with amber accent (#D97706)
  • Foreground notification gains a third row for Sonnet, hidden when no data is present
  • 4 JVM unit tests cover JSON parsing edge cases (all windows present, missing Sonnet, used/limit fallback, empty object)

Changed Files

Core logic

  • ClaudeApiService.kt — parse seven_day_sonnet key; parseUsageData/parseWindow made internal for testability; empty {} objects return null
  • SessionManager.ktsonnetUtilization/sonnetResetsAt fields + SharedPreferences persistence

UI

  • MainActivity.kt — conditional Sonnet UsageCard (amber theme, 7-day window label)
  • notification_usage.xml — Sonnet row (GONE by default)
  • notif_progress_sonnet.xml — amber progress drawable
  • UsagePollingService.kt — bind/show/hide Sonnet notification row

Tests & build

  • ClaudeApiServiceParsingTest.kt — 4 JUnit4 parsing tests
  • gradle/libs.versions.toml + app/build.gradle.ktsorg.json:json as testImplementation

Docs

  • README.md — updated one-liner to mention Sonnet

Verification

  • ./gradlew :app:assembleDebug
  • ./gradlew :app:testDebugUnitTest ✅ (4/4 tests pass)

How to Test

  1. adb install -r app/build/outputs/apk/debug/app-debug.apk
  2. Log in with your Claude account
  3. If your account has Sonnet quota data, a third amber card should appear below the Weekly card
  4. The foreground notification should show a Sonnet row when data exists

youngbinkim0 and others added 4 commits February 25, 2026 15:19
- Parse seven_day_sonnet quota from Claude API responses
- Persist quota data in SessionManager (sonnetUtilization, sonnetResetsAt)
- Add notification layout with Sonnet progress bar
- Add Sonnet progress drawable (amber color #FFD97706)

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
- Display Sonnet quota card in MainActivity using Compose
- Show card only when Sonnet data is available (sonnetResetsAt > 0L or sonnetUtilization > 0.0)
- Use amber color theme (#FFD97706) for Sonnet indicator

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
- Add ClaudeApiServiceParsingTest.kt with 4 JUnit4 parsing tests
  * Tests empty response handling
  * Tests seven_day_sonnet parsing
  * Tests null handling for missing quota objects
- Add org.json:json as testImplementation for JSON parsing on JVM
- Update app/build.gradle.kts with test dependency

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
- Added note about Sonnet weekly quota tracking in documentation
- Feature now tracks seven_day_sonnet usage window alongside other quotas

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
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