Skip to content

aivault-org/aivault

Repository files navigation

🏛️ AIVault

Your AI Data. Secured. Unified. Yours.

All your AI conversations in one place — import, search, and chat with your knowledge base.

License Next.js TypeScript Supabase Deploy


Features · Quick Start · Deploy · Architecture · Contributing


🎯 Why AIVault?

You chat with AI every day — ChatGPT, Claude, Gemini, MiMo. Your conversations contain valuable knowledge: code solutions, project decisions, research insights. But they're trapped in silos.

AIVault liberates your AI data:

  • 📥 Import conversations from any AI platform
  • 🔍 Search across everything with semantic vector search
  • 💬 Chat with your knowledge base using any LLM
  • 🤖 Collect Claude Code sessions automatically
  • 🔌 Integrate with any AI agent via MCP protocol

✨ Features

📥 Multi-Platform Import

Upload ChatGPT JSON exports, Claude conversations, Claude Code terminal sessions. Auto-detect format, batch import.

🔍 Semantic Search

Powered by pgvector embeddings. Ask natural language questions — find the conversation that matters, not just keyword matches.

💬 Knowledge Base Chat

Chat with your conversations using any OpenAI/Anthropic compatible LLM. Configure API key and model per session.

🤖 Real-Time Collection

MCP Server built-in collector watches ~/.claude/projects/ and syncs raw sessions to AIVault automatically. Zero manual effort.

🔌 MCP Server

Model Context Protocol integration — connect AIVault to Claude Desktop, Cursor, or any MCP-compatible agent.

🔑 API Key System

Generate API keys for external tools. Collector, MCP, or your own scripts — all authenticated through AIVault.


🚀 Quick Start

Prerequisites

  • Node.js 18+
  • Supabase account (free tier works)
  • Clerk account (free tier works)

1. Clone & Install

git clone https://github.com/aivault-org/aivault.git
cd aivault
npm install

2. Set Up Services

Supabase — Create a project at supabase.com

Clerk — Create an application at clerk.com

3. Configure

cp .env.example .env.local

Fill in your credentials:

# Supabase (Settings → API)
NEXT_PUBLIC_SUPABASE_URL=https://xxx.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJ...
SUPABASE_SERVICE_ROLE_KEY=eyJ...

# Clerk (API Keys)
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_...
CLERK_SECRET_KEY=sk_test_...

4. Database Setup

Run these SQL files in Supabase SQL Editor (Dashboard → SQL Editor):

-- 1. Core tables (users, conversations, messages, subscriptions)
--    → Paste contents of supabase/schema.sql

-- 2. Vector search (optional, for RAG)
--    → Paste contents of supabase/migrations/002_pgvector.sql

-- 3. API key authentication
--    → Paste contents of supabase/migrations/003_api_keys.sql

5. Run

npm run dev

Open http://localhost:3000 🎉


☁️ Deploy to Vercel

Deploy with Vercel

  1. Click the button above (or connect repo manually)
  2. Add environment variables from .env.local
  3. Deploy — done!

Every git push auto-deploys.


Note: Claude Code session collection is now built into the MCP Server. No separate collector process needed.


🔌 MCP Server

AIVault 提供独立的 MCP Server 包,可连接任何兼容 MCP 协议的 Agent:

{
  "mcpServers": {
    "aivault": {
      "command": "npx",
      "args": ["-y", "@aivault/aivault-mcp-server"],
      "env": {
        "AIVAULT_URL": "https://your-aivault.vercel.app",
        "AIVAULT_API_KEY": "av_xxxxxxxx"
      }
    }
  }
}

详见 @aivault/aivault-mcp-server

可用工具:

  • search_conversations — 搜索对话(关键词 / 语义)
  • get_conversation — 获取完整对话详情
  • list_conversations — 列出最近对话
  • get_stats — 获取统计信息
  • register_agent — 注册 Agent 到 Dashboard
  • sync_conversation — 同步对话到知识库
  • heartbeat — 心跳保活

🏗 Architecture

┌─────────────────────────────────────────────────────┐
│                    AIVault App                       │
│              Next.js 15 + TypeScript                │
├─────────────┬───────────────┬───────────────────────┤
│   Frontend  │   API Routes  │    Middleware          │
│  (React 19) │  (/api/*)     │   (Clerk Auth)        │
├─────────────┴───────────────┴───────────────────────┤
│                      ↓                               │
│  ┌──────────┐  ┌──────────┐  ┌───────────────────┐  │
│  │ Supabase │  │  Clerk   │  │   LLM APIs        │  │
│  │ Postgres │  │  Auth    │  │ MiMo / OpenAI /    │  │
│  │ + pgvector│  │          │  │ Anthropic          │  │
│  └──────────┘  └──────────┘  └───────────────────┘  │
├─────────────────────────────────────────────────────┤
│  External Tools                                      │
│  ┌──────────────┐  ┌──────────────┐                 │
│  │   MCP Server  │  │ (with built-in│                 │
│  │  collector)   │  │              │                 │
│  └──────────────┘  └──────────────┘                 │
└─────────────────────────────────────────────────────┘

📁 Project Structure

aivault/
├── src/
│   ├── app/                    # Next.js App Router
│   │   ├── (auth)/             # Sign in / Sign up pages
│   │   ├── (dashboard)/        # Main app pages
│   │   │   ├── chat/           # AI chat with knowledge base
│   │   │   ├── conversations/  # Browse imported conversations
│   │   │   ├── import/         # File upload & import
│   │   │   ├── search/         # Full-text & semantic search
│   │   │   └── settings/       # Account & API key management
│   │   └── api/                # REST API endpoints
│   ├── components/             # Reusable UI components
│   ├── lib/                    # Core libraries
│   │   ├── parsers/            # ChatGPT, Claude, Claude Code parsers
│   │   ├── embeddings.ts       # Vector embedding generation
│   │   ├── supabase.ts         # Database client
│   │   ├── auth.ts             # Auth utilities
│   │   └── api-keys.ts         # API key management
│   └── middleware.ts           # Clerk auth middleware
├── supabase/                   # Database schema & migrations
│   ├── schema.sql              # Core database schema
│   └── migrations/             # pgvector & API keys
└── docs/                       # Documentation

⚙️ Tech Stack

Layer Technology
Framework Next.js 15 (App Router)
Language TypeScript 5
UI Tailwind CSS + shadcn/ui
Database Supabase (PostgreSQL)
Vector Search pgvector (HNSW index)
Auth Clerk
AI/LLM MiMo, OpenAI, Anthropic compatible
Deploy Vercel

🤝 Contributing

We welcome contributions! See CONTRIBUTING.md for:

  • Development setup
  • Code conventions
  • Pull request process

📄 License

Apache License 2.0 — free for personal and commercial use.


Built with ❤️ for the AI era

⬆ Back to top

About

Your AI Data. Secured. Unified. Yours. — Import, search, and chat with all your AI conversations in one place.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors