# joshi-chinmay-016/cognify architecture

> Architecture diagram of the GitHub repository joshi-chinmay-016/cognify, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/joshi-chinmay-016/cognify
- Repository: https://github.com/joshi-chinmay-016/cognify

## Overview

Cognify is a local document-and-data assistant: users ask through the CLI, which routes questions to document retrieval, spreadsheet analytics, cross-workbook comparisons, or chart generation. Drive synchronization and local-file ingestion prepare Word text and Excel worksheets; RAG chunks and indexes searchable text, while Pandas computes numerical results. The README documents these product branches; sampled source confirms key ingestion, indexing, retrieval, and persistence calls. Some parser, routing, and analytics interactions are documented rather than fully sampled.

Main entry points: [`app/cli.py`](https://github.com/joshi-chinmay-016/cognify/blob/main/app/cli.py) (Interactive CLI), [`app/rag/pipeline.py`](https://github.com/joshi-chinmay-016/cognify/blob/main/app/rag/pipeline.py) (RAG Pipeline), [`app/ingestion/document_loader.py`](https://github.com/joshi-chinmay-016/cognify/blob/main/app/ingestion/document_loader.py) (Document Loader), [`app/drive/drive_client.py`](https://github.com/joshi-chinmay-016/cognify/blob/main/app/drive/drive_client.py) (Drive Sync)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Sync &amp; Ingestion"]
  node_drive_client["Drive Sync<br/>[drive_client.py]"]
  node_auth["Drive OAuth<br/>[authentication.py]"]
  node_loader["Document Loader<br/>[document_loader.py]"]
  node_word["Word Parser<br/>[word_parser.py]"]
  node_excel["Excel Parser<br/>[excel_parser.py]"]
end

subgraph group_rag["Document RAG"]
  node_chunker["Text Chunker<br/>[chunker.py]"]
  node_embedder["Local Embedder<br/>[embedder.py]"]
  node_vectors[("FAISS Store<br/>[vector_store.py]")]
  node_retriever["Semantic Retriever<br/>[retriever.py]"]
  node_pipeline["RAG Pipeline<br/>[pipeline.py]"]
end

subgraph group_analytics["Data Intelligence"]
  node_pandas["Pandas Analytics<br/>[pandas_engine.py]"]
  node_cross["Cross-File Analysis"]
  node_charts["Chart Generator<br/>[chart_generator.py]"]
end

subgraph group_interface["Assistant Interface"]
  node_cli["Interactive CLI<br/>[cli.py]"]
  node_router["Query Router<br/>[query_router.py]"]
end

subgraph group_local["Local Services"]
  node_config["App Configuration<br/>[config.py]"]
  node_metadata[("File Metadata<br/>[metadata.py]")]
  node_generator["Grounded Generator<br/>[generator.py]"]
end

node_user(("User"))
node_drive["Google Drive"]
node_ollama["Ollama"]

node_user -->|"asks"| node_cli
node_cli -->|"syncs files"| node_drive_client
node_drive_client -->|"authenticates with"| node_auth
node_drive_client -->|"lists and downloads"| node_drive
node_cli -->|"loads documents"| node_loader
node_loader -->|"parses Word"| node_word
node_loader -->|"parses Excel"| node_excel
node_loader -->|"tracks files"| node_metadata
node_loader -->|"prepares searchable text"| node_chunker
node_cli -->|"routes query"| node_router
node_cli -->|"answers document queries"| node_pipeline
node_pipeline -->|"splits documents"| node_chunker
node_pipeline -->|"embeds chunks"| node_embedder
node_pipeline -->|"indexes chunks"| node_vectors
node_pipeline -->|"retrieves context"| node_retriever
node_retriever -->|"embeds query"| node_embedder
node_retriever -->|"searches vectors"| node_vectors
node_pipeline -->|"generates grounded answer"| node_generator
node_generator -->|"requests inference"| node_ollama
node_cli -->|"runs spreadsheet analysis"| node_pandas
node_cli -->|"compares workbooks"| node_cross
node_cli -->|"generates charts"| node_charts
node_pandas -->|"calculates on worksheets"| node_excel
node_cross -->|"compares worksheet data"| node_excel
node_charts -->|"visualizes worksheet data"| node_excel
node_cli -->|"tracks processing state"| node_metadata
node_cli -->|"uses settings"| node_config
node_drive_client -->|"uses Drive settings"| node_config
node_pipeline -->|"uses RAG settings"| node_config
node_generator -->|"uses model settings"| node_config

click node_cli "https://github.com/joshi-chinmay-016/cognify/blob/main/app/cli.py"
click node_router "https://github.com/joshi-chinmay-016/cognify/blob/main/app/query_router.py"
click node_config "https://github.com/joshi-chinmay-016/cognify/blob/main/app/config.py"
click node_drive_client "https://github.com/joshi-chinmay-016/cognify/blob/main/app/drive/drive_client.py"
click node_auth "https://github.com/joshi-chinmay-016/cognify/blob/main/app/drive/authentication.py"
click node_loader "https://github.com/joshi-chinmay-016/cognify/blob/main/app/ingestion/document_loader.py"
click node_word "https://github.com/joshi-chinmay-016/cognify/blob/main/app/ingestion/word_parser.py"
click node_excel "https://github.com/joshi-chinmay-016/cognify/blob/main/app/ingestion/excel_parser.py"
click node_metadata "https://github.com/joshi-chinmay-016/cognify/blob/main/app/utils/metadata.py"
click node_chunker "https://github.com/joshi-chinmay-016/cognify/blob/main/app/rag/chunker.py"
click node_embedder "https://github.com/joshi-chinmay-016/cognify/blob/main/app/rag/embedder.py"
click node_vectors "https://github.com/joshi-chinmay-016/cognify/blob/main/app/rag/vector_store.py"
click node_retriever "https://github.com/joshi-chinmay-016/cognify/blob/main/app/rag/retriever.py"
click node_pipeline "https://github.com/joshi-chinmay-016/cognify/blob/main/app/rag/pipeline.py"
click node_generator "https://github.com/joshi-chinmay-016/cognify/blob/main/app/llm/generator.py"
click node_pandas "https://github.com/joshi-chinmay-016/cognify/blob/main/app/analytics/pandas_engine.py"
click node_cross "https://github.com/joshi-chinmay-016/cognify/blob/main/app/analytics/cross_file_analysis.py"
click node_charts "https://github.com/joshi-chinmay-016/cognify/blob/main/app/analytics/chart_generator.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_drive_client,node_auth,node_loader,node_word,node_excel,node_user toneBlue
class node_chunker,node_embedder,node_vectors,node_retriever,node_pipeline toneAmber
class node_pandas,node_cross,node_charts toneMint
class node_cli,node_router toneRose
class node_config,node_metadata,node_generator,node_drive,node_ollama toneIndigo
```

## Components

### Sync & Ingestion

- [Drive Sync](https://github.com/joshi-chinmay-016/cognify/blob/main/app/drive/drive_client.py): `app/drive/drive_client.py`
- [Drive OAuth](https://github.com/joshi-chinmay-016/cognify/blob/main/app/drive/authentication.py): `app/drive/authentication.py`
- [Document Loader](https://github.com/joshi-chinmay-016/cognify/blob/main/app/ingestion/document_loader.py): `app/ingestion/document_loader.py`
- [Word Parser](https://github.com/joshi-chinmay-016/cognify/blob/main/app/ingestion/word_parser.py): `app/ingestion/word_parser.py`
- [Excel Parser](https://github.com/joshi-chinmay-016/cognify/blob/main/app/ingestion/excel_parser.py): `app/ingestion/excel_parser.py`

### Document RAG

- [Text Chunker](https://github.com/joshi-chinmay-016/cognify/blob/main/app/rag/chunker.py): `app/rag/chunker.py`
- [Local Embedder](https://github.com/joshi-chinmay-016/cognify/blob/main/app/rag/embedder.py): `app/rag/embedder.py`
- [FAISS Store](https://github.com/joshi-chinmay-016/cognify/blob/main/app/rag/vector_store.py): `app/rag/vector_store.py`
- [Semantic Retriever](https://github.com/joshi-chinmay-016/cognify/blob/main/app/rag/retriever.py): `app/rag/retriever.py`
- [RAG Pipeline](https://github.com/joshi-chinmay-016/cognify/blob/main/app/rag/pipeline.py): `app/rag/pipeline.py`

### Data Intelligence

- [Pandas Analytics](https://github.com/joshi-chinmay-016/cognify/blob/main/app/analytics/pandas_engine.py): `app/analytics/pandas_engine.py`
- [Cross-File Analysis](https://github.com/joshi-chinmay-016/cognify/blob/main/app/analytics/cross_file_analysis.py): `app/analytics/cross_file_analysis.py`
- [Chart Generator](https://github.com/joshi-chinmay-016/cognify/blob/main/app/analytics/chart_generator.py): `app/analytics/chart_generator.py`

### Assistant Interface

- [Interactive CLI](https://github.com/joshi-chinmay-016/cognify/blob/main/app/cli.py): `app/cli.py`
- [Query Router](https://github.com/joshi-chinmay-016/cognify/blob/main/app/query_router.py): `app/query_router.py`

### Local Services

- [App Configuration](https://github.com/joshi-chinmay-016/cognify/blob/main/app/config.py): `app/config.py`
- [File Metadata](https://github.com/joshi-chinmay-016/cognify/blob/main/app/utils/metadata.py): `app/utils/metadata.py`
- [Grounded Generator](https://github.com/joshi-chinmay-016/cognify/blob/main/app/llm/generator.py): `app/llm/generator.py`

### Other components

- **User**
- **Google Drive**
- **Ollama**

## Connections

- User → Interactive CLI: asks (evidence: `README.md`)
- Interactive CLI → Drive Sync: syncs files (evidence: `README.md`)
- Drive Sync → Drive OAuth: authenticates with (evidence: `app/drive/drive_client.py`)
- Drive Sync → Google Drive: lists and downloads (evidence: `README.md`)
- Interactive CLI → Document Loader: loads documents (evidence: `app/cli.py`)
- Document Loader → Word Parser: parses Word (evidence: `app/ingestion/document_loader.py`)
- Document Loader → Excel Parser: parses Excel (evidence: `app/ingestion/document_loader.py`)
- Document Loader → File Metadata: tracks files (evidence: `app/ingestion/document_loader.py`)
- Document Loader → Text Chunker: prepares searchable text (evidence: `README.md`)
- Interactive CLI → Query Router: routes query (evidence: `app/cli.py`)
- Interactive CLI → RAG Pipeline: answers document queries (evidence: `app/cli.py`)
- RAG Pipeline → Text Chunker: splits documents (evidence: `app/rag/pipeline.py`)
- RAG Pipeline → Local Embedder: embeds chunks (evidence: `app/rag/pipeline.py`)
- RAG Pipeline → FAISS Store: indexes chunks (evidence: `app/rag/pipeline.py`)
- RAG Pipeline → Semantic Retriever: retrieves context (evidence: `app/rag/pipeline.py`)
- Semantic Retriever → Local Embedder: embeds query (evidence: `app/rag/retriever.py`)
- Semantic Retriever → FAISS Store: searches vectors (evidence: `app/rag/retriever.py`)
- RAG Pipeline → Grounded Generator: generates grounded answer (evidence: `README.md`)
- Grounded Generator → Ollama: requests inference (evidence: `app/llm/generator.py`)
- Interactive CLI → Pandas Analytics: runs spreadsheet analysis (evidence: `app/cli.py`)
- Interactive CLI → Cross-File Analysis: compares workbooks (evidence: `app/cli.py`)
- Interactive CLI → Chart Generator: generates charts (evidence: `app/cli.py`)
- Pandas Analytics → Excel Parser: calculates on worksheets (evidence: `app/analytics/pandas_engine.py`)
- Cross-File Analysis → Excel Parser: compares worksheet data (evidence: `README.md`)
- Chart Generator → Excel Parser: visualizes worksheet data (evidence: `app/analytics/chart_generator.py`)
- Interactive CLI → File Metadata: tracks processing state (evidence: `app/cli.py`)
- Interactive CLI → App Configuration: uses settings (evidence: `app/cli.py`)
- Drive Sync → App Configuration: uses Drive settings (evidence: `app/drive/drive_client.py`)
- RAG Pipeline → App Configuration: uses RAG settings (evidence: `app/rag/pipeline.py`)
- Grounded Generator → App Configuration: uses model settings (evidence: `app/llm/generator.py`)
