# borregs/secretariasisexp architecture

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

- Interactive diagram: https://gitdiagram.com/borregs/secretariasisexp
- Repository: https://github.com/borregs/secretariasisexp

## Overview

Secretaria Experta is an F# phone assistant whose main workflow begins with a caller reaching Twilio, continues through the `/api/voice` webhook and AI response generation, and returns speech through TwiML. The README also describes confidence-based follow-up and optional SMS, plus environment-based configuration. The tree identifies startup, telephony, AI, console, environment, and web-page files, but no source excerpts were provided; relationships below therefore rely on README statements, and internal call details remain unverified.

Main entry points: [`SecretariaSisExp/Telephony.fs`](https://github.com/borregs/secretariasisexp/blob/master/SecretariaSisExp/Telephony.fs) (Voice webhook), [`SecretariaSisExp/Program.fs`](https://github.com/borregs/secretariasisexp/blob/master/SecretariaSisExp/Program.fs) (App startup), [`SecretariaSisExp/AiBrain.fs`](https://github.com/borregs/secretariasisexp/blob/master/SecretariaSisExp/AiBrain.fs) (AI response engine), [`SecretariaSisExp/Env.fs`](https://github.com/borregs/secretariasisexp/blob/master/SecretariaSisExp/Env.fs) (Environment config)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["App runtime"]
  node_startup["App startup<br/>[Program.fs]"]
  node_env["Environment config<br/>[Env.fs]"]
end

subgraph group_voice["Voice interaction"]
  node_webhook["Voice webhook<br/>[Telephony.fs]"]
  node_twiml["TwiML response<br/>[Telephony.fs]"]
end

subgraph group_intelligence["AI and follow-up"]
  node_ai["AI response engine<br/>[AiBrain.fs]"]
  node_confidence["Follow-up confidence<br/>[AiBrain.fs]"]
  node_sms["SMS delivery<br/>[Telephony.fs]"]
end

subgraph group_interface["User interface"]
  node_console["Console UI<br/>[ConsoleUI.fs]"]
  node_web_page["Web page<br/>[index.html]"]
end

node_caller(("Phone caller"))
node_twilio["Twilio voice"]
node_sms_provider["SMS service"]

node_caller -->|"calls"| node_twilio
node_twilio -->|"posts speech"| node_webhook
node_startup -->|"registers route"| node_webhook
node_webhook -->|"requests response"| node_ai
node_ai -->|"returns answer"| node_webhook
node_webhook -->|"generates speech"| node_twiml
node_twiml -->|"returns TwiML"| node_twilio
node_twilio -->|"speaks answer"| node_caller
node_webhook -->|"assesses follow-up"| node_confidence
node_webhook -.->|"dispatches follow-up"| node_sms
node_sms -.->|"sends text"| node_sms_provider
node_env -->|"loads configuration"| node_startup

click node_startup "https://github.com/borregs/secretariasisexp/blob/master/SecretariaSisExp/Program.fs"
click node_env "https://github.com/borregs/secretariasisexp/blob/master/SecretariaSisExp/Env.fs"
click node_webhook "https://github.com/borregs/secretariasisexp/blob/master/SecretariaSisExp/Telephony.fs"
click node_twiml "https://github.com/borregs/secretariasisexp/blob/master/SecretariaSisExp/Telephony.fs"
click node_ai "https://github.com/borregs/secretariasisexp/blob/master/SecretariaSisExp/AiBrain.fs"
click node_confidence "https://github.com/borregs/secretariasisexp/blob/master/SecretariaSisExp/AiBrain.fs"
click node_sms "https://github.com/borregs/secretariasisexp/blob/master/SecretariaSisExp/Telephony.fs"
click node_console "https://github.com/borregs/secretariasisexp/blob/master/SecretariaSisExp/ConsoleUI.fs"
click node_web_page "https://github.com/borregs/secretariasisexp/blob/master/SecretariaSisExp/wwwroot/index.html"

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_startup,node_env toneBlue
class node_webhook,node_twiml toneAmber
class node_ai,node_confidence,node_sms toneMint
class node_console,node_web_page toneRose
class node_caller,node_twilio,node_sms_provider toneIndigo
```

## Components

### App runtime

- [App startup](https://github.com/borregs/secretariasisexp/blob/master/SecretariaSisExp/Program.fs): `SecretariaSisExp/Program.fs`
- [Environment config](https://github.com/borregs/secretariasisexp/blob/master/SecretariaSisExp/Env.fs): `SecretariaSisExp/Env.fs`

### Voice interaction

- [Voice webhook](https://github.com/borregs/secretariasisexp/blob/master/SecretariaSisExp/Telephony.fs): `SecretariaSisExp/Telephony.fs`
- [TwiML response](https://github.com/borregs/secretariasisexp/blob/master/SecretariaSisExp/Telephony.fs): `SecretariaSisExp/Telephony.fs`

### AI and follow-up

- [AI response engine](https://github.com/borregs/secretariasisexp/blob/master/SecretariaSisExp/AiBrain.fs): `SecretariaSisExp/AiBrain.fs`
- [Follow-up confidence](https://github.com/borregs/secretariasisexp/blob/master/SecretariaSisExp/AiBrain.fs): `SecretariaSisExp/AiBrain.fs`
- [SMS delivery](https://github.com/borregs/secretariasisexp/blob/master/SecretariaSisExp/Telephony.fs): `SecretariaSisExp/Telephony.fs`

### User interface

- [Console UI](https://github.com/borregs/secretariasisexp/blob/master/SecretariaSisExp/ConsoleUI.fs): `SecretariaSisExp/ConsoleUI.fs`
- [Web page](https://github.com/borregs/secretariasisexp/blob/master/SecretariaSisExp/wwwroot/index.html): `SecretariaSisExp/wwwroot/index.html`

### Other components

- **Phone caller**
- **Twilio voice**
- **SMS service**

## Connections

- Phone caller → Twilio voice: calls (evidence: `README.md`)
- Twilio voice → Voice webhook: posts speech (evidence: `README.md`)
- App startup → Voice webhook: registers route (evidence: `README.md`)
- Voice webhook → AI response engine: requests response (evidence: `README.md`)
- AI response engine → Voice webhook: returns answer (evidence: `README.md`)
- Voice webhook → TwiML response: generates speech (evidence: `README.md`)
- TwiML response → Twilio voice: returns TwiML (evidence: `README.md`)
- Twilio voice → Phone caller: speaks answer (evidence: `README.md`)
- Voice webhook → Follow-up confidence: assesses follow-up (evidence: `README.md`)
- Voice webhook → SMS delivery: dispatches follow-up (evidence: `README.md`)
- SMS delivery → SMS service: sends text (evidence: `README.md`)
- Environment config → App startup: loads configuration (evidence: `README.md`)
