Agent skill

RAG Cite Sources

by lyonzin in lyonzin/knowledge-rag

Every technical claim drawn from the local corpus must ship with a source citation formatted as path:line or path:section.

MITAuto-check passedAI & LLM Engineering

Install RAG Cite Sources

skills CLI
$ npx skills add lyonzin/knowledge-rag --skill rag-cite-sources -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install lyonzin/knowledge-rag rag-cite-sources --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/lyonzin/knowledge-rag.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/foundation/rag-cite-sources .claude/skills/rag-cite-sources && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
rag-cite-sources
GitHub stars
292
Token cost
~1.4k tokens
SKILL.md length
361 words
Files
1
Skills in repo
10
Repo updated
First seen
Licence
MIT

At a glance

Every technical claim drawn from the local corpus must ship with a source citation formatted as path:line or path:section.

  • Works in 5 steps: When you call search_knowledge or… → When you draft the response, mark every… → If quoting verbatim, use fenced… → …
  • Ever the response quotes
  • SKILL.md covers When to use this skill, What this skill commits to, Steps and Examples, plus 2 more sections
  • Reaches datatracker.ietf.org

What it does

RAG Cite Sources is an agent skill from lyonzin/knowledge-rag. Every technical claim drawn from the local corpus must ship with a source citation formatted as path:line or path:section. Trigger whenever the response quotes, paraphrases, or acts on knowledge that came from a searchknowledge or getdocument call. Makes answers auditable and lets the user jump to source in one click.

Its SKILL.md is about 1.4k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in AI & LLM Engineering, covering Citation management and Retrieval-augmented generation. It works with Model Context Protocol. The repository describes itself as: Local RAG MCP server for Claude Code — hybrid search (semantic + BM25), cross-encoder reranking, 13 MCP tools, 20 format parsers. Zero external servers, zero API keys. The licence is MIT.

When your agent uses it

  • Ever the response quotes
  • Acts on knowledge that came from a searchknowledge
  • Getdocument call

Example prompts

  • “/rag-cite-sources”

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. When you call search_knowledge or get_document, capture
  2. When you draft the response, mark every fact-carrying sentence with its source. Preferred inline syntax
  3. If quoting verbatim, use fenced blockquote + citation
  4. If synthesizing across multiple sources, cite each
  5. When a claim is NOT from the corpus (general knowledge, external doc, your own reasoning), mark it explicitly

What it can do on your machine

Read from SKILL.md and the folder at commit df9cccb. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are markdown).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • datatracker.ietf.org

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

RAG Cite Sources loads about 1.4k tokens when it runs. Until then it costs about 85 tokens; SKILL.md has 361 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~85
When it runs · the whole SKILL.md, loaded when a task matches
~1.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from lyonzin/knowledge-rag at commit df9cccb, republished under its MIT licence (© lyonzin). 361 words, ~1,420 tokens.

