Build a chatbot with a custom personality and backstory that remembers past conversations using a vector database.
Learn how AI chatbots with memory are built by running and modifying a working starter kit locally.
Add SMS chat to an AI companion so users can text it from their phone via Twilio.
Fork this project to create a fully custom AI companion app with your own character definitions and personality files.
Requires API keys for multiple services including Clerk, OpenAI or Replicate, Pinecone or Supabase, and Upstash, Twilio is optional for SMS.
This repository is a tutorial starter kit for building your own AI companion, meaning a chatbot with a defined personality that you can converse with over a web browser or through text messages. It was created by the infrastructure team at a16z as a learning resource, not as a finished product, so the goal is to show developers how these kinds of chatbots are built rather than to ship a polished app. The core idea is that you define your companion's personality and backstory by writing a text file, then the app uses that information to shape every conversation. To give the companion a sense of memory, the system stores recent conversation history in a queue and also uses a vector database to find relevant past context and pull it into the current prompt. This makes responses feel more connected to what was discussed earlier, rather than each message being treated in isolation. The technical stack includes Next.js for the web app, Clerk for user login, Langchain.js to coordinate the AI calls, and either OpenAI or a model called Vicuna (hosted on a service called Replicate) as the actual language model. Conversation history is stored in Upstash, and the vector database can be either Pinecone or Supabase. You can also add SMS chat via Twilio if you want to text your companion from your phone. Each of these services requires an API key, and the README walks through obtaining and configuring each one. The repository includes four pre-built companion personalities you can chat with right away after setting up the environment variables. The README explicitly notes that this is a developer tutorial, not a production platform, and that heavier production alternatives exist elsewhere. If you are a developer curious about how AI chatbots with memory are built, this repository gives you a working example you can run locally and modify. If you are a non-technical user looking for an AI companion to use, this is a codebase you would need to deploy yourself, not a ready-to-use product.
← a16z-infra on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.