Design a Postgres Brain for Claude
Build a persistent knowledge base (a 'Postgres brain') that gives Claude permanent memory of your business context. Based on @angus.sewell's viral prompt: schema design, loading order, one sync per data source.
Design a persistent Postgres-backed knowledge base that gives Claude permanent memory of your business.
Design a Postgres Brain for Claude
Give Claude permanent memory by designing a structured knowledge base backed by PostgreSQL. Instead of re-explaining your business every session, Claude reads your "brain" and starts with full context.
The Prompt
Use this prompt in Claude Code or Cowork to have Claude design the schema for you:
// My tools:
[list your MCP connections]
// My business:
[describe what you do]
// My biggest gap:
[what context does your AI lose?]
--------------------------------------
Design my Postgres brain.
1. Schema (tables + columns)
2. Loading order
3. One sync per data source
// Start with clients.
// Ask me questions first.
How It Works
1. Schema Design
Claude designs a PostgreSQL schema tailored to your business. Typical tables:
- clients — name, industry, contact, notes, last interaction
- projects — status, deadlines, deliverables, client_id
- knowledge — topic, content, source, last_updated
- preferences — communication style, industry jargon, formatting rules
- history — past conversations, decisions, outcomes
2. Loading Order
Tables are loaded in dependency order so foreign keys resolve:
- Core entities (clients, team members)
- Relationships (projects, engagements)
- Knowledge (industry data, preferences)
- History (past interactions, decisions)
3. One Sync Per Data Source
Each external data source gets exactly one sync mechanism:
- CRM → clients table (daily sync)
- Project tool → projects table (hourly sync)
- Documents → knowledge table (on upload)
- Email → history table (weekly digest)
Why This Matters
- Claude starts every session with full business context
- No more "let me re-explain my business" prompts
- Decisions build on previous decisions
- Your AI gets smarter over time, not just faster
Getting Started
- Run the prompt above in Claude Code
- Let Claude ask you questions about your business
- Review the proposed schema
- Deploy to your Postgres instance
- Set up sync scripts for your data sources
Best Practices
- Start with the clients table — it's the foundation
- Keep tables narrow (10–15 columns max)
- Use text columns for flexibility, add constraints later
- Include
last_updatedon every table for sync tracking - Add a
sourcecolumn to track where data came from
Based on @angus.sewell's "Build my brain" Postgres prompt
- →Design a client knowledge base for a consulting firm
- →Build a project history brain for a design agency
- →Create a persistent context store for a trades business
Source
community
Author
Angus Sewell / Tech Horizon Labs
Version
1.0
Complexity
Compatible With
Prerequisites
- PostgreSQL database
- Basic understanding of database tables
- Claude Code or Cowork access
Best For
Tags
