What would you like to be added?
A DAP (Debug Adapter Protocol) toolset for the Gemini CLI agent that enables
it to attach to live running processes (Node.js, Python, Go, etc.), set
breakpoints, inspect stack traces, query variable states, and perform automated
root-cause analysis i.e all directly from within the terminal session.
This introduces a new debug tool category under packages/core/src/tools/,
parallel to existing tools like run_shell_command and read_file, consisting
of the following agent-callable tools:
New tools proposed:
debug_launch: Launch a target program under a DAP debug adapter and
return a session handle
debug_attach: Attach to an already-running process by PID or port
debug_set_breakpoint: Set a breakpoint at a file + line or function name
debug_continue: Resume execution until the next breakpoint or program end
debug_stack_trace: Retrieve the current call stack with file, line, and
function context
debug_get_variables: Inspect local/global variables and their values
at the current stack frame
debug_evaluate: Evaluate an arbitrary expression in the current debug context
debug_step: Step over / into / out of the current line
debug_disconnect: Cleanly terminate the debug session
New interactive mode:
A /debug slash command that enters a persistent "Debug Mode" where the agent
maintains a live DAP session across multiple turns, allowing natural language
debugging like: "Why is user null here?" → agent inspects variables and
explains the root cause.
Language support (Phase 1):
- Node.js / TypeScript via built-in V8 inspector (
--inspect flag, port 9229)
- Python via
debugpy (python -m debugpy --listen 5678)
- GoLang via
dlv Delve debugger (dlv debug --headless --listen :2345)
Why is this needed?
Today, when a developer encounters a bug while working with Gemini CLI, the
agent's only tool is reading source code, running the program, and guessing
from static text output. It cannot observe live runtime state i.e the actual
values of variables, the exact call stack at the moment of failure, or the
execution path that led to the crash.
This creates a fundamental gap: the hardest bugs are runtime bugs. They don't
appear in source code, they appear in memory at runtime.
The Debug Adapter Protocol (DAP) : developed by Microsoft and used by VS
Code, Neovim, and virtually every modern editor i.e is the industry-standard way
to communicate with debuggers. It is language-agnostic and already has mature
adapters for every major language. By integrating DAP into Gemini CLI's tool
system, the agent gains full visibility into running programs.
Concrete scenarios this unlocks:
-
"My Flask app crashes with a NullPointerError, figure out why" → Agent
launches the app under debugpy, sets a breakpoint at the crash site,
inspects the variable state, and explains exactly which input caused user
to be None
-
"This Node.js async function returns undefined sometimes, debug it" →
Agent attaches to the process, sets conditional breakpoints, steps through
the async chain, and identifies the race condition
-
"My Go service panics under load i.e what's the stack trace?" → Agent
attaches Delve, captures the panic stack trace, correlates it with the
source, and suggests a fix
Without DAP integration, Gemini CLI is a static code analysis tool. With it,
it becomes a true debugging partner, the closest thing to JARVIS for
software development that currently exists in a terminal.
This is directly aligned with GSoC 2026 Idea #7 and the project's stated goal
of making Gemini CLI the most capable AI coding agent in the terminal.
Additional context
Relevant existing files to extend:
packages/core/src/tools/: All new DAP tools go here as individual
.ts files, following the same pattern as run-shell-command.ts and
read-file.ts
packages/core/src/tools/tool-registry.ts: DAP tools register here
alongside existing tools
packages/core/src/core/client.ts: Agent loop; /debug slash command
integrates here to maintain session state across turns
packages/cli/src/ui/: Debug mode UI: show current breakpoint location,
variable panel, stack trace inline in the Ink TUI
DAP reference implementation:
Proposed package structure:
packages/core/src/tools/dap/
├── dap-client.ts # Low-level DAP session manager (connect, send, receive)
├── debug-launch.ts # debug_launch tool
├── debug-attach.ts # debug_attach tool
├── debug-set-breakpoint.ts
├── debug-stack-trace.ts
├── debug-get-variables.ts
├── debug-evaluate.ts
├── debug-step.ts
├── debug-disconnect.ts
└── types.ts # Shared DAP types (StackFrame, Variable, Breakpoint)
Security considerations:
- DAP sessions are local-only by default (localhost ports); no remote
debugging without explicit user opt-in
debug_evaluate is sandboxed, arbitrary expression evaluation in a
live process is powerful and must be gated behind the existing tool
approval system
- Debug sessions must be cleaned up on agent exit or
/quit to avoid
zombie debug adapters holding process handles
Related issues:
- None: searched
DAP integration, DAP debugger, debug adapter protocol,
breakpoint agent no relevant open issues exist
Searched queries (confirming no duplicates):
is:issue state:open DAP integration → 0 results
is:issue state:open debug adapter protocol → 0 results
is:issue state:open DAP debugger → 1 unrelated result
is:issue state:open breakpoint agent → 8 unrelated results
I am proposing this as part of my GSoC 2026 application for Gemini CLI
(Idea #7 : Terminal-Integrated Debugging Companion). I am prepared to provide
a working proof-of-concept dap-client.ts that establishes a DAP session with
a Node.js process and retrieves a stack trace, available for maintainer review
before any formal work begins.
What would you like to be added?
A DAP (Debug Adapter Protocol) toolset for the Gemini CLI agent that enables
it to attach to live running processes (Node.js, Python, Go, etc.), set
breakpoints, inspect stack traces, query variable states, and perform automated
root-cause analysis i.e all directly from within the terminal session.
This introduces a new
debugtool category underpackages/core/src/tools/,parallel to existing tools like
run_shell_commandandread_file, consistingof the following agent-callable tools:
New tools proposed:
debug_launch: Launch a target program under a DAP debug adapter andreturn a session handle
debug_attach: Attach to an already-running process by PID or portdebug_set_breakpoint: Set a breakpoint at a file + line or function namedebug_continue: Resume execution until the next breakpoint or program enddebug_stack_trace: Retrieve the current call stack with file, line, andfunction context
debug_get_variables: Inspect local/global variables and their valuesat the current stack frame
debug_evaluate: Evaluate an arbitrary expression in the current debug contextdebug_step: Step over / into / out of the current linedebug_disconnect: Cleanly terminate the debug sessionNew interactive mode:
A
/debugslash command that enters a persistent "Debug Mode" where the agentmaintains a live DAP session across multiple turns, allowing natural language
debugging like: "Why is
usernull here?" → agent inspects variables andexplains the root cause.
Language support (Phase 1):
--inspectflag, port 9229)debugpy(python -m debugpy --listen 5678)dlvDelve debugger (dlv debug --headless --listen :2345)Why is this needed?
Today, when a developer encounters a bug while working with Gemini CLI, the
agent's only tool is reading source code, running the program, and guessing
from static text output. It cannot observe live runtime state i.e the actual
values of variables, the exact call stack at the moment of failure, or the
execution path that led to the crash.
This creates a fundamental gap: the hardest bugs are runtime bugs. They don't
appear in source code, they appear in memory at runtime.
The Debug Adapter Protocol (DAP) : developed by Microsoft and used by VS
Code, Neovim, and virtually every modern editor i.e is the industry-standard way
to communicate with debuggers. It is language-agnostic and already has mature
adapters for every major language. By integrating DAP into Gemini CLI's tool
system, the agent gains full visibility into running programs.
Concrete scenarios this unlocks:
"My Flask app crashes with a NullPointerError, figure out why" → Agent
launches the app under debugpy, sets a breakpoint at the crash site,
inspects the variable state, and explains exactly which input caused
userto be None
"This Node.js async function returns undefined sometimes, debug it" →
Agent attaches to the process, sets conditional breakpoints, steps through
the async chain, and identifies the race condition
"My Go service panics under load i.e what's the stack trace?" → Agent
attaches Delve, captures the panic stack trace, correlates it with the
source, and suggests a fix
Without DAP integration, Gemini CLI is a static code analysis tool. With it,
it becomes a true debugging partner, the closest thing to JARVIS for
software development that currently exists in a terminal.
This is directly aligned with GSoC 2026 Idea #7 and the project's stated goal
of making Gemini CLI the most capable AI coding agent in the terminal.
Additional context
Relevant existing files to extend:
packages/core/src/tools/: All new DAP tools go here as individual.tsfiles, following the same pattern asrun-shell-command.tsandread-file.tspackages/core/src/tools/tool-registry.ts: DAP tools register herealongside existing tools
packages/core/src/core/client.ts: Agent loop;/debugslash commandintegrates here to maintain session state across turns
packages/cli/src/ui/: Debug mode UI: show current breakpoint location,variable panel, stack trace inline in the Ink TUI
DAP reference implementation:
vscode-debugadapternpm package handles the DAP wire protocoldebugpy(Python),dlv(Go) are the target language adapters for Phase 1Proposed package structure:
packages/core/src/tools/dap/
├── dap-client.ts # Low-level DAP session manager (connect, send, receive)
├── debug-launch.ts # debug_launch tool
├── debug-attach.ts # debug_attach tool
├── debug-set-breakpoint.ts
├── debug-stack-trace.ts
├── debug-get-variables.ts
├── debug-evaluate.ts
├── debug-step.ts
├── debug-disconnect.ts
└── types.ts # Shared DAP types (StackFrame, Variable, Breakpoint)
Security considerations:
debugging without explicit user opt-in
debug_evaluateis sandboxed, arbitrary expression evaluation in alive process is powerful and must be gated behind the existing tool
approval system
/quitto avoidzombie debug adapters holding process handles
Related issues:
DAP integration,DAP debugger,debug adapter protocol,breakpoint agentno relevant open issues existSearched queries (confirming no duplicates):
is:issue state:open DAP integration→ 0 resultsis:issue state:open debug adapter protocol→ 0 resultsis:issue state:open DAP debugger→ 1 unrelated resultis:issue state:open breakpoint agent→ 8 unrelated resultsI am proposing this as part of my GSoC 2026 application for Gemini CLI
(Idea #7 : Terminal-Integrated Debugging Companion). I am prepared to provide
a working proof-of-concept
dap-client.tsthat establishes a DAP session witha Node.js process and retrieves a stack trace, available for maintainer review
before any formal work begins.