# jaindhruv1923/kavach architecture

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

- Interactive diagram: https://gitdiagram.com/jaindhruv1923/kavach
- Repository: https://github.com/jaindhruv1923/kavach

## Overview

KAVACH is a security-governed agentic DevOps platform. A developer submits a request through the dashboard or API; the backend orchestrator plans it, retrieves repository context, checks security and impact, generates code, validates it, and records workflow state for review or completion. Separate API capabilities support repository indexing/search, change-impact reports, SBOM generation, and security tools. The graph reflects the README’s major capabilities; several subsystem links are documented rather than verified from sampled implementation, so uncertain call relationships are omitted.

Main entry points: [`kavach/backend/app/agent/orchestrator.py`](https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/agent/orchestrator.py) (Workflow Orchestrator), [`kavach/backend/app/main.py`](https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/main.py) (FastAPI API), [`kavach/backend/app/mcp/server.py`](https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/mcp/server.py) (MCP Server), [`kavach/backend/app/impact/analyzer.py`](https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/impact/analyzer.py) (Impact Analyzer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Interfaces"]
  node_dashboard["Dashboard<br/>[app.js]"]
  node_api["FastAPI API<br/>[main.py]"]
  node_mcp["MCP Server<br/>[server.py]"]
end

subgraph group_workflow["Agent Workflow"]
  node_orchestrator["Workflow Orchestrator<br/>[orchestrator.py]"]
  node_planner["Request Planner<br/>[planner.py]"]
  node_run_state[("Run State<br/>[state.py]")]
end

subgraph group_knowledge["Repository Context"]
  node_ingestion["Repository Ingestion<br/>[ingest.py]"]
  node_vector_index[("Vector Index<br/>[embed_store.py]")]
end

subgraph group_governance["Security Governance"]
  node_detector["Sensitive Data Scan<br/>[detector.py]"]
  node_policy["Risk Policy<br/>[policy_engine.py]"]
  node_injection["Injection Shield"]
  node_package_firewall["Package Firewall"]
  node_sbom["SBOM Generator<br/>[sbom_generator.py]"]
  node_audit["Audit Redaction<br/>[audit_redaction.py]"]
end

subgraph group_analysis["Impact and Generation"]
  node_impact["Impact Analyzer<br/>[analyzer.py]"]
  node_dependency_graph["Dependency Graph"]
  node_impact_eval["Impact Evaluator<br/>[evaluator.py]"]
  node_generator["Code Generator<br/>[generator.py]"]
  node_llm_client["LLM Client<br/>[llm_client.py]"]
  node_validator["Output Validator<br/>[validator.py]"]
end

node_developer(("Developer"))
node_gemini{{"Gemini API"}}
node_qdrant[("Qdrant")]
node_verified_result["Governed Result"]

node_developer -->|"submits request"| node_dashboard
node_dashboard -->|"calls API"| node_api
node_api -->|"runs workflow"| node_orchestrator
node_api -->|"ingests repository"| node_ingestion
node_api -->|"searches repository"| node_vector_index
node_api -->|"analyzes change"| node_impact
node_api -->|"generates SBOM"| node_sbom
node_orchestrator -->|"plans request"| node_planner
node_orchestrator -->|"retrieves context"| node_vector_index
node_orchestrator -->|"scans content"| node_detector
node_orchestrator -->|"checks context"| node_injection
node_orchestrator -->|"evaluates risk"| node_policy
node_orchestrator -->|"analyzes impact"| node_impact
node_orchestrator -->|"generates code"| node_generator
node_orchestrator -->|"validates output"| node_validator
node_orchestrator -->|"saves run"| node_run_state
node_ingestion -->|"indexes chunks"| node_vector_index
node_vector_index -->|"stores vectors"| node_qdrant
node_impact -->|"builds graph"| node_dependency_graph
node_impact -->|"ranks effects"| node_impact_eval
node_generator -->|"requests completion"| node_llm_client
node_llm_client -.->|"sends prompt"| node_gemini
node_orchestrator -->|"completes workflow"| node_verified_result
node_mcp -->|"scans text"| node_detector
node_mcp -->|"checks prompt"| node_injection
node_mcp -->|"verifies packages"| node_package_firewall
node_mcp -->|"generates SBOM"| node_sbom

click node_dashboard "https://github.com/jaindhruv1923/kavach/blob/main/kavach/frontend/app.js"
click node_api "https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/main.py"
click node_mcp "https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/mcp/server.py"
click node_orchestrator "https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/agent/orchestrator.py"
click node_planner "https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/agent/planner.py"
click node_run_state "https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/agent/state.py"
click node_ingestion "https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/rag/ingest.py"
click node_vector_index "https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/rag/embed_store.py"
click node_detector "https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/security/detector.py"
click node_policy "https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/security/policy_engine.py"
click node_injection "https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/security/injection_shield.py"
click node_package_firewall "https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/security/package_firewall.py"
click node_sbom "https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/security/sbom_generator.py"
click node_audit "https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/security/audit_redaction.py"
click node_impact "https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/impact/analyzer.py"
click node_dependency_graph "https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/impact/dependency_graph.py"
click node_impact_eval "https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/impact/evaluator.py"
click node_generator "https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/generation/generator.py"
click node_llm_client "https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/generation/llm_client.py"
click node_validator "https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/generation/validator.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_dashboard,node_api,node_mcp toneBlue
class node_orchestrator,node_planner,node_run_state,node_qdrant toneAmber
class node_ingestion,node_vector_index,node_gemini toneMint
class node_detector,node_policy,node_injection,node_package_firewall,node_sbom,node_audit toneRose
class node_impact,node_dependency_graph,node_impact_eval,node_generator,node_llm_client,node_validator,node_developer,node_verified_result toneIndigo
```

## Components

### Interfaces

- [Dashboard](https://github.com/jaindhruv1923/kavach/blob/main/kavach/frontend/app.js): `kavach/frontend/app.js`
- [FastAPI API](https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/main.py): `kavach/backend/app/main.py`
- [MCP Server](https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/mcp/server.py): `kavach/backend/app/mcp/server.py`

### Agent Workflow

- [Workflow Orchestrator](https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/agent/orchestrator.py): `kavach/backend/app/agent/orchestrator.py`
- [Request Planner](https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/agent/planner.py): `kavach/backend/app/agent/planner.py`
- [Run State](https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/agent/state.py): `kavach/backend/app/agent/state.py`

### Repository Context

- [Repository Ingestion](https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/rag/ingest.py): `kavach/backend/app/rag/ingest.py`
- [Vector Index](https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/rag/embed_store.py): `kavach/backend/app/rag/embed_store.py`

### Security Governance

- [Sensitive Data Scan](https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/security/detector.py): `kavach/backend/app/security/detector.py`
- [Risk Policy](https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/security/policy_engine.py): `kavach/backend/app/security/policy_engine.py`
- [Injection Shield](https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/security/injection_shield.py): `kavach/backend/app/security/injection_shield.py`
- [Package Firewall](https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/security/package_firewall.py): `kavach/backend/app/security/package_firewall.py`
- [SBOM Generator](https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/security/sbom_generator.py): `kavach/backend/app/security/sbom_generator.py`
- [Audit Redaction](https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/security/audit_redaction.py): `kavach/backend/app/security/audit_redaction.py`

### Impact and Generation

- [Impact Analyzer](https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/impact/analyzer.py): `kavach/backend/app/impact/analyzer.py`
- [Dependency Graph](https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/impact/dependency_graph.py): `kavach/backend/app/impact/dependency_graph.py`
- [Impact Evaluator](https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/impact/evaluator.py): `kavach/backend/app/impact/evaluator.py`
- [Code Generator](https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/generation/generator.py): `kavach/backend/app/generation/generator.py`
- [LLM Client](https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/generation/llm_client.py): `kavach/backend/app/generation/llm_client.py`
- [Output Validator](https://github.com/jaindhruv1923/kavach/blob/main/kavach/backend/app/generation/validator.py): `kavach/backend/app/generation/validator.py`

### Other components

- **Developer**
- **Gemini API**
- **Qdrant**
- **Governed Result**

## Connections

- Developer → Dashboard: submits request
- Dashboard → FastAPI API: calls API
- FastAPI API → Workflow Orchestrator: runs workflow
- FastAPI API → Repository Ingestion: ingests repository
- FastAPI API → Vector Index: searches repository
- FastAPI API → Impact Analyzer: analyzes change
- FastAPI API → SBOM Generator: generates SBOM
- Workflow Orchestrator → Request Planner: plans request
- Workflow Orchestrator → Vector Index: retrieves context
- Workflow Orchestrator → Sensitive Data Scan: scans content
- Workflow Orchestrator → Injection Shield: checks context
- Workflow Orchestrator → Risk Policy: evaluates risk
- Workflow Orchestrator → Impact Analyzer: analyzes impact
- Workflow Orchestrator → Code Generator: generates code
- Workflow Orchestrator → Output Validator: validates output
- Workflow Orchestrator → Run State: saves run
- Repository Ingestion → Vector Index: indexes chunks
- Vector Index → Qdrant: stores vectors
- Impact Analyzer → Dependency Graph: builds graph
- Impact Analyzer → Impact Evaluator: ranks effects
- Code Generator → LLM Client: requests completion
- LLM Client → Gemini API: sends prompt
- Workflow Orchestrator → Governed Result: completes workflow
- MCP Server → Sensitive Data Scan: scans text
- MCP Server → Injection Shield: checks prompt
- MCP Server → Package Firewall: verifies packages
- MCP Server → SBOM Generator: generates SBOM
