# moritzkremb/jev-sales-copilot architecture

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

- Interactive diagram: https://gitdiagram.com/moritzkremb/jev-sales-copilot
- Repository: https://github.com/moritzkremb/jev-sales-copilot

## Overview

Sales Copilot accepts call utterances through a browser or transcript replay, analyzes each turn, and returns live probability, signals, stage, objection state, and coaching. The server owns session orchestration; the call engine combines Jev’s typed judgments with code-based scoring and state. Optional tailored phrasing runs off the critical path. The excerpts show core engine, replay, and personalization behavior; some UI and server wiring is supported only by the README, so unsampled relationships are omitted.

Main entry points: [`copilot/engine.py`](https://github.com/moritzkremb/jev-sales-copilot/blob/main/copilot/engine.py) (Call session), [`copilot/server.py`](https://github.com/moritzkremb/jev-sales-copilot/blob/main/copilot/server.py) (WebSocket server), [`static/index.html`](https://github.com/moritzkremb/jev-sales-copilot/blob/main/static/index.html) (Browser UI), [`copilot/jev_client.py`](https://github.com/moritzkremb/jev-sales-copilot/blob/main/copilot/jev_client.py) (Jev client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Call interaction"]
  node_browser["Browser UI<br/>[index.html]"]
  node_transcript["Call transcripts"]
  node_replay_loader["Transcript loader<br/>[replay.py]"]
  node_cli["Replay CLI<br/>[cli.py]"]
end

subgraph group_runtime["Session runtime"]
  node_server["WebSocket server<br/>[server.py]"]
  node_session["Call session<br/>[engine.py]"]
end

subgraph group_analysis["Call analysis"]
  node_copilot_state["Live call state<br/>[engine.py]"]
  node_scoring["Probability and signals<br/>[engine.py]"]
  node_decision_config["Questions and weights<br/>[constants.py]"]
  node_stage_objection["Stage and objections<br/>[constants.py]"]
  node_jev_client["Jev client<br/>[jev_client.py]"]
end

subgraph group_guidance["Coaching and integrations"]
  node_playbook["Coaching playbook<br/>[playbook.json]"]
  node_personalizer["Tailored phrasing<br/>[personalize.py]"]
end

node_seller(("Sales rep"))
node_jev{{"TypeSafe Jev"}}
node_anthropic{{"Anthropic LLM"}}

node_seller -->|"provides utterances"| node_browser
node_browser -->|"sends utterances"| node_server
node_transcript -->|"loads calls"| node_replay_loader
node_browser -->|"starts replay"| node_server
node_server -->|"loads replay"| node_replay_loader
node_cli -->|"loads transcripts"| node_replay_loader
node_cli -->|"ingests turns"| node_session
node_server -->|"ingests turns"| node_session
node_session -->|"judges utterance"| node_jev_client
node_jev_client -->|"uses model settings"| node_decision_config
node_jev_client -->|"requests judgments"| node_jev
node_session -->|"uses thresholds"| node_decision_config
node_session -->|"computes state"| node_scoring
node_session -->|"tracks decisions"| node_stage_objection
node_decision_config -->|"loads moves"| node_playbook
node_session -->|"selects coaching"| node_playbook
node_server -->|"requests rewrite"| node_personalizer
node_personalizer -->|"generates phrasing"| node_anthropic
node_personalizer -->|"verifies phrasing"| node_jev_client
node_server -->|"streams updates"| node_browser
node_copilot_state -->|"renders live results"| node_browser

click node_browser "https://github.com/moritzkremb/jev-sales-copilot/blob/main/static/index.html"
click node_transcript "https://github.com/moritzkremb/jev-sales-copilot/tree/main/data/calls"
click node_replay_loader "https://github.com/moritzkremb/jev-sales-copilot/blob/main/copilot/replay.py"
click node_cli "https://github.com/moritzkremb/jev-sales-copilot/blob/main/copilot/cli.py"
click node_server "https://github.com/moritzkremb/jev-sales-copilot/blob/main/copilot/server.py"
click node_session "https://github.com/moritzkremb/jev-sales-copilot/blob/main/copilot/engine.py"
click node_copilot_state "https://github.com/moritzkremb/jev-sales-copilot/blob/main/copilot/engine.py"
click node_scoring "https://github.com/moritzkremb/jev-sales-copilot/blob/main/copilot/engine.py"
click node_decision_config "https://github.com/moritzkremb/jev-sales-copilot/blob/main/copilot/constants.py"
click node_stage_objection "https://github.com/moritzkremb/jev-sales-copilot/blob/main/copilot/constants.py"
click node_jev_client "https://github.com/moritzkremb/jev-sales-copilot/blob/main/copilot/jev_client.py"
click node_playbook "https://github.com/moritzkremb/jev-sales-copilot/blob/main/data/playbook.json"
click node_personalizer "https://github.com/moritzkremb/jev-sales-copilot/blob/main/copilot/personalize.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_browser,node_transcript,node_replay_loader,node_cli toneBlue
class node_server,node_session toneAmber
class node_copilot_state,node_scoring,node_decision_config,node_stage_objection,node_jev_client toneMint
class node_playbook,node_personalizer toneRose
class node_seller,node_jev,node_anthropic toneIndigo
```

## Components

### Call interaction

- [Browser UI](https://github.com/moritzkremb/jev-sales-copilot/blob/main/static/index.html): `static/index.html`
- [Call transcripts](https://github.com/moritzkremb/jev-sales-copilot/tree/main/data/calls): `data/calls`
- [Transcript loader](https://github.com/moritzkremb/jev-sales-copilot/blob/main/copilot/replay.py): `copilot/replay.py`
- [Replay CLI](https://github.com/moritzkremb/jev-sales-copilot/blob/main/copilot/cli.py): `copilot/cli.py`

### Session runtime

- [WebSocket server](https://github.com/moritzkremb/jev-sales-copilot/blob/main/copilot/server.py): `copilot/server.py`
- [Call session](https://github.com/moritzkremb/jev-sales-copilot/blob/main/copilot/engine.py): `copilot/engine.py`

### Call analysis

- [Live call state](https://github.com/moritzkremb/jev-sales-copilot/blob/main/copilot/engine.py): `copilot/engine.py`
- [Probability and signals](https://github.com/moritzkremb/jev-sales-copilot/blob/main/copilot/engine.py): `copilot/engine.py`
- [Questions and weights](https://github.com/moritzkremb/jev-sales-copilot/blob/main/copilot/constants.py): `copilot/constants.py`
- [Stage and objections](https://github.com/moritzkremb/jev-sales-copilot/blob/main/copilot/constants.py): `copilot/constants.py`
- [Jev client](https://github.com/moritzkremb/jev-sales-copilot/blob/main/copilot/jev_client.py): `copilot/jev_client.py`

### Coaching and integrations

- [Coaching playbook](https://github.com/moritzkremb/jev-sales-copilot/blob/main/data/playbook.json): `data/playbook.json`
- [Tailored phrasing](https://github.com/moritzkremb/jev-sales-copilot/blob/main/copilot/personalize.py): `copilot/personalize.py`

### Other components

- **Sales rep**
- **TypeSafe Jev**
- **Anthropic LLM**

## Connections

- Sales rep → Browser UI: provides utterances (evidence: `README.md`)
- Browser UI → WebSocket server: sends utterances (evidence: `README.md`)
- Call transcripts → Transcript loader: loads calls (evidence: `copilot/replay.py`)
- Browser UI → WebSocket server: starts replay (evidence: `README.md`)
- WebSocket server → Transcript loader: loads replay (evidence: `copilot/server.py`)
- Replay CLI → Transcript loader: loads transcripts (evidence: `copilot/cli.py`)
- Replay CLI → Call session: ingests turns (evidence: `copilot/cli.py`)
- WebSocket server → Call session: ingests turns (evidence: `copilot/server.py`)
- Call session → Jev client: judges utterance (evidence: `README.md`)
- Jev client → Questions and weights: uses model settings (evidence: `copilot/jev_client.py`)
- Jev client → TypeSafe Jev: requests judgments (evidence: `copilot/jev_client.py`)
- Call session → Questions and weights: uses thresholds (evidence: `copilot/engine.py`)
- Call session → Probability and signals: computes state (evidence: `copilot/engine.py`)
- Call session → Stage and objections: tracks decisions (evidence: `README.md`)
- Questions and weights → Coaching playbook: loads moves (evidence: `README.md`)
- Call session → Coaching playbook: selects coaching (evidence: `README.md`)
- WebSocket server → Tailored phrasing: requests rewrite (evidence: `copilot/server.py`)
- Tailored phrasing → Anthropic LLM: generates phrasing (evidence: `copilot/personalize.py`)
- Tailored phrasing → Jev client: verifies phrasing (evidence: `copilot/personalize.py`)
- WebSocket server → Browser UI: streams updates (evidence: `README.md`)
- Live call state → Browser UI: renders live results (evidence: `README.md`)
