# farahchannir/ai-codebase-intelligence-engine architecture

> Architecture diagram of the GitHub repository farahchannir/ai-codebase-intelligence-engine, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/farahchannir/ai-codebase-intelligence-engine
- Repository: https://github.com/farahchannir/ai-codebase-intelligence-engine

## Overview

The checked-in runtime is an early code-ingestion and parsing pipeline: a caller supplies a repository source, and the pipeline returns code chunks. The README describes a broader planned codebase-intelligence product, including RAG, Q&A, bug detection, documentation, dependency analysis, APIs, and a UI; those capabilities are not present in the sampled runtime, so they are not represented as implemented components. Source excerpts are partial, so internal helper wiring is shown only where supported.

Main entry points: [`core/ingestion.py`](https://github.com/farahchannir/ai-codebase-intelligence-engine/blob/main/core/ingestion.py) (Ingest sources), [`core/chunking.py`](https://github.com/farahchannir/ai-codebase-intelligence-engine/blob/main/core/chunking.py) (Chunk dispatcher), [`main.py`](https://github.com/farahchannir/ai-codebase-intelligence-engine/blob/main/main.py) (Pipeline runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingestion["Code ingestion"]
  node_pipeline["Pipeline runner<br/>[main.py]"]
  node_ingest["Ingest sources<br/>[ingestion.py]"]
  node_git["Git clone<br/>[ingestion.py]"]
  node_zip["ZIP extraction<br/>[ingestion.py]"]
  node_file_filter["File discovery and filtering<br/>[ingestion.py]"]
  node_language["Language detection<br/>[ingestion.py]"]
  node_records["File records<br/>[ingestion.py]"]
end

subgraph group_parsing["Parsing and chunking"]
  node_chunk_entry["Chunk dispatcher<br/>[chunking.py]"]
  node_tree_sitter["Structure-aware parsers<br/>[chunking.py]"]
  node_window_chunker["Window fallback<br/>[chunking.py]"]
  node_chunks["Code chunks<br/>[chunking.py]"]
end

node_caller(("Pipeline caller"))

node_caller -->|"runs"| node_pipeline
node_pipeline -->|"calls"| node_ingest
node_ingest -->|"clones"| node_git
node_ingest -->|"extracts"| node_zip
node_ingest -->|"filters files"| node_file_filter
node_ingest -->|"detects language"| node_language
node_ingest -->|"returns records"| node_records
node_pipeline -->|"calls per record"| node_chunk_entry
node_records -->|"provides record"| node_chunk_entry
node_chunk_entry -->|"dispatches supported languages"| node_tree_sitter
node_chunk_entry -->|"falls back"| node_window_chunker
node_chunk_entry -->|"returns chunks"| node_chunks
node_pipeline -->|"returns result"| node_chunks

click node_pipeline "https://github.com/farahchannir/ai-codebase-intelligence-engine/blob/main/main.py"
click node_ingest "https://github.com/farahchannir/ai-codebase-intelligence-engine/blob/main/core/ingestion.py"
click node_git "https://github.com/farahchannir/ai-codebase-intelligence-engine/blob/main/core/ingestion.py"
click node_zip "https://github.com/farahchannir/ai-codebase-intelligence-engine/blob/main/core/ingestion.py"
click node_file_filter "https://github.com/farahchannir/ai-codebase-intelligence-engine/blob/main/core/ingestion.py"
click node_language "https://github.com/farahchannir/ai-codebase-intelligence-engine/blob/main/core/ingestion.py"
click node_records "https://github.com/farahchannir/ai-codebase-intelligence-engine/blob/main/core/ingestion.py"
click node_chunk_entry "https://github.com/farahchannir/ai-codebase-intelligence-engine/blob/main/core/chunking.py"
click node_tree_sitter "https://github.com/farahchannir/ai-codebase-intelligence-engine/blob/main/core/chunking.py"
click node_window_chunker "https://github.com/farahchannir/ai-codebase-intelligence-engine/blob/main/core/chunking.py"
click node_chunks "https://github.com/farahchannir/ai-codebase-intelligence-engine/blob/main/core/chunking.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_pipeline,node_ingest,node_git,node_zip,node_file_filter,node_language,node_records toneBlue
class node_chunk_entry,node_tree_sitter,node_window_chunker,node_chunks toneAmber
class node_caller toneIndigo
```

## Components

### Code ingestion

- [Pipeline runner](https://github.com/farahchannir/ai-codebase-intelligence-engine/blob/main/main.py): `main.py`
- [Ingest sources](https://github.com/farahchannir/ai-codebase-intelligence-engine/blob/main/core/ingestion.py): `core/ingestion.py`
- [Git clone](https://github.com/farahchannir/ai-codebase-intelligence-engine/blob/main/core/ingestion.py): `core/ingestion.py`
- [ZIP extraction](https://github.com/farahchannir/ai-codebase-intelligence-engine/blob/main/core/ingestion.py): `core/ingestion.py`
- [File discovery and filtering](https://github.com/farahchannir/ai-codebase-intelligence-engine/blob/main/core/ingestion.py): `core/ingestion.py`
- [Language detection](https://github.com/farahchannir/ai-codebase-intelligence-engine/blob/main/core/ingestion.py): `core/ingestion.py`
- [File records](https://github.com/farahchannir/ai-codebase-intelligence-engine/blob/main/core/ingestion.py): `core/ingestion.py`

### Parsing and chunking

- [Chunk dispatcher](https://github.com/farahchannir/ai-codebase-intelligence-engine/blob/main/core/chunking.py): `core/chunking.py`
- [Structure-aware parsers](https://github.com/farahchannir/ai-codebase-intelligence-engine/blob/main/core/chunking.py): `core/chunking.py`
- [Window fallback](https://github.com/farahchannir/ai-codebase-intelligence-engine/blob/main/core/chunking.py): `core/chunking.py`
- [Code chunks](https://github.com/farahchannir/ai-codebase-intelligence-engine/blob/main/core/chunking.py): `core/chunking.py`

### Other components

- **Pipeline caller**

## Connections

- Pipeline caller → Pipeline runner: runs
- Pipeline runner → Ingest sources: calls
- Ingest sources → Git clone: clones
- Ingest sources → ZIP extraction: extracts
- Ingest sources → File discovery and filtering: filters files
- Ingest sources → Language detection: detects language
- Ingest sources → File records: returns records
- Pipeline runner → Chunk dispatcher: calls per record
- File records → Chunk dispatcher: provides record
- Chunk dispatcher → Structure-aware parsers: dispatches supported languages
- Chunk dispatcher → Window fallback: falls back
- Chunk dispatcher → Code chunks: returns chunks
- Pipeline runner → Code chunks: returns result
