Dev.to AI 🤖 Ai 👁 0 📖 2 min read

How I Built a Multi-AI Workspace with Persistent Memory & Tree Chats (Next.js + Supabase pgvector)

As a developer, my daily AI workflow used to look like a mess of open browser tabs. I was paying separately for ChatGPT, Claude, and Gemini—and worse, every time a conversation grew past a few thousand tokens, the model

As a developer, my daily AI workflow used to look like a mess of open browser tabs. I was paying separately for ChatGPT, Claude, and Gemini—and worse, every time a conversation grew past a few thousand tokens, the model would forget my project architecture, coding preferences, or earlier decisions.

I got tired of copy-pasting the same context over and over. So over the last few months, building solo from Sri Lanka 🇱🇰, I built BryDepth—an independent AI workspace designed around persistent long-term memory and non-linear tree chats.

Here is a breakdown of the architecture and the lessons I learned shipping it.

**## 1. The Core Problem: Linear Chats & Amnesia

****Traditional AI chat interfaces have two structural flaws for real engineering work:

  1. Context Amnesia: Once a session ends (or the context window fills up), your preferences and project rules vanish.
  2. Linear Pollution: If you want to test a quick edge-case or debug a side tangent, asking it in the main thread pollutes the context for everything that follows.

2. The Architecture Behind BryDepth

🧠 Living Memory Vault (Postgres + pgvector)

Instead of relying purely on massive context windows, I built a structured extraction pipeline on Supabase (PostgreSQL + pgvector):

  • 7 Structured Categories: Memories are automatically classified into technical preferences, active projects, architectural decisions, workflows, and goals.
  • Semantic Recall: When you send a prompt, BryDepth embeds the query and retrieves only the most relevant memory vectors via Row-Level Security (RLS) isolated queries.
  • User Sovereignty: Unlike black-box memory systems, users can inspect, edit, approve, or wipe any extracted memory inside the vault.

🌳 Tree Chats & Sub-Chats

Every message node in BryDepth is stored as a parent-child relational tree rather than a flat array.

  • You can fork any AI response into a dedicated sub-chat to explore an alternative implementation, debug an error, or brainstorm—and then return to your main branch with zero context pollution.

⚡ Multi-Model Routing & Workspace Copilot

Different tasks need different engines:

  • Gemini 2.5 Flash for ultra-fast iteration and large-context synthesis.
  • GPT-4o for general reasoning and structured outputs.
  • Claude 3.7 Sonnet for deep code refactoring and architectural planning.

BryDepth lets you switch models mid-workflow inside the same workspace without losing your memory state.

3. The Hardest Part Wasn't the Code

Honestly, building the pgvector pipeline and tree-state UI was the fun part. Getting global payments approved as a solo indie developer in Sri Lanka—after facing rejection after rejection from traditional merchant platforms—was the real boss fight.

After months of persistence and compliance iterations, I finally integrated Dodo Payments with a seamless dark-mode overlay checkout, allowing me to offer prepaid 30-day passes with zero sneaky auto-renewals.

Try It Out (14-Day Free Trial)

If you're tired of repeating yourself to AI or juggling multiple subscriptions, give BryDepth a spin:

  • 14-day universal free trial (no credit card required).
  • 30% Launch Discount for the next 30 days using code LAUNCH30 at checkout.

I’d love to hear feedback from fellow devs on the memory categorization and tree-chat UX. Drop your thoughts or questions below! 👇

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.