# ChronoMind — Windsurf / Codeium Rules
# Read AGENTS.md for full context. These are the critical rules.

Project: ChronoMind — AI-Powered Contextual Clock & Timer
Stack: Next.js 16 (web) + SwiftUI (iOS/Watch/Mac) + Jetpack Compose (Android) + Platform-service (Fastify 5)

## Architecture Rules
- Web engine logic in web/src/lib/ — pure TS, no React imports
- Components in web/src/components/ — React UI only
- iOS shared logic in ios/ChronoMind/Shared/ — consumed by all Apple targets
- Android engine in android/app/.../engine/ — pure Kotlin, no Android framework deps
- Backend: platform-service in sibling repo learning_ai_common_plat (port 4003)
- Product ID: chronomind — every Cosmos document MUST include productId field

## Key Paths
- Web: web/src/ (Next.js 16, App Router)
- iOS: ios/ChronoMind/ (SwiftUI, iOS 17+)
- Watch: ios/ChronoMindWatch/ (watchOS 10+)
- Mac: ios/ChronoMindMac/ (macOS 14+)
- Widgets: ios/ChronoMindWidgets/ (WidgetKit)
- Android: android/app/src/main/java/com/chronomind/app/
- Wear OS: android/wear/
- Docs: docs/ (PRD.md, roadmap.md, INDUSTRY_RESEARCH.md)
- Backend modules: ../learning_ai_common_plat/services/platform-service/src/modules/{timers,routines,households,shared-timers}/

## Conventions
- Theme tokens: --cm-* CSS custom properties (web), ChronoMindTheme (native)
- Commits: feat(scope): description / fix(scope): description
- Web build: must use --webpack flag (Serwist incompatible with Turbopack)
- Never use console.log — use analytics.ts stub or req.log in Fastify
- Never hardcode colors — use theme tokens
- Never hardcode API URLs — use env vars

## Build Verification
- Web: cd web && npm test && npm run typecheck && npm run build
- iOS: Open ChronoMind.xcodeproj, Cmd+B
- Android: cd android && ./gradlew :app:compileDebugKotlin
