DEV Community

brian austin
brian austin

Posted on

Claude Code memory bank: never lose context between sessions

Claude Code memory bank: never lose context between sessions

One of the most frustrating Claude Code experiences: you build up perfect context over a 2-hour session, then close the terminal. Next day, you start fresh and spend 30 minutes re-explaining the codebase.

The memory bank pattern fixes this permanently.

What is a memory bank?

A structured set of markdown files that Claude reads at the start of every session. Instead of re-explaining, you write once and reference forever.

your-project/
├── CLAUDE.md              # Entry point - Claude reads this first
├── memory/
│   ├── architecture.md    # System design decisions
│   ├── decisions.md       # Why things are built the way they are
│   ├── progress.md        # What's done, what's in progress
│   ├── patterns.md        # Code conventions and patterns
│   └── blockers.md        # Known issues and workarounds
Enter fullscreen mode Exit fullscreen mode

Setting it up

Create your CLAUDE.md entry point:

# Project: MyApp

## Memory Bank
Read these files at session start:
- memory/architecture.md - system design
- memory/decisions.md - architectural decisions  
- memory/progress.md - current status
- memory/patterns.md - code conventions
- memory/blockers.md - known issues

## Quick Context
- Stack: Node.js + PostgreSQL + React
- Deploy: PM2 on Ubuntu VPS
- Testing: Jest + Supertest
- Current sprint: user authentication
Enter fullscreen mode Exit fullscreen mode

Then tell Claude at session start:

Read CLAUDE.md and all files in the memory/ directory. 
Then summarize what we're working on.
Enter fullscreen mode Exit fullscreen mode

Claude will read everything and give you a crisp summary. You're back in context in 30 seconds instead of 30 minutes.

The update loop

The key is keeping the memory bank current. Add this to your session workflow:

At the end of every session:
- Update memory/progress.md with what we completed
- Add any new patterns to memory/patterns.md
- Document any decisions made in memory/decisions.md
- Note any blockers in memory/blockers.md
Enter fullscreen mode Exit fullscreen mode

You can even automate this with a Claude Code hook:

# .claude/hooks/post-session.sh
#!/bin/bash
# Run after every Claude Code session
claude -p "Update memory/progress.md with what we accomplished this session. Keep it under 200 words."
Enter fullscreen mode Exit fullscreen mode

What goes in each file

architecture.md

# Architecture

## Services
- API: Express on port 4000 (PM2 managed)
- Frontend: React SPA served from /public
- DB: PostgreSQL on localhost:5432

## Data flow
User → React → /api/* → Express → PostgreSQL

## Key decisions
- JWT auth (not sessions) - stateless for scaling
- Soft deletes everywhere - never hard delete user data
- All dates stored as UTC
Enter fullscreen mode Exit fullscreen mode

decisions.md

# Architectural Decisions

## 2026-01-15: Switched from MySQL to PostgreSQL
Reason: needed JSONB for flexible metadata storage
Impact: all queries now use pg library, not mysql2

## 2026-02-03: Removed Redis caching layer
Reason: premature optimization, added complexity
Impact: direct DB queries everywhere, simpler code
Enter fullscreen mode Exit fullscreen mode

progress.md

# Progress

## Done
- [x] User registration + email verification
- [x] JWT login/logout
- [x] Stripe subscription billing

## In Progress
- [ ] Password reset flow (50% done - email sends, reset form not built)

## Next
- [ ] Admin dashboard
- [ ] Usage analytics
Enter fullscreen mode Exit fullscreen mode

The rate limit problem

Long sessions with heavy context are exactly when Claude Code hits rate limits. Your memory bank helps by keeping sessions shorter — you don't need marathon sessions when context loads instantly.

But rate limits still hit mid-session on complex tasks. The fastest fix:

export ANTHROPIC_BASE_URL=https://api.simplylouie.com
Enter fullscreen mode Exit fullscreen mode

SimplyLouie removes the rate limit ceiling for $2/month — built specifically for Claude Code heavy users who hit the wall mid-task.

Template to copy

Here's a starter memory bank you can drop into any project:

mkdir -p memory

cat > CLAUDE.md << 'EOF'
# Project Memory Bank

Read at session start:
- memory/architecture.md
- memory/decisions.md  
- memory/progress.md
- memory/patterns.md

## Stack
[YOUR STACK HERE]

## Current focus
[WHAT YOU'RE BUILDING]
EOF

cat > memory/architecture.md << 'EOF'
# Architecture
[DESCRIBE YOUR SYSTEM]
EOF

cat > memory/progress.md << 'EOF'
# Progress
## Done
## In Progress
## Next
EOF

cat > memory/patterns.md << 'EOF'
# Patterns
[CODE CONVENTIONS]
EOF

echo "Memory bank created. Edit the files and run: claude 'Read CLAUDE.md and memory/ directory'"
Enter fullscreen mode Exit fullscreen mode

Result

With a memory bank:

  • Session startup: 30 seconds (not 30 minutes)
  • Context quality: consistent across every session
  • Onboarding new Claude sessions: instant
  • Rate limit recovery: start new session with full context immediately

The investment is 20 minutes to set up. The return is hours saved over weeks of development.


Hit rate limits before the memory bank even loads? SimplyLouie — $2/month, no rate ceiling, set with one env var.

Top comments (0)