A self-hosted RAG chatbot that answers questions about the Quilibrium protocol using official documentation, livestream transcriptions, community docs and Discord announcements. It ships as a web app plus a Discord bot.
- RAG-powered answers with source citations from official Quilibrium docs
- Streaming responses with a choice of LLM providers
- Free mode: the server's key can serve all users, so nobody has to bring their own (
NEXT_PUBLIC_FREE_MODE) - Chutes OAuth as an optional sign-in that needs no API key
- Bring your own key when free mode is off
- Two-stage retrieval with Cohere or Cloudflare reranking (free tier available)
- Auto-sync of docs from GitHub, Discord announcements, the tech tree and the ecosystem list
- Discord bot (
bot/) that answers mentions and posts a daily digest - Bot protection with Cloudflare Turnstile
- Conversation history persisted in browser localStorage
- Dark mode support
- Mobile responsive design
- QA evaluation harness for stress-testing response quality with LLM-as-judge
- Node.js 22+
- Yarn 4 (run
corepack enable; the version is pinned inpackage.json) - Supabase account (free tier works)
- An LLM provider API key (see
.env.example) - Chutes account (optional, for Sign in with Chutes)
- GitHub token (for docs sync, no scopes needed)
git clone https://github.com/Quilibrium-Community/quily.git
cd quily
corepack enable
yarnCopy .env.example to .env.local and fill in your values. .env.example is the full, commented list; the essentials are:
# Supabase (required)
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
SUPABASE_URL=your_supabase_url
SUPABASE_SERVICE_KEY=your_service_role_key
# LLM provider key (required: used for embeddings and chat)
OPENROUTER_API_KEY=your_api_key
# Free mode (optional): serve all users with the server's key
# NEXT_PUBLIC_FREE_MODE=true
# Chutes OAuth (optional - enables Sign in with Chutes)
# CHUTES_OAUTH_CLIENT_ID=cid_xxx
# CHUTES_OAUTH_CLIENT_SECRET=csc_xxx
# CHUTES_OAUTH_SCOPES="openid profile chutes:invoke"
NEXT_PUBLIC_APP_URL=http://localhost:3000
# Reranking (optional, improves retrieval quality)
# COHERE_API_KEY=your_cohere_key
# GitHub (required for docs sync)
GITHUB_TOKEN=ghp_your_token_hereGet your keys:
- Supabase → Dashboard → Settings → API
- LLM provider key (required, see
.env.example) - Chutes → Create account (optional, for OAuth sign-in)
- Cohere (optional)
- GitHub → Generate token (no scopes needed for public repos)
Create a new Supabase project and run the schema from scripts/db/schema.sql in the SQL Editor.
The schema uses BGE-M3 embeddings (1024 dimensions). Ingestion generates them through the configured provider.
# Sync docs from Quilibrium GitHub repo
yarn sync-docs:run
# Ingest into vector database
yarn ingest:runyarn devOpen http://localhost:3000 and start chatting. With free mode off, configure a provider (API key or Chutes sign-in) in Settings first.
The chatbot's knowledge comes from the ./docs folder. Documentation is organized into three categories:
Official Quilibrium docs are synced from QuilibriumNetwork/docs into docs/quilibrium-official/. The folder is tracked in git (the daily workflow commits to it), but never edit it by hand: the next sync overwrites your changes.
# Check what would change
yarn sync-docs:status
# Sync latest docs
yarn sync-docs:run
# Force re-download everything
yarn sync-docs:forcedocs/discord/ holds announcements, dev updates, node updates and the general recap, pulled from Discord by yarn sync-discord:run. Also an automated mirror: do not edit by hand.
Add your own content to docs/transcriptions/ or docs/custom/. These are version-controlled. docs/custom/auto/ is generated by the tech tree and ecosystem syncs, so leave it alone.
docs/
├── quilibrium-official/ ← Synced from GitHub (automated)
│ ├── api/ build/ discover/
│ ├── learn/ protocol/ run-node/
│ └── .sync-manifest.json
├── discord/ ← Synced from Discord (automated)
│ ├── announcements/ dev-updates/
│ └── node-updates/ general-recap/
├── transcriptions/ ← Livestream and interview transcripts (committed)
│ └── 2024-06-19_quilibrium-web3-galaxy-brain-interview.md
└── custom/ ← Community docs (committed)
├── Epochs-And-Frames.md
└── auto/ ← Generated (tech tree, ecosystem)
| Extension | Type | Notes |
|---|---|---|
.md |
Markdown | Frontmatter supported |
.txt |
Plain text | Good for transcriptions |
A GitHub Actions workflow runs daily at 06:00 UTC. It syncs official docs and Discord content, commits any changes, and re-ingests embeddings into Supabase. Other workflows in .github/workflows/:
| Workflow | What it does |
|---|---|
sync-docs.yml |
Daily docs and Discord sync + RAG ingestion |
sync-techtree.yml |
Weekly tech tree sync |
sync-ecosystem.yml |
Weekly ecosystem project list sync |
monthly-model-scout.yml |
Monthly report on cheaper or better models |
supabase-keepalive.yml |
Keeps the free-tier Supabase project from pausing |
ci.yml |
Install and typecheck (guards the toolchain) |
To enable the daily sync, add these GitHub Secrets (Settings → Secrets and variables → Actions):
| Secret | Value from .env |
|---|---|
SUPABASE_URL |
NEXT_PUBLIC_SUPABASE_URL |
SUPABASE_SERVICE_KEY |
SUPABASE_SERVICE_ROLE_KEY |
OPENROUTER_API_KEY |
OPENROUTER_API_KEY |
PAT_TOKEN |
A token that can push to the repo |
DISCORD_BOT_TOKEN, DISCORD_CHANNEL_IDS, DISCORD_GENERAL_CHANNEL_ID |
Only if you sync Discord content |
You can also trigger it manually from the Actions tab → "Daily Docs Sync & RAG Ingestion" → "Run workflow".
# One-command: sync + ingest
yarn sync-docs:ingest
# Or step by step:
yarn sync-docs:run # Sync latest from GitHub
yarn ingest:run # Update the RAG database (BGE-M3 embeddings)
yarn sync-discord:run # Optional: pull Discord content (needs DISCORD_BOT_TOKEN)# Remove orphaned chunks from database
yarn ingest:clean# GitHub sync status
yarn sync-docs:status
# Database sync status
yarn ingest:status| Command | Description |
|---|---|
yarn dev |
Start development server |
yarn build |
Production build |
yarn start |
Start production server |
yarn typecheck |
TypeScript type checking |
yarn doc:lint |
Lint knowledge base docs |
yarn retrieval:check |
Retrieval regression check |
yarn prod-logs / yarn prod-curl |
Production debugging helpers |
The bot lives in bot/ with its own package.json. From that folder: npm run dev, npm run build, npm run start. Set DISCORD_BOT_TOKEN, DISCORD_CLIENT_ID and DISCORD_CHANNEL_IDS (see .env.example).
| Command | Description |
|---|---|
yarn sync-docs:status |
Check for remote changes |
yarn sync-docs:run |
Sync docs from GitHub |
yarn sync-docs:force |
Force re-download all |
yarn sync-docs:ingest |
Sync + auto-ingest |
yarn sync-docs:dry |
Preview without downloading |
yarn sync-docs verify |
Verify local files match manifest |
yarn sync-discord:run |
Sync Discord announcements and updates |
yarn sync-techtree |
Sync the Quilibrium tech tree |
yarn sync-ecosystem |
Sync the ecosystem project list |
| Command | Description |
|---|---|
yarn ingest:run |
Run ingestion pipeline (default) |
yarn ingest:run-chutes |
Run ingestion via Chutes (legacy, opt-in) |
yarn ingest:clean |
Ingest + remove orphaned chunks |
yarn ingest:dry |
Preview without uploading |
yarn ingest:status |
Show local vs database sync |
yarn ingest:count |
Count chunks in database |
yarn ingest clean |
Remove orphaned chunks only |
| Command | Description |
|---|---|
yarn eval:list |
List all test cases |
yarn eval:run |
Run full evaluation suite (requires OPENROUTER_API_KEY) |
yarn eval:smoke |
Run smoke tests only (a few quick tests) |
yarn eval:broad |
Run the broad suite (53 cases) instead of the focused default (43) |
yarn eval:run --no-judge |
Deterministic checks only (free) |
yarn eval:report <path> |
Re-display a saved JSON report |
The eval harness sends queries to the chat API, parses streaming responses, and evaluates quality using deterministic checks and an LLM judge (Claude Sonnet). Requires a running dev server (yarn dev). See .agents/docs/qa-evaluation-harness.md for full documentation.
├── app/
│ ├── api/
│ │ ├── chat/route.ts # Streaming chat endpoint with RAG
│ │ ├── auth/ # Provider and Turnstile auth
│ │ ├── chutes/models/ # Chutes model discovery
│ │ └── debug/retrieve/ # Retrieval debugging endpoint
│ ├── about/ links/ search/ settings/ # Other pages
│ ├── layout.tsx # Root layout with theme provider
│ └── page.tsx # Main chat page
├── bot/ # Discord bot (own package.json)
│ └── src/ # handlers/ (mention, digest, stats) and services/
├── docs/ # Documentation source
│ ├── quilibrium-official/ # ← Synced from GitHub (automated)
│ ├── discord/ # ← Synced from Discord (automated)
│ ├── transcriptions/ # ← Transcripts (committed)
│ └── custom/ # ← Community docs (committed; auto/ is generated)
├── scripts/
│ ├── ingest/ # Ingestion pipeline
│ │ ├── index.ts # CLI orchestrator
│ │ ├── loader.ts # Document loader (.md, .txt)
│ │ ├── chunker.ts # Semantic chunking
│ │ ├── embedder.ts # BGE-M3 embeddings (default)
│ │ ├── embedder-chutes.ts # BGE-M3 embeddings (Chutes)
│ │ └── uploader.ts # Supabase upload + cleanup
│ ├── sync-docs/ # GitHub sync system
│ │ ├── index.ts # CLI orchestrator
│ │ ├── github.ts # GitHub API client
│ │ ├── manifest.ts # Sync state tracking
│ │ ├── diff.ts # Change detection
│ │ └── sync.ts # File sync execution
│ ├── eval/ # QA evaluation harness
│ │ ├── index.ts # CLI entry point
│ │ ├── test-suite-focused.yaml # Default suite (43 cases)
│ │ ├── test-suite.yaml # Broad suite (53 cases)
│ │ ├── runner.ts # Test execution engine
│ │ ├── judge.ts # LLM-as-judge
│ │ ├── stream-parser.ts # AI SDK stream parser
│ │ └── reporter.ts # Terminal + JSON reports
│ ├── sync-discord/ # Discord content sync and recaps
│ ├── sync-techtree.ts # Tech tree sync
│ ├── sync-ecosystem.ts # Ecosystem list sync
│ └── db/
│ └── schema.sql # Supabase schema
├── src/
│ ├── components/
│ │ ├── chat/ # Chat UI components
│ │ ├── sidebar/ # Sidebar components
│ │ └── ui/ # Shared UI components
│ ├── hooks/ # Custom React hooks
│ ├── lib/
│ │ ├── rag/ # RAG retrieval, reranking, prompts
│ │ ├── chutes/ # Chutes helpers
│ │ ├── openrouter.ts # Model definitions
│ │ └── supabase.ts # Database client
│ └── stores/ # Zustand state management
└── .agents/
└── docs/ # Internal documentation
| Variable | Required | Description |
|---|---|---|
NEXT_PUBLIC_SUPABASE_URL |
Yes | Supabase project URL |
SUPABASE_SERVICE_ROLE_KEY |
Yes | Service role key (server-side) |
SUPABASE_URL |
Yes | Supabase URL (for scripts) |
SUPABASE_SERVICE_KEY |
Yes | Service key (for scripts) |
GITHUB_TOKEN |
Yes | For docs sync (no scopes needed) |
OPENROUTER_API_KEY |
Yes | LLM provider key (embeddings and chat) |
NEXT_PUBLIC_FREE_MODE |
No | Serve all users with the server's key |
CHUTES_OAUTH_CLIENT_ID |
No | Chutes OAuth client ID (for Sign in with Chutes) |
CHUTES_OAUTH_CLIENT_SECRET |
No | Chutes OAuth client secret |
CHUTES_API_KEY |
No | Chutes model discovery (OAuth tokens cannot list models) |
CHUTES_OAUTH_SCOPES |
No | OAuth scopes (default: openid profile chutes:invoke) |
NEXT_PUBLIC_APP_URL |
No | Used to build OAuth redirect URL |
CHUTES_OAUTH_REDIRECT_URI |
No | Override redirect URL |
CHUTES_IDP_BASE_URL |
No | Override Chutes IDP base URL |
CHUTES_DEFAULT_MODEL |
No | Default Chutes LLM chute URL |
NEXT_PUBLIC_CHUTES_DEFAULT_MODEL |
No | Client default Chutes model |
CHUTES_EMBEDDING_MODEL |
No | Chutes embedding chute URL |
COHERE_API_KEY |
No | Enables reranking (paid, highest quality) |
CLOUDFLARE_ACCOUNT_ID |
No | Free reranking via Workers AI |
CLOUDFLARE_API_TOKEN |
No | Free reranking via Workers AI |
NEXT_PUBLIC_TURNSTILE_SITE_KEY, TURNSTILE_SECRET_KEY |
No | Cloudflare Turnstile bot protection |
DISCORD_BOT_TOKEN, DISCORD_CLIENT_ID, DISCORD_CHANNEL_IDS |
Bot only | Discord bot and Discord sync |
DEBUG_BYPASS_TOKEN |
No | Lets yarn prod-curl debug production |
See .env.example for the full list, including latency tuning and daily digest settings.
- Framework: Next.js 16 (App Router)
- Styling: Tailwind CSS 4
- State: Zustand + localStorage
- AI: Vercel AI SDK with multiple provider options
- Embeddings: BGE-M3 (1024 dimensions)
- Vector DB: Supabase pgvector
- Reranking: Cohere (paid) or Cloudflare Workers AI (free)
- Bot protection: Cloudflare Turnstile
- Discord bot: discord.js (in
bot/)
Quily is a standard Next.js app, so it runs on any host that supports Next.js (or on your own server with yarn build && yarn start).
- Push to GitHub
- Connect the repo to your host
- Add environment variables
- Deploy
Documentation sync runs automatically via GitHub Actions. Check the Actions tab for run history and status. To trigger manually:
# Or run locally:
yarn sync-docs:ingest# Delete files from ./docs, then:
yarn ingest:cleanyarn sync-docs:force
yarn ingest:clean- Add
.txtor.mdfiles to./docs/transcriptions/or./docs/custom/ - Run
yarn ingest:run
| Issue | Solution |
|---|---|
| Sync rate limited | Add GITHUB_TOKEN to .env |
| Deleted files still in search | Run yarn ingest:clean |
| Embeddings failing | Check OPENROUTER_API_KEY (or CHUTES_API_KEY if you use yarn ingest:run-chutes) |
| Poor search results | Add COHERE_API_KEY for reranking |
For detailed documentation, see .agents/docs/rag-knowledge-base-workflow.md.
- QuilibriumNetwork - Official Quilibrium GitHub organization
- Quilibrium Docs Repo - Source for the RAG knowledge base
- docs.quilibrium.com - Official documentation
- quilibrium.com - Official website
- Community Treasury - Support the project
Quily's answers are only as good as its knowledge base. If you notice something wrong or missing, there are two easy ways to help:
Option 1: Open a GitHub Issue (easiest)
- Go to Issues and click "New Issue"
- Select the "Knowledge Update" template
- Describe what Quily should know (or what it gets wrong)
- The maintainers will review and apply the change
Option 2: Submit a Pull Request
- Fork this repository
- Add or edit a
.mdfile indocs/custom/ - Submit a PR — the maintainers will review, merge, and reingest
Note: Do not edit
docs/quilibrium-official/ordocs/discord/— these are automated mirrors and get overwritten.
- Fork the repository
- Create a feature branch
- Submit a pull request
AGPL-3.0 license
Last updated: 2026-11-17