Structured JSON schemas for typed data extraction from X search results
The --extract flag returns strictly-typed JSON output instead of natural language. Five built-in schemas cover common intelligence extraction patterns.
Model OverrideUsing --extract automatically selects the grok-4-1-fast-non-reasoning model, regardless of --fast or --deep flags. This is required by the xAI Responses API for structured output with tools.
{ "topic": "Remote work", "dominant_narratives": [ { "narrative": "Return-to-office mandates are about real estate and control, not productivity", "sentiment": "critical", "key_accounts": ["levelsio", "dhh", "paulg"], "evidence": "Multiple threads citing productivity studies, real estate portfolios of major companies, and firsthand accounts of forced RTO." }, { "narrative": "Hybrid work is the realistic compromise that preserves culture while offering flexibility", "sentiment": "neutral", "key_accounts": ["satyanadella", "sundarpichai"], "evidence": "Company leaders from Microsoft and Google discussing hybrid policies as 'best of both worlds'." } ], "emerging_narratives": [ "Four-day work weeks are gaining traction in Europe as a separate but related trend", "Remote work is enabling geographic arbitrage and reshaping housing markets" ], "counter_narratives": [ "In-person collaboration creates serendipity that Zoom calls cannot replicate", "Junior employees need physical proximity to seniors for mentorship and learning" ], "summary": "Remote work discourse is polarized between RTO critics and hybrid advocates, with emerging threads around four-day weeks and geographic arbitrage."}
{ "topic": "xAI product announcements", "events": [ { "date": "2025-12-11", "event": "Grok 3 released to Premium+ subscribers with significantly improved reasoning and a new 'Think' mode for extended chain-of-thought responses.", "source_handle": "xai", "significance": "major product launch", "url": "https://x.com/xai/status/186634291000000001" }, { "date": "2026-01-08", "event": "Aurora image generation model launched inside Grok on X. Available to all Premium subscribers.", "source_handle": "xai", "significance": "new capability launch", "url": "https://x.com/xai/status/187700120000000001" }, { "date": "2026-02-27", "event": "Grok-4 model family announced. Grok-4-0709 positioned as flagship reasoning model; fast variants released for latency-sensitive workloads.", "source_handle": "xai", "significance": "major model release", "url": "https://x.com/xai/status/189731500000000001" } ], "summary": "xAI shipped three major releases in Q1 2026: Grok 3 with Think mode, Aurora image generation, and the Grok-4 model family."}
{ "profiles": [ { "handle": "naval", "posting_style": "Aphoristic, philosophical tweets. Rarely threads. High signal-to-noise. Posts 1-3 times per day.", "main_topics": ["startups", "philosophy", "investing", "crypto", "health"], "key_positions": [ "Wealth creation through equity, not salary", "Specific knowledge is highly valuable and non-teachable", "Bitcoin is a store of value, not just a currency" ], "recent_notable_posts": [ "'Play long-term games with long-term people' - 87K likes, widely shared in startup circles", "Thread on the difference between money and wealth - 42K likes" ], "influence_assessment": "Very high influence in startup and tech circles. Posts frequently cited in books and courses." }, { "handle": "paulg", "posting_style": "Mix of startup advice, essays, and personal anecdotes. Responds frequently to replies. Posts 5-10 times per day.", "main_topics": ["startups", "Y Combinator", "programming", "education", "writing"], "key_positions": [ "Great founders are relentlessly resourceful", "Do things that don't scale in early stages", "Essays are superior to books for idea exploration" ], "recent_notable_posts": [ "'The most important quality in a startup founder is determination' - 56K likes", "Advice on choosing co-founders - 38K likes, high engagement from YC network" ], "influence_assessment": "Extremely high influence in the startup ecosystem. YC founder. His essays shape entrepreneurial thinking." } ], "summary": "Both are top-tier startup influencers. Naval's style is more philosophical and sparse; Paul's is more tactical and frequent. Both have cult followings."}
{ "topic": "Chip export controls", "claims": [ { "claim": "The Commerce Department extended the comment period for BIS export rules by 60 days", "attributed_to": "SemiAnalysis", "claim_type": "factual", "verifiable": true, "context": "Analyzing a procedural notice from the Commerce Department as signal of policy reconsideration", "url": "https://x.com/SemiAnalysis/status/189600234000000001" }, { "claim": "This extension means the administration is backing down from the November 2025 draft", "attributed_to": "SemiAnalysis", "claim_type": "prediction", "verifiable": false, "context": "Interpreting the procedural extension as a political signal rather than administrative routine", "url": "https://x.com/SemiAnalysis/status/189600234000000001" }, { "claim": "A source at a major US fab described current rules as 'administratively unworkable'", "attributed_to": "karaswisher", "claim_type": "allegation", "verifiable": false, "context": "Anonymous sourcing from industry contact, reported without corroboration", "url": "https://x.com/karaswisher/status/189588901000000001" } ], "summary": "Claims mix verifiable facts (BIS extension confirmed by Reuters) with predictions and anonymous sourcing. The procedural extension is factual; its interpretation is speculative."}
Strict Schema EnforcementAll schemas use strict: true mode with additionalProperties: false. Grok is forced to return JSON that exactly matches the schema — no extra fields, no missing required fields.If Grok cannot extract enough information to populate required fields, it will return minimal valid JSON rather than failing.