Maintain your memory
Full Lesson Reference
Memory grows. After 30 sessions, 100 sessions, 500 sessions you'll have a substantial archive. A 5-minute monthly audit keeps it useful instead of noisy.
What "maintaining" actually means
- Remove stale rules that no longer reflect how you work
- Merge duplicate rules that have accumulated over time
- Archive old session summaries for projects you're no longer working on
- Keep the projects table clean - one active record per real project
- Review what Claude is learning about you and correct misreadings
Monthly audit - 5 minutes
Once a month, open Claude Code and tell it
Audit my memory layer. For each
-
global_rules - group by category. Show me any duplicates or rules that contradict each other. Flag rules that haven't been referenced in the last 3 months as potentially stale.
-
projects - list every project. Flag ones that haven't had activity in 3+ months as candidates for archiving.
-
session_memories - show me the total count and the oldest + newest session. Don't delete anything, just report.
Give me a short summary with specific action items.
Claude scans your Supabase tables, pattern-matches, and produces a prioritised list. Approve or reject each suggestion - Claude handles the updates.
When a rule goes wrong
Over time you'll notice Claude following a rule you don't remember setting, or applying a preference that's no longer right. This is your rule system drifting.
Fix it directly
I want to change how you handle [X]. Update the relevant rule in my global_rules table to say [new behaviour]. Show me the rule before and after.
Claude finds the rule, shows you the current + proposed content, applies the change on your approval.
Archiving old projects
When a project is done - client offboarded, campaign ended, one-off task finished - archive rather than delete:
Mark project [project-key] as archived. Keep the record but add an "archived_at" note. Don't delete any session memories associated with it. Archived projects stop showing up in /startup suggestions but stay searchable if you ever need them. Most people never delete anything - disk is cheap, searchability is valuable.
Searching past sessions
The real power of memory is full-text search across everything you've ever done.
Common queries
When did we first discuss [topic]? Search my sessions for anything mentioning [client name]. What decisions have I made about [X] across all projects? Show me the last 5 sessions on [project]. Find the session where we figured out [specific thing].
Claude runs a search across the session_memories table and returns matching summaries. Turns your memory into a searchable journal of everything you've built.
Semantic search (if pgvector is enabled)
The schema includes a vector column for embedding-based search. This lets you search by meaning, not just keywords:
Search my memory for sessions where I was struggling with something similar to [description]. Don't need exact word matches - find semantically related sessions.
Useful when you can't remember the exact words you used - just the feeling or shape of what you did.
Pre-flight state check
Before a big session (running a complex workflow for the first time, working with a new client), do a pre-flight:
Show me the current state of my memory layer. For [project-key]: what's the context, what's pending, any recent rules I've set? For global_rules: anything I've flagged in the last 2 weeks? 30-second sanity check to make sure you're starting from the right baseline.
Back up your memory
Supabase handles backups for you on their end, but you can also export a local copy:
Export my memory layer to a local backup file. Save it to my Claude Code folder as memory-backup-[date].json. Include all 3 tables.
Useful before major schema changes or if you want a cold archive.
Action items
☐ Add a monthly reminder to audit your memory layer
☐ Run your first audit now - tell Claude to scan all 3 tables
☐ Practice asking Claude to search past sessions
☐ Know how to update a rule when your preferences change
☐ Archive (don't delete) projects as they finish
Module complete. Next: Module 05 - How Claude Code actually works under the hood.
Exercises
- Review the concepts covered in this lesson: Maintain your memory.
- Write down your key takeaway from this lesson.
- Practice running any commands or prompts mentioned above inside your terminal.