Methods & Design Decisions
Methodology, assumptions, limitations, and architectural decisions behind the WeChat Style Distiller.
Data Provenance
Original Tool: Analyzes real WeChat chat history extracted via the chatlog tool (MIT licensed). Requires WeChat desktop app on macOS/Windows and user consent to access their own SQLite chat database.
Demo Site: Uses 6 synthetic personas generated by scripts/generate_synthetic_personas.py. Each persona has 150+ synthetic messages with controlled linguistic features. No real user data is used, committed, or deployed.
Sample Sizes: Original tool works with any chat history size (tested 100–10,000 messages). Synthetic personas each have n=80–150 turns (a "turn" is one continuous sending block, which may contain multiple bubbles).
Method
Pipeline: Extract → Clean → Analyze → Distill
- Extract: Read messages from WeChat SQLite database (or synthetic message list). Fields: sender, timestamp, content, contact ID, is_group.
- Clean: Group consecutive messages from the same sender into turns. Filter out system messages, media-only bubbles (images, stickers without text).
- Analyze: For each turn, compute 12+ linguistic features:
- Message shape: Length distribution (mean, median, p25–p90), bubbles per turn, punctuation habits
- Expressiveness: Emoji frequency (Unicode + WeChat faces), laughter tokens (哈哈, lol, 233, hhh)
- Language: Code-switching ratio (CJK chars vs Latin words), catchphrases (top n-grams), openers/closers
- Temporal: Active hours (UTC), per-contact tone (avg length by recipient)
- Distill: Map features to LLM instructions. E.g., "median 18 chars, p90 36 chars" → "Keep replies short: median ~18 characters, rarely over 36". Generate
persona_prompt.txt(system prompt) andprofile.md(human-readable summary).
Evaluation (Career-Aligned Upgrade)
- Inter-persona variance: Compute mean, variance, and 95% bootstrap CIs for each feature across personas. Verifies that personas differ meaningfully.
- Pairwise similarity: Cosine similarity in 6D feature space. Lower values = more distinct persona pairs.
- Distinctiveness: For each persona, compute 1 - average similarity to all others. Higher = more unique profile.
- Feature correlation: Pearson correlation matrix. Identifies which features co-vary (e.g., emoji rate vs code-switching).
All confidence intervals computed with bootstrap percentile method (1000 iterations, fixed seeds 42–47 for reproducibility). Wilson score intervals used for proportions.
Assumptions & Limitations
Assumptions
- Your texting style is relatively stable (not drastically different across contacts or time periods). The tool computes per-contact stats but generates one global persona.
- WeChat message format is consistent (SQLite schema hasn't changed). Tool tested with WeChat desktop 3.x on macOS.
- LLMs can follow quantitative style instructions. Effectiveness varies by model (tested with Claude 3.5 Haiku/Sonnet).
Limitations
- Surface features only: Captures how you text (length, emoji, language), not what you say (topics, opinions, personality). By design for privacy.
- No semantic content: The persona prompt won't know your knowledge, interests, or conversation topics. It only replicates linguistic style.
- Aggregate statistics: Features are turn-level averages. Fine-grained patterns (e.g., "uses more emoji when excited") are not captured.
- Platform-specific: Designed for WeChat. Other platforms (WhatsApp, Telegram, SMS) have different message formats and would require adapters.
- Small sample size: Synthetic personas have n=80–150 turns. Real validation would require larger samples and human evaluation.
AI Use Statement
What AI Does: Optional BYOK (Bring Your Own Key) features allow visitors to test persona prompts and tune them interactively. AI is used for:
- Persona testing: Generate sample responses using a persona prompt to verify linguistic consistency.
- Prompt tuning: Adjust persona parameters (e.g., "make more formal") and compare before/after outputs.
- Persona matching: Match a visitor's self-reported texting habits to the closest synthetic persona.
What AI Never Does:
- Access your real chat data (the demo uses synthetic personas only)
- Store or transmit your API key to our servers (keys stay in your browser)
- Make claims about your personality, mental state, or identity
- Generate content for deployment without human review
Data Sent to Providers: When you use BYOK features, your browser sends:
- To Anthropic/OpenAI: Your prompt + persona prompt + test input (e.g., "How was your day?"). Your API key authenticates the request. Data is subject to the provider's privacy policy.
- NOT sent: Your API key is never sent to our server. All calls go directly from your browser to the AI provider (CORS enabled via
anthropic-dangerous-direct-browser-access: trueheader for Anthropic, standard OpenAI API for OpenAI).
Human-in-the-Loop: All AI outputs are labeled "AI-generated". Every interaction is logged in an audit trail (stored locally in IndexedDB) with your decision: accepted / edited / rejected.
Audit Trail: View all AI interactions at /ai-log. Export as JSON or CSV. Clear anytime.
Decision Records
Key architectural and methodological decisions, documented with context, options considered, rationale, and outcomes.
Local-First Architecture
All chat data analysis runs locally on the user's machine. No cloud backend, no data upload.
Synthetic Demo Data
The public demo site uses only synthetic personas. No real chat data is committed or deployed.
Feature Selection
Extract 12+ quantitative linguistic features (length, emoji, code-switching, etc.) rather than semantic embeddings or stylometric features.
Client-Side BYOK Architecture
AI features use Bring-Your-Own-Key. API keys stay in browser storage, direct calls to providers, full audit trail in IndexedDB.