# dariopipa/small-minds architecture

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

- Interactive diagram: https://gitdiagram.com/dariopipa/small-minds
- Repository: https://github.com/dariopipa/small-minds

## Overview

This thesis application runs benchmark experiments against local Ollama models to compare single- and multi-agent strategies. The principal workflow loads experiment settings, starts the completion API, runs benchmark requests through a selected strategy, collects calls and scores, and writes per-run results. The strategy stage includes direct, role-based, self-consistency, and Society of Minds approaches; agents prepare prompts, call the model, and extract answers. Separate analysis scripts inspect and plot results. Some evaluation and analysis links are based on the source index rather than inspected implementations.

Main entry points: [`src/api/app.py`](https://github.com/dariopipa/small-minds/blob/master/src/api/app.py) (API application), [`src/evaluation/runner.py`](https://github.com/dariopipa/small-minds/blob/master/src/evaluation/runner.py) (Evaluation runner), [`src/strategies/factory.py`](https://github.com/dariopipa/small-minds/blob/master/src/strategies/factory.py) (Strategy factory), [`src/agents/agent.py`](https://github.com/dariopipa/small-minds/blob/master/src/agents/agent.py) (LLM agent)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_evaluation["Experiment evaluation"]
  node_config["Experiment settings<br/>[experiments.py]"]
  node_loader["Config loader<br/>[config_loader.py]"]
  node_runner["Evaluation runner<br/>[runner.py]"]
  node_api_process["API process<br/>[api_process.py]"]
  node_harness["Benchmark harness<br/>[lm_eval_harness.py]"]
  node_sample_results["Sample assembly<br/>[sample_results.py]"]
  node_result_store["Run results<br/>[result_store.py]"]
end

subgraph group_serving["Completion API"]
  node_app["API application<br/>[app.py]"]
  node_routes["Completion route<br/>[routes.py]"]
  node_call_log["Call records<br/>[routes.py]"]
end

subgraph group_collaboration["Agent strategies"]
  node_factory["Strategy factory<br/>[factory.py]"]
  node_direct["Direct strategy<br/>[direct.py]"]
  node_role_svj["Role-based SVJ<br/>[role_based_svj.py]"]
  node_self_consistency["Self consistency"]
  node_society["Society of Minds"]
  node_agent_factory["Agent factory<br/>[factory.py]"]
  node_agent["LLM agent<br/>[agent.py]"]
  node_prompt_loader["Prompt loader<br/>[loader.py]"]
end

subgraph group_model["Model and answers"]
  node_extractor_factory["Extractor factory<br/>[factory.py]"]
  node_extractor["Answer extraction<br/>[base.py]"]
  node_llm_factory["LLM factory<br/>[factory.py]"]
  node_ollama["Ollama client<br/>[client.py]"]
end

subgraph group_analysis["Result analysis"]
  node_analysis_main["Analysis entry<br/>[analysis.py]"]
  node_analysis_behavior["Behavior analysis"]
  node_analysis_plots["Result plots<br/>[analysis_plots.py]"]
end

node_engineer(("Experiment operator"))
node_ollama_service(("Ollama model service"))

node_engineer -->|"starts evaluation"| node_runner
node_runner -->|"loads settings"| node_loader
node_loader -->|"parses experiments"| node_config
node_runner -->|"starts API"| node_api_process
node_runner -->|"runs benchmark"| node_harness
node_runner -->|"assembles samples"| node_sample_results
node_runner -->|"writes run results"| node_result_store
node_harness -.->|"sends completions"| node_app
node_app -->|"loads experiments"| node_loader
node_app -->|"creates client"| node_llm_factory
node_app -->|"creates extractor"| node_extractor_factory
node_app -->|"builds strategies"| node_factory
node_app -->|"registers routes"| node_routes
node_routes -->|"writes records"| node_call_log
node_routes -.->|"runs selected strategy"| node_direct
node_factory -->|"creates strategy"| node_direct
node_factory -->|"creates strategy"| node_role_svj
node_factory -->|"creates strategy"| node_self_consistency
node_factory -->|"creates strategy"| node_society
node_app -->|"configures agents"| node_agent_factory
node_agent_factory -->|"creates agents"| node_agent
node_agent -->|"generates response"| node_ollama
node_agent -->|"prepares and extracts"| node_extractor
node_llm_factory -->|"creates client"| node_ollama
node_ollama -->|"requests generation"| node_ollama_service
node_role_svj -->|"runs agent"| node_agent
node_self_consistency -->|"runs agent"| node_agent
node_society -->|"runs agent"| node_agent
node_society -->|"prepares follow-up"| node_extractor
node_factory -->|"loads prompts"| node_prompt_loader
node_analysis_main -->|"uses analysis"| node_analysis_behavior
node_analysis_main -->|"uses plotting"| node_analysis_plots

click node_config "https://github.com/dariopipa/small-minds/blob/master/src/configs/experiments.py"
click node_loader "https://github.com/dariopipa/small-minds/blob/master/src/configs/config_loader.py"
click node_runner "https://github.com/dariopipa/small-minds/blob/master/src/evaluation/runner.py"
click node_api_process "https://github.com/dariopipa/small-minds/blob/master/src/evaluation/api_process.py"
click node_harness "https://github.com/dariopipa/small-minds/blob/master/src/evaluation/lm_eval_harness.py"
click node_sample_results "https://github.com/dariopipa/small-minds/blob/master/src/evaluation/sample_results.py"
click node_result_store "https://github.com/dariopipa/small-minds/blob/master/src/evaluation/result_store.py"
click node_app "https://github.com/dariopipa/small-minds/blob/master/src/api/app.py"
click node_routes "https://github.com/dariopipa/small-minds/blob/master/src/api/routes.py"
click node_call_log "https://github.com/dariopipa/small-minds/blob/master/src/api/routes.py"
click node_factory "https://github.com/dariopipa/small-minds/blob/master/src/strategies/factory.py"
click node_direct "https://github.com/dariopipa/small-minds/blob/master/src/strategies/direct.py"
click node_role_svj "https://github.com/dariopipa/small-minds/blob/master/src/strategies/role_based_svj.py"
click node_self_consistency "https://github.com/dariopipa/small-minds/blob/master/src/strategies/self_consistency.py"
click node_society "https://github.com/dariopipa/small-minds/blob/master/src/strategies/society_of_minds.py"
click node_agent_factory "https://github.com/dariopipa/small-minds/blob/master/src/agents/factory.py"
click node_agent "https://github.com/dariopipa/small-minds/blob/master/src/agents/agent.py"
click node_prompt_loader "https://github.com/dariopipa/small-minds/blob/master/src/prompts/loader.py"
click node_extractor_factory "https://github.com/dariopipa/small-minds/blob/master/src/extractors/factory.py"
click node_extractor "https://github.com/dariopipa/small-minds/blob/master/src/extractors/base.py"
click node_llm_factory "https://github.com/dariopipa/small-minds/blob/master/src/llm/factory.py"
click node_ollama "https://github.com/dariopipa/small-minds/blob/master/src/llm/ollama/client.py"
click node_analysis_main "https://github.com/dariopipa/small-minds/blob/master/analysis.py"
click node_analysis_behavior "https://github.com/dariopipa/small-minds/blob/master/analysis_behavior.py"
click node_analysis_plots "https://github.com/dariopipa/small-minds/blob/master/analysis_plots.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_config,node_loader,node_runner,node_api_process,node_harness,node_sample_results,node_result_store toneBlue
class node_app,node_routes,node_call_log toneAmber
class node_factory,node_direct,node_role_svj,node_self_consistency,node_society,node_agent_factory,node_agent,node_prompt_loader toneMint
class node_extractor_factory,node_extractor,node_llm_factory,node_ollama toneRose
class node_analysis_main,node_analysis_behavior,node_analysis_plots,node_engineer,node_ollama_service toneIndigo
```

## Components

### Experiment evaluation

- [Experiment settings](https://github.com/dariopipa/small-minds/blob/master/src/configs/experiments.py): `src/configs/experiments.py`
- [Config loader](https://github.com/dariopipa/small-minds/blob/master/src/configs/config_loader.py): `src/configs/config_loader.py`
- [Evaluation runner](https://github.com/dariopipa/small-minds/blob/master/src/evaluation/runner.py): `src/evaluation/runner.py`
- [API process](https://github.com/dariopipa/small-minds/blob/master/src/evaluation/api_process.py): `src/evaluation/api_process.py`
- [Benchmark harness](https://github.com/dariopipa/small-minds/blob/master/src/evaluation/lm_eval_harness.py): `src/evaluation/lm_eval_harness.py`
- [Sample assembly](https://github.com/dariopipa/small-minds/blob/master/src/evaluation/sample_results.py): `src/evaluation/sample_results.py`
- [Run results](https://github.com/dariopipa/small-minds/blob/master/src/evaluation/result_store.py): `src/evaluation/result_store.py`

### Completion API

- [API application](https://github.com/dariopipa/small-minds/blob/master/src/api/app.py): `src/api/app.py`
- [Completion route](https://github.com/dariopipa/small-minds/blob/master/src/api/routes.py): `src/api/routes.py`
- [Call records](https://github.com/dariopipa/small-minds/blob/master/src/api/routes.py): `src/api/routes.py`

### Agent strategies

- [Strategy factory](https://github.com/dariopipa/small-minds/blob/master/src/strategies/factory.py): `src/strategies/factory.py`
- [Direct strategy](https://github.com/dariopipa/small-minds/blob/master/src/strategies/direct.py): `src/strategies/direct.py`
- [Role-based SVJ](https://github.com/dariopipa/small-minds/blob/master/src/strategies/role_based_svj.py): `src/strategies/role_based_svj.py`
- [Self consistency](https://github.com/dariopipa/small-minds/blob/master/src/strategies/self_consistency.py): `src/strategies/self_consistency.py`
- [Society of Minds](https://github.com/dariopipa/small-minds/blob/master/src/strategies/society_of_minds.py): `src/strategies/society_of_minds.py`
- [Agent factory](https://github.com/dariopipa/small-minds/blob/master/src/agents/factory.py): `src/agents/factory.py`
- [LLM agent](https://github.com/dariopipa/small-minds/blob/master/src/agents/agent.py): `src/agents/agent.py`
- [Prompt loader](https://github.com/dariopipa/small-minds/blob/master/src/prompts/loader.py): `src/prompts/loader.py`

### Model and answers

- [Extractor factory](https://github.com/dariopipa/small-minds/blob/master/src/extractors/factory.py): `src/extractors/factory.py`
- [Answer extraction](https://github.com/dariopipa/small-minds/blob/master/src/extractors/base.py): `src/extractors/base.py`
- [LLM factory](https://github.com/dariopipa/small-minds/blob/master/src/llm/factory.py): `src/llm/factory.py`
- [Ollama client](https://github.com/dariopipa/small-minds/blob/master/src/llm/ollama/client.py): `src/llm/ollama/client.py`

### Result analysis

- [Analysis entry](https://github.com/dariopipa/small-minds/blob/master/analysis.py): `analysis.py`
- [Behavior analysis](https://github.com/dariopipa/small-minds/blob/master/analysis_behavior.py): `analysis_behavior.py`
- [Result plots](https://github.com/dariopipa/small-minds/blob/master/analysis_plots.py): `analysis_plots.py`

### Other components

- **Experiment operator**
- **Ollama model service**

## Connections

- Experiment operator → Evaluation runner: starts evaluation
- Evaluation runner → Config loader: loads settings (evidence: `src/evaluation/runner.py`)
- Config loader → Experiment settings: parses experiments (evidence: `src/configs/config_loader.py`)
- Evaluation runner → API process: starts API (evidence: `src/evaluation/runner.py`)
- Evaluation runner → Benchmark harness: runs benchmark (evidence: `src/evaluation/runner.py`)
- Evaluation runner → Sample assembly: assembles samples (evidence: `src/evaluation/runner.py`)
- Evaluation runner → Run results: writes run results (evidence: `src/evaluation/runner.py`)
- Benchmark harness → API application: sends completions
- API application → Config loader: loads experiments (evidence: `src/api/app.py`)
- API application → LLM factory: creates client (evidence: `src/api/app.py`)
- API application → Extractor factory: creates extractor (evidence: `src/api/app.py`)
- API application → Strategy factory: builds strategies (evidence: `src/api/app.py`)
- API application → Completion route: registers routes (evidence: `src/api/app.py`)
- Completion route → Call records: writes records (evidence: `src/api/routes.py`)
- Completion route → Direct strategy: runs selected strategy
- Strategy factory → Direct strategy: creates strategy (evidence: `src/strategies/factory.py`)
- Strategy factory → Role-based SVJ: creates strategy (evidence: `src/strategies/factory.py`)
- Strategy factory → Self consistency: creates strategy (evidence: `src/strategies/factory.py`)
- Strategy factory → Society of Minds: creates strategy (evidence: `src/strategies/factory.py`)
- API application → Agent factory: configures agents (evidence: `src/api/app.py`)
- Agent factory → LLM agent: creates agents (evidence: `src/agents/factory.py`)
- LLM agent → Ollama client: generates response (evidence: `src/agents/agent.py`)
- LLM agent → Answer extraction: prepares and extracts (evidence: `src/agents/agent.py`)
- LLM factory → Ollama client: creates client (evidence: `src/llm/factory.py`)
- Ollama client → Ollama model service: requests generation (evidence: `src/llm/ollama/client.py`)
- Role-based SVJ → LLM agent: runs agent (evidence: `src/strategies/role_based_svj.py`)
- Self consistency → LLM agent: runs agent (evidence: `src/strategies/self_consistency.py`)
- Society of Minds → LLM agent: runs agent (evidence: `src/strategies/society_of_minds.py`)
- Society of Minds → Answer extraction: prepares follow-up (evidence: `src/strategies/society_of_minds.py`)
- Strategy factory → Prompt loader: loads prompts (evidence: `src/strategies/factory.py`)
- Analysis entry → Behavior analysis: uses analysis (evidence: `analysis.py`)
- Analysis entry → Result plots: uses plotting (evidence: `analysis.py`)
