🕊️ Introduction
Me and the Team Web5 decided to participate in Solana Hackathon 26 with the Floww project but upgrading it.

Along the way, we faced several challenges that requires our decision as a team to make this project qualified for a new challenge, which was Solana Hackathon 26.
One of them was to decide a way to improve policies and the code to have better plan for implementing persistent memory in PostgreSQL.
As a backend engineer I had to think about problems that it could cause and the solutions to prevent them from happening.

What is Persistent Memory? 🧠
Persistent Memory allows AI agents to store and retrieve past experiences, user preferences, and task outcomes across sessions.
Instead of treating every task as new, agents can use relevant historical information to make better decisions and avoid repeating previous mistakes.
For Floww, we can implement Persistent Memory using PostgreSQL to store structured experiences and execution histories, with pgvector added if semantic search becomes necessary.
Importantly, Persistent Memory supports AI decision-making but does not override user authorization or backend execution policies.
PostgreSQL and ERD
I’ve added persistent memory extension from our ERD to make sure the team gets the whole view on what I’m going to implement.

The green part depicts the AI memory/ agent extension part.
If you want to see the real document of the erd and the database specification, you might as well welcome to visit our workspace.
Semantic Search with pgvector
Semantic Search
Semantic Memory enables AI agents to store and retrieve long-term knowledge, including facts, concepts, and user preferences, rather than specific details of past events.
For example, an AI agent can remember that a user prioritizes translation quality and apply this preference when selecting translation services in the future.
In a Persistent Memory system, this knowledge can be stored in PostgreSQL, with pgvector enabling semantic similarity searches when needed.
The key idea is not just remembering what happened, but retaining what was learned from past experiences.
pgvector
pgvector is a PostgreSQL extension that enables the storage and similarity search of vector embeddings directly within a relational database.
Unlike traditional keyword-based searches, pgvector allows AI agents to retrieve information based on semantic similarity, even when different words or phrases are used.
In a Persistent Memory system, pgvector helps AI agents find relevant past experiences, user preferences, and stored knowledge without searching through their entire history.
The key benefit is enabling efficient semantic memory retrieval while keeping structured data and vector embeddings in the same PostgreSQL database.
AI Agent
↓
Embedding Model
↓
PostgreSQL
├── Regular Tables (memories, users, tasks)
└── pgvector (embeddings + similarity search)
↓
Relevant Memories → AI Agent+ Should I worry about how PostgreSQL does semantic search with pgvector?
👉🏻 Yes and no.
pgvector doesn't automatically understand, extract, or generate semantic memories. It stores and searches embeddings, but your AI application must handle memory creation and interpretation.
You just need to implement the AI-side memory management logic.
I haven’t fully implemented semantic search on our project, so when I do, I’m going to update this part
Memory Retrieval API

