This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
OctoMeter (internal name: Kunigami) is a Kotlin Multiplatform (KMP) app for tracking UK Octopus Energy tariff rates and smart meter usage. Targets Android, Desktop (macOS/Windows/Linux), and iOS. The project is in maintenance mode — no new features, dependency updates and critical fixes only.
Package namespace: com.rwmobi.kunigami
# Run desktop app
./gradlew run
# Build Android debug APK
./gradlew :composeApp:assembleDebug
# Full build with all checks
./gradlew build
# iOS: open iosApp/OctoMeter.xcworkspace in Xcode# Run all unit tests (Android)
./gradlew :composeApp:testDebugUnitTest
# Run desktop tests
./gradlew :composeApp:desktopTest
# Run a single test class
./gradlew :composeApp:testDebugUnitTest --tests "com.rwmobi.kunigami.ui.viewmodels.AgileViewModelTest"
# Run a single test method
./gradlew :composeApp:testDebugUnitTest --tests "com.rwmobi.kunigami.ui.viewmodels.AgileViewModelTest.methodName"
# Android instrumented tests (Pixel 2 API 35 managed device)
./gradlew :composeApp:pixel2Api35DebugAndroidTest
# Before running tests after Room schema changes
./gradlew :composeApp:kspCommonMainKotlinMetadataAll tests run with timezone fixed to Europe/London.
./gradlew lintKotlin # Check Kotlin style
./gradlew formatKotlin # Auto-format code
./gradlew detekt # Static analysis
./gradlew lint # Android lint
./gradlew :composeApp:jacocoTestReportDebug # Code coverage reportCI enforces all of these — run ./gradlew check assembleDebug to replicate the CI gate.
Clean Architecture with three layers in composeApp/src/commonMain/:
domain/ → Pure Kotlin: models, repository interfaces, use cases
data/ → Repository implementations, data sources (network, Room DB, cache, prefs)
ui/ → Compose screens, ViewModels, navigation, theme
di/ → Koin dependency injection modules
Data flow: Compose UI → ViewModel (StateFlow) → UseCase → Repository interface → DataSource (GraphQL/REST/Room)
Key patterns:
- MVVM with ViewModels exposing
StateFlow - Repository pattern with abstract interfaces in domain, implementations in data
- Koin for DI across all platforms
- Apollo GraphQL (primary API) + Ktor REST (secondary) — GraphQL queries live in
commonMain/graphql/ - Room database with KSP code generation (requires
kspCommonMainKotlinMetadatatask before compilation after schema changes)
| Purpose | Library |
|---|---|
| UI | Compose Multiplatform + Material3 |
| Networking | Ktor 3.x + Apollo GraphQL 4.x |
| Database | AndroidX Room (KMP) |
| DI | Koin 4.x |
| Async | Kotlinx Coroutines |
| Serialization | Kotlinx Serialization |
| Logging | Kermit |
| Charting | KoalaPlot |
| Settings | Multiplatform Settings |
commonMain/commonTest— shared code and tests (primary location for logic)androidMain/androidUnitTest/androidInstrumentedTestdesktopMain/desktopTestiosMain
All dependency versions are centralized in gradle/libs.versions.toml. Renovate bot handles automated dependency updates.