# cs196illinois/mp-context architecture

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

- Interactive diagram: https://gitdiagram.com/cs196illinois/mp-context
- Repository: https://github.com/cs196illinois/mp-context

## Overview

MP Context is a course exercise for writing and improving a customer-service bot’s system prompt using a local-model evaluation harness. The main workflow is to consult the menu and rules, edit `system_prompt.txt`, run the graded eval suite, inspect scores, and iterate; students can also author extra evals to challenge their bot. The harness loads the prompt and eval inputs, requests model responses, checks them against schema and behavioral criteria, and reports results. The graph includes documented product inputs and capabilities; relationships for unsampled areas are limited to those stated in the README.

Main entry points: [`run_evals.py`](https://github.com/cs196illinois/mp-context/blob/main/run_evals.py) (Eval Entrypoint), [`harness/runner.py`](https://github.com/cs196illinois/mp-context/blob/main/harness/runner.py) (Eval Runner), [`harness/scoring.py`](https://github.com/cs196illinois/mp-context/blob/main/harness/scoring.py) (Scoring Checks), [`harness/client.py`](https://github.com/cs196illinois/mp-context/blob/main/harness/client.py) (Model Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_product["Bot Prompt Inputs"]
  node_menu["Menu Facts<br/>[menu.md]"]
  node_rules["Bot Rules<br/>[rules.md]"]
  node_prompt["System Prompt<br/>[system_prompt.txt]"]
end

subgraph group_evaluation["Evaluation Workflow"]
  node_graded_suite["Graded Eval Suite<br/>[tests.json]"]
  node_student_suite["Student Evals<br/>[student_evals.txt]"]
  node_entrypoint["Eval Entrypoint<br/>[run_evals.py]"]
  node_student_eval_parser["Student Eval Parser<br/>[student_evals.py]"]
  node_runner["Eval Runner<br/>[runner.py]"]
  node_client["Model Client<br/>[client.py]"]
end

subgraph group_checks["Scoring and Checks"]
  node_schema["Response Schema<br/>[schema.json]"]
  node_rubrics["Judge Rubrics"]
  node_scoring["Scoring Checks<br/>[scoring.py]"]
end

subgraph group_results["Results and Iteration"]
  node_report["Results Report<br/>[report.py]"]
end

node_student(("Student"))
node_ollama{{"Local Ollama"}}

node_student -->|"reads"| node_menu
node_student -->|"reads"| node_rules
node_student -->|"edits"| node_prompt
node_student -->|"runs"| node_entrypoint
node_student -->|"authors"| node_student_suite
node_menu -->|"informs"| node_prompt
node_rules -->|"informs"| node_prompt
node_entrypoint -->|"loads"| node_prompt
node_entrypoint -->|"loads"| node_graded_suite
node_entrypoint -->|"loads"| node_schema
node_entrypoint -->|"uses"| node_student_eval_parser
node_entrypoint -->|"dispatches"| node_runner
node_entrypoint -->|"configures"| node_scoring
node_entrypoint -->|"creates"| node_client
node_entrypoint -->|"reports"| node_report
node_student_eval_parser -->|"parses"| node_student_suite
node_student_eval_parser -->|"produces evals"| node_runner
node_runner -->|"requests responses"| node_client
node_runner -->|"runs checks"| node_scoring
node_scoring -->|"loads rubric"| node_rubrics
node_scoring -->|"calls judge"| node_client
node_client -->|"sends chat"| node_ollama
node_report -->|"formats results"| node_runner

click node_menu "https://github.com/cs196illinois/mp-context/blob/main/docs/menu.md"
click node_rules "https://github.com/cs196illinois/mp-context/blob/main/docs/rules.md"
click node_prompt "https://github.com/cs196illinois/mp-context/blob/main/system_prompt.txt"
click node_graded_suite "https://github.com/cs196illinois/mp-context/blob/main/evals/tests.json"
click node_student_suite "https://github.com/cs196illinois/mp-context/blob/main/evals/student_evals.txt"
click node_schema "https://github.com/cs196illinois/mp-context/blob/main/evals/schema.json"
click node_rubrics "https://github.com/cs196illinois/mp-context/tree/main/evals/rubrics"
click node_entrypoint "https://github.com/cs196illinois/mp-context/blob/main/run_evals.py"
click node_student_eval_parser "https://github.com/cs196illinois/mp-context/blob/main/harness/student_evals.py"
click node_runner "https://github.com/cs196illinois/mp-context/blob/main/harness/runner.py"
click node_client "https://github.com/cs196illinois/mp-context/blob/main/harness/client.py"
click node_scoring "https://github.com/cs196illinois/mp-context/blob/main/harness/scoring.py"
click node_report "https://github.com/cs196illinois/mp-context/blob/main/harness/report.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_menu,node_rules,node_prompt toneBlue
class node_graded_suite,node_student_suite,node_entrypoint,node_student_eval_parser,node_runner,node_client toneAmber
class node_schema,node_rubrics,node_scoring toneMint
class node_report toneRose
class node_student,node_ollama toneIndigo
```

## Components

### Bot Prompt Inputs

- [Menu Facts](https://github.com/cs196illinois/mp-context/blob/main/docs/menu.md): `docs/menu.md`
- [Bot Rules](https://github.com/cs196illinois/mp-context/blob/main/docs/rules.md): `docs/rules.md`
- [System Prompt](https://github.com/cs196illinois/mp-context/blob/main/system_prompt.txt): `system_prompt.txt`

### Evaluation Workflow

- [Graded Eval Suite](https://github.com/cs196illinois/mp-context/blob/main/evals/tests.json): `evals/tests.json`
- [Student Evals](https://github.com/cs196illinois/mp-context/blob/main/evals/student_evals.txt): `evals/student_evals.txt`
- [Eval Entrypoint](https://github.com/cs196illinois/mp-context/blob/main/run_evals.py): `run_evals.py`
- [Student Eval Parser](https://github.com/cs196illinois/mp-context/blob/main/harness/student_evals.py): `harness/student_evals.py`
- [Eval Runner](https://github.com/cs196illinois/mp-context/blob/main/harness/runner.py): `harness/runner.py`
- [Model Client](https://github.com/cs196illinois/mp-context/blob/main/harness/client.py): `harness/client.py`

### Scoring and Checks

- [Response Schema](https://github.com/cs196illinois/mp-context/blob/main/evals/schema.json): `evals/schema.json`
- [Judge Rubrics](https://github.com/cs196illinois/mp-context/tree/main/evals/rubrics): `evals/rubrics`
- [Scoring Checks](https://github.com/cs196illinois/mp-context/blob/main/harness/scoring.py): `harness/scoring.py`

### Results and Iteration

- [Results Report](https://github.com/cs196illinois/mp-context/blob/main/harness/report.py): `harness/report.py`

### Other components

- **Student**
- **Local Ollama**

## Connections

- Student → Menu Facts: reads (evidence: `README.md`)
- Student → Bot Rules: reads (evidence: `README.md`)
- Student → System Prompt: edits (evidence: `README.md`)
- Student → Eval Entrypoint: runs (evidence: `README.md`)
- Student → Student Evals: authors (evidence: `README.md`)
- Menu Facts → System Prompt: informs (evidence: `README.md`)
- Bot Rules → System Prompt: informs (evidence: `README.md`)
- Eval Entrypoint → System Prompt: loads (evidence: `run_evals.py`)
- Eval Entrypoint → Graded Eval Suite: loads (evidence: `run_evals.py`)
- Eval Entrypoint → Response Schema: loads (evidence: `run_evals.py`)
- Eval Entrypoint → Student Eval Parser: uses (evidence: `run_evals.py`)
- Eval Entrypoint → Eval Runner: dispatches (evidence: `run_evals.py`)
- Eval Entrypoint → Scoring Checks: configures (evidence: `run_evals.py`)
- Eval Entrypoint → Model Client: creates (evidence: `run_evals.py`)
- Eval Entrypoint → Results Report: reports (evidence: `run_evals.py`)
- Student Eval Parser → Student Evals: parses (evidence: `README.md`)
- Student Eval Parser → Eval Runner: produces evals (evidence: `README.md`)
- Eval Runner → Model Client: requests responses (evidence: `harness/runner.py`)
- Eval Runner → Scoring Checks: runs checks (evidence: `harness/runner.py`)
- Scoring Checks → Judge Rubrics: loads rubric (evidence: `harness/scoring.py`)
- Scoring Checks → Model Client: calls judge (evidence: `harness/client.py`)
- Model Client → Local Ollama: sends chat (evidence: `harness/client.py`)
- Results Report → Eval Runner: formats results (evidence: `harness/report.py`)
