# ratanasovann/quote-brief-copilot architecture

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

- Interactive diagram: https://gitdiagram.com/ratanasovann/quote-brief-copilot
- Repository: https://github.com/ratanasovann/quote-brief-copilot

## Overview

Quote Brief Copilot turns an enquiry into a classified, evidence-checked job card, a missing-details checklist, a guarded draft reply, and an estimator’s quote brief. The rep reviews and approves every message; prices and dates are not generated. The primary runtime is the one-enquiry pipeline, invoked by batch or serving entry points, while the static demo presents saved runs and browser-side decisions. Product profiles define requirements and tone, and evaluation scores pipeline results against hand labels. Some UI relationships are documented in the README; unsampled implementation details are not inferred.

Main entry points: [`src/pipeline.py`](https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/pipeline.py) (Enquiry pipeline), [`src/llm.py`](https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/llm.py) (Model gateway), [`src/classify.py`](https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/classify.py) (Classify message), [`src/extract.py`](https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/extract.py) (Extract job card)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Enquiry workflow"]
  node_enquiry["Enquiry text"]
  node_entry["Run entry points<br/>[run_one.py]"]
  node_pipeline["Enquiry pipeline<br/>[pipeline.py]"]
  node_classify["Classify message<br/>[classify.py]"]
  node_router["Route decision<br/>[router.py]"]
  node_extract["Extract job card<br/>[extract.py]"]
  node_evidence["Evidence checking<br/>[evidence.py]"]
  node_completeness["Completeness check<br/>[completeness.py]"]
  node_reply["Reply drafting<br/>[reply.py]"]
  node_guardrails["Reply guardrails<br/>[guardrails.py]"]
  node_brief["Estimator brief<br/>[brief.py]"]
end

subgraph group_support["Configuration and controls"]
  node_profiles["Business profiles"]
  node_schema["Structured schemas<br/>[schema.py]"]
  node_llm["Model gateway<br/>[llm.py]"]
end

subgraph group_experience["Demo and review"]
  node_batch["Batch runs<br/>[run_all.py]"]
  node_saved_runs["Saved demo runs<br/>[runs.json]"]
  node_demo["Static demo<br/>[app.js]"]
  node_decision_log["Browser decision log<br/>[runlog.js]"]
end

subgraph group_evaluation["Evaluation"]
  node_evaluator["Evaluation runner<br/>[eval.py]"]
  node_scoring["Result scoring<br/>[scoring.py]"]
end

node_rep(("Sales rep"))
node_anthropic["Anthropic API"]
node_langfuse["Langfuse tracing"]

node_rep -->|"provides"| node_enquiry
node_enquiry -->|"submits"| node_entry
node_entry -->|"runs"| node_pipeline
node_batch -->|"runs"| node_pipeline
node_pipeline -->|"classifies"| node_classify
node_pipeline -->|"routes"| node_router
node_pipeline -->|"extracts"| node_extract
node_pipeline -->|"checks evidence"| node_evidence
node_pipeline -->|"checks gaps"| node_completeness
node_pipeline -->|"drafts reply"| node_reply
node_pipeline -->|"screens reply"| node_guardrails
node_pipeline -->|"builds brief"| node_brief
node_classify -->|"requests model"| node_llm
node_extract -->|"requests model"| node_llm
node_reply -->|"requests model"| node_llm
node_llm -->|"calls API"| node_anthropic
node_llm -.->|"traces calls"| node_langfuse
node_classify -->|"returns classification"| node_schema
node_extract -->|"returns job card"| node_schema
node_reply -->|"returns draft"| node_schema
node_pipeline -->|"uses settings"| node_profiles
node_batch -->|"writes runs"| node_saved_runs
node_demo -->|"displays runs"| node_saved_runs
node_rep -->|"reviews and approves"| node_demo
node_demo -->|"records decisions"| node_decision_log
node_evaluator -->|"runs cases"| node_pipeline
node_evaluator -->|"scores results"| node_scoring

