build-rag-from-scratch

Constructs the RAG and GraphRAG knowledge layer from scratch for new or existing models.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When the ChromaDB vector index, the NetworkX knowledge graph, or their upstream inputs (codebase wiki, CDL files, curated YAML, parsers) are missing, there is no single procedure to rebuild the entire knowledge layer. This Skill orchestrates that full construction, covering both disaster-recovery reconstruction of an existing model's layer and bootstrapping a brand-new model into A2MC. ## Core Features & Use Cases - Two construction paths: Path R reconstructs an existing model's index from commit-pinned inputs (reproducibility contract); Path N bootstraps a new model (e.g., EcoSim, ReSOM) through 12 steps including per-model parsers, curated YAML, and loader registration. - Orchestrates sub-skills: Sequences generate-codebase-wiki, the build_rag_index.py invocation, inject-knowledge authoring discipline, and validate-rag-chain, while owning the glue none of them cover. - Verification gate: Proves both the vector index and the graph built correctly via get_stats and find_parameters_for_output checks, catching silent half-builds where the graph is empty. - Use Case: A collaborator wants to add EcoSim to A2MC. This Skill walks through creating the KB directory, generating the wiki, writing parameter/output parsers, authoring curated relationships YAML, building into a separate persist dir, and validating the chain. ## Quick Start Ask the agent to build the RAG and GraphRAG knowledge layer from scratch for your model, specifying whether you are reconstructing an existing model's index or onboarding a new model.

Frequently Asked Questions about build-rag-from-scratch

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

FAQPage Schema
How do I build a RAG knowledge base from scratch for a new model?▼

Follow the 12-step Path N: create the KB directory, generate a commit-pinned codebase wiki, produce parameter and output CDLs, write per-model parsers, author curated relationships YAML, register the loader, and build into a separate persist directory. Finish by verifying both layers and running chain validation.

How do I rebuild a ChromaDB index after a fresh clone?▼

Use Path R: confirm the commit-pinned wiki, both CDLs, and curated YAML exist, point the loader at the correct wiki tree, then run build_rag_index.py with the rebuild flag. Verify both the vector index and the knowledge graph afterward.

What is the difference between building RAG from scratch and reindexing?▼

Building from scratch handles cases where the index or its upstream inputs (wiki, CDLs, parsers, curated YAML) do not exist yet. Reindexing with rebuild-rag only applies when all inputs already exist and you just need to regenerate the indexes from them.

Why does my RAG build have vector documents but an empty knowledge graph?▼

This silent half-build happens when the curated YAML or CDL parsing fails, so only the vector index populates. Check get_stats for zero graph nodes or edges, and confirm parameter and output names in the YAML exactly match the CDLs.

Which Python version is required to build the RAG index?▼

Use Python 3.10 for all build steps. Homebrew Python 3.12 fails due to PEP-668 externally-managed-environment restrictions, so the workflow pins a specific Python 3.10 interpreter.

How long does it take to bootstrap a knowledge base for a new model?▼

The index build itself takes about two minutes with local embeddings, but wiki generation takes 30 to 90 minutes. Writing per-model parsers and the curated relationships YAML is the real cost, typically days of work for a first usable build.