Every developer who uses AI coding assistants hits the same wall: you explain something once, and next conversation, it's forgotten. You correct a mistake, and three sessions later, the same mistake appears. It's like working with a brilliant colleague who has amnesia.
Today, I want to share a workflow I've been using with Claude Code that fundamentally changes this dynamic. Instead of repeating myself, I tell Claude to write down what it learns — and it actually sticks.
The Problem: Groundhog Day Development
Here's a real scenario from my codebase. I'm building a team-based access control feature in a .NET + React application. During our first session, Claude:
- Added comments to every file (I don't want comments)
- Created EF Core migrations (we use raw SQL scripts)
- Added unnecessary
usingstatements - Used pricing flags instead of feature flags
- Forgot to add database GRANT permissions for new tables
Every single one of these mistakes would repeat in the next conversation. I'd have to re-explain the same rules over and over.
The Solution: Two Persistence Mechanisms
Claude Code has two built-in mechanisms for persistent context that survive across conversations.
1. CLAUDE.md — Project Rules
CLAUDE.md sits in your project root and acts as a set of instructions Claude reads at the start of every conversation. Think of it as a .editorconfig for AI behavior.
Here's what mine looks like after a day of working together:
## Code Style Rules
- No comments in code. Code should be self-explanatory.
- No unnecessary usings. Every using must be actually needed.
## Database Rules
- Never create EF Core migrations. Always deliver raw PostgreSQL scripts.
- Always add GRANT SELECT, INSERT, UPDATE, DELETE for application-dev user.
The key insight: I didn't write these rules upfront. They emerged organically from corrections during our work session. When I said "stop adding comments," I followed up with "write that down so you remember next time." Claude added the rule to CLAUDE.md, and the behavior stopped — permanently.
2. Memory Files — Contextual Knowledge
The second mechanism is Claude's memory system — markdown files stored in .claude/projects/.../memory/. Unlike CLAUDE.md (which holds rules), memory files store contextual knowledge that helps Claude make better decisions.
For example, after I explained how feature flags work in our codebase (frontend hooks, backend services, sysadmin razor pages), I told Claude to save that knowledge. It created a reference file covering:
- Which hook to use for feature flags vs pricing flags
- Where the sysadmin flag editor lives
- The naming convention for flags
Next time Claude needs to add a feature flag, it won't use a pricing flag by mistake. It won't forget to add the checkbox in the sysadmin razor page. The knowledge is there, indexed and searchable.
If you'd rather have this whole setup broken into a few short, copy-paste steps in your inbox, I turned it into The Claude Code Memory Starter — a free email series.
The Workflow: Correct Once, Remember Forever
The pattern is simple:
- Claude makes a mistake (or you notice a pattern worth preserving)
- You correct it — "don't do X" or "always do Y"
- You tell Claude to save it — "write that down" or "remember this for next time"
- Claude persists it — either as a CLAUDE.md rule or a memory file
- Future conversations benefit — the rule or context is loaded automatically
This turns every correction into a permanent improvement. Your AI assistant gets smarter with every session — not through model updates, but through accumulated project-specific knowledge.
What Goes Where?
Not everything belongs in the same place:
CLAUDE.md is for actionable rules:
- Code style preferences
- Workflow constraints (no migrations, always run tests)
- Project-specific patterns to follow or avoid
Memory files are for contextual knowledge:
- How systems work (feature flags, auth, deployment)
- Project goals and motivations
- References to external resources
- Team member roles and responsibilities
Neither should contain things derivable from code (architecture, file paths) or git history (recent changes, who did what).
Real Impact
After one working session with this approach, my Claude Code setup knows:
- Never add comments to code
- Always provide raw SQL with GRANT statements for new database objects
- How feature flags work across three layers (frontend, backend, sysadmin)
- The full requirements spec for the feature we're building
- That
tms_accsis a feature flag, not a pricing flag
Tomorrow, when I start a new conversation to continue this feature, none of this context will be lost. I won't waste the first 10 minutes re-explaining constraints. Claude will just... know.
Getting Started
If you're using Claude Code, you can start right now:
- Create a
CLAUDE.mdin your project root - Next time you correct Claude, add: "and write that down so you remember"
- Watch as your AI assistant accumulates project knowledge over time
The best part? These files are just markdown. You can review them, edit them, commit them to your repo (CLAUDE.md), or keep them local (memory files). Your team members can benefit from the same rules, or each developer can have their own memory layer.
It's not about having a smarter model. It's about building a smarter working relationship — one correction at a time.
If you want the starter version of this to land in your inbox, The Claude Code Memory Starter walks you through it over a few short emails — free.
Top comments (0)