library-rag

library-rag is a skill for Claude Code, Codex from moonlight-lupin/agent-skills. It costs 54 tokens per session (4,930 once invoked), scanned A, original, MIT.

A meaning-based search system for a personal collection of books and documents. It can convert EPUB and PDF files into searchable text and uses an MCP server to expose the search tools.

In plain words
What is it for?
Indexing a personal text library, searching it with natural-language questions, checking index statistics, and adding books or documents.
Why use it?
It finds relevant passages by meaning rather than requiring the exact words used in the source material.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: names the AskUserQuestion tool; positional $N argument.

Good fit Indexing a personal text library, searching it with natural-language questions, checking index statistics, and adding books or documents.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/moonlight-lupin/agent-skills/library-rag
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 library-rag
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 library-rag

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/moonlight-lupin/agent-skills/library-rag"><img src="https://agentmods.dev/badge/skills/moonlight-lupin/agent-skills/library-rag.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 54 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,930 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 warn 7 Sept 2026
SkillSpector: 9 findings, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Privilege Escalation · line 44
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
  • high Privilege Escalation · line 44
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
  • high Prompt Injection · line 353
    Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.
    Fix: Audit all comments and invisible characters. Remove any instructions that direct the agent to perform unauthorized actions. Use plain, reviewable content.
  • high Prompt Injection · line 389
    Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.
    Fix: Audit all comments and invisible characters. Remove any instructions that direct the agent to perform unauthorized actions. Use plain, reviewable content.
  • medium Rogue Agent · line 49
    Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
    Fix: Remove any persistence mechanisms (cron jobs, startup scripts, state files). Skills should not maintain state across sessions without explicit user consent.
  • medium Rogue Agent · line 84
    Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
    Fix: Remove any persistence mechanisms (cron jobs, startup scripts, state files). Skills should not maintain state across sessions without explicit user consent.
  • medium Rogue Agent · line 115
    Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
    Fix: Remove any persistence mechanisms (cron jobs, startup scripts, state files). Skills should not maintain state across sessions without explicit user consent.
  • medium Rogue Agent · line 122
    Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
    Fix: Remove any persistence mechanisms (cron jobs, startup scripts, state files). Skills should not maintain state across sessions without explicit user consent.
  • medium Rogue Agent · line 284
    Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
    Fix: Remove any persistence mechanisms (cron jobs, startup scripts, state files). Skills should not maintain state across sessions without explicit user consent.
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.00054 $0.04930
Opus 5 $0.00027 $0.02465
Sonnet 5 $0.00011 $0.00986
Haiku 4.5 $0.00005 $0.00493

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

Security

Grade A, and why

library-rag 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 10d ago.

The scan reads SKILL.md. This mod also ships 14 executable files (scripts/convert_epub_library.py, scripts/convert_pdf_library.py, scripts/mcp_server.py, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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/SKILL.md · 395 lines

How it starts

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

Library RAG

Semantic search over ~/.hermes/library/ using Nemotron-3-Embed-1B embeddings (via NVIDIA NIM) stored in sqlite-vec. Enables meaning-based retrieval across any text corpus — books, documents, reference works — in any language.

Architecture

NVIDIA NIM API (nemotron-3-embed-1b, 2048-dim)
        │
        ▼
~/.hermes/library/rag_index.db (sqlite-vec)
  ├── chunks table      — text + metadata (source, book, chapter, section)
  ├── vec_chunks table  — L2-normalized vector embeddings
  └── indexed_files     — SHA-256 hash tracking for incremental updates

MCP Server (mcp_server.py)
  ├── search(query, top_k, source_type)  — semantic search, auto-available
  ├── stats()                             — index statistics
  └── add_book(file_path, ...)            — EPUB/PDF → md → index in one call

Onboarding workflow (run this the first time a user sets up the skill)

When a user wants to start using Library RAG, walk them through this sequence. Use AskUserQuestion for the decisions marked ASK — don't assume paths or silently create directories outside the home folder.

Step 1 — Check prerequisites

python3 --version                                   # need 3.9+
python3 -c "import sqlite_vec; print('sqlite-vec ok')" 2>&1
test -n "$NVIDIA_API_KEY" && echo "key in env" || grep -qs NVIDIA_API_KEY ~/.hermes/.env && echo "key in .env" || echo "NO API KEY"
  • If sqlite-vec import fails → run pip install -r requirements.txt (add --break-system-packages on externally-managed Python). See README "Installation".
  • If NO API KEY → help the user create a free NVIDIA NIM key at https://build.nvidia.com/nvidia/nemotron-3-embed-1b, then store it: echo 'NVIDIA_API_KEY=nvapi-...' >> ~/.hermes/.env. (Legacy OpenRouter keys still work: if only OPENROUTER_API_KEY is set, load_api_key() auto-switches to the bge-m3 OpenRouter endpoint.)

Step 2 — Define directories (ASK)

Three locations drive everything. Confirm them with the user and export the env vars (persist in their shell profile). Defaults in parentheses:

Read the full file on GitHub · 395 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. 10d ago First seen · 395 lines · 54 tokens per session scan A 5db12af0f461

Subscribe to this mod's changes

library-rag is a skill published in the GitHub repository moonlight-lupin/agent-skills (60 stars, last pushed 3d ago), licensed MIT. It adds 54 tokens to every session and 4,930 once invoked, about $0.0003 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

document-qa

A document question-and-answer tool for PDFs, Word files, text, Markdown, CSV, and Excel files. It finds relevant passages in one file or a whole folder and uses a language model to answer questions.

xyva-yuangui/XyvaClaw · 53 tokens

rag-knowledge-base

A local document search system that lets you add PDFs, Word files, Excel files, Markdown, and text, then ask questions about their contents. It finds relevant passages using both meaning-based and keyword search, then prepares context for an AI model.

xyva-yuangui/XyvaClaw · 0 tokens

compact-yaml-frontmatter

How to design lean, high-density YAML frontmatter for documentation, skills, and RAG knowledge bases, eliminating 70% of header token bloat.

alivirgo/Major-AI-Skills · 37 tokens

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

azure-ai-contentunderstanding-py

Azure AI Content Understanding SDK for Python. Use for multimodal content extraction from documents, images, audio, and video.

Ghosteken/agent-harness · 32 tokens

markitdown

Convert heterogeneous documents and selected URIs to Markdown with Microsoft MarkItDown for text analysis, search, and LLM/RAG ingestion. Covers safe local conversion, streams, Office/PDF/data formats, batch workflows, plugins, vision OCR, Azure extraction, and the official MCP server.

K-Dense-AI/scientific-agent-skills · 61 tokens