click node_enquiry "https://github.com/ratanasovann/quote-brief-copilot/tree/main/data/enquiries"
click node_entry "https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/run_one.py"
click node_pipeline "https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/pipeline.py"
click node_classify "https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/classify.py"
click node_router "https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/router.py"
click node_extract "https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/extract.py"
click node_evidence "https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/evidence.py"
click node_completeness "https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/completeness.py"
click node_reply "https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/reply.py"
click node_guardrails "https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/guardrails.py"
click node_brief "https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/brief.py"
click node_profiles "https://github.com/ratanasovann/quote-brief-copilot/tree/main/profiles"
click node_schema "https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/schema.py"
click node_llm "https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/llm.py"
click node_batch "https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/run_all.py"
click node_saved_runs "https://github.com/ratanasovann/quote-brief-copilot/blob/main/web/runs.json"
click node_demo "https://github.com/ratanasovann/quote-brief-copilot/blob/main/web/app.js"
click node_decision_log "https://github.com/ratanasovann/quote-brief-copilot/blob/main/web/runlog.js"
click node_evaluator "https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/eval.py"
click node_scoring "https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/scoring.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_enquiry,node_entry,node_pipeline,node_classify,node_router,node_extract,node_evidence,node_completeness,node_reply,node_guardrails,node_brief toneBlue
class node_profiles,node_schema,node_llm toneAmber
class node_batch,node_saved_runs,node_demo,node_decision_log,node_anthropic toneMint
class node_evaluator,node_scoring toneRose
class node_rep,node_langfuse toneIndigo
```

## Components

### Enquiry workflow

- [Enquiry text](https://github.com/ratanasovann/quote-brief-copilot/tree/main/data/enquiries): `data/enquiries`
- [Run entry points](https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/run_one.py): `src/run_one.py`
- [Enquiry pipeline](https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/pipeline.py): `src/pipeline.py`
- [Classify message](https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/classify.py): `src/classify.py`
- [Route decision](https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/router.py): `src/router.py`
- [Extract job card](https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/extract.py): `src/extract.py`
- [Evidence checking](https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/evidence.py): `src/evidence.py`
- [Completeness check](https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/completeness.py): `src/completeness.py`
- [Reply drafting](https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/reply.py): `src/reply.py`
- [Reply guardrails](https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/guardrails.py): `src/guardrails.py`
- [Estimator brief](https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/brief.py): `src/brief.py`

### Configuration and controls

- [Business profiles](https://github.com/ratanasovann/quote-brief-copilot/tree/main/profiles): `profiles`
- [Structured schemas](https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/schema.py): `src/schema.py`
- [Model gateway](https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/llm.py): `src/llm.py`

### Demo and review

- [Batch runs](https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/run_all.py): `src/run_all.py`
- [Saved demo runs](https://github.com/ratanasovann/quote-brief-copilot/blob/main/web/runs.json): `web/runs.json`
- [Static demo](https://github.com/ratanasovann/quote-brief-copilot/blob/main/web/app.js): `web/app.js`
- [Browser decision log](https://github.com/ratanasovann/quote-brief-copilot/blob/main/web/runlog.js): `web/runlog.js`

### Evaluation

- [Evaluation runner](https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/eval.py): `src/eval.py`
- [Result scoring](https://github.com/ratanasovann/quote-brief-copilot/blob/main/src/scoring.py): `src/scoring.py`

### Other components

- **Sales rep**
- **Anthropic API**
- **Langfuse tracing**

## Connections

- Sales rep → Enquiry text: provides (evidence: `README.md`)
- Enquiry text → Run entry points: submits (evidence: `README.md`)
- Run entry points → Enquiry pipeline: runs (evidence: `src/run_one.py`)
- Batch runs → Enquiry pipeline: runs (evidence: `src/run_all.py`)
- Enquiry pipeline → Classify message: classifies (evidence: `src/pipeline.py`)
- Enquiry pipeline → Route decision: routes (evidence: `src/pipeline.py`)
- Enquiry pipeline → Extract job card: extracts (evidence: `src/pipeline.py`)
- Enquiry pipeline → Evidence checking: checks evidence (evidence: `src/pipeline.py`)
- Enquiry pipeline → Completeness check: checks gaps (evidence: `src/pipeline.py`)
- Enquiry pipeline → Reply drafting: drafts reply (evidence: `src/pipeline.py`)
- Enquiry pipeline → Reply guardrails: screens reply (evidence: `src/pipeline.py`)
- Enquiry pipeline → Estimator brief: builds brief (evidence: `src/pipeline.py`)
- Classify message → Model gateway: requests model (evidence: `src/classify.py`)
- Extract job card → Model gateway: requests model (evidence: `src/extract.py`)
- Reply drafting → Model gateway: requests model (evidence: `src/reply.py`)
- Model gateway → Anthropic API: calls API (evidence: `src/llm.py`)
- Model gateway → Langfuse tracing: traces calls (evidence: `src/llm.py`)
- Classify message → Structured schemas: returns classification (evidence: `src/classify.py`)
- Extract job card → Structured schemas: returns job card (evidence: `src/extract.py`)
- Reply drafting → Structured schemas: returns draft (evidence: `src/reply.py`)
- Enquiry pipeline → Business profiles: uses settings (evidence: `README.md`)
- Batch runs → Saved demo runs: writes runs (evidence: `src/run_all.py`)
- Static demo → Saved demo runs: displays runs (evidence: `README.md`)
- Sales rep → Static demo: reviews and approves (evidence: `README.md`)
- Static demo → Browser decision log: records decisions (evidence: `README.md`)
- Evaluation runner → Enquiry pipeline: runs cases (evidence: `src/eval.py`)
- Evaluation runner → Result scoring: scores results (evidence: `src/eval.py`)
