# mandlekaranurag786-afk/sdlc-ai architecture

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

- Interactive diagram: https://gitdiagram.com/mandlekaranurag786-afk/sdlc-ai
- Repository: https://github.com/mandlekaranurag786-afk/sdlc-ai

## Overview

This is an SDLC requirements-generation service with a Streamlit UI and FastAPI backend. Users submit a problem statement, answer iterative clarification questions when needed, generate and validate requirement documents, then preview or download results; prototype generation is also available. The agent coordinates analysis and document generation, while deterministic helpers support consistency, traceability, provenance, and hygiene checks. SQLite persists session state. The graph combines README workflow documentation and shown source references; several agent stages and helper interactions are represented from the source index rather than inspected implementation excerpts.

Main entry points: [`agent.py`](https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/agent.py) (Generation agent), [`streamlit_app/api_client.py`](https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/streamlit_app/api_client.py) (API client), [`main.py`](https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/main.py) (Requirements API), [`deterministic_checks.py`](https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/deterministic_checks.py) (Deterministic validation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["User interface"]
  node_streamlit["Streamlit workspace<br/>[app.py]"]
  node_ui_state["UI session state<br/>[state_manager.py]"]
  node_api_client["API client<br/>[api_client.py]"]
end

subgraph group_api["API and sessions"]
  node_api["Requirements API<br/>[main.py]"]
  node_auth["API authentication<br/>[auth.py]"]
  node_sessions[("Session persistence<br/>[db.py]")]
end

subgraph group_agent["Requirement workflow"]
  node_agent["Generation agent<br/>[agent.py]"]
  node_prompts["Prompt templates<br/>[prompts.py]"]
  node_llm["Language model client<br/>[llm.py]"]
  node_analysis["Requirement analysis<br/>[agent.py]"]
  node_clarification["Clarification loop<br/>[agent.py]"]
  node_brd["BRD generation<br/>[agent.py]"]
  node_epics["Epics and stories<br/>[agent.py]"]
  node_frd["FRD generation<br/>[agent.py]"]
  node_prototype["Prototype generation<br/>[agent.py]"]
end

subgraph group_quality["Validation and consistency"]
  node_checks["Deterministic validation"]
  node_arithmetic["Estimation arithmetic"]
  node_currency["Currency utilities<br/>[currency_utils.py]"]
  node_hygiene["BRD hygiene"]
  node_traceability["Traceability checks"]
  node_provenance["Numeric provenance"]
  node_feature_flags["Generation feature flags<br/>[feature_flags.py]"]
end

subgraph group_output["Documents and storage"]
  node_export["DOCX export<br/>[document_export.py]"]
  node_postprocess["Document post-processing<br/>[post_processor.py]"]
end

node_user(("Requirements author"))
node_external_llm(("LLM provider"))

node_user -->|"submits input"| node_streamlit
node_streamlit -->|"dispatches actions"| node_ui_state
node_ui_state -->|"requests workflow"| node_api_client
node_api_client -->|"calls endpoints"| node_api
node_api -.->|"verifies requests"| node_auth
node_api -->|"loads and saves"| node_sessions
node_api -->|"runs generation"| node_agent
node_agent -->|"analyzes requirements"| node_analysis
node_agent -->|"requests questions"| node_clarification
node_agent -->|"generates BRD"| node_brd
node_agent -->|"generates epics"| node_epics
node_agent -->|"generates FRD"| node_frd
node_agent -->|"generates prototype"| node_prototype
node_agent -->|"formats prompts"| node_prompts
node_agent -->|"requests completions"| node_llm
node_llm -->|"sends prompts"| node_external_llm
node_agent -->|"validates documents"| node_checks
node_checks -->|"recomputes estimates"| node_arithmetic
node_checks -->|"checks numeric claims"| node_provenance
node_agent -->|"updates estimates"| node_arithmetic
node_arithmetic -.->|"uses currency data"| node_currency
node_agent -->|"cleans BRD"| node_hygiene
node_agent -->|"checks mappings"| node_traceability
node_checks -->|"reads flags"| node_feature_flags
node_arithmetic -->|"reads flags"| node_feature_flags
node_agent -->|"exports documents"| node_export
node_export -->|"post-processes output"| node_postprocess
node_api_client -.->|"fetches session state"| node_sessions
node_api_client -->|"returns downloads"| node_user

click node_streamlit "https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/streamlit_app/app.py"
click node_ui_state "https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/streamlit_app/state_manager.py"
click node_api_client "https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/streamlit_app/api_client.py"
click node_api "https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/main.py"
click node_auth "https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/auth.py"
click node_sessions "https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/db.py"
click node_agent "https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/agent.py"
click node_prompts "https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/prompts.py"
click node_llm "https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/llm.py"
click node_analysis "https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/agent.py"
click node_clarification "https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/agent.py"
click node_brd "https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/agent.py"
click node_epics "https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/agent.py"
click node_frd "https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/agent.py"
click node_prototype "https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/agent.py"
click node_checks "https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/deterministic_checks.py"
click node_arithmetic "https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/arithmetic_utils.py"
click node_currency "https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/currency_utils.py"
click node_hygiene "https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/brd_hygiene_utils.py"
click node_traceability "https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/traceability_utils.py"
click node_provenance "https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/provenance_utils.py"
click node_export "https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/document_export.py"
click node_postprocess "https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/post_processor.py"
click node_feature_flags "https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/feature_flags.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_streamlit,node_ui_state,node_api_client toneBlue
class node_api,node_auth,node_sessions toneAmber
class node_agent,node_prompts,node_llm,node_analysis,node_clarification,node_brd,node_epics,node_frd,node_prototype toneMint
class node_checks,node_arithmetic,node_currency,node_hygiene,node_traceability,node_provenance,node_feature_flags toneRose
class node_export,node_postprocess,node_user,node_external_llm toneIndigo
```

## Components

### User interface

- [Streamlit workspace](https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/streamlit_app/app.py): `streamlit_app/app.py`
- [UI session state](https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/streamlit_app/state_manager.py): `streamlit_app/state_manager.py`
- [API client](https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/streamlit_app/api_client.py): `streamlit_app/api_client.py`

### API and sessions

- [Requirements API](https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/main.py): `main.py`
- [API authentication](https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/auth.py): `auth.py`
- [Session persistence](https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/db.py): `db.py`

### Requirement workflow

- [Generation agent](https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/agent.py): `agent.py`
- [Prompt templates](https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/prompts.py): `prompts.py`
- [Language model client](https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/llm.py): `llm.py`
- [Requirement analysis](https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/agent.py): `agent.py`
- [Clarification loop](https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/agent.py): `agent.py`
- [BRD generation](https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/agent.py): `agent.py`
- [Epics and stories](https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/agent.py): `agent.py`
- [FRD generation](https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/agent.py): `agent.py`
- [Prototype generation](https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/agent.py): `agent.py`

### Validation and consistency

- [Deterministic validation](https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/deterministic_checks.py): `deterministic_checks.py`
- [Estimation arithmetic](https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/arithmetic_utils.py): `arithmetic_utils.py`
- [Currency utilities](https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/currency_utils.py): `currency_utils.py`
- [BRD hygiene](https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/brd_hygiene_utils.py): `brd_hygiene_utils.py`
- [Traceability checks](https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/traceability_utils.py): `traceability_utils.py`
- [Numeric provenance](https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/provenance_utils.py): `provenance_utils.py`
- [Generation feature flags](https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/feature_flags.py): `feature_flags.py`

### Documents and storage

- [DOCX export](https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/document_export.py): `document_export.py`
- [Document post-processing](https://github.com/mandlekaranurag786-afk/sdlc-ai/blob/main/post_processor.py): `post_processor.py`

### Other components

- **Requirements author**
- **LLM provider**

## Connections

- Requirements author → Streamlit workspace: submits input (evidence: `README.md`)
- Streamlit workspace → UI session state: dispatches actions (evidence: `streamlit_app/app.py`)
- UI session state → API client: requests workflow (evidence: `streamlit_app/state_manager.py`)
- API client → Requirements API: calls endpoints (evidence: `streamlit_app/api_client.py`)
- Requirements API → API authentication: verifies requests (evidence: `main.py`)
- Requirements API → Session persistence: loads and saves (evidence: `main.py`)
- Requirements API → Generation agent: runs generation (evidence: `main.py`)
- Generation agent → Requirement analysis: analyzes requirements (evidence: `agent.py`)
- Generation agent → Clarification loop: requests questions (evidence: `agent.py`)
- Generation agent → BRD generation: generates BRD (evidence: `agent.py`)
- Generation agent → Epics and stories: generates epics (evidence: `agent.py`)
- Generation agent → FRD generation: generates FRD (evidence: `agent.py`)
- Generation agent → Prototype generation: generates prototype (evidence: `agent.py`)
- Generation agent → Prompt templates: formats prompts (evidence: `agent.py`)
- Generation agent → Language model client: requests completions (evidence: `agent.py`)
- Language model client → LLM provider: sends prompts (evidence: `llm.py`)
- Generation agent → Deterministic validation: validates documents (evidence: `agent.py`)
- Deterministic validation → Estimation arithmetic: recomputes estimates (evidence: `deterministic_checks.py`)
- Deterministic validation → Numeric provenance: checks numeric claims (evidence: `deterministic_checks.py`)
- Generation agent → Estimation arithmetic: updates estimates (evidence: `agent.py`)
- Estimation arithmetic → Currency utilities: uses currency data (evidence: `arithmetic_utils.py`)
- Generation agent → BRD hygiene: cleans BRD (evidence: `agent.py`)
- Generation agent → Traceability checks: checks mappings (evidence: `agent.py`)
- Deterministic validation → Generation feature flags: reads flags (evidence: `deterministic_checks.py`)
- Estimation arithmetic → Generation feature flags: reads flags (evidence: `arithmetic_utils.py`)
- Generation agent → DOCX export: exports documents (evidence: `agent.py`)
- DOCX export → Document post-processing: post-processes output (evidence: `document_export.py`)
- API client → Session persistence: fetches session state
- API client → Requirements author: returns downloads (evidence: `README.md`)
