# chikara11/deloitte architecture

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

- Interactive diagram: https://gitdiagram.com/chikara11/deloitte
- Repository: https://github.com/chikara11/deloitte

## Overview

AuditBridge accepts invoice cases, applies tenant isolation and security screening, normalizes evidence, runs control checks and expert review, then records human gate decisions before producing an exportable control sheet. The 5-gate workflow and documented audit-log capabilities are represented alongside the sampled runtime modules. The harness and API excerpts are partial; links for documented but unsampled steps cite the README, and the Google Cloud services shown are target integrations rather than confirmed active local wiring.

Main entry points: [`app/agents/harness.py`](https://github.com/chikara11/deloitte/blob/main/app/agents/harness.py) (5-Gate Harness), [`app/data/audit_logger.py`](https://github.com/chikara11/deloitte/blob/main/app/data/audit_logger.py) (Hash-Chained Audit Log), [`app/main.py`](https://github.com/chikara11/deloitte/blob/main/app/main.py) (FastAPI API), [`app/security/gate1.py`](https://github.com/chikara11/deloitte/blob/main/app/security/gate1.py) (Gate 1 Screening)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_intake["Intake &amp; Security"]
  node_gate1["Gate 1 Screening<br/>[gate1.py]"]
  node_dlp["DLP Tokenizer<br/>[dlp_tokenizer.py]"]
  node_armor["Model Armor<br/>[model_armor.py]"]
  node_ingest["Document Ingestion<br/>[ingest.py]"]
  node_normalizer["Invoice Normalizer<br/>[normalizer.py]"]
end

subgraph group_review["Audit &amp; Expertise"]
  node_auditor_agent["Auditor Rules<br/>[auditor.py]"]
  node_auditeur_agent["Auditeur Agent<br/>[auditeur_agent.py]"]
  node_skeptic["Skeptic Check<br/>[skeptic_agent.py]"]
  node_bridge["Brief Drafting<br/>[bridge.py]"]
  node_legal["Legal Expert<br/>[legal_agent.py]"]
  node_quant["Quant Expert<br/>[quant_agent.py]"]
  node_synthesis["Confidence Synthesis<br/>[synthesis.py]"]
end

subgraph group_governance["Human Governance"]
  node_api["FastAPI API<br/>[main.py]"]
  node_harness["5-Gate Harness<br/>[harness.py]"]
end

subgraph group_records["Records &amp; Evidence"]
  node_passport["Tenant Passports<br/>[passports.py]"]
  node_models["Case &amp; Event Models<br/>[models.py]"]
  node_auditlog[("Hash-Chained Audit Log<br/>[audit_logger.py]")]
  node_vector[("Evidence Vector Store<br/>[vector_store.py]")]
  node_governance_refs["Governance References<br/>[governance_refs.py]"]
  node_storage[("Document Store<br/>[storage.py]")]
end

subgraph group_outputs["Documentation"]
  node_fiche["Control Sheet<br/>[fiche_controle.py]"]
  node_exporter["MD / DOCX Export<br/>[exporter.py]"]
end

node_auditor(("Auditor"))
node_gcs[("Google Cloud Storage")]
node_firestore[("Cloud Firestore")]
node_pubsub["Cloud Pub/Sub"]

node_auditor -->|"submits case"| node_api
node_api -->|"routes gate actions"| node_harness
node_harness -->|"runs screening"| node_gate1
node_ingest -->|"screens input"| node_gate1
node_ingest -->|"tokenizes content"| node_dlp
node_gate1 -->|"checks prompts"| node_armor
node_normalizer -->|"loads mapping"| node_passport
node_normalizer -->|"checks tenant"| node_gate1
node_harness -->|"runs controls"| node_auditor_agent
node_auditor_agent -->|"uses canonical invoice"| node_normalizer
node_harness -->|"drafts briefs"| node_bridge
node_harness -->|"records decisions"| node_auditlog
node_harness -->|"computes confidence"| node_synthesis
node_harness -->|"enables final export"| node_exporter
node_harness -->|"requests expert review"| node_legal
node_harness -->|"requests expert review"| node_quant
node_auditor_agent -.->|"checks evidence"| node_skeptic
node_skeptic -->|"verifies chunks"| node_vector
node_legal -->|"searches evidence"| node_vector
node_quant -->|"searches evidence"| node_vector
node_harness -->|"updates case"| node_models
node_auditlog -->|"stores events"| node_models
node_api -->|"lists and streams events"| node_auditlog
node_api -.->|"serves documents"| node_storage
node_storage -.->|"reads and writes"| node_gcs
node_auditlog -.->|"persists case events"| node_firestore
node_auditlog -.->|"publishes live events"| node_pubsub
node_harness -->|"generates documentation"| node_fiche
node_fiche -.->|"renders formats"| node_exporter
node_auditeur_agent -->|"loads references"| node_governance_refs

click node_api "https://github.com/chikara11/deloitte/blob/main/app/main.py"
click node_harness "https://github.com/chikara11/deloitte/blob/main/app/agents/harness.py"
click node_gate1 "https://github.com/chikara11/deloitte/blob/main/app/security/gate1.py"
click node_dlp "https://github.com/chikara11/deloitte/blob/main/app/security/dlp_tokenizer.py"
click node_armor "https://github.com/chikara11/deloitte/blob/main/app/security/model_armor.py"
click node_ingest "https://github.com/chikara11/deloitte/blob/main/app/data/ingest.py"
click node_normalizer "https://github.com/chikara11/deloitte/blob/main/app/data/normalizer.py"
click node_passport "https://github.com/chikara11/deloitte/blob/main/app/data/passports.py"
click node_auditor_agent "https://github.com/chikara11/deloitte/blob/main/app/agents/auditor.py"
click node_auditeur_agent "https://github.com/chikara11/deloitte/blob/main/app/agents/auditeur_agent.py"
click node_skeptic "https://github.com/chikara11/deloitte/blob/main/app/agents/skeptic_agent.py"
click node_bridge "https://github.com/chikara11/deloitte/blob/main/app/agents/bridge.py"
click node_legal "https://github.com/chikara11/deloitte/blob/main/app/agents/legal_agent.py"
click node_quant "https://github.com/chikara11/deloitte/blob/main/app/agents/quant_agent.py"
click node_synthesis "https://github.com/chikara11/deloitte/blob/main/app/agents/synthesis.py"
click node_models "https://github.com/chikara11/deloitte/blob/main/app/agents/models.py"
click node_auditlog "https://github.com/chikara11/deloitte/blob/main/app/data/audit_logger.py"
click node_vector "https://github.com/chikara11/deloitte/blob/main/app/data/vector_store.py"
click node_governance_refs "https://github.com/chikara11/deloitte/blob/main/app/data/governance_refs.py"
click node_storage "https://github.com/chikara11/deloitte/blob/main/app/data/storage.py"
click node_fiche "https://github.com/chikara11/deloitte/blob/main/app/agents/fiche_controle.py"
click node_exporter "https://github.com/chikara11/deloitte/blob/main/app/agents/exporter.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_gate1,node_dlp,node_armor,node_ingest,node_normalizer toneBlue
class node_auditor_agent,node_auditeur_agent,node_skeptic,node_bridge,node_legal,node_quant,node_synthesis,node_gcs,node_firestore toneAmber
class node_api,node_harness toneMint
class node_passport,node_models,node_auditlog,node_vector,node_governance_refs,node_storage toneRose
class node_fiche,node_exporter,node_auditor,node_pubsub toneIndigo
```

## Components

### Intake & Security

- [Gate 1 Screening](https://github.com/chikara11/deloitte/blob/main/app/security/gate1.py): `app/security/gate1.py`
- [DLP Tokenizer](https://github.com/chikara11/deloitte/blob/main/app/security/dlp_tokenizer.py): `app/security/dlp_tokenizer.py`
- [Model Armor](https://github.com/chikara11/deloitte/blob/main/app/security/model_armor.py): `app/security/model_armor.py`
- [Document Ingestion](https://github.com/chikara11/deloitte/blob/main/app/data/ingest.py): `app/data/ingest.py`
- [Invoice Normalizer](https://github.com/chikara11/deloitte/blob/main/app/data/normalizer.py): `app/data/normalizer.py`

### Audit & Expertise

- [Auditor Rules](https://github.com/chikara11/deloitte/blob/main/app/agents/auditor.py): `app/agents/auditor.py`
- [Auditeur Agent](https://github.com/chikara11/deloitte/blob/main/app/agents/auditeur_agent.py): `app/agents/auditeur_agent.py`
- [Skeptic Check](https://github.com/chikara11/deloitte/blob/main/app/agents/skeptic_agent.py): `app/agents/skeptic_agent.py`
- [Brief Drafting](https://github.com/chikara11/deloitte/blob/main/app/agents/bridge.py): `app/agents/bridge.py`
- [Legal Expert](https://github.com/chikara11/deloitte/blob/main/app/agents/legal_agent.py): `app/agents/legal_agent.py`
- [Quant Expert](https://github.com/chikara11/deloitte/blob/main/app/agents/quant_agent.py): `app/agents/quant_agent.py`
- [Confidence Synthesis](https://github.com/chikara11/deloitte/blob/main/app/agents/synthesis.py): `app/agents/synthesis.py`

### Human Governance

- [FastAPI API](https://github.com/chikara11/deloitte/blob/main/app/main.py): `app/main.py`
- [5-Gate Harness](https://github.com/chikara11/deloitte/blob/main/app/agents/harness.py): `app/agents/harness.py`

### Records & Evidence

- [Tenant Passports](https://github.com/chikara11/deloitte/blob/main/app/data/passports.py): `app/data/passports.py`
- [Case & Event Models](https://github.com/chikara11/deloitte/blob/main/app/agents/models.py): `app/agents/models.py`
- [Hash-Chained Audit Log](https://github.com/chikara11/deloitte/blob/main/app/data/audit_logger.py): `app/data/audit_logger.py`
- [Evidence Vector Store](https://github.com/chikara11/deloitte/blob/main/app/data/vector_store.py): `app/data/vector_store.py`
- [Governance References](https://github.com/chikara11/deloitte/blob/main/app/data/governance_refs.py): `app/data/governance_refs.py`
- [Document Store](https://github.com/chikara11/deloitte/blob/main/app/data/storage.py): `app/data/storage.py`

### Documentation

- [Control Sheet](https://github.com/chikara11/deloitte/blob/main/app/agents/fiche_controle.py): `app/agents/fiche_controle.py`
- [MD / DOCX Export](https://github.com/chikara11/deloitte/blob/main/app/agents/exporter.py): `app/agents/exporter.py`

### Other components

- **Auditor**
- **Google Cloud Storage**
- **Cloud Firestore**
- **Cloud Pub/Sub**

## Connections

- Auditor → FastAPI API: submits case (evidence: `README.md`)
- FastAPI API → 5-Gate Harness: routes gate actions (evidence: `app/main.py`)
- 5-Gate Harness → Gate 1 Screening: runs screening (evidence: `app/agents/harness.py`)
- Document Ingestion → Gate 1 Screening: screens input (evidence: `app/data/ingest.py`)
- Document Ingestion → DLP Tokenizer: tokenizes content (evidence: `app/data/ingest.py`)
- Gate 1 Screening → Model Armor: checks prompts (evidence: `app/security/gate1.py`)
- Invoice Normalizer → Tenant Passports: loads mapping (evidence: `app/data/normalizer.py`)
- Invoice Normalizer → Gate 1 Screening: checks tenant (evidence: `app/data/normalizer.py`)
- 5-Gate Harness → Auditor Rules: runs controls (evidence: `app/agents/harness.py`)
- Auditor Rules → Invoice Normalizer: uses canonical invoice (evidence: `app/agents/auditor.py`)
- 5-Gate Harness → Brief Drafting: drafts briefs (evidence: `app/agents/harness.py`)
- 5-Gate Harness → Hash-Chained Audit Log: records decisions (evidence: `app/agents/harness.py`)
- 5-Gate Harness → Confidence Synthesis: computes confidence (evidence: `app/agents/harness.py`)
- 5-Gate Harness → MD / DOCX Export: enables final export (evidence: `README.md`)
- 5-Gate Harness → Legal Expert: requests expert review (evidence: `README.md`)
- 5-Gate Harness → Quant Expert: requests expert review (evidence: `README.md`)
- Auditor Rules → Skeptic Check: checks evidence
- Skeptic Check → Evidence Vector Store: verifies chunks (evidence: `app/agents/skeptic_agent.py`)
- Legal Expert → Evidence Vector Store: searches evidence (evidence: `app/agents/legal_agent.py`)
- Quant Expert → Evidence Vector Store: searches evidence (evidence: `app/agents/quant_agent.py`)
- 5-Gate Harness → Case & Event Models: updates case (evidence: `app/agents/harness.py`)
- Hash-Chained Audit Log → Case & Event Models: stores events (evidence: `app/data/audit_logger.py`)
- FastAPI API → Hash-Chained Audit Log: lists and streams events (evidence: `app/main.py`)
- FastAPI API → Document Store: serves documents (evidence: `app/main.py`)
- Document Store → Google Cloud Storage: reads and writes (evidence: `app/data/storage.py`)
- Hash-Chained Audit Log → Cloud Firestore: persists case events (evidence: `README.md`)
- Hash-Chained Audit Log → Cloud Pub/Sub: publishes live events (evidence: `README.md`)
- 5-Gate Harness → Control Sheet: generates documentation (evidence: `README.md`)
- Control Sheet → MD / DOCX Export: renders formats
- Auditeur Agent → Governance References: loads references (evidence: `app/agents/auditeur_agent.py`)
