curvedinf/dir-assistant
Chat with your current directory's files using a local or API LLM.
What it solves
dir-assistant helps you work with large or unfamiliar codebases by letting you ask questions and give commands in plain English. Instead of manually searching through files, it automatically includes the most relevant file contents in each prompt to the LLM, so you can quickly understand what a project does, get explanations for specific functions, or perform targeted updates and refactoring.
How it works
After you install it with pip, you run it inside any folder. It recursively scans all text files in that folder and builds an index. When you type a prompt, it uses a method called CGRAG (Contextually Guided Retrieval-Augmented Generation) to pick out which files are most relevant to your question and adds their contents to the prompt before sending it to the LLM. You can use it in two modes: an interactive chat mode, or a single-prompt mode for scripts and automation. It works with local models (CPU, CUDA, RocM, Metal, Vulkan, SYCL) and with any major LLM API via LiteLLM. It can even automatically make file edits and commit them to git if you enable that option. It also optimizes prompts for context caching, which typically reduces latency and cost by 50-90%.
Who it’s for
Developers and technical users who need to quickly understand or modify large codebases, get explanations of specific code parts, automate file analysis or documentation tasks, or run high-level questions like "What is the main purpose of this application?". It’s also useful for automating repetitive file changes and refactoring.
Highlights
- Interactive chat mode and a single-prompt for scripting.
- Automatically includes the most contextually relevant files using CGRAG.
- Supports many local acceleration platforms and all major LLM APIs.
- Can optionally auto-commit changes to git.
- Optimizes for context caching to cut cost and latency.
Related
- Project
- Project
- Project
- Project