ai-internet-search
Internet research for AI agents that is defensible, not just cheap.
ai-internet-search finds candidate pages, ranks them by source quality before
reading them, quotes evidence, surfaces disagreement, and says what it could
not establish. It is a zero-runtime-dependency Node.js CLI and MCP server for
agents that need useful research without hiding uncertainty behind a majority
vote.

Quick start
Requires Node.js 18 or newer.
npm install -g ai-internet-search
ai-internet-search "what is a connection pool"
Or run it without installing:
npx ai-internet-search "what is a connection pool"
The output is intentionally compact and machine-readable. A typical result
contains a query kind, selected handler, research decision, certainty, quoted
claims, source pointers, conflicts, and any gaps:
query_kind: engineering
handler: engineering_sources
decision: answer
certainty: moderate
claims[...]{tier,host,claim}:
... quoted evidence ...
sources[...]{tier,host,why,url,sha256}:
... source pointers ...
Network results vary. Finding nothing is still a successful, explicit answer:
could_not_establish: no source above the noise floor answered this.
Why it works this way
Search engines return a mixture of official documentation, research, copied
articles, and content farms. Counting results lets repeated low-quality claims
outvote a better source. This tool makes credibility part of the retrieval
pipeline:
flowchart LR
A[Question] --> B[Route by intent]
B --> C[Find candidates]
C --> D[Rank by source quality]
D --> E[Open a small set]
E --> F[Quote evidence]
F --> G[Show conflicts and gaps]
The default pass opens at most one page per host and a small number of pages
overall. It ranks candidates before fetching their bodies, so the same choice
reduces noise, latency, and tokens. Authority is the primary sort key; title
relevance and a URL-based freshness heuristic only break ties.
The source tiers are deliberately explainable:
| Tier |
Typical sources |
Meaning |
| 1 |
Official docs, specifications, RFCs, source, changelogs, registries |
The thing itself |
| 2 |
Peer-reviewed papers, issue threads, vendor engineering blogs |
People who built or study it |
| 3 |
Practitioner Q&A, reference sites, forums, preprints |
Useful secondary evidence |
| 4 |
Content aggregators, SEO listicles, retracted papers |
Lowest default trust |
An unrecognised host starts at tier 3. Unknown is not automatically junk.
A vendor engineering blog moves to tier 1 ("vendor on its own product") when
the question names that vendor, or when you give its URL directly. Anthropic's
post about Anthropic's own system is the first-hand account of that system.
Two rules come from Calling Bullshit:
- A preprint (arXiv, bioRxiv, medRxiv, SSRN) is tier 3. It is not junk, but it
has not passed peer review, so it does not count as tier 1-2 corroboration.
- A retracted paper is tier 4 on any host, with the reason
retracted paper.
OpenAlex supplies the flag (is_retracted, or a "RETRACTED" title marker).
An unflagged duplicate record of the same paper in the same results is
marked too. The retraction notice itself keeps its normal tier. The paper
stays visible, because the question can be about the retraction.
Typed decisions and uncertainty
Every research plan exposes a bounded decision object. It is deterministic in
the open-source implementation, so it can be audited and tested without a
model dependency:
query_kind: definition | engineering | academic
decision: answer | search_more | escalate_uncertainty | inspect_plan
evidence_sufficient: no | uncertain | yes
checks: readable, authoritative, agreement, coverage, question (true | false)
The same decision is available in TOON output, --json, and the MCP
research tool. The evaluator is isolated in lib/decisions.js, so a future
local model can replace the heuristic without changing the output contract.
No number in the decision object is invented. query_kind probabilities are
the normalized keyword weights. handler and source_strategy are fixed
functions of query_kind, so they carry the same distribution. next_action
comes from a rule, so it reports a one-hot distribution with confidence 1. That
is the rule's certainty about its own output, not a claim that the answer is
true. Calibrated probabilities need a model, and this tool uses none.
Readable sources also carry a contentHash: the full JSON output exposes the
SHA-256 fingerprint of the exact bytes fetched, while compact output shows its
first 16 characters as sha256. This is an audit signal for comparing runs,
not a permanent guarantee that a URL has not changed.
The research plan uses three Jev-inspired controls:
- intent routing selects a reference, engineering, or academic handler;
- eligible providers fan out in parallel, and a provider that times out is
reported under
failed, not asked again;
- source scoring combines authority, title relevance, and URL freshness.
If the evidence is insufficient, the result tells the caller whether to answer,
inspect the plan, search more, or escalate uncertainty. That keeps iteration
under the control of the calling agent.
An answer decision also requires authoritative support: at least one tier-1
source, or independent corroboration from two tier-2 sources on different
hosts. A moderate grade from one secondary source is therefore still escalated
for review.
A copy is not corroboration. When a read page repeats another read page (the
same canonical URL, the same wire-service story, or 70% or more of its text),
the page gets copyOf and copyKind (url, wire, body). It is then not
counted as a second source for certainty or for the answer decision. The
CLI shows the copy in the why column of sources, and certainty.why
states how many copies were not counted. Search results are also
deduplicated by canonical URL, so a utm_ or www. variant of a page is not
opened twice. This check is adapted from
hyperresearch (MIT).
evidence_sufficient answers five independent checks in one pass: a source
was readable, the support is authoritative, the sources agree, every query term
is covered, and a specific question was asked. Its probability is the share
of checks that passed. It is a measured fraction, not a calibrated probability.
The band gives no below 0.30 and yes only when every check passed, so the
band cannot say yes next to an escalated action. The band pattern comes from
TypeSafe's
self-consistency cookbook.
One question, one pass
The tool performs one retrieval pass per invocation. It does not silently enter
a reflection loop or keep re-searching after a gap. This is intentional:
- simple factual questions usually need one focused retrieval pass;
- multi-hop questions are better split by the caller into several calls;
- an insufficient result is explicit (
search_more or
escalate_uncertainty) instead of being turned into a confident guess.
Within that pass, one retry is allowed, and it is always reported. Hacker News,
Stack Exchange and GitHub return only results that match every term, so a long
question gets nothing back from them. A provider that returns nothing for the
full query is asked once more with the first three terms. The output then shows
a widened: line. Widened results must still match the full question.
Providers that did return results are not asked again.
For the caller's next pass, each gap comes with a short follow-up query in
next_queries (at most three). The query is the question's leading covered
terms plus the missing term. The agent runs the loop. The tool does not.
Provider discovery may run in parallel, but page reading remains bounded and
the output keeps the source tier, quoted evidence, and known gaps visible.
Readable documents are capped at 8 MB so large references remain usable
without turning one request into an unbounded memory load.
Usage
ai-internet-search "<question>" # research
ai-internet-search --plan "<question>" # triage; fetch nothing
ai-internet-search --limit 5 "<question>" # open more sources
ai-internet-search --claims 6 "<question>" # quote more per source (default 3)
ai-internet-search --per-host 2 "<question>" # allow more per host
ai-internet-search --json "<question>" # JSON output
ai-internet-search --report "<question>" # write a printable HTML report (handbook page)
ai-internet-search --report=out.html "<question>" # choose report path
ai-internet-search --render "<question>" # retry readable pages in Chromium
Exit codes are stable for callers:
| Code |
Meaning |
0 |
Success, including an explicit empty result |
1 |
Runtime or research error |
2 |
Unknown flag or bad usage |
Query directives
Google-style directives scope candidates returned by a provider without
polluting the keyword search:
ai-internet-search "postgres pooling site:github.com"
ai-internet-search 'rate limiting -site:reddit.com intitle:"token bucket"'
Supported directives are site: / -site:, inurl: / -inurl:,
intitle: / -intitle: and filetype:. A site: value may include a path.
after: and before: are intentionally not supported because candidates do
not reliably carry publication dates.
Directives are lenient: if a filter would remove every candidate, it is
relaxed and the output explains why. A restrictive query should not turn into
silence just because a provider omitted a field.
Direct URL research
An explicit http(s) URL is treated as the source to inspect. It bypasses
provider discovery, but still goes through source tiering, bounded extraction,
render fallback, claims, and uncertainty grading:
ai-internet-search "https://github.com/browser-use/jev-ultrafast"
This is useful for repository READMEs, papers, documentation pages, and other
specific sources that a keyless search provider may not discover.
When the prompt contains only generic inspection wording plus a URL, the tool
returns the strongest extracted claims but keeps the decision in review until
the caller supplies a specific question.
Rendering pages that fetch cannot read
Some pages return an empty client-rendered shell or a 403 to a plain fetch.
With --render, the tool retries the source in an already-installed,
headless Chrome or Chromium and sends the rendered DOM through the same scoring
and extraction path:
ai-internet-search --render "..."
Rendering is opt-in, adds no npm dependency, and is a no-op with an explicit
message when no compatible browser is available. It helps read a page; it does
not improve provider discovery.
Reading through your own browser
--browser URL retries a source in a running Chrome over the Chrome DevTools
Protocol, using that profile's cookies and logins:
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \
--remote-debugging-port=9222 \
--user-data-dir="$HOME/.ai-internet-search-chrome"
ai-internet-search --browser http://127.0.0.1:9222 "..."
This path needs Node.js 22 or newer because it uses Node's built-in WebSocket
client. Only http:, https:, and data: URLs are opened. A DevTools port
allows local processes to control that browser, so close the profile when you
are done.
General-web recall
The default providers are keyless: Wikipedia, OpenAlex, DOAJ, Hacker News,
GitHub issues, Stack Overflow, news feeds, and You.com web search. The others
cover reference, academic, practitioner, bug-diagnosis, and recent-news
questions. You.com adds general-web "how do I..." recall.
You.com keyless search
You.com's free Agents API needs no key and no account. It allows 100 queries a
day per IP address (You.com docs).
One research call can use two queries when the tool widens the search. After
the cap, youcom shows under unreachable: and the other providers still
answer. Set YOUCOM=0 to turn it off.
Recent news
A question with a news cue (a year such as 2026, or words such as latest,
announced, released, criticism, DMCA, shut down) also reads the
public RSS and Atom feeds of 17 tech and games outlets, including The Verge,
Ars Technica, TechCrunch, GamesRadar+, Eurogamer, and Kotaku. The full list is
in lib/providers/news.js. Only the title, link, and date of each story are
used, and stories are kept only when their title matches the question.
- A feed lists only an outlet's latest 10-100 stories, so this finds news from
roughly the last days or weeks. It is not an archive.
- News outlets grade as tier 3 (
news report (secondhand)). Look for the
primary source the story cites.
- The feeds are fetched once and reused for 10 minutes.
- Bing News and Google News search feeds are not used: both state that they are
for personal, non-commercial use in a feed reader.
Enable a keyed general-web engine when you need more recall:
export SERPER_API_KEY=... # Google results; or BRAVE_API_KEY, TAVILY_API_KEY
ai-internet-search "how do I keep a status page realtime"
Every engine whose key is set runs, in parallel, and each is reported by name
(brave, tavily, serper, google). A second key adds a second index; it
does not replace the first. Results enter the same tiered ranking, and the
number of engines that return a page is never treated as consensus.
Google Programmable Search (GOOGLE_SEARCH_API_KEY + GOOGLE_SEARCH_CX) still
works for existing keys. Google closed it to new customers and ends it on
2027-01-01 (Google notice).
MARGINALIA=1 turns on the keyless Marginalia index. It has a latency cost. On
2026-09-29, the shared public key timed out on every multi-term query that was
tested, while single-term queries answered in about 1 second. On 2026-11-16 a
single query timed out after 10 seconds. A timed-out provider is reported
under unreachable: and is not retried, but it can still add up to 10
seconds to each search.
MCP and agent clients
Install once to put both binaries on PATH:
npm install -g ai-internet-search
The package provides ai-internet-search and ai-internet-search-mcp.
Agent skill
The package also ships an Agent Skills guide at
skills/ai-internet-search/SKILL.md. It tells an agent when to run the tool
and how to read its output. Link it once into ~/.agents/skills, which
Codex, Gemini CLI, OpenCode, Cursor, and GitHub Copilot read. Claude Code
reads only ~/.claude/skills, so link it there as well:
mkdir -p ~/.agents/skills ~/.claude/skills
ln -sfn "$(npm root -g)/ai-internet-search/skills/ai-internet-search" ~/.agents/skills/ai-internet-search
ln -sfn ~/.agents/skills/ai-internet-search ~/.claude/skills/ai-internet-search
The links follow npm install -g ai-internet-search upgrades.
MCP
Terminal agents should run the CLI directly: MCP costs more tokens. If a
client has no shell or prefers MCP, register the stdio server:
claude mcp add --scope user ai-internet-search -- ai-internet-search-mcp