CLAUDE.md
Guides Claude Code through an offline RAG project, listing Makefile commands, architecture files, and configuration details for local LLM inference.
What this file does
Guides Claude Code through an offline RAG project, listing Makefile commands, architecture files, and configuration details for local LLM inference.
When to use it
- Onboarding to this RAG repository
- Setting up local development environment
- Understanding project structure and commands
- Configuring models and dependencies
Assumes this stack
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
Airgapped Offline RAG is a Retrieval-Augmented Generation (RAG) system for documents using local LLM inference. It uses Llama C++ for model inference, LangChain for orchestration, ChromaDB for vector storage, and Streamlit for the UI. The system is designed to work completely offline with GGUF quantized models.
Development Commands
Setup and Installation
make setup # Create virtual environment and install dependencies
make install # Install requirements only
make clean # Clean up virtual environment
Running the Application
make run # Run Streamlit app locally (runs: streamlit run app/main.py)
make docker-build # Build Docker image
make docker-run # Run Docker container
Testing and Code Quality
make test # Run pytest tests (PYTHONPATH=$(PWD) pytest tests/)
make precommit # Run pre-commit hooks (security checks, linting, formatting)
Key Architecture Components
Core Application Structure
- app/main.py: Streamlit UI entry point with custom dark theme CSS
- app/rag.py: RAG implementation with ChromaDB vector store and context retrieval
- app/document_processor.py: PDF processing and document chunking logic
- app/model_handler.py: LLM model loading and inference using Llama C++
- app/utils.py: Configuration loading and utilities
Configuration
- config.yaml: Main configuration file with model paths, RAG settings, and embedding configuration
- Model paths use environment variable substitution (e.g.,
${LLAMA_MODEL_PATH:-"default/path"}) - Supports Llama, Mistral, and Gemma models in GGUF format
- Configurable chunk size, overlap, and retrieval parameters
- Model paths use environment variable substitution (e.g.,
Testing
Tests use pytest and are located in tests/ directory. Each main module has a corresponding test file.
Dependencies and Environment
- Python 3.9 required (specified in runtime.txt)
- Key dependencies: llama-cpp-python, langchain, chromadb, streamlit, sentence-transformers
- Pre-commit hooks configured for security (gitleaks, detect-secrets), linting (flake8, black), and formatting
Models
Models should be placed in the models/ directory in GGUF format. The system supports:
- Llama 3 (8B) models
- Mistral (7B) models
- Gemma (2B) models
What's inside
6 sections: overview, 4 command groups, 3 architecture subsections, testing, dependencies, models. Includes 8 Make targets and 5 file references.
Change this for your project
- Replace
vincentkoc/airgapped-offline-ragwith your repository name - Replace
LLAMA_MODEL_PATHwith your model path variable - Replace
models/with your model directory - Replace
app/main.pywith your entry point
Where it goes
Save as CLAUDE.md in your repository root. Claude Code reads it automatically at the start of every session.
Related Documents
Code indexing for AI agents: summarization strategies and evaluation systems
Synthesises 2024-2025 research on code indexing for AI agents, covering summarisation strategies, hybrid retrieval architectures, and evaluation benchmarks.
Claude AI Git Workflow Integration
Recommends using the git-ai-commit CLI tool for AI-generated commit messages instead of manual ones.
Missing Business Agents Research — FLUXION 2026
Identifies 12 missing business operations agents for an indie software company and ranks them by impact and effort with €0 implementation plans.
角色:金牌面试者
Prompts Claude to act as a resume consultant, collecting user info and generating a polished A4-format React resume component with STAR-format experience.