Thread Chat is a branch-conversation workspace for following an idea without losing the conversation that led to it. Select text in a response, branch from that context, and compare or navigate the resulting threads in columns or on a canvas.
- Live product: https://thread-chat.zilin.im/
- Source repository: https://github.com/hifizz/thread-chatbot
- Start a new branch from any point in a response (with context). Select a phrase, claim, example, or question to open a focused conversation that inherits everything up to that point. The branch can develop independently without cluttering or changing the original thread, and it can split again whenever another idea deserves its own path.
- Navigate the whole conversation as a tree. Keep important threads open side by side in resizable columns, use breadcrumbs and search to move between them, or zoom out to the canvas to see how every conversation connects and return to any branch.
Thread Chat is under active development. The current repository includes authenticated chat, persisted branch trees, column and canvas workspaces, Markdown artifacts, optional attachments, deep research, account flows, and billing integrations. Interfaces and operational integrations may continue to evolve before a stable release.
Current directions include strengthening automated coverage, improving deployment and configuration guidance, and refining the branch-workspace experience across screen sizes. Treat the issue tracker and accepted OpenSpec changes as the source of truth for planned work.
Organized by theme. Priority tag: P0 = highest priority.
- Inherited-context compression - Compress inherited branch context to lower multi-column conversation cost.
- Project workspace - Project-level goals and shared documents.
- In-product memory - Long-term memory geared toward project research.
- Summarize & index - Summarize a column or topic, with indexing and retention.
- Multi-tenant & multi-user - User isolation, with memory scoped per user/project.
- Web search - Bring web search into the conversation.
- DeepResearch - Add deep-research capability.
- Skill system - Web-based Skills and a built-in Skill Creator.
- Sub-agent - Create, monitor, and aggregate multiple Sub-agents.
- Interactive Preview - Render interactive visual artifacts within generated content.
- Markdown rendering enhancements - Refine rendering and essentials, including Mermaid.
- Code-block highlighting - Improve the code-block highlighting experience.
- Markdown artifact display - Refine panel placement and information density.
- HTML generation & preview - Support HTML generation and preview.
- Text-selection toolbar - Quick action bubble on text selection.
- Chat TOC - Side directory navigation per conversation.
- Scroll-to-bottom button - Refine placement and appearance threshold.
- Simplify input area - Streamline the bottom input styling.
- Overall UI micro-polish - Fine-tune UI elements and interaction effects.
- Node.js
>=20.9.0and pnpm (this repository declarespnpm@10.32.1) - A PostgreSQL database
- Credentials for at least one supported model provider; the default model uses MiniMax
Clone the repository and install dependencies:
git clone https://github.com/hifizz/thread-chatbot.git
cd thread-chatbot
pnpm install
cp .env.example .env.localFor the default minimum local setup, set these values in .env.local:
DATABASE_URL=postgres://...
DIRECT_URL=postgres://...
BETTER_AUTH_SECRET=replace-with-a-high-entropy-secret
BETTER_AUTH_URL=http://localhost:3000
MINIMAX_API_KEY=...DATABASE_URL is required by the running application. pnpm db:migrate uses DIRECT_URL when present and otherwise falls back to DATABASE_URL; use a direct database URL for migrations when your runtime URL is a transaction-pooler connection. MINIMAX_BASE_URL and LLM_MODEL_ID have defaults in .env.example, so they are not required for the default setup. A different configured model provider may be used instead of MiniMax, but the default model selection expects MINIMAX_API_KEY.
Apply migrations and start the development server:
pnpm db:migrate
pnpm devOpen http://localhost:3000/thread-chat to enter the Thread Chat workspace. Sign in when prompted; the bare route resumes the most recently opened tree when available, while a tree URL such as /thread-chat/{treeId} identifies a specific persisted conversation.
The following features are opt-in and are not required for the quick start:
- Deep research:
SEARCH_API_KEY(and optionallySEARCH_BASE_URL) - Attachments and PDF processing: Cloudflare R2 variables (
R2_ACCOUNT_ID,R2_ACCESS_KEY_ID,R2_SECRET_ACCESS_KEY,R2_BUCKET) - Large-document vector retrieval:
EMBEDDINGS_BASE_URL,EMBEDDINGS_API_KEY, andEMBEDDINGS_MODEL, plus PostgreSQLpgvector - Additional model providers and gateways: provider keys, Cloudflare AI Gateway, or Vercel AI Gateway variables documented in
.env.example - Email verification, Turnstile, Google sign-in, billing, and Creem payments: their feature-specific variables in
.env.example
Do not commit .env.local or credentials.
The project is a Next.js 16 App Router application using React, TypeScript, Tailwind CSS, Base UI-backed shadcn components, assistant-ui, AI SDK, Drizzle ORM, and PostgreSQL.
| Boundary | Location | Responsibility |
|---|---|---|
| Core | app/thread-chat/core/ |
Tree state, selectors, and the branch-conversation store |
| Branching | app/thread-chat/branching/ |
Text selection, anchors, contextual branches, and branch-aware chat rendering |
| Orchestration | app/thread-chat/orchestration/ |
Column workspace, tree canvas, switching, artifacts, and workbench controls |
| Network | app/thread-chat/net/ |
Tree loading, sanitization, debounced persistence, prompts, and streaming UI events |
| Server | app/api/ and lib/chat/ |
Authentication, model streaming, tool handling, branch-tree APIs, attachments, and research tools |
Detailed design material is available in the repository:
- ChatPDF research and design
- Deep research design
- OpenSpec change records
- Project development guidance
Issues and pull requests are welcome. Please read CONTRIBUTING.md for the pnpm workflow, validation commands, and contribution terms.
Copyright © 2026 hifizz.
Thread Chat is licensed under GNU Affero General Public License v3.0 only (AGPL-3.0-only). This project license does not replace the licenses or notices that apply to third-party dependencies, assets, or separately attributed code.