Pipeline Architecture
Four-stage pipeline: Extract → Clean → Analyze → Distill. Each stage is pure Python with no API calls except the optional chatbot.
Stage 1
Extract
Read WeChat chat history using the chatlog tool
WeChat database (encrypted)
Raw message JSON
- Delegates decryption to the chatlog CLI tool (MIT licensed)
- Extracts messages, timestamps, contacts, group flags
- Filters for YOUR messages only (context → your reply pairs)
Stage 2
Clean
Normalize and structure conversation turns
Raw messages
Turn objects (context + reply)
- Groups consecutive messages into "bubble bursts"
- Associates each reply with its conversational context
- Preserves metadata: contact, group/1:1, timestamp
Stage 3
Analyze
Extract quantitative linguistic features
Structured turns
stats.json
- Message length distribution (mean, median, percentiles)
- Emoji & WeChat face frequency, laughter tokens
- Code-switching ratio (Chinese ↔ English)
- Punctuation habits, catchphrases, opener/closer patterns
- Time-of-day activity, per-contact tone differences
- Pure Python, no API calls
Stage 4
Distill
Generate human-readable profile and persona prompt
stats.json
profile.md, persona_prompt.txt
- profile.md: Human-readable style report with examples
- persona_prompt.txt: System prompt encoding your voice
- Maps linguistic features to LLM instructions
- Includes few-shot examples from your actual messages
Example: 500 messages → Style Profile
Input: 500 of your WeChat messages across 20 contacts
Extract: 500 raw message objects with timestamps
Clean: 320 turns (context → reply pairs)
Analyze: 12 linguistic features quantified (median length 18 chars, 40% code-switching, 0.3 emoji/turn...)
Distill: 1 profile.md + 1 persona_prompt.txt ready to use