# codesbyrohit/overthinking-engine architecture

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

- Interactive diagram: https://gitdiagram.com/codesbyrohit/overthinking-engine
- Repository: https://github.com/codesbyrohit/overthinking-engine

## Overview

The Overthinking Engine is a browser-only decision app: a user submits a dilemma, the app normalizes alternatives and computes a deterministic council decision, then presents deliberation and a formal verdict. Optional Monte Carlo analysis runs in a Web Worker when available, with a main-thread fallback. The README documents the decision-tree, counterfactual, and verdict capabilities; their implementation paths are included, though not all were sampled. Evidence for some engine-stage links is therefore README-level rather than a direct source excerpt.

Main entry points: [`src/components/Results.tsx`](https://github.com/codesbyrohit/overthinking-engine/blob/main/src/components/Results.tsx) (Results composition), [`src/App.tsx`](https://github.com/codesbyrohit/overthinking-engine/blob/main/src/App.tsx) (App orchestration), [`src/engine/verdict.ts`](https://github.com/codesbyrohit/overthinking-engine/blob/main/src/engine/verdict.ts) (Verdict builder), [`src/lib/useSimulation.ts`](https://github.com/codesbyrohit/overthinking-engine/blob/main/src/lib/useSimulation.ts) (Simulation controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App workflow"]
  node_app["App orchestration<br/>[App.tsx]"]
  node_intake["Dilemma intake<br/>[IntakeForm.tsx]"]
  node_deliberation["Deliberation display<br/>[Deliberation.tsx]"]
end

subgraph group_core["Decision core"]
  node_normalize["Normalize alternatives<br/>[normalize.ts]"]
  node_features["Alternative features<br/>[features.ts]"]
  node_council["Specialist scoring<br/>[agents.ts]"]
  node_engine["Aggregate and explain<br/>[engine.ts]"]
  node_verdict["Verdict builder<br/>[verdict.ts]"]
end

subgraph group_analysis["Robustness analysis"]
  node_simulation["Monte Carlo simulator<br/>[simulation.ts]"]
  node_worker["Simulation worker"]
  node_simulation_hook["Simulation controller<br/>[useSimulation.ts]"]
  node_tree["Decision tree builder<br/>[tree.ts]"]
end

subgraph group_presentation["Results and reporting"]
  node_results["Results composition<br/>[Results.tsx]"]
  node_council_view["Council results<br/>[AgentCouncil.tsx]"]
  node_scoreboard["Ranked alternatives<br/>[Scoreboard.tsx]"]
  node_tree_view["Decision tree view"]
  node_simulation_panel["Simulation charts"]
  node_report["Official report<br/>[OfficialReport.tsx]"]
  node_commentary["Report commentary<br/>[provider.ts]"]
  node_hero["Verdict summary<br/>[VerdictHero.tsx]"]
end

node_user(("Decision maker"))

node_user -->|"submits dilemma"| node_intake
node_intake -->|"provides form"| node_app
node_app -->|"analyzes input"| node_normalize
node_normalize -->|"normalized decision"| node_engine
node_engine -->|"extracts features"| node_features
node_engine -->|"evaluates alternatives"| node_council
node_app -->|"shows deliberation"| node_deliberation
node_app -->|"shows findings"| node_results
node_results -->|"renders"| node_council_view
node_results -->|"renders"| node_scoreboard
node_results -->|"renders"| node_tree_view
node_results -->|"renders"| node_simulation_panel
node_results -->|"renders"| node_report
node_results -->|"renders"| node_hero
node_app -->|"builds verdict"| node_verdict
node_verdict -->|"uses simulation outcomes"| node_simulation
node_verdict -.->|"provides report data"| node_tree
node_report -->|"requests commentary"| node_commentary
node_commentary -->|"uses verdict data"| node_verdict
node_app -->|"controls simulation"| node_simulation_hook
node_simulation_hook -->|"sends simulation request"| node_worker
node_worker -->|"runs scenarios"| node_simulation
node_simulation_hook -->|"runs fallback"| node_simulation
node_simulation_panel -->|"configures and reruns"| node_simulation_hook
node_tree_view -.->|"displays tree output"| node_tree

click node_app "https://github.com/codesbyrohit/overthinking-engine/blob/main/src/App.tsx"
click node_intake "https://github.com/codesbyrohit/overthinking-engine/blob/main/src/components/IntakeForm.tsx"
click node_deliberation "https://github.com/codesbyrohit/overthinking-engine/blob/main/src/components/Deliberation.tsx"
click node_normalize "https://github.com/codesbyrohit/overthinking-engine/blob/main/src/engine/normalize.ts"
click node_features "https://github.com/codesbyrohit/overthinking-engine/blob/main/src/engine/features.ts"
click node_council "https://github.com/codesbyrohit/overthinking-engine/blob/main/src/engine/agents.ts"
click node_engine "https://github.com/codesbyrohit/overthinking-engine/blob/main/src/engine/engine.ts"
click node_simulation "https://github.com/codesbyrohit/overthinking-engine/blob/main/src/engine/simulation.ts"
click node_worker "https://github.com/codesbyrohit/overthinking-engine/blob/main/src/workers/simulation.worker.ts"
click node_simulation_hook "https://github.com/codesbyrohit/overthinking-engine/blob/main/src/lib/useSimulation.ts"
click node_tree "https://github.com/codesbyrohit/overthinking-engine/blob/main/src/engine/tree.ts"
click node_results "https://github.com/codesbyrohit/overthinking-engine/blob/main/src/components/Results.tsx"
click node_council_view "https://github.com/codesbyrohit/overthinking-engine/blob/main/src/components/AgentCouncil.tsx"
click node_scoreboard "https://github.com/codesbyrohit/overthinking-engine/blob/main/src/components/Scoreboard.tsx"
click node_tree_view "https://github.com/codesbyrohit/overthinking-engine/blob/main/src/components/DecisionTreeView.tsx"
click node_simulation_panel "https://github.com/codesbyrohit/overthinking-engine/blob/main/src/components/MonteCarloPanel.tsx"
click node_verdict "https://github.com/codesbyrohit/overthinking-engine/blob/main/src/engine/verdict.ts"
click node_report "https://github.com/codesbyrohit/overthinking-engine/blob/main/src/components/OfficialReport.tsx"
click node_commentary "https://github.com/codesbyrohit/overthinking-engine/blob/main/src/commentary/provider.ts"
click node_hero "https://github.com/codesbyrohit/overthinking-engine/blob/main/src/components/VerdictHero.tsx"

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_app,node_intake,node_deliberation toneBlue
class node_normalize,node_features,node_council,node_engine,node_verdict toneAmber
class node_simulation,node_worker,node_simulation_hook,node_tree toneMint
class node_results,node_council_view,node_scoreboard,node_tree_view,node_simulation_panel,node_report,node_commentary,node_hero toneRose
class node_user toneIndigo
```

## Components

### App workflow

- [App orchestration](https://github.com/codesbyrohit/overthinking-engine/blob/main/src/App.tsx): `src/App.tsx`
- [Dilemma intake](https://github.com/codesbyrohit/overthinking-engine/blob/main/src/components/IntakeForm.tsx): `src/components/IntakeForm.tsx`
- [Deliberation display](https://github.com/codesbyrohit/overthinking-engine/blob/main/src/components/Deliberation.tsx): `src/components/Deliberation.tsx`

### Decision core

- [Normalize alternatives](https://github.com/codesbyrohit/overthinking-engine/blob/main/src/engine/normalize.ts): `src/engine/normalize.ts`
- [Alternative features](https://github.com/codesbyrohit/overthinking-engine/blob/main/src/engine/features.ts): `src/engine/features.ts`
- [Specialist scoring](https://github.com/codesbyrohit/overthinking-engine/blob/main/src/engine/agents.ts): `src/engine/agents.ts`
- [Aggregate and explain](https://github.com/codesbyrohit/overthinking-engine/blob/main/src/engine/engine.ts): `src/engine/engine.ts`
- [Verdict builder](https://github.com/codesbyrohit/overthinking-engine/blob/main/src/engine/verdict.ts): `src/engine/verdict.ts`

### Robustness analysis

- [Monte Carlo simulator](https://github.com/codesbyrohit/overthinking-engine/blob/main/src/engine/simulation.ts): `src/engine/simulation.ts`
- [Simulation worker](https://github.com/codesbyrohit/overthinking-engine/blob/main/src/workers/simulation.worker.ts): `src/workers/simulation.worker.ts`
- [Simulation controller](https://github.com/codesbyrohit/overthinking-engine/blob/main/src/lib/useSimulation.ts): `src/lib/useSimulation.ts`
- [Decision tree builder](https://github.com/codesbyrohit/overthinking-engine/blob/main/src/engine/tree.ts): `src/engine/tree.ts`

### Results and reporting

- [Results composition](https://github.com/codesbyrohit/overthinking-engine/blob/main/src/components/Results.tsx): `src/components/Results.tsx`
- [Council results](https://github.com/codesbyrohit/overthinking-engine/blob/main/src/components/AgentCouncil.tsx): `src/components/AgentCouncil.tsx`
- [Ranked alternatives](https://github.com/codesbyrohit/overthinking-engine/blob/main/src/components/Scoreboard.tsx): `src/components/Scoreboard.tsx`
- [Decision tree view](https://github.com/codesbyrohit/overthinking-engine/blob/main/src/components/DecisionTreeView.tsx): `src/components/DecisionTreeView.tsx`
- [Simulation charts](https://github.com/codesbyrohit/overthinking-engine/blob/main/src/components/MonteCarloPanel.tsx): `src/components/MonteCarloPanel.tsx`
- [Official report](https://github.com/codesbyrohit/overthinking-engine/blob/main/src/components/OfficialReport.tsx): `src/components/OfficialReport.tsx`
- [Report commentary](https://github.com/codesbyrohit/overthinking-engine/blob/main/src/commentary/provider.ts): `src/commentary/provider.ts`
- [Verdict summary](https://github.com/codesbyrohit/overthinking-engine/blob/main/src/components/VerdictHero.tsx): `src/components/VerdictHero.tsx`

### Other components

- **Decision maker**

## Connections

- Decision maker → Dilemma intake: submits dilemma (evidence: `README.md`)
- Dilemma intake → App orchestration: provides form (evidence: `src/App.tsx`)
- App orchestration → Normalize alternatives: analyzes input (evidence: `src/App.tsx`)
- Normalize alternatives → Aggregate and explain: normalized decision (evidence: `src/engine/index.ts`)
- Aggregate and explain → Alternative features: extracts features (evidence: `src/engine/engine.ts`)
- Aggregate and explain → Specialist scoring: evaluates alternatives (evidence: `src/engine/engine.ts`)
- App orchestration → Deliberation display: shows deliberation (evidence: `src/App.tsx`)
- App orchestration → Results composition: shows findings (evidence: `src/App.tsx`)
- Results composition → Council results: renders (evidence: `src/components/Results.tsx`)
- Results composition → Ranked alternatives: renders (evidence: `src/components/Results.tsx`)
- Results composition → Decision tree view: renders (evidence: `src/components/Results.tsx`)
- Results composition → Simulation charts: renders (evidence: `src/components/Results.tsx`)
- Results composition → Official report: renders (evidence: `src/components/Results.tsx`)
- Results composition → Verdict summary: renders (evidence: `src/components/Results.tsx`)
- App orchestration → Verdict builder: builds verdict (evidence: `src/App.tsx`)
- Verdict builder → Monte Carlo simulator: uses simulation outcomes (evidence: `src/engine/verdict.ts`)
- Verdict builder → Decision tree builder: provides report data
- Official report → Report commentary: requests commentary (evidence: `src/components/OfficialReport.tsx`)
- Report commentary → Verdict builder: uses verdict data (evidence: `src/commentary/provider.ts`)
- App orchestration → Simulation controller: controls simulation (evidence: `src/App.tsx`)
- Simulation controller → Simulation worker: sends simulation request (evidence: `src/lib/useSimulation.ts`)
- Simulation worker → Monte Carlo simulator: runs scenarios (evidence: `src/workers/simulation.worker.ts`)
- Simulation controller → Monte Carlo simulator: runs fallback (evidence: `src/lib/useSimulation.ts`)
- Simulation charts → Simulation controller: configures and reruns (evidence: `src/components/MonteCarloPanel.tsx`)
- Decision tree view → Decision tree builder: displays tree output
