Skip to content

Punkte/revive

Repository files navigation

Revive

This is a proof of concept. It is not intended for commercial use, public deployment, or any production purpose.

The goal of this project was to explore how far you can push modern AI techniques to simulate a real person's texting style from a conversation export — without fine-tuning a model. It was built as a personal experiment to understand:

  • How to extract a detailed persona from raw conversation data using an LLM
  • How to ground a language model's responses in real memories via a vector database (RAG)
  • How to shape model behaviour entirely through system prompt engineering — style constraints, biographical facts, anti-hallucination rules
  • How SSE streaming works end-to-end from an API to a browser UI
  • The limits and failure modes of each approach (hallucination, context window, style drift, emoji over-use…)

No model was fine-tuned. Everything runs on prompt + retrieval.


Tech stack

Layer What
API Fastify v5 + Zod + TypeScript
Database PostgreSQL 17 + pgvector (via Docker)
Embeddings Ollama (nomic-embed-text) — runs locally
Persona + Chat Claude (Anthropic API) — claude-sonnet-4-6
Frontend Next.js 16 + Tailwind CSS v4

Prerequisites

  • Node.js v20+
  • Docker + Docker Compose
  • Ollamaollama.com — for local embeddings
  • Anthropic API key — for persona extraction and chat

Setup

1. Clone and install

git clone <repo>
cd revive
npm install

2. Start the database

docker compose up -d

This starts PostgreSQL 17 with the pgvector extension on port 5432.

3. Configure environment

cp revive-api/.env.example revive-api/.env

Edit revive-api/.env and fill in your Anthropic API key:

DATABASE_URL=postgres://revive:revive@localhost:5432/revive
OLLAMA_BASE_URL=http://localhost:11434
ANTHROPIC_API_KEY=sk-ant-...

4. Run database migrations

npm run db:migrate -w revive-api

5. Pull the embedding model

ollama pull nomic-embed-text

6. Start both servers

npm run dev

This starts:

  • API on http://localhost:1997
  • Frontend on http://localhost:3000

Usage

  1. Export a WhatsApp conversation as .txt (Chat > Export Chat > Without media)
  2. Open http://localhost:3000
  3. Drop the file, select who you want to talk to, enter your name
  4. Wait for the pipeline to run (chunking + embedding + persona extraction)
  5. Review the extracted persona, adjust if needed
  6. Start chatting

How it works

Upload .txt
    │
    ▼
Parse messages ──► Temporal chunking ──► Embed (nomic-embed-text) ──► pgvector
    │
    ▼
Sample 6 time windows ──► Claude extracts partial PersonaCard × 6 (parallel)
    │
    ▼
Claude merges partials ──► Final PersonaCard (style, quirks, slang, key facts…)
    │
    ▼
User sends message
    │
    ├──► pgvector cosine search ──► top-K relevant excerpts
    │
    └──► System prompt = PersonaCard + key facts + excerpts + chat history
              │
              ▼
         Claude streams response

Limitations

  • Only WhatsApp .txt exports are supported (bracket and dash formats)
  • Quality depends entirely on the volume and richness of the source conversation
  • The model will sometimes refuse to answer in character — this is expected
  • This is not a replacement for human connection

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages