learntodriveai.dev/Web Development/State Architecture and Project Memory
Web DevelopmentProject 096 units

State Architecture and Project Memory

Kham PhouthoneFounder and Managing Director · Eco-tourism boat company · Luang Prabang, Laos
Voice memo · from Kham
The system gets confused when things change. And the information the guides see on their screens is sometimes different from what the office sees.
Chat with Kham

What you hand back

  • A booking system that keeps both route lists in sync
  • A capacity check that blocks overbooking
  • Cache headers and a time-to-availability metric
  • A read-only guide view for phones
  • A village host notification path
  • Project memory files and a handover brief

6 units

  1. Unit 1: The Booking System

    Read Kham's voice memo, question him, and reproduce the stale booking list while the database shows the truth.

    Open unit 1
  2. Unit 2: State Architecture

    Design shared booking state, refetch both affected trips after a change, and add a database-level capacity check.

    Open unit 2
  3. Unit 3: Data Fetching and Performance

    Add cache headers by how fast the data ages, build the guide phone view, and define a custom speed metric.

    Open unit 3
  4. Unit 4: Writing Project Memory

    Write CLAUDE.md and AGENTS.md from the project's real constraints, then test them with a new API route.

    Open unit 4
  5. Unit 5: Context Briefs

    Write a context brief for the village host notification build and compare a briefed session with an unbriefed one.

    Open unit 5
  6. Unit 6: Ship It

    Verify the whole system, write a handover brief and client summary for Kham, then write the README and push.

    Open unit 6
Read the full brief

You're fixing a booking system for a river eco-tourism company in Luang Prabang, Laos — diagnosing stale data from broken state architecture, then building your first project memory file.

The discipline skills: client-side vs server-side state management, cache invalidation strategy, diagnosing stale data bugs where the database is correct but the page lies, and authoring CLAUDE.md and AGENTS.md as session-start infrastructure.

The AI-direction lesson: you move from using AI tools to configuring them. Last project had a pre-built CLAUDE.md — you saw how it changed AI's output from the first prompt. This project, there's no memory file. You notice the gap. Then you write one yourself. The difference between using someone else's infrastructure and building your own is the difference between benefiting from it and understanding what makes it work. Specific, testable constraints produce specific, verifiable output. Vague entries produce vague compliance. The memory file you write becomes infrastructure that shapes every future session.

Your Role

You fix a booking system that mostly works but disagrees with itself. The database updates correctly when bookings change. The pages keep showing the old data — the client-side cache doesn't know anything changed.

After fixing the state architecture, you build your first project memory file — writing down the stack, the patterns, and the constraints in a form that Claude reads at session start.

What's New

Last time you added CI/CD and connected AI to a database for a Singapore VFX studio. You worked with a codebase you didn't write, built infrastructure around existing code.

Two things change.

You fix broken state, not broken process. The CI/CD pipeline was about automating quality checks. This is different. The code runs. The database is correct. But the page lies. Finding why the page lies when the database tells the truth — that's the new terrain.

You build AI infrastructure yourself. Last project had a pre-built CLAUDE.md. You experienced how it changed AI's output from the first prompt. This project, there's no memory file. You notice the gap. Then you write one yourself. The difference between using someone else's infrastructure and building your own is the difference between benefiting from it and understanding why it works. AI dependence is a documented career hazard — developers who always accept AI's defaults lose the ability to evaluate them. Building your own infrastructure, rather than relying on what's handed to you, is how you maintain agency.

Tools

  • Next.js, React, TypeScript, PostgreSQL, Prisma — continuing.
  • PostgreSQL MCP server — continuing from P8. AI reads the database directly.
  • CLAUDE.md / AGENTS.md — project memory files. New — you author these yourself.
  • VS Code + Claude Code — continuing.
  • Git + GitHub — continuing.

Materials

  • Existing booking system — a Next.js + PostgreSQL application with the state management bug. Functional but unreliable when bookings change.
  • Voice memo transcript from Kham — first-contact.md, the written transcript of how the project starts. He tells you the problem through a story about a couple from Melbourne.
  • Backlog notes — Kham's own list of the pieces of work he needs done, kept as a reference; the units below sequence them.
  • CLAUDE.md example — claude-md-example.md, a well-structured project memory file from a different project (a clothing e-commerce platform), for structure only.
  • AGENTS.md reference — a brief guide to the cross-platform project memory standard.
Materials · 29 files
Start Project 9

You work at a computer with a terminal. Signed in, your place is saved.