portable-rag-per-skill

portable-rag-per-skill is a skill for Claude Code, Codex from moonlight-lupin/agent-skills. It costs 29 tokens per session (3,061 once invoked), scanned A, original, MIT.

A pattern for putting a retrieval-augmented generation index inside each skill, so the skill can search its own reference documents without a shared database.

In plain words
What is it for?
It helps build portable, domain-specific document indexes with local storage, direct search calls, and optional database or API-key overrides.
Why use it?
It makes skills easier to move between machines and avoids requiring a separately configured database or server.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: positional $N argument.

Good fit It helps build portable, domain-specific document indexes with local storage, direct search calls, and optional database or API-key overrides.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/moonlight-lupin/agent-skills/portable-rag-per
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 moonlight-lupin/agent-skills --skill portable-rag-per
Clone the repo
git clone --depth 1 https://github.com/moonlight-lupin/agent-skills

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 portable-rag-per-skill

README.md
[![agentmods](https://agentmods.dev/badge/skills/moonlight-lupin/agent-skills/portable-rag-per/github.svg)](https://agentmods.dev/skills/moonlight-lupin/agent-skills/portable-rag-per)
Your own site
<a href="https://agentmods.dev/skills/moonlight-lupin/agent-skills/portable-rag-per"><img src="https://agentmods.dev/badge/skills/moonlight-lupin/agent-skills/portable-rag-per/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 portable-rag-per-skill

Your own site · 80×15
<a href="https://agentmods.dev/skills/moonlight-lupin/agent-skills/portable-rag-per"><img src="https://agentmods.dev/badge/skills/moonlight-lupin/agent-skills/portable-rag-per.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 29 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,061 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.00029 $0.03061
Opus 5 $0.00015 $0.01530
Sonnet 5 $0.00006 $0.00612
Haiku 4.5 $0.00003 $0.00306

Measured 7d ago against content hash 954ed92e2de1, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

portable-rag-per-skill 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 7d 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.

research/library-rag/references/portable-rag-per-skill.md · 304 lines

How it starts

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

Portable RAG: Per-Skill Standalone Index

The default library-rag setup uses a shared DB at ~/.hermes/library/rag_index.db with an MCP server registered in config.yaml. This is good for a permanent library but creates two problems for skills that should be self-contained:

  1. Not portable — moving the skill to another machine breaks the DB path
  2. MCP dependency — requires config.yaml registration, not self-contained

The Portable Pattern

Instead of the shared DB + MCP approach, create a standalone RAG index inside the skill's own references/ directory:

Key Differences from Library RAG

Aspect Library RAG Portable RAG
DB location ~/.hermes/library/rag_index.db <skill>/references/rag_index.db
Path resolution Hardcoded LIBRARY_ROOT Path(__file__).resolve().parent.parent
DB override None --db flag or env var
API key .env only NVIDIA_API_KEY env var OR .env (OpenRouter key as fallback)
MCP server Yes (config.yaml dependency) No — import rag_query.search() directly
Chunker Source-specific Domain-specific (headings, sections, etc.)
Portable No Yes — zip the folder, drop on another machine, done

Implementation: Path Resolution

# All paths resolve from the script's own location — no hardcoded paths
SKILL_DIR = Path(__file__).resolve().parent.parent
REFERENCES_DIR = Path(os.environ.get('SKILL_REFERENCES_DIR', SKILL_DIR / 'references'))
DB_PATH = Path(os.environ.get('SKILL_RAG_DB', REFERENCES_DIR / 'rag_index.db'))
ENV_PATH = os.environ.get('HERMES_ENV', os.path.expanduser('~/.hermes/.env'))

Implementation: API Key Loading

def load_api_key():
    # Prefer NVIDIA NIM key; fall back to legacy OpenRouter key
    for env_var in ('NVIDIA_API_KEY', 'OPENROUTER_API_KEY'):
        key = os.environ.get(env_var)
        if key:
            return key
    env_path = Path(ENV_PATH)
    if env_path.exists():
        for line in env_path.read_text().splitlines():
            if line.startswith('#') or '=' not in line:
                continue
            name, _, value = line.partition('=')
            if name.strip() in ('NVIDIA_API_KEY', 'OPENROUTER_API_KEY'):
                return value.strip().strip('"').strip("'")
    raise ValueError(f"No NVIDIA_API_KEY (or OPENROUTER_API_KEY) found in env or {ENV_PATH}")

Read the full file on GitHub · 304 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. 7d ago First seen · 304 lines · 29 tokens per session scan A 954ed92e2de1

Subscribe to this mod's changes

portable-rag-per-skill is a skill published in the GitHub repository moonlight-lupin/agent-skills (62 stars, last pushed 4d ago), licensed MIT. It adds 29 tokens to every session and 3,061 once invoked, about $0.0001 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-09-04.

Related

Other skills, from other repositories

mnemosyne-maintenance

Use when: upgrading Mnemosyne, diagnosing slow/hung consolidation (mnemosynesleep), fixing missing embeddings, or troubleshooting import/version mismatches.

AtlasOmnia/hermes-custom-pack · 40 tokens

rag-construction

Build RAG systems for construction knowledge bases. Create searchable AI-powered construction document systems.

datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction · 20 tokens

vector-search

Implement semantic vector search for construction data. Build AI-powered search using embeddings and vector databases (Qdrant, ChromaDB) for intelligent querying of specifications, standards, and project documents.

datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction · 41 tokens

semantic-search-cwicr

Semantic search in the DDC CWICR construction cost database using vector embeddings (BGE-M3, 1024-dim, per-language Qdrant collections). Find similar work items and resources for cost estimation across 8 national bases and 30 markets in 26 languages.

datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction · 63 tokens

neurolink-guide

Guide for using the NeuroLink SDK and CLI. Invoke when users ask how to use neurolink, integrate AI providers, add MCP tools, configure RAG, set up memory, deploy servers, or work with multimodal content. Covers SDK, CLI, providers, tools, and enterprise features.

juspay/neurolink · 65 tokens

haystack

Build production search and NLP pipelines with Haystack. Pipeline DAG composition, document stores, retrievers, PromptBuilder (Jinja2), generators, evaluation, Hayhooks deployment. Use when building search pipelines or comparing NLP application frameworks. Do not use this skill for unrelated requests; route to the…

magnus919/agent-skills · 65 tokens