# skarif1617-ops/shadowfox architecture

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

- Interactive diagram: https://gitdiagram.com/skarif1617-ops/shadowfox
- Repository: https://github.com/skarif1617-ops/shadowfox

## Overview

This is a Streamlit student study utility. A student selects one of four tasks, enters text, and submits it; the app validates the input, builds a task-specific prompt, streams a Groq model response, and displays the result or an error. The runtime evidence is concentrated in app.py; the four prompt behaviors are documented in the README and implemented as branches of build_prompt().

Main entry points: [`app.py`](https://github.com/skarif1617-ops/shadowfox/blob/main/app.py) (Request handler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Student interface"]
  node_ui["Task and text UI<br/>[app.py]"]
  node_result["Streaming result display<br/>[app.py]"]
  node_errors["Warnings and errors<br/>[app.py]"]
end

subgraph group_workflow["Request workflow"]
  node_workflow["Request handler<br/>[app.py]"]
  node_validation["Input validation<br/>[app.py]"]
  node_prompt["Task prompt builder<br/>[app.py]"]
  node_summary["Note summary prompt<br/>[app.py]"]
  node_quiz["Quiz prompt<br/>[app.py]"]
  node_answer["Answer improvement prompt<br/>[app.py]"]
  node_concept["Concept explanation prompt<br/>[app.py]"]
end

subgraph group_inference["AI inference"]
  node_stream["Response streamer<br/>[app.py]"]
end

node_student(("Student"))
node_groq{{"Groq Chat API"}}

node_student -->|"enters task and text"| node_ui
node_ui -->|"submits"| node_workflow
node_workflow -->|"validates"| node_validation
node_workflow -->|"builds prompt"| node_prompt
node_prompt -->|"selects for summary"| node_summary
node_prompt -->|"selects for quiz"| node_quiz
node_prompt -->|"selects for improvement"| node_answer
node_prompt -->|"selects for explanation"| node_concept
node_workflow -->|"requests generation"| node_stream
node_stream -->|"streams completion request"| node_groq
node_stream -->|"yields chunks"| node_result
node_workflow -->|"shows failures"| node_errors
node_workflow -->|"shows validation warning"| node_ui

click node_ui "https://github.com/skarif1617-ops/shadowfox/blob/main/app.py"
click node_workflow "https://github.com/skarif1617-ops/shadowfox/blob/main/app.py"
click node_validation "https://github.com/skarif1617-ops/shadowfox/blob/main/app.py"
click node_prompt "https://github.com/skarif1617-ops/shadowfox/blob/main/app.py"
click node_summary "https://github.com/skarif1617-ops/shadowfox/blob/main/app.py"
click node_quiz "https://github.com/skarif1617-ops/shadowfox/blob/main/app.py"
click node_answer "https://github.com/skarif1617-ops/shadowfox/blob/main/app.py"
click node_concept "https://github.com/skarif1617-ops/shadowfox/blob/main/app.py"
click node_stream "https://github.com/skarif1617-ops/shadowfox/blob/main/app.py"
click node_result "https://github.com/skarif1617-ops/shadowfox/blob/main/app.py"
click node_errors "https://github.com/skarif1617-ops/shadowfox/blob/main/app.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_ui,node_result,node_errors toneBlue
class node_workflow,node_validation,node_prompt,node_summary,node_quiz,node_answer,node_concept toneAmber
class node_stream,node_groq toneMint
class node_student toneIndigo
```

## Components

### Student interface

- [Task and text UI](https://github.com/skarif1617-ops/shadowfox/blob/main/app.py): `app.py`
- [Streaming result display](https://github.com/skarif1617-ops/shadowfox/blob/main/app.py): `app.py`
- [Warnings and errors](https://github.com/skarif1617-ops/shadowfox/blob/main/app.py): `app.py`

### Request workflow

- [Request handler](https://github.com/skarif1617-ops/shadowfox/blob/main/app.py): `app.py`
- [Input validation](https://github.com/skarif1617-ops/shadowfox/blob/main/app.py): `app.py`
- [Task prompt builder](https://github.com/skarif1617-ops/shadowfox/blob/main/app.py): `app.py`
- [Note summary prompt](https://github.com/skarif1617-ops/shadowfox/blob/main/app.py): `app.py`
- [Quiz prompt](https://github.com/skarif1617-ops/shadowfox/blob/main/app.py): `app.py`
- [Answer improvement prompt](https://github.com/skarif1617-ops/shadowfox/blob/main/app.py): `app.py`
- [Concept explanation prompt](https://github.com/skarif1617-ops/shadowfox/blob/main/app.py): `app.py`

### AI inference

- [Response streamer](https://github.com/skarif1617-ops/shadowfox/blob/main/app.py): `app.py`

### Other components

- **Student**
- **Groq Chat API**

## Connections

- Student → Task and text UI: enters task and text
- Task and text UI → Request handler: submits
- Request handler → Input validation: validates
- Request handler → Task prompt builder: builds prompt
- Task prompt builder → Note summary prompt: selects for summary
- Task prompt builder → Quiz prompt: selects for quiz
- Task prompt builder → Answer improvement prompt: selects for improvement
- Task prompt builder → Concept explanation prompt: selects for explanation
- Request handler → Response streamer: requests generation
- Response streamer → Groq Chat API: streams completion request
- Response streamer → Streaming result display: yields chunks
- Request handler → Warnings and errors: shows failures
- Request handler → Task and text UI: shows validation warning
