# mithalouni/system-one-open architecture

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

- Interactive diagram: https://gitdiagram.com/mithalouni/system-one-open
- Repository: https://github.com/mithalouni/system-one-open

## Overview

System One is an open Jev-style decision model: callers provide state and typed questions, and receive calibrated choice, score, or yes/no results from one model pass. The repository also includes dataset preparation, model training, evaluation, live demos, and game-policy examples. The graph follows documented flows and sampled call sites; several demo and evaluation internals are represented at their indexed module paths because their full implementations were not sampled.

Main entry points: [`serve.py`](https://github.com/mithalouni/system-one-open/blob/main/serve.py) (HTTP decision service), [`s1/engine.py`](https://github.com/mithalouni/system-one-open/blob/main/s1/engine.py) (Decision inference), [`train.py`](https://github.com/mithalouni/system-one-open/blob/main/train.py) (Model training), [`evaluate.py`](https://github.com/mithalouni/system-one-open/blob/main/evaluate.py) (Model evaluation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Decision Data"]
  node_data_real["Public task loaders<br/>[data_real.py]"]
  node_data_synth["Synthetic task generators<br/>[data_synth.py]"]
  node_build_data["Dataset mixture builder<br/>[build_data.py]"]
end

subgraph group_model["Model Runtime"]
  node_schema["Typed prompt schema<br/>[schema.py]"]
  node_engine["Decision inference<br/>[engine.py]"]
end

subgraph group_product["Serving &amp; Demos"]
  node_server["HTTP decision service<br/>[serve.py]"]
  node_presets["Demo presets<br/>[demo_presets.py]"]
  node_demo_page["Main demo page<br/>[demo_page.py]"]
  node_demo_pages2["Race, email, viral demos<br/>[demo_pages2.py]"]
  node_demo_pages3["Drive, home demos<br/>[demo_pages3.py]"]
  node_demo_race["Demo question sets<br/>[demo_race.py]"]
  node_games["Game policy runner<br/>[games.py]"]
  node_doom_sim["Doom policy simulator<br/>[doom_sim.py]"]
end

subgraph group_eval["Training &amp; Evaluation"]
  node_train["Model training<br/>[train.py]"]
  node_evaluate["Model evaluation<br/>[evaluate.py]"]
  node_metrics["Calibration metrics<br/>[metrics.py]"]
  node_typesafe_eval["TypeSafe benchmark data<br/>[typesafe_eval.py]"]
end

node_caller(("API caller"))

node_data_real -->|"creates examples"| node_schema
node_data_synth -->|"creates examples"| node_schema
node_data_real -->|"supplies tasks"| node_build_data
node_data_synth -->|"supplies tasks"| node_build_data
node_build_data -->|"prepares mixture"| node_train
node_engine -->|"builds prompts"| node_schema
node_caller -->|"sends request"| node_server
node_server -->|"calls decide"| node_engine
node_server -->|"loads presets"| node_presets
node_server -->|"serves page"| node_demo_page
node_server -->|"serves pages"| node_demo_pages2
node_server -->|"serves pages"| node_demo_pages3
node_server -->|"loads questions"| node_demo_race
node_demo_pages2 -->|"shares styles"| node_demo_pages3
node_demo_pages2 -->|"posts race request"| node_server
node_demo_pages3 -->|"posts decisions"| node_server
node_games -->|"requests decisions"| node_engine
node_doom_sim -->|"uses task states"| node_data_synth
node_train -->|"loads examples"| node_schema
node_train -->|"trains model"| node_engine
node_train -->|"measures calibration"| node_metrics
node_evaluate -->|"scores decisions"| node_engine
node_evaluate -->|"computes metrics"| node_metrics
node_evaluate -->|"evaluates policy"| node_doom_sim
node_typesafe_eval -->|"provides benchmark"| node_evaluate

click node_data_real "https://github.com/mithalouni/system-one-open/blob/main/s1/data_real.py"
click node_data_synth "https://github.com/mithalouni/system-one-open/blob/main/s1/data_synth.py"
click node_build_data "https://github.com/mithalouni/system-one-open/blob/main/build_data.py"
click node_schema "https://github.com/mithalouni/system-one-open/blob/main/s1/schema.py"
click node_engine "https://github.com/mithalouni/system-one-open/blob/main/s1/engine.py"
click node_server "https://github.com/mithalouni/system-one-open/blob/main/serve.py"
click node_presets "https://github.com/mithalouni/system-one-open/blob/main/s1/demo_presets.py"
click node_demo_page "https://github.com/mithalouni/system-one-open/blob/main/s1/demo_page.py"
click node_demo_pages2 "https://github.com/mithalouni/system-one-open/blob/main/s1/demo_pages2.py"
click node_demo_pages3 "https://github.com/mithalouni/system-one-open/blob/main/s1/demo_pages3.py"
click node_demo_race "https://github.com/mithalouni/system-one-open/blob/main/s1/demo_race.py"
click node_games "https://github.com/mithalouni/system-one-open/blob/main/games.py"
click node_doom_sim "https://github.com/mithalouni/system-one-open/blob/main/s1/doom_sim.py"
click node_train "https://github.com/mithalouni/system-one-open/blob/main/train.py"
click node_evaluate "https://github.com/mithalouni/system-one-open/blob/main/evaluate.py"
click node_metrics "https://github.com/mithalouni/system-one-open/blob/main/s1/metrics.py"
click node_typesafe_eval "https://github.com/mithalouni/system-one-open/blob/main/typesafe_eval.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_data_real,node_data_synth,node_build_data toneBlue
class node_schema,node_engine toneAmber
class node_server,node_presets,node_demo_page,node_demo_pages2,node_demo_pages3,node_demo_race,node_games,node_doom_sim,node_caller toneMint
class node_train,node_evaluate,node_metrics,node_typesafe_eval toneRose
```

## Components

### Decision Data

- [Public task loaders](https://github.com/mithalouni/system-one-open/blob/main/s1/data_real.py): `s1/data_real.py`
- [Synthetic task generators](https://github.com/mithalouni/system-one-open/blob/main/s1/data_synth.py): `s1/data_synth.py`
- [Dataset mixture builder](https://github.com/mithalouni/system-one-open/blob/main/build_data.py): `build_data.py`

### Model Runtime

- [Typed prompt schema](https://github.com/mithalouni/system-one-open/blob/main/s1/schema.py): `s1/schema.py`
- [Decision inference](https://github.com/mithalouni/system-one-open/blob/main/s1/engine.py): `s1/engine.py`

### Serving & Demos

- [HTTP decision service](https://github.com/mithalouni/system-one-open/blob/main/serve.py): `serve.py`
- [Demo presets](https://github.com/mithalouni/system-one-open/blob/main/s1/demo_presets.py): `s1/demo_presets.py`
- [Main demo page](https://github.com/mithalouni/system-one-open/blob/main/s1/demo_page.py): `s1/demo_page.py`
- [Race, email, viral demos](https://github.com/mithalouni/system-one-open/blob/main/s1/demo_pages2.py): `s1/demo_pages2.py`
- [Drive, home demos](https://github.com/mithalouni/system-one-open/blob/main/s1/demo_pages3.py): `s1/demo_pages3.py`
- [Demo question sets](https://github.com/mithalouni/system-one-open/blob/main/s1/demo_race.py): `s1/demo_race.py`
- [Game policy runner](https://github.com/mithalouni/system-one-open/blob/main/games.py): `games.py`
- [Doom policy simulator](https://github.com/mithalouni/system-one-open/blob/main/s1/doom_sim.py): `s1/doom_sim.py`

### Training & Evaluation

- [Model training](https://github.com/mithalouni/system-one-open/blob/main/train.py): `train.py`
- [Model evaluation](https://github.com/mithalouni/system-one-open/blob/main/evaluate.py): `evaluate.py`
- [Calibration metrics](https://github.com/mithalouni/system-one-open/blob/main/s1/metrics.py): `s1/metrics.py`
- [TypeSafe benchmark data](https://github.com/mithalouni/system-one-open/blob/main/typesafe_eval.py): `typesafe_eval.py`

### Other components

- **API caller**

## Connections

- Public task loaders → Typed prompt schema: creates examples (evidence: `s1/data_real.py`)
- Synthetic task generators → Typed prompt schema: creates examples (evidence: `s1/data_synth.py`)
- Public task loaders → Dataset mixture builder: supplies tasks (evidence: `build_data.py`)
- Synthetic task generators → Dataset mixture builder: supplies tasks (evidence: `build_data.py`)
- Dataset mixture builder → Model training: prepares mixture (evidence: `README.md`)
- Decision inference → Typed prompt schema: builds prompts (evidence: `s1/engine.py`)
- API caller → HTTP decision service: sends request (evidence: `serve.py`)
- HTTP decision service → Decision inference: calls decide (evidence: `serve.py`)
- HTTP decision service → Demo presets: loads presets (evidence: `serve.py`)
- HTTP decision service → Main demo page: serves page (evidence: `serve.py`)
- HTTP decision service → Race, email, viral demos: serves pages (evidence: `serve.py`)
- HTTP decision service → Drive, home demos: serves pages (evidence: `serve.py`)
- HTTP decision service → Demo question sets: loads questions (evidence: `serve.py`)
- Race, email, viral demos → Drive, home demos: shares styles (evidence: `s1/demo_pages3.py`)
- Race, email, viral demos → HTTP decision service: posts race request (evidence: `s1/demo_pages2.py`)
- Drive, home demos → HTTP decision service: posts decisions (evidence: `s1/demo_pages3.py`)
- Game policy runner → Decision inference: requests decisions (evidence: `games.py`)
- Doom policy simulator → Synthetic task generators: uses task states (evidence: `s1/doom_sim.py`)
- Model training → Typed prompt schema: loads examples (evidence: `train.py`)
- Model training → Decision inference: trains model (evidence: `train.py`)
- Model training → Calibration metrics: measures calibration (evidence: `train.py`)
- Model evaluation → Decision inference: scores decisions (evidence: `evaluate.py`)
- Model evaluation → Calibration metrics: computes metrics (evidence: `evaluate.py`)
- Model evaluation → Doom policy simulator: evaluates policy (evidence: `evaluate.py`)
- TypeSafe benchmark data → Model evaluation: provides benchmark (evidence: `README.md`)
