# Evening Sprint - 2025-01-29 @ 7pm ET

## PRIORITY 1: Flutter Styleguide (BLOCKING DEPLOYMENT!)

**Task:** Trash current styleguide, rebuild from scratch using exact CSS values.

**Source:** https://inou.com/static/style.css (saved to /tmp/inou-style.css)

**Approach:**
1. Extract ALL values from the CSS exactly
2. Font: Sora (Google Fonts)
3. Base: 15px, line-height 1.5
4. Match every font-size, weight, letter-spacing exactly
5. Test side-by-side with web version

**Key Typography (from styleguide page):**
- Page Title: 2.5rem / 700
- Section Title: 1.4rem / 600
- Subsection Title: 1.1rem / 600
- Label/Category: 0.75rem / 600 / caps
- Intro text: 1.15rem / 300
- Body light: 1rem / 300
- Body regular: 1rem / 400
- Mono: SF Mono

**Colors:**
- Accent: #B45309
- Text: #1C1917
- Text Muted: #78716C
- Background: #F8F7F6
- Success: #059669
- Danger: #DC2626

---

## PRIORITY 2: MoltMobile Phone Assistant

### Goal
Full phone assistant functionality — answer calls, handle spam, relay messages.

## Features to Build

### 1. Answer Phone Calls (InCallService)
- Implement Android InCallService to actually control calls
- Hook into DirectGateway command handlers
- call.answer → actually pick up
- call.reject → actually reject
- call.hangup → actually hang up

### 2. Spam Call Handling
When "spam likely" or unknown number calls:
1. Pick up automatically
2. Ask: "Who is calling and from what company?"
3. Speak legal disclaimer:
   > "This call is being recorded. You have reached a number registered on the Do Not Call list. 
   > This is an unsolicited call. We request immediate removal from your calling list. 
   > Any recurring call from your organization will result in a formal complaint to the 
   > Florida Department of Agriculture and Consumer Services and may result in penalties 
   > of up to $10,000 per violation under the Florida Telemarketing Act."
4. Listen for response
5. Store full conversation verbatim in `~/clawd/memory/calls/YYYY-MM-DD-HH-MM-number.md`
6. Hang up

### 3. Known Number Handling
When a known/saved contact calls:
1. Pick up
2. Say: "Hello, this is James, Johan's assistant. How can I help you?"
3. Listen to their message
4. Respond: "I'll relay [summary] to Johan. Is there anything else?"
5. Say goodbye and hang up
6. Store verbatim transcript in `~/clawd/memory/calls/YYYY-MM-DD-HH-MM-contact.md`
7. Send summary to Johan via Signal

### 4. Answer Texts (SMS)
- Capture incoming SMS via notification
- Identify spam vs legitimate
- For spam: auto-reply "STOP"
- For legitimate: relay to Johan, await instructions

### 5. TTS/STT Integration
- Need text-to-speech for speaking to callers
- Need speech-to-text for transcribing caller's responses
- Options: Android built-in, Google Cloud, ElevenLabs

### 6. 🚨 SUPER ATTENTION MODE
**Purpose:** Maximum urgency alerts — make the phone go CRAZY to get attention.

**Triggers:** 
- Gateway command: `POST /attention/super`
- Use case: Medical emergency, Sophia alert, critical system failure

**All of these simultaneously:**
- 📢 **Volume:** Force to MAX (ignore Do Not Disturb)
- 🔔 **Ringtone:** Loudest/most jarring tone available
- 📳 **Vibration:** Continuous strong vibration pattern
- 💡 **Screen:** Full brightness, flashing colors (red/white strobe)
- 🔦 **Flashlight:** Strobe the camera flash LED
- 🔊 **Audio:** Play alarm sound on loop
- 📱 **Wake:** Force screen on, prevent sleep
- 🔁 **Loop:** Continue until acknowledged via app or gateway

