Free Local RAG for Claude Code - Save Tokens & Time 日本語版はこちら | Japanese Version DevRag is a lightweight RAG (Retrieval-Augmented Generation) system designed specifically for developers using Claude Code. Stop wasting tokens by reading entire documents - let vector search find exactly what you need. When using Claude Code, reading documents with the Read tool consumes massive amounts of tokens: - ❌
Add this skill
npx mdskills install tomohiro-owada/devragProduction-ready RAG system with excellent docs, semantic search, and multi-platform support
Free Local RAG for Claude Code - Save Tokens & Time
DevRag is a lightweight RAG (Retrieval-Augmented Generation) system designed specifically for developers using Claude Code. Stop wasting tokens by reading entire documents - let vector search find exactly what you need.
When using Claude Code, reading documents with the Read tool consumes massive amounts of tokens:
With DevRag:
Get the appropriate binary from Releases:
| Platform | File |
|---|---|
| macOS (Apple Silicon) | devrag-macos-apple-silicon.tar.gz |
| macOS (Intel) | devrag-macos-intel.tar.gz |
| Linux (x64) | devrag-linux-x64.tar.gz |
| Linux (ARM64) | devrag-linux-arm64.tar.gz |
| Windows (x64) | devrag-windows-x64.zip |
macOS/Linux:
tar -xzf devrag-*.tar.gz
chmod +x devrag-*
sudo mv devrag-* /usr/local/bin/devrag
Windows:
C:\Program Files\devrag\)Add to ~/.claude.json or .mcp.json:
{
"mcpServers": {
"devrag": {
"type": "stdio",
"command": "/usr/local/bin/devrag"
}
}
}
Using a custom config file:
{
"mcpServers": {
"devrag": {
"type": "stdio",
"command": "/usr/local/bin/devrag",
"args": ["--config", "/path/to/custom-config.json"]
}
}
}
mkdir documents
cp your-notes.md documents/
That's it! Documents are automatically indexed on startup.
In Claude Code:
"Search for JWT authentication methods"
Create config.json:
{
"document_patterns": [
"./documents",
"./notes/**/*.md",
"./projects/backend/**/*.md"
],
"db_path": "./vectors.db",
"chunk_size": 500,
"search_top_k": 5,
"compute": {
"device": "auto",
"fallback_to_cpu": true
},
"model": {
"name": "multilingual-e5-small",
"dimensions": 384
}
}
document_patterns: Array of document paths and glob patterns
"./documents""./docs/**/*.md" (recursive)documents_dir field is still supported (automatically migrated)db_path: Vector database file pathchunk_size: Document chunk size in characterssearch_top_k: Number of search results to returncompute.device: Compute device (auto, cpu, gpu)compute.fallback_to_cpu: Fallback to CPU if GPU unavailablemodel.name: Embedding model namemodel.dimensions: Vector dimensions--config : Specify a custom configuration file path (default: config.json)Example:
devrag --config /path/to/custom-config.json
This is useful for:
{
"document_patterns": [
"./documents", // All .md files in documents/
"./notes/**/*.md", // Recursive search in notes/
"./projects/*/docs/*.md", // docs/ in each project
"/path/to/external/docs" // Absolute path
]
}
DevRag provides the following tools via Model Context Protocol:
Perform semantic vector search with optional filtering
Parameters:
query (string, required): Search query in natural languagetop_k (number, optional): Maximum number of results (default: 5)directory (string, optional): Filter to specific directory (e.g., "docs/api")file_pattern (string, optional): Glob pattern for filename (e.g., "api-.md", ".md")Returns: Array of search results with filename, chunk content, and similarity score
Examples:
// Basic search
search(query: "JWT authentication")
// Search only in docs/api directory
search(query: "user endpoints", directory: "docs/api")
// Search only files matching pattern
search(query: "deployment", file_pattern: "guide-*.md")
// Combined filters
search(query: "authentication", directory: "docs/api", file_pattern: "auth*.md")
Index a markdown file
Parameters:
filepath (string): Path to the file to indexList all indexed documents
Returns: Document list with filenames and timestamps
Remove a document from the index
Parameters:
filepath (string): Path to the file to deleteRe-index a document
Parameters:
filepath (string): Path to the file to re-indexPerfect for teams with large documentation repositories:
git pull automatically updates the indexConfigure for your project's docs directory:
{
"document_patterns": [
"./docs",
"./api-docs/**/*.md",
"./wiki/**/*.md"
],
"db_path": "./.devrag/vectors.db"
}
Environment: MacBook Pro M2, 100 files (1MB total)
| Operation | Time | Tokens |
|---|---|---|
| Startup | 2.3s | - |
| Indexing | 8.5s | - |
| Search (1 query) | 95ms | ~300 |
| Traditional Read | 25s | ~12,000 |
260x faster search, 40x fewer tokens
# All tests
go test ./...
# Specific packages
go test ./internal/config -v
go test ./internal/indexer -v
go test ./internal/embedder -v
go test ./internal/vectordb -v
# Integration tests
go test . -v -run TestEndToEnd
# Using build script
./build.sh
# Direct build
go build -o devrag cmd/main.go
# Cross-platform release build
./scripts/build-release.sh
# Create version tag
git tag v1.0.1
# Push tag
git push origin v1.0.1
GitHub Actions automatically:
devrag/
├── cmd/
│ └── main.go # Entry point
├── internal/
│ ├── config/ # Configuration
│ ├── embedder/ # Vector embeddings
│ ├── indexer/ # Indexing logic
│ ├── mcp/ # MCP server
│ └── vectordb/ # Vector database
├── models/ # ONNX models
├── build.sh # Build script
└── integration_test.go # Integration tests
Cause: Internet connection or Hugging Face server issues
Solutions:
export HTTP_PROXY=http://your-proxy:port
export HTTPS_PROXY=http://your-proxy:port
models/DOWNLOAD.md)Explicitly set CPU in config.json:
{
"compute": {
"device": "cpu",
"fallback_to_cpu": true
}
}
go env CGO_ENABLEDchunk_size (default: 500)MIT License
Issues and Pull Requests are welcome!
Special thanks to all contributors who helped improve DevRag:
--config CLI flag (#3)Your contributions make DevRag better for everyone!
Claude Code用の無料ローカルRAG - トークン&時間を節約
DevRagは、Claude Codeを使う開発者のための軽量RAG(Retrieval-Augmented Generation)システムです。ドキュメント全体を読み込んでトークンを無駄にするのをやめて、ベクトル検索で必要な情報だけを取得しましょう。
Claude Codeでドキュメントを読み込むと、大量のトークンを消費します:
DevRagを使えば:
Releasesから環境に合ったファイルをダウンロード:
| プラットフォーム | ファイル |
|---|---|
| macOS (Apple Silicon) | devrag-macos-apple-silicon.tar.gz |
| macOS (Intel) | devrag-macos-intel.tar.gz |
| Linux (x64) | devrag-linux-x64.tar.gz |
| Linux (ARM64) | devrag-linux-arm64.tar.gz |
| Windows (x64) | devrag-windows-x64.zip |
macOS/Linux:
tar -xzf devrag-*.tar.gz
chmod +x devrag-*
sudo mv devrag-* /usr/local/bin/devrag
Windows:
C:\Program Files\devrag\)~/.claude.json または .mcp.json に追加:
{
"mcpServers": {
"devrag": {
"type": "stdio",
"command": "/usr/local/bin/devrag"
}
}
}
カスタム設定ファイルを使用する場合:
{
"mcpServers": {
"devrag": {
"type": "stdio",
"command": "/usr/local/bin/devrag",
"args": ["--config", "/path/to/custom-config.json"]
}
}
}
mkdir documents
cp your-notes.md documents/
これで完了!起動時に自動的にインデックス化されます。
Claude Codeで:
「JWTの認証方法について検索して」
config.jsonを作成:
{
"document_patterns": [
"./documents",
"./notes/**/*.md",
"./projects/backend/**/*.md"
],
"db_path": "./vectors.db",
"chunk_size": 500,
"search_top_k": 5,
"compute": {
"device": "auto",
"fallback_to_cpu": true
},
"model": {
"name": "multilingual-e5-small",
"dimensions": 384
}
}
document_patterns: ドキュメントのパスとglobパターンの配列
"./documents""./docs/**/*.md" (再帰的)documents_dirもサポート(自動的に移行)db_path: ベクトルデータベースのパスchunk_size: ドキュメントのチャンクサイズ(文字数)search_top_k: 検索結果の返却件数compute.device: 計算デバイス(auto, cpu, gpu)compute.fallback_to_cpu: GPU利用不可時にCPUにフォールバックmodel.name: 埋め込みモデル名model.dimensions: ベクトル次元数--config : カスタム設定ファイルのパスを指定(デフォルト: config.json)使用例:
devrag --config /path/to/custom-config.json
これは以下の用途で便利です:
{
"document_patterns": [
"./documents", // documents/内の全.mdファイル
"./notes/**/*.md", // notes/内を再帰的に検索
"./projects/*/docs/*.md", // 各プロジェクトのdocs/
"/path/to/external/docs" // 絶対パス
]
}
Model Context Protocolを通じて以下のツールを提供:
フィルター機能付き意味ベクトル検索を実行
パラメータ:
query (string, 必須): 自然言語の検索クエリtop_k (number, 任意): 最大結果数(デフォルト: 5)directory (string, 任意): 特定ディレクトリに絞り込み(例: "docs/api")file_pattern (string, 任意): ファイル名のglobパターン(例: "api-.md", ".md")戻り値: ファイル名、チャンク内容、類似度スコアを含む検索結果の配列
使用例:
// 基本検索
search(query: "JWT認証")
// docs/apiディレクトリ内のみ検索
search(query: "ユーザーエンドポイント", directory: "docs/api")
// パターンに一致するファイルのみ検索
search(query: "デプロイ", file_pattern: "guide-*.md")
// フィルターの組み合わせ
search(query: "認証", directory: "docs/api", file_pattern: "auth*.md")
マークダウンファイルをインデックス化
パラメータ:
filepath (string): インデックス化するファイルのパスインデックス化されたドキュメントの一覧を取得
戻り値: ファイル名とタイムスタンプを含むドキュメントリスト
ドキュメントをインデックスから削除
パラメータ:
filepath (string): 削除するファイルのパスドキュメントを再インデックス化
パラメータ:
filepath (string): 再インデックス化するファイルのパス大量のドキュメントがあるチームに最適:
git pullでインデックスを自動更新プロジェクトのdocsディレクトリ用に設定:
{
"document_patterns": [
"./docs",
"./api-docs/**/*.md",
"./wiki/**/*.md"
],
"db_path": "./.devrag/vectors.db"
}
環境: MacBook Pro M2, 100ファイル (合計1MB)
| 操作 | 時間 | トークン |
|---|---|---|
| 起動 | 2.3秒 | - |
| インデックス化 | 8.5秒 | - |
| 検索 (1クエリ) | 95ms | ~300 |
| 従来のRead | 25秒 | ~12,000 |
検索は260倍速、トークンは40分の1
# すべてのテスト
go test ./...
# 特定のパッケージ
go test ./internal/config -v
go test ./internal/indexer -v
go test ./internal/embedder -v
go test ./internal/vectordb -v
# 統合テスト
go test . -v -run TestEndToEnd
# ビルドスクリプト使用
./build.sh
# 直接ビルド
go build -o devrag cmd/main.go
# クロスプラットフォームリリースビルド
./scripts/build-release.sh
# バージョンタグを作成
git tag v1.0.1
# タグをプッシュ
git push origin v1.0.1
GitHub Actionsが自動的に:
devrag/
├── cmd/
│ └── main.go # エントリーポイント
├── internal/
│ ├── config/ # 設定管理
│ ├── embedder/ # ベクトル埋め込み
│ ├── indexer/ # インデックス処理
│ ├── mcp/ # MCPサーバー
│ └── vectordb/ # ベクトルDB
├── models/ # ONNXモデル
├── build.sh # ビルドスクリプト
└── integration_test.go # 統合テスト
原因: インターネット接続またはHugging Faceサーバーの問題
解決方法:
export HTTP_PROXY=http://your-proxy:port
export HTTPS_PROXY=http://your-proxy:port
models/DOWNLOAD.md参照)config.jsonで明示的にCPUを指定:
{
"compute": {
"device": "cpu",
"fallback_to_cpu": true
}
}
go env CGO_ENABLEDchunk_sizeを調整(デフォルト: 500)MIT License
IssuesとPull Requestsを歓迎します!
DevRagの改善に貢献してくださった皆様に感謝します:
皆様の貢献がDevRagをより良くしています!
Install via CLI
npx mdskills install tomohiro-owada/devragDevRag is a free, open-source AI agent skill. Free Local RAG for Claude Code - Save Tokens & Time 日本語版はこちら | Japanese Version DevRag is a lightweight RAG (Retrieval-Augmented Generation) system designed specifically for developers using Claude Code. Stop wasting tokens by reading entire documents - let vector search find exactly what you need. When using Claude Code, reading documents with the Read tool consumes massive amounts of tokens: - ❌
Install DevRag with a single command:
npx mdskills install tomohiro-owada/devragThis downloads the skill files into your project and your AI agent picks them up automatically.
DevRag works with Claude Code, Claude Desktop, Cursor, Vscode Copilot, Windsurf, Continue Dev, Codex, Gemini Cli, Amp, Roo Code, Goose, Opencode, Trae, Qodo, Command Code. Skills use the open SKILL.md format which is compatible with any AI coding agent that reads markdown instructions.