# What Is the Purpose of the `phases` Directory in AI Engineering from Scratch?

> Discover the purpose of the phases directory in AI engineering from scratch. This directory structures 20 learning modules, guiding you from setup to advanced AI projects.

- Repository: [Rohit Ghumare/ai-engineering-from-scratch](https://github.com/rohitg00/ai-engineering-from-scratch)
- Tags: internals
- Published: 2026-08-26

---

**The `phases` directory serves as the structural backbone of the curriculum, organizing twenty sequential learning modules that guide students from basic tooling setup through advanced capstone projects.**

The `phases` directory in the **rohitg00/ai-engineering-from-scratch** repository contains the complete modular curriculum, dividing complex AI engineering concepts into twenty numbered folders. This hierarchical structure allows learners to navigate the educational content systematically, with each phase building upon the knowledge established in previous sections. Understanding how this directory organizes lessons, code implementations, and documentation is critical for effectively using the repository's educational resources.

## Hierarchical Organization of the Phases Directory

The `phases` directory implements a strict numbered hierarchy that sequences the learning journey. According to the repository's main [`README.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/README.md) (lines 78-84), twenty numbered phase folders reside within this directory, ranging from `00-setup-and-tooling` through `19-capstone-projects`. Each phase folder groups coherent lessons that target specific domains of AI engineering, creating a logical progression from foundational concepts to advanced implementations.

For example, the sequence includes foundational phases like `01-math-foundations` and `07-transformers-deep-dive`, culminating in applied topics such as agent engineering and production-grade projects. This structure is visualized in the Mermaid flowchart present in the main README (lines 78-102), which depicts the curriculum as stacked phases representing the learning trajectory.

## Standard Lesson Structure Within Each Phase

Every phase directory contains lesson sub-folders following a consistent three-part layout. As documented in the README (lines 108-115), each lesson folder contains:

- **[`docs/en.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/docs/en.md)** – The narrative documentation explaining theoretical concepts
- **`code/`** – Runnable implementations available in Python, TypeScript, Rust, or Julia
- **`outputs/`** – The deliverable artifacts produced by the lesson, such as prompts, skills, agents, or MCP servers

This standardized structure appears across all phases, from `phases/00-setup-and-tooling/` through `phases/19-capstone-projects/`. The [`phases/00-setup-and-tooling/README.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/phases/00-setup-and-tooling/README.md) establishes the pattern that subsequent phases follow, ensuring learners can predict where to find specific resources regardless of their position in the curriculum.

## Curriculum Flow and Sequencing

The phases directory organizes content into a pedagogical progression that mirrors professional AI engineering workflows. The sequencing begins with **Phase 0** (setup and tooling), advances through mathematics and deep learning fundamentals, explores transformers and generative AI, and finally addresses LLM engineering and production deployment in the capstone phases.

This flow is intentionally designed to build competence incrementally. Early phases establish the mathematical foundations necessary for understanding later transformer architectures, while intermediate phases bridge theory and implementation before culminating in practical, production-ready projects. The Mermaid diagram in the repository's README explicitly visualizes this progression, making the curriculum's logical structure immediately apparent to newcomers.

## Programmatic Navigation of the Phases Directory

Developers and automated tooling can interact with the `phases` directory structure using standard filesystem operations. The consistent naming convention—`phases/<NN>-<phase-name>/<NN>-<lesson-name>/`—enables reliable path resolution and curriculum traversal.

To enumerate available phases programmatically:

```python
import pathlib

repo_root = pathlib.Path(__file__).parent.parent
phases = sorted(p.name for p in (repo_root / "phases").iterdir() if p.is_dir())
print("Available phases:", phases)

# → ['00-setup-and-tooling', '01-math-foundations', … '19-capstone-projects']

```

For command-line navigation to specific phase documentation:

```bash
less phases/07-transformers-deep-dive/README.md

```

TypeScript applications can resolve lesson entry points dynamically using the predictable directory structure:

```typescript
import path from "path";

function lessonMainPath(phase: string, lesson: string, lang: "python" | "typescript" | "rust" | "julia") {
  const ext = lang === "python" ? "py" : lang === "typescript" ? "ts" : lang;
  return path.join("phases", phase, lesson, "code", `main.${ext}`);
}

console.log(lessonMainPath("07-transformers-deep-dive", "02-self-attention-from-scratch", "python"));
// → phases/07-transformers-deep-dive/02-self-attention-from-scratch/code/main.py

```

## Key Files in the Phases Directory

Several critical files define the curriculum's architecture and provide entry points for learners:

- **[`phases/README.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/phases/README.md)** – Generated overview linking to all phase lessons and describing the curriculum structure
- **[`phases/00-setup-and-tooling/README.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/phases/00-setup-and-tooling/README.md)** – Template establishing documentation standards for subsequent phases
- **`phases/<NN>-<phase-name>/<NN>-<lesson-name>/docs/en.md`** – Individual lesson narratives explaining specific concepts
- **`phases/<NN>-<phase-name>/<NN>-<lesson-name>/code/`** – Language-specific implementations of lesson concepts
- **`phases/<NN>-<phase-name>/<NN>-<lesson-name>/outputs/`** – Shipped artifacts including prompts, skills, and MCP servers

These paths remain consistent across all twenty phases, enabling the `start-learning` skill and other automation tools to traverse the curriculum reliably.

## Summary

- The `phases` directory contains **twenty numbered folders** that structure the complete AI engineering curriculum from `00-setup-and-tooling` to `19-capstone-projects`.
- Each phase follows a **standardized three-part layout** with `docs/`, `code/`, and `outputs/` subdirectories, ensuring predictable resource location.
- The **sequential numbering** creates a pedagogical progression from mathematical foundations through transformers to production deployment.
- The **consistent path structure** enables programmatic navigation and integration with automation tools like the `start-learning` skill.
- Individual lesson narratives reside in [`docs/en.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/docs/en.md) while runnable implementations support **Python, TypeScript, Rust, and Julia**.

## Frequently Asked Questions

### How are the phases in the AI Engineering from Scratch repository numbered?

The twenty phases use zero-padded two-digit numbering from `00` through `19`, creating a lexicographically sortable sequence that progresses from `00-setup-and-tooling` (environment configuration) through foundational mathematics and deep learning, to `19-capstone-projects` (production deployment). This numbering scheme ensures that basic file listing commands display phases in the correct pedagogical order.

### What content exists inside individual phase folders?

Each phase folder contains numbered lesson sub-folders following the pattern `<NN>-<lesson-name>/`, where each lesson includes three components: [`docs/en.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/docs/en.md) containing the theoretical narrative, a `code/` directory with implementations in multiple programming languages, and an `outputs/` directory storing deliverable artifacts such as prompts, skills, agents, or MCP servers. This structure appears consistently across all phases from `00` through `19`.

### Can I jump directly to a specific lesson without completing previous phases?

While the curriculum builds sequentially, the modular directory structure allows direct access to any lesson via its explicit path: `phases/<phase-name>/<lesson-name>/`. The [`docs/en.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/docs/en.md) file within each lesson provides context-specific explanations, though the README recommends following the numbered sequence as visualized in the Mermaid diagram (lines 78-102 of the main README) for optimal learning outcomes.

### Which programming languages are supported in the phases directory code examples?

The `code/` directories within phase lessons contain implementations in **Python**, **TypeScript**, **Rust**, and **Julia**, allowing learners to study AI engineering concepts in their preferred language. The repository maintains parallel implementations across these languages, with entry points typically located at `phases/<NN>-<phase>/<NN>-<lesson>/code/main.<ext>` where the extension varies by language (`.py`, `.ts`, `.rs`, or `.jl`).