# divyanshrawat7/researchforge-plus-plus architecture

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

- Interactive diagram: https://gitdiagram.com/divyanshrawat7/researchforge-plus-plus
- Repository: https://github.com/divyanshrawat7/researchforge-plus-plus

## Overview

ResearchForge++ is a Streamlit research copilot: a researcher submits a question, the app retrieves and reranks papers, then five evidence-focused agents analyze the results and the app assembles a downloadable Markdown report. Its main stages are query expansion, dense and keyword retrieval, hybrid merging, reranking, evidence construction, analysis, and report assembly. The graph also shows resource loading and the local paper/index stores. Retrieval and agent interactions are grounded in the shown source; the README documents Gemini use. Notebooks and corpus-building workflows are not mapped because their runtime behavior was not sampled.

Main entry points: [`app/ui.py`](https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app/ui.py) (Research UI), [`app/retrieval.py`](https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app/retrieval.py) (Evidence context), [`app/agents.py`](https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app/agents.py) (Method comparison), [`app/report_generator.py`](https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app/report_generator.py) (Report assembly)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_entry["App entry<br/>[app.py]"]
  node_ui["Research UI<br/>[ui.py]"]
end

subgraph group_retrieval["Literature retrieval"]
  node_resource_loader["Resource loader<br/>[retrieval.py]"]
  node_query_expansion["Query expansion<br/>[retrieval.py]"]
  node_hybrid_retrieval["Hybrid retrieval<br/>[retrieval.py]"]
  node_dense_search["FAISS search<br/>[retrieval.py]"]
  node_keyword_search["BM25 search<br/>[retrieval.py]"]
  node_reranking["Cross-encoder reranking<br/>[retrieval.py]"]
  node_evidence["Evidence context<br/>[retrieval.py]"]
end

subgraph group_analysis["Research analysis"]
  node_method_agent["Method comparison<br/>[agents.py]"]
  node_contradiction_agent["Contradiction detection<br/>[agents.py]"]
  node_gap_agent["Research gap detection<br/>[agents.py]"]
  node_idea_agent["Research idea generation<br/>[agents.py]"]
  node_debate_agent["Research debate<br/>[agents.py]"]
end

subgraph group_data["Corpus and reporting"]
  node_papers[("Paper corpus<br/>[papers.json]")]
  node_faiss_index[("FAISS index")]
  node_report_generator["Report assembly"]
end

node_researcher(("Researcher"))
node_gemini{{"Google Gemini"}}

node_researcher -->|"submits question"| node_ui
node_entry -->|"starts"| node_ui
node_ui -->|"loads resources"| node_resource_loader
node_resource_loader -->|"reads"| node_papers
node_resource_loader -->|"loads"| node_faiss_index
node_ui -->|"expands query"| node_query_expansion
node_ui -->|"requests papers"| node_hybrid_retrieval
node_hybrid_retrieval -->|"expands query"| node_query_expansion
node_hybrid_retrieval -->|"runs dense search"| node_dense_search
node_hybrid_retrieval -->|"runs BM25 search"| node_keyword_search
node_dense_search -->|"searches"| node_faiss_index
node_keyword_search -->|"ranks abstracts"| node_papers
node_hybrid_retrieval -->|"reranks merged results"| node_reranking
node_reranking -->|"returns ranked papers"| node_hybrid_retrieval
node_ui -->|"builds context"| node_evidence
node_ui -->|"sends evidence"| node_method_agent
node_ui -->|"sends evidence"| node_contradiction_agent
node_ui -->|"sends evidence"| node_gap_agent
node_ui -->|"sends evidence"| node_idea_agent
node_ui -->|"sends evidence"| node_debate_agent
node_evidence -->|"grounds analysis"| node_method_agent
node_evidence -->|"grounds analysis"| node_contradiction_agent
node_evidence -->|"grounds analysis"| node_gap_agent
node_evidence -->|"grounds analysis"| node_idea_agent
node_evidence -->|"grounds analysis"| node_debate_agent
node_method_agent -->|"requests generation"| node_gemini
node_contradiction_agent -->|"requests generation"| node_gemini
node_gap_agent -->|"requests generation"| node_gemini
node_idea_agent -->|"requests generation"| node_gemini
node_debate_agent -->|"requests generation"| node_gemini
node_ui -->|"assembles report"| node_report_generator
node_report_generator -->|"returns Markdown"| node_ui
node_ui -->|"displays and downloads"| node_researcher

