# tokenrhythm/neohorse architecture

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

- Interactive diagram: https://gitdiagram.com/tokenrhythm/neohorse
- Repository: https://github.com/tokenrhythm/neohorse

## Overview

NeoHorse-Jev is the repository’s clearest end-user runtime: an application submits state and Choice/Noul/Score questions, and receives decisions with probabilities (and optional confidence). The graph follows request validation, encoding, model inference, and response formatting, with separate HTTP, image, and serving-backend branches. NeoHorse-1’s routing-guided training loop is documented in the README but has no implementing source path in the tree, so it is shown only as a documented concept. Connections to unsampled backend code are limited to relationships recorded in the source index.

Main entry points: [`jev/package/src/neohorse_decision/server.py`](https://github.com/tokenrhythm/neohorse/blob/main/jev/package/src/neohorse_decision/server.py) (HTTP Server), [`jev/package/src/neohorse_decision/vision.py`](https://github.com/tokenrhythm/neohorse/blob/main/jev/package/src/neohorse_decision/vision.py) (Vision Engine), [`jev/package/src/neohorse_decision/engine.py`](https://github.com/tokenrhythm/neohorse/blob/main/jev/package/src/neohorse_decision/engine.py) (Decision Engine), [`jev/package/src/neohorse_decision/_vendor/schema.py`](https://github.com/tokenrhythm/neohorse/blob/main/jev/package/src/neohorse_decision/_vendor/schema.py) (Request Schema)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Decision API"]
  node_server["HTTP Server<br/>[server.py]"]
  node_wire["System One Adapter<br/>[systemone.py]"]
end

subgraph group_engine["Inference Engine"]
  node_schema["Request Schema<br/>[schema.py]"]
  node_engine_core["Decision Engine<br/>[engine.py]"]
  node_offline["Offline Inference<br/>[_inference.py]"]
  node_decision_model["Decision Model<br/>[model.py]"]
end

subgraph group_vision["Image Decisions"]
  node_image_input["Image Input<br/>[image_input.py]"]
  node_vision_engine["Vision Engine<br/>[vision.py]"]
  node_vision_predictor["Vision Predictor<br/>[predictor.py]"]
end

subgraph group_serving["Serving Backends"]
  node_vllm_head["vLLM Decision Head<br/>[head.py]"]
  node_vllm_model["vLLM Runtime Model<br/>[model.py]"]
  node_vllm_schema["vLLM Request Schema<br/>[schema.py]"]
  node_vllm_vision["vLLM Vision Adapter<br/>[vision.py]"]
  node_vllm_loader["vLLM Model Loader<br/>[vllm_loader.py]"]
  node_weight_mapping["Weight Mapping<br/>[weight_mapping.py]"]
  node_sglang_head["SGLang Decision Head<br/>[head.py]"]
  node_sglang_vision["SGLang Vision Adapter<br/>[vision.py]"]
end

node_app(("Application"))
node_routing_harness["Routing Harness"]
node_decision_result["Decision Result"]

node_app -->|"submits request"| node_server
node_server -->|"validates and formats"| node_wire
node_server -->|"dispatches text"| node_engine_core
node_server -->|"decodes image"| node_image_input
node_server -->|"dispatches image"| node_vision_engine
node_engine_core -->|"loads and predicts"| node_offline
node_engine_core -->|"validates and encodes"| node_schema
node_offline -->|"loads and runs"| node_decision_model
node_offline -->|"maps request"| node_schema
node_wire -->|"validates decisions"| node_schema
node_vision_engine -->|"reuses text model"| node_engine_core
node_vision_engine -->|"encodes question"| node_schema
node_vision_engine -->|"adds confidence"| node_wire
node_vision_predictor -->|"re-exports"| node_vision_engine
node_server -->|"returns response"| node_decision_result
node_vllm_head -->|"encodes and reads out"| node_vllm_model
node_vllm_head -->|"validates requests"| node_vllm_schema
node_vllm_head -->|"routes image input"| node_vllm_vision
node_vllm_loader -->|"maps weights"| node_weight_mapping
node_sglang_head -->|"reuses runtime"| node_vllm_model
node_sglang_head -->|"reuses schema"| node_vllm_schema
node_sglang_head -.->|"routes image input"| node_sglang_vision
node_routing_harness -.->|"routes tasks"| node_app

click node_server "https://github.com/tokenrhythm/neohorse/blob/main/jev/package/src/neohorse_decision/server.py"
click node_wire "https://github.com/tokenrhythm/neohorse/blob/main/jev/package/src/neohorse_decision/systemone.py"
click node_schema "https://github.com/tokenrhythm/neohorse/blob/main/jev/package/src/neohorse_decision/_vendor/schema.py"
click node_engine_core "https://github.com/tokenrhythm/neohorse/blob/main/jev/package/src/neohorse_decision/engine.py"
click node_offline "https://github.com/tokenrhythm/neohorse/blob/main/jev/package/src/neohorse_decision/_inference.py"
click node_decision_model "https://github.com/tokenrhythm/neohorse/blob/main/jev/package/src/neohorse_decision/_vendor/model.py"
click node_image_input "https://github.com/tokenrhythm/neohorse/blob/main/jev/package/src/neohorse_decision/image_input.py"
click node_vision_engine "https://github.com/tokenrhythm/neohorse/blob/main/jev/package/src/neohorse_decision/vision.py"
click node_vision_predictor "https://github.com/tokenrhythm/neohorse/blob/main/jev/vision/predictor.py"
click node_vllm_head "https://github.com/tokenrhythm/neohorse/blob/main/jev/infer/vllm/head.py"
click node_vllm_model "https://github.com/tokenrhythm/neohorse/blob/main/jev/infer/vllm/jev_runtime/model.py"
click node_vllm_schema "https://github.com/tokenrhythm/neohorse/blob/main/jev/infer/vllm/jev_runtime/schema.py"
click node_vllm_vision "https://github.com/tokenrhythm/neohorse/blob/main/jev/infer/vllm/vision.py"
click node_vllm_loader "https://github.com/tokenrhythm/neohorse/blob/main/jev/infer/vllm/vllm_loader.py"
click node_weight_mapping "https://github.com/tokenrhythm/neohorse/blob/main/jev/infer/vllm/weight_mapping.py"
click node_sglang_head "https://github.com/tokenrhythm/neohorse/blob/main/jev/infer/sglang/head.py"
click node_sglang_vision "https://github.com/tokenrhythm/neohorse/blob/main/jev/infer/sglang/vision.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_server,node_wire toneBlue
class node_schema,node_engine_core,node_offline,node_decision_model toneAmber
class node_image_input,node_vision_engine,node_vision_predictor toneMint
class node_vllm_head,node_vllm_model,node_vllm_schema,node_vllm_vision,node_vllm_loader,node_weight_mapping,node_sglang_head,node_sglang_vision toneRose
class node_app,node_routing_harness,node_decision_result toneIndigo
```

## Components

### Decision API

- [HTTP Server](https://github.com/tokenrhythm/neohorse/blob/main/jev/package/src/neohorse_decision/server.py): `jev/package/src/neohorse_decision/server.py`
- [System One Adapter](https://github.com/tokenrhythm/neohorse/blob/main/jev/package/src/neohorse_decision/systemone.py): `jev/package/src/neohorse_decision/systemone.py`

### Inference Engine

- [Request Schema](https://github.com/tokenrhythm/neohorse/blob/main/jev/package/src/neohorse_decision/_vendor/schema.py): `jev/package/src/neohorse_decision/_vendor/schema.py`
- [Decision Engine](https://github.com/tokenrhythm/neohorse/blob/main/jev/package/src/neohorse_decision/engine.py): `jev/package/src/neohorse_decision/engine.py`
- [Offline Inference](https://github.com/tokenrhythm/neohorse/blob/main/jev/package/src/neohorse_decision/_inference.py): `jev/package/src/neohorse_decision/_inference.py`
- [Decision Model](https://github.com/tokenrhythm/neohorse/blob/main/jev/package/src/neohorse_decision/_vendor/model.py): `jev/package/src/neohorse_decision/_vendor/model.py`

### Image Decisions

- [Image Input](https://github.com/tokenrhythm/neohorse/blob/main/jev/package/src/neohorse_decision/image_input.py): `jev/package/src/neohorse_decision/image_input.py`
- [Vision Engine](https://github.com/tokenrhythm/neohorse/blob/main/jev/package/src/neohorse_decision/vision.py): `jev/package/src/neohorse_decision/vision.py`
- [Vision Predictor](https://github.com/tokenrhythm/neohorse/blob/main/jev/vision/predictor.py): `jev/vision/predictor.py`

### Serving Backends

- [vLLM Decision Head](https://github.com/tokenrhythm/neohorse/blob/main/jev/infer/vllm/head.py): `jev/infer/vllm/head.py`
- [vLLM Runtime Model](https://github.com/tokenrhythm/neohorse/blob/main/jev/infer/vllm/jev_runtime/model.py): `jev/infer/vllm/jev_runtime/model.py`
- [vLLM Request Schema](https://github.com/tokenrhythm/neohorse/blob/main/jev/infer/vllm/jev_runtime/schema.py): `jev/infer/vllm/jev_runtime/schema.py`
- [vLLM Vision Adapter](https://github.com/tokenrhythm/neohorse/blob/main/jev/infer/vllm/vision.py): `jev/infer/vllm/vision.py`
- [vLLM Model Loader](https://github.com/tokenrhythm/neohorse/blob/main/jev/infer/vllm/vllm_loader.py): `jev/infer/vllm/vllm_loader.py`
- [Weight Mapping](https://github.com/tokenrhythm/neohorse/blob/main/jev/infer/vllm/weight_mapping.py): `jev/infer/vllm/weight_mapping.py`
- [SGLang Decision Head](https://github.com/tokenrhythm/neohorse/blob/main/jev/infer/sglang/head.py): `jev/infer/sglang/head.py`
- [SGLang Vision Adapter](https://github.com/tokenrhythm/neohorse/blob/main/jev/infer/sglang/vision.py): `jev/infer/sglang/vision.py`

### Other components

- **Application**
- **Routing Harness**
- **Decision Result**

## Connections

- Application → HTTP Server: submits request (evidence: `jev/package/src/neohorse_decision/server.py`)
- HTTP Server → System One Adapter: validates and formats (evidence: `jev/package/src/neohorse_decision/server.py`)
- HTTP Server → Decision Engine: dispatches text (evidence: `jev/package/src/neohorse_decision/server.py`)
- HTTP Server → Image Input: decodes image (evidence: `jev/package/src/neohorse_decision/server.py`)
- HTTP Server → Vision Engine: dispatches image (evidence: `jev/package/src/neohorse_decision/server.py`)
- Decision Engine → Offline Inference: loads and predicts (evidence: `jev/package/src/neohorse_decision/engine.py`)
- Decision Engine → Request Schema: validates and encodes (evidence: `jev/package/src/neohorse_decision/engine.py`)
- Offline Inference → Decision Model: loads and runs (evidence: `jev/package/src/neohorse_decision/_inference.py`)
- Offline Inference → Request Schema: maps request (evidence: `jev/package/src/neohorse_decision/_inference.py`)
- System One Adapter → Request Schema: validates decisions (evidence: `jev/package/src/neohorse_decision/systemone.py`)
- Vision Engine → Decision Engine: reuses text model (evidence: `jev/package/src/neohorse_decision/vision.py`)
- Vision Engine → Request Schema: encodes question (evidence: `jev/package/src/neohorse_decision/vision.py`)
- Vision Engine → System One Adapter: adds confidence (evidence: `jev/package/src/neohorse_decision/vision.py`)
- Vision Predictor → Vision Engine: re-exports (evidence: `jev/vision/predictor.py`)
- HTTP Server → Decision Result: returns response (evidence: `jev/package/src/neohorse_decision/server.py`)
- vLLM Decision Head → vLLM Runtime Model: encodes and reads out (evidence: `jev/infer/vllm/head.py`)
- vLLM Decision Head → vLLM Request Schema: validates requests (evidence: `jev/infer/vllm/head.py`)
- vLLM Decision Head → vLLM Vision Adapter: routes image input (evidence: `jev/infer/vllm/head.py`)
- vLLM Model Loader → Weight Mapping: maps weights (evidence: `jev/infer/vllm/vllm_loader.py`)
- SGLang Decision Head → vLLM Runtime Model: reuses runtime (evidence: `jev/infer/sglang/head.py`)
- SGLang Decision Head → vLLM Request Schema: reuses schema (evidence: `jev/infer/sglang/head.py`)
- SGLang Decision Head → SGLang Vision Adapter: routes image input
- Routing Harness → Application: routes tasks (evidence: `README.md`)
