Skip to main content

2. Core Subsystems

2.1 Subsystem Inventory

Batho is composed of tightly-integrated subsystems that work together to provide code intelligence capabilities. Each subsystem has a well-defined responsibility and can be tested independently.

SubsystemModule PathPurposeStatus
AST Extractionbatho/context/extractor.pytree-sitter based multi-language parsingProduction
Language Registrybatho/context/languages/Detector + per-language extractorsProduction
Code Graphbatho/context/codegraph.pyIn-memory hypergraph with adjacency indexingProduction
Symbol Indexbatho/context/symbol_index.pyCross-file import resolutionProduction
AST Cachebatho/context/cache.pySQLite-backed entity cachingProduction
Pipelinebatho/context/pipeline.pyParallel graph constructionProduction
BSG Mapbatho/context/bsg_map.pyFlat symbol index + renderersProduction
BSG Rulesbatho/bsg/rules.pyPlugin loader + semantic overlayProduction
Time Machinebatho/time_machine.pySnapshots, diffs, incremental patchesProduction
Hooksbatho/hooks/Git hook managementProduction
Dashboardbatho/dashboard/Interactive web UIProduction
Bridgebatho/bridge/REST API + MCP serverProduction
Cloud Syncbatho/cloud_sync/Artifact synchronizationProduction
Configbatho/config.pyPydantic-validated configurationProduction
Storagebatho/context/storage.pySQLite artifact registryProduction
Query Servicebatho/context/query.pyPersisted graph indexesProduction
Synthesizerbatho/synthesizer.pyEvolution ledger + failure rule synthesisProduction

2.2 Technology Stack

Runtime Environment

LayerTechnologyVersion
Language RuntimePython3.11+
AST Parsingtree-sitter0.25+
Language Packtree-sitter-language-packLatest
ConfigurationPydantic2.x

Interface Layer

LayerTechnologyPurpose
CLI Frameworkargparse (stdlib)Command-line interface
Web DashboardVanilla JS + Static HTMLInteractive visualization
REST APIstdlib http.serverProgrammatic access
MCP Serverstdio / sse transportLLM integration

Data Layer

LayerTechnologyPurpose
Cache / RegistrySQLite3.x
SnapshotsJSON filesTime-travel storage
MetricsJSON filesPerformance tracking

Development & Testing

LayerTechnologyPurpose
Testingpytest + pytest-cov8.x / 5.x
Build TooluvLatest
Type CheckingTypeScript6.x
Lintingruff, mypyCode quality

2.3 Subsystem Interactions

Subsystems communicate through well-defined interfaces:

Figure 4: Subsystem Interactions - Dependency graph showing how Batho subsystems communicate through well-defined interfaces. CLI connects to Extractor, Graph, Bridge, and Dashboard. Extractor connects to Cache, Graph, and Pipeline. Graph connects to SymbolIndex, BSG, and TimeMachine. SymbolIndex provides feedback to Graph. BSG connects to Rules, Bridge, and Snapshots. Rules provides feedback to BSG. TimeMachine connects to Snapshots and CLI. Bridge connects to Dashboard.

Figure 4: Subsystem Interactions - Dependency graph showing how Batho subsystems communicate through well-defined interfaces.

2.4 Data Flow Between Subsystems

  1. Extraction Phase: CLI → Extractor → Cache + Graph
  2. Resolution Phase: Graph → SymbolIndex → Graph (cross-file resolution)
  3. Intelligence Phase: Graph → BSG → Rules → BSG (semantic tagging)
  4. Output Phase: BSG → Snapshots + Bridge + Dashboard