Open Brain - Supabase Table Structure

This is the "blueprints" for your database. If you ever accidentally delete the table or want to start a fresh "Open Brain" on a different Supabase project, you just need to run this code in the Supabase SQL Editor.

I’ve designed this schema to be "Future-Proof"—it includes a metadata column so Claude can store things like "priority level" or "category" without you having to change the table structure later.

The "Open Brain" SQL Schema

SQL

-- 1. Create the table
CREATE TABLE IF NOT EXISTS open_brain_memories (
id SERIAL PRIMARY KEY,
content TEXT NOT NULL,
metadata JSONB DEFAULT '{}'::jsonb,
category TEXT DEFAULT 'general',
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);
 
-- 2. Add an index for speed (optional but recommended as your brain grows)
CREATE INDEX IF NOT EXISTS idx_memories_content ON open_brain_memories USING GIN (to_tsvector('english', content));
 
-- 3. Add a trigger to automatically update the 'updated_at' timestamp
CREATE OR REPLACE FUNCTION update_modified_column()
RETURNS TRIGGER AS $$
BEGIN
NEW.updated_at = now();
RETURN NEW;
END;
$$ language 'plpgsql';
 
CREATE TRIGGER update_memories_modtime
BEFORE UPDATE ON open_brain_memories
FOR EACH ROW
EXECUTE PROCEDURE update_modified_column();

What each part does:

  • content: This is where the actual text lives (e.g., "Flexigive uses Stripe Connect").

  • metadata: This is a "flexible" column. Claude can store extra data here (like { "importance": "high" }) in a format that doesn't break the table.

  • category: Helps Claude filter between "Personal," "Flexigive," or "Technical Stack."

  • updated_at Trigger: This is a pro-move. It ensures that every time Claude updates a memory, the timestamp changes automatically. This helps Claude know which information is the "newest."


How to verify your data right now:

If you want to see exactly what is currently inside your brain, run this in your Supabase SQL Editor:

SQL

SELECT * FROM open_brain_memories ORDER BY updated_at DESC;

The "Final Setup" Checklist

  1. Config File: Saved on your Mac.

  2. Engine: Installed in ~/mcp-servers/postgres.

  3. Preferences: Pasted into Claude Settings.

  4. Schema: Active in Supabase.