click node_entry "https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app.py"
click node_ui "https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app/ui.py"
click node_resource_loader "https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app/retrieval.py"
click node_query_expansion "https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app/retrieval.py"
click node_hybrid_retrieval "https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app/retrieval.py"
click node_dense_search "https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app/retrieval.py"
click node_keyword_search "https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app/retrieval.py"
click node_reranking "https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app/retrieval.py"
click node_evidence "https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app/retrieval.py"
click node_papers "https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/data/papers.json"
click node_faiss_index "https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/vector_db/researchforge_faiss.index"
click node_method_agent "https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app/agents.py"
click node_contradiction_agent "https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app/agents.py"
click node_gap_agent "https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app/agents.py"
click node_idea_agent "https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app/agents.py"
click node_debate_agent "https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app/agents.py"
click node_report_generator "https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app/report_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_entry,node_ui toneBlue
class node_resource_loader,node_query_expansion,node_hybrid_retrieval,node_dense_search,node_keyword_search,node_reranking,node_evidence toneAmber
class node_method_agent,node_contradiction_agent,node_gap_agent,node_idea_agent,node_debate_agent toneMint
class node_papers,node_faiss_index,node_report_generator toneRose
class node_researcher,node_gemini toneIndigo
```

## Components

### User interface

- [App entry](https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app.py): `app.py`
- [Research UI](https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app/ui.py): `app/ui.py`

### Literature retrieval

- [Resource loader](https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app/retrieval.py): `app/retrieval.py`
- [Query expansion](https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app/retrieval.py): `app/retrieval.py`
- [Hybrid retrieval](https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app/retrieval.py): `app/retrieval.py`
- [FAISS search](https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app/retrieval.py): `app/retrieval.py`
- [BM25 search](https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app/retrieval.py): `app/retrieval.py`
- [Cross-encoder reranking](https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app/retrieval.py): `app/retrieval.py`
- [Evidence context](https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app/retrieval.py): `app/retrieval.py`

### Research analysis

- [Method comparison](https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app/agents.py): `app/agents.py`
- [Contradiction detection](https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app/agents.py): `app/agents.py`
- [Research gap detection](https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app/agents.py): `app/agents.py`
- [Research idea generation](https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app/agents.py): `app/agents.py`
- [Research debate](https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app/agents.py): `app/agents.py`

### Corpus and reporting

- [Paper corpus](https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/data/papers.json): `data/papers.json`
- [FAISS index](https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/vector_db/researchforge_faiss.index): `vector_db/researchforge_faiss.index`
- [Report assembly](https://github.com/divyanshrawat7/researchforge-plus-plus/blob/main/app/report_generator.py): `app/report_generator.py`

### Other components

- **Researcher**
- **Google Gemini**

## Connections

- Researcher → Research UI: submits question (evidence: `app/ui.py`)
- App entry → Research UI: starts (evidence: `app.py`)
- Research UI → Resource loader: loads resources (evidence: `app/ui.py`)
- Resource loader → Paper corpus: reads (evidence: `app/retrieval.py`)
- Resource loader → FAISS index: loads (evidence: `app/retrieval.py`)
- Research UI → Query expansion: expands query (evidence: `app/ui.py`)
- Research UI → Hybrid retrieval: requests papers (evidence: `app/ui.py`)
- Hybrid retrieval → Query expansion: expands query (evidence: `app/retrieval.py`)
- Hybrid retrieval → FAISS search: runs dense search (evidence: `app/retrieval.py`)
- Hybrid retrieval → BM25 search: runs BM25 search (evidence: `app/retrieval.py`)
- FAISS search → FAISS index: searches (evidence: `app/retrieval.py`)
- BM25 search → Paper corpus: ranks abstracts (evidence: `app/retrieval.py`)
- Hybrid retrieval → Cross-encoder reranking: reranks merged results (evidence: `app/retrieval.py`)
- Cross-encoder reranking → Hybrid retrieval: returns ranked papers (evidence: `app/retrieval.py`)
- Research UI → Evidence context: builds context (evidence: `app/ui.py`)
- Research UI → Method comparison: sends evidence (evidence: `app/ui.py`)
- Research UI → Contradiction detection: sends evidence (evidence: `app/ui.py`)
- Research UI → Research gap detection: sends evidence (evidence: `app/ui.py`)
- Research UI → Research idea generation: sends evidence (evidence: `app/ui.py`)
- Research UI → Research debate: sends evidence (evidence: `app/ui.py`)
- Evidence context → Method comparison: grounds analysis (evidence: `app/ui.py`)
- Evidence context → Contradiction detection: grounds analysis (evidence: `app/ui.py`)
- Evidence context → Research gap detection: grounds analysis (evidence: `app/ui.py`)
- Evidence context → Research idea generation: grounds analysis (evidence: `app/ui.py`)
- Evidence context → Research debate: grounds analysis (evidence: `app/ui.py`)
- Method comparison → Google Gemini: requests generation (evidence: `README.md`)
- Contradiction detection → Google Gemini: requests generation (evidence: `README.md`)
- Research gap detection → Google Gemini: requests generation (evidence: `README.md`)
- Research idea generation → Google Gemini: requests generation (evidence: `README.md`)
- Research debate → Google Gemini: requests generation (evidence: `README.md`)
- Research UI → Report assembly: assembles report (evidence: `app/ui.py`)
- Report assembly → Research UI: returns Markdown (evidence: `app/ui.py`)
- Research UI → Researcher: displays and downloads (evidence: `app/ui.py`)
