uooooo/agent-skills

Claude Code & OpenAI Codex skills: grok-x-search, pdf-lecture-notes, codex-web-search

Compatible conClaude CodeCodex CLI~Cursor
npx add-skill uooooo/agent-skills

name: grok-x-search description: Search and analyze fresh X/Twitter discourse through OpenRouter using xAI Grok models, with automatic routing between x-ai/grok-4.1-fast and x-ai/grok-4.20-multi-agent, native X search filters, and X-focused prompt shaping. Use when Codex needs current information from X rather than ordinary web pages, especially for requests like “X で何と言われているか調べて”, “recent reactions on X”, handle-scoped searches, date-bounded social research, or lightweight social-sentiment tracking.

Grok X Search

Overview

Use this skill when X posts are the primary evidence source. Run the bundled script with uv run so OpenRouter request shape, X filters, model selection, and output formatting stay consistent instead of rebuilding the API call ad hoc.

Workflow

  1. Normalize the request into:
  • topic or entity
  • time window
  • optional include or exclude handles
  • whether images or videos matter
  • whether the ask is quick/focused or deep/multi-faceted
  1. Use uv run scripts/search_x.py ... instead of hand-writing the HTTP request.

  2. Default is --model multi-agent (= x-ai/grok-4.20-multi-agent). Override only when there is a clear reason:

  • --model fast (= x-ai/grok-4.1-fast) for cheap focused lookups, single-handle queries, or strict cost ceilings
  • --model auto for cost-aware complexity-based routing (the previous default)
  • keep --model multi-agent for comparison, trend synthesis, broader scope, or any deep work
  • pair with --reasoning-effort high|xhigh to escalate from 4 agents to 16 agents
  1. Prefer filters over prompt wording when the user gives hard constraints:
  • use --allow-handle or --exclude-handle for source control
  • use --from-date and --to-date for recency bounds
  • use --include-images or --include-videos only when media content matters
  1. Return the result with:
  • a short direct answer
  • the key X-side signals
  • disagreement or uncertainty if evidence is mixed
  • the model actually used
  • any filters that materially constrained the search

Quick Start

Export the API key in the shell before invoking the script:

export OPENROUTER_API_KEY="..."

If you want the skill to work without exporting each time, store:

mkdir -p ~/.config/grok-x-search
printf 'OPENROUTER_API_KEY=...\n' > ~/.config/grok-x-search/env
chmod 600 ~/.config/grok-x-search/env

Focused search:

uv run ~/.codex/skills/grok-x-search/scripts/search_x.py \
  "What are people on X saying about OpenRouter's latest Grok support?" \
  --from-date 2026-04-01

Handle-scoped search:

uv run ~/.codex/skills/grok-x-search/scripts/search_x.py \
  "Summarize the recent messaging around Grok 4.20 multi-agent" \
  --allow-handle xAI \
  --allow-handle OpenRouterAI \
  --from-date 2026-03-31

Deeper synthesis:

uv run ~/.codex/skills/grok-x-search/scripts/search_x.py \
  "Compare sentiment on X toward Grok 4.1 Fast versus Grok 4.20 Multi-Agent since launch, including speed, price, and quality tradeoffs" \
  --model multi-agent \
  --reasoning-effort high \
  --from-date 2026-03-31

Preview the exact request without sending it:

uv run ~/.codex/skills/grok-x-search/scripts/search_x.py \
  "What are developers saying on X about Grok 4.1 Fast?" \
  --dry-run

Query Shaping Rules

Do not treat the user's sentence as the literal search query. The model should generate the internal search calls, but the request you send should still be structured well:

  • state the entity, product, or event explicitly
  • state the analytical task explicitly: reactions, sentiment, comparison, timeline, criticism, launch reception
  • add a time window whenever freshness matters
  • include aliases, bilingual phrasing, or hashtags in the user request when they materially improve recall
  • ask for evidence quality handling, for example “call out disagreement” or “say if evidence is sparse”

Good:

Compare recent X reactions to Grok 4.1 Fast and Grok 4.20 Multi-Agent since 2026-03-31. Focus on latency, price sensitivity, and perceived research quality. Note disagreement and cite posts.

Weak:

Search X for Grok.

Model Routing

--model multi-agent (= x-ai/grok-4.20-multi-agent) is the default. --reasoning-effort medium runs 4 agents; high / xhigh runs 16 agents.

Stay on the default (multi-agent + medium) for:

  • comparisons across products, periods, or stakeholder groups
  • trend synthesis over a wider time range
  • prompts that ask for tradeoffs, competing narratives, or deeper research
  • almost any non-trivial X-side investigation

Switch to --model fast (= x-ai/grok-4.1-fast) only for:

  • one topic AND one recent event
  • a narrow set of handles
  • explicit “quick check” / cost-sensitive lookups

Switch to --model auto only when you want the previous cost-aware heuristic routing.

Pricing (OpenRouter, 2026-04):

  • grok-4.20-multi-agent: $2 / $6 per 1M tokens, $5/K web search
  • grok-4.1-fast: $0.20 / $0.50 per 1M tokens, $5/K web search

If you need the detailed rationale or want to change the heuristics, read references/openrouter-grok-notes.md.

Implementation Notes

  • The bundled script uses OpenRouter Chat Completions because OpenRouter’s documented X-specific filters are exposed on the web plugin path.
  • The request uses plugins: [{"id":"web","engine":"native"}] plus x_search_filter so xAI-native search is used when available.
  • The system prompt biases the model toward x_search first. OpenRouter may still make web_search available alongside it on xAI models.
  • The script is executable through uv run and also carries a uv shebang for direct execution after install.
  • The script first reads OPENROUTER_API_KEY from the shell, then falls back to ~/.config/grok-x-search/env.
  • The script prints the final answer to stdout and prints request diagnostics to stderr.

Resources

scripts

  • scripts/search_x.py: OpenRouter client for X-focused Grok search with auto model selection and filter support.

references

  • references/openrouter-grok-notes.md: Source-backed notes on OpenRouter/XAI behavior, model pricing, and routing rationale.

Skills relacionados