Download SKILL.mdSave it as .claude/skills/rag-cite-sources/SKILL.md (or your agent's skills folder).
name
rag-cite-sources
description
Every technical claim drawn from the local corpus must ship with a source citation formatted as path:line or path:section. Trigger whenever the response quotes, paraphrases, or acts on knowledge that came from a search_knowledge or get_document call. Makes answers auditable and lets the user jump to source in one click.
metadata.type
rag-workflow
metadata.kind
foundation
metadata.target
any-mcp-client

rag-cite-sources — every claim traces to a source

When to use this skill

Whenever an answer contains any of these:

  • A specific number, threshold, config value, or version taken from the corpus
  • A statement about how the system currently works, was designed, or was decided
  • A code snippet, function signature, or API contract quoted from indexed files
  • A "the runbook says", "the ADR says", "the RFC decided", "we agreed" claim
  • A recommendation grounded in prior team practice

Basically: if a curious reader would want to double-check where you got that, cite.


What this skill commits to

Every technical claim in the response carries a citation of the form:

  • [path/to/file.md:42] — line-anchored (from search_knowledge result's source field)
  • [path/to/file.md#section-heading] — section-anchored for Markdown
  • [path/to/file.md] — file-only, when line/section is not available

Citations are inline at the point of the claim, not batched at the end. One claim = one citation.


Steps

  1. When you call search_knowledge or get_document, capture:

    • The source field (usually the file path)
    • The filename (short name for display)
    • Any chunk_id or line hint in the metadata
    • The actual content you are about to quote or paraphrase
  2. When you draft the response, mark every fact-carrying sentence with its source. Preferred inline syntax:

    markdown
    Per ADR-0018 [docs/adr/0018-auth.md], the payment service uses mTLS between services.
    The retry policy is 3 attempts with exponential backoff [services/payment/retry.py].
  3. If quoting verbatim, use fenced blockquote + citation:

    markdown
    > "All external API calls must timeout after 30 seconds."
    > — [docs/architecture/http-contracts.md#timeouts]
  4. If synthesizing across multiple sources, cite each:

    markdown
    The service uses OAuth2 [docs/adr/0018-auth.md] with a 15-minute access token TTL
    [config/auth.yaml:12] and refresh-token rotation on every use [docs/security/oauth-flow.md].
  5. When a claim is NOT from the corpus (general knowledge, external doc, your own reasoning), mark it explicitly:

    markdown
    Per [docs/adr/0018-auth.md] we use OAuth2. Note that OAuth2 spec (RFC 6749, external)
    also allows client-credentials flow, which the ADR does not mention.

Show full SKILL.md (177 more words)Show less

Examples

Example 1 — Answering a config question

User: "What is our default request timeout?"

Agent:

search_knowledge(query="default request timeout") →
1 hit: config/http.yaml (line 8, score 0.87)

Reply: "The default request timeout is 30 seconds [config/http.yaml:8].
This is enforced globally by the HTTP client middleware [services/common/http_client.py:45]."

Example 2 — Code review

User: "Is this retry logic correct?"

Agent:

search_knowledge(query="retry policy exponential backoff") →
2 hits: docs/adr/0031-retries.md (0.79), services/common/retry.py (0.65)

Reply: "Per our retry ADR [docs/adr/0031-retries.md], the policy is
'3 attempts, exponential backoff starting at 1s, max 30s'. Your code
retries 5 times which exceeds the standard. Adjust to match
services/common/retry.py:12–28 or open a new ADR to document
the exception."

Example 3 — Explicit no-source note

User: "Should we use gRPC instead of REST for the new service?"

Agent:

search_knowledge(query="grpc rest choice") → 0 hits

Reply: "The corpus does not have a decision on gRPC vs REST for new services
(no ADR indexed on this). Answering from general considerations [not from corpus]:
gRPC gives you… [reasoning]. Recommend: open an ADR with the tradeoffs before
committing."

Edge cases

  • Chunk mid-sentence — if search_knowledge returns a chunk that starts mid-paragraph, call get_document(filepath=<source>) to fetch context before quoting.
  • Very long paths — abbreviate for readability, keep the full path in a footnote:
    markdown
    Per the retry ADR [ADR-0031¹], we use exponential backoff.
    ¹ docs/architecture/decisions/0031-retries-and-timeouts.md
  • Non-file sources (URL-ingested content) — cite the original URL from the document's metadata:
    markdown
    Per RFC 9110 §15.5.9 [https://datatracker.ietf.org/doc/html/rfc9110, indexed
    via add_from_url on 2026-05-14], 425 Too Early is idempotent-safe.
  • The corpus contradicts itself — cite both sources and flag the conflict explicitly:
    markdown
    Conflicting sources: [docs/adr/0018-auth.md] says 15-min TTL, but
    [config/auth.yaml:12] shows 30-min. Recommend resolving the ADR vs config
    drift before answering with certainty.

  • rag-check-first — the prerequisite: search happens first, citations follow.
  • rag-deep-dive — chained citations across a full drill-down.
  • rag-code-review — code review is where citation discipline pays off most.

© lyonzin, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/foundation/rag-cite-sources of lyonzin/knowledge-rag.

Open the folder on GitHubat commit df9cccb

Compare with similar skills

RAG Cite Sources next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

RAG Cite Sources compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
RAG Cite Sources this skilllyonzin/knowledge-rag292—~1.4kAutomated safety check: PassMIT
Sciverseopendatalab/Sciverse-Agent-Tools120—~3kAutomated safety check: PassCustom licence
Tw Legal RAGaa0101181514/tw-legal-rag328—~580Automated safety check: PassCustom licence
Scholar RAGjoshzyj/open-scholar-skill168—~7.4kAutomated safety check: NotesCustom licence
Local RAG Searchnkapila6/mcp-local-rag1341 repos~1.6kAutomated safety check: PassMIT
Gnogmickel/gno1151 repos~1.6kAutomated safety check: PassMIT

Similar skills

  • Sciverse

    opendatalab/Sciverse-Agent-Tools

    A skill your agent uses when the user needs academic paper retrieval — searching scientific literature by author/year/journal, finding paper chunks for RAG-style citations, or expanding original…

    120 GitHub stars~3k tokensUpdated 20 days ago
    AI & LLM EngineeringAuto-check passed
  • Tw Legal RAG

    aa0101181514/tw-legal-rag

    Retrieve real Taiwan court judgments with verifiable citations before answering any question about Taiwan law or case law.

    328 GitHub stars~580 tokensUpdated 2 days ago
    Legal & ComplianceAuto-check passed
  • Scholar RAG

    joshzyj/open-scholar-skill

    Build and query a local vector database + GraphRAG over your entire reference library (Zotero or a PDF folder) for literature review.

    168 GitHub stars~7.4k tokensUpdated 22 days ago
    Research & ScienceAuto-check: notes
  • Local RAG Search

    nkapila6/mcp-local-rag

    Efficiently perform web searches using the mcp-local-rag server with semantic similarity ranking.

    134 GitHub starsUsed in 1 repo~1.6k tokens
    AI & LLM EngineeringAuto-check passed
  • Gno

    gmickel/gno

    Search local documents, files, notes, and knowledge bases. An agent skill from gmickel/gno.

    115 GitHub starsUsed in 1 repo~1.6k tokens
    Knowledge ManagementAuto-check passed
  • Gno

    gmickel/gno

    Search local documents, files, notes, and knowledge bases. An agent skill from gmickel/gno.

    115 GitHub stars~11k tokensUpdated 2 days ago
    Knowledge ManagementAuto-check passed

More from lyonzin/knowledge-rag

All 10 skills in this repo
  • RAG Check First

    lyonzin/knowledge-rag

    Before answering any technical question, code request, architecture decision, or factual claim, call searchknowledge to check the local corpus.

    292 GitHub stars~1.4k tokensUpdated yesterday
    Auto-check passed
  • RAG Code Review

    lyonzin/knowledge-rag

    When performing code review on a PR, diff, snippet, or "look at this change" request, first consult the corpus for related ADRs, coding standards, prior patterns, and similar files.

    292 GitHub stars~1.8k tokensUpdated yesterday
    Auto-check passed
  • RAG Deep Dive

    lyonzin/knowledge-rag

    Three-step multi-tool workflow — search the corpus, fetch the most relevant document in full, then find similar documents.

    292 GitHub stars~1.6k tokensUpdated yesterday
    Auto-check passed
  • RAG Troubleshoot

    lyonzin/knowledge-rag

    When the user reports a bug, error message, stack trace, unexpected behavior, or "why is this broken" question, search the corpus first for prior occurrences, known fixes, or related runbooks.

    292 GitHub stars~1.8k tokensUpdated yesterday
    Auto-check passed
  • RAG Evaluate Quality

    lyonzin/knowledge-rag

    Measure retrieval quality using evaluateretrieval (MRR@5 and Recall@5) and getindexstats.

    292 GitHub stars~1.4k tokensUpdated yesterday
    Auto-check passed
  • RAG Index Decisions

    lyonzin/knowledge-rag

    After making a non-obvious architectural decision, solving a novel bug, agreeing on a coding standard, or reaching a conclusion worth remembering, index it back into the knowledge base so the next…

    292 GitHub stars~2k tokensUpdated yesterday
    Auto-check passed

Questions about RAG Cite Sources

What does RAG Cite Sources do?

Every technical claim drawn from the local corpus must ship with a source citation formatted as path:line or path:section. RAG Cite Sources is an agent skill from lyonzin/knowledge-rag. Every technical claim drawn from the local corpus must ship with a source citation formatted as path:line or path:section.

When should I use RAG Cite Sources?

RAG Cite Sources fits situations like: ever the response quotes; acts on knowledge that came from a searchknowledge; getdocument call.

How do I install RAG Cite Sources in Claude Code?

Run `npx skills add lyonzin/knowledge-rag --skill rag-cite-sources -a claude-code`. Or copy the skill folder (skills/foundation/rag-cite-sources in lyonzin/knowledge-rag) into .claude/skills/rag-cite-sources in your project. Claude Code loads it when a task matches its description.

How do I install RAG Cite Sources in Codex?

Run `npx skills add lyonzin/knowledge-rag --skill rag-cite-sources -a codex`. Or copy the skill folder (skills/foundation/rag-cite-sources in lyonzin/knowledge-rag) into .agents/skills/rag-cite-sources in your project. Codex loads it when a task matches its description.

Can I use RAG Cite Sources in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add lyonzin/knowledge-rag --skill rag-cite-sources -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/rag-cite-sources, .gemini/skills/rag-cite-sources, .github/skills/rag-cite-sources and .opencode/skills/rag-cite-sources in your project.

What does RAG Cite Sources need to run?

SKILL.md names no scripts, command-line tools or credentials: RAG Cite Sources is instructions for the agent only.

Does RAG Cite Sources access the network?

SKILL.md names 1 domain. In commands or code: datatracker.ietf.org; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is RAG Cite Sources safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does RAG Cite Sources use?

RAG Cite Sources is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does RAG Cite Sources use?

About 1.4k tokens (SKILL.md is roughly 5.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to RAG Cite Sources?

Skills that share tags, products or a category with RAG Cite Sources: Sciverse (opendatalab/Sciverse-Agent-Tools, 120 stars), Tw Legal RAG (aa0101181514/tw-legal-rag, 328 stars), Scholar RAG (joshzyj/open-scholar-skill, 168 stars) and Local RAG Search (nkapila6/mcp-local-rag, 134 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains RAG Cite Sources?

lyonzin (a GitHub user) maintains it in lyonzin/knowledge-rag, which has 292 GitHub stars. The repository holds 10 skills in this directory. The repository was last updated on October 9, 2026.

Source: lyonzin/knowledge-rag on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.