Learning Objectives
- Understand how Claude manages context across sessions
- Use memory strategically to improve automation quality
- Avoid context overflow in complex workflows
π― What You'll Learn: How Claude remembers information within sessions, across projects, and globally
β±οΈ Time Required: 35 minutes
π¦ What You'll Build: A memory strategy document for your automation project
Riley's Journey Continues
Riley's coordinated workflow is running smoothly. But she noticed something puzzling.
π¬ "I asked Claude to draft a margin call summary, and it kept calling 'Initial Margin' calls 'collateral deposits', and once it referred to a 'Breach' as a 'flag'. Those aren't interchangeable in regulatory reports. My compliance team was confused. Then I realised - Claude doesn't know our specific terminology. Every conversation, I was re-explaining things. That's when I knew I needed to understand memory."
β Riley Harper
Where Riley is now:
By the end of this lesson:
What We're Building in This Lesson
Claude's memory works like a combination of a notebook (session), a company wiki (project), and personal preferences (global). Knowing which to use when makes Claude dramatically more helpful.
In this lesson:
Key Concept: The Three Types of Memory
Overview
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CLAUDE'S MEMORY β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββ β
β β SESSION MEMORY β β PROJECT MEMORY β β GLOBAL β β
β β β β β β MEMORY β β
β β Current chat β β CLAUDE.md file β β β β
β β Resets on /clearβ β Per-folder β β~/.claude/ β β
β β β β Auto-loaded β βCLAUDE.md β β
β β "What we just β β "Company wiki" β β "Personal β β
β β talked about" β β β β preferences"β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββ β
β β² β² β² β
β β β β β
β Temporary Persistent Universal β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Type 1: Session Memory
What it is: Everything discussed in the current conversation.
Persists: Until you run /clear or start a new session.
Think of it as: Notes from a meeting - useful during the meeting, gone after.
| Included | NOT Included |
|---|---|
| Everything you've said | Previous sessions |
| Claude's responses | Other projects |
| Files you've shared | Anything before /clear |
| Decisions made this session |
Riley's Example:
π¬ "In one session, I told Claude that Meridian Capital is our highest-exposure counterparty. It remembered that for the whole conversation. But after /clear, I had to tell it again. Session memory is like a whiteboard that gets erased."
When session memory helps:
When session memory hurts:
Type 2: Project Memory (CLAUDE.md)
What it is: A markdown file that Claude reads at the start of every session in that folder.
Persists: Forever (until you change it)
Location: CLAUDE.md in your project root or .claude/CLAUDE.md
Think of it as: Company wiki or employee handbook - always available, always consistent.
| Good for CLAUDE.md | Bad for CLAUDE.md |
|---|---|
| Company terminology | Today's specific task |
| Standard processes | Temporary decisions |
| Team conventions | Personal preferences |
| Domain knowledge | One-time instructions |
Riley's Example:
# Margin Operations Context
## Team Information
- Firm: Mid-sized financial services firm
- Team: Derivatives Clearing Risk, Operations
- Scope: Margin reporting across equity and fixed income positions
- Reporting to: Head of Risk Operations (Marcus Webb)
## Margin Call Status (Use THESE exact terms)
- "Open" = margin call issued, awaiting counterparty payment
- "Disputed" = counterparty contests the call amount
- "Settled" = payment received and confirmed
- "Failed" = settlement deadline missed β escalation required
NOTE: Do NOT use "outstanding", "pending", "completed", or "overdue".
These terms have specific regulatory meanings in clearing confirmations.
## Position Risk Status (Use THESE exact terms)
- "Watch" = approaching exposure limits, monitoring required
- "Restricted" = new positions blocked pending review
- "Breached" = exposure limits exceeded β same-day escalation to Marcus Webb
NOTE: Do NOT use "flagged", "at-risk", or "warning" as substitutes.
Each status triggers different compliance actions.
## Key Metric Abbreviations
- "IM" = Initial Margin (NOT "collateral deposit" or "margin deposit")
- "VM" = Variation Margin (NOT "daily settlement" or "MTM payment")
- "Net Exposure" = counterparty exposure after netting agreements applied
Why this matters:
π¬ "After I added the status terminology to CLAUDE.md, Claude never mixed up 'Breach' and 'flag' again. In a regulated environment, that's not just tidiness, it's accuracy the compliance team depends on. Project memory is like onboarding a new employee once and never having to repeat it."
Type 3: Global Memory (Global CLAUDE.md)
What it is: A CLAUDE.md file placed in your home ~/.claude/ folder, it loads in every project, every session.
Persists: Forever (until you change it)
Location: ~/.claude/CLAUDE.md
Think of it as: Personal preferences, how you like to work, regardless of which project you're in.
| Good for Global | Bad for Global |
|---|---|
| Preferred communication style | Project-specific terms |
| How you like output formatted | Domain knowledge |
| Your name and role context | Company processes |
| Output preferences | Team conventions |
Example Global CLAUDE.md:
# My Global Preferences
## Communication Style
- Concise responses β bullet points over paragraphs
- Use tables when comparing options
- Flag anything that looks like a data inconsistency
## About Me
- My role: Operations Director
- I work in financial services β use professional language
- Prefer UK English spelling
π‘ This file is separate from your project CLAUDE.md. Think of it as your personal assistant preferences, they follow you everywhere. Your project CLAUDE.md holds domain knowledge specific to that folder.
Memory Comparison Table
| Aspect | Session | Project (CLAUDE.md) | Global (Settings) |
|---|---|---|---|
| Scope | This conversation | This folder | All projects |
| Duration | Until /clear | Forever | Forever |
| Content | Conversation history | Domain knowledge | Preferences |
| Location | In memory | CLAUDE.md file | ~/.claude/CLAUDE.md |
| Use for | Current task context | Company/project info | Personal style |
Exercise: Create Your Memory Strategy
β±οΈ Total Time: 35 minutes
What You'll Build
π A memory strategy document that maps what goes where for YOUR automation project.
Step 1: Audit Your Repeated Instructions
β±οΈ Time: 10 minutes
What you're doing:
Identifying what you keep telling Claude over and over.
Instructions:
Think about your last several Claude sessions. What did you have to explain multiple times?
Categories to consider:
| Category | Examples |
|---|---|
| Terminology | Product names, internal terms, acronyms |
| Processes | How you do things, company standards |
| People | Key contacts, reporting structure |
| Preferences | How you like output formatted |
| Domain knowledge | Industry context, regulations |
Riley's Audit:
## Things I Keep Re-Explaining
### Terminology (Almost every session)
- Margin call status terms (Open/Disputed/Settled/Failed β NOT "outstanding", "pending", etc.)
- Position risk status (Watch/Restricted/Breached β NOT "flagged" or "at-risk")
- Key metric abbreviations (IM = Initial Margin, VM = Variation Margin)
- What "Net Exposure" means in our netting agreement context
### People & Structure (Often)
- Reporting to Head of Risk Operations (Marcus Webb)
- Which portfolio managers own which counterparty relationships
- My 2 direct reports (risk analysts)
### Processes (Sometimes)
- Monday report goes to Marcus Webb + Head of Derivatives Clearing
- IM variance threshold: >10% WoW requires explanation in report
- Breaches (Β£10M+ net exposure) require same-day escalation to Marcus
### Preferences (Every session)
- Concise bullet points, not paragraphs
- Tables for data comparison
- Flag anything over 10% variance
Your Audit:
## Things I Keep Re-Explaining
### Terminology
### People & Structure
### Processes
### Preferences
β Success Check:
Step 2: Map Information to Memory Types
β±οΈ Time: 10 minutes
What you're doing:
Deciding where each piece of information should live.
Decision Framework:
Is this specific to ONE project/folder?
YES β CLAUDE.md (Project Memory)
NO β Is this about MY personal preferences?
YES β Settings (Global Memory)
NO β Only needed for this task?
YES β Just say it (Session Memory)
NO β Probably CLAUDE.md
Riley's Mapping:
## Memory Mapping
### β CLAUDE.md (Project Memory)
- Margin and position terminology β
(Company-specific, regulatory impact)
- Risk status classifications β
(Domain knowledge)
- Team structure β
(Organisational context)
- Report process β
(Project-specific workflow)
- Threshold definitions β
(Business rules)
### β ~/.claude/CLAUDE.md (Global Memory)
- Prefer concise bullets β
(My style, all projects)
- Use tables for data β
(My preference)
### β Session Only
- Today's specific positions (changes daily)
- This week's priorities (temporary)
- Current conversation context (naturally accumulates)
Your Mapping:
## My Memory Mapping
### β CLAUDE.md (Project Memory)
-
-
-
### β ~/.claude/CLAUDE.md (Global Memory)
-
-
### β Session Only
-
-
β Success Check:
Step 3: Create Your Memory Strategy Document
β±οΈ Time: 15 minutes
What you're doing:
Documenting your strategy for future reference and team sharing.
Create the file:
touch .claude/MEMORY-STRATEGY.md
Riley's Memory Strategy:
# Riley's Claude Memory Strategy
## Overview
This document defines what information goes where to ensure
consistent, effective Claude interactions across my automation project.
---
## Project Memory (CLAUDE.md)
### What Goes Here
Information specific to her firm risk operations that should be
available in every session working on this project.
**Include:**
- Team and firm information (context, scope)
- Margin and position terminology (critical β regulatory impact)
- Risk status classifications and definitions
- Team structure and key contacts
- Standard processes and thresholds
- Report formats and recipients
**Don't Include:**
- Today's specific numbers (use session)
- My personal preferences (use global)
- Temporary decisions (use session)
### File Location
`/margin-automation/CLAUDE.md`
### Update Frequency
- Review monthly
- Update when terminology changes
- Add new terms as discovered
---
## Global Memory (~/.claude/CLAUDE.md)
### What Goes Here
My personal preferences that apply across ALL projects.
**Include:**
- Response style: concise
- Preferred formats: bullets, tables, markdown
- Your name, role, and working context
**Don't Include:**
- Project-specific terminology
- Company information
- Domain knowledge
### File Location
`~/.claude/CLAUDE.md` (your home folder, not a project folder)
### Update Frequency
- Rarely (when your preferences change)
---
## Session Memory
### What Goes Here
Context for the current task only.
**Include:**
- Today's specific data and positions
- Current task requirements
- Decisions made this session
- Iterative work in progress
**Management:**
- Use /clear when starting a fresh task (this discards the conversation)
- Use /compact when a session you're still working on slows down (this keeps your work but frees up room)
- Use /context to check how full the context window is, so you know when to compact or clear
- Keep sessions focused on one workflow
- Don't let conversations get too long (>50 exchanges)
---
## Quick Reference
| Info Type | Memory Type | Location |
|-----------|-------------|----------|
| Company terms | Project | CLAUDE.md |
| My response style | Global | ~/.claude/CLAUDE.md |
| Today's exposure snapshot | Session | Current chat |
| Position status terms | Project | CLAUDE.md |
| Prefer tables | Global | ~/.claude/CLAUDE.md |
| This week's priorities | Session | Current chat |
---
## Common Mistakes to Avoid
1. **Putting style preferences in a project CLAUDE.md**
- Wrong: "I like bullet points" in your project's CLAUDE.md
- Right: Put it in `~/.claude/CLAUDE.md` β global, applies everywhere
2. **Putting project info in your global CLAUDE.md**
- Wrong: Company-specific terminology in `~/.claude/CLAUDE.md`
- Right: Put it in the project's CLAUDE.md so it stays scoped
3. **Not using /clear**
- Symptom: Claude seems confused or slow
- Fix: Start fresh with /clear for new tasks
4. **CLAUDE.md too long**
- Symptom: Important info gets buried
- Fix: Keep under 200 lines, prioritize critical info
---
Created: [Date]
Last Updated: [Date]
Next Review: [Date + 1 month]
Your Memory Strategy:
Create your own strategy document using Riley's as a template.
β Success Check:
Overall Success Criteria
By the end of this lesson, you should:
Quick Test:
Pick 5 random things you tell Claude. Can you instantly identify which memory type each belongs to?
Troubleshooting
π€ "Claude keeps forgetting things I told it earlier in the session"
**Why this happens:** Very long conversations can cause earlier context to be deprioritized.
**Fix:**
- Keep sessions focused (one workflow per session)
- Use /clear and restart if conversation exceeds ~50 exchanges
- Put critical info in CLAUDE.md so it's always loaded
π "My CLAUDE.md doesn't seem to be working"
**Why this happens:** File location or naming issue.
**Fix checklist:**
- [ ] File is named exactly CLAUDE.md (case sensitive)
- [ ] File is in project root OR .claude/CLAUDE.md
- [ ] Content is valid markdown
- [ ] No syntax errors in the file
**Test:** Start new session and ask "What do you know about this project?"
β‘ "Sessions are getting slow"
**Why this happens:** Too much context accumulating.
**Fix:**
- Run /compact to summarise the conversation and free up room without losing your work (best when you're still mid-task)
- Use /clear for a clean slate when you're moving to a new task
- Keep CLAUDE.md focused (under 200 lines)
- Break long workflows into multiple sessions
- Use agents for isolated analysis (fresh context)
π "Information inconsistent between sessions"
**Why this happens:** Relying on session memory for persistent info.
**Fix:** If you need info in every session, it belongs in CLAUDE.md, not session memory.
You Did It!
You now understand how Claude's memory works!
What Riley accomplished:
π¬ "Once I understood the three memory types, everything made sense. No more repeating terminology every session. No more confusion about margin status terms. I put it in CLAUDE.md once, and Claude knows it forever. That's the power of understanding memory."
The transformation:
| Before | After |
|---|---|
| π Repeat company terms every session | π CLAUDE.md knows them permanently |
| π Claude forgets my preferences | βοΈ Settings apply everywhere |
| π Everything in one long conversation | π§Ή Clean sessions with /clear |
| π€· Not sure what Claude remembers | π Clear strategy for each type |
π‘ The pattern: Once you stop explaining the same context every session and start putting it in CLAUDE.md, the improvement in Claude's responses is immediate and permanent. The audit is the shortcut, just notice what you keep repeating.