# deeepak-17/clasp architecture

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

- Interactive diagram: https://gitdiagram.com/deeepak-17/clasp
- Repository: https://github.com/deeepak-17/clasp

## Overview

CLASP is an on-premise federated code-generation system: clients train local LoRA adapters, a cluster aggregates them, and the registry versions and promotes adapters for later use. Evaluation measures code-generation quality and presents results in a dashboard. The graph preserves the documented training, aggregation, registry, personalization, security, and evaluation capabilities. Some implementation paths are included from the repository tree and README rather than sampled source; those links are marked dashed when their wiring is not shown.

Main entry points: [`services/cluster/src/cluster/server.py`](https://github.com/deeepak-17/clasp/blob/main/services/cluster/src/cluster/server.py) (Federation Server), [`services/edge/src/edge/train_client.py`](https://github.com/deeepak-17/clasp/blob/main/services/edge/src/edge/train_client.py) (Client LoRA Training), [`services/registry/src/registry/app.py`](https://github.com/deeepak-17/clasp/blob/main/services/registry/src/registry/app.py) (Registry API), [`services/evaluation/src/evaluation/eval_harness/harness.py`](https://github.com/deeepak-17/clasp/blob/main/services/evaluation/src/evaluation/eval_harness/harness.py) (Evaluation Harness)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_edge["Edge Layer"]
  node_train["Client LoRA Training<br/>[train_client.py]"]
  node_chunk["Code Chunking<br/>[chunking.py]"]
  node_model["Model Loading<br/>[model_loader.py]"]
  node_merge["Adapter Merge &amp; Inference<br/>[merge.py]"]
  node_edge_registry["Edge Registry Client<br/>[registry_client.py]"]
end

subgraph group_cluster["Cluster Layer"]
  node_cluster_server["Federation Server<br/>[server.py]"]
  node_aggregation["Federated Aggregation<br/>[aggregation.py]"]
  node_adapter["LoRA Adapter Format<br/>[adapter_format.py]"]
  node_clustering["Client Clustering<br/>[clustering.py]"]
  node_redistribution["Adapter Redistribution<br/>[redistribution.py]"]
end

subgraph group_registry["State Registry"]
  node_registry_app["Registry API<br/>[app.py]"]
  node_storage[("Versioned Adapter Store<br/>[storage.py]")]
  node_composition["Composite Adapters<br/>[composition.py]"]
  node_promotion["Promotion &amp; Rollback<br/>[promotion.py]"]
end

subgraph group_evaluation["Evaluation"]
  node_evaluation["Evaluation Harness<br/>[harness.py]"]
  node_scoring["Pass@k Scoring<br/>[scoring.py]"]
  node_execution["Sandboxed Execution<br/>[execution.py]"]
  node_dashboard["Evaluation Dashboard<br/>[App.tsx]"]
end

subgraph group_shared["Shared Contracts &amp; Security"]
  node_contracts["Shared Data Contracts<br/>[types.py]"]
  node_dp["Differential Privacy<br/>[engine.py]"]
  node_mtls["mTLS Security<br/>[context.py]"]
end

node_developer(("Developer"))

node_developer -.->|"trains locally"| node_train
node_train -->|"uses chunks"| node_chunk
node_train -->|"loads model"| node_model
node_train -.->|"applies DP"| node_dp
node_train -.->|"submits adapter"| node_cluster_server
node_cluster_server -->|"aggregates updates"| node_aggregation
node_cluster_server -->|"encodes updates"| node_adapter
node_cluster_server -->|"orchestrates clients"| node_clustering
node_cluster_server -->|"redistributes adapters"| node_redistribution
node_cluster_server -->|"publishes aggregate"| node_registry_app
node_cluster_server -.->|"secures transport"| node_mtls
node_registry_app -->|"reads and writes"| node_storage
node_registry_app -->|"plans composites"| node_composition
node_registry_app -->|"promotes adapters"| node_promotion
node_registry_app -->|"uses contracts"| node_contracts
node_edge_registry -.->|"fetches adapters"| node_registry_app
node_edge_registry -.->|"supplies adapters"| node_merge
node_train -->|"uses cluster adapter"| node_merge
node_evaluation -.->|"requests inference"| node_edge_registry
node_evaluation -->|"runs candidates"| node_execution
node_evaluation -->|"scores outcomes"| node_scoring
node_dashboard -.->|"presents results"| node_evaluation
node_aggregation -.->|"shares adapter metadata"| node_contracts

click node_train "https://github.com/deeepak-17/clasp/blob/main/services/edge/src/edge/train_client.py"
click node_chunk "https://github.com/deeepak-17/clasp/blob/main/services/edge/src/edge/chunking.py"
click node_model "https://github.com/deeepak-17/clasp/blob/main/services/edge/src/edge/model_loader.py"
click node_merge "https://github.com/deeepak-17/clasp/blob/main/services/edge/src/edge/merge.py"
click node_edge_registry "https://github.com/deeepak-17/clasp/blob/main/services/edge/src/edge/registry_client.py"
click node_cluster_server "https://github.com/deeepak-17/clasp/blob/main/services/cluster/src/cluster/server.py"
click node_aggregation "https://github.com/deeepak-17/clasp/blob/main/services/cluster/src/cluster/aggregation.py"
click node_adapter "https://github.com/deeepak-17/clasp/blob/main/services/cluster/src/cluster/adapter_format.py"
click node_clustering "https://github.com/deeepak-17/clasp/blob/main/services/cluster/src/cluster/clustering.py"
click node_redistribution "https://github.com/deeepak-17/clasp/blob/main/services/cluster/src/cluster/redistribution.py"
click node_registry_app "https://github.com/deeepak-17/clasp/blob/main/services/registry/src/registry/app.py"
click node_storage "https://github.com/deeepak-17/clasp/blob/main/services/registry/src/registry/storage.py"
click node_composition "https://github.com/deeepak-17/clasp/blob/main/services/registry/src/registry/composition.py"
click node_promotion "https://github.com/deeepak-17/clasp/blob/main/services/registry/src/registry/promotion.py"
click node_evaluation "https://github.com/deeepak-17/clasp/blob/main/services/evaluation/src/evaluation/eval_harness/harness.py"
click node_scoring "https://github.com/deeepak-17/clasp/blob/main/services/evaluation/src/evaluation/eval_harness/scoring.py"
click node_execution "https://github.com/deeepak-17/clasp/blob/main/services/evaluation/src/evaluation/eval_harness/execution.py"
click node_dashboard "https://github.com/deeepak-17/clasp/blob/main/services/evaluation/dashboard/src/App.tsx"
click node_contracts "https://github.com/deeepak-17/clasp/blob/main/contracts/src/contracts/types.py"
click node_dp "https://github.com/deeepak-17/clasp/blob/main/security/src/security/dp/engine.py"
click node_mtls "https://github.com/deeepak-17/clasp/blob/main/security/src/security/mtls/context.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_train,node_chunk,node_model,node_merge,node_edge_registry toneBlue
class node_cluster_server,node_aggregation,node_adapter,node_clustering,node_redistribution toneAmber
class node_registry_app,node_storage,node_composition,node_promotion toneMint
class node_evaluation,node_scoring,node_execution,node_dashboard toneRose
class node_contracts,node_dp,node_mtls,node_developer toneIndigo
```

## Components

### Edge Layer

- [Client LoRA Training](https://github.com/deeepak-17/clasp/blob/main/services/edge/src/edge/train_client.py): `services/edge/src/edge/train_client.py`
- [Code Chunking](https://github.com/deeepak-17/clasp/blob/main/services/edge/src/edge/chunking.py): `services/edge/src/edge/chunking.py`
- [Model Loading](https://github.com/deeepak-17/clasp/blob/main/services/edge/src/edge/model_loader.py): `services/edge/src/edge/model_loader.py`
- [Adapter Merge & Inference](https://github.com/deeepak-17/clasp/blob/main/services/edge/src/edge/merge.py): `services/edge/src/edge/merge.py`
- [Edge Registry Client](https://github.com/deeepak-17/clasp/blob/main/services/edge/src/edge/registry_client.py): `services/edge/src/edge/registry_client.py`

### Cluster Layer

- [Federation Server](https://github.com/deeepak-17/clasp/blob/main/services/cluster/src/cluster/server.py): `services/cluster/src/cluster/server.py`
- [Federated Aggregation](https://github.com/deeepak-17/clasp/blob/main/services/cluster/src/cluster/aggregation.py): `services/cluster/src/cluster/aggregation.py`
- [LoRA Adapter Format](https://github.com/deeepak-17/clasp/blob/main/services/cluster/src/cluster/adapter_format.py): `services/cluster/src/cluster/adapter_format.py`
- [Client Clustering](https://github.com/deeepak-17/clasp/blob/main/services/cluster/src/cluster/clustering.py): `services/cluster/src/cluster/clustering.py`
- [Adapter Redistribution](https://github.com/deeepak-17/clasp/blob/main/services/cluster/src/cluster/redistribution.py): `services/cluster/src/cluster/redistribution.py`

### State Registry

- [Registry API](https://github.com/deeepak-17/clasp/blob/main/services/registry/src/registry/app.py): `services/registry/src/registry/app.py`
- [Versioned Adapter Store](https://github.com/deeepak-17/clasp/blob/main/services/registry/src/registry/storage.py): `services/registry/src/registry/storage.py`
- [Composite Adapters](https://github.com/deeepak-17/clasp/blob/main/services/registry/src/registry/composition.py): `services/registry/src/registry/composition.py`
- [Promotion & Rollback](https://github.com/deeepak-17/clasp/blob/main/services/registry/src/registry/promotion.py): `services/registry/src/registry/promotion.py`

### Evaluation

- [Evaluation Harness](https://github.com/deeepak-17/clasp/blob/main/services/evaluation/src/evaluation/eval_harness/harness.py): `services/evaluation/src/evaluation/eval_harness/harness.py`
- [Pass@k Scoring](https://github.com/deeepak-17/clasp/blob/main/services/evaluation/src/evaluation/eval_harness/scoring.py): `services/evaluation/src/evaluation/eval_harness/scoring.py`
- [Sandboxed Execution](https://github.com/deeepak-17/clasp/blob/main/services/evaluation/src/evaluation/eval_harness/execution.py): `services/evaluation/src/evaluation/eval_harness/execution.py`
- [Evaluation Dashboard](https://github.com/deeepak-17/clasp/blob/main/services/evaluation/dashboard/src/App.tsx): `services/evaluation/dashboard/src/App.tsx`

### Shared Contracts & Security

- [Shared Data Contracts](https://github.com/deeepak-17/clasp/blob/main/contracts/src/contracts/types.py): `contracts/src/contracts/types.py`
- [Differential Privacy](https://github.com/deeepak-17/clasp/blob/main/security/src/security/dp/engine.py): `security/src/security/dp/engine.py`
- [mTLS Security](https://github.com/deeepak-17/clasp/blob/main/security/src/security/mtls/context.py): `security/src/security/mtls/context.py`

### Other components

- **Developer**

## Connections

- Developer → Client LoRA Training: trains locally
- Client LoRA Training → Code Chunking: uses chunks (evidence: `services/edge/src/edge/train_client.py`)
- Client LoRA Training → Model Loading: loads model (evidence: `services/edge/src/edge/train_client.py`)
- Client LoRA Training → Differential Privacy: applies DP
- Client LoRA Training → Federation Server: submits adapter
- Federation Server → Federated Aggregation: aggregates updates (evidence: `services/cluster/src/cluster/server.py`)
- Federation Server → LoRA Adapter Format: encodes updates (evidence: `services/cluster/src/cluster/server.py`)
- Federation Server → Client Clustering: orchestrates clients (evidence: `services/cluster/src/cluster/server.py`)
- Federation Server → Adapter Redistribution: redistributes adapters (evidence: `services/cluster/src/cluster/server.py`)
- Federation Server → Registry API: publishes aggregate (evidence: `services/cluster/src/cluster/server.py`)
- Federation Server → mTLS Security: secures transport
- Registry API → Versioned Adapter Store: reads and writes (evidence: `services/registry/src/registry/app.py`)
- Registry API → Composite Adapters: plans composites (evidence: `services/registry/src/registry/app.py`)
- Registry API → Promotion & Rollback: promotes adapters (evidence: `services/registry/src/registry/app.py`)
- Registry API → Shared Data Contracts: uses contracts (evidence: `services/registry/src/registry/app.py`)
- Edge Registry Client → Registry API: fetches adapters
- Edge Registry Client → Adapter Merge & Inference: supplies adapters
- Client LoRA Training → Adapter Merge & Inference: uses cluster adapter (evidence: `services/edge/src/edge/train_client.py`)
- Evaluation Harness → Edge Registry Client: requests inference
- Evaluation Harness → Sandboxed Execution: runs candidates
- Evaluation Harness → Pass@k Scoring: scores outcomes
- Evaluation Dashboard → Evaluation Harness: presents results
- Federated Aggregation → Shared Data Contracts: shares adapter metadata
