Skip to main content

RAGrep

RAGrep is a dead-simple local semantic recall tool for code and text files.

It uses:

  • mxbai-embed-large embeddings in-process (no server)
  • a single local SQLite database file: .ragrep.db

No ChromaDB. No remote API keys.

Install

pip install ragrep

Embedding Model Storage

RAGrep downloads the embedding model automatically on first use.

Default model directories:

  • Linux: ~/.config/ragrep/models
  • macOS: ~/Library/Application Support/ragrep/models
  • Windows: %APPDATA%\\ragrep\\models

Override with:

  • env var: RAGREP_MODEL_DIR
  • CLI flag: --model-dir
  • Python API: RAGrep(model_dir="...")

GPU Usage

RAGrep can use GPU for embeddings when available.

  • Default behavior: RAGREP_DEVICE=auto (prefers cuda, then mps, then cpu)
  • Override via env: RAGREP_DEVICE=cpu|cuda|mps|cuda:0
  • Override via CLI: --device ...
  • Override via Python API: RAGrep(embedding_device="...")
  • Note: GPU usage requires a GPU-capable PyTorch build in your environment.
  • Check runtime GPU support: ragrep --check-gpu (or ragrep --check-gpu --json)

CLI Usage

Recall is the default command.

# Implied recall (auto-indexes when needed)
ragrep "authentication middleware"

# Explicit recall (same behavior)
ragrep recall "authentication middleware"

# Build/update index manually
ragrep index .

# Show stats
ragrep stats

# Stats alias
ragrep --stats

When --path is omitted, auto-indexing uses the previously indexed root if one exists; otherwise it uses the current directory.

Indexing is incremental by default:

  • new files are added
  • modified files are re-embedded
  • removed files are deleted from the index

CLI runs that index files print newly indexed file paths to stdout.

Useful flags:

ragrep "query text" --path . --limit 10 --db-path ./.ragrep.db
ragrep "query text" --model-dir ~/.config/ragrep/models --json
ragrep "query text" --device auto
ragrep index . --force

Python Usage

from ragrep import RAGrep

rag = RAGrep(
    db_path="./.ragrep.db",
    embedding_model="mxbai-embed-large",
    embedding_device="auto",
)
rag.index(".")

result = rag.recall("database transactions", limit=5)
for match in result["matches"]:
    print(match["score"], match["metadata"]["source"])

print(rag.stats())
rag.close()

Library methods:

  • index(path=".", force=False)
  • recall(query, limit=20, path=".", auto_index=True)
  • stats()

Backwards-compatible aliases still available:

  • RAGSystem (alias of RAGrep)
  • dump(...) (alias of recall(..., auto_index=False) result list)

Local Database

RAGrep stores everything in one SQLite file (default ./.ragrep.db):

  • indexed files and mtimes
  • chunked source text
  • embedding vectors
  • index metadata (model, chunk settings, root path)

Development

pip install -e .[dev]
python -m unittest discover -s tests -p 'test_*.py'
python -m build
twine check dist/*

License

MIT

Metadata

Release files for ragrep 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ragrep 0.2.3
File Size Uploaded Provenance
ragrep-0.2.3.tar.gz 24.1 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ragrep 0.2.3
File Interpreter ABI Platform
ragrep-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 44.8 kB

Release files / ragrep-0.2.3.tar.gz

Download URL ragrep-0.2.3.tar.gz
Size 24.1 kB
Tags Source
SHA-256 checksum
How to use checksums
aaac67101d542e585aab9e7fe652dad8f6c97d5585fb16002f2d9070b1885e1c
BLAKE2b-256 checksum
How to use checksums
709f0c386419b6c9aec7df6089a8fed9035b726b60ff3d040e2840c7fb3e9039
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 12, 2026.

Transparency log

Release files / ragrep-0.2.3-py3-none-any.whl

Download URL ragrep-0.2.3-py3-none-any.whl
Size 20.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1935ed15c340d6cd142a13b7bb8326233f7bae6760bc8c7a374c860bcc5a37aa
BLAKE2b-256 checksum
How to use checksums
24bc5546659aa6f7da3c3b6a9bafa915403567dec18df646190129a70eab32bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 12, 2026.

Transparency log

Security for ragrep 0.2.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ragrep-0.2.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page