search

A command-line search tool for finding posts on X (formerly Twitter) through the Grok API.

In plain words
What is it for?
Use it to search X by topic, date range, or account, and to return results for people or programs to process.
Why use it?
It provides a dedicated way to search X without mixing those results with general web searches. JSON output gives scripts and automation a consistent response format.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/moore-developers/grok-cli/search
Clone the repo
git clone --depth 1 https://github.com/Moore-developers/grok-cli
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 764 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00764
Opus 5 $0.00000 $0.00382
Sonnet 5 $0.00000 $0.00153
Haiku 4.5 $0.00000 $0.00076

Measured 2d ago against content hash f1ee20c69375, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

search scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

docs/commands/search.md · 95 lines

How it starts

The opening of the file, as written. The whole thing — 95 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Purpose

Search X through the Grok Responses API x_search tool. This command is the dedicated X search entrypoint and is separate from the general web_search attached by default to chat.

For human use, search streams readable text by default without exposing raw SSE events or status messages such as Searching X.... For scripts, skills, and automation, prefer --json for a stable single response.

Common Usage

grok-cli search "What are builders saying about Grok today?"

Limit date range:

grok-cli search "AI news" --from-date 2026-05-18 --to-date 2026-05-20

Restrict or exclude handles:

grok-cli search "Grok" --allowed-x-handle xai --excluded-x-handle example

Script or skill usage:

grok-cli search --json --query "Grok Hermes latest updates"

Disable default streaming:

grok-cli search "AI news" --no-stream

Output raw normalized stream events:

grok-cli search "AI news" --raw-stream

Parameters

  • QUERY: positional search query.
  • --query <QUERY>: explicit script-friendly query.
  • --json: use the standard JSON envelope. This disables streaming by default and returns one stable result.
  • --auth-file <PATH>: override the OAuth state file path.
  • --allowed-x-handle <HANDLE>: restrict X handles. Repeatable, up to 10.
  • --excluded-x-handle <HANDLE>: exclude X handles. Repeatable, up to 10.
  • --from-date <YYYY-MM-DD>: start date.
  • --to-date <YYYY-MM-DD>: end date.
  • --enable-image-understanding: enable image understanding.
  • --enable-video-understanding: enable video understanding.
  • --model <MODEL>: override the model for this request only.
  • --stream: explicitly use formatted streaming output.
  • --no-stream: disable default streaming and print one final result.
  • --raw-stream: output raw normalized stream events for debugging or programmatic consumption.
  • --timeout <SECONDS>: request timeout, default 3600.

Read the full file on GitHub · 95 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 95 lines · 0 tokens per session scan A f1ee20c69375

Subscribe to this mod's changes

search is a command published in the GitHub repository Moore-developers/grok-cli (52 stars, last pushed 19d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 764 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.