# meenanoolu/firststep architecture

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

- Interactive diagram: https://gitdiagram.com/meenanoolu/firststep
- Repository: https://github.com/meenanoolu/firststep

## Overview

FirstStep is a coding-practice tutor: a learner chooses a problem, describes a concrete first move, submits code, and receives a minimized failing input and explanation rather than a full solution. The API coordinates problem access, first-step judging, execution, feedback, and session completion; supporting branches provide reviews, failure profiles, hints, and paid unlocks. Source evidence is limited to the supplied excerpts and SOURCE INDEX; documented but unsampled relationships cite the README.

Main entry points: [`app/main.py`](https://github.com/meenanoolu/firststep/blob/main/app/main.py) (Practice API), [`app/llm.py`](https://github.com/meenanoolu/firststep/blob/main/app/llm.py) (LLM adapter), [`app/problems/__init__.py`](https://github.com/meenanoolu/firststep/blob/main/app/problems/__init__.py) (Problem catalog), [`app/counterexample.py`](https://github.com/meenanoolu/firststep/blob/main/app/counterexample.py) (Counterexample finder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_practice["Practice workflow"]
  node_api["Practice API<br/>[main.py]"]
  node_web["Practice page<br/>[index.html]"]
  node_firststep["First-step gate<br/>[firststep.py]"]
  node_catalog["Problem catalog<br/>[__init__.py]"]
  node_problem["Problem definitions<br/>[base.py]"]
  node_freebank["Free problems<br/>[bank.py]"]
  node_problems["Pro problem pack<br/>[pro_pack.py]"]
  node_runner["Code runner<br/>[runner.py]"]
end

subgraph group_feedback["Learning feedback"]
  node_finder["Counterexample finder<br/>[counterexample.py]"]
  node_hints["Hint service<br/>[hints.py]"]
  node_leakcheck["Hint leak check<br/>[leakcheck.py]"]
  node_failure["Failure profiles<br/>[metrics.py]"]
end

subgraph group_state["Sessions and access"]
  node_sessions[("Session store<br/>[store.py]")]
  node_reviews["Review scheduling<br/>[scheduler.py]"]
  node_pro["Paid access<br/>[pro.py]"]
end

subgraph group_models["Model integrations"]
  node_classifier["LLM adapter<br/>[llm.py]"]
  node_modelservice["Model provider"]
  node_observability["Model observability<br/>[observability.py]"]
end

node_learner(("Learner"))

node_learner -->|"uses"| node_web
node_web -->|"requests practice"| node_api
node_api -->|"judges step"| node_firststep
node_api -->|"classifies step"| node_classifier
node_firststep -->|"requests classification"| node_classifier
node_classifier -.->|"calls provider"| node_modelservice
node_classifier -->|"records spans"| node_observability
node_api -->|"serves problems"| node_catalog
node_catalog -->|"registers"| node_freebank
node_catalog -->|"registers"| node_problems
node_freebank -->|"defines"| node_problem
node_problems -->|"defines"| node_problem
node_api -->|"executes submission"| node_runner
node_api -->|"finds failure"| node_finder
node_finder -->|"runs candidate"| node_runner
node_finder -->|"checks and shrinks"| node_problem
node_api -->|"serves hints"| node_hints
node_hints -->|"filters hints"| node_leakcheck
node_api -->|"profiles failures"| node_failure
node_api -->|"reads and writes"| node_sessions
node_failure -->|"reads profile data"| node_sessions
node_api -->|"schedules reviews"| node_reviews
node_api -->|"checks unlocks"| node_pro
node_pro -->|"stores unlocks"| node_sessions

click node_api "https://github.com/meenanoolu/firststep/blob/main/app/main.py"
click node_web "https://github.com/meenanoolu/firststep/blob/main/app/static/index.html"
click node_firststep "https://github.com/meenanoolu/firststep/blob/main/app/firststep.py"
click node_catalog "https://github.com/meenanoolu/firststep/blob/main/app/problems/__init__.py"
click node_problem "https://github.com/meenanoolu/firststep/blob/main/app/problems/base.py"
click node_freebank "https://github.com/meenanoolu/firststep/blob/main/app/problems/bank.py"
click node_problems "https://github.com/meenanoolu/firststep/blob/main/app/problems/pro_pack.py"
click node_runner "https://github.com/meenanoolu/firststep/blob/main/app/runner.py"
click node_finder "https://github.com/meenanoolu/firststep/blob/main/app/counterexample.py"
click node_hints "https://github.com/meenanoolu/firststep/blob/main/app/hints.py"
click node_leakcheck "https://github.com/meenanoolu/firststep/blob/main/app/leakcheck.py"
click node_failure "https://github.com/meenanoolu/firststep/blob/main/app/metrics.py"
click node_sessions "https://github.com/meenanoolu/firststep/blob/main/app/store.py"
click node_reviews "https://github.com/meenanoolu/firststep/blob/main/app/scheduler.py"
click node_pro "https://github.com/meenanoolu/firststep/blob/main/app/pro.py"
click node_classifier "https://github.com/meenanoolu/firststep/blob/main/app/llm.py"
click node_observability "https://github.com/meenanoolu/firststep/blob/main/app/observability.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_api,node_web,node_firststep,node_catalog,node_problem,node_freebank,node_problems,node_runner toneBlue
class node_finder,node_hints,node_leakcheck,node_failure toneAmber
class node_sessions,node_reviews,node_pro toneMint
class node_classifier,node_modelservice,node_observability toneRose
class node_learner toneIndigo
```

## Components

### Practice workflow

- [Practice API](https://github.com/meenanoolu/firststep/blob/main/app/main.py): `app/main.py`
- [Practice page](https://github.com/meenanoolu/firststep/blob/main/app/static/index.html): `app/static/index.html`
- [First-step gate](https://github.com/meenanoolu/firststep/blob/main/app/firststep.py): `app/firststep.py`
- [Problem catalog](https://github.com/meenanoolu/firststep/blob/main/app/problems/__init__.py): `app/problems/__init__.py`
- [Problem definitions](https://github.com/meenanoolu/firststep/blob/main/app/problems/base.py): `app/problems/base.py`
- [Free problems](https://github.com/meenanoolu/firststep/blob/main/app/problems/bank.py): `app/problems/bank.py`
- [Pro problem pack](https://github.com/meenanoolu/firststep/blob/main/app/problems/pro_pack.py): `app/problems/pro_pack.py`
- [Code runner](https://github.com/meenanoolu/firststep/blob/main/app/runner.py): `app/runner.py`

### Learning feedback

- [Counterexample finder](https://github.com/meenanoolu/firststep/blob/main/app/counterexample.py): `app/counterexample.py`
- [Hint service](https://github.com/meenanoolu/firststep/blob/main/app/hints.py): `app/hints.py`
- [Hint leak check](https://github.com/meenanoolu/firststep/blob/main/app/leakcheck.py): `app/leakcheck.py`
- [Failure profiles](https://github.com/meenanoolu/firststep/blob/main/app/metrics.py): `app/metrics.py`

### Sessions and access

- [Session store](https://github.com/meenanoolu/firststep/blob/main/app/store.py): `app/store.py`
- [Review scheduling](https://github.com/meenanoolu/firststep/blob/main/app/scheduler.py): `app/scheduler.py`
- [Paid access](https://github.com/meenanoolu/firststep/blob/main/app/pro.py): `app/pro.py`

### Model integrations

- [LLM adapter](https://github.com/meenanoolu/firststep/blob/main/app/llm.py): `app/llm.py`
- **Model provider**
- [Model observability](https://github.com/meenanoolu/firststep/blob/main/app/observability.py): `app/observability.py`

### Other components

- **Learner**

## Connections

- Learner → Practice page: uses (evidence: `README.md`)
- Practice page → Practice API: requests practice (evidence: `README.md`)
- Practice API → First-step gate: judges step (evidence: `app/main.py`)
- Practice API → LLM adapter: classifies step (evidence: `app/main.py`)
- First-step gate → LLM adapter: requests classification (evidence: `README.md`)
- LLM adapter → Model provider: calls provider (evidence: `app/llm.py`)
- LLM adapter → Model observability: records spans (evidence: `app/llm.py`)
- Practice API → Problem catalog: serves problems (evidence: `app/main.py`)
- Problem catalog → Free problems: registers (evidence: `app/problems/__init__.py`)
- Problem catalog → Pro problem pack: registers (evidence: `app/problems/__init__.py`)
- Free problems → Problem definitions: defines (evidence: `app/problems/bank.py`)
- Pro problem pack → Problem definitions: defines (evidence: `app/problems/pro_pack.py`)
- Practice API → Code runner: executes submission (evidence: `README.md`)
- Practice API → Counterexample finder: finds failure (evidence: `app/main.py`)
- Counterexample finder → Code runner: runs candidate (evidence: `app/counterexample.py`)
- Counterexample finder → Problem definitions: checks and shrinks (evidence: `app/counterexample.py`)
- Practice API → Hint service: serves hints (evidence: `app/main.py`)
- Hint service → Hint leak check: filters hints (evidence: `app/hints.py`)
- Practice API → Failure profiles: profiles failures (evidence: `README.md`)
- Practice API → Session store: reads and writes (evidence: `app/main.py`)
- Failure profiles → Session store: reads profile data (evidence: `app/metrics.py`)
- Practice API → Review scheduling: schedules reviews (evidence: `app/main.py`)
- Practice API → Paid access: checks unlocks (evidence: `app/main.py`)
- Paid access → Session store: stores unlocks (evidence: `app/pro.py`)
