# noepeyre/harness-python architecture

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

- Interactive diagram: https://gitdiagram.com/noepeyre/harness-python
- Repository: https://github.com/noepeyre/harness-python

## Overview

This small repository contains a terminal chat client, an older alternative client, and a standalone LM Studio-compatible mock server. The main workflow selects and loads a model, sends chat turns while tracking response IDs for conversation continuity, and supports model management and retry commands. The mock server maintains an in-memory model catalog and can simulate completions offline or optionally adapt requests to Mistral. The excerpts do not establish that the client and mock server are deployed together; their chat endpoint paths also differ.

Main entry points: [`old/lmstudio_mock_mistral.py`](https://github.com/noepeyre/harness-python/blob/master/old/lmstudio_mock_mistral.py) (Compatibility API), [`main.py`](https://github.com/noepeyre/harness-python/blob/master/main.py) (Interactive client), [`old/models.py`](https://github.com/noepeyre/harness-python/blob/master/old/models.py) (Legacy chat client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_terminal["Terminal clients"]
  node_main_client["Interactive client<br/>[main.py]"]
  node_legacy_client["Legacy chat client<br/>[models.py]"]
end

subgraph group_server["Mock server"]
  node_mock_api["Compatibility API"]
  node_model_state[("Model state")]
  node_offline_completion["Offline simulation"]
  node_mistral_adapter["Mistral adapter"]
end

subgraph group_backend["External services"]
  node_lm_studio{{"LM Studio API"}}
  node_mistral{{"Mistral API"}}
end

node_user(("Terminal user"))

node_user -->|"enters prompts"| node_main_client
node_main_client -->|"sends model and chat requests"| node_lm_studio
node_user -->|"enters prompts"| node_legacy_client
node_legacy_client -->|"sends chat requests"| node_lm_studio
node_mock_api -->|"reads and updates"| node_model_state
node_mock_api -->|"builds fallback"| node_offline_completion
node_mock_api -->|"builds request"| node_mistral_adapter
node_mistral_adapter -.->|"sends optional request"| node_mistral

click node_main_client "https://github.com/noepeyre/harness-python/blob/master/main.py"
click node_legacy_client "https://github.com/noepeyre/harness-python/blob/master/old/models.py"
click node_mock_api "https://github.com/noepeyre/harness-python/blob/master/old/lmstudio_mock_mistral.py"
click node_model_state "https://github.com/noepeyre/harness-python/blob/master/old/lmstudio_mock_mistral.py"
click node_offline_completion "https://github.com/noepeyre/harness-python/blob/master/old/lmstudio_mock_mistral.py"
click node_mistral_adapter "https://github.com/noepeyre/harness-python/blob/master/old/lmstudio_mock_mistral.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_main_client,node_legacy_client,node_user toneBlue
class node_mock_api,node_model_state,node_offline_completion,node_mistral_adapter toneAmber
class node_lm_studio,node_mistral toneMint
```

## Components

### Terminal clients

- [Interactive client](https://github.com/noepeyre/harness-python/blob/master/main.py): `main.py`
- [Legacy chat client](https://github.com/noepeyre/harness-python/blob/master/old/models.py): `old/models.py`

### Mock server

- [Compatibility API](https://github.com/noepeyre/harness-python/blob/master/old/lmstudio_mock_mistral.py): `old/lmstudio_mock_mistral.py`
- [Model state](https://github.com/noepeyre/harness-python/blob/master/old/lmstudio_mock_mistral.py): `old/lmstudio_mock_mistral.py`
- [Offline simulation](https://github.com/noepeyre/harness-python/blob/master/old/lmstudio_mock_mistral.py): `old/lmstudio_mock_mistral.py`
- [Mistral adapter](https://github.com/noepeyre/harness-python/blob/master/old/lmstudio_mock_mistral.py): `old/lmstudio_mock_mistral.py`

### External services

- **LM Studio API**
- **Mistral API**

### Other components

- **Terminal user**

## Connections

- Terminal user → Interactive client: enters prompts (evidence: `main.py`)
- Interactive client → LM Studio API: sends model and chat requests (evidence: `main.py`)
- Terminal user → Legacy chat client: enters prompts (evidence: `old/models.py`)
- Legacy chat client → LM Studio API: sends chat requests (evidence: `old/models.py`)
- Compatibility API → Model state: reads and updates (evidence: `old/lmstudio_mock_mistral.py`)
- Compatibility API → Offline simulation: builds fallback (evidence: `old/lmstudio_mock_mistral.py`)
- Compatibility API → Mistral adapter: builds request (evidence: `old/lmstudio_mock_mistral.py`)
- Mistral adapter → Mistral API: sends optional request (evidence: `old/lmstudio_mock_mistral.py`)
