How kaifalikhan-rgb/codebase-rag-system works
This is a Python-codebase RAG product: it indexes repositories into searchable semantic chunks, then answers code questions using retrieved chunks as grounded context. The primary workflow starts with a user query and passes through retrieval, context construction, and answer generation; a parallel API workflow accepts repository indexing requests and returns indexing status. Indexing tracks file hashes and repository metadata to support incremental re-indexing. The README also describes metadata-rich results, Top-K search, similarity thresholds, and latency measurement. Edges reflect the sampled calls and documented workflow; unsampled implementation details are not inferred.
Main entry points: indexer.py Index coordinator · app.py FastAPI routes · pipeline.py RAG pipeline · retriever.py Query retriever
Components 20
API and orchestration
- FastAPI routes
src/api/app.py - RAG pipeline
src/rag/pipeline.py
Repository indexing
- Index coordinator
src/indexing/indexer.py - Python file loader
src/ingestion/loader.py - Source reader
src/ingestion/reader.py - AST parser
src/parser/ast_parser.py - Semantic chunker
src/chunking/chunker.py - Embedding model
src/embeddings/embedder.py - Chunk export
src/utils/storage.py - File hashing
src/utils/file_hash.py
Semantic retrieval
- Query retriever
src/retrieval/retriever.py
Grounded answers
- Context builder
src/generation/context_builder.py - Answer generator
src/generation/llm_client.py
Persistent state
- ChromaDB chunks
src/storage/chroma_store.py - Index state
src/utils/index_state.py - Schema version
src/utils/schema_version.py - Repository registry
src/utils/repositories.py - Index status
src/utils/index_status.py
Other components
- User
- Gemini service
Connections 25
- User → FastAPI routes: submits request
src/api/app.py - FastAPI routes → Index coordinator: starts indexing
src/api/app.py - FastAPI routes → RAG pipeline: routes query
src/api/app.py - FastAPI routes → Repository registry: checks repositories
src/api/app.py - FastAPI routes → ChromaDB chunks: deletes chunks
src/api/app.py - FastAPI routes → Index state: deletes state
src/api/app.py - FastAPI routes → Index status: reads status
src/api/app.py - Index coordinator → Python file loader: loads files
src/indexing/indexer.py - Index coordinator → Source reader: reads source
src/indexing/indexer.py - Index coordinator → AST parser: parses source
src/indexing/indexer.py - Index coordinator → Semantic chunker: extracts chunks
src/indexing/indexer.py - Index coordinator → File hashing: hashes files
src/indexing/indexer.py - Index coordinator → Schema version: checks schema
src/indexing/indexer.py - Index coordinator → Index state: loads and saves
src/indexing/indexer.py - Index coordinator → Index status: sets status
src/indexing/indexer.py - Index coordinator → Repository registry: registers repository
src/indexing/indexer.py - Index coordinator → Chunk export: saves chunks
src/indexing/indexer.py - Index coordinator → Embedding model: embeds chunks
src/indexing/indexer.py - Index coordinator → ChromaDB chunks: upserts chunks
src/indexing/indexer.py - Query retriever → Embedding model: embeds query
src/retrieval/retriever.py - Query retriever → ChromaDB chunks: queries vectors
src/retrieval/retriever.py - RAG pipeline → Query retriever: retrieves chunks
src/rag/pipeline.py - RAG pipeline → Context builder: builds context
src/rag/pipeline.py - RAG pipeline → Answer generator: generates answer
src/rag/pipeline.py - Answer generator → Gemini service: requests completion
src/generation/llm_client.py