# hust-open-atom-club/trusted-agent-hub architecture

> Architecture diagram of the GitHub repository hust-open-atom-club/trusted-agent-hub, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hust-open-atom-club/trusted-agent-hub
- Repository: https://github.com/hust-open-atom-club/trusted-agent-hub

## Overview

TrustedAgentHub is a distribution and trust platform for Agent Skills, MCP servers, plugins, and subagents. Its primary workflow takes a package submission through source acquisition, metadata extraction, security scanning and trust assessment, then human review and publication; users can browse published packages and install them with the CLI. The graph includes the documented web, API, scanner, scoring, and installation capabilities. Some subsystems are represented at directory level because their implementation files were not sampled; those connections are documented by the README rather than inferred from imports.

Main entry points: [`apps/api/src/services/producer.py`](https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/api/src/services/producer.py) (Producer workflow), [`apps/api/src/main.py`](https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/api/src/main.py) (API application), [`apps/api/src/routers/producer.py`](https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/api/src/routers/producer.py) (Submission and producer routes), [`apps/api/src/database.py`](https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/api/src/database.py) (Application database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Web and CLI"]
  node_web_submission["Submission UI<br/>[page.tsx]"]
  node_web_review["Review workspace<br/>[page.tsx]"]
  node_web_catalog["Browse and package pages<br/>[home-client.tsx]"]
  node_cli["CLI commands<br/>[cli.ts]"]
  node_cli_install["Install executor"]
end

subgraph group_api["Platform API"]
  node_api_app["API application<br/>[main.py]"]
  node_producer_routes["Submission and producer routes<br/>[producer.py]"]
  node_review_routes["Review and publication routes<br/>[review.py]"]
  node_auth_routes["Authentication routes<br/>[auth.py]"]
  node_producer_service["Producer workflow<br/>[producer.py]"]
  node_api_auth["JWT and role authorization<br/>[auth.py]"]
  node_api_dependencies["API dependencies<br/>[dependencies.py]"]
  node_trust_routes["Trust and scan endpoints<br/>[trust.py]"]
end

subgraph group_assessment["Scanning and trust"]
  node_risk_scanner["Security scanner<br/>[scanner.py]"]
  node_scan_evidence["Evidence and redaction<br/>[evidence.py]"]
  node_trust_engine["Trust assessment engine<br/>[engine.py]"]
end

subgraph group_persistence["Contracts and storage"]
  node_schema_extract["Package metadata extraction<br/>[extract_skills.py]"]
  node_shared_contracts["Shared status and finding contracts<br/>[constants.py]"]
  node_producer_repository["Producer repository"]
  node_consumer_repository["Package repository<br/>[sqlalchemy.py]"]
  node_database[("Application database<br/>[database.py]")]
end

node_submitter(("Submitter"))
node_reviewer(("Reviewer"))
node_package_user(("Package user"))

node_submitter -->|"submits package"| node_web_submission
node_web_submission -.->|"sends submission"| node_producer_routes
node_producer_routes -->|"invokes workflow"| node_producer_service
node_producer_service -->|"scans source"| node_risk_scanner
node_producer_service -->|"extracts metadata"| node_schema_extract
node_producer_service -->|"refreshes trust"| node_trust_routes
node_risk_scanner -->|"builds evidence"| node_scan_evidence
node_risk_scanner -->|"uses finding types"| node_shared_contracts
node_trust_engine -->|"uses shared constants"| node_shared_contracts
node_producer_service -->|"persists workflow"| node_producer_repository
node_reviewer -->|"reviews findings"| node_web_review
node_web_review -.->|"submits decision"| node_review_routes
node_review_routes -->|"changes package status"| node_producer_service
node_api_app -->|"mounts routes"| node_producer_routes
node_api_app -->|"mounts routes"| node_review_routes
node_api_app -->|"mounts routes"| node_auth_routes
node_api_app -->|"mounts routes"| node_trust_routes
node_auth_routes -->|"uses token functions"| node_api_auth
node_api_auth -->|"opens database session"| node_database
node_api_dependencies -->|"creates sessions"| node_database
node_api_dependencies -->|"provides repository"| node_consumer_repository
node_consumer_repository -.->|"reads and writes"| node_database
node_producer_repository -.->|"persists records"| node_database
node_package_user -->|"browses packages"| node_web_catalog
node_package_user -->|"runs commands"| node_cli
node_cli -.->|"dispatches install"| node_cli_install
node_cli_install -.->|"requests package data"| node_producer_routes
node_cli_install -->|"installs locally"| node_package_user
node_web_catalog -.->|"loads catalog"| node_consumer_repository

click node_web_submission "https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/web/src/app/submit/page.tsx"
click node_web_review "https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/web/src/app/review/page.tsx"
click node_web_catalog "https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/web/src/app/home-client.tsx"
click node_cli "https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/cli/src/cli.ts"
click node_cli_install "https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/cli/src/install-executor.ts"
click node_api_app "https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/api/src/main.py"
click node_producer_routes "https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/api/src/routers/producer.py"
click node_review_routes "https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/api/src/routers/review.py"
click node_auth_routes "https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/api/src/routers/auth.py"
click node_producer_service "https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/api/src/services/producer.py"
click node_risk_scanner "https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/scanners/risk_scanner/scanner.py"
click node_scan_evidence "https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/scanners/risk_scanner/evidence.py"
click node_trust_engine "https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/packages/trust-score/src/engine.py"
click node_schema_extract "https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/packages/schema/extract_skills.py"
click node_shared_contracts "https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/packages/schema/constants.py"
click node_producer_repository "https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/api/src/repositories/producer_sqlalchemy.py"
click node_consumer_repository "https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/api/src/repositories/sqlalchemy.py"
click node_database "https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/api/src/database.py"
click node_api_auth "https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/api/src/auth.py"
click node_api_dependencies "https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/api/src/dependencies.py"
click node_trust_routes "https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/api/src/routers/trust.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_web_submission,node_web_review,node_web_catalog,node_cli,node_cli_install,node_reviewer,node_package_user toneBlue
class node_api_app,node_producer_routes,node_review_routes,node_auth_routes,node_producer_service,node_api_auth,node_api_dependencies,node_trust_routes toneAmber
class node_risk_scanner,node_scan_evidence,node_trust_engine toneMint
class node_schema_extract,node_shared_contracts,node_producer_repository,node_consumer_repository,node_database toneRose
class node_submitter toneIndigo
```

## Components

### Web and CLI

- [Submission UI](https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/web/src/app/submit/page.tsx): `apps/web/src/app/submit/page.tsx`
- [Review workspace](https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/web/src/app/review/page.tsx): `apps/web/src/app/review/page.tsx`
- [Browse and package pages](https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/web/src/app/home-client.tsx): `apps/web/src/app/home-client.tsx`
- [CLI commands](https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/cli/src/cli.ts): `apps/cli/src/cli.ts`
- [Install executor](https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/cli/src/install-executor.ts): `apps/cli/src/install-executor.ts`

### Platform API

- [API application](https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/api/src/main.py): `apps/api/src/main.py`
- [Submission and producer routes](https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/api/src/routers/producer.py): `apps/api/src/routers/producer.py`
- [Review and publication routes](https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/api/src/routers/review.py): `apps/api/src/routers/review.py`
- [Authentication routes](https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/api/src/routers/auth.py): `apps/api/src/routers/auth.py`
- [Producer workflow](https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/api/src/services/producer.py): `apps/api/src/services/producer.py`
- [JWT and role authorization](https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/api/src/auth.py): `apps/api/src/auth.py`
- [API dependencies](https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/api/src/dependencies.py): `apps/api/src/dependencies.py`
- [Trust and scan endpoints](https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/api/src/routers/trust.py): `apps/api/src/routers/trust.py`

### Scanning and trust

- [Security scanner](https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/scanners/risk_scanner/scanner.py): `scanners/risk_scanner/scanner.py`
- [Evidence and redaction](https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/scanners/risk_scanner/evidence.py): `scanners/risk_scanner/evidence.py`
- [Trust assessment engine](https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/packages/trust-score/src/engine.py): `packages/trust-score/src/engine.py`

### Contracts and storage

- [Package metadata extraction](https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/packages/schema/extract_skills.py): `packages/schema/extract_skills.py`
- [Shared status and finding contracts](https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/packages/schema/constants.py): `packages/schema/constants.py`
- [Producer repository](https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/api/src/repositories/producer_sqlalchemy.py): `apps/api/src/repositories/producer_sqlalchemy.py`
- [Package repository](https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/api/src/repositories/sqlalchemy.py): `apps/api/src/repositories/sqlalchemy.py`
- [Application database](https://github.com/hust-open-atom-club/trusted-agent-hub/blob/main/apps/api/src/database.py): `apps/api/src/database.py`

### Other components

- **Submitter**
- **Reviewer**
- **Package user**

## Connections

- Submitter → Submission UI: submits package (evidence: `README.md`)
- Submission UI → Submission and producer routes: sends submission
- Submission and producer routes → Producer workflow: invokes workflow
- Producer workflow → Security scanner: scans source (evidence: `apps/api/src/services/producer.py`)
- Producer workflow → Package metadata extraction: extracts metadata (evidence: `apps/api/src/services/producer.py`)
- Producer workflow → Trust and scan endpoints: refreshes trust (evidence: `apps/api/src/services/producer.py`)
- Security scanner → Evidence and redaction: builds evidence (evidence: `scanners/risk_scanner/evidence.py`)
- Security scanner → Shared status and finding contracts: uses finding types (evidence: `packages/schema/constants.py`)
- Trust assessment engine → Shared status and finding contracts: uses shared constants (evidence: `packages/trust-score/src/engine.py`)
- Producer workflow → Producer repository: persists workflow (evidence: `apps/api/src/services/producer.py`)
- Reviewer → Review workspace: reviews findings (evidence: `README.md`)
- Review workspace → Review and publication routes: submits decision
- Review and publication routes → Producer workflow: changes package status (evidence: `apps/api/src/routers/review.py`)
- API application → Submission and producer routes: mounts routes (evidence: `apps/api/src/main.py`)
- API application → Review and publication routes: mounts routes (evidence: `apps/api/src/main.py`)
- API application → Authentication routes: mounts routes (evidence: `apps/api/src/main.py`)
- API application → Trust and scan endpoints: mounts routes (evidence: `apps/api/src/main.py`)
- Authentication routes → JWT and role authorization: uses token functions (evidence: `apps/api/src/routers/auth.py`)
- JWT and role authorization → Application database: opens database session (evidence: `apps/api/src/auth.py`)
- API dependencies → Application database: creates sessions (evidence: `apps/api/src/dependencies.py`)
- API dependencies → Package repository: provides repository (evidence: `apps/api/src/dependencies.py`)
- Package repository → Application database: reads and writes (evidence: `apps/api/src/database.py`)
- Producer repository → Application database: persists records
- Package user → Browse and package pages: browses packages (evidence: `README.md`)
- Package user → CLI commands: runs commands (evidence: `README.md`)
- CLI commands → Install executor: dispatches install
- Install executor → Submission and producer routes: requests package data
- Install executor → Package user: installs locally (evidence: `README.md`)
- Browse and package pages → Package repository: loads catalog
