Back to browse
I built a chat client that uses embeddings to cluster messages by topic

I built a chat client that uses embeddings to cluster messages by topic

by doantam·Jul 21, 2026·1 point·0 comments

AI Analysis

●●SolidNiche GemBig Brain

Cosine similarity scoring against the last three messages keeps context tight.

Strengths
  • Using LLM summaries for embeddings is smarter than raw text chunking.
  • Threshold-based grouping prevents topic drift better than simple clustering.
  • Sidebar navigation solves the 'scroll fatigue' problem in long chat sessions.
Weaknesses
  • No mention of export options or API access for the clustered data.
  • Hard to justify switching from existing clients without more features.
Category
Target Audience

Heavy LLM users, researchers

Similar To

Chatbase · TypingMind · LibreChat

Post Description

Hi HN, I found myself scrolling backwards a lot in my chats with LLMs to follow up on interesting things I had seen earlier in the conversation. So, I built a basic chat client and I added a sidebar that allowed me to jump directly to different messages. The sidebar started getting hard to navigate with a lot of items, so then I thought it'd be nice if the chat history was clustered by topic.

In the end what I settled on was to have an LLM generate summaries of the query and responses, turn those summaries into vector embeddings, and then score the new message against the existing groups. A group's score is the cosine similarity of the new message and the last three messages in each group. The message is added to the best scoring group if it exceeds the threshold and is still similar enough to the first message in the group.

This was a fun project because I've never built a complete website before, so I learned a lot and it was satisfying to get something up and running. The stack itself is Node / Express / Svelte. I also enjoyed thinking about different ways to make the clustering work and trying to improve it.

If you've ever played around with clustering algorithms, you'll know there's definitely some magic numbers involved, so I'm curious to see if other people find it interesting.

Try out a live demo with sample data: https://llmtrail.com/demo

For more technical details, you can read my writeup here: https://doantamphan.com/llmtrail/

Similar Projects

CLI tool to analyze your Vector Embeddings!

Embedding auditor with 5 checks and pretty plots, but crowded niche with unclear novelty.

Ship It
gauravvij137
215mo ago
Data●●Solid

Explore Trends in HN posts. ETL using Embeddings/KMeans/DuckDB

Unsupervised KMeans clustering discovers HN topics instead of relying on predefined tags.

Big BrainNiche Gem
ugabuga
201d ago