# danzeroum/central_inteligencia_juridica architecture

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

- Interactive diagram: https://gitdiagram.com/danzeroum/central_inteligencia_juridica
- Repository: https://github.com/danzeroum/central_inteligencia_juridica

## Overview

A multi-agent legal-intelligence platform with a React workspace and administration console, plus a substantial fiscal-compliance workflow. The documented legal-query flow delegates from a supervisor to tribunal specialists; the fiscal worker excerpt shows processing and persistence. The frontend’s route composition and API client are visible, but most backend route wiring and several major feature implementations were not sampled, so those links are omitted rather than inferred.

Main entry points: [`frontend/src/App.jsx`](https://github.com/danzeroum/central_inteligencia_juridica/blob/master/frontend/src/App.jsx) (Workspace and admin SPA), [`src/agents/supervisor_agent.py`](https://github.com/danzeroum/central_inteligencia_juridica/blob/master/src/agents/supervisor_agent.py) (Supervisor agent), [`frontend/src/api/client.js`](https://github.com/danzeroum/central_inteligencia_juridica/blob/master/frontend/src/api/client.js) (API client), [`src/workers/tasks.py`](https://github.com/danzeroum/central_inteligencia_juridica/blob/master/src/workers/tasks.py) (Fiscal processing worker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_spa["Workspace and admin SPA<br/>[App.jsx]"]
  node_api_client["API client<br/>[client.js]"]
  node_ui_primitives["Shared UI primitives<br/>[primitives.jsx]"]
  node_toast["Toast notifications<br/>[toast.jsx]"]
  node_legal_screens["Legal workspace"]
  node_admin_screens["Admin console"]
  node_fiscal_screens["Fiscal workspace"]
end

subgraph group_legal["Legal intelligence"]
  node_supervisor["Supervisor agent"]
  node_tribunal["Tribunal specialists"]
  node_consensus["Weighted consensus<br/>[weighted_voting.py]"]
  node_legal_memory[("Vector memory and RAG<br/>[vector_memory.py]")]
end

subgraph group_fiscal["Fiscal compliance"]
  node_fiscal_routes["Fiscal API routes<br/>[fiscal.py]"]
  node_fiscal_worker["Fiscal processing worker<br/>[tasks.py]"]
  node_fiscal_rules["SPED rules engine<br/>[rules_engine.py]"]
  node_fiscal_data[("Fiscal repositories and records<br/>[repository.py]")]
end

subgraph group_governance["Governance and learning"]
  node_hitl["HITL and autonomy"]
  node_ledger[("Decision ledger<br/>[ledger.py]")]
  node_training["Continuous training"]
  node_learning_router["Adaptive learning router<br/>[learning_router.py]"]
end

subgraph group_platform["Platform services"]
  node_api["FastAPI application<br/>[main.py]"]
  node_database[("SQL database<br/>[engine.py]")]
end

node_user(("User"))

node_user -->|"uses"| node_spa
node_spa -->|"routes to"| node_legal_screens
node_spa -->|"routes to"| node_admin_screens
node_spa -->|"routes to"| node_fiscal_screens
node_spa -->|"uses"| node_api_client
node_api_client -.->|"requests"| node_api
node_api_client -.->|"uses"| node_ui_primitives
node_toast -->|"renders"| node_ui_primitives
node_supervisor -->|"delegates to"| node_tribunal
node_supervisor -.->|"coordinates"| node_consensus
node_legal_memory -.->|"supports queries"| node_legal_screens
node_fiscal_routes -.->|"dispatches"| node_fiscal_worker
node_fiscal_worker -->|"validates with"| node_fiscal_rules
node_fiscal_worker -->|"persists results"| node_fiscal_data
node_fiscal_data -.->|"stores in"| node_database
node_training -->|"updates routes"| node_learning_router
node_supervisor -.->|"uses autonomy"| node_hitl
node_supervisor -.->|"records decisions"| node_ledger

click node_spa "https://github.com/danzeroum/central_inteligencia_juridica/blob/master/frontend/src/App.jsx"
click node_api_client "https://github.com/danzeroum/central_inteligencia_juridica/blob/master/frontend/src/api/client.js"
click node_ui_primitives "https://github.com/danzeroum/central_inteligencia_juridica/blob/master/frontend/src/components/primitives.jsx"
click node_toast "https://github.com/danzeroum/central_inteligencia_juridica/blob/master/frontend/src/components/toast.jsx"
click node_legal_screens "https://github.com/danzeroum/central_inteligencia_juridica/tree/master/frontend/src/screens/user"
click node_admin_screens "https://github.com/danzeroum/central_inteligencia_juridica/tree/master/frontend/src/screens/admin"
click node_fiscal_screens "https://github.com/danzeroum/central_inteligencia_juridica/tree/master/frontend/src/screens/fiscal"
click node_api "https://github.com/danzeroum/central_inteligencia_juridica/blob/master/src/api/main.py"
click node_supervisor "https://github.com/danzeroum/central_inteligencia_juridica/blob/master/src/agents/supervisor_agent.py"
click node_tribunal "https://github.com/danzeroum/central_inteligencia_juridica/blob/master/src/agents/tribunal_api_client.py"
click node_consensus "https://github.com/danzeroum/central_inteligencia_juridica/blob/master/src/consensus/weighted_voting.py"
click node_legal_memory "https://github.com/danzeroum/central_inteligencia_juridica/blob/master/src/memory/vector_memory.py"
click node_fiscal_routes "https://github.com/danzeroum/central_inteligencia_juridica/blob/master/src/api/routes/fiscal.py"
click node_fiscal_worker "https://github.com/danzeroum/central_inteligencia_juridica/blob/master/src/workers/tasks.py"
click node_fiscal_rules "https://github.com/danzeroum/central_inteligencia_juridica/blob/master/src/fiscal/rules_engine.py"
click node_fiscal_data "https://github.com/danzeroum/central_inteligencia_juridica/blob/master/src/fiscal/repository.py"
click node_hitl "https://github.com/danzeroum/central_inteligencia_juridica/blob/master/src/hitl/progressive_autonomy.py"
click node_ledger "https://github.com/danzeroum/central_inteligencia_juridica/blob/master/src/utils/ledger.py"
click node_training "https://github.com/danzeroum/central_inteligencia_juridica/blob/master/src/training/training_manager.py"
click node_learning_router "https://github.com/danzeroum/central_inteligencia_juridica/blob/master/src/routing/learning_router.py"
click node_database "https://github.com/danzeroum/central_inteligencia_juridica/blob/master/src/db/engine.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_spa,node_api_client,node_ui_primitives,node_toast,node_legal_screens,node_admin_screens,node_fiscal_screens,node_user toneBlue
class node_supervisor,node_tribunal,node_consensus,node_legal_memory toneAmber
class node_fiscal_routes,node_fiscal_worker,node_fiscal_rules,node_fiscal_data toneMint
class node_hitl,node_ledger,node_training,node_learning_router toneRose
class node_api,node_database toneIndigo
```

## Components

### User experience

- [Workspace and admin SPA](https://github.com/danzeroum/central_inteligencia_juridica/blob/master/frontend/src/App.jsx): `frontend/src/App.jsx`
- [API client](https://github.com/danzeroum/central_inteligencia_juridica/blob/master/frontend/src/api/client.js): `frontend/src/api/client.js`
- [Shared UI primitives](https://github.com/danzeroum/central_inteligencia_juridica/blob/master/frontend/src/components/primitives.jsx): `frontend/src/components/primitives.jsx`
- [Toast notifications](https://github.com/danzeroum/central_inteligencia_juridica/blob/master/frontend/src/components/toast.jsx): `frontend/src/components/toast.jsx`
- [Legal workspace](https://github.com/danzeroum/central_inteligencia_juridica/tree/master/frontend/src/screens/user): `frontend/src/screens/user`
- [Admin console](https://github.com/danzeroum/central_inteligencia_juridica/tree/master/frontend/src/screens/admin): `frontend/src/screens/admin`
- [Fiscal workspace](https://github.com/danzeroum/central_inteligencia_juridica/tree/master/frontend/src/screens/fiscal): `frontend/src/screens/fiscal`

### Legal intelligence

- [Supervisor agent](https://github.com/danzeroum/central_inteligencia_juridica/blob/master/src/agents/supervisor_agent.py): `src/agents/supervisor_agent.py`
- [Tribunal specialists](https://github.com/danzeroum/central_inteligencia_juridica/blob/master/src/agents/tribunal_api_client.py): `src/agents/tribunal_api_client.py`
- [Weighted consensus](https://github.com/danzeroum/central_inteligencia_juridica/blob/master/src/consensus/weighted_voting.py): `src/consensus/weighted_voting.py`
- [Vector memory and RAG](https://github.com/danzeroum/central_inteligencia_juridica/blob/master/src/memory/vector_memory.py): `src/memory/vector_memory.py`

### Fiscal compliance

- [Fiscal API routes](https://github.com/danzeroum/central_inteligencia_juridica/blob/master/src/api/routes/fiscal.py): `src/api/routes/fiscal.py`
- [Fiscal processing worker](https://github.com/danzeroum/central_inteligencia_juridica/blob/master/src/workers/tasks.py): `src/workers/tasks.py`
- [SPED rules engine](https://github.com/danzeroum/central_inteligencia_juridica/blob/master/src/fiscal/rules_engine.py): `src/fiscal/rules_engine.py`
- [Fiscal repositories and records](https://github.com/danzeroum/central_inteligencia_juridica/blob/master/src/fiscal/repository.py): `src/fiscal/repository.py`

### Governance and learning

- [HITL and autonomy](https://github.com/danzeroum/central_inteligencia_juridica/blob/master/src/hitl/progressive_autonomy.py): `src/hitl/progressive_autonomy.py`
- [Decision ledger](https://github.com/danzeroum/central_inteligencia_juridica/blob/master/src/utils/ledger.py): `src/utils/ledger.py`
- [Continuous training](https://github.com/danzeroum/central_inteligencia_juridica/blob/master/src/training/training_manager.py): `src/training/training_manager.py`
- [Adaptive learning router](https://github.com/danzeroum/central_inteligencia_juridica/blob/master/src/routing/learning_router.py): `src/routing/learning_router.py`

### Platform services

- [FastAPI application](https://github.com/danzeroum/central_inteligencia_juridica/blob/master/src/api/main.py): `src/api/main.py`
- [SQL database](https://github.com/danzeroum/central_inteligencia_juridica/blob/master/src/db/engine.py): `src/db/engine.py`

### Other components

- **User**

## Connections

- User → Workspace and admin SPA: uses (evidence: `README.md`)
- Workspace and admin SPA → Legal workspace: routes to (evidence: `frontend/src/App.jsx`)
- Workspace and admin SPA → Admin console: routes to (evidence: `frontend/src/App.jsx`)
- Workspace and admin SPA → Fiscal workspace: routes to (evidence: `frontend/src/App.jsx`)
- Workspace and admin SPA → API client: uses (evidence: `frontend/src/App.jsx`)
- API client → FastAPI application: requests (evidence: `frontend/src/api/client.js`)
- API client → Shared UI primitives: uses
- Toast notifications → Shared UI primitives: renders (evidence: `frontend/src/components/toast.jsx`)
- Supervisor agent → Tribunal specialists: delegates to (evidence: `README.md`)
- Supervisor agent → Weighted consensus: coordinates
- Vector memory and RAG → Legal workspace: supports queries
- Fiscal API routes → Fiscal processing worker: dispatches
- Fiscal processing worker → SPED rules engine: validates with (evidence: `src/workers/tasks.py`)
- Fiscal processing worker → Fiscal repositories and records: persists results (evidence: `src/workers/tasks.py`)
- Fiscal repositories and records → SQL database: stores in
- Continuous training → Adaptive learning router: updates routes (evidence: `src/training/training_manager.py`)
- Supervisor agent → HITL and autonomy: uses autonomy
- Supervisor agent → Decision ledger: records decisions
