Deebo is an agentic debugging copilot designed to augment AI coding agents via the Model Context Protocol (MCP). It orchestrates a “mother” agent that coordinates investigations and spawns multiple parallel “scenario” agents, each testing a specific hypothesis on isolated Git branches. Results are logged to a memory bank and surfaced through a status “pulse.”
Key components:
- Mother agent (
src/mother-agent.ts): Coordinates the investigation loop, manages hypotheses, executes MCP tool calls, spawns scenario agents, and synthesizes a final solution when confident. - Scenario agent (
src/scenario-agent.ts): Focused investigator for a single hypothesis that uses tools, gathers evidence, and produces a structured report. - MCP server (
src/index.ts): Exposes tools to start, check, cancel sessions, and add observations; manages process lifecycle and memory bank folders. - Utilities (
src/util/*): Tool client connections, logging, memory bank updates, observations, reports, branch creation, LLM plumbing, and sanitization. - Setup CLI (
packages/deebo-setup): One-command installer that configures MCP clients (Cursor/Cline/Claude/VS Code), writes.env, clones and builds Deebo under~/.deebo. - Doctor CLI (
packages/deebo-doctor): Verifies environment, tools, and configuration.
Relevant docs:
- README with quick usage and guide
config/tools.jsondescribing how external MCP tools are launched
- Deebo runs as an MCP server process (Node, ESM, TypeScript → built to
build/). - Entry is
src/index.ts, which:- Loads env, validates
MOTHER_MODELandSCENARIO_MODEL. - Resolves tool paths for
npxanduvx(and Windows-specificnpmbin) and exposes them viaDEEBO_*env vars. - Prepares
~/.deebo/memory-bankstructure under the repo-specific project hash. - Registers MCP tools:
start,check,cancel,add_observation. - Maintains a per-session registry tracking the mother AbortController and scenario PIDs.
- Loads env, validates
High-level lifecycle:
- Start: Client calls
start(error, repoPath, context?, language?, filePath?).- A session ID is created and logged. The mother agent begins its OODA loop.
- Investigate: Mother agent observes, orients, decides, and acts repeatedly:
- Executes MCP tool calls (git/filesystem) requested by the LLM.
- Extracts
<hypothesis>tags and spawns one scenario agent per hypothesis on new Git branches. - Incorporates new “scientific observations” written by users/tools.
- Continues until a
<solution>is confidently produced or the session is cancelled.
- Scenarios: Each scenario agent investigates one hypothesis:
- Uses tools, collects evidence, and when ready emits a structured
<report>that gets persisted.
- Uses tools, collects evidence, and when ready emits a structured
- Status: Client calls
check(sessionId)to get a human-readable pulse including mother status, scenario summaries, links to logs/reports, and solution content if complete. - Cancellation: Client calls
cancel(sessionId)to abort mother and terminate tracked scenario processes. - Observations: Client can
add_observation(observation, sessionId, agentId?)which feeds the loop.
-
Tools
start: Creates session directories (logs,reports), registers a mother AbortController and a Set of scenario PIDs, and launchesrunMotherAgent(...)in the background.check: Readsmother.logand scenario logs/reports to build a pulse: status (in_progress/completed/cancelled/failed), session duration, last activity, mother stage, solution content (if any), and per-scenario outcomes. Includesfile://links for quick navigation.cancel: Aborts the mother agent via AbortController, sends SIGTERM to tracked scenario PIDs, updates the PID tombstone set, and cleans registry.add_observation: Appends a JSONL observation to the agent-specific observations log after derivingrepoPathfrom the agent’s first log entry.
-
Tool Path Resolution
- Non-Windows: uses
which npxandwhich uvx. - Windows: uses
where npx.cmdandwhere uvx.exeand derives%APPDATA%/npmfor.cmdshims. - Exposes
DEEBO_NPX_PATH,DEEBO_UVX_PATH, andDEEBO_NPM_BINfor child processes and tool clients.
- Non-Windows: uses
-
Memory Bank Root
DEEBO_ROOTresolved as project root; memory bank underDEEBO_ROOT/memory-bank.- Project ID derived from SHA-256 of
repoPathfirst 12 chars.
connectRequiredTools(agentName, sessionId, repoPath)returns two MCP clients:git-mcp: launched viauvx mcp-server-git --repository {repoPath}.desktopCommander: launched vianpx @wonderwhy-er/desktop-commander(ordesktop-commander.cmdon Windows).
- Placeholder substitution in command and args:
{npxPath},{uvxPath},{repoPath},{memoryPath},{memoryRoot}are expanded before process spawn.
- Critical env passed to tool processes:
NODE_ENV,USE_MEMORY_BANK,MOTHER_*,SCENARIO_*,OPENROUTER_API_KEY.
Purpose:
- Drive the OODA loop (Observe, Orient, Decide, Act) and converge on a high-confidence solution tagged as
<solution>...</solution>.
Key behaviors:
- LLM configuration chosen by env:
MOTHER_HOSTin {openai, openrouter, anthropic, gemini} andMOTHER_MODEL. - Initial context includes error, repo path, language, file path, session/project IDs, and a rich system prompt encouraging multiple hypotheses and memory-bank usage.
- Tool vs hypothesis precedence in a single LLM turn:
- If a response contains both
<use_mcp_tool>and<hypothesis>, Deebo executes the tools first and defers hypotheses to a later turn. Logging clarifies this precedence. - If a response contains only hypotheses, scenarios are spawned immediately.
- If a response contains only tools, tools are executed.
- If it contains only a
<solution>(without hypotheses), the loop ends.
- If a response contains both
- Spawning scenarios:
- Creates a unique
debug-<session>-<counter>branch viasimple-git. - Spawns
node build/scenario-agent.js --id ... --session ... --repo ... --branch ...with env inherited. - Tracks PID in a shared Set for the session; applies a per-scenario timeout with SIGTERM/SIGKILL cleanup.
- Creates a unique
- Observations: Periodically polls agent-specific observations to augment message history with “Scientific observation: …”.
- Robustness:
- Retries and backoff on empty/malformed LLM replies; logs structured events.
- Gentle parsing for MCP tool requests; malformed XML tool calls are logged and skipped, not fatal.
- Cooperative cancellation via AbortSignal; ensures tracked PIDs are terminated on exit.
- Memory bank updates (optional via
USE_MEMORY_BANK=true):- Appends hypothesis records to
activeContext.mdand session progress toprogress.md.
- Appends hypothesis records to
Purpose:
- Validate or falsify a single hypothesis on an isolated branch and produce a structured report.
Key behaviors:
- CLI-like process that parses args (
--id --session --error --context --hypothesis --language --file --repo --branch). - Connects to
git-mcpanddesktop-commanderfor Git and filesystem/terminal actions. - Conversation seed:
- System prompt mandates using tools, respecting provided context (what was already tried), and producing a final
<report>. - User message includes the hypothesis and investigation context.
- System prompt mandates using tools, respecting provided context (what was already tried), and producing a final
- Loop:
- Executes
<use_mcp_tool>calls; on errors, logs and feeds them back as user messages for recovery. - If a
<report>tag is present without tools, it writes the report and exits. - Retries/backoff on malformed/empty LLM replies.
- Executes
- Output:
- Writes JSON report to
memory-bank/<project>/sessions/<session>/reports/<scenarioId>.json. - Logs JSONL events to
logs/scenario-<id>.log.
- Writes JSON report to
Logging and Memory Bank (src/util/logger.ts, src/util/membank.ts, src/util/observations.ts, src/util/reports.ts)
- Directory structure (under
DEEBO_ROOT/memory-bank/<projectId>/sessions/<sessionId>/):logs/mother.log: JSONL entries with{timestamp, agent, level, message, data}.scenario-<id>.log: per-scenario JSONL logs.
reports/<scenarioId>.json: scenario’s final report.
observations/<agentId>.log: JSONL “scientific observations” appended by clients/tools.
- Project-level files (under
DEEBO_ROOT/memory-bank/<projectId>/):activeContext.md: running notes; mother appends hypothesis records here.progress.md: appended records of session-level progress and outcomes.
- Write helpers:
log(...)appends JSONL;writeReport(...)pretty-prints JSON;writeObservation(...)appends JSONL;updateMemoryBank(...)appends markdown to active/progress files.
- Reads mother and scenario logs/reports to compute:
- Overall status: in_progress / completed / cancelled / failed.
- Session duration and last activity.
- Solution block (between
<solution>...</solution>) if present. - Scenario summaries: Reported outcomes include extracted hypothesis, confirmation status, and investigation summary; unreported list shows running/terminated state derived from PID mapping.
- Clickable
file://links toprogress.md,mother.log, per-scenario logs and reports.
- Tracks terminated PIDs across lines indicating “Spawned/Removed/Terminated/Cancelled Scenario … PID ” to classify scenario status.
- Each scenario runs on a unique branch:
debug-<session>-<counter>. - Uses
simple-gittocheckoutLocalBranch(...). The scenario agent should not attempt to create branches directly (guarded by a check).
- Supported providers via
MOTHER_HOST,SCENARIO_HOST:openai(requiresOPENAI_API_KEYandOPENAI_BASE_URL)openrouter(requiresOPENROUTER_API_KEY)anthropic(requiresANTHROPIC_API_KEY)gemini(requiresGEMINI_API_KEY)
- Uniform chat API wrapper
callLlm(messages, config)chooses client and maps message formats:- OpenAI-compatible:
openai.chat.completions.createwithbaseURL. - OpenRouter: OpenAI-compatible endpoint at
https://openrouter.ai/api/v1. - Gemini:
@google/generative-aiwith messages mapped toContent[]. - Anthropic:
@anthropic-ai/sdkwithMessageParam[]messages.
- OpenAI-compatible:
- Prompts:
- Mother: mandates multiple hypotheses, prioritizes tool execution when mixed with hypotheses, uses memory bank guidance, and requires ≥96% confidence for
<solution>. - Scenario: mandates tool usage and a structured
<report>with HYPOTHESIS/CONFIRMED/INVESTIGATION/CHANGES MADE/CONFIDENCE sections.
- Mother: mandates multiple hypotheses, prioritizes tool execution when mixed with hypotheses, uses memory bank guidance, and requires ≥96% confidence for
- Purpose: One-command installer and configurator for Deebo.
- Behavior:
- Prompts for LLM hosts/models for mother/scenario and API keys.
- Verifies prerequisites: Node≥18, git, ripgrep,
uvx(and installs when possible with platform-aware instructions). - Creates
~/.deebo, clones the repository, installs dependencies, and builds the project. - Writes
~/.deebo/.envwith selected hosts, models, API keys, andUSE_MEMORY_BANK=true. - Updates MCP configuration for detected clients (Cline, Claude Desktop, Cursor, VS Code settings) without overwriting other servers.
- Windows notes: ensures VS Code/Cursor directories are created and advises installing DesktopCommander globally.
- Purpose: Verify environment health and configuration.
- Checks:
- Node version (v18, v20, v22 accepted), Git present.
- Tool paths (
node,npm,npx,uvx,git,rg) and PATH sanity. - MCP tools:
uvx mcp-server-gitanddesktop-commanderavailability (Windows.cmdchecked via%APPDATA%/npm). - Configuration files: presence and validity of
~/.deebo/.env,~/.deebo/config/tools.json, MCP configs in Cline/Claude/Cursor/VS Code. - API key heuristics by prefix per provider.
- Output: colored pass/warn/fail with optional
--verbosedetails.
Required env at server start:
MOTHER_MODEL,SCENARIO_MODEL(hard-required byindex.ts).- Hosts:
MOTHER_HOST,SCENARIO_HOST(used by agents). - Provider keys:
OPENROUTER_API_KEY,OPENAI_API_KEY,ANTHROPIC_API_KEY,GEMINI_API_KEYdepending on hosts. - Optional:
OPENAI_BASE_URLfor OpenAI-compatible endpoints.
Tool discovery and substitution:
findToolPaths()setsDEEBO_NPX_PATH,DEEBO_UVX_PATH, andDEEBO_NPM_BIN(Windows)config/tools.jsoncontrols spawned MCP tools with placeholders replaced at connect time.
Project identification:
getProjectId(repoPath): SHA-256 of absolute repo path (first 12 chars) used for namespacing memory bank directories.
- Tool Execution:
desktop-commanderexposes terminal and filesystem actions; Deebo’s prompts constrain usage, but MCP client/server policies should enforce safe command blocking.- Scenario agent explicitly blocks
git_create_branchtool usage to enforce branch creation only by mother.
- Process Management:
- PIDs of scenario agents are tracked and terminated on
cancelor when timeouts occur.
- PIDs of scenario agents are tracked and terminated on
- Memory Bank Integrity:
- Prompts instruct editing memory files via
edit_file(surgical diffs) rather thanwrite_fileto avoid overwrites.
- Prompts instruct editing memory files via
- Windows Specifics:
- Uses
desktop-commander.cmdshim to ensure proper stdio attachment;npmroaming path is discovered via%APPDATA%substitute if VS Code strips env.
- Uses
Build from source:
- Node 18+,
npm install,npm run build(outputs tobuild/).
Run as MCP server (direct):
node --experimental-specifier-resolution=node --experimental-modules --max-old-space-size=4096 build/index.js
Recommended install (automated):
npx deebo-setup@latest- Follow prompts; then restart your MCP client and ensure the
deeboserver appears in MCP configuration.
- Follow prompts; then restart your MCP client and ensure the
Basic usage in an MCP client:
- Start a session: call
deebo.startwitherror,repoPath, optionalcontext,language,filePath. - Check status: call
deebo.checkwithsessionId(wait ~30s initially). - Add observation: call
deebo.add_observationwithobservation,sessionId, and optionalagentId. - Cancel: call
deebo.cancelwithsessionId.
Diagnostics:
npx deebo-doctor(use--verbosefor details) to verify environment and configuration.
Memory bank navigation:
~/.deebo/memory-bank/<projectId>/sessions/<sessionId>/logsfor JSONL logs.~/.deebo/memory-bank/<projectId>/sessions/<sessionId>/reportsfor scenario outcomes.~/.deebo/memory-bank/<projectId>/activeContext.mdandprogress.mdfor running notes and history.
- Adding tools:
- Extend
config/tools.jsonwith new tool definitions (e.g., code analyzers, test runners). Use placeholders for paths; ensure env passed is sufficient. - Update prompts to teach tools, or detect new
<use_mcp_tool>tags at runtime.
- Extend
- New providers/models:
callLlmalready supports OpenAI/OpenRouter/Anthropic/Gemini; adapt to additional providers by extending the switch.
- Custom orchestration:
- Adjust OODA loop thresholds, timeouts, and branching strategy.
- Modify
checkpulse rendering or add new computed metrics.
- Server and agents
src/index.ts: MCP server, toolsstart|check|cancel|add_observation, process registry, path discovery, memory root.src/mother-agent.ts: Mother OODA loop, tool/hypothesis precedence, scenario spawning, memory updates, cancellation.src/scenario-agent.ts: Hypothesis-focused investigation loop and report writing.
- Utilities
src/util/mcp.ts: Connectsgit-mcpanddesktop-commander, placeholder/env handling, Windows shim.src/util/logger.ts: JSONL logging;src/util/reports.ts: report writer;src/util/observations.ts: observation read/write.src/util/membank.ts: appenders foractiveContext.mdandprogress.md.src/util/branch-manager.ts: createsdebug-...branches viasimple-git.src/util/agent-utils.ts: prompts and provider-agnosticcallLlm.src/util/sanitize.ts: stable project ID hashing fromrepoPath.
- Configuration and assets
config/tools.json: external tool launch definitions with placeholders.tsconfig.json,package.json: build/CLI exposure (bin.deebo, main).
- CLI packages
packages/deebo-setup: installation/configuration wizard.packages/deebo-doctor: environment/configuration diagnostics.
- Ensure
MOTHER_MODELandSCENARIO_MODELare set; otherwise the MCP server will throw on startup. OPENAI_BASE_URLmust be provided foropenaihost usage.- The first
checkoften needs ~30 seconds afterstartfor meaningful status. - Scenario timeouts default to 5 minutes; mother agent max runtime defaults to 60 minutes.
- Report files are JSON-formatted; the scenario prints report text to stdout as well for mother ingestion.
This document summarizes how Deebo is structured and how its agents coordinate investigations via MCP tools, Git isolation, and memory bank logs to accelerate debugging workflows.