Skip to content
aidb-architecture logo

AIDB Architecture Skill

aidb-architecture

Comprehensive architectural reference for AIDB core and MCP integration.

SKILL.md

Full skill instructions

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

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View