Every AI Project Fails the Same Way (Here’s the Fix)

How to Set Up Every AI Project to Win
Beginner’s Guide · AI Project Setup · 12 min read
Most AI projects fail not because the model is bad — but because it forgets everything between sessions. Here’s the system that fixes it: structured markdown files, the Karpathy wiki pattern, and five principles that keep any agent permanently up to date.
Works with Claude Code, Cursor, Windsurf, and GitHub Copilot.
🔴 The problem: your AI agent has no memory
You open Cursor or Claude Code. You explain your stack. You describe your goals. You get to work. An hour later, you close it. Tomorrow you open it again — and it has no idea who you are, what you’re building, or what happened yesterday.
This is the default state. And it’s the reason most people feel like AI tools are impressive in demos but frustrating in real projects. The model isn’t the problem. The setup is.
The core insight: An AI agent isn’t a person who remembers — it’s a very smart reader. Give it the right documents to read at the start of every session, and it will behave as if it knows everything it needs to know.
This guide shows you the exact file structure, principles, and workflow to make that happen — using nothing more than plain markdown files in your project folder.
🧠 The foundation: Karpathy’s LLM Wiki pattern
“Something I’m finding very useful recently: using LLMs to build personal knowledge bases for various topics of research interest. A large fraction of my recent token throughput is going less into manipulating code, and more into manipulating knowledge.”
— Andrej Karpathy, April 2026 (16M+ views)
Andrej Karpathy — co-founder of OpenAI and the person behind Tesla Autopilot’s neural net stack — published a GitHub gist in April 2026 that went viral almost immediately. The idea was almost embarrassingly simple: stop using AI as a search engine and start using it as a librarian.
Instead of a vector database, embeddings pipeline, or RAG system, the pattern uses three layers of plain markdown files. The LLM reads them directly — no infrastructure required. It’s reportedly up to 70x more efficient than RAG for personal-scale knowledge bases.
The three layers
raw/
wiki/
CLAUDE.md
The analogy is compilation. You don’t run source code every time — you compile it into an optimised artifact. Raw files are your source. The wiki is your compiled output. The LLM is your compiler.
💎 Five principles for any AI project
These principles come from building the AI Agent Orchestration Playbook — a production system for running Claude Code agents across real projects. They apply whether you’re building a solo side project or a multi-agent pipeline.
1 → Single source of truth
Each piece of information lives in exactly one file. If your stack is described in
CLAUDE.mdREADME.md2 → Write for zero memory
Every document must be understandable by an agent starting cold — no prior context, no chat history. If you’d need to explain something verbally, write it in a file instead. Assume the agent has never seen your project before.
3 → Standup is sacred
The daily standup file (
standup.md4 → Templates, not dogma
Delete sections you don’t need. Add sections your project needs. The structure serves you — not the other way around. Start minimal and add files as genuine complexity emerges. Don’t set up a 20-file system for a weekend project.
5 → Product drives architecture drives plan
This is the information hierarchy. Define what you’re building first. Then how. Then when. Never let technical decisions drive your product vision. An agent given good product context makes better technical decisions automatically.
🗂 The exact folder structure to use
Drop this into any project. Claude Code, Cursor, Windsurf — they all read the same markdown. The key files are in
docs/CLAUDE.mdCODEyour-project/ ├── CLAUDE.md ← Agent reads this first. Always. ├── docs/ │ ├── product.md ← What are we building? For who? │ ├── architecture.md ← Stack, services, decisions │ ├── plan.md ← Sequenced work items │ ├── standup.md ← Yesterday / Today / Blocked │ └── decisions.md ← Why we chose X over Y └── .claude/ ├── skills/ ← Reusable agent skill files ├── agents/ ← Sub-agent definitions └── commands/ ← Slash command shortcuts
What each file does:
| File | Purpose |
|---|---|
CODE | Master context. Project name, stack, key decisions, what to read, how to behave. |
CODE | Updated every session. Yesterday’s progress, today’s plan, any blockers. |
CODE | The why. User personas, goals, non-goals, success metrics. |
CODE | Stack, services, folder structure, naming conventions, environment setup. |
CODE | ADR log. “We chose Supabase over Firebase because…” Prevents the agent from re-opening closed decisions. |
CODE | Task-specific instruction files. Load the relevant skill when you need it — like a plugin. |
🔧 What goes in CLAUDE.md
This is the file that makes everything work. It’s the first thing any AI agent reads when it opens your project. It gives the agent its operating context — what the project is, how it’s structured, what the current state is, and how it should behave.
Here’s a minimal starter template you can copy and edit:
markdown# Project: My App ## What We're Building A task management tool for freelancers. Single user, web-first. Goal: reduce admin overhead by 50% through smart automation. ## Stack - React + TypeScript + Next.js (App Router) - Supabase (auth, database, storage) - Tailwind CSS - Deployed via Vercel ## Read These First 1. docs/standup.md — current session context 2. docs/plan.md — active work items 3. docs/product.md — user and goal context ## Agent Behaviour - Check standup.md before any work - Update standup.md after completing work - Write for zero memory — explain reasoning in comments - Log any significant architectural decisions in decisions.md
⚡ Claude Code tip: Use
to auto-generate a starting CLAUDE.md from your codebase. Then edit it to add what the auto-scan misses — your goals, constraints, and current state.CODE/init
⬆️ The standup file: your agent’s short-term memory
Of all the files in the system, the standup file does the most work per line. It’s updated at the end of every session and read at the start of the next. It’s the answer to “what’s happening right now” — the thing your agent needs most.
markdown## Session: 2026-05-19 ### 🟢 Completed - Set up Supabase auth with email + Google OAuth - Built task creation form (validation passing) - Fixed mobile layout bug on dashboard ### 🔵 Next - Wire task list to real Supabase query (currently mock data) - Add optimistic UI updates on task completion ### 🔴 Blocked - Stripe webhook setup waiting on account verification ### 🧠 Notes for next agent - useTaskStore (Zustand) has a known race condition on rapid clicks - Don't touch the RLS policies until Stripe is connected
Keep the last 3–5 sessions in the file. Older entries can be archived to a
standup-archive.md⚙️ The workflow: using this with your IDE or Claude Code
The beauty of this system is its simplicity. Any AI coding tool can read markdown files. They don’t need a plugin. They just need the right files to read.
01 → Set up your folder structure Create the
docs/02 → Start every session with context Open your project and say: “Read CLAUDE.md and docs/standup.md before we start.” In Claude Code this happens automatically — it reads CLAUDE.md on launch. In Cursor, add it as a rule or just ask directly.
03 → Work normally The agent now has full context. It knows your stack, your goals, and where you left off. Treat it like a team member who read the briefing docs before the meeting.
04 → End every session with a standup update Before you close the IDE, ask: “Update standup.md with what we completed, what’s next, and any notes for the next session.” One prompt. Thirty seconds. The habit that makes everything else work.
05 → Let the agent maintain the docs As your project grows, ask the agent to keep
docs/🔥 Claude Code power move: Create
andCODE.claude/commands/start-session.mdas slash commands that automate the standup read and write. TypeCODE.claude/commands/end-session.mdand the agent loads full context automatically.CODE/start-session
🛠 Supercharge it with MCP servers
Once your markdown system is in place, you can extend your agent’s capabilities by connecting it to external services via MCP (Model Context Protocol) servers. Think of these as power tools the agent can reach for when it needs them.
| MCP Server | What it does | When to add it |
|---|---|---|
| GitHub | PR management, issues, code review | As soon as you’re on a real project |
| Context7 | Live library docs (no hallucinated APIs) | Any project with external packages |
| Sequential Thinking | Forces the agent to plan before acting | Complex multi-step tasks |
| Supabase | Direct database management from Claude Code | Any Supabase-backed project |
| Sentry | Error tracking and log analysis | Once you’re in production |
Installing in Claude Code:
bash# Context7 — live library docs claude mcp add context7 -- npx -y @upstash/context7-mcp@latest # GitHub — issues, PRs, code review claude mcp add --transport http github https://api.githubcopilot.com/mcp/
🔥 The system in one page
If you take nothing else from this article, take these four things:
🔧 CLAUDE.md — One file at the root. Your project’s operating manual. Stack, goals, behaviour rules, and what to read first. Every agent session starts here.
⬆️ standup.md — Updated at the end of every session. Yesterday, today, blocked. The agent’s short-term memory. Never skip this — it’s the glue that holds everything together.
🧠 The Karpathy pattern —
raw/wiki/CLAUDE.md💎 Product → Architecture → Plan — This is the order. Define what before how. Define how before when. An agent given good product context makes better technical decisions automatically.
The real unlock: When you treat your AI agent as a reader, not a genie, everything changes. You stop asking it to remember and start giving it things to read. Markdown files are persistent. LLM context windows aren’t. Store knowledge in files. That’s the whole system.
Based on the AI Agent Orchestration Playbook and Andrej Karpathy’s LLM Wiki pattern (April 2026).