Lazydap

Lazydap

A scriptable, terminal-first debugger. CLI core, JSON-over-Unix-socket protocol, multiple frontends. Wraps DAP adapters (codelldb / debugpy / etc.) so any AI agent, shell script, or custom UI can drive a debug session.

Project lives at: ~/code/planetaryescape/lazydap/
Architecture inherited from: ~/code/planetaryescape/mxr/

Status

Pre-alpha. No code yet. The ~/code/planetaryescape/lazydap/ directory currently holds the full architecture, blueprint, and per-milestone implementation plan. Code arrives starting with milestone M0.

Milestones M0–M18, organised in 5 phases:

The architecture in one paragraph

Single binary lazydap with subcommands. Auto-spawning daemon owns the DAP adapter and live session. Clients (TUI, CLI, agent skill, anything) talk to it over a length-delimited JSON Unix socket. Scriptability is the core tenet: every operation goes through the protocol, no client gets privileged access. Inherits mxr's discipline: strict crate boundaries enforced by Cargo, CLI-first culture, JSON output as a product feature, --dry-run for mutations, tracing from start, real-system tests not mocks.

Tech stack

Decisions made (full list in 15-decision-log.md)

  1. TOML state files (.lazydap/state.toml), not SQLite. Scriptable from any language, version-controllable.
  2. Multi-session designed for from M5 (every IPC message has session_id), enforced N=1 in v0.1. Lifting later is daemon-only change.
  3. .vscode/launch.json parsed from M5+. Drop-in usable in existing repos.
  4. Same .skill ZIP shape as mxr (SKILL.md + references/commands.md).
  5. One daemon per project, keyed by repo root.
  6. --wait is the bridge from async DAP to sync shell. 30s default timeout. Buffers intervening events. Coalesces 50ms for additional thread stops. (Full design in docs/blueprint/10-async-to-sync.md.)
  7. AI features are external clients of the protocol. Core ships two primitives (Subscribe { channels } events + getStateSnapshot rich JSON), community ships AI features. (See docs/blueprint/12-ai-future.md.)

Research findings — what already exists

(Full article: docs/articles/agent-driven-debugging.md.)

The gap is real. Every existing AI-debug solution is MCP-tied (assumes Claude/Cursor host), VS-Code-tied, or DAP-tied. Nothing exposes debugging as plain shell subcommands.

Direct competitors:

Research validates the demand: Microsoft's debug-gym reports +30% (Claude 3.7), +182% (o1), +160% (o3-mini) on SWE-bench Lite when LLMs have pdb available. Runtime debugger access genuinely helps.

Lazydap's positioning: shell-first, JSON output, no MCP runtime needed, TUI parity. Narrow, sharp.

Future AI roadmap (post-v0.1)

(Full version: docs/blueprint/12-ai-future.md.)

Two primitives in core; everything else external:

  1. Streaming events API (already in v0.1)
  2. getStateSnapshot — rich JSON for one-shot LLM context

Tier 1 (v0.2): "why did this break?", stack trace summarisation, auto-watch suggestion. Single LLM call each.
Tier 2 (v0.3): generate regression test from paused state, "fix it" patch suggestion.
Tier 3 (v0.4+): "set bps to find this bug", autonomous debug agent.

Closest research analogues: ChatDBG, InspectCoder, debug-gym.


Learning resources

Curated reading/watching path. Read DAP first, watch ratatui videos, study nvim-dap as the closest reference architecture, then start M0.

1. DAP — start here (read, not watch)

The protocol is small enough that 60–90 minutes of reading beats any video.

2. ratatui — the videos to watch

This is where the YouTube content is genuinely good.

2.5. Lua primer (prerequisite for reading nvim-dap source)

You'll need just enough Lua to read nvim-dap. Not a Lua guru — just tables, closures, the : syntax, modules, pcall, and coroutines (the load-bearing concept for nvim-dap's async-to-sync bridge).

→ See Lua Primer for Reading nvim-dap for the curated 3-hour path + cheat sheet.

3. nvim-dap walkthroughs — closest reference architecture

These show DAP-in-action at the user level. Even though it's Lua, the session lifecycle and event handling map 1:1 to what you'll build.

4. Optional — "build a debugger from scratch"

You're NOT building this (DAP adapters do it for you), but skimming one of these helps understand what the adapter is actually doing on the other side of the wire.

5. Reference projects to study (architecture, not docs)

6. Async-to-sync DAP — research findings

(Detailed analysis in docs/blueprint/10-async-to-sync.md.)

Key references for the --wait design:

Suggested reading order

  1. Day 1: read DAP overview + spec (1–2 hours)
  2. Day 2: skim Python debug-adapter-client repo to see the shape of a real client
  3. Day 3–7: watch the ratatui beginner video + work through the official JSON Editor tutorial
  4. Day 8+: read nvim-dap's session.lua, then start [M0](file:///Users/bhekanik/code/planetaryescape/lazydap/docs/implementation/tasks/M00-hello-adapter.md)

Tip: when stuck on DAP semantics, read the actual JSON traffic. nvim-dap can be told to log every message:

require("dap").set_log_level("TRACE")
-- log goes to ~/.cache/nvim/dap.log

Reading 10 minutes of real DAP traffic teaches more than any blog post.


Internal-only sibling

Pre-M0 questions, things-I'm-watching-for during M0–M5, betting-against/betting-on, and architecture intuitions to test in code live in Lazydap Personal Notes (deliberately not published to the garden).

Connects to: LangX (own language design project), Mxr (sister project, same architecture), my interest in Rust generally, the broader question of "what would the terminal-first IDE look like?".

Vault clusters this project touches

If you're reading this in a year and want to traverse, lazydap connects to these synthesis notes (each opens its own cluster):

Atomic notes on debugging concepts (the most relevant cluster)