rebuild-rag

Rebuilds and verifies per-model ChromaDB and NetworkX RAG indexes for A2MC.

Updated Aug 28, 2026
One-click install
npx skills add https://github.com/jingtao-lbl/A2MC --skill rebuild-rag-jingtao-lbl
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: rebuild-rag
Source: https://github.com/jingtao-lbl/A2MC/tree/main/.claude/skills/rebuild-rag
Command: npx skills add https://github.com/jingtao-lbl/A2MC --skill rebuild-rag-jingtao-lbl

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires chromadb, sentence-transformers, networkx.

What problem does it solve? A2MC's ReasoningModule queries a RAG/GraphRAG index before every Claude API call, but each onboarded model (FATES, EcoSIM, PFLOTRAN) has its own build script with incompatible flags, and rebuilds silently fail in several ways: the wiki loader probes the wrong directory, incremental adds skip changed content, and the chroma.sqlite3 skip-worktree flag means git add stages nothing so a rebuilt index is never committed. ## Core Features & Use Cases - Per-model build routing: Selects the correct builder (build_rag_index.py, build_ecosim_rag.py, build_pflotran_rag.py) with its exact flag set, since flags like --graph-only and --allow-shrink are not portable across models. - Rebuild mode decision tree: Distinguishes graph-only rebuilds after curated YAML edits, full rebuilds after CDL changes, and Recipe 1 symlink redirection when bumping the wiki to a new commit-pinned tree. - Verification and commit procedure: Runs model-routed golden-query and seed-coverage checks, then un-skips the skip-worktree bit on chroma.sqlite3 before committing so the new vector index actually lands in git. - Use Case: After editing curated_relationships.yaml for the PFLOTRAN profile, run a full rebuild (PFLOTRAN has no --graph-only), verify with check_ecosim_rag_queries.py, and commit the index with the skip-worktree workaround. ## Quick Start Ask the agent to rebuild the RAG index for your model profile, for example by saying "rebuild the EcoSIM RAG index and commit the result".

Frequently Asked Questions about rebuild-rag

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I rebuild the RAG index for EcoSIM or PFLOTRAN?▼

Each model has its own build script: `build_ecosim_rag.py` for EcoSIM and `build_pflotran_rag.py` for PFLOTRAN, run with `--rebuild`. Flag sets differ per model, so do not copy FATES commands; PFLOTRAN has no `--graph-only` option.

Why did my RAG rebuild not get committed to git?▼

The chroma.sqlite3 file carries a skip-worktree flag, so `git add` stages nothing without error. Run `git update-index --no-skip-worktree` on the file before adding, commit, then re-arm the flag afterward.

What is the difference between --rebuild and --graph-only?▼

A full `--rebuild` re-embeds all documents into ChromaDB and rebuilds the graph, taking about two minutes. `--graph-only` skips re-embedding and only regenerates the NetworkX graph after curated YAML edits, completing in seconds.

Why does the rebuilt index still contain old wiki content?▼

The loader probes wiki directory names and stops at the first match, so a legacy directory shadows the new commit-pinned tree. Create a symlink from the expected directory name to the new commit-pinned tree before rebuilding.

How do I verify a RAG rebuild produced correct content?▼

Run the golden-query test routed by model: `check_rag_queries.py` for FATES profiles or `check_ecosim_rag_queries.py` for adapter models, plus `validate_seed_coverage.py` on the profile's seed file. Also check document, node, and edge counts against expected values.

Which Python interpreter should run the RAG build scripts?▼

On Mac use Python 3.10 from python.org, since Homebrew 3.12 fails on PEP-668. On Perlmutter use `~/a2mc_env/bin/python` (3.11), which is verified to import chromadb and sentence_transformers.