# abcel-thomas/smartrenameai-lite architecture

> Architecture diagram of the GitHub repository abcel-thomas/smartrenameai-lite, 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/abcel-thomas/smartrenameai-lite
- Repository: https://github.com/abcel-thomas/smartrenameai-lite

## Overview

SmartRenameAI Lite is a local-first file analysis and filename-suggestion prototype. Its active CLI workflow discovers files in a selected folder, extracts text or prepares images, obtains a model-generated description and name, validates the suggestion, and prints a dry-run preview; it does not rename or move files. A separate inventory service scans and hashes files, records metadata and duplicate links in SQLite, and is not wired into the CLI. Operation planning, approval, persistence, and execution modules are present, but their detailed runtime flow is not established by the excerpts; edges show only documented or indexed references.

Main entry points: [`main.py`](https://github.com/abcel-thomas/smartrenameai-lite/blob/main/main.py) (Preview CLI), [`database/db_manager.py`](https://github.com/abcel-thomas/smartrenameai-lite/blob/main/database/db_manager.py) (Database Manager), [`intelligence/analyzer.py`](https://github.com/abcel-thomas/smartrenameai-lite/blob/main/intelligence/analyzer.py) (Content Analysis), [`file_manager/inventory.py`](https://github.com/abcel-thomas/smartrenameai-lite/blob/main/file_manager/inventory.py) (Inventory Service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_naming["Naming Preview"]
  node_cli["Preview CLI<br/>[main.py]"]
  node_config["Shared Settings<br/>[config.py]"]
  node_text_extract["Text Extraction<br/>[text_engine.py]"]
  node_image_prep["Image Preparation<br/>[image_engine.py]"]
  node_analysis["Content Analysis<br/>[analyzer.py]"]
  node_name_generation["Name Generation"]
  node_name_validation["Name Validation<br/>[validator.py]"]
  node_ollama_client["Ollama Client<br/>[ollama_client.py]"]
end

subgraph group_inventory["File Inventory"]
  node_inventory_service["Inventory Service<br/>[inventory.py]"]
  node_scanner["File Scanner<br/>[scanner.py]"]
  node_hasher["SHA-256 Hasher<br/>[hasher.py]"]
end

subgraph group_persistence["SQLite Persistence"]
  node_database_manager["Database Manager<br/>[db_manager.py]"]
  node_records["Typed Records<br/>[models.py]"]
  node_sqlite[("SQLite Store")]
end

subgraph group_operations["Operations Workflow"]
  node_planner["Operation Planner<br/>[planner.py]"]
  node_approval["Approval Manager"]
  node_executor["Operation Executor<br/>[executor.py]"]
end

node_user(("User"))
node_ollama{{"Local Ollama"}}

node_user -->|"runs"| node_cli
node_cli -->|"extracts text"| node_text_extract
node_cli -->|"requests OCR"| node_image_prep
node_cli -->|"requests summary"| node_analysis
node_cli -->|"requests name"| node_name_generation
node_cli -->|"validates suggestion"| node_name_validation
node_cli -->|"uses settings"| node_config
node_text_extract -->|"uses limits"| node_config
node_analysis -->|"uses prompts"| node_config
node_analysis -->|"uses image support"| node_image_prep
node_analysis -.->|"requests model"| node_ollama_client
node_name_generation -.->|"requests model"| node_ollama_client
node_ollama_client -->|"reads endpoint"| node_config
node_ollama_client -->|"sends chat request"| node_ollama
node_user -->|"indexes folder"| node_inventory_service
node_inventory_service -->|"scans files"| node_scanner
node_inventory_service -->|"hashes files"| node_hasher
node_inventory_service -->|"records inventory"| node_database_manager
node_database_manager -->|"reads and writes"| node_sqlite
node_database_manager -.->|"constructs records"| node_records
node_planner -.->|"uses persistence"| node_database_manager
node_approval -->|"records decisions"| node_database_manager
node_executor -.->|"uses persistence"| node_database_manager
node_executor -.->|"uses hashing"| node_hasher

click node_cli "https://github.com/abcel-thomas/smartrenameai-lite/blob/main/main.py"
click node_config "https://github.com/abcel-thomas/smartrenameai-lite/blob/main/config.py"
click node_text_extract "https://github.com/abcel-thomas/smartrenameai-lite/blob/main/engines/text_engine.py"
click node_image_prep "https://github.com/abcel-thomas/smartrenameai-lite/blob/main/engines/image_engine.py"
click node_analysis "https://github.com/abcel-thomas/smartrenameai-lite/blob/main/intelligence/analyzer.py"
click node_name_generation "https://github.com/abcel-thomas/smartrenameai-lite/blob/main/intelligence/filename_generator.py"
click node_name_validation "https://github.com/abcel-thomas/smartrenameai-lite/blob/main/intelligence/validator.py"
click node_ollama_client "https://github.com/abcel-thomas/smartrenameai-lite/blob/main/engines/ollama_client.py"
click node_inventory_service "https://github.com/abcel-thomas/smartrenameai-lite/blob/main/file_manager/inventory.py"
click node_scanner "https://github.com/abcel-thomas/smartrenameai-lite/blob/main/file_manager/scanner.py"
click node_hasher "https://github.com/abcel-thomas/smartrenameai-lite/blob/main/file_manager/hasher.py"
click node_database_manager "https://github.com/abcel-thomas/smartrenameai-lite/blob/main/database/db_manager.py"
click node_records "https://github.com/abcel-thomas/smartrenameai-lite/blob/main/database/models.py"
click node_planner "https://github.com/abcel-thomas/smartrenameai-lite/blob/main/operations/planner.py"
click node_approval "https://github.com/abcel-thomas/smartrenameai-lite/blob/main/operations/approval_manager.py"
click node_executor "https://github.com/abcel-thomas/smartrenameai-lite/blob/main/operations/executor.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_cli,node_config,node_text_extract,node_image_prep,node_analysis,node_name_generation,node_name_validation,node_ollama_client,node_user toneBlue
class node_inventory_service,node_scanner,node_hasher toneAmber
class node_database_manager,node_records,node_sqlite toneMint
class node_planner,node_approval,node_executor toneRose
class node_ollama toneIndigo
```

## Components

### Naming Preview

- [Preview CLI](https://github.com/abcel-thomas/smartrenameai-lite/blob/main/main.py): `main.py`
- [Shared Settings](https://github.com/abcel-thomas/smartrenameai-lite/blob/main/config.py): `config.py`
- [Text Extraction](https://github.com/abcel-thomas/smartrenameai-lite/blob/main/engines/text_engine.py): `engines/text_engine.py`
- [Image Preparation](https://github.com/abcel-thomas/smartrenameai-lite/blob/main/engines/image_engine.py): `engines/image_engine.py`
- [Content Analysis](https://github.com/abcel-thomas/smartrenameai-lite/blob/main/intelligence/analyzer.py): `intelligence/analyzer.py`
- [Name Generation](https://github.com/abcel-thomas/smartrenameai-lite/blob/main/intelligence/filename_generator.py): `intelligence/filename_generator.py`
- [Name Validation](https://github.com/abcel-thomas/smartrenameai-lite/blob/main/intelligence/validator.py): `intelligence/validator.py`
- [Ollama Client](https://github.com/abcel-thomas/smartrenameai-lite/blob/main/engines/ollama_client.py): `engines/ollama_client.py`

### File Inventory

- [Inventory Service](https://github.com/abcel-thomas/smartrenameai-lite/blob/main/file_manager/inventory.py): `file_manager/inventory.py`
- [File Scanner](https://github.com/abcel-thomas/smartrenameai-lite/blob/main/file_manager/scanner.py): `file_manager/scanner.py`
- [SHA-256 Hasher](https://github.com/abcel-thomas/smartrenameai-lite/blob/main/file_manager/hasher.py): `file_manager/hasher.py`

### SQLite Persistence

- [Database Manager](https://github.com/abcel-thomas/smartrenameai-lite/blob/main/database/db_manager.py): `database/db_manager.py`
- [Typed Records](https://github.com/abcel-thomas/smartrenameai-lite/blob/main/database/models.py): `database/models.py`
- **SQLite Store**

### Operations Workflow

- [Operation Planner](https://github.com/abcel-thomas/smartrenameai-lite/blob/main/operations/planner.py): `operations/planner.py`
- [Approval Manager](https://github.com/abcel-thomas/smartrenameai-lite/blob/main/operations/approval_manager.py): `operations/approval_manager.py`
- [Operation Executor](https://github.com/abcel-thomas/smartrenameai-lite/blob/main/operations/executor.py): `operations/executor.py`

### Other components

- **User**
- **Local Ollama**

## Connections

- User → Preview CLI: runs (evidence: `README.md`)
- Preview CLI → Text Extraction: extracts text (evidence: `main.py`)
- Preview CLI → Image Preparation: requests OCR (evidence: `main.py`)
- Preview CLI → Content Analysis: requests summary (evidence: `main.py`)
- Preview CLI → Name Generation: requests name (evidence: `main.py`)
- Preview CLI → Name Validation: validates suggestion (evidence: `main.py`)
- Preview CLI → Shared Settings: uses settings (evidence: `main.py`)
- Text Extraction → Shared Settings: uses limits (evidence: `engines/text_engine.py`)
- Content Analysis → Shared Settings: uses prompts (evidence: `intelligence/analyzer.py`)
- Content Analysis → Image Preparation: uses image support (evidence: `intelligence/analyzer.py`)
- Content Analysis → Ollama Client: requests model (evidence: `intelligence/analyzer.py`)
- Name Generation → Ollama Client: requests model (evidence: `intelligence/filename_generator.py`)
- Ollama Client → Shared Settings: reads endpoint (evidence: `engines/ollama_client.py`)
- Ollama Client → Local Ollama: sends chat request (evidence: `engines/ollama_client.py`)
- User → Inventory Service: indexes folder (evidence: `README.md`)
- Inventory Service → File Scanner: scans files (evidence: `file_manager/inventory.py`)
- Inventory Service → SHA-256 Hasher: hashes files (evidence: `file_manager/inventory.py`)
- Inventory Service → Database Manager: records inventory (evidence: `file_manager/inventory.py`)
- Database Manager → SQLite Store: reads and writes (evidence: `database/db_manager.py`)
- Database Manager → Typed Records: constructs records (evidence: `database/db_manager.py`)
- Operation Planner → Database Manager: uses persistence
- Approval Manager → Database Manager: records decisions (evidence: `operations/approval_manager.py`)
- Operation Executor → Database Manager: uses persistence
- Operation Executor → SHA-256 Hasher: uses hashing (evidence: `operations/executor.py`)
