Skip to main content

    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.

    advanced
    Productivity
    1–2 hours initial setup
    Quick Start

    Design a persistent Postgres-backed knowledge base that gives Claude permanent memory of your business.

    Complete Guide

    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:

    1. Core entities (clients, team members)
    2. Relationships (projects, engagements)
    3. Knowledge (industry data, preferences)
    4. 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

    1. Run the prompt above in Claude Code
    2. Let Claude ask you questions about your business
    3. Review the proposed schema
    4. Deploy to your Postgres instance
    5. 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_updated on every table for sync tracking
    • Add a source column to track where data came from

    Based on @angus.sewell's "Build my brain" Postgres prompt

    Usage Examples
    • →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
    Skill Details

    Source

    community

    Author

    Angus Sewell / Tech Horizon Labs

    Version

    1.0

    Complexity

    Compatible With

    Claude code
    Claude cowork

    Prerequisites

    • PostgreSQL database
    • Basic understanding of database tables
    • Claude Code or Cowork access

    Best For

    professional services
    tech
    retail

    Tags

    claude
    postgres
    knowledge-base
    memory
    mcp
    advanced
    database
    Need Help?
    Learn more about using Claude Skills effectively