# baitc-hacks/hack-173e8652-synex architecture

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

- Interactive diagram: https://gitdiagram.com/baitc-hacks/hack-173e8652-synex
- Repository: https://github.com/baitc-hacks/hack-173e8652-synex

## Overview

MoneyGraph is a local AML investigation workbench: it turns transaction files into explainable graph signals and a prioritized case queue, then lets an analyst inspect evidence, decide, and receive the result of an allowed local action. The README documents this workflow and its limits. Source excerpts show the pipeline orchestrator, API service wiring, AI controls, and persistence; some runtime modules were not sampled, so undocumented internal links are omitted.

Main entry points: [`src/moneygraph/pipeline/service.py`](https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/pipeline/service.py) (Analysis pipeline), [`src/moneygraph/services/agentic_loop.py`](https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/services/agentic_loop.py) (Case assessment and actions), [`src/moneygraph/api/main.py`](https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/api/main.py) (FastAPI application), [`src/moneygraph/ui/agentic.py`](https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/ui/agentic.py) (Investigation workspace)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_analysis["Graph analysis"]
  node_pipeline["Analysis pipeline<br/>[service.py]"]
  node_ingestion["Ingestion and validation<br/>[ingestion.py]"]
  node_graphbuild["Graph construction<br/>[graph_builder.py]"]
  node_features["Financial features<br/>[features.py]"]
  node_roles["Role assignment<br/>[role_engine.py]"]
  node_clustering["Clustering<br/>[clustering.py]"]
  node_temporal["Temporal analysis<br/>[temporal.py]"]
  node_priority["Prioritization<br/>[priority.py]"]
  node_explanations["Signal explanations<br/>[explanations.py]"]
  node_exports["Analysis artifacts<br/>[exporters.py]"]
end

subgraph group_casework["Monitoring and cases"]
  node_monitor["Date replay monitor<br/>[auto_monitor.py]"]
  node_agentic["Case assessment and actions<br/>[agentic_loop.py]"]
  node_reviewdoc["Review draft<br/>[review_document.py]"]
end

subgraph group_ai["AI support"]
  node_ai["Provider and AI governance<br/>[governance.py]"]
  node_assistant["AI Copilot route<br/>[assistant.py]"]
end

subgraph group_backend["API and persistence"]
  node_api["FastAPI application<br/>[main.py]"]
  node_routes["Case and analytics routes<br/>[agentic.py]"]
  node_graphqueries["Graph query service<br/>[graph_queries.py]"]
  node_artifacts["Artifact access<br/>[artifacts.py]"]
  node_repository["Case repository<br/>[repositories.py]"]
  node_database[("SQLite database<br/>[database.py]")]
end

subgraph group_interface["Analyst interface"]
  node_ui["Streamlit application<br/>[app.py]"]
  node_caseui["Investigation workspace<br/>[agentic.py]"]
  node_client["HTTP API client<br/>[client.py]"]
  node_graphui["Graph visualization<br/>[graph.py]"]
end

node_analyst(("AML analyst"))
node_parquet["Transaction Parquet"]
node_openai["OpenAI service"]

node_parquet -->|"provides inputs"| node_pipeline
node_pipeline -->|"runs validation"| node_ingestion
node_pipeline -->|"builds graph"| node_graphbuild
node_pipeline -->|"computes features"| node_features
node_pipeline -->|"assigns roles"| node_roles
node_pipeline -->|"clusters nodes"| node_clustering
node_pipeline -->|"computes timing"| node_temporal
node_pipeline -->|"scores priorities"| node_priority
node_pipeline -->|"generates explanations"| node_explanations
node_pipeline -->|"writes artifacts"| node_exports
node_pipeline -->|"produces snapshot"| node_exports
node_monitor -.->|"scans dates"| node_agentic
node_agentic -->|"records cases"| node_repository
node_agentic -->|"requests assessment"| node_ai
node_agentic -->|"prepares draft"| node_reviewdoc
node_analyst -->|"reviews and decides"| node_caseui
node_assistant -->|"requests answer"| node_ai
node_ai -.->|"dispatches calls"| node_openai
node_api -->|"starts monitor"| node_monitor
node_api -->|"registers routes"| node_routes
node_routes -->|"handles case actions"| node_agentic
node_routes -->|"reads and writes"| node_repository
node_api -->|"wires graph service"| node_graphqueries
node_graphqueries -->|"queries artifacts"| node_artifacts
node_repository -->|"persists records"| node_database
node_ui -->|"renders workspace"| node_caseui
node_ui -->|"creates client"| node_client
node_caseui -->|"requests API data"| node_client
node_caseui -->|"shows graph evidence"| node_graphui
node_client -->|"sends HTTP requests"| node_api
node_exports -.->|"serves analysis data"| node_artifacts

