Add long-term memory to a Vercel AI SDK chatbot (middleware, Next.js route and agent tools)
Chat persistence saves one transcript per chat. Here's how to add per-user memory that carries across chats with one wrapLanguageModel call, plus helpers and five memory tools.
