Local-first CLI AI debugger for Python projects
Project description
AI Debugger - aidbg
aidbg is a local-first, CLI-based AI debugging tool for Python projects.
It wraps program execution, detects runtime failures, collects minimal diagnostic context, and returns a structured debugging explanation using an LLM โ without running background processes or monitoring your system.
aidbg activates only when your program crashes, analyzes the error, prints a concise fix, and exits immediately.
โจ Why aidbg?
Modern developers often copy-paste tracebacks into AI chat tools to debug errors.
aidbg removes that friction.
Instead of:
python app.py
# copy error
# open browser
# paste into AI
You do:
aidbg run app.py
And get:
- Root Cause
- Fix
- Short Explanation
All inside your terminal.
๐ Key Features
-
CLI-based execution wrapper
-
Event-driven (no background daemon)
-
Zero idle CPU usage
-
Minimal context collection
-
Token-controlled LLM responses
-
Guardrails against unsafe or hacky fixes
-
Multi-provider support:
- Groq
- OpenAI
- Ollama (local)
-
Global and project-level configuration
-
Fully open-source core
๐ง How It Works
Execution Flow:
aidbg run app.py
โ executes script
โ detects crash (non-zero exit)
โ extracts traceback
โ collects minimal context
โ sends structured prompt to LLM
โ prints debugging result
โ exits
aidbg never:
- Runs continuously
- Monitors your system
- Sends your full repository
- Collects environment variables
- Reads .env files
- Uploads datasets
๐ฆ Installation
pip install aidbg
Or from source:
pip install -e .
โ๏ธ Configuration
Initialize configuration:
aidbg init
Project-specific config:
aidbg init --local
Config priority:
-
Project config (.aidbg/config.json)
-
Global config (~/.aidbg/config.json)
๐ Usage
aidbg run app.py
Example output:
Root Cause:
Division by zero.
Fix:
Validate the divisor before performing the division.
Explanation:
Python raises ZeroDivisionError when the divisor is zero.
๐ Privacy Model
aidbg follows a minimal context principle.
Collected:
- Relevant traceback frames
- Failing file + line number
- Code snippet around failure
- Shallow project structure (depth โค 2)
- Python version
- OS
- requirements.txt (if present)
Never collected:
- Full repository
- Secrets
- Environment variables
- Binary files
- Historical logs
๐งฉ Project Structure
aidbg/
โ
โโ cli.py
โ Entry point for CLI commands.
โ
โโ runner.py
โ Executes target Python script via subprocess.
โ
โโ trigger.py
โ Crash detection and LLM orchestration logic.
โ
โโ init.py
โ Interactive configuration (global / project).
โ
โโ config.py
โ Configuration loading and priority resolution.
โ
โโ prompt.py
โ LLM system and user prompt construction.
โ
โโ logic/
โ โโ complexity.py
โ โ Error classification (simple vs complex).
โ โโ token_budget.py
โ Fixed token budget logic.
โ
โโ context/
โ โโ collector.py
โ โ Traceback parsing and file extraction.
โ โโ project_tree.py
โ โ Shallow project structure extraction.
โ โโ environment.py
โ โ Python version and OS detection.
โ โโ dependencies.py
โ Lightweight dependency parsing.
โ
โโ llm/
โ โโ base.py
โ โโ groq.py
โ โโ openai.py
โ โโ ollama.py
โ
โโ tests/
Basic unit tests for stability.
๐งช Testing
pytest
๐ Roadmap
Phase 1 (Current):
- CLI tool
- Multi-provider support
- Token-controlled responses
- Guarded fix suggestions
Phase 2 (Planned):
- Specialized lightweight debugging model
- Optional hosted API
- Possible commercial extension
- The core CLI tool will remain open-source.
๐ License
MIT License.
The open-source CLI tool is released under MIT. Future hosted APIs or proprietary debugging models may be released under separate commercial terms.
๐ค Contributing
Pull requests welcome. Please keep contributions minimal, testable, and consistent with the local-first philosophy.
Project details
Release history Release notifications | RSS feed
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 aidbg-0.1.2.tar.gz.
File metadata
- Download URL: aidbg-0.1.2.tar.gz
- Upload date:
- Size: 13.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2cb6b5f40539be0c71bbd72a0a7ad6282cf62bef2f3949250114a4c3a7b7a51c
|
|
| MD5 |
c1ed524a8f2963c2ef234222ef08f455
|
|
| BLAKE2b-256 |
5a75c2e742ca7416a0b5c0c0121dbd095ec326fbf627cf293dfe8cc3f9de9354
|
File details
Details for the file aidbg-0.1.2-py3-none-any.whl.
File metadata
- Download URL: aidbg-0.1.2-py3-none-any.whl
- Upload date:
- Size: 14.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0a52f490aa5798c12104579c41d5e572dbb57b5cb1c14a4286d2237b8c1236b
|
|
| MD5 |
d45ed15ea9d1b7bfb0a6e23b2f679fed
|
|
| BLAKE2b-256 |
8027754382f89621974eb9400e5f9f1a276c2bb3307247e443434be7d65f63a1
|