mohsen1/llm-debugger-vscode-extension
VSCode extension that demonstrates the use of large language models (LLMs) for active debugging of programs
LLM Debugger – VS Code Extension
What it is – A VS Code extension that lets a language model debug JavaScript/Node programs by actually running them under the real VS Code debugger. The model watches breakpoints, steps, and live variable values, then decides the next debugging action. Only when the model cannot infer the next move does it call a generative LLM to propose a hypothesis, a breakpoint location, an expression to evaluate, or the final patch.
Why it matters – Most AI‑based debugging tools only look at static source code. By feeding the model real‑time runtime state, LLM Debugger can pinpoint bugs with far fewer expensive LLM calls, dramatically cutting cost and improving accuracy.
Core workflow
- Plan – The generation model sees only the entry file and the failing assertion, then suggests initial breakpoints.
- Run – The program is launched under the normal VS Code debugger and stops at the first breakpoint.
- Decide – For each pause, the Jev decision model (a typed System‑One classifier) chooses the next debugger action (step, continue, set another breakpoint, evaluate an expression). If the decision requires a concrete location or expression, a generative model (e.g.,
gpt‑5.4‑nano) is invoked. - Act – The chosen action is executed; the editor highlights move accordingly.
- Report – After the loop finishes, the extension returns a root‑cause description and an exact code edit that fixes the bug. The patch is automatically applied and re‑run to verify that the original failing assertion now passes.
Key features
| Feature | What it does |
|---|---|
| Runtime‑driven debugging | Uses real breakpoints, stepping, and live locals instead of static analysis. |
| Self‑placed breakpoints | The model decides where to stop based only on the failing test description. |
| Hybrid decision making | A cheap, typed classifier (Jev) routes most steps; a generative LLM is called only for the few decisions that need free‑form reasoning. |
| Patch output | Returns a minimal source edit that resolves the bug; the benchmark verifies the fix automatically. |
| Cost ledger | Every run logs debugger actions, fast checks, generation calls and the associated dollar cost. |
| Configurable brains | Switch between jev (classifier) and a pure llm baseline, choose provider (openai or vercel), model, and reasoning effort. |
| Agent‑tool integration | Exposes eight debugger‑control tools (llm-debugger_start, llm-debugger_step, …) so other coding assistants (Copilot, Claude, Codex) can invoke the live debugger programmatically. |
Getting started
# 1. Install API keys
cp api.env.example api.env # add your OPENAI_API_KEY and TYPESAFE_API_KEY
# 2. Build the extension
npm run build
# 3. Install in VS Code
# • Open the Command Palette → “Extensions: Install from VSIX”
# • Point to the built folder
# • Reload VS Code
Using the extension – In the VS Code chat sidebar type commands such as:
@debugger– runs the currently open file, automatically picks the failing test.@debugger the async order total comes out NaN– debug a symptom you describe.@debugger run.js– debug a specific entry script.
The extension will run the program, perform the autonomous debugging loop, and finally present a patch.
Benchmarks (from the README)
| Brain | Solved | Median run time | Debugger steps | Generation calls | Cost |
|---|---|---|---|---|---|
| jev (gpt‑5.4‑nano) | 13/13 | 12.8 s | 147 | 67 | $0.055 |
| llm (gpt‑5.4‑nano) | 11/13 | 92.5 s | 513 | 540 | $0.243 |
| jev (gpt‑5.6‑sol, low effort) | 13/13 | 33.5 s | 134 | 39 | $0.480 |
| llm (gpt‑5.6‑sol, low effort) | 12/13 | 37.7 s | 82 | 120 | $1.086 |
The results show that the classifier‑driven jev route dramatically reduces both runtime and API cost while maintaining or improving solve rates.
Extending / integrating
- Agent tools – The live debugger can be called from other AI assistants via the eight
llm-debugger_*tools, either as in‑process language‑model tools (Copilot) or out‑of‑process via the MCP bridge. - Benchmark suite –
benchmark/contains scripts to run the 13 curated bug‑fix tasks and verify that patches truly resolve the failing assertion. - Configuration – All major knobs (model, provider, reasoning effort, strategy) are exposed in VS Code settings under LLM Debugger.
TL;DR
LLM Debugger is a research‑grade VS Code extension that lets a language model debug JavaScript by actually stepping through the program. It combines a cheap typed classifier (Jev) with an optional generative LLM, outputs a verified code patch, and tracks API cost. It’s aimed at developers and AI‑assistant researchers who want to explore runtime‑aware LLM debugging.
Related
- Project
- Project
- Project
- Project