aidb-architecture

Comprehensive architectural reference for AIDB core and MCP integration. Covers 6-layer architecture (MCP, Service, Session, Adapter, DAP Client, Protocol), component organization, data flow patterns, and design decisions. Use when explaining overall system design or understanding how layers interact.

$ Installieren

git clone https://github.com/ai-debugger-inc/aidb /tmp/aidb && cp -r /tmp/aidb/.claude/skills/aidb-architecture ~/.claude/skills/aidb

// tip: Run this command in your terminal to install the skill


name: aidb-architecture description: Comprehensive architectural reference for AIDB core and MCP integration. Covers 6-layer architecture (MCP, Service, Session, Adapter, DAP Client, Protocol), component organization, data flow patterns, and design decisions. Use when explaining overall system design or understanding how layers interact. version: 1.0.0 tags:

  • architecture
  • session
  • service
  • dap
  • mcp
  • design-patterns
  • components
  • data-flow

AIDB Architecture Skill

Overview

This skill provides a comprehensive architectural reference for understanding AIDB's multi-layered architecture, focusing on aidb core library and aidb_mcp MCP integration.

Purpose: Enable developers to navigate the codebase confidently, understand component responsibilities, trace data flows, and make correct architectural decisions.

Scope:

  • PRIMARY: aidb/ (core debugging library), aidb_mcp/ (MCP server integration)
  • SECONDARY: aidb_common/, aidb_logging/ (supporting utilities)
  • EXCLUDED: aidb_cli/ (covered by dev-cli-development skill)

When to Use This Skill

Use this skill when:

  • Understanding overall system architecture
  • Tracing data flow across layers (e.g., MCP tool call โ†’ DAP adapter)
  • Identifying component responsibilities
  • Making architectural decisions (which layer to modify)
  • Understanding design patterns and rationale
  • Debugging cross-layer issues

Do NOT use this skill for:

  • Deep adapter implementation patterns โ†’ Use adapter-development skill
  • DAP protocol details โ†’ Use dap-protocol-guide skill
  • MCP tool development โ†’ Use mcp-tools-development skill

6-Layer Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Layer 1: MCP Layer (aidb_mcp/)                             โ”‚
โ”‚  โ”œโ”€โ”€ 12 debugging tools for AI agents                       โ”‚
โ”‚  โ”œโ”€โ”€ Handler dispatch, response optimization                โ”‚
โ”‚  โ””โ”€โ”€ Session management integration                         โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  Layer 2: Service Layer (aidb/service/)                     โ”‚
โ”‚  โ”œโ”€โ”€ DebugService - Main entry point                        โ”‚
โ”‚  โ”œโ”€โ”€ SessionManager, SessionBuilder (in aidb/session/)      โ”‚
โ”‚  โ””โ”€โ”€ .execution / .stepping / .breakpoints / .variables     โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  Layer 3: Session Layer (aidb/session/)                     โ”‚
โ”‚  โ”œโ”€โ”€ Session - Infrastructure hub                           โ”‚
โ”‚  โ”œโ”€โ”€ SessionState, SessionConnector                         โ”‚
โ”‚  โ”œโ”€โ”€ SessionRegistry, ResourceManager                       โ”‚
โ”‚  โ””โ”€โ”€ Parent-child session support (JavaScript)              โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  Layer 4: Adapter Layer (aidb/adapters/)                    โ”‚
โ”‚  โ”œโ”€โ”€ DebugAdapter - Component delegation base               โ”‚
โ”‚  โ”œโ”€โ”€ ProcessManager, PortManager, LaunchOrchestrator        โ”‚
โ”‚  โ””โ”€โ”€ Language Adapters - Python, JavaScript, Java           โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  Layer 5: DAP Client Layer (aidb/dap/client/)               โ”‚
โ”‚  โ”œโ”€โ”€ DAPClient - Single request path                        โ”‚
โ”‚  โ”œโ”€โ”€ Transport, RequestHandler, EventProcessor              โ”‚
โ”‚  โ””โ”€โ”€ MessageRouter, ConnectionManager                       โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  Layer 6: Protocol Layer (aidb/dap/protocol/)               โ”‚
โ”‚  โ””โ”€โ”€ Fully-typed DAP specification (see dap-protocol-guide) โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Quick Navigation

"I want to understand..."

TopicResourceContents
MCP & Service Layersapi-mcp-layer.md12 tools, handler pattern, response system, DebugService, execution/stepping
Session Layersession-layer.mdInfrastructure hub, SessionState, SessionConnector, parent-child sessions
Adapter Layeradapter-architecture.mdDebugAdapter base, ProcessManager, PortManager, lifecycle hooks, Python/JS/Java
DAP Clientdap-client.mdSingle request path, Future-based async, event handling, design decisions
Patterns & Resourcespatterns-and-resources.mdArchitectural principles, three-tier cleanup, resource management, data flows

Key Architectural Principles

  1. Component Delegation - Focused components vs monolithic classes
  2. Language-Agnostic Design - Pluggable adapter architecture
  3. Human-Cadence Debugging - Breakpoints before execution, one step at a time
  4. Resource Lifecycle Management - Multi-tier cleanup with defense-in-depth
  5. Parent-Child Session Support - JavaScript subprocess debugging
  6. Single Request Path - No circular dependencies in DAP client
  7. Three-Tier Cleanup - DAP disconnect โ†’ process termination โ†’ port release

For detailed explanations, see patterns-and-resources.md.


Resource Management Summary

Three-Tier Cleanup Strategy:

  1. Tier 1: DAP disconnect (graceful adapter shutdown)
  2. Tier 2: Process termination (SIGTERM โ†’ SIGKILL escalation)
  3. Tier 3: Port release (registry updates)

Why Order Matters: Prevents port conflicts and orphaned processes.

Key Components:

  • Process Registry (aidb/resources/pids.py)
  • Port Registry (aidb/resources/ports.py)
  • Orphan Cleanup (aidb/resources/orphan_cleanup.py)
  • ResourceManager (aidb/session/resource.py)

Related Skills

SkillUse For
adapter-developmentLanguage-specific adapter implementation patterns
dap-protocol-guideDAP protocol specification and usage
mcp-tools-developmentMCP tool creation and agent optimization

Resources

ResourceContent
api-mcp-layer.mdMCP server, 12 tools, handler pattern, Service layer, execution/stepping
session-layer.mdSession architecture, infrastructure hub, state management, parent-child
adapter-architecture.mdAdapter base class, components, lifecycle hooks, language-specific patterns
dap-client.mdDAP client design, single request path, Future-based async, events
patterns-and-resources.mdArchitectural principles, resource management, cleanup, data flows

Documentation:

  • Architecture overview โ†’ docs/developer-guide/overview.md
  • Component source โ†’ src/aidb/, src/aidb_mcp/, src/aidb_cli/, src/aidb_common/, src/aidb_logging/

Quick Reference

6 Layers: MCP โ†’ Service โ†’ Session โ†’ Adapter โ†’ DAP Client โ†’ Protocol

Key Patterns: Component delegation, language-agnostic, human-cadence debugging, resource lifecycle, parent-child sessions, single request path

5 Resource Files: api-mcp-layer, session-layer, adapter-architecture, dap-client, patterns-and-resources