frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Everyone's trying vectors and graphs for AI memory. We went back to SQL

75•Arindam1729•2d ago
When we first started building with LLMs, the gap was obvious: they could reason well in the moment, but forgot everything as soon as the conversation moved on.

You could tell an agent, “I don’t like coffee,” and three steps later it would suggest espresso again. It wasn’t broken logic, it was missing memory.

Over the past few years, people have tried a bunch of ways to fix it:

1. Prompt stuffing / fine-tuning – Keep prepending history. Works for short chats, but tokens and cost explode fast.

2. Vector databases (RAG) – Store embeddings in Pinecone/Weaviate. Recall is semantic, but retrieval is noisy and loses structure.

3. Graph databases – Build entity-relationship graphs. Great for reasoning, but hard to scale and maintain.

4. Hybrid systems – Mix vectors, graphs, key-value, and relational DBs. Flexible but complex.

And then there’s the twist: Relational databases! Yes, the tech that’s been running banks and social media for decades is looking like one of the most practical ways to give AI persistent memory.

Instead of exotic stores, you can:

- Keep short-term vs long-term memory in SQL tables

- Store entities, rules, and preferences as structured records

- Promote important facts into permanent memory

- Use joins and indexes for retrieval

This is the approach we’ve been working on at Gibson. We built an open-source project called Memori (https://memori.gibsonai.com/), a multi-agent memory engine that gives your AI agents human-like memory.

It’s kind of ironic, after all the hype around vectors and graphs, one of the best answers to AI memory might be the tech we’ve trusted for 50+ years.

I would love to know your thoughts about our approach!

Comments

gangtao•2d ago
Who would've thought that 50 years of 'SELECT * FROM reality' might beat the latest semantic embedding wizardry?
mynti•2d ago
How does Memori choose what part of past conversations is relevant to the current conversation? Is there some maximum amount of memory it can feasibly handle before it will spam the context with irrelevant "memories"?
datadrivenangel•1h ago
Looking at the code, it looks like they do about 5 'memories' that get retrieved by a database query designed by an LLM with this fella:

SYSTEM_PROMPT = """You are a Memory Search Agent responsible for understanding user queries and planning effective memory retrieval strategies.

Your primary functions: 1. *Analyze Query Intent*: Understand what the user is actually looking for 2. *Extract Search Parameters*: Identify key entities, topics, and concepts 3. *Plan Search Strategy*: Recommend the best approach to find relevant memories 4. *Filter Recommendations*: Suggest appropriate filters for category, importance, etc.

*MEMORY CATEGORIES AVAILABLE:* - *fact*: Factual information, definitions, technical details, specific data points - *preference*: User preferences, likes/dislikes, settings, personal choices, opinions - *skill*: Skills, abilities, competencies, learning progress, expertise levels - *context*: Project context, work environment, current situations, background info - *rule*: Rules, policies, procedures, guidelines, constraints

*SEARCH STRATEGIES:* - *keyword_search*: Direct keyword/phrase matching in content - *entity_search*: Search by specific entities (people, technologies, topics) - *category_filter*: Filter by memory categories - *importance_filter*: Filter by importance levels - *temporal_filter*: Search within specific time ranges - *semantic_search*: Conceptual/meaning-based search

*QUERY INTERPRETATION GUIDELINES:* - "What did I learn about X?" → Focus on facts and skills related to X - "My preferences for Y" → Focus on preference category - "Rules about Z" → Focus on rule category - "Recent work on A" → Temporal filter + context/skill categories - "Important information about B" → Importance filter + keyword search

Be strategic and comprehensive in your search planning."""

thedevindevops•2d ago
How does what you've described solve the coffee/espresso problem? You can't query SQL such that records like 'espresso' return coffee?
brudgers•2d ago
Wouldn’t a beverage LLM would already “know” espresso is coffee?
muzani•1d ago
Yup, that's exactly what parent comment is saying.

Let's say your beverage LLM is there to recommend drinks. You once said "I hate espresso" or even something like "I don't take caffeine" at one point to the LLM.

Before recommending coffee, Beverage LLM might do a vector search for "coffee" and it would match up to these phrases. Then the LLM processes the message history to figure out whether this person likes or dislikes coffee.

But searching SQL for `LIKE '%coffee%'` won't match with any of these.

brudgers•1d ago
I think the problem being addressed is

   A. Last month user fd8120113 said “I don’t like coffee”
   B. Today they are back for another beverage recommendation
SQL is the place to store the relevant fact about user fd8120113 so that you can retrieve it into the LLM prompt to make a new beverage recommendation, today.

It’s addressing the “how many fucking times do I fucking need to tell you I don’t like fucking coffee” problem, not the word salad problem.

The ggp comment is strawmanning.

shepardrtc•1h ago
Right but if the user hates espresso but loves black coffee, how do you properly store that in SQL?

"I hate espresso" "I love coffee"

What if the SQL query only retrieves the first one?

brudgers•1h ago
Good queries are hard. Database design is hard. System architecture is hard.

My comment described the problem.

The solution is left as an exercise for the reader.

Keep in mind that people change their minds, misspeak, and use words in peculiar ways.

9rx•2h ago
If an LLM understands that coffee and expresso are both relevant, like the earlier comment suggests, why wouldn't it understand that it should search for something like `foo LIKE '%coffee%' OR foo LIKE '%expresso%'`?

In fact, this is what ChatGPT came up with:

   SELECT *
   FROM documents
   WHERE text ILIKE '%coffee%'
      OR text ILIKE '%espresso%'
      OR text ILIKE '%latte%'
      OR text ILIKE '%cappuccino%'
      OR text ILIKE '%americano%'
      OR text ILIKE '%mocha%'
      OR text ILIKE '%macchiato%';
(I gave it no direction as to the structure of the DB, but it shouldn't be terribly difficult to adapt to your exact schema)
jimbokun•2h ago
You are slowly approaching the vector solution.

There are an unlimited number of items to add to your “like” clauses. Vector search allows you to efficiently query for all of them at once.

9rx•2h ago
The handwavvy assertion was that relational database solutions[1] work better in practice.

[1] Despite also somehow supporting MongoDB...

mr_toad•2h ago
Implementations that use vector database do not use LLMs to generate queries against those databases. That would be incredibly expensive and slow (and yes there is a certain irony there).

Main advantages of a vector lookup are built-in fuzzy matching and the potential to keep a large amount of documentation in memory for low latency. I can’t see an RDMS being ideal for either. LLMs are slow enough already, adding a slow document lookup isn’t going to help.

9rx•1h ago
The main disadvantage of vector lookup, allegedly, is that it doesn't work as well in practice. Did you, uh, forget to read the thread?
esafak•1h ago
The negation part is a query understanding problem. https://en.wikipedia.org/wiki/Query_understanding
sdesol•34m ago
I haven't looked at the code, but it might do what I do with my chat app which is talked about at https://github.com/gitsense/chat/blob/main/packages/chat/wid...

The basic idea is, you don't search for a single term but rather you search for many. Depending on the instructions provided in the "Query Construction" stage, you may end up with a very high level search term like beverage or you may end up with terms like 'hot-drinks', 'code-drinks', etc.

Once you have the query, you can do a "Broad Search" which returns an overview of the message and from there the LLM can determine which messages it should analyze further if required.

Edit.

I should add, this search strategy will only work well if you have a post message process. For example, after every message save/upddate, you have the LLM generate an overview. These are my instructions for my tiny overview https://github.com/gitsense/chat/blob/main/data/analyze/tiny... that is focused on generating the purpose and keywords that can be used to help the LLM define search terms.

adastra22•12m ago
That’s going to be incredibly fragile. You could fix it by giving the query term a bunch of different scores, e.g. its caffeine-ness, bitterness, etc. and then doing a likeness search across these many dimensions. That would be much less fragile.

And now you’ve reinvented vector embeddings.

Xmd5a•2d ago
>It wasn’t broken logic, it was missing memory.

sigh

cdaringe•1d ago
Go on.
spacebacon•1d ago
SELECT 'Hacked!' AS result FROM Gibson_AI WHERE memory='SQL' AND NOT EXISTS ( SELECT 1 FROM vector_graph_hype WHERE recall > ( SELECT speed FROM relational_magic WHERE tech='50_years_old' ) )
muzani•1d ago
Any reason I should pick it over Supabase? https://supabase.com/docs/guides/ai

They have pgvector, which has practically all the benefits of postgres (ACID, etc, which may not be in many other vector DBs). If I wanted a keyword search, it works well. If I wanted vector search, that's there too.

I'm not keen on having another layer on top especially when it takes about 15 mins to vibe code a database query - there's all kinds of problems with abstracted layers and it's not a particularly complex bit of code.

koakuma-chan•2h ago
> multi-agent memory engine that gives your AI agents human-like memory

What does this do exactly?

datadrivenangel•2h ago
You gotta refactor the code around the mongodb integration. It's basically duplicating your data access paths.
morkalork•2h ago
IMHO all these approaches are hacks on top of existing systems. The real solution is going to be when foundational models are given a mechanism that makes them capable of storing and retrieving their own internal representation of concepts/ideas.
mr_toad•1h ago
Neural networks already have their own internal knowledge representations. They just aren’t capable of learning new knowledge (without expensive re-training or fine-tuning).

Inference is cheap, training is expensive. It’s a really difficult problem, but one that will probably need to be solved to approach true intelligence.

morkalork•1h ago
In the way that they're trained to complete tasks from users, can they be trained to complete tasks that require usage of a memory storage and retrieval mechanism?
cpursley•1h ago
Postgres Is Enough:

https://news.ycombinator.com/item?id=39273954

https://gist.github.com/cpursley/c8fb81fe8a7e5df038158bdfe0f...

refset•1h ago
> pg_memories revolutionized our AI's ability to remember things. Before, we were using... well, also a database, but this one has better marketing.

https://pg-memories.netlify.app/

brainless•1h ago
I tried a graph based approach in my previous product (1). I am on a new product now and I came back to SQLite. Initially it was because I just wanted a simple DB to enable creating cross-platform desktop apps.

I realized LLMs are really good at using sqlite3 and SQL statements. So in my current product (2) I am planning to keep all project data in SQLite. I am creating a self-hosted AI coding platform and I debated where to keep project state for LLMs. I thought of JSON/NDJSON files (3) but I am gravitating toward SQLite and figuring out the models at the moment (4).

  1. Previous product with a graph data approach https://github.com/pixlie/PixlieAI
  2. Current product with SQLite for its own and other projects data: https://github.com/brainless/nocodo
  3. Github issue on JSON/NDJSON based data for project state for LLMs: https://github.com/brainless/nocodo/issues/114
  4. Github issue on expanding the SQLite approach: https://github.com/brainless/nocodo/issues/141
Still work in progress, but I am heading toward SQLite for LLM state.
matchagaucho•1h ago
As context window sizes increase and token prices go down, it makes more sense to inject dynamic memories into context (and use RAG/vector stores for knowledge retrieval).
cmrdporcupine•10m ago
The relational model is built on first order / predicate logic. While SQL itself is kind of a dubious and low grade implementation of it, it's not a surprise to me that it would be useful for applications of reasoning and memory about facts generally.

I think a Datalog type dialect would be more appropriate, myself. Maybe something like that RelationalAI has implemented.

alpinesol•4m ago
Using an obscure derivative of an obscure academic language (prolog) is never appropriate outside of a university.

Yt-dlp: Upcoming new requirements for YouTube downloads

https://github.com/yt-dlp/yt-dlp/issues/14404
615•phewlink•5h ago•301 comments

That Secret Service SIM farm story is bogus

https://cybersect.substack.com/p/that-secret-service-sim-farm-story
708•sixhobbits•8h ago•368 comments

SedonaDB: A new geospatial DataFrame library written in Rust

https://sedona.apache.org/latest/blog/2025/09/24/introducing-sedonadb-a-single-node-analytical-da...
18•MrPowers•42m ago•3 comments

US Airlines Push to Strip Away Travelers' Rights by Rolling Back Key Protections

https://www.travelandtourworld.com/news/article/american-joins-delta-southwest-united-and-other-u...
423•duxup•4h ago•390 comments

Terence Tao: The role of small organizations in society has shrunk significantly

https://mathstodon.xyz/@tao/115259943398316677
7•bertman•11m ago•0 comments

Python on the Edge: Fast, sandboxed, and powered by WebAssembly

https://wasmer.io/posts/python-on-the-edge-powered-by-webassembly
37•baalimago•55m ago•6 comments

Learning Persian with Anki, ChatGPT and YouTube

https://cjauvin.github.io/posts/learning-persian/
87•cjauvin•3h ago•32 comments

How to Lead in a Room Full of Experts

https://idiallo.com/blog/how-to-lead-in-a-room-full-of-experts
92•jnord•3h ago•20 comments

EU age verification app not planning desktop support

https://github.com/eu-digital-identity-wallet/av-doc-technical-specification/issues/22
284•sschueller•4h ago•187 comments

Who Funds Misfit Research?

https://blog.spec.tech/p/who-funds-misfit-research
31•surprisetalk•1h ago•5 comments

Smartphone Cameras Go Hyperspectral

https://spectrum.ieee.org/hyperspectral-imaging
28•voxadam•2h ago•10 comments

New bacteria, and two potential antibiotics, discovered in soil

https://www.rockefeller.edu/news/38239-hundreds-of-new-bacteria-and-two-potential-antibiotics-fou...
15•PaulHoule•39m ago•3 comments

The Lambda Calculus – Stanford Encyclopedia of Philosophy

https://plato.stanford.edu/entries/lambda-calculus/
21•lordleft•1h ago•3 comments

Zed's Pricing Has Changed: LLM Usage Is Now Token-Based

https://zed.dev/blog/pricing-change-llm-usage-is-now-token-based
18•meetpateltech•29m ago•2 comments

How to Be a Leader When the Vibes Are Off

https://chaoticgood.management/how-to-be-a-leader-when-the-vibes-are-off/
30•mooreds•1h ago•4 comments

How HubSpot Scaled AI Adoption

https://product.hubspot.com/blog/context-is-key-how-hubspot-scaled-ai-adoption
50•zek•2h ago•24 comments

Better Curl Saul: a lightweight API testing CLI focused on UX and simplicity

https://github.com/DeprecatedLuar/better-curl-saul
6•jicea•26m ago•2 comments

S3 scales to petabytes a second on top of slow HDDs

https://bigdata.2minutestreaming.com/p/how-aws-s3-scales-with-tens-of-millions-of-hard-drives
134•todsacerdoti•6h ago•42 comments

The Data Commons Model Context Protocol (MCP) Server

https://developers.googleblog.com/en/datacommonsmcp/
4•meetpateltech•53m ago•0 comments

Rights groups urge UK PM Starmer to abandon plans for mandatory digital ID

https://bigbrotherwatch.org.uk/press-releases/rights-groups-urge-starmer-to-abandon-plans-for-man...
153•Improvement•4h ago•109 comments

My Ed(1) Toolbox

https://aartaka.me/my-ed.html
50•mooreds•4h ago•13 comments

Just Let Me Select Text

https://aartaka.me/select-text.html
186•ayoisaiah•2h ago•187 comments

The DHS has been harvesting DNA from Americans for years

https://www.wired.com/story/dhs-has-been-collecting-us-citizens-dna-for-years/
49•righthand•1h ago•7 comments

Preparing for the .NET 10 GC

https://maoni0.medium.com/preparing-for-the-net-10-gc-88718b261ef2
57•benaadams•6h ago•36 comments

Everyone's trying vectors and graphs for AI memory. We went back to SQL

75•Arindam1729•2d ago•33 comments

Exploring GrapheneOS secure allocator: Hardened Malloc

https://www.synacktiv.com/en/publications/exploring-grapheneos-secure-allocator-hardened-malloc
68•r4um•6h ago•1 comments

Huntington's disease treated for first time

https://www.bbc.com/news/articles/cevz13xkxpro
202•_zie•5h ago•62 comments

My game's server is blocked in Spain whenever there's a football match on

https://old.reddit.com/r/gamedev/comments/1np6kyn/my_games_server_is_blocked_in_spain_whenever/
312•greazy•6h ago•146 comments

Identity Types

https://bartoszmilewski.com/2025/09/22/identity-types/
6•ibobev•2d ago•0 comments

I Spent Three Nights Solving Listen Labs Berghain Challenge (and Got #16)

https://kuber.studio/blog/Projects/How-I-Spent-Three-Nights-Solving-Listen-Labs-Berghain-Challenge
39•kuberwastaken•3d ago•10 comments