| name | xf |
| description | Search X (Twitter) archives for insights, conversations, and knowledge. Use when mining tweets, DMs, Grok chats, likes, or extracting information from X data exports. |
xf Knowledge Extraction
Core Insight: Your X archive is a goldmine. Sub-millisecond search makes iterative exploration practical. Mine your history before rebuilding context.
The Goldmine Principle
Your X archive contains:
- Public thoughts — Tweets capture your evolving thinking over years
- Private conversations — DMs hold detailed discussions, decisions, links shared
- AI interactions — Grok chats show what questions you asked and answers received
- Curated content — Likes reveal what resonated with you
The insight: Mining your X history surfaces forgotten context faster than rebuilding it.
THE EXACT PROMPT — Discovery Workflow
1. Bootstrap: Check health, get archive overview
xf doctor && xf stats --format json | jq '{tweets, likes, dms, grok_messages}'
2. Search: Find content by topic (hybrid mode default = best)
xf search "KEYWORD" --format json --limit 50
3. Filter by type: Narrow to specific content
xf search "KEYWORD" --types dm --context --format json # DMs w/ conversation
xf search "KEYWORD" --types grok --format json # AI Q&A
4. Follow hits: Get full context
xf tweet <ID> --thread --format json # Tweet thread
xf search "KEYWORD" --types dm --context --format json # Full DM thread
5. Extract: Export for analysis
xf search "topic" --format json --limit 1000 | jq '[.[] | {text, date: .created_at}]'
Why This Workflow Works
- Hybrid search first — Default mode combines keyword + semantic for best coverage
--format json — Machine-readable output for piping to jq
--context for DMs — Shows full conversation threads around matches
- Iterate fast — Sub-millisecond search enables exploration loops
Quick Reference
xf doctor && xf stats --format json
xf search "query" --format json
xf search "exact phrase" --mode lexical
xf search "feeling stressed" --mode semantic
xf search "query" --types tweet --format json
xf search "query" --types dm --context
xf search "query" --types like --format json
xf search "query" --types grok --format json
xf search "query" --since "2024-01" --until "2024-06" --format json
xf search "query" --since "last week" --format json
xf search "query" --limit 100 --offset 50 --format json
When to Use What
| You Want | Use | Why |
|---|
| Find content by topic | --mode hybrid (default) | Best of keyword + semantic |
| Find exact phrase | --mode lexical + "quotes" | Literal string match |
| Find conceptually related | --mode semantic | "feeling overwhelmed" → burnout tweets |
| DM conversations | --types dm --context | Shows full thread around matches |
| What you engaged with | --types like | Your curation over time |
| AI Q&A history | --types grok | What you asked Grok |
| High engagement content | --sort engagement | Your best tweets |
Critical Rules
| Rule | Why | Consequence |
|---|
--format json | Machine-readable output | Required for jq pipelines |
| Index first | Archive must be indexed | xf index before search |
--context requires --types dm | Only works for DMs | Ignored otherwise |
| All data local | Zero network calls | Privacy-first, offline-capable |
The Heuristics
| Signal | Meaning | Action |
|---|
| Many likes on topic | Topic resonated with you | Search likes for curated content |
| DM mentions project | Detailed private discussion | Use --context to get full thread |
| Grok chat on topic | You asked AI about it | May have refined explanations |
| High engagement tweet | Your audience resonated | Check thread for discussion |
| Semantic finds more | Wording varies | Use semantic for broad exploration |
jq Essentials
| jq '.[].text'
| jq '.[] | {text, date: .created_at}'
| jq '[.[] | select(.favorite_count > 10)]'
| jq -r '.[].created_at[:4]' | sort | uniq -c
| jq '[.[].metadata.conversation_id] | unique'
| jq -r '.[].text' | grep -oE '#\w+' | sort | uniq -c | sort -rn
References
Scripts
| Script | Usage |
|---|
./scripts/quick_analysis.sh | One-command archive overview |
./scripts/topic_miner.py "topic" | Deep dive on a topic |
./scripts/validate.sh | Validate xf is working |
Validation
xf doctor
If issues: run xf index --force to rebuild.