click node_pipeline "https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/pipeline/service.py"
click node_ingestion "https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/pipeline/ingestion.py"
click node_graphbuild "https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/pipeline/graph_builder.py"
click node_features "https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/pipeline/features.py"
click node_roles "https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/pipeline/role_engine.py"
click node_clustering "https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/pipeline/clustering.py"
click node_temporal "https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/pipeline/temporal.py"
click node_priority "https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/pipeline/priority.py"
click node_explanations "https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/pipeline/explanations.py"
click node_exports "https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/pipeline/exporters.py"
click node_monitor "https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/services/auto_monitor.py"
click node_agentic "https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/services/agentic_loop.py"
click node_reviewdoc "https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/services/review_document.py"
click node_ai "https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/ai/governance.py"
click node_assistant "https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/api/routes/assistant.py"
click node_api "https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/api/main.py"
click node_routes "https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/api/routes/agentic.py"
click node_graphqueries "https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/services/graph_queries.py"
click node_artifacts "https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/services/artifacts.py"
click node_repository "https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/repository/repositories.py"
click node_database "https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/repository/database.py"
click node_ui "https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/ui/app.py"
click node_caseui "https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/ui/agentic.py"
click node_client "https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/ui/client.py"
click node_graphui "https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/ui/graph.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_pipeline,node_ingestion,node_graphbuild,node_features,node_roles,node_clustering,node_temporal,node_priority,node_explanations,node_exports toneBlue
class node_monitor,node_agentic,node_reviewdoc toneAmber
class node_ai,node_assistant toneMint
class node_api,node_routes,node_graphqueries,node_artifacts,node_repository,node_database toneRose
class node_ui,node_caseui,node_client,node_graphui,node_analyst,node_parquet,node_openai toneIndigo
```

## Components

### Graph analysis

- [Analysis pipeline](https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/pipeline/service.py): `src/moneygraph/pipeline/service.py`
- [Ingestion and validation](https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/pipeline/ingestion.py): `src/moneygraph/pipeline/ingestion.py`
- [Graph construction](https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/pipeline/graph_builder.py): `src/moneygraph/pipeline/graph_builder.py`
- [Financial features](https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/pipeline/features.py): `src/moneygraph/pipeline/features.py`
- [Role assignment](https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/pipeline/role_engine.py): `src/moneygraph/pipeline/role_engine.py`
- [Clustering](https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/pipeline/clustering.py): `src/moneygraph/pipeline/clustering.py`
- [Temporal analysis](https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/pipeline/temporal.py): `src/moneygraph/pipeline/temporal.py`
- [Prioritization](https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/pipeline/priority.py): `src/moneygraph/pipeline/priority.py`
- [Signal explanations](https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/pipeline/explanations.py): `src/moneygraph/pipeline/explanations.py`
- [Analysis artifacts](https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/pipeline/exporters.py): `src/moneygraph/pipeline/exporters.py`

### Monitoring and cases

- [Date replay monitor](https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/services/auto_monitor.py): `src/moneygraph/services/auto_monitor.py`
- [Case assessment and actions](https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/services/agentic_loop.py): `src/moneygraph/services/agentic_loop.py`
- [Review draft](https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/services/review_document.py): `src/moneygraph/services/review_document.py`

### AI support

- [Provider and AI governance](https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/ai/governance.py): `src/moneygraph/ai/governance.py`
- [AI Copilot route](https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/api/routes/assistant.py): `src/moneygraph/api/routes/assistant.py`

### API and persistence

- [FastAPI application](https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/api/main.py): `src/moneygraph/api/main.py`
- [Case and analytics routes](https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/api/routes/agentic.py): `src/moneygraph/api/routes/agentic.py`
- [Graph query service](https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/services/graph_queries.py): `src/moneygraph/services/graph_queries.py`
- [Artifact access](https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/services/artifacts.py): `src/moneygraph/services/artifacts.py`
- [Case repository](https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/repository/repositories.py): `src/moneygraph/repository/repositories.py`
- [SQLite database](https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/repository/database.py): `src/moneygraph/repository/database.py`

### Analyst interface

- [Streamlit application](https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/ui/app.py): `src/moneygraph/ui/app.py`
- [Investigation workspace](https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/ui/agentic.py): `src/moneygraph/ui/agentic.py`
- [HTTP API client](https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/ui/client.py): `src/moneygraph/ui/client.py`
- [Graph visualization](https://github.com/baitc-hacks/hack-173e8652-synex/blob/main/src/moneygraph/ui/graph.py): `src/moneygraph/ui/graph.py`

### Other components

- **AML analyst**
- **Transaction Parquet**
- **OpenAI service**

## Connections

- Transaction Parquet → Analysis pipeline: provides inputs
- Analysis pipeline → Ingestion and validation: runs validation (evidence: `src/moneygraph/pipeline/service.py`)
- Analysis pipeline → Graph construction: builds graph (evidence: `src/moneygraph/pipeline/service.py`)
- Analysis pipeline → Financial features: computes features (evidence: `src/moneygraph/pipeline/service.py`)
- Analysis pipeline → Role assignment: assigns roles (evidence: `src/moneygraph/pipeline/service.py`)
- Analysis pipeline → Clustering: clusters nodes (evidence: `src/moneygraph/pipeline/service.py`)
- Analysis pipeline → Temporal analysis: computes timing (evidence: `src/moneygraph/pipeline/service.py`)
- Analysis pipeline → Prioritization: scores priorities (evidence: `src/moneygraph/pipeline/service.py`)
- Analysis pipeline → Signal explanations: generates explanations (evidence: `src/moneygraph/pipeline/service.py`)
- Analysis pipeline → Analysis artifacts: writes artifacts (evidence: `src/moneygraph/pipeline/service.py`)
- Analysis pipeline → Analysis artifacts: produces snapshot (evidence: `src/moneygraph/pipeline/service.py`)
- Date replay monitor → Case assessment and actions: scans dates
- Case assessment and actions → Case repository: records cases (evidence: `src/moneygraph/services/agentic_loop.py`)
- Case assessment and actions → Provider and AI governance: requests assessment (evidence: `src/moneygraph/services/agentic_loop.py`)
- Case assessment and actions → Review draft: prepares draft (evidence: `src/moneygraph/services/agentic_loop.py`)
- AML analyst → Investigation workspace: reviews and decides
- AI Copilot route → Provider and AI governance: requests answer (evidence: `src/moneygraph/api/routes/assistant.py`)
- Provider and AI governance → OpenAI service: dispatches calls
- FastAPI application → Date replay monitor: starts monitor (evidence: `src/moneygraph/api/main.py`)
- FastAPI application → Case and analytics routes: registers routes (evidence: `src/moneygraph/api/main.py`)
- Case and analytics routes → Case assessment and actions: handles case actions (evidence: `src/moneygraph/api/routes/agentic.py`)
- Case and analytics routes → Case repository: reads and writes (evidence: `src/moneygraph/api/routes/agentic.py`)
- FastAPI application → Graph query service: wires graph service
- Graph query service → Artifact access: queries artifacts (evidence: `src/moneygraph/services/graph_queries.py`)
- Case repository → SQLite database: persists records (evidence: `src/moneygraph/repository/database.py`)
- Streamlit application → Investigation workspace: renders workspace (evidence: `src/moneygraph/ui/app.py`)
- Streamlit application → HTTP API client: creates client (evidence: `src/moneygraph/ui/app.py`)
- Investigation workspace → HTTP API client: requests API data (evidence: `src/moneygraph/ui/agentic.py`)
- Investigation workspace → Graph visualization: shows graph evidence (evidence: `src/moneygraph/ui/agentic.py`)
- HTTP API client → FastAPI application: sends HTTP requests (evidence: `src/moneygraph/ui/client.py`)
- Analysis artifacts → Artifact access: serves analysis data
