rag-web-fallback

rag-web-fallback is a skill for Claude Code, Codex from lyonzin/knowledge-rag. It costs 61 tokens per session (1,542 once invoked), scanned A, original, MIT.

A rule for answering questions from a local collection of indexed documents before using an external web search.

In plain words
What is it for?
It helps agents search internal documentation first, try a different local query if needed, and record why they had to use the web when local information was insufficient.
Why use it?
It avoids unnecessary network requests, delay, cost, and accidental internet access when the needed information is already available locally.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It helps agents search internal documentation first, try a different local query if needed, and record why they had to use the web when local information was insufficient.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/lyonzin/knowledge-rag/rag-web-fallback
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.

Any agent
npx skills add lyonzin/knowledge-rag --skill rag-web-fallback
Clone the repo
git clone --depth 1 https://github.com/lyonzin/knowledge-rag

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for rag-web-fallback

README.md
[![agentmods](https://agentmods.dev/badge/skills/lyonzin/knowledge-rag/rag-web-fallback/github.svg)](https://agentmods.dev/skills/lyonzin/knowledge-rag/rag-web-fallback)
Your own site
<a href="https://agentmods.dev/skills/lyonzin/knowledge-rag/rag-web-fallback"><img src="https://agentmods.dev/badge/skills/lyonzin/knowledge-rag/rag-web-fallback/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for rag-web-fallback

Your own site · 80×15
<a href="https://agentmods.dev/skills/lyonzin/knowledge-rag/rag-web-fallback"><img src="https://agentmods.dev/badge/skills/lyonzin/knowledge-rag/rag-web-fallback.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 61 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,542 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.1 $0.00061 $0.01542
Opus 5.5 $0.00024 $0.00617
Sonnet 5.5 $0.00012 $0.00308
Haiku 4.5 $0.00006 $0.00154

Measured 28d ago against content hash 50fc0b83623d, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

rag-web-fallback 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 28d 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.

skills/workflow/rag-web-fallback/SKILL.md · 137 lines

How it starts

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

rag-web-fallback — local first, web only when necessary

When to use this skill

Whenever the agent is tempted to call an external tool for information (WebSearch, WebFetch, mcp__exa__*, mcp__context7__*, etc.), route through this skill's checklist first.

Applies to:

  • Any request that could be answered from indexed docs before hitting the network
  • Any factual claim the agent is about to look up externally
  • Any "give me the latest on X" question where X might be in the corpus

Does NOT apply to:

  • Deliberate freshness requests: "what happened today", "current news"
  • User explicitly asks for a web search
  • Live infra queries (external API calls that are the actual task, not for context)

What this skill commits to

The agent will:

  1. Attempt at least one search_knowledge call before any web call, using appropriately extracted keywords.
  2. Attempt a second call with alternative phrasing if the first returned nothing relevant.
  3. Only then, if genuinely no local coverage, escalate to web search — with an explicit note to the user that RAG was checked and came back empty.

Steps

  1. First-pass RAG:

    search_knowledge(query="<extracted keywords>", max_results=5)
    
  2. If it returns no_results or the snippets do not address the question, try a paraphrase. Judge this from the snippets, not from score: it is min-max normalized within each query, so the top result scores 1.0 even when it is off-topic. When reranker_score is present (not null), it is the raw cross-encoder score and can be compared across queries. Common variants:

    • Swap synonyms ("auth" ↔ "authentication", "reindex" ↔ "rebuild", "ttl" ↔ "expiration")
    • Broaden ("payment refund cancellation" → "refund process")
    • Narrow ("architecture" → "authentication architecture")
  3. Second-pass RAG:

    search_knowledge(query="<paraphrased keywords>", max_results=5)
    

    Do not lower or raise min_score to catch weaker matches: it filters on the per-query normalized score, so it only drops the weakest results of each query, whatever their relevance.

Read the full file on GitHub · 137 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. 28d ago Changed · +1 lines 50fc0b83623d
  2. 3mo ago First seen · 136 lines · 61 tokens per session scan A cb015a77be73

Subscribe to this mod's changes

rag-web-fallback is a skill published in the GitHub repository lyonzin/knowledge-rag (314 stars, last pushed yesterday), licensed MIT. It adds 61 tokens to every session and 1,542 once invoked, about $0.0002 per session on Opus 5.5. 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.

Related

rag-web-fallback compared with skills from other repositories

rag-web-fallback next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
rag-web-fallbacklyonzin/knowledge-ragSkill314yesterdayMITA61Claude Code, Codex
pinecone-assistantpinecone-io/skillsSkill1725d agoMITA71Claude Code, Codex
pinecone:full-text-searchpinecone-io/pinecone-claude-code-pluginSkill6923d agoMITA180Claude Code
pinecone:n8npinecone-io/pinecone-claude-code-pluginSkill6923d agoMITA67Claude Code
pinecone:quickstartpinecone-io/pinecone-claude-code-pluginSkill6923d agoMITA94Claude Code
pinecone:clipinecone-io/pinecone-claude-code-pluginSkill6923d agoMITA75Claude Code
pinecone:mcppinecone-io/pinecone-claude-code-pluginSkill6923d agoMITA80Claude Code