ai/from-scratch

Set up your workbench

Fifteen minutes, once. After this, every lab drops a file into the same repo, and everything you need is on these pages.

  1. Step 1

    Python 3.10 or newer

    Every lab is Python. Check your version. A laptop CPU is enough for the whole path; no GPU needed.

    terminal
    python3 --version
  2. Step 2

    Make the Pocket repo

    Pocket is the project you grow across every stage. Each stage gets its own folder, and one virtual environment serves them all. Run every lab from the pocket/ folder, as python stageN/file.py. Commit after every lab so you can always go back to working code.

    terminal
    mkdir -p pocket/notes && cd pocket
    git init
    mkdir stage0 stage1 stage2 stage3 stage4 stage5 stage6 stage7 stage8 stage9 stage10 stage11
    python3 -m venv .venv
    source .venv/bin/activate        # Windows: .venv\Scripts\activate
    pip install numpy
    echo ".venv/" > .gitignore
  3. Step 3

    Give Pocket something to read: the sample notes

    Every lab runs on the same 22 sample notes (about 54 KB) kept by a fictional developer, Sam: decision records and an outage postmortem for a side project, meeting notes, reading logs, a trip plan, a recipe. Every lab states its expected output against these notes, and the evaluation labs already contain questions with known answers. Save the script into pocket/ and run it. Nothing is downloaded from the internet: the notes are inside the script.

    terminal
    python make_sample_notes.py
    # Wrote 22 notes to .../pocket/notes
    The files it writes

    streakly-stack-decisions.md streakly-db-migration.md streakly-outage-postmortem.md streakly-roadmap.md streakly-user-feedback.md weekly-2025-09-01.md weekly-2025-11-17.md weekly-2026-02-23.md onboarding-checklist.md reading-log-ml-basics.md reading-log-transformers-and-rag.md reading-log-agents-and-evals.md book-notes-thinking-in-systems.md book-notes-habits.md lisbon-trip-plan.md running-log.md sourdough-recipe.md home-network.md interview-prep.md cli-snippets.md shared-snippets-from-forum.md year-review-2025.md

    Later you can add your own notes next to them. Keep out anything you would not paste into a public chat: stage 4 onward sends note text to a model API.

  4. Step 4

    An API key, but not yet

    Stages 1 to 3 run fully offline. Stage 4 is the first to call a hosted model. When you get there, create a key in your provider's console and keep it in an environment variable, never in code or in git.

    terminal
    export ANTHROPIC_API_KEY="..."   # add to your shell profile, not to the repo

How to use this path

  • One lesson per sitting. Read the recap and the idea, follow the worked example, work the coached steps, then build the lab before the quiz.
  • New to the math? Start at stage 0. Comfortable with it? Take the placement check, or skip straight to any stage. Every lesson re-teaches what it builds on.
  • Stuck on a lab? Each one has a full solution and its expected output. Compare line by line rather than pasting.
  • Type the starter code yourself rather than pasting it. The slowness is where the understanding comes from.
  • When a lab output does not match the check, stop and find out why. That gap is the lesson.
Go to your path