agentleFS
AutsunsetAutsunset/grok-search/SKILL.md

grok-search

Skill19 starsChanged 4 months agoMITView on GitHub

Use when the user explicitly asks to search the web, check latest/current facts, fetch a URL, or discover pages on a website. Also use when the user asks to install, configure, or setup grok-search (API URL/key, chat vs responses). Do not use for local code search or stable offline knowledge unless the user asks for live web access.

  • Reads credentials

10 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

12 rules. 0 are common, 4 are distinctive, and 8 are very specific to this project.

  • 0

    Common

    Most of the 8 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When the user asks to install / configure / setup this skill, follow README.md →「Agent 安装与配置向导」 (English: README.en.md →「Agent setup …

    line 12
  2. Very specific:

    Success: if exit 0, no error, diagnostics.grok_endpoint matches choice, non-empty answer.text.

    line 22
  3. Very specific:

    If search later returns GROK_API_URL 未配置 or GROK_API_KEY 未配置, run this wizard instead of inventing env vars.

    line 25
  4. Distinctive:

    Do not chain map → fetch → search by default.

    line 35
  5. Very specific:

    Use ./scripts/fetch.js --max-chars 50000 URL only for an explicit deep read after the preview shows the page is worth reading.

    line 55
  6. Very specific:

    Search supports two Grok protocols via searchEndpoint / --search-endpoint:

    line 63
  7. Very specific:

    If Grok quota is explicitly exhausted, search.js may return a visibly marked degraded answer made from raw Tavily/Firecrawl results.

    line 70
  8. Distinctive:

    Check in this order:

    line 76
  9. Very specific:

    Search success: read answer.text, then sources.merged.

    line 80
  10. Very specific:

    Search: inspect diagnostics.grok_endpoint, diagnostics.degraded, diagnostics.cost_usd, provider attempts, and sources.grok[].source_type …

    line 81
  11. Distinctive:

    Search and fetch are intentionally separated.

    line 85
  12. Very specific:

    If search.js returns GROK_API_URL 未配置 or GROK_API_KEY 未配置, the project itself is missing required setup — point the user at README.md …

    line 98

“Common” is measured: kept by at least 6 in 10 of the 8 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Grok Search

Node scripts for web search, URL fetch, and lightweight site mapping. Run npm install once if dependencies are not installed, then run the scripts directly — there is no MCP server or extension to call.

Install Or Configure (agent wizard)

When the user asks to install / configure / setup this skill, follow README.md →「Agent 安装与配置向导」 (English: README.en.md →「Agent setup wizard」). Do not improvise a shorter flow.

Order:

  1. Self-check Node >=18.17, skill path, npm install, existing ~/.config/grok-search/config.json (mask any key).
  2. Ask protocol: chat (grok2api/NewAPI; grok-4.3-fast / grok-4.20-*) vs responses (CPA-style; often grok-4.5 only).
  3. Ask apiUrl (base only) and apiKey (never echo full key).
  4. Ask model id; write ~/.config/grok-search/config.json with mode 600.
  5. Ask whether to test. Only if yes, run: node "$SKILL_ROOT/scripts/search.js" --no-extra "随便搜个新闻"
  6. Success if exit 0, no error, diagnostics.grok_endpoint matches choice, non-empty answer.text.
  7. On failure, branch by error / HTTP status / empty search (401 key, 404 protocol/URL, 422 model, quota, proxy, model_not_found, no citations) and ask the user for the specific fix — then retest only if they agree.

If search later returns GROK_API_URL 未配置 or GROK_API_KEY 未配置, run this wizard instead of inventing env vars.

Choose The Script

Decide before running, by what the user already gave you:

  • They gave a URL and asked what it says → scripts/fetch.js.
  • They named a site but no URL, and want to know what is on it → scripts/map.js, then fetch.js on the URLs you pick.
  • They want current/latest information, or the URL is unknown → scripts/search.js.

Do not chain map → fetch → search by default. Run the fewest commands that answer the question. If sub-questions are independent (different sites, unrelated facts), launch the commands in parallel instead of sequentially.

Commands

./scripts/search.js "query"
./scripts/search.js --search-endpoint chat --model grok-4.3-fast "query"
./scripts/search.js --platform GitHub "query"
./scripts/search.js --extra 10 "query"
./scripts/search.js --no-extra "query"
./scripts/search.js --source-chars 200 "query"
./scripts/search.js --responses-openrouter-engine exa "strict web-only query"
./scripts/search.js --responses-x-search --responses-allowed-x-handles xai,OpenAI "query"
./scripts/fetch.js https://example.com
./scripts/fetch.js --provider direct https://example.com

Use ./scripts/fetch.js --max-chars 50000 URL only for an explicit deep read after the preview shows the page is worth reading.

./scripts/map.js https://docs.example.com --limit 20
./scripts/map.js --provider direct https://docs.example.com
./scripts/map.js https://docs.example.com --instructions "only API reference pages" --max-depth 2

Search supports two Grok protocols via searchEndpoint / --search-endpoint:

  • responses (default): {apiUrl}/responses + agentic web_search. Typical for CPA / xAI-style search (e.g. grok-4.5).
  • chat: {apiUrl}/chat/completions + web_search tools. Typical for grok2api / NewAPI with grok-4.3-fast, grok-4.20-fast, or grok-4.20-0309-non-reasoning.

On many relays, Responses search only works for CPA grok-4.5; prefer chat for the fast Grok models above. Both paths run alongside independent Tavily and Firecrawl searches. Tavily is used when its key is configured; Firecrawl works keyless and automatically uses FIRECRAWL_API_KEY when available. The default combined extra target is 6. Add --extra 10 only for a broader candidate-source sweep. Extras are never fed into Grok.

If Grok quota is explicitly exhausted, search.js may return a visibly marked degraded answer made from raw Tavily/Firecrawl results. Check diagnostics.degraded and diagnostics.grok_error. Other Grok failures remain errors. --no-extra disables this fallback as well as the external searches.

Reading Results

Each script writes a single JSON object to stdout. On failure it still writes JSON to stdout, a short message to stderr, and exits non-zero.

Check in this order:

  • error — if present, read error.message, error.code, error.preview if present, and diagnostics.provider_attempts. Before retrying, change something: a sharper query, a different --provider (fetch/map), or a different --model (search). Do not rerun the same command.
  • diagnostics.warnings and diagnostics.provider_attempts — these tell you which providers were skipped, failed, or produced content.
  • Search success: read answer.text, then sources.merged. Source cards are short and use snippet, not description or content. Full source/provider raw is in sources.raw_path; read it in chunks only when needed.
  • Search: inspect diagnostics.grok_endpoint, diagnostics.degraded, diagnostics.cost_usd, provider attempts, and sources.grok[].source_type (citation vs searched) before treating sources as evidence.
  • Fetch success: read content.text. If content.truncated is true and the preview is enough, stop. If more is needed, read content.full_path in chunks or rerun once with a deliberate larger --max-chars.
  • Map success: read urls, choose the best candidates, then fetch only the few URLs you need.

Search and fetch are intentionally separated. Use search to discover and compare sources, then fetch a specific URL for deep reading. In one research turn, fetch 1-2 URLs by default; do not batch-fetch many pages unless the user explicitly asks.

Providers And Limits

fetch.js provider order for --provider auto: Tavily Extract → Firecrawl Scrape → Direct Fetch. map.js provider order for --provider auto: Tavily Map → Direct Map.

For search, Tavily requires a key while Firecrawl uses its keyless tier by default. For fetch, missing Tavily means Firecrawl Keyless runs before Direct Fetch. The direct providers do not execute JavaScript, log in, use cookies, parse PDFs, or bypass anti-bot. Direct Map only reads /sitemap.xml and same-domain homepage links, ignores --instructions, and is limited to --max-depth 1.

Proxy

The scripts automatically use terminal proxy environment variables via undici when present: HTTP_PROXY / HTTPS_PROXY / ALL_PROXY and lowercase variants. NO_PROXY is honored, and loopback hosts are bypassed. Use GROK_PROXY="http://127.0.0.1:7890" to set a proxy just for this tool, or GROK_PROXY=off to force direct connections. If proxy debugging is needed, set GROK_DEBUG=true.

If search.js returns GROK_API_URL 未配置 or GROK_API_KEY 未配置, the project itself is missing required setup — point the user at README.md instead of trying to work around it.

When To Plan First

For multi-part research, conflicting sources, or anything that needs both site discovery and page content, read references/planning.md before running commands.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.