couple-repo/Projects/WIP/AlwaysOnRecorder.md
StillHammer f57c197773 Add week action plan, AlwaysOnRecorder project, and strategic pivot documentation
- Plan action 16-22 décembre avec priorités critiques (visa, Wise, freelance)
- Projet AlwaysOnRecorder (recording app pour protection juridique + long-term tool)
- Pivot stratégique : Rester Shanghai + divorce + relation Maëlle
- Nouveau profil Maëlle (professeure chinois, timeline révélation)
- Mise à jour profils Alexis et Tingting (situation décembre 2025)
- Plan final consolidé avec phases détaillées et protection actifs

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-14 13:13:02 +08:00

429 lines
12 KiB
Markdown

# AlwaysOnRecorder - App de Recording Continu
**Status**: WIP
**Type**: Mobile App (Android)
**Stack**: React Native, SQLite, AES-256, Whisper (optional)
**Priority**: HIGH (Protection juridique + Life tool)
**Target MVP**: 10-15h dev
**Start Date**: 16 décembre 2025
---
## Vue d'ensemble
**AlwaysOnRecorder** est une application mobile de recording audio continu conçue pour :
- **Protection juridique** : Enregistrement conversations avec Tingting (gaslighting, mensonges, refus accord)
- **Mémoire conversationnelle** : Archive searchable de toutes conversations importantes
- **Discrétion** : Background service, pas besoin d'activation manuelle
- **Sécurité** : Encryption AES-256, stockage local, pas de cloud auto-upload
**Use cases** :
1. **Court terme** (3 semaines) : Protection divorce Tingting
2. **Long terme** (vie) : Mémoire conversations, journal audio, recherche historique
**Contexte légal** : One-party consent recording légal en Chine
---
## Architecture MVP (10-15h)
### Core Features
**1. Background Recording Service**
```javascript
// Détecte voix automatiquement (VAD - Voice Activity Detection)
// Si silence > 30s → Pause recording
// Si voix détectée → Resume recording
// Économie batterie + storage
```
**2. Local Encrypted Storage**
```javascript
// SQLite database
// Schema:
// - id (INT)
// - start_time (DATETIME)
// - end_time (DATETIME)
// - duration (INT seconds)
// - file_path (TEXT) → encrypted audio file
// - tags (TEXT) → "tingting", "maelle", "work", etc.
// - transcription (TEXT, nullable)
// - is_protected (BOOL) → ne peut pas être supprimé
```
**3. Simple UI**
```
┌─────────────────────────────┐
│ AlwaysOn Recorder │
│ ○ Recording (12:34:56) │ ← Status + uptime
├─────────────────────────────┤
│ Today: │
│ ├─ 09:23 - 09:45 (22min) │ ← Liste recordings
│ ├─ 14:12 - 14:58 (46min) │
│ └─ 18:30 - ongoing │
├─────────────────────────────┤
│ [⏸️ Pause] [🔍 Search] │
│ [⚙️ Settings] │
└─────────────────────────────┘
```
**4. Tagging System**
```javascript
// Auto-tagging (optionnel) :
// - Détection contact phone (si call)
// - Détection location (home/work/campus)
//
// Manual tagging :
// - Longpress recording → "Tag as Tingting"
// - Swipe → "Important" flag
```
---
## Stack Technique
### Framework
- **React Native** (cross-platform, fast dev)
- **Expo** (managed workflow, fast iteration) OU Bare React Native (plus de contrôle)
### Audio Recording
```javascript
// Option 1: react-native-audio-recorder-player
import AudioRecorderPlayer from 'react-native-audio-recorder-player';
// Option 2: expo-av (si Expo managed)
import { Audio } from 'expo-av';
```
### Background Service
```javascript
// react-native-background-actions
import BackgroundService from 'react-native-background-actions';
// Foreground service (Android) → Notification persistante
// Seul moyen de garantir pas killed par OS
```
### Storage
```javascript
// SQLite local
import SQLite from 'react-native-sqlite-storage';
// Encryption files
import RNFS from 'react-native-fs';
import CryptoJS from 'crypto-js';
```
### VAD (Voice Activity Detection)
```javascript
// Option 1: Analyse amplitude audio (simple)
if (amplitude > threshold) {
recording = true;
} else if (silence_duration > 30s) {
recording = false;
}
// Option 2: Librairie ML (plus précis mais heavier)
// @tensorflow/tfjs + VAD model
```
---
## Fonctionnalités
### MVP (Phase 1 - 10-15h)
**Essentiels** :
- ✅ Background recording avec foreground service
- ✅ VAD simple (amplitude-based)
- ✅ SQLite storage avec metadata
- ✅ AES-256 encryption files audio
- ✅ Simple UI (ON/OFF toggle, liste recordings)
- ✅ Manual tags (Tingting, Maëlle, Work, etc.)
- ✅ Export manuel (share audio file)
- ✅ Protected flag (recordings importants ne peuvent pas être supprimés accidentellement)
**Architecture** :
```
AlwaysOnRecorder/
├── src/
│ ├── components/
│ │ ├── RecordingStatus.tsx
│ │ ├── RecordingList.tsx
│ │ └── TagSelector.tsx
│ ├── services/
│ │ ├── BackgroundRecorder.ts
│ │ ├── VADDetector.ts
│ │ ├── EncryptionManager.ts
│ │ └── DatabaseManager.ts
│ ├── screens/
│ │ ├── HomeScreen.tsx
│ │ ├── SettingsScreen.tsx
│ │ └── SearchScreen.tsx
│ └── utils/
│ ├── permissions.ts
│ └── constants.ts
└── App.tsx
```
### Phase 2 (Après move out - Long terme)
**Advanced Features** :
- ⏳ Transcription automatique (Whisper)
- ⏳ Recherche sémantique dans transcriptions
- ⏳ Auto-tagging via ML (speaker recognition)
- ⏳ Cloud backup (chiffré, S3/IPFS/Backblaze)
- ⏳ Export formats (MP3, WAV, M4A)
- ⏳ Compression intelligente (quality vs storage)
- ⏳ Multi-langue transcription (EN/FR/CN)
- ⏳ Timeline visualization
- ⏳ Statistiques (temps parole, patterns, etc.)
---
## Développement
### Étapes MVP
**1. Setup Projet (1-2h)**
```bash
# React Native bare
npx react-native init AlwaysOnRecorder
# OU Expo managed
npx create-expo-app AlwaysOnRecorder
```
**2. Background Service + Recording (3-4h)**
- Permissions (microphone, storage, background)
- Foreground service setup
- AudioRecorder integration
- Start/Stop logic
**3. VAD Simple (2-3h)**
- Amplitude monitoring
- Silence detection (30s threshold)
- Auto pause/resume
**4. Storage + Encryption (2-3h)**
- SQLite schema
- Save recording metadata
- AES-256 file encryption
- File management (delete, protected flag)
**5. UI Basique (2-3h)**
- Home screen (status + recording list)
- Settings (thresholds, storage limit)
- Tag selector
- Search simple (by date, by tag)
**Total MVP** : 10-15h
---
## Problèmes Techniques Anticipés
### 1. Battery Drain
**Problème** : Recording continu = CPU + microphone actif = batterie drainée
**Solutions** :
- VAD pause recording pendant silence (économie 70%+)
- Sample rate réduit (16kHz au lieu de 44.1kHz, qualité suffisante pour voix)
- Compression adaptive (moins de writes disque)
- Foreground service avec notification = user aware
**Estimation** : 5-10% batterie/heure avec VAD optimisé
### 2. Storage Management
**Problème** : 1h audio ≈ 30-60MB (16kHz, mono)
**Solutions** :
- Compression audio (Opus codec, 20-30KB/minute pour voix)
- Auto-delete recordings > 30 jours (sauf protected)
- Storage limit user-configurable (ex: max 5GB)
- Warning quand approche limite
**Estimation** : 30 jours recordings ≈ 2-4GB avec compression
### 3. Android Background Service Restrictions
**Problème** : Android 8+ kill background services agressivement
**Solutions** :
- **Foreground service** avec notification persistante (seul moyen fiable)
- Battery optimization exemption (demander user)
- Notification permanente (légalement requis pour foreground service)
**Trade-off** : Notification visible en permanence (prix à payer pour garantir recording)
### 4. Découverte par Tingting
**Problème** : Si elle voit notification/app sur phone
**Mitigations** :
- App icon + nom générique ("System Logger", "Audio Notes")
- Notification discrète (juste icône microphone, pas de texte explicite)
- Lock app (PIN/biometric avant ouverture)
- Cacher icon dans launcher (option Android)
### 5. Legal Compliance
**One-party consent** (Chine) :
- ✅ Légal d'enregistrer conversations auxquelles tu participes
- ✅ Utilisable en procédure divorce (preuve mensonges/gaslighting)
- ⚠️ NE PAS enregistrer conversations privées autres (écoute clandestine)
---
## Configuration Recommandée
### Settings Optimaux MVP
```javascript
const DEFAULT_CONFIG = {
// Audio
sampleRate: 16000, // 16kHz (voix quality)
channels: 1, // Mono
encoding: 'opus', // Compression efficace
// VAD
silenceThreshold: -40, // dB (ajustable)
silenceDuration: 30, // seconds before pause
// Storage
maxStorageGB: 5, // Auto-delete old si dépassé
autoDeleteDays: 30, // Recordings non-protected
// Security
encryption: true, // AES-256
requireAuth: true, // PIN/biometric
// UI
notificationText: "Audio Logger Active"
};
```
---
## Priorité dans Timeline Globale
### Cette Semaine (16-22 Décembre)
**CRITIQUE (faire avant app)** :
1. ✅ Visa check (URGENT - today/tomorrow)
2. ✅ Wise setup (protection actifs)
**Parallèle** :
3. AlwaysOnRecorder MVP (10-15h) + 40 applications freelance
**Ordre recommandé** :
- Lundi 16 : Visa check + Wise setup
- Mardi 17-Mercredi 18 : AlwaysOnRecorder dev (sprint 10-12h)
- Jeudi 19-Samedi 21 : 40 applications freelance + finalisation app
- Dimanche 22 : Review + test app en conditions réelles
---
## Utilisation Prévue
### Court Terme (Décembre-Janvier)
**Objectif** : Protection juridique divorce
**Situations à enregistrer** :
- Conversations avec Tingting (refus divorce, menaces, gaslighting)
- Négociations déménagement/argent
- Toute interaction potentiellement litigieuse
**Extraction** :
- Tag immédiatement après conversation importante
- Marquer "Protected" si besoin comme preuve
- Export vers Wise/cloud backup si critique
### Long Terme (Post-Divorce)
**Objectif** : Mémoire conversationnelle générale
**Use cases** :
- Retrouver détails conversation professionnelle
- Journal audio personnel
- Recherche dans historique (avec transcription Phase 2)
- Archive vie quotidienne
---
## Alternatives Considérées
| Solution | Avantages | Inconvénients | Verdict |
|----------|-----------|---------------|---------|
| **Apps existantes** (Call Recorder, etc.) | 0h dev, disponible maintenant | Pas de VAD smart, cloud forced, privacy concerns | ❌ Rejeté |
| **Manual recording** (phone app) | 0h dev, simple | Oubli fréquent, pas automatique, gaps | ❌ Trop unreliable |
| **Hardware recorder** (dictaphone) | Fiable, pas de battery phone | Device supplémentaire, pas searchable, pas encrypted | ❌ Moins pratique |
| **Custom app** (ce projet) | Control total, features sur mesure, long-term utility | 10-15h dev | ✅ **Choisi** |
---
## Success Metrics
### MVP Ready Si
- ✅ Enregistre automatiquement en background (foreground service)
- ✅ VAD fonctionne (pause silence > 30s)
- ✅ Files encryptés AES-256
- ✅ UI permet voir/taguer/exporter recordings
- ✅ Battery drain < 10%/heure
- Pas de crash pendant 8h recording continu
- Protected recordings ne peuvent pas être supprimés accidentellement
### Phase 2 Ready Si
- Transcription automatique Whisper
- Recherche texte dans transcriptions
- Cloud backup optionnel
- Export formats multiples
---
## Risques
### Technique
| Risque | Probabilité | Impact | Mitigation |
|--------|-------------|--------|------------|
| Android kill background service | 30% | HIGH | Foreground service + battery exemption |
| Battery drain excessif | 40% | MEDIUM | VAD optimisé + user config |
| Storage plein | 20% | LOW | Auto-delete + warnings |
| Découverte par Tingting | 50% | MEDIUM | App camouflage + lock |
### Planning
| Risque | Probabilité | Impact | Mitigation |
|--------|-------------|--------|------------|
| Dépasse 15h dev | 60% | LOW | Scope creep control, MVP strict |
| Détourne du freelance | 40% | HIGH | Time-boxing (max 15h), parallèle 40 apps |
| Procrastination disguisée | 30% | HIGH | Deadline hard : App ready avant 22 décembre |
---
## Liens
**Ressources Externes** :
- React Native Audio : https://github.com/hyochan/react-native-audio-recorder-player
- Background Tasks : https://github.com/jamesmontemagno/react-native-background-actions
- Expo Audio : https://docs.expo.dev/versions/latest/sdk/audio/
- Whisper : https://github.com/openai/whisper
**Projets Associés** :
- `couple_backlog/14_decembre_2025_pivot_strategique.md` (contexte)
- `plan_discussion/plan_final_14_decembre_2025.md` (timeline globale)
---
**Créé** : 16 décembre 2025
**Type** : Protection juridique + Life tool
**MVP Target** : 22 décembre 2025
**Long-term utility** : Conversation memory, searchable archive