Search & ResearchDocumentedScanned
grok-search
Search web or X/Twitter using.
Share:
Installation
npx clawhub@latest install grok-searchView the full skill documentation and source below.
Documentation
Run xAI Grok locally via bundled scripts (search + chat + model listing). Default output for search is pretty JSON (agent-friendly) with citations.
API key
The script looks for an xAI API key in this order:
XAI_API_KEYenv var~/.clawdbot/clawdbot.json→env.XAI_API_KEY~/.clawdbot/clawdbot.json→skills.entries["grok-search"].apiKey- fallback:
skills.entries["search-x"].apiKeyorskills.entries.xai.apiKey
Run
Use {baseDir} so the command works regardless of workspace layout.
Search
- Web search (JSON):
node {baseDir}/scripts/grok_search.mjs "" --web
- X/Twitter search (JSON):
node {baseDir}/scripts/grok_search.mjs "" --x
Chat
- Chat (text):
node {baseDir}/scripts/chat.mjs ""
- Chat (vision):
node {baseDir}/scripts/chat.mjs --image /path/to/image.jpg ""
Models
- List models:
node {baseDir}/scripts/models.mjs
Useful flags
Output:
--links-onlyprint just citation URLs--texthide the citations section in pretty output--rawinclude the raw Responses API payload on stderr (debug)
Common:
--maxlimit results (default 8)--model(defaultgrok-4-1-fast)
X-only filters (server-side via x_search tool params):
--days(e.g. 7)--from YYYY-MM-DD/--to YYYY-MM-DD--handles @a,@b(limit to these handles)--exclude @bots,@spam(exclude handles)
Output shape (JSON)
{
"query": "...",
"mode": "web" | "x",
"results": [
{
"title": "...",
"url": "...",
"snippet": "...",
"author": "...",
"posted_at": "..."
}
],
"citations": [""]
}
Notes
citationsare merged/validated from xAI response annotations where possible (more reliable than trusting the model’s JSON blindly).- Prefer
--xfor tweets/threads,--webfor general research.