rag-index

rag-index is a skill for Claude Code, Codex from brifl/coding-agent-orchestration. It costs 17 tokens per session (594 once invoked), scanned A, original, MIT.

Experimental tools for scanning a repository, building a searchable SQLite index, and retrieving relevant code or documentation for prompts. RAG means retrieval-augmented generation: finding useful project context before generating an answer.

In plain words
What is it for?
Use it to create repository manifests, build or update an index, search for terms, and format matching code chunks as prompt context.
Why use it?
It helps an agent locate relevant files and code sections without loading the entire repository. Incremental indexing updates only changed or removed files and chunks.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/brifl/coding-agent-orchestration/rag-index
Any agent
npx skills add brifl/coding-agent-orchestration --skill rag-index
Clone the repo
git clone --depth 1 https://github.com/brifl/coding-agent-orchestration

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 rag-index

README.md
[![agentmods](https://agentmods.dev/badge/skills/brifl/coding-agent-orchestration/rag-index.svg)](https://agentmods.dev/skills/brifl/coding-agent-orchestration/rag-index)
Your own site
<a href="https://agentmods.dev/skills/brifl/coding-agent-orchestration/rag-index"><img src="https://agentmods.dev/badge/skills/brifl/coding-agent-orchestration/rag-index.svg" alt="Measured on agentmods" height="20"></a>
Per session 17 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 594 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00017 $0.00594
Opus 5 $0.00009 $0.00297
Sonnet 5 $0.00003 $0.00119
Haiku 4.5 $0.00002 $0.00059

Measured 4d ago against content hash 7d936234ad52, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

rag-index 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 4d ago.

The scan reads SKILL.md. This mod also ships 5 executable files (chunker.py, indexer.py, retrieve.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.

.codex/skills/rag-index/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-index

Purpose

Prototype utilities for building a repo index used by retrieval-augmented prompts. The workflow is scan -> index -> retrieve, with a one-shot pipeline for ad-hoc use.

Scripts

  • scanner.py — recursive directory scanner that emits deterministic JSON manifests
  • indexer.py — chunk-aware SQLite index builder and lexical search (build, search)
  • retrieve.py — prompt-context formatter that consumes chunk-level search results (retrieve, pipeline)

How to use

  1. Generate a manifest (scanner):
    • python3 scanner.py <path1> <path2> --output manifest.json
    • Common options:
      • --file-types .py .md
      • --max-depth 2
      • --exclude "*.venv*" "*.git*"
      • --stats to print exclusion counts
  2. Build/update an index (indexer):
    • python3 indexer.py build --manifest manifest.json --output index.db
    • Incremental behavior:
      • unchanged files are skipped
      • changed files update only changed chunks
      • removed files/chunks are deleted
  3. Search the index (indexer):
    • python3 indexer.py search "query" --index index.db --top-k 5
    • Returns chunk-level records (path, rel_path, start_line, end_line, chunk_id, snippet)
  4. Retrieve prompt-ready context (retrieve):
    • python3 retrieve.py "query" --index index.db --top-k 5
    • Useful options:
      • --max-context-chars 8000 hard output budget
      • --max-per-file 3 diversity cap
      • --mode lex|sem|hybrid (sem uses TF-IDF cosine; hybrid blends lexical + semantic scores)
  5. One-shot pipeline (retrieve):
    • python3 retrieve.py pipeline "query" --dirs <path1> <path2>
    • Optional:
      • --index /tmp/rag.db to persist index
      • --max-depth 2
      • --file-types .py .md
    • This runs scan -> build -> retrieve in one command.

When to use RAG

Use RAG when:

  • the question depends on repository-specific behavior or contracts
  • the answer needs exact symbols, paths, config keys, or line ranges
  • the agent is uncertain and needs grounded evidence from code/docs

Read the full file on GitHub · 61 lines

Files

What ships with it

5 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. 4d ago First seen · 61 lines · 17 tokens per session scan A 7d936234ad52

Subscribe to this mod's changes

rag-index is a skill published in the GitHub repository brifl/coding-agent-orchestration (20 stars, last pushed 1mo ago), licensed MIT. It adds 17 tokens to every session and 594 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-08-30.

Related

Other skills, from other repositories

mem0-vercel-ai-sdk

Mem0 provider for Vercel AI SDK (@mem0/vercel-ai-provider). TRIGGER when: user mentions "vercel ai sdk", "@mem0/vercel-ai-provider", "createMem0", "retrieveMemories", "addMemories", "getMemories", "searchMemories", "mem0 vercel", "AI SDK provider", "AI SDK memory", or is using generateText/streamText with mem0. Also…

mem0ai/mem0 · 146 tokens

mem0-test-integration

Verify a Mem0 integration produced by /mem0-integrate. Runs in the same workspace on the same branch (loose coupling) — installs dependencies, runs the repo's native test suite, then exercises a real end-to-end smoke flow against the user's API key. Produces a scorecard. TRIGGER when: user has just run /mem0-integrate…

mem0ai/mem0 · 207 tokens

mem0-oss-to-platform

Plan and then execute a migration of a project from the mem0 open-source / self-hosted SDK (the local Memory class) to the mem0 Platform / hosted / managed SDK (the MemoryClient class). Use this whenever a developer wants to move, switch, or migrate their mem0 usage off OSS/self-hosted to the hosted API — e.g.…

mem0ai/mem0 · 273 tokens

graph-mutation-plan

Cookbook for composing an applygraphmutations plan — stable entitykey patterns, the canonical label/edge vocabulary, evidence/invalidation/confidence discipline, and a worked example. Load this when building a non-trivial mutation plan.

potpie-ai/potpie · 51 tokens

potpie-infra-architecture

Use for project infra and architecture context: environments, adapters, runtime configuration, deployments, service dependencies, datastores, API contracts, ownership, incidents, and dependency blast radius.

potpie-ai/potpie · 43 tokens

browserwing-admin

Manage and operate BrowserWing — an intelligent browser automation platform. Install dependencies, configure LLM, create/manage/execute automation scripts, use AI-driven exploration to generate scripts, browse the script marketplace, and troubleshoot issues.

MemTensor/MemOS · 47 tokens