# hemantmoree/repognition architecture

> Architecture diagram of the GitHub repository hemantmoree/repognition, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-10-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hemantmoree/repognition
- Repository: https://github.com/hemantmoree/repognition

## Overview

##### Project type and purpose
- This is a Python-based command-line and Streamlit tool (“Repo-gnition”) that implements a Retrieval-Augmented Generation (RAG) pipeline.
- Its purpose is to index arbitrary GitHub codebases into a local FAISS vector store and then answer natural-language questions about the code with direct source citations.

##### File structure
- Top-level directories:
- app/             – Streamlit and Typer-based frontends (app/main.py, app/cli.py)
- config/          – Global settings (config/settings.py)
- src/components/  – Core building blocks: git_cloner, chunker, vectorstore
- src/parsers/     – Language-specific parsers (Python, Java, JS, Markdown)
- src/llm/         – Ollama client for embeddings & generations
- src/pipeline/    – Orchestrators: indexing.py & querying.py
- src/utils/       – Helpers (cache_manager, gitignore_loader)
- Supporting files: requirements.txt, setup.py, pytest.ini, tests/

##### README for additional insights
- Two-phase flow:
A. Indexing: clone → parse & chunk → enrich (LLM summaries & keywords) → embed → store in FAISS
B. Querying: embed(question) → retrieve top chunks → generate answer (LLM) → present with citations
- Uses local Ollama models for both embeddings and generation.
- Provides both CLI commands (`repognition index/query`) and a Streamlit UI.
- Basic and detailed flowcharts are in assets/basic_flow_chart.png and assets/flowchart.png.

##### Key reminders
- Every distinct component in src/ (components, parsers, llm, pipeline, utils).
- How config/settings.py drives model choice & directories.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% UI Layer
    CLI["CLI UI"]:::ui
    WebUI["Web UI"]:::ui

    %% Configuration
    Settings["Global Configuration"]:::external

    %% Controllers
    IndexCtrl["IndexingController"]:::controllers
    QueryCtrl["QueryingController"]:::controllers

    %% Processing Components
    subgraph "Processing Components"
        direction TB
        GitCloner["GitCloner"]:::processing
        subgraph "Parsers"
            direction TB
            PyParser["Python Parser"]:::processing
            JavaParser["Java Parser"]:::processing
            JSParser["JavaScript Parser"]:::processing
            MDParser["Markdown Parser"]:::processing
        end
        Chunker["Chunker"]:::processing
        OllamaClient["Ollama LLM Client"]:::processing
    end

    %% Storage & Utils
    subgraph "Storage & Utils"
        direction TB
        VectorStore["VectorStore (FAISS)"]:::storage
        LocalFS["Local Filesystem (repos & data)"]:::storage
        CacheMgr["Cache Manager"]:::storage
        Gitignore["Gitignore Loader"]:::storage
    end

    %% External Services
    GitHub["GitHub API"]:::external
    OllamaAPI["Ollama API"]:::external
    Assets["Flowchart Assets"]:::external

    %% Indexing Flow
    CLI -->|uses| IndexCtrl
    WebUI -->|uses| IndexCtrl
    Settings -->|configures| IndexCtrl
    IndexCtrl -->|clones repo| GitCloner
    GitHub -->|repo data| GitCloner
    GitCloner -->|writes files| LocalFS
    LocalFS -->|raw files| PyParser
    LocalFS -->|raw files| JavaParser
    LocalFS -->|raw files| JSParser
    LocalFS -->|raw files| MDParser
    PyParser -->|parsed chunks| Chunker
    JavaParser -->|parsed chunks| Chunker
    JSParser -->|parsed chunks| Chunker
    MDParser -->|parsed chunks| Chunker
    Chunker -->|text chunks| OllamaClient
    OllamaAPI -->|LLM calls| OllamaClient
    Settings -->|model settings| OllamaClient
    OllamaClient -->|embeddings| VectorStore
    VectorStore -->|stored vectors| LocalFS

    %% Querying Flow
    CLI -->|uses| QueryCtrl
    WebUI -->|uses| QueryCtrl
    Settings -->|configures| QueryCtrl
    QueryCtrl -->|embed question| OllamaClient
    OllamaClient -->|vector query| VectorStore
    VectorStore -->|top-k chunks| QueryCtrl
    QueryCtrl -->|generate answer| OllamaClient
    OllamaClient -->|answer + citations| WebUI
    OllamaClient -->|answer + citations| CLI

    %% Utilities
    CacheMgr -->|caches| LocalFS
    Gitignore -->|filters files| GitCloner

    %% Assets
    Assets

    %% Click Events
    click CLI "https://github.com/hemantmoree/repognition/blob/main/app/cli.py"
    click WebUI "https://github.com/hemantmoree/repognition/blob/main/app/main.py"
    click Settings "https://github.com/hemantmoree/repognition/blob/main/config/settings.py"
    click IndexCtrl "https://github.com/hemantmoree/repognition/blob/main/src/pipeline/indexing.py"
    click QueryCtrl "https://github.com/hemantmoree/repognition/blob/main/src/pipeline/querying.py"
    click GitCloner "https://github.com/hemantmoree/repognition/blob/main/src/components/git_cloner.py"
    click PyParser "https://github.com/hemantmoree/repognition/blob/main/src/parsers/python_parser.py"
    click JavaParser "https://github.com/hemantmoree/repognition/blob/main/src/parsers/java_parser.py"
    click JSParser "https://github.com/hemantmoree/repognition/blob/main/src/parsers/js_parser.py"
    click MDParser "https://github.com/hemantmoree/repognition/blob/main/src/parsers/markdown_parser.py"
    click Chunker "https://github.com/hemantmoree/repognition/blob/main/src/components/chunker.py"
    click OllamaClient "https://github.com/hemantmoree/repognition/blob/main/src/llm/ollama_client.py"
    click VectorStore "https://github.com/hemantmoree/repognition/blob/main/src/components/vectorstore.py"
    click CacheMgr "https://github.com/hemantmoree/repognition/blob/main/src/utils/cache_manager.py"
    click Gitignore "https://github.com/hemantmoree/repognition/blob/main/src/utils/gitignore_loader.py"
    click Assets "https://github.com/hemantmoree/repognition/tree/main/assets/"

    %% Styles
    classDef ui fill:#e6ffed,stroke:#2ecc71;
    classDef controllers fill:#e8f8f5,stroke:#3498db;
    classDef processing fill:#fff0e0,stroke:#d35400;
    classDef storage fill:#f5e6ff,stroke:#8e44ad;
    classDef external fill:#ececec,stroke:#7f8c8d;
```
