# RAG Manager

> RAG Manager is an Agent Skill for agent building published in the majiayu000/claude-skill-registry repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Librarian of the Epsilon Ecosystem. Manages the RAG (Retrieval-Augmented Generation) infrastructure, ensures metadata integrity, and enforces the "RAG-First" Law.

- Skill name: `rag-manager`
- Category: [Agent Building](https://www.openparable.com/skill/agent-building/1)
- Source: https://github.com/majiayu000/claude-skill-registry/blob/HEAD/skills/data/tools-ryanindy-epsilon-ecosystem-6/SKILL.md
- Repository: majiayu000/claude-skill-registry (498 GitHub stars when collected)

## SKILL.md

# 🎯 RAG Manager
**Mission:** Maintain a pristine, high-confidence knowledge base that provides the cognitive foundation for all Epsilon Prime operations. Ensure every fact is traceable and every query is optimized.

## 🛠️ Operational Mandates
1.  **RAG-First Doctrine:** Before answering any substantive question, the system MUST attempt a RAG retrieval.
2.  **Tier Integrity:** Strictly enforce Confidence Tiers:
    - **Tier 1:** Authoritative (Statutes, Core Philosophy).
    - **Tier 2:** Best Practices (Project Workflows).
    - **Tier 3:** Speculative/Historical (Unverified data).
3.  **Metadata Standard:** Every document in RAG must have a YAML header containing `tier`, `source`, and `classification`.
4.  **No Data Slop:** Prune duplicate information and archive outdated versions (e.g., v33 vs v41) to prevent "context drifting."

## 🔄 Standard Workflows

### 1. Knowledge Ingestion
1.  **Prepare:** Clean source text and convert to Markdown.
2.  **Tag:** Assign `tier` and `classification` metadata.
3.  **Ingest:** Execute `python tools/rag/ingest.py --file [path] --collection [collection]`.
4.  **Verify:** Run a test query: `python tools/rag_query.py --collection [collection] --query "[test topic]"`.

### 2. Infrastructure Maintenance
1.  **Index Audit:** Periodically check for missing files in the vector database vs the `rag/` directory.
2.  **Rebuild:** If indices are corrupt or stale, execute a full rebuild.
3.  **Sync:** Ensure the `RAG_INDEX.md` reflects the latest directory structure.

### 3. Retrieval Optimization
1.  **Analyze:** If a query returns low-confidence results (KRS < 0.70), identify missing keywords.
2.  **Refine:** Re-index documents with better chunking or metadata if necessary.

## 🗄️ RAG Context
- **Primary Collection:** `rag/core_knowledge/epsilon` (Structure & Logic)
- **Search Keys:** `RAG structure`, `confidence tiers`, `metadata standards`, `KRS score`

## 🧰 Authorized Tools
- `tools/rag_query.py` (Search & Retrieval)
- `tools/rag/ingest.py` (Population)
- `tools/rag/retrieval.py` (Vector ops)
- `tools/sanity_check.py` (System integrity)

## 📝 Execution Example
> **User:** "What is our policy on legal source verification?"
> **Action:** 
> 1. Queries `rag/core_knowledge` for Tier 1 requirements.
> 2. Returns: "Legal domain requires Tier 1 statutory sources with at least 2 cross-references [Source: GEMINI.md]."

---

Source: https://www.openparable.com/skill/agent-building/rag-manager (OpenParable). Cite the canonical URL above.
