The memory schema
Full Lesson Reference
A database needs a schema - a structure of tables and columns that defines what data goes where. Your memory layer needs 3 tables: projects, session_memories, and global_rules.
You won't write any SQL. Claude sets up the schema for you - one instruction, 30 seconds.
What each table holds
projects
One row per client, brand, or initiative you work on. Contains:
- project_key - short identifier (e.g. my-brand, client-acme)
- display_name - human-readable name
- context - overview of the project (what it is, who it's for)
- pending_items - list of open tasks to pick up next session
- rules - project-specific rules Claude should follow
- categories - sub-documents for different areas (google-ads, meta-ads, seo, etc.)
session_memories
One row per Claude Code session you complete. Contains
- session_date - when the session happened
- project_name - which project it was for
- project_key - the project identifier
- project_path - the path of the project on your computer
- summary - what you worked on
- actions_taken - list of things Claude did
- decisions_made - choices made during the session + reasoning
- rules_learned - new rules or preferences that emerged
- pending_items - what's left for next time
- data_discovered - new information learned after research
- problems_and_solutions - what issues came up and how were they solved
global_rules
Cross-project rules, feedback, and references. Contains
- rule_key - short identifier for the rule
- category - feedback / pattern / reference
- content - the actual rule text
Claude reads all of these at the start of every session - that's how it knows your preferences instantly.
Tell Claude to set up the schema
Open a terminal, start Claude, and tell it
Set up the memory layer schema in my Supabase project. Use the credentials in my .env file. Create three tables - projects, session_memories, global_rules - with the standard Claude Code memory structure (the fields covered above). Confirm each table was created successfully.
Claude connects to Supabase, writes the SQL, runs it, and confirms all 3 tables exist. You can verify in the Supabase dashboard > Table Editor.
Verify via Claude
To confirm the setup worked
Query my Supabase memory and tell me how many rows are in each table. All should be 0 since this is a fresh setup.
Claude queries each table and reports. Three zeros = ready to go.
Don't panic about the details
You'll never write SQL yourself. You'll never edit the schema by hand. Claude handles all of it. The tables exist, the schema is set, and everything Claude needs is in place.
If you ever get curious and want to look at the data, open the Supabase dashboard > Table Editor. You'll see your rows accumulate as you run sessions.
Action items
☐ Tell Claude to set up the memory schema in your Supabase project
☐ Verify all 3 tables exist (projects, session_memories, global_rules)
☐ Confirm all 3 are empty (fresh start)
Next lesson: Connect /startup and /wrapup to your memory.
Exercises
- Review the concepts covered in this lesson: The memory schema.
- Write down your key takeaway from this lesson.
- Practice running any commands or prompts mentioned above inside your terminal.