Dig into any bug with full codebase context — zero LLM calls
Project description
dug
Dig into any bug with full codebase context — zero LLM calls.
dug takes a bug report or stack trace and generates a structured Claude Code prompt that includes the exact files, functions, and context needed to fix it — using grep, AST parsing, and a local vector index with no API calls and no LLM required.
Install
# Recommended
pipx install dug-cli
# macOS (Homebrew)
brew tap ratishjain12/dug
brew install dug-cli
# One-liner (Linux / macOS)
curl -fsSL https://raw.githubusercontent.com/ratishjain12/dug/main/install.sh | sh
# Inside a virtualenv
pip install dug-cli
Quick start
# 1. Run once in your repo root to build the index
cd /your/project
dug init
# 2. Paste any bug report or stack trace
dug "NullPointerException in UserService.authenticate at line 42"
# dug prints a ready-to-paste Claude Code prompt with ranked file context
Sample output:
You are a senior engineer debugging this issue:
NullPointerException in UserService.authenticate at line 42
Relevant files (ranked by relevance):
1. src/auth/UserService.java:35
authenticate() — modified 2 commits ago
...
2. src/config/AppConfig.java:12
loadConfig() — error pattern match
...
[full function bodies + graph context follow]
How it works
dug builds a local knowledge base the first time you run dug init:
| Layer | What it builds | Used for |
|---|---|---|
| Structural graph | File → Symbol → Commit nodes (networkx) | Import chains, recent changes |
| Semantic index | Function embeddings in LanceDB (sentence-transformers) | Meaning-level matches |
| History log | Past bug→fix pairs | Learning from outcomes |
At query time, three signals are combined into a ranked list:
- Structural score — imports your error file, was modified in a related commit
- Semantic score — cosine similarity between bug text and function bodies
- History boost — similar past bugs pointed here
The index stays fresh via git hooks (post-commit, post-checkout) and an optional file watcher.
Commands
| Command | What it does |
|---|---|
dug init |
Index the current repo (builds graph + embeddings) |
dug "error text" |
Generate a Claude Code prompt for the bug |
dug update |
Re-index files changed since last commit |
dug watch |
Watch for file saves and re-index in real time |
dug stats |
Show index size (nodes, edges, chunks) |
dug config |
View / edit configuration |
dug feedback good |
Mark last query as helpful (improves future results) |
dug feedback bad |
Mark last query as unhelpful |
Options
dug init --local # Use local embeddings (default, no API key needed)
dug init --openai # Use OpenAI text-embedding-3-small (needs OPENAI_API_KEY)
dug "error" --files 3 # Limit to top 3 files in prompt
dug "error" --no-history # Skip learning loop context
Configuration
dug init creates .dug/config.json in the repo root. You can also edit it with dug config set <key> <value>.
{
"embedding_mode": "local",
"languages": ["python", "java", "typescript", "javascript"],
"max_files_in_prompt": 5,
"git_history_depth": 50,
"exclude_test_files": true
}
.dug/ is automatically added to .gitignore — it's machine-specific and never committed.
Contributing
git clone https://github.com/ratishjain12/dug
cd dug
uv sync
uv run dug init # index the dug repo itself
uv run dug "your bug here"
Requires Python 3.10+ and uv.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dug_cli-0.1.3.tar.gz.
File metadata
- Download URL: dug_cli-0.1.3.tar.gz
- Upload date:
- Size: 39.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c54fc5a44e8734af084db89178c8b23383ac333868717fa08cf35be181290743
|
|
| MD5 |
9b1be623abc697b6158e432e73b59966
|
|
| BLAKE2b-256 |
99603e6a6aec66d0efd89e9ecdb490d5b2ebfafd8c55c44d074e3509daf3c2bf
|
File details
Details for the file dug_cli-0.1.3-py3-none-any.whl.
File metadata
- Download URL: dug_cli-0.1.3-py3-none-any.whl
- Upload date:
- Size: 31.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
989b9338208f6439b00956261f7b87f370d2e0909267a1208c45933320bf8574
|
|
| MD5 |
679e749eff1c1fbf37967f08b681cf1b
|
|
| BLAKE2b-256 |
2a3f537bea875c4b1eace4f493a3471c881e705cd15d9efa688e85d3864c78a3
|