* Add blog post: Adding Long-Term Memory to LangGraph and LangChain Agents * blog: update langgraph post date to 2026-03-24 and add cover image * blog: fix claude-code-telegram filename to match frontmatter date (2026-03-25) * blog: set claude-code-telegram date to 2026-03-23 * blog: fix date timezone offset by adding T12:00 to all post dates * ci: trigger fresh CI run * blog: fix broken docs link (routeBasePath is /)
157 lines
No EOL
6.8 KiB
Markdown
157 lines
No EOL
6.8 KiB
Markdown
---
|
|
title: "Your Vercel Chat SDK bot forgets everything. Hindsight fixes that."
|
|
authors: [nicoloboschi]
|
|
date: 2026-02-26T12:00
|
|
tags: [chat-sdk, slack, discord, typescript, memory]
|
|
image: /img/blog/vercel-chat.png
|
|
---
|
|
|
|
|
|

|
|
|
|
## TL;DR
|
|
|
|
- Chat bots built with Vercel's Chat SDK forget everything between messages
|
|
- `@vectorize-io/hindsight-chat` adds persistent memory with one wrapper function
|
|
- Memories cross platforms automatically -- Slack, Discord, Teams, Google Chat
|
|
- We built a team assistant that tracks feature requests and bugs across Slack and Discord with shared memory
|
|
|
|
<!-- truncate -->
|
|
|
|
---
|
|
|
|
## The Problem: Your Team Bot Forgets Everything
|
|
|
|
Your team uses a bot across Slack and Discord. Someone reports a bug in Slack: "The checkout flow is broken on mobile." Someone else mentions a feature request in Discord: "We need dark mode support." A week later, the PM asks the bot: "What are the open issues?" Nothing. The bot has no idea.
|
|
|
|
This is the default for every Chat SDK bot. Each message is a blank slate. No memory of past conversations, no awareness across platforms, no accumulated knowledge.
|
|
|
|
Teams work around this by piping everything into Jira or Notion manually. But the context -- the nuance of why something was requested, who cares about it, what was discussed -- gets lost in the handoff.
|
|
|
|
What if the bot just remembered?
|
|
|
|
---
|
|
|
|
## The Fix: One Wrapper, Shared Memory
|
|
|
|
[`@vectorize-io/hindsight-chat`](https://hindsight.vectorize.io/sdks/integrations/chat) adds a `withHindsightChat()` wrapper to any Chat SDK handler. It automatically recalls relevant memories before your handler runs and retains conversations after.
|
|
|
|
```
|
|
Slack message ─────┐
|
|
├─→ withHindsightChat() ─→ recall ─→ your handler ─→ retain
|
|
Discord message ───┘ │
|
|
▼
|
|
Hindsight API
|
|
(shared memory)
|
|
```
|
|
|
|
Both platforms share the same memory bank. A bug reported in Slack shows up when someone asks in Discord. Feature requests accumulate across both. The bot builds institutional knowledge over time.
|
|
|
|
Here's what the core handler looks like:
|
|
|
|
```typescript
|
|
bot.onNewMention(
|
|
withHindsightChat(
|
|
{
|
|
client: hindsight,
|
|
bankId: () => 'team-memory',
|
|
retain: { enabled: true, tags: ['chat'] },
|
|
},
|
|
async (thread, message, ctx) => {
|
|
const system = [
|
|
'You are a team assistant that tracks feature requests, bugs, and decisions.',
|
|
'You remember everything the team has discussed across Slack and Discord.',
|
|
ctx.memoriesAsSystemPrompt()
|
|
? `\nHere is what you know:\n${ctx.memoriesAsSystemPrompt()}`
|
|
: '',
|
|
].join('\n');
|
|
|
|
const { text } = await generateText({
|
|
model: openai('gpt-4o-mini'),
|
|
system,
|
|
prompt: message.text,
|
|
});
|
|
|
|
await thread.post(text);
|
|
await ctx.retain(`User: ${message.text}\nAssistant: ${text}`);
|
|
}
|
|
)
|
|
);
|
|
```
|
|
|
|
That's the whole handler. The wrapper takes care of recalling memories, formatting them for the LLM, and retaining conversations. You just write the logic. See the [full API reference](https://hindsight.vectorize.io/sdks/integrations/chat) for all configuration options.
|
|
|
|
---
|
|
|
|
## What This Looks Like in Practice
|
|
|
|
**Monday, Slack:**
|
|
> **@team-bot** checkout is broken on mobile -- users can't tap the pay button on iOS
|
|
|
|
The bot acknowledges and retains the bug report.
|
|
|
|
**Tuesday, Discord:**
|
|
> **@team-bot** we really need dark mode, three customers asked about it this week
|
|
|
|
The bot retains the feature request.
|
|
|
|
**Wednesday, Slack:**
|
|
> **@team-bot** what are the open issues this week?
|
|
|
|
The bot recalls both the checkout bug and the dark mode request -- even though they came from different platforms, different days, and different people.
|
|
|
|
No Jira integration. No manual tagging. The bot just remembers.
|
|
|
|
---
|
|
|
|
## How It Works
|
|
|
|
Hindsight isn't a simple vector store. When the bot retains a conversation, Hindsight's pipeline:
|
|
|
|
1. **Extracts structured facts** -- "checkout is broken on mobile iOS" becomes a fact with entities (checkout, mobile, iOS) and relationships
|
|
2. **Builds a knowledge graph** -- entities link across conversations, so "checkout" connects the bug report to any prior discussions about the checkout flow
|
|
3. **Recalls with multiple strategies** -- semantic search, keyword matching, graph traversal, and temporal ranking all run in parallel and fuse results
|
|
|
|
This means the bot doesn't just find messages that look similar to your query. It understands that "open issues" relates to both a bug report and a feature request, even if neither message contained the word "issue."
|
|
|
|
---
|
|
|
|
## Memory Isolation
|
|
|
|
The `bankId` option controls who shares memory:
|
|
|
|
- **Shared team memory** (`bankId: 'team-memory'`): everyone reads and writes to the same bank. Good for tracking bugs, decisions, and feature requests across the team.
|
|
- **Per-user memory** (`bankId: (msg) => msg.author.userId`): each person gets their own bank. Good for personal assistants that remember individual preferences.
|
|
- **Per-channel or per-project**: scope the bank ID however you want. One bank per project, per team, per customer.
|
|
|
|
For the cross-platform use case, a shared bank is the key. Both Slack and Discord write to the same bank, so memories are available everywhere.
|
|
|
|
---
|
|
|
|
## Supported Platforms
|
|
|
|
The Vercel Chat SDK supports Slack, Discord, Microsoft Teams, Google Chat, GitHub, and Linear. The `withHindsightChat()` wrapper works with all of them -- same code, same memory, any combination of platforms.
|
|
|
|
---
|
|
|
|
## Try It
|
|
|
|
The full working example is in the [Hindsight Cookbook](https://github.com/vectorize-io/hindsight-cookbook/tree/main/applications/chat-sdk-multi-platform). It includes:
|
|
|
|
- Complete bot with Slack + Discord adapters
|
|
- LLM-powered responses with Vercel AI SDK
|
|
- Shared Hindsight memory bank
|
|
- Discord Gateway route setup
|
|
- Environment configuration and setup instructions
|
|
|
|
Start Hindsight locally or use [Hindsight Cloud](https://ui.hindsight.vectorize.io/signup), clone the cookbook, and you'll have a working cross-platform bot with memory in minutes.
|
|
|
|
---
|
|
|
|
## Next Steps
|
|
|
|
- **Read the docs**: [Chat SDK integration guide](https://hindsight.vectorize.io/sdks/integrations/chat) covers the full API, configuration options, and advanced patterns
|
|
- **Clone the cookbook**: [chat-sdk-multi-platform](https://github.com/vectorize-io/hindsight-cookbook/tree/main/applications/chat-sdk-multi-platform) has the full working example
|
|
- **Try Hindsight Cloud**: Skip self-hosting with a [free account](https://ui.hindsight.vectorize.io/signup)
|
|
- **Add more platforms**: Teams, Google Chat, GitHub -- same wrapper, same memory
|
|
- **Scope memory per team or project**: Use `bankId` to isolate memory for different contexts |