rag-grounding

rag-grounding is a skill for Claude Code from sanic732/P2P-4PDA-edition. It costs 186 tokens per session (962 once invoked), scanned A, original, MIT.

A generator for system prompts that make an AI answer from attached reference sources, with citations and an explicit marker when the sources do not contain an answer. RAG means retrieval-augmented generation: answering with retrieved documents.

In plain words
What is it for?
It creates model-specific grounding prompts for NotebookLM and other Claude, Gemini, or GPT workflows that need source-based answers with citations.
Why use it?
It reduces unsupported answers by defining the source scope, required evidence, output format, and rules against making up information.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

Part of the p2p-v8c3 plugin — 9 skills, 13 commands, 8 agents, 2 hooks shipped together

Good fit It creates model-specific grounding prompts for NotebookLM and other Claude, Gemini, or GPT workflows that need source-based answers with citations.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/sanic732/p2p-4pda-edition/rag-grounding
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 sanic732/P2P-4PDA-edition --skill rag-grounding
Clone the repo
git clone --depth 1 https://github.com/sanic732/P2P-4PDA-edition

Made for: Claude Code.

Or install p2p-v8c3, the plugin that ships this one along with the rest of its 9 skills, 13 commands, 8 agents, 2 hooks.

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-grounding

README.md
[![agentmods](https://agentmods.dev/badge/skills/sanic732/p2p-4pda-edition/rag-grounding/github.svg)](https://agentmods.dev/skills/sanic732/p2p-4pda-edition/rag-grounding)
Your own site
<a href="https://agentmods.dev/skills/sanic732/p2p-4pda-edition/rag-grounding"><img src="https://agentmods.dev/badge/skills/sanic732/p2p-4pda-edition/rag-grounding/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-grounding

Your own site · 80×15
<a href="https://agentmods.dev/skills/sanic732/p2p-4pda-edition/rag-grounding"><img src="https://agentmods.dev/badge/skills/sanic732/p2p-4pda-edition/rag-grounding.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 186 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 962 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.
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.00186 $0.00962
Opus 5 $0.00093 $0.00481
Sonnet 5 $0.00037 $0.00192
Haiku 4.5 $0.00019 $0.00096

Measured 12d ago against content hash 5319de8ce8ee, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

rag-grounding 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 12d 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.

editions/8.4.6-C/plugin/.claude/skills/rag-grounding/SKILL.md · 61 lines

How it starts

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

rag-grounding — промпт-запрос к источникам («как считывать»)

Собирает готовый системный промпт, который заставляет модель отвечать СТРОГО по прикреплённым источникам, с цитатами и маркером UNKNOWN — в нативном синтаксисе выбранной модели.

Когда применять / НЕ применять

Применять: нужно надёжно «прочитать» базу/блокнот без отсебятины; собрать grounding-промпт под конкретную модель. НЕ применять: подготовка самих файлов (→ rag-prep); выбор инструмента/стратегии (→ rag-router).

Каркас (неизменный костяк)

PERSONATASKCONTEXT_SCOPEOUTPUT_CONTRACTANTI_HALLUCINATION_GUARD. Меняются только Task/Output под задачу; grounding и guard остаются.

Правило формулировок — позитивно: «отвечай только на основе источников» и «каждый тезис — с цитатой [файл, §]», а не «не галлюцинируй».

Адаптация под модель (обязательно)

Один контракт — разный синтаксис и обход бага модели:

  • Claude (Opus 4.8 / Sonnet 4.6): XML-теги (<role><rules><task>), нативно.
  • Gemini (3.1 Pro / 3.5 Flash): Zero-XML, только markdown-заголовки (XML триггерит деградацию — баг G2). Идеально под NotebookLM.
  • GPT-5.5: markdown, ≤7 пар MUST/MUST NOT (иначе тихая деградация — G9).
  • Grok 4.3: обрамить Topic Anchor сверху и снизу (дрейф темы — G3).
  • DeepSeek: минимализм, не навязывать структуру и не писать «думай пошагово» (ломает нативный reasoning); fetch у него нет — RAG только через прикреплённые файлы.
  • Qwen / GLM: markdown + строгий JSON-режим.

Готовые блоки под каждую модель (копировать) — в reference/model_templates.md (полированные; сырые исходные заготовки — в reference/model_templates_source.txt). Самые дешёвые модели (Haiku, Gemini 3.5 Flash-Lite) исключать: на них строгий grounding нестабилен.

Процесс

  1. Спроси/определи целевую модель и задачу.
  2. Возьми каркас, подставь Task/Output, переупакуй под синтаксис модели и её баг.
  3. Выдай готовый промпт одним блоком для копирования.

Self-check

  • Есть все 5 секций каркаса; guard сформулирован позитивно.
  • Синтаксис строго под целевую модель (XML только для Claude; Gemini — Zero-XML).
  • Соблюдён лимит правил для GPT; Topic Anchor для Grok.
  • Требование цитат [файл, §] и маркер UNKNOWN присутствуют.

Read the full file on GitHub · 61 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 12d ago First seen · 61 lines · 186 tokens per session scan A 5319de8ce8ee

Subscribe to this mod's changes

rag-grounding is a skill published in the GitHub repository sanic732/P2P-4PDA-edition (17 stars, last pushed 25d ago), licensed MIT. It adds 186 tokens to every session and 962 once invoked, about $0.0009 per session on Opus 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

Other skills, from other repositories