# anakinrtran/mp-context architecture

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

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

## Overview

MP Context is a prompt-engineering exercise for building and improving a customer-service bot. The main workflow is: a student studies the shop facts and rules, edits the bot prompt, runs customer-message evals against a local model, reviews scored results, and iterates; students can also author adversarial evals. The graph reflects the documented workflow and sampled harness calls. The eval definitions, menu, rules, and rubrics are represented from the tree and README; their internal contents were not sampled.

Main entry points: [`run_evals.py`](https://github.com/anakinrtran/mp-context/blob/main/run_evals.py) (Eval entry point), [`harness/scoring.py`](https://github.com/anakinrtran/mp-context/blob/main/harness/scoring.py) (Response checks), [`harness/client.py`](https://github.com/anakinrtran/mp-context/blob/main/harness/client.py) (Ollama client), [`harness/runner.py`](https://github.com/anakinrtran/mp-context/blob/main/harness/runner.py) (Eval runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_authoring["Prompt authoring"]
  node_shop_facts["Shop facts<br/>[menu.md]"]
  node_shop_rules["Bot rules<br/>[rules.md]"]
  node_bot_prompt["Bot prompt<br/>[system_prompt.txt]"]
  node_graded_evals["Graded evals<br/>[tests.json]"]
  node_student_evals["Student evals<br/>[student_evals.txt]"]
  node_eval_schema["Response schema<br/>[schema.json]"]
  node_judge_rubrics["Judge rubrics"]
end

subgraph group_evaluation["Eval execution"]
  node_entrypoint["Eval entry point<br/>[run_evals.py]"]
  node_eval_parser["Student eval parser<br/>[student_evals.py]"]
  node_eval_runner["Eval runner<br/>[runner.py]"]
  node_model_client["Ollama client<br/>[client.py]"]
end

subgraph group_assessment["Scoring and feedback"]
  node_response_checks["Response checks<br/>[scoring.py]"]
  node_judge["LLM judge<br/>[client.py]"]
  node_results_report["Results report<br/>[report.py]"]
end

node_student(("Student"))
node_local_model(("Local model"))

node_student -->|"reads facts"| node_shop_facts
node_student -->|"reads rules"| node_shop_rules
node_student -->|"edits prompt"| node_bot_prompt
node_student -->|"authors evals"| node_student_evals
node_entrypoint -->|"loads evals"| node_graded_evals
node_entrypoint -->|"loads schema"| node_eval_schema
node_entrypoint -->|"loads prompt"| node_bot_prompt
node_entrypoint -->|"loads student evals"| node_eval_parser
node_eval_parser -->|"parses blocks"| node_student_evals
node_entrypoint -->|"runs evals"| node_eval_runner
node_eval_runner -->|"requests response"| node_model_client
node_model_client -->|"sends prompt"| node_local_model
node_local_model -->|"returns response"| node_model_client
node_eval_runner -->|"checks response"| node_response_checks
node_response_checks -->|"validates shape"| node_eval_schema
node_response_checks -->|"loads rubric"| node_judge_rubrics
node_response_checks -->|"requests judgment"| node_judge
node_judge -->|"uses model client"| node_model_client
node_entrypoint -->|"prints results"| node_results_report
node_results_report -->|"shows scores"| node_student

click node_shop_facts "https://github.com/anakinrtran/mp-context/blob/main/docs/menu.md"
click node_shop_rules "https://github.com/anakinrtran/mp-context/blob/main/docs/rules.md"
click node_bot_prompt "https://github.com/anakinrtran/mp-context/blob/main/system_prompt.txt"
click node_graded_evals "https://github.com/anakinrtran/mp-context/blob/main/evals/tests.json"
click node_student_evals "https://github.com/anakinrtran/mp-context/blob/main/evals/student_evals.txt"
click node_eval_schema "https://github.com/anakinrtran/mp-context/blob/main/evals/schema.json"
click node_judge_rubrics "https://github.com/anakinrtran/mp-context/tree/main/evals/rubrics"
click node_entrypoint "https://github.com/anakinrtran/mp-context/blob/main/run_evals.py"
click node_eval_parser "https://github.com/anakinrtran/mp-context/blob/main/harness/student_evals.py"
click node_eval_runner "https://github.com/anakinrtran/mp-context/blob/main/harness/runner.py"
click node_model_client "https://github.com/anakinrtran/mp-context/blob/main/harness/client.py"
click node_response_checks "https://github.com/anakinrtran/mp-context/blob/main/harness/scoring.py"
click node_judge "https://github.com/anakinrtran/mp-context/blob/main/harness/client.py"
click node_results_report "https://github.com/anakinrtran/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_shop_facts,node_shop_rules,node_bot_prompt,node_graded_evals,node_student_evals,node_eval_schema,node_judge_rubrics toneBlue
class node_entrypoint,node_eval_parser,node_eval_runner,node_model_client toneAmber
class node_response_checks,node_judge,node_results_report toneMint
class node_student,node_local_model toneIndigo
```

## Components

### Prompt authoring

- [Shop facts](https://github.com/anakinrtran/mp-context/blob/main/docs/menu.md): `docs/menu.md`
- [Bot rules](https://github.com/anakinrtran/mp-context/blob/main/docs/rules.md): `docs/rules.md`
- [Bot prompt](https://github.com/anakinrtran/mp-context/blob/main/system_prompt.txt): `system_prompt.txt`
- [Graded evals](https://github.com/anakinrtran/mp-context/blob/main/evals/tests.json): `evals/tests.json`
- [Student evals](https://github.com/anakinrtran/mp-context/blob/main/evals/student_evals.txt): `evals/student_evals.txt`
- [Response schema](https://github.com/anakinrtran/mp-context/blob/main/evals/schema.json): `evals/schema.json`
- [Judge rubrics](https://github.com/anakinrtran/mp-context/tree/main/evals/rubrics): `evals/rubrics`

### Eval execution

- [Eval entry point](https://github.com/anakinrtran/mp-context/blob/main/run_evals.py): `run_evals.py`
- [Student eval parser](https://github.com/anakinrtran/mp-context/blob/main/harness/student_evals.py): `harness/student_evals.py`
- [Eval runner](https://github.com/anakinrtran/mp-context/blob/main/harness/runner.py): `harness/runner.py`
- [Ollama client](https://github.com/anakinrtran/mp-context/blob/main/harness/client.py): `harness/client.py`

### Scoring and feedback

- [Response checks](https://github.com/anakinrtran/mp-context/blob/main/harness/scoring.py): `harness/scoring.py`
- [LLM judge](https://github.com/anakinrtran/mp-context/blob/main/harness/client.py): `harness/client.py`
- [Results report](https://github.com/anakinrtran/mp-context/blob/main/harness/report.py): `harness/report.py`

### Other components

- **Student**
- **Local model**

## Connections

- Student → Shop facts: reads facts
- Student → Bot rules: reads rules
- Student → Bot prompt: edits prompt
- Student → Student evals: authors evals
- Eval entry point → Graded evals: loads evals
- Eval entry point → Response schema: loads schema
- Eval entry point → Bot prompt: loads prompt
- Eval entry point → Student eval parser: loads student evals
- Student eval parser → Student evals: parses blocks
- Eval entry point → Eval runner: runs evals
- Eval runner → Ollama client: requests response
- Ollama client → Local model: sends prompt
- Local model → Ollama client: returns response
- Eval runner → Response checks: checks response
- Response checks → Response schema: validates shape
- Response checks → Judge rubrics: loads rubric
- Response checks → LLM judge: requests judgment
- LLM judge → Ollama client: uses model client
- Eval entry point → Results report: prints results
- Results report → Student: shows scores
