High-performance RAG search tool for AI agents. 160ms keyword search, 5.1MB binary, 110MB memory.
Build Index Guide | API Service | Codebase Overview | 中文文档
Arag CLI is a RAG search tool designed for AI agents — not humans. It provides keyword search (BM25), semantic search (embeddings), and hybrid search (RRF fusion) for agentic RAG workflows. Built in Rust, 50x faster than the Python version.
- Keyword Search — BM25 with multi-keyword support and snippet extraction
- Semantic Search — Embedding-based retrieval via HTTP API
- Hybrid Search — BM25 + semantic RRF fusion with personalized ranking
- Structure-Aware Chunking — Tables and code blocks are atomic, never truncated
- Multi-KB Management — Create, switch, and manage multiple knowledge bases
- Incremental Updates — Auto-detect file changes via mtime/size diff
- Scheduled Auto-Update — Daemon mode for periodic index refresh
- Query Cache & History — JSONL-based cache with followup inference
- User Profile — Hot/cold chunk analysis, blind spot detection, adoption rate
- Agent Integration — JSON schema output,
--format textfor LLM consumption - REST API — FastAPI service wrapping all CLI commands
# Linux / macOS
curl -sSL https://github.com/KuaishouGameMind/arag-cli/releases/latest/download/install.sh | bash
# Windows (PowerShell)
Invoke-WebRequest -Uri https://github.com/KuaishouGameMind/arag-cli/releases/latest/download/install.bat -OutFile install.bat
.\install.batOr build from source (requires Rust 1.75+):
git clone https://github.com/KuaishouGameMind/arag-cli.git
cd arag-cli && cargo build --release
ln -sf "$(pwd)/target/release/arag-cli" ~/.cargo/bin/arag-cli# Set up embedding API (optional, semantic search will be unavailable without it)
export ARAG_EMBEDDING_BASE_URL="https://your-api.example.com/v1"
export ARAG_EMBEDDING_MODEL="your-model-name"
export ARAG_EMBEDDING_API_KEY="your-api-key"
# Build index from documents
arag-cli build-index --input-dir ./docs
# Keyword search
arag-cli keyword-search "warrior" "skill" -k 5
# Semantic search
arag-cli semantic-search "What are the sequences of the Warrior pathway" -k 5
# Read a chunk
arag-cli read-chunk "1850"
# Hybrid search (BM25 + semantic fusion)
arag-cli search "warrior pathway sequences" -k 10| Variable | Description |
|---|---|
ARAG_EMBEDDING_BASE_URL |
Embedding API address (optional, required for semantic/hybrid search) |
ARAG_EMBEDDING_MODEL |
Embedding model name |
ARAG_EMBEDDING_API_KEY |
Embedding API key (optional, required for semantic/hybrid search) |
ARAG_INDEX_DIR |
Index directory (overridable by -i) |
ARAG_KB |
Knowledge base name (overridable by --kb) |
ARAG_SESSION |
Session file path |
| Option | Description |
|---|---|
--kb <name> |
Specify knowledge base name |
-i, --index-dir <PATH> |
Directly specify index directory (highest priority) |
--format <json|text> |
Output format (default: json) |
--session <PATH> |
Session file path |
This project is based on the original arag project and the A-RAG paper.
@misc{du2026aragscalingagenticretrievalaugmented,
title={A-RAG: Scaling Agentic Retrieval-Augmented Generation via Hierarchical Retrieval Interfaces},
author={Mingxuan Du and Benfeng Xu and Chiwei Zhu and Shaohan Wang and Pengyu Wang and Xiaorui Wang and Zhendong Mao},
year={2026},
eprint={2602.03442},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2602.03442},
}MIT

