WeChat MBTI Chat Analysis
Prerequisites
If wechat-cli is not confirmed installed and initialized, first use $wechat-cli-install.
Treat MBTI as an interpretive lens, not a diagnosis. State confidence and evidence limits clearly. Analyze only the user's own local chat records and avoid exposing unnecessary private details.
Workflow
- Resolve the target contact:
wechat-cli contacts --query "好友名"
wechat-cli sessions --limit 20
If there are multiple likely contacts, ask the user which one to analyze.
- Gather enough data. For large Windows analyses, prefer the fast raw SQLite extractor. It reuses wechat-cli's config and decrypted databases, reads text messages directly from SQLite, and avoids slow per-message XML/media formatting:
python %USERPROFILE%\.codex\skills\wechat-mbti-chat-analysis\scripts\fast_extract_chat.py --chat "好友名" --limit 50000 --output work/wechat-mbti-report/messages.jsonl
python %USERPROFILE%\.codex\skills\wechat-mbti-chat-analysis\scripts\analyze_chat.py work/wechat-mbti-report/messages.jsonl --contact-name "好友名" --sample-ratio 0.05 --output-dir work/wechat-mbti-report
Use fast_extract_chat.py --decompress only if raw text is unreadable; it is much slower. In observed Windows testing, raw SQLite extraction collected about 20k text messages in a few seconds, while wechat-cli history/export could stall above a few hundred messages because it performs full per-message formatting.
Default report behavior:
- Count and visualize both sides of the private chat.
- Run MBTI, keywords, evidence, and representative sampling on the specified friend only. When
--contact-name "好友名" is provided, that contact is the default MBTI analysis subject.
- Use Chinese chart labels in
stats.svg.
- Generate rich statistics, not only message counts: sender balance, per-sender average/median length, short-message ratio, long-message ratio, question/exclamation/laugh/emoji/numeric-expression ratios, active hour and weekday distribution, month trend, 30-minute conversation sessions, session initiators, cross-sender reply latency, and topic buckets for the MBTI subject.
- Filter obvious dirty data before statistics and MBTI analysis: copied notices, long pasted text, URLs, code blocks, bank/notification templates, machine noise, and non-chat formal material.
- Keep口语化 expression: short questions, reactions, daily logistics, emojis, casual technical questions, jokes, uncertainty, and back-and-forth chat fragments.
- Sample at least 5% of the cleaned messages from the MBTI analysis subject. Increase
--sample-ratio for smaller conversations.
- Build
llm_context.md as a large evidence pack, not a tiny excerpt. Include the 5% representative sample plus stratified evidence groups: chronological coverage, longest messages, short reactions, questions, laugh/emoji/teasing samples, numeric/time/planning samples, and keyword-specific samples. Default --evidence-per-group 40 is appropriate for large chats; increase it when context budget allows.
- Use
--analysis-sender "好友名" if the contact display label differs from --contact-name. Use --sender only as a backward-compatible alias.
Fallback to direct paginated fetching when the fast extractor cannot import the local wechat-cli modules:
wechat-cli stats "好友名"
wechat-cli history "好友名" --limit 500
wechat-cli history "好友名" --limit 500 --offset 500
python %USERPROFILE%\.codex\skills\wechat-mbti-chat-analysis\scripts\analyze_chat.py --chat "好友名" --contact-name "好友名" --sender "好友名" --page-size 500 --max-pages 100 --max-messages 50000 --output-dir work/wechat-mbti-report
Use time windows when the user specifies a period:
wechat-cli history "好友名" --start-time "2026-01-01" --end-time "2026-06-01" --limit 1000
python %USERPROFILE%\.codex\skills\wechat-mbti-chat-analysis\scripts\analyze_chat.py --chat "好友名" --contact-name "好友名" --sender "好友名" --start-time "2026-01-01" --end-time "2026-06-01" --output-dir work/wechat-mbti-report
For a deeper run, export to a local working file:
wechat-cli export "好友名" --format markdown --limit 3000 --output work/chat-export.md
- Generate charts and a draft MBTI report from the export:
python %USERPROFILE%\.codex\skills\wechat-mbti-chat-analysis\scripts\analyze_chat.py work/chat-export.md --contact-name "好友名" --sender "好友名" --output-dir work/wechat-mbti-report
The script writes report.md, stats.svg, sample.md, llm_context.md, analysis.json, and messages.json when fetching directly from wechat-cli. Use llm_context.md as the evidence pack for a second-pass LLM analysis, then polish report.md into the final answer.
- Sample the target friend's messages when you only need excerpts. Prefer text messages from the friend rather than the user's own outgoing messages. Use
--sender when sender labels are available, or --exclude-sender "我" when the user's own label is clear. If the CLI output does not mark sender reliably, state the limitation.
Use the sampler when you have exported JSON/text/markdown:
python %USERPROFILE%\.codex\skills\wechat-mbti-chat-analysis\scripts\sample_chat.py work/chat-export.md --max-samples 80 --output work/chat-sample.md
python %USERPROFILE%\.codex\skills\wechat-mbti-chat-analysis\scripts\sample_chat.py work/chat-export.md --sender "好友名" --max-samples 80 --output work/chat-sample.md
Analyze with the rubric in references/mbti-chat-rubric.md.
Write a Chinese report unless the user requests another language.
Generated Statistics
The analysis script should produce a visual stats.svg containing:
- Total raw messages, cleaned口语化 messages, sampled MBTI-subject messages, active days, and date range.
- Sender message counts for both sides when sender labels are present.
- 30-minute conversation count, median message length, MBTI-subject question ratio, and laugh/teasing ratio.
- Hour-of-day activity distribution with Chinese labels.
- Weekday activity distribution with Chinese labels.
- Message length distribution with Chinese labels.
- Session initiator counts, cross-sender reply median minutes, topic buckets for the MBTI subject, and recent monthly message trend.
- High-frequency keyword table in
report.md.
llm_context.md with rich interaction statistics, keyword signals, MBTI heuristic scores, representative samples, and stratified evidence groups for LLM refinement.
If sender labels are missing or noisy, keep the chart but mention that attribution confidence is limited.
Report Shape
Use this structure:
- 分析范围: contact name, date range if known, sampled message count, data limitations.
- 结论先行: likely MBTI type or top 2 candidates, confidence level, one-sentence rationale.
- 互动统计指标: include richer metrics from
analysis.json so the reader can judge the behavioral basis without opening raw data.
- 四个维度: E/I, S/N, T/F, J/P. For each dimension, cite behavioral signals from chat style and include counter-evidence.
- 沟通画像: response rhythm, emotional expression, decision style, humor/teasing, conflict handling, support needs.
- 典型样本: short paraphrased examples or very short quotes only when necessary.
- 相处建议: give practical, warm, relationship-aware suggestions that are specific to this friend, not generic MBTI advice. Anchor each suggestion in at least one observed signal from the current analysis: high-frequency topics/keywords, representative sample phrasing, message length, active time windows, sender balance, or dimension evidence. Include concrete wording patterns the user could actually send, how to ask for help, how to disagree without hurting the relationship, how to handle delays/short replies, and how to close the loop. Avoid generic advice like "communicate more"; if a suggestion could be copied unchanged to another friend, rewrite it with this friend's actual evidence.
- Caveat: MBTI inference from chat is tentative and context-dependent.
Evidence Rules
- Prefer patterns across many messages over isolated memorable lines.
- Separate the friend's traits from the relationship dynamic between user and friend.
- Make advice evidence-bound. Good advice names the observed pattern first, then gives the action: "Because TA often talks about X / replies in short bursts / is active around Y, try Z." Avoid advice that only follows from the four MBTI letters.
- When doing second-pass LLM analysis, read
llm_context.md carefully and use multiple evidence groups. Do not rely only on the first representative samples or top keywords.
- Do not over-interpret silence, delayed replies, emojis, or message length without cross-checking context.
- Avoid clinical labels and sensitive inferences unrelated to the user's request.
- Keep direct quotations short and only include them when they materially support a point.
1---2name: wechat-mbti-chat-analysis3description: Analyze a user-specified WeChat friend's local chat history by querying or exporting with wechat-cli, generating chat statistics charts, sampling representative messages, and writing an MBTI-informed personality and communication-style report. Use when the user asks to analyze a WeChat friend, 微信好友, 聊天记录, 聊天统计图, 聊天风格, 性格, MBTI, 人格倾向, relationship/communication patterns, or summarize a specific contact's messages from local WeChat data.4---56# WeChat MBTI Chat Analysis78## Prerequisites910If `wechat-cli` is not confirmed installed and initialized, first use `$wechat-cli-install`.1112Treat MBTI as an interpretive lens, not a diagnosis. State confidence and evidence limits clearly. Analyze only the user's own local chat records and avoid exposing unnecessary private details.1314## Workflow15161. Resolve the target contact:1718```powershell19wechat-cli contacts --query "好友名"20wechat-cli sessions --limit 2021```2223If there are multiple likely contacts, ask the user which one to analyze.24252. Gather enough data. For large Windows analyses, prefer the fast raw SQLite extractor. It reuses wechat-cli's config and decrypted databases, reads text messages directly from SQLite, and avoids slow per-message XML/media formatting:2627```powershell28python %USERPROFILE%\.codex\skills\wechat-mbti-chat-analysis\scripts\fast_extract_chat.py --chat "好友名" --limit 50000 --output work/wechat-mbti-report/messages.jsonl29python %USERPROFILE%\.codex\skills\wechat-mbti-chat-analysis\scripts\analyze_chat.py work/wechat-mbti-report/messages.jsonl --contact-name "好友名" --sample-ratio 0.05 --output-dir work/wechat-mbti-report30```3132Use `fast_extract_chat.py --decompress` only if raw text is unreadable; it is much slower. In observed Windows testing, raw SQLite extraction collected about 20k text messages in a few seconds, while `wechat-cli history/export` could stall above a few hundred messages because it performs full per-message formatting.3334Default report behavior:3536- Count and visualize both sides of the private chat.37- Run MBTI, keywords, evidence, and representative sampling on the specified friend only. When `--contact-name "好友名"` is provided, that contact is the default MBTI analysis subject.38- Use Chinese chart labels in `stats.svg`.39- Generate rich statistics, not only message counts: sender balance, per-sender average/median length, short-message ratio, long-message ratio, question/exclamation/laugh/emoji/numeric-expression ratios, active hour and weekday distribution, month trend, 30-minute conversation sessions, session initiators, cross-sender reply latency, and topic buckets for the MBTI subject.40- Filter obvious dirty data before statistics and MBTI analysis: copied notices, long pasted text, URLs, code blocks, bank/notification templates, machine noise, and non-chat formal material.41- Keep口语化 expression: short questions, reactions, daily logistics, emojis, casual technical questions, jokes, uncertainty, and back-and-forth chat fragments.42- Sample at least 5% of the cleaned messages from the MBTI analysis subject. Increase `--sample-ratio` for smaller conversations.43- Build `llm_context.md` as a large evidence pack, not a tiny excerpt. Include the 5% representative sample plus stratified evidence groups: chronological coverage, longest messages, short reactions, questions, laugh/emoji/teasing samples, numeric/time/planning samples, and keyword-specific samples. Default `--evidence-per-group 40` is appropriate for large chats; increase it when context budget allows.44- Use `--analysis-sender "好友名"` if the contact display label differs from `--contact-name`. Use `--sender` only as a backward-compatible alias.4546Fallback to direct paginated fetching when the fast extractor cannot import the local wechat-cli modules:4748```powershell49wechat-cli stats "好友名"50wechat-cli history "好友名" --limit 50051wechat-cli history "好友名" --limit 500 --offset 50052python %USERPROFILE%\.codex\skills\wechat-mbti-chat-analysis\scripts\analyze_chat.py --chat "好友名" --contact-name "好友名" --sender "好友名" --page-size 500 --max-pages 100 --max-messages 50000 --output-dir work/wechat-mbti-report53```5455Use time windows when the user specifies a period:5657```powershell58wechat-cli history "好友名" --start-time "2026-01-01" --end-time "2026-06-01" --limit 100059python %USERPROFILE%\.codex\skills\wechat-mbti-chat-analysis\scripts\analyze_chat.py --chat "好友名" --contact-name "好友名" --sender "好友名" --start-time "2026-01-01" --end-time "2026-06-01" --output-dir work/wechat-mbti-report60```6162For a deeper run, export to a local working file:6364```powershell65wechat-cli export "好友名" --format markdown --limit 3000 --output work/chat-export.md66```67683. Generate charts and a draft MBTI report from the export:6970```powershell71python %USERPROFILE%\.codex\skills\wechat-mbti-chat-analysis\scripts\analyze_chat.py work/chat-export.md --contact-name "好友名" --sender "好友名" --output-dir work/wechat-mbti-report72```7374The script writes `report.md`, `stats.svg`, `sample.md`, `llm_context.md`, `analysis.json`, and `messages.json` when fetching directly from `wechat-cli`. Use `llm_context.md` as the evidence pack for a second-pass LLM analysis, then polish `report.md` into the final answer.75764. Sample the target friend's messages when you only need excerpts. Prefer text messages from the friend rather than the user's own outgoing messages. Use `--sender` when sender labels are available, or `--exclude-sender "我"` when the user's own label is clear. If the CLI output does not mark sender reliably, state the limitation.7778Use the sampler when you have exported JSON/text/markdown:7980```powershell81python %USERPROFILE%\.codex\skills\wechat-mbti-chat-analysis\scripts\sample_chat.py work/chat-export.md --max-samples 80 --output work/chat-sample.md82python %USERPROFILE%\.codex\skills\wechat-mbti-chat-analysis\scripts\sample_chat.py work/chat-export.md --sender "好友名" --max-samples 80 --output work/chat-sample.md83```84855. Analyze with the rubric in `references/mbti-chat-rubric.md`.86876. Write a Chinese report unless the user requests another language.8889## Generated Statistics9091The analysis script should produce a visual `stats.svg` containing:9293- Total raw messages, cleaned口语化 messages, sampled MBTI-subject messages, active days, and date range.94- Sender message counts for both sides when sender labels are present.95- 30-minute conversation count, median message length, MBTI-subject question ratio, and laugh/teasing ratio.96- Hour-of-day activity distribution with Chinese labels.97- Weekday activity distribution with Chinese labels.98- Message length distribution with Chinese labels.99- Session initiator counts, cross-sender reply median minutes, topic buckets for the MBTI subject, and recent monthly message trend.100- High-frequency keyword table in `report.md`.101- `llm_context.md` with rich interaction statistics, keyword signals, MBTI heuristic scores, representative samples, and stratified evidence groups for LLM refinement.102103If sender labels are missing or noisy, keep the chart but mention that attribution confidence is limited.104105## Report Shape106107Use this structure:108109- 分析范围: contact name, date range if known, sampled message count, data limitations.110- 结论先行: likely MBTI type or top 2 candidates, confidence level, one-sentence rationale.111- 互动统计指标: include richer metrics from `analysis.json` so the reader can judge the behavioral basis without opening raw data.112- 四个维度: E/I, S/N, T/F, J/P. For each dimension, cite behavioral signals from chat style and include counter-evidence.113- 沟通画像: response rhythm, emotional expression, decision style, humor/teasing, conflict handling, support needs.114- 典型样本: short paraphrased examples or very short quotes only when necessary.115- 相处建议: give practical, warm, relationship-aware suggestions that are specific to this friend, not generic MBTI advice. Anchor each suggestion in at least one observed signal from the current analysis: high-frequency topics/keywords, representative sample phrasing, message length, active time windows, sender balance, or dimension evidence. Include concrete wording patterns the user could actually send, how to ask for help, how to disagree without hurting the relationship, how to handle delays/short replies, and how to close the loop. Avoid generic advice like "communicate more"; if a suggestion could be copied unchanged to another friend, rewrite it with this friend's actual evidence.116- Caveat: MBTI inference from chat is tentative and context-dependent.117118## Evidence Rules119120- Prefer patterns across many messages over isolated memorable lines.121- Separate the friend's traits from the relationship dynamic between user and friend.122- Make advice evidence-bound. Good advice names the observed pattern first, then gives the action: "Because TA often talks about X / replies in short bursts / is active around Y, try Z." Avoid advice that only follows from the four MBTI letters.123- When doing second-pass LLM analysis, read `llm_context.md` carefully and use multiple evidence groups. Do not rely only on the first representative samples or top keywords.124- Do not over-interpret silence, delayed replies, emojis, or message length without cross-checking context.125- Avoid clinical labels and sensitive inferences unrelated to the user's request.126- Keep direct quotations short and only include them when they materially support a point.127