How I Shipped 3 Production SaaS Backends in 30 Days Using Claude Code (Without Context Loss Destroying Everything)
Source: Dev.to
I’ve been using Claude Code for the last 4 months to build SaaS back‑ends. Love it. Until I don’t.
You know the pattern.
| Day | What Happens |
|---|---|
| 1 | Claude writes beautiful auth logic. You’re impressed. |
| 3 | You ask it to add Stripe webhooks. |
| 5 | Auth is broken. No idea what changed. |
| 7 | Context window full → start a new session. |
| 8 | “Wait, what database schema are we using again?” |
Every. Single. Time.
I end up spending more time re‑explaining my project than actually building it. The “brilliant colleague with amnesia” metaphor is painfully accurate.
The Context‑Loss Problem
Mid‑session drift
Claude starts with async/await, then randomly switches to .then() chains 200 lines later. Why? Context degradation – the model “forgets” earlier patterns as the conversation grows.
Schema amnesia
I define a users table with specific columns in message 5. By message 40 Claude is suggesting queries for columns that don’t exist.
Security regression
Row‑level‑security policies carefully set up in Phase 1 are completely ignored when adding features in Phase 3.
The Groundhog‑Day effect
Close laptop Friday → open Monday → spend 30 minutes re‑explaining the entire project before Claude can write a single line.
What I Tried (and Failed)
- Longer prompts with full context – hit token limits; quality degraded anyway.
- Custom instructions – too vague, didn’t persist across sessions.
- Separate chats for each feature – lost the big picture, broke dependencies.
- Manual “memory dumps” – exhausting and error‑prone.
The fundamental issue: LLMs have working memory, not long‑term memory. They’re brilliant in the moment, terrible at maintaining state.
What Actually Fixed It: Multi‑Agent Orchestration
The problem isn’t the AI; it’s the workflow. Human developers don’t keep entire codebases in their heads either. We use:
- Documentation
- Design docs
- Database schemas
- API specs
- External references that persist.
I built a system that orchestrates Claude through specialized agents, each with a fresh context window and a specific job.
The Four Files That Maintain State
| File | Purpose |
|---|---|
| PROJECT.md | Vision document – problem being solved, target users & workflows, core value proposition, success criteria. |
| REQUIREMENTS.md | Traceable feature definitions – unique IDs (e.g., AUTH-01, PAY-02), v1 scope, v2 scope, out‑of‑scope, acceptance criteria. |
| ROADMAP.md | Phased execution plan – Phase 0 (infra), Phase 1 (core), Phase 2 (supporting), Phase 3 (polish); each requirement mapped to a phase. |
| STATE.md | Living memory – completed phases (locked), current phase (modifiable), exact DB DDL, API routes (paths, methods, business logic), architectural decisions. |
Each file is sized to avoid context degradation (under 10 k tokens) and serves as a single source of truth for both humans and AI.
The Multi‑Agent System
Research agents (run in parallel before coding)
- Stack researcher – finds the best technologies for your domain.
- Features researcher – distinguishes table‑stakes from differentiators.
- Architecture researcher – proposes system design patterns.
- Pitfalls researcher – lists common mistakes to avoid.
Execution agents
| Agent | Role |
|---|---|
| Planner | Creates verified task plans. |
| Executor | Runs plans with atomic commits. |
| Verifier | Tests and auto‑debugs. |
| Mapper | Analyzes the existing codebase. |
Each agent gets a fresh context – no degradation, no drift.
The Workflow Cycle
1. INITIALIZE
• Describe vision → AI creates PROJECT.md, REQUIREMENTS.md, ROADMAP.md
2. DISCUSS (each phase)
• Shape implementation preferences before committing
3. PLAN
• Research domain patterns → create verified execution plan
4. EXECUTE
• Run plans in parallel waves with fresh contexts → atomic git commits
5. VERIFY
• User acceptance testing with automatic debugging
Repeat steps 2‑5 for each phase.
Critical rule: Completed phases are locked. The AI can only modify code in the current phase, eliminating the “adding payments breaks auth” problem entirely.
Boilerplate‑Aware Intelligence
The AI knows what’s already built in the boilerplate (auth, Stripe, Razorpay, Supabase, multi‑tenancy, emails, admin panel). It only plans what’s custom to your domain, which means:
- Zero time wiring auth to the database
- Zero time setting up payment webhooks
- Zero time building admin panels
- Pure focus on your unique business logic
The Results (Why I’m Sharing This)
| Project | Time Spent | Highlights | Early Traction |
|---|---|---|---|
| Analytics Dashboard | 13 h (4 sessions) | Custom analytics schema, ingestion API with validation, time‑series calculations, CSV export with date filtering | 8 paying users → $96 / month |
| Feedback Widget | 11 h (3 sessions) | Feedback schema with metadata, widget embedding API (iframe + script), admin CRUD with filtering, email notifications, webhook system for integrations | 5 sign‑ups in first week |
| Content Calendar | 9 h (2 sessions) | Content schema with scheduling, CRUD API with role‑based access, publishing logic with timezone handling, calendar‑view backend | En route to production |
All production‑ready, all built with AI orchestration, all using persistent state across weeks.
Commands That Run It
/propelkit:new-project
This master command:
- Prompts Claude to generate the four state‑files (
PROJECT.md,REQUIREMENTS.md,ROADMAP.md,STATE.md). - Spins up the research and execution agents.
- Locks completed phases automatically.
- Provides a CLI for iterating through the workflow cycle.
Feel free to adapt the approach to your own LLM‑driven development workflow.
Deep Questions About Your Project
- Spawns research agents for your domain
- Creates PROJECT.md, REQUIREMENTS.md, ROADMAP.md
- Generates a phased execution plan
- Hands you off to phase‑by‑phase building
Then for each phase
/propelkit:discuss-phase 1 # Shape your preferences
/propelkit:plan-phase 1 # Research + create execution plan
/propelkit:execute-phase 1 # Build with parallel agents
/propelkit:verify-work # Test with auto‑debugging
Enter fullscreen mode
Exit fullscreen mode
The system maintains STATE.md automatically. Close your laptop, come back days later, and resume exactly where you left off.
PropelKit – The Packaged System
What you get
Production Next.js boilerplate (saves 100+ hours):
- Auth (email, OAuth, sessions)
- Stripe + Razorpay payments
- Supabase (PostgreSQL with RLS)
- Multi‑tenancy (organizations, teams, roles)
- Credits system (usage‑based billing)
- Email templates (8 pre‑built)
- Admin panel (user management, analytics)
- 26 AI PM commands
Stack: Next.js 16, TypeScript, Supabase, Stripe, Razorpay
One‑time purchase. You own the code. Build unlimited products.
The AI PM uses the exact multi‑agent orchestration system described above: persistent state, parallel research, boilerplate‑aware, atomic commits.
Demo
(watch the AI questioning, research, roadmap generation, and execution)
Why This Approach Works
- Context engineering – Separate files stay under degradation thresholds, not one massive chat.
- Multi‑agent orchestration – Fresh contexts per agent, no drift accumulation.
- Boilerplate awareness – AI knows what exists, only builds what’s custom.
- Atomic commits – One feature per commit, precision rollback.
- Phase locking – Completed code stays completed, no random rewrites.
- Domain research – AI understands your industry before writing code.
These principles work anywhere—you just need persistent state files and fresh context windows per task.
What’s your experience with AI code context loss? Have you found other systems that work?