system_pipeline

HowItWorks.json

// Deep-dive technical breakdown of the GitMesh AI code intelligence engine.

HowItWorks.json
JSON · UTF-8
{  "id": 1,  "stepNumber": "01",  "title": "Connect & Import",  "headline": "Shallow clone and workspace detection",  "description": "Paste a public or private GitHub repository URL. GitMesh performs a shallow clone (git clone --depth 1) of the target branch to retrieve the active codebase state. It runs ingestion diagnostics to analyze project files, detect monorepos, locate package configs, and identify all active programming languages.",  "tech": [    "GitHub REST API",    "Shallow Clone (Depth-1)",    "Monorepo Detection",    "Workspace Ingestion"  ],  "codePreview": "$ git clone --depth 1 --branch main https://github.com/owner/repo"}

Shallow clone and workspace detection

GitHub REST APIShallow Clone (Depth-1)Monorepo DetectionWorkspace Ingestion
bash · git-clone
$ gitmesh-cli import --url

Shallow cloning ensures we only pull the metadata and files required for structural analysis, optimizing memory and reducing wait times under 2 seconds.

system_execution_flow

Step-by-Step Architecture Process

Walk through the detailed sequence of steps GitMesh performs to clone, analyze, parse, route, and stream answers for your codebase.

01

Connect & Import

Shallow clone and workspace detection

Paste a public or private GitHub repository URL. GitMesh performs a shallow clone (git clone --depth 1) of the target branch to retrieve the active codebase state. It runs ingestion diagnostics to analyze project files, detect monorepos, locate package configs, and identify all active programming languages.

GitHub REST APIShallow Clone (Depth-1)Monorepo DetectionWorkspace Ingestion
terminal / code representationbash · python
$ git clone --depth 1 --branch main https://github.com/owner/repo
02

AST Parse & Graph Compile

Tree-sitter syntactic extraction

Code files are processed using language-specific Tree-sitter parsers (such as ts_parser.py and python_parser.py). The system extracts structural declaration nodes: classes, functions, import directives, variable declarations, and associated docstrings. By mapping import paths to actual file definitions, it builds a multi-file dependency graph of nodes and relational call edges.

Tree-sitter Parsersts_parser.pypython_parser.pyAbstract Syntax Trees (AST)Dependency Graph Creation
terminal / code representationbash · python
parse_source_file(file_content) → { classes, functions, imports, docstrings }
03

Vectorless RAG Routing

Bi-directional Graph BFS & Hybrid Context

Unlike traditional vector database RAG, GitMesh does not chunk files or store embeddings. First, it uses Gemini LLM structured outputs to map the user query to TargetEntities (target file paths and symbols). It then executes a Breadth-First Search (BFS) graph walk traversing import and dependent relationships. Depth-0 & Depth-1 files load full source code; Depth-2 files load AST outlines (signatures & docstrings only) for import validation. Depth-3 and above are excluded to save tokens.

TargetEntities MappingBi-directional BFS WalkHybrid Context StuffingAST Signatures OutlineGemini Context Cache
terminal / code representationbash · python
ASTRouter.walk_graph(target_files, graph_data, max_depth=2) → (depth_1_full, depth_2_signatures)
04

Multi-Agent Pipeline

LangGraph supervisor coordination

The compiled hybrid context is fed to a multi-agent pipeline choreographed using LangGraph. A supervisor agent node acts as the central router, classifying the user's intent and delegating code retrieval to specialized worker nodes: Code QA for direct questions, Visualizer for Mermaid flowchart rendering, Blast Radius for change-impact diffing, and Repo Summary for codebase overviews.

LangGraph OrchestrationSupervisor Agent PatternWorker Specialist AgentsStructured JSON Tool Outputs
terminal / code representationbash · python
workflow: START → Supervisor → { CodeQA, Visualizer, BlastRadius, RepoSummary } → END
05

SSE Stream & Visualization

SSE text streaming and interactive layouts

Response outputs are streamed dynamically back to the client console via Server-Sent Events (SSE). The stream broadcasts live agent execution logs (thought chains), final markdown answers, specific code citations linked to file line ranges, and interactive visualizations such as dependency graphs and Mermaid class flowcharts.

SSE (Server-Sent Events)Mermaid.js FlowchartsInteractive Graph ViewerSource Line Citations
terminal / code representationbash · python
data: { "type": "thought", "content": "Supervisor routing query to QA specialist..." }

comparison

Why Vectorless Graph RAG?

Traditional RAG splits code into text chunks and compares them using vector embeddings. This loses structure. GitMesh maps relations.

Traditional Vector RAG

  • Splits functions and classes mid-line based on character count boundaries.
  • Ignores codebase imports, call relationships, and execution pathways.
  • Prone to retrieval hallucinations due to semantic similarity overlap.

GitMesh AST Graph RAG

Active
  • Parses files into syntactically valid AST syntax blocks (methods, exports).
  • Builds a complete, multi-file relational import & call dependency graph.
  • Context window loading using Graph BFS (Depth-1 source + Depth-2 signatures).