**Android APIs needed:**
- `AudioManager.setStreamVolume(STREAM_ALARM, max, FLAG_ALLOW_RINGER_MODES)`
- `Vibrator.vibrate(VibrationEffect.createWaveform(pattern, repeat))`
- `WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | FLAG_TURN_SCREEN_ON`
- `CameraManager.setTorchMode()` for flash strobe
- `PowerManager.WakeLock` to prevent sleep
- Override DND with `NotificationManager.INTERRUPTION_FILTER_ALL`

**Stop conditions:**
- User taps "ACKNOWLEDGE" button on full-screen alert
- Gateway sends `POST /attention/stop`
- Timeout (configurable, default: none — keep going until ack)

### 7. 🌐 Remote Browser (WebView GUI)
**Purpose:** Let James control a browser on the phone — open URLs, interact with pages, take screenshots.

**Simple GUI:**
- Full-screen WebView activity
- Can be launched via gateway command
- Status bar shows "James is browsing"

**Gateway endpoints:**
- `POST /browser/open` — Launch browser activity with URL
- `POST /browser/navigate` — Go to new URL
- `POST /browser/js` — Execute JavaScript
- `GET /browser/screenshot` — Capture current view
- `POST /browser/close` — Close browser activity

**Use cases:**
- Check websites that need mobile view
- Fill out forms that require phone
- Debug mobile-specific issues
- Access phone-only services
- Screenshots of mobile layouts

**Implementation:**
```kotlin
class RemoteBrowserActivity : AppCompatActivity() {
    lateinit var webView: WebView
    
    override fun onCreate(savedInstanceState: Bundle?) {
        webView = WebView(this).apply {
            settings.javaScriptEnabled = true
            settings.domStorageEnabled = true
            webViewClient = WebViewClient()
        }
        setContentView(webView)
        
        // Load URL from intent
        intent.getStringExtra("url")?.let { webView.loadUrl(it) }
    }
    
    fun executeJs(script: String, callback: (String) -> Unit) {
        webView.evaluateJavascript(script, callback)
    }
    
    fun captureScreenshot(): Bitmap {
        val bitmap = Bitmap.createBitmap(webView.width, webView.height, Bitmap.Config.ARGB_8888)
        webView.draw(Canvas(bitmap))
        return bitmap
    }
}
```

**Permissions needed:**
- `android.permission.INTERNET` (already have)
- No special permissions for WebView

## Technical Requirements

### Android InCallService
```kotlin
class MoltMobileCallService : InCallService() {
    override fun onCallAdded(call: Call) {
        // Can now control the call
        call.answer(VideoProfile.STATE_AUDIO_ONLY)
        call.reject(false, null)
        call.disconnect()
    }
}
```

Manifest:
```xml
<service android:name=".calls.MoltMobileCallService"
    android:permission="android.permission.BIND_INCALL_SERVICE">
    <meta-data android:name="android.telecom.IN_CALL_SERVICE_UI" android:value="false"/>
    <intent-filter>
        <action android:name="android.telecom.InCallService"/>
    </intent-filter>
</service>
```

### Florida Legal Reference
- Florida Telemarketing Act (Chapter 501, Part IV)
- Do Not Call list violations: up to $10,000 per call
- FDACS complaint: https://www.fdacs.gov/Consumer-Resources/Consumer-Rights-and-Responsibilities/Telemarketing

## Files to Create/Modify
- `calls/MoltMobileCallService.kt` - InCallService implementation
- `calls/CallHandler.kt` - Logic for spam vs known caller handling
- `calls/TtsEngine.kt` - Text-to-speech wrapper
- `calls/SttEngine.kt` - Speech-to-text wrapper
- `gateway/DirectGateway.kt` - Wire up call control
- `AndroidManifest.xml` - Add InCallService

## Gateway Endpoints Needed
- POST /call/speak - TTS to caller
- POST /call/listen - Get transcription
- POST /call/transcript - Full call transcript
- POST /sms/reply - Send SMS reply

## Testing
1. Test with wife's phone (known contact)
2. Test with Google Voice number (unknown)
3. Wait for actual spam call 😈
