Single file RAG (ChromaDB) with hybrid search, smart chunking, and normalized scoring. Enterprise-grade quality with comprehensive testing and security enhancements.
Download raggy.py (or the raggy launcher) and place it in the root of your project. All you need to do next is put all your documents for the RAG inside a ./docs folder and build the RAG using the command line.
Supported file formats: .md (Markdown), .pdf (PDF), .docx (Word), .txt (Plain text)
# First-time setup (required) python raggy.py init # Initialize environment and install dependencies # Basic usage python raggy.py build # Index your docs python raggy.py search "your query" # Search with normalized scores # Or use the portable launcher (auto-manages venv & deps): ./raggy build ./raggy search "your query" # Enhanced features python raggy.py search "term" --hybrid # Hybrid semantic + keyword search python raggy.py search "api" --expand # Query expansion python raggy.py search "fix" --path docs/CHANGELOG.md # Filter by path python raggy.py optimize # Benchmark search modes # Quality assurance (new!) python raggy.py test # Run built-in self-tests python raggy.py diagnose # Check system health python raggy.py validate # Verify configuration python raggy.py compact # Archive aged docs and refresh index python raggy.py compact --yes # Compact without confirmation (for scripts) # Version management python raggy.py --version # Show current version # (Automatic update notifications shown once per day when available)
-
Copy the example config:
cp raggy_config_example.yaml raggy_config.yaml
-
Customize the
expansionssection with your domain terms:search: expansions: myterm: ["myterm", "synonym1", "synonym2"] acronym: ["acronym", "full phrase"]
-
Use expanded search:
python raggy.py search "myterm" --expand
Raggy automatically checks for updates once per day (non-intrusive):
# When an update is available, you'll see:
π¦ Raggy update available: v2.1.0 β https://github.com/dimitritholen/raggy/releases/latestTo disable update checks, add to your raggy_config.yaml:
updates: check_enabled: false
Privacy: Update checks are anonymous GitHub API calls. No tracking or personal data is sent.
π‘ TIP: Instead of manually creating expansions, let AI extract domain-specific terms from your documents and generate the config for you! Ask Claude or ChatGPT:
"Analyze my documentation and create raggy_config.yaml expansions for these terms: [list key terms from your docs]".
Or go full-automatic with:
"Analyze my documentation in ./docs/ and its subfolders and create raggy_config.yaml expansions for the most important terms. Do not go overboard, so keep it strategic. Do it step by step. Ultrathink."
This saves time and ensures you capture the right synonyms and related concepts.
- Hybrid Search: Combines semantic + BM25 keyword ranking for precise results
- Smart Chunking: Markdown-aware document processing with boundary detection
- Normalized Scoring: 0-1 scores with quality labels (Excellent/Good/Fair/Poor)
- Query Expansion: Automatic synonym expansion for domain-specific terms
- Model Presets: fast/balanced/multilingual/accurate options for different needs
- Multi-Format: Supports
.md,.pdf,.docx,.txtdocuments
- Built-in Testing: Self-diagnostics with
python raggy.py test - System Health: Comprehensive diagnostics with
python raggy.py diagnoseand detailed status withpython raggy.py status - Security Hardened: Path validation, input sanitization, secure hashing
- Type Safe: Full type hints for better IDE support and error prevention
- Performance Optimized: Streaming file processing and pre-compiled regex patterns
- Comprehensive Testing: 85%+ test coverage with unit and integration tests
- Universal: Drop into any project - just copy
raggy.py(orraggy) - π° Completely Free: No API costs - everything runs locally
- π 100% Private: Your documents never leave your machine
- β‘ Fast Setup: One command initialization with automatic dependency management
- π Auto-Updates: Non-intrusive update notifications (once per day, easily disabled)
π Zero Cost Forever
- No API tokens, no monthly fees, no usage limits
- Run unlimited searches on unlimited documents
- Perfect for developers, students, and cost-conscious teams
π 100% Local & Private
- Your documents never leave your machine
- No internet required after initial setup
- No rate limits or API downtime
- Full control over your data and processing
β‘ Blazing Fast
- Local search = instant results
- No network latency or API delays
- Process thousands of documents without breaking the bank
vs. Cloud RAG Services:
- Cloud RAG: $$/year for typical usage
- Raggy: 0γγ«/year forever
- That's β% savings! π
- Python 3.8+ (tested on 3.8-3.12)
uvpackage manager (installation guide)- 5-10MB disk space for dependencies (everything installs locally)
-
Install uv (if not already installed):
# On macOS/Linux: curl -LsSf https://astral.sh/uv/install.sh | sh # On Windows: # Download and run installer from https://astral.sh/uv/getting-started/installation/
-
Initialize the project:
python raggy.py init
This will:
- Create a virtual environment (
.venv) - Generate
pyproject.toml - Install all dependencies
- Create a
docs/directory
- Create a virtual environment (
-
Add your documents to the
docs/directory
Supported formats:.md,.pdf,.docx,.txt -
Index your documents:
python raggy.py build # Or: ./raggy build -
Start searching:
python raggy.py search "your query" # Or: ./raggy search "your query"
Raggy includes comprehensive testing and diagnostic tools:
python raggy.py test # Run core functionality tests python raggy.py diagnose # Check system health and dependencies python raggy.py validate # Verify configuration settings
# Install development dependencies pip install -r requirements-dev.txt # Run comprehensive test suite pytest tests/ --cov=raggy # Run code quality checks ruff check raggy.py # Linting ruff format raggy.py # Code formatting mypy raggy.py # Type checking bandit raggy.py # Security scan
See TESTING.md for detailed testing documentation.
- β Multi-Python Testing: Automated testing on Python 3.8-3.12
- β Security Scanning: Vulnerability detection with Bandit and Safety
- β Code Quality: Linting, formatting, and type checking
- β Performance Testing: Benchmark validation and optimization checks
- SHA256 hashing replaces MD5 for file integrity
- Path validation prevents directory traversal attacks
- Input sanitization with file size limits (100MB max)
- Error message sanitization prevents information leakage
- 15-30% faster search with pre-compiled regex patterns
- Streaming file processing for large documents
- Optimized memory usage with chunked file operations
- Enhanced BM25 scoring with improved tokenization
- Portable Launcher: New
./raggyscript for zero-config execution (auto-manages venv & dependencies)
- 85%+ test coverage with comprehensive test suite
- Built-in diagnostics for troubleshooting and validation
- Security scanning with automated vulnerability detection
- Multi-version compatibility testing (Python 3.8-3.12)
- Full type hints for better IDE support and error prevention
- Comprehensive error handling with specific exception types
- Improved documentation with testing guides and examples
- CI/CD pipeline with automated quality checks
Backward Compatible: All existing raggy v1.x commands work unchanged!
Raggy is designed to work seamlessly with AI coding agents (Claude, Cursor, Windsurf, etc.). To enable Knowledge-Driven Development, you must provide your agent with the "operating protocol" defined in AGENTS.md.
AGENTS.md is not just a set of instructions; it is the cortex of your AI developer. It solves the "Cold Start" problem where agents lack context about your project's history, architecture, and active state.
By including AGENTS.md in your agent's system prompt or rules, you ensure:
- Context Awareness: The agent explicitly gathers context from
CURRENT_STATE.mdand RAG search before writing code. - Architectural Consistency: It enforces adherence to established patterns found in your documentation.
- Living Memory: It forces the agent to update
CURRENT_STATE.mdandCHANGELOG.md, creating a continuous loop of knowledge preservation.
- Copy the content of AGENTS.md.
- Paste it into your agent's custom instructions file:
- Cursor:
.cursorrules - Windsurf:
~/.codeium/windsurf/memories(or project-specific rules) - Claude Projects: Project Instructions
- General LLMs: Paste it at the start of your session.
- Cursor:
β οΈ IMPORTANT: Without this protocol, your agent is just a smart code generator. WITH this protocol, it becomes a strategic partner that maintains your project's long-term health.