# sinsntgit/tax_slm architecture

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

- Interactive diagram: https://gitdiagram.com/sinsntgit/tax_slm
- Repository: https://github.com/sinsntgit/tax_slm

## Overview

This is a framework for a tax-law knowledge graph application, with an Indian income-tax domain pack. The main user workflow is uploading a document, converting and extracting it, loading and embedding its graph content, then asking questions and receiving graph- and vector-grounded answers with citations. The map also preserves validation and domain-pack configuration as distinct capabilities. Some subsystem links are based on README statements or source-index references; unsampled implementation details are not inferred.

Main entry points: [`framework/core/ingest/pipeline_ops.py`](https://github.com/sinsntgit/tax_slm/blob/main/framework/core/ingest/pipeline_ops.py) (Ingestion operations), [`framework/core/retrieve/graphrag.py`](https://github.com/sinsntgit/tax_slm/blob/main/framework/core/retrieve/graphrag.py) (GraphRAG retrieval), [`domain_packs/tax/pipeline.py`](https://github.com/sinsntgit/tax_slm/blob/main/domain_packs/tax/pipeline.py) (Ingestion dispatcher), [`framework/core/infra/neo4j_client.py`](https://github.com/sinsntgit/tax_slm/blob/main/framework/core/infra/neo4j_client.py) (Neo4j graph)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_webapp["Web application<br/>[app.py]"]
end

subgraph group_ingestion["Tax ingestion"]
  node_tax_pipeline["Ingestion dispatcher<br/>[pipeline.py]"]
  node_tax_config["Tax domain config<br/>[config.py]"]
  node_tax_pack["Tax pack<br/>[pack.py]"]
  node_tax_prompts["Tax prompts<br/>[tax_prompts.py]"]
  node_act_ingest["Act ingestion<br/>[ingest_act.py]"]
  node_case_ingest["Case-law ingestion<br/>[ingest_caselaw.py]"]
  node_circular_ingest["Circular ingestion<br/>[ingest_circular.py]"]
  node_treaty_ingest["Treaty ingestion<br/>[ingest_treaty.py]"]
end

subgraph group_graph["Graph platform"]
  node_pipeline_ops["Ingestion operations<br/>[pipeline_ops.py]"]
  node_graph_loader["Graph loader<br/>[graph_loader.py]"]
  node_entity_resolution["Entity resolution"]
  node_provenance["Provenance<br/>[provenance.py]"]
  node_validation["Graph validation<br/>[validate.py]"]
  node_embedding["Chunk embeddings<br/>[embedder.py]"]
end

subgraph group_retrieval["Question retrieval"]
  node_graphrag["GraphRAG retrieval<br/>[graphrag.py]"]
  node_retrieval_router["Retrieval router"]
  node_category_retrieval["Category retrieval"]
  node_pii["PII masking<br/>[pii.py]"]
end

subgraph group_shared["Shared services"]
  node_neo4j[("Neo4j graph<br/>[neo4j_client.py]")]
  node_llm["LLM client<br/>[llm_client.py]"]
  node_observability["LLM observability<br/>[observability.py]"]
  node_audit["Ingestion audit<br/>[audit_log.py]"]
  node_settings["Runtime settings<br/>[settings_store.py]"]
  node_step_logger["Step logging<br/>[step_logger.py]"]
  node_dotenv["Environment config<br/>[dotenv_path.py]"]
  node_pack_loader["Pack loader<br/>[pack_loader.py]"]
end

node_user(("User"))

node_user -->|"uploads or asks"| node_webapp
node_webapp -->|"starts ingestion"| node_tax_pipeline
node_tax_pipeline -->|"dispatches Act"| node_act_ingest
node_tax_pipeline -->|"dispatches case"| node_case_ingest
node_tax_pipeline -.->|"dispatches circular"| node_circular_ingest
node_tax_pipeline -.->|"dispatches treaty"| node_treaty_ingest
node_act_ingest -->|"loads graph"| node_pipeline_ops
node_case_ingest -->|"loads graph"| node_pipeline_ops
node_circular_ingest -->|"loads graph"| node_pipeline_ops
node_treaty_ingest -->|"loads graph"| node_pipeline_ops
node_tax_pack -.->|"exposes config"| node_tax_config
node_tax_pack -.->|"exposes prompts"| node_tax_prompts
node_pipeline_ops -->|"loads entities"| node_graph_loader
node_pipeline_ops -->|"opens session"| node_neo4j
node_pipeline_ops -->|"records run"| node_audit
node_graph_loader -->|"resolves entities"| node_entity_resolution
node_graph_loader -->|"tracks provenance"| node_provenance
node_graph_loader -->|"writes graph"| node_neo4j
node_webapp -->|"validates graph"| node_validation
node_webapp -->|"runs ask"| node_graphrag
node_graphrag -->|"queries graph"| node_neo4j
node_graphrag -->|"generates queries"| node_llm
node_graphrag -->|"routes retrieval"| node_retrieval_router
node_graphrag -->|"masks evidence"| node_pii
node_graphrag -.->|"supports categories"| node_category_retrieval
node_embedding -->|"stores vectors"| node_neo4j
node_llm -->|"traces calls"| node_observability
node_llm -->|"reads settings"| node_settings
node_llm -->|"loads environment"| node_dotenv
node_neo4j -->|"loads environment"| node_dotenv
node_pack_loader -->|"loads pack"| node_tax_pack
node_act_ingest -->|"uses domain config"| node_tax_config
node_act_ingest -->|"logs steps"| node_step_logger

click node_webapp "https://github.com/sinsntgit/tax_slm/blob/main/framework/webapp/app.py"
click node_tax_pipeline "https://github.com/sinsntgit/tax_slm/blob/main/domain_packs/tax/pipeline.py"
click node_tax_config "https://github.com/sinsntgit/tax_slm/blob/main/domain_packs/tax/config.py"
click node_tax_pack "https://github.com/sinsntgit/tax_slm/blob/main/domain_packs/tax/pack.py"
click node_tax_prompts "https://github.com/sinsntgit/tax_slm/blob/main/domain_packs/tax/prompts/tax_prompts.py"
click node_act_ingest "https://github.com/sinsntgit/tax_slm/blob/main/domain_packs/tax/converters/ingest_act.py"
click node_case_ingest "https://github.com/sinsntgit/tax_slm/blob/main/domain_packs/tax/converters/ingest_caselaw.py"
click node_circular_ingest "https://github.com/sinsntgit/tax_slm/blob/main/domain_packs/tax/converters/ingest_circular.py"
click node_treaty_ingest "https://github.com/sinsntgit/tax_slm/blob/main/domain_packs/tax/converters/ingest_treaty.py"
click node_pipeline_ops "https://github.com/sinsntgit/tax_slm/blob/main/framework/core/ingest/pipeline_ops.py"
click node_graph_loader "https://github.com/sinsntgit/tax_slm/blob/main/framework/core/ingest/graph_loader.py"
click node_entity_resolution "https://github.com/sinsntgit/tax_slm/blob/main/framework/core/ingest/entity_resolution.py"
click node_provenance "https://github.com/sinsntgit/tax_slm/blob/main/framework/core/ingest/provenance.py"
click node_validation "https://github.com/sinsntgit/tax_slm/blob/main/framework/core/ingest/validate.py"
click node_neo4j "https://github.com/sinsntgit/tax_slm/blob/main/framework/core/infra/neo4j_client.py"
click node_graphrag "https://github.com/sinsntgit/tax_slm/blob/main/framework/core/retrieve/graphrag.py"
click node_retrieval_router "https://github.com/sinsntgit/tax_slm/blob/main/framework/core/retrieve/retrieval_router.py"
click node_category_retrieval "https://github.com/sinsntgit/tax_slm/blob/main/framework/core/retrieve/category_retrieval.py"
click node_pii "https://github.com/sinsntgit/tax_slm/blob/main/framework/core/retrieve/pii.py"
click node_llm "https://github.com/sinsntgit/tax_slm/blob/main/framework/core/infra/llm_client.py"
click node_observability "https://github.com/sinsntgit/tax_slm/blob/main/framework/core/retrieve/observability.py"
click node_audit "https://github.com/sinsntgit/tax_slm/blob/main/framework/core/infra/audit_log.py"
click node_settings "https://github.com/sinsntgit/tax_slm/blob/main/framework/core/infra/settings_store.py"
click node_step_logger "https://github.com/sinsntgit/tax_slm/blob/main/framework/core/infra/step_logger.py"
click node_dotenv "https://github.com/sinsntgit/tax_slm/blob/main/framework/core/infra/dotenv_path.py"
click node_pack_loader "https://github.com/sinsntgit/tax_slm/blob/main/framework/cli/pack_loader.py"
click node_embedding "https://github.com/sinsntgit/tax_slm/blob/main/framework/core/ingest/embedder.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_webapp,node_user toneBlue
class node_tax_pipeline,node_tax_config,node_tax_pack,node_tax_prompts,node_act_ingest,node_case_ingest,node_circular_ingest,node_treaty_ingest toneAmber
class node_pipeline_ops,node_graph_loader,node_entity_resolution,node_provenance,node_validation,node_embedding toneMint
class node_graphrag,node_retrieval_router,node_category_retrieval,node_pii toneRose
class node_neo4j,node_llm,node_observability,node_audit,node_settings,node_step_logger,node_dotenv,node_pack_loader toneIndigo
```

## Components

### User interface

- [Web application](https://github.com/sinsntgit/tax_slm/blob/main/framework/webapp/app.py): `framework/webapp/app.py`

### Tax ingestion

- [Ingestion dispatcher](https://github.com/sinsntgit/tax_slm/blob/main/domain_packs/tax/pipeline.py): `domain_packs/tax/pipeline.py`
- [Tax domain config](https://github.com/sinsntgit/tax_slm/blob/main/domain_packs/tax/config.py): `domain_packs/tax/config.py`
- [Tax pack](https://github.com/sinsntgit/tax_slm/blob/main/domain_packs/tax/pack.py): `domain_packs/tax/pack.py`
- [Tax prompts](https://github.com/sinsntgit/tax_slm/blob/main/domain_packs/tax/prompts/tax_prompts.py): `domain_packs/tax/prompts/tax_prompts.py`
- [Act ingestion](https://github.com/sinsntgit/tax_slm/blob/main/domain_packs/tax/converters/ingest_act.py): `domain_packs/tax/converters/ingest_act.py`
- [Case-law ingestion](https://github.com/sinsntgit/tax_slm/blob/main/domain_packs/tax/converters/ingest_caselaw.py): `domain_packs/tax/converters/ingest_caselaw.py`
- [Circular ingestion](https://github.com/sinsntgit/tax_slm/blob/main/domain_packs/tax/converters/ingest_circular.py): `domain_packs/tax/converters/ingest_circular.py`
- [Treaty ingestion](https://github.com/sinsntgit/tax_slm/blob/main/domain_packs/tax/converters/ingest_treaty.py): `domain_packs/tax/converters/ingest_treaty.py`

### Graph platform

- [Ingestion operations](https://github.com/sinsntgit/tax_slm/blob/main/framework/core/ingest/pipeline_ops.py): `framework/core/ingest/pipeline_ops.py`
- [Graph loader](https://github.com/sinsntgit/tax_slm/blob/main/framework/core/ingest/graph_loader.py): `framework/core/ingest/graph_loader.py`
- [Entity resolution](https://github.com/sinsntgit/tax_slm/blob/main/framework/core/ingest/entity_resolution.py): `framework/core/ingest/entity_resolution.py`
- [Provenance](https://github.com/sinsntgit/tax_slm/blob/main/framework/core/ingest/provenance.py): `framework/core/ingest/provenance.py`
- [Graph validation](https://github.com/sinsntgit/tax_slm/blob/main/framework/core/ingest/validate.py): `framework/core/ingest/validate.py`
- [Chunk embeddings](https://github.com/sinsntgit/tax_slm/blob/main/framework/core/ingest/embedder.py): `framework/core/ingest/embedder.py`

### Question retrieval

- [GraphRAG retrieval](https://github.com/sinsntgit/tax_slm/blob/main/framework/core/retrieve/graphrag.py): `framework/core/retrieve/graphrag.py`
- [Retrieval router](https://github.com/sinsntgit/tax_slm/blob/main/framework/core/retrieve/retrieval_router.py): `framework/core/retrieve/retrieval_router.py`
- [Category retrieval](https://github.com/sinsntgit/tax_slm/blob/main/framework/core/retrieve/category_retrieval.py): `framework/core/retrieve/category_retrieval.py`
- [PII masking](https://github.com/sinsntgit/tax_slm/blob/main/framework/core/retrieve/pii.py): `framework/core/retrieve/pii.py`

### Shared services

- [Neo4j graph](https://github.com/sinsntgit/tax_slm/blob/main/framework/core/infra/neo4j_client.py): `framework/core/infra/neo4j_client.py`
- [LLM client](https://github.com/sinsntgit/tax_slm/blob/main/framework/core/infra/llm_client.py): `framework/core/infra/llm_client.py`
- [LLM observability](https://github.com/sinsntgit/tax_slm/blob/main/framework/core/retrieve/observability.py): `framework/core/retrieve/observability.py`
- [Ingestion audit](https://github.com/sinsntgit/tax_slm/blob/main/framework/core/infra/audit_log.py): `framework/core/infra/audit_log.py`
- [Runtime settings](https://github.com/sinsntgit/tax_slm/blob/main/framework/core/infra/settings_store.py): `framework/core/infra/settings_store.py`
- [Step logging](https://github.com/sinsntgit/tax_slm/blob/main/framework/core/infra/step_logger.py): `framework/core/infra/step_logger.py`
- [Environment config](https://github.com/sinsntgit/tax_slm/blob/main/framework/core/infra/dotenv_path.py): `framework/core/infra/dotenv_path.py`
- [Pack loader](https://github.com/sinsntgit/tax_slm/blob/main/framework/cli/pack_loader.py): `framework/cli/pack_loader.py`

### Other components

- **User**

## Connections

- User → Web application: uploads or asks
- Web application → Ingestion dispatcher: starts ingestion
- Ingestion dispatcher → Act ingestion: dispatches Act
- Ingestion dispatcher → Case-law ingestion: dispatches case
- Ingestion dispatcher → Circular ingestion: dispatches circular
- Ingestion dispatcher → Treaty ingestion: dispatches treaty
- Act ingestion → Ingestion operations: loads graph (evidence: `domain_packs/tax/converters/ingest_act.py`)
- Case-law ingestion → Ingestion operations: loads graph (evidence: `domain_packs/tax/converters/ingest_caselaw.py`)
- Circular ingestion → Ingestion operations: loads graph (evidence: `domain_packs/tax/converters/ingest_circular.py`)
- Treaty ingestion → Ingestion operations: loads graph (evidence: `domain_packs/tax/converters/ingest_treaty.py`)
- Tax pack → Tax domain config: exposes config
- Tax pack → Tax prompts: exposes prompts
- Ingestion operations → Graph loader: loads entities (evidence: `framework/core/ingest/pipeline_ops.py`)
- Ingestion operations → Neo4j graph: opens session (evidence: `framework/core/ingest/pipeline_ops.py`)
- Ingestion operations → Ingestion audit: records run (evidence: `framework/core/ingest/pipeline_ops.py`)
- Graph loader → Entity resolution: resolves entities (evidence: `framework/core/ingest/graph_loader.py`)
- Graph loader → Provenance: tracks provenance (evidence: `framework/core/ingest/graph_loader.py`)
- Graph loader → Neo4j graph: writes graph (evidence: `framework/core/ingest/graph_loader.py`)
- Web application → Graph validation: validates graph (evidence: `framework/webapp/app.py`)
- Web application → GraphRAG retrieval: runs ask (evidence: `framework/webapp/app.py`)
- GraphRAG retrieval → Neo4j graph: queries graph (evidence: `framework/core/retrieve/graphrag.py`)
- GraphRAG retrieval → LLM client: generates queries (evidence: `framework/core/retrieve/graphrag.py`)
- GraphRAG retrieval → Retrieval router: routes retrieval (evidence: `framework/core/retrieve/graphrag.py`)
- GraphRAG retrieval → PII masking: masks evidence (evidence: `framework/core/retrieve/graphrag.py`)
- GraphRAG retrieval → Category retrieval: supports categories
- Chunk embeddings → Neo4j graph: stores vectors (evidence: `framework/core/ingest/embedder.py`)
- LLM client → LLM observability: traces calls (evidence: `framework/core/infra/llm_client.py`)
- LLM client → Runtime settings: reads settings (evidence: `framework/core/infra/llm_client.py`)
- LLM client → Environment config: loads environment (evidence: `framework/core/infra/llm_client.py`)
- Neo4j graph → Environment config: loads environment (evidence: `framework/core/infra/neo4j_client.py`)
- Pack loader → Tax pack: loads pack (evidence: `framework/cli/pack_loader.py`)
- Act ingestion → Tax domain config: uses domain config (evidence: `domain_packs/tax/converters/ingest_act.py`)
- Act ingestion → Step logging: logs steps (evidence: `domain_packs/tax/converters/ingest_act.py`)
