Skip to content

DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.

docs(readme): adopt ragflow-style pastel language pills

Bingxi Zhao (Frank)2bcc8bfff2a9
diff --git a/README.md b/README.md
index d779dc496..0d53e9892 100644
--- a/README.md
+++ b/README.md
@@ -6,17 +6,19 @@
<a href="https://trendshift.io/repositories/17099" target="_blank"><img src="https://trendshift.io/api/badge/repositories/17099" alt="HKUDS%2FDeepTutor | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
-[![English](https://img.shields.io/badge/English-1f6feb?style=flat-square)](README.md)
-[![简体中文](https://img.shields.io/badge/%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87-868e96?style=flat-square)](assets/README/README_CN.md)
-[![日本語](https://img.shields.io/badge/%E6%97%A5%E6%9C%AC%E8%AA%9E-868e96?style=flat-square)](assets/README/README_JA.md)
-[![Español](https://img.shields.io/badge/Espa%C3%B1ol-868e96?style=flat-square)](assets/README/README_ES.md)
-[![Français](https://img.shields.io/badge/Fran%C3%A7ais-868e96?style=flat-square)](assets/README/README_FR.md)
-[![العربية](https://img.shields.io/badge/%D8%A7%D9%84%D8%B9%D8%B1%D8%A8%D9%8A%D8%A9-868e96?style=flat-square)](assets/README/README_AR.md)
-[![Русский](https://img.shields.io/badge/%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9-868e96?style=flat-square)](assets/README/README_RU.md)
-[![हिन्दी](https://img.shields.io/badge/%E0%A4%B9%E0%A4%BF%E0%A4%A8%E0%A5%8D%E0%A4%A6%E0%A5%80-868e96?style=flat-square)](assets/README/README_HI.md)
-[![Português](https://img.shields.io/badge/Portugu%C3%AAs-868e96?style=flat-square)](assets/README/README_PT.md)
-[![ภาษาไทย](https://img.shields.io/badge/%E0%B8%A0%E0%B8%B2%E0%B8%A9%E0%B8%B2%E0%B9%84%E0%B8%97%E0%B8%A2-868e96?style=flat-square)](assets/README/README_TH.md)
-[![Polski](https://img.shields.io/badge/Polski-868e96?style=flat-square)](assets/README/README_PL.md)
+<p align="center">
+ <a href="README.md"><img alt="English" src="https://img.shields.io/badge/English-DBEDFA"></a>
+ <a href="assets/README/README_CN.md"><img alt="简体中文" src="https://img.shields.io/badge/简体中文-DFE0E5"></a>
+ <a href="assets/README/README_JA.md"><img alt="日本語" src="https://img.shields.io/badge/日本語-DFE0E5"></a>
+ <a href="assets/README/README_ES.md"><img alt="Español" src="https://img.shields.io/badge/Español-DFE0E5"></a>
+ <a href="assets/README/README_FR.md"><img alt="Français" src="https://img.shields.io/badge/Français-DFE0E5"></a>
+ <a href="assets/README/README_AR.md"><img alt="العربية" src="https://img.shields.io/badge/العربية-DFE0E5"></a>
+ <a href="assets/README/README_RU.md"><img alt="Русский" src="https://img.shields.io/badge/Русский-DFE0E5"></a>
+ <a href="assets/README/README_HI.md"><img alt="हिन्दी" src="https://img.shields.io/badge/हिन्दी-DFE0E5"></a>
+ <a href="assets/README/README_PT.md"><img alt="Português" src="https://img.shields.io/badge/Português-DFE0E5"></a>
+ <a href="assets/README/README_TH.md"><img alt="ภาษาไทย" src="https://img.shields.io/badge/ภาษาไทย-DFE0E5"></a>
+ <a href="assets/README/README_PL.md"><img alt="Polski" src="https://img.shields.io/badge/Polski-DFE0E5"></a>
+</p>
[![Python 3.11+](https://img.shields.io/badge/Python-3.11%2B-3776AB?style=flat-square&logo=python&logoColor=white)](https://www.python.org/downloads/)
[![Next.js 16](https://img.shields.io/badge/Next.js-16-000000?style=flat-square&logo=next.js&logoColor=white)](https://nextjs.org/)
@@ -423,26 +425,29 @@ Minimal model setup can be done in the browser: open **Settings → Models**, ad
<img src="assets/figs/deeptutor-architecture.png" alt="DeepTutor Architecture" width="800">
</div>
+The v1.4.0-beta refactor reorganises DeepTutor around **five core surfaces** — Chat, Co-Writer, Book, Knowledge, Space — plus a **three-layer Memory** that sits underneath all of them and a unified **Settings** workbench that exposes every knob. Capabilities (Solve / Quiz / Research / Visualize) and tools (RAG, web, code, reason, brainstorm, paper search, `ask_user`, `web_fetch`, `write_note`, `list_notebook`, `github_query`) compose freely on top.
+
### 💬 Chat — Unified Intelligent Workspace
<div align="center">
<img src="assets/figs/dt-chat.png" alt="Chat Workspace" width="800">
</div>
-Six distinct modes coexist in a single workspace, bound by a **unified context management system**. Conversation history, knowledge bases, and references persist across modes — switch between them freely within the same topic, whenever the moment calls for it.
+One thread, five modes, any tool. The capability picker lives in the composer; the same session, knowledge base, attachments, and references travel with you across modes — switch from a casual question into multi-agent solving, into a quiz, into a full research report, without losing context.
-| Mode | What It Does |
-|:---|:---|
-| **Chat** | Fluid, tool-augmented conversation. Choose from RAG retrieval, web search, code execution, deep reasoning, brainstorming, and paper search — mix and match as needed. |
-| **Deep Solve** | Multi-agent problem solving: plan, investigate, solve, and verify — with precise source citations at every step. |
-| **Quiz Generation** | Generate assessments grounded in your knowledge base, with built-in validation. |
-| **Deep Research** | Decompose a topic into subtopics, dispatch parallel research agents across RAG, web, and academic papers, and produce a fully cited report. |
-| **Math Animator** | Turn mathematical concepts into visual animations and storyboards powered by Manim. |
-| **Visualize** | Generate interactive SVG diagrams, Chart.js charts, Mermaid graphs, or self-contained HTML pages from natural language descriptions. |
+| Mode | What it does | Built on |
+|:---|:---|:---|
+| **Chat** | Flexible conversation with any tool; pick from RAG, web search, code execution, deep reasoning, brainstorming, paper search, GeoGebra analysis. | LlamaIndex-backed RAG + tool registry |
+| **Solve** | Multi-step plan → investigate → solve → verify, with precise source citations. | Agentic engine (`deep_solve`) |
+| **Quiz** | Auto-validated question generation grounded in your KB; spawns a follow-up chat composer per question. | Agentic engine (`deep_question`) |
+| **Research** | Decomposes a topic into subtopics, dispatches parallel agents across RAG / web / arXiv, and produces a cited report with iterative append-mode revisions. | Rebuilt `pipeline.py` (~45% smaller, citations + iterative reporting preserved) |
+| **Visualize** | Generate SVG diagrams, Chart.js charts, Mermaid graphs, interactive HTML pages, **or** Manim videos / storyboards — the analyzer picks the right `render_type`. | Visualize pipeline (Animator merged in) |
+
+**Auto mode** (CLI / API: `deeptutor run auto …`) is a router capability that analyses intent and delegates to the best-matching mode, then synthesises the final response — useful when you want the system to pick the right tool for you.
-Tools are **decoupled from workflows** — in every mode, you decide which tools to enable, how many to use, or whether to use any at all. The workflow orchestrates the reasoning; the tools are yours to compose.
+**New chat tools** shipped with the refactor: `ask_user` (asks a structured clarifying question mid-turn), `web_fetch` (pulls a specific URL into context), `write_note` / `list_notebook` (saves and lists notebook records from the chat surface), and `github_query` (issue / PR / repo lookups). Tools stay **decoupled from workflows** — every mode lets you opt tools in or out per turn.
-> Start with a quick chat question, escalate to Deep Solve when it gets hard, visualize a concept, generate quiz questions to test yourself, then launch a Deep Research to go deeper — all in one continuous thread.
+A session also carries a **cumulative source inventory** across turns, so citations from earlier RAG / web hits remain reusable later in the same conversation.
### ✍️ Co-Writer — Multi-Document AI Writing Workspace
@@ -450,9 +455,9 @@ Tools are **decoupled from workflows** — in every mode, you decide which tools
<img src="assets/figs/dt-cowriter.png" alt="Co-Writer" width="800">
</div>
-Co-Writer brings the intelligence of Chat directly into a writing surface. Create and manage multiple documents, each persisted in its own workspace — not a single throwaway scratchpad, but a full-featured multi-document Markdown editor where AI is a first-class collaborator.
+Co-Writer is a split-view Markdown workbench (raw editor on the left, live preview on the right) for notes, reports, tutorials, and AI-assisted drafts. Each document lives in its own workspace with autosave, downloadable Markdown, and one-click **Save to Notebook**.
-Select any text and choose **Rewrite**, **Expand**, or **Shorten** — optionally drawing context from your knowledge base or the web. The editing flow is non-destructive with full undo/redo, and every piece you write can be saved straight to your notebooks, feeding back into your learning ecosystem.
+Select any text and choose **Rewrite**, **Expand**, or **Shorten** — every action runs as a tracked agent edit that can optionally pull from a knowledge base or the web. Co-Writer renders standard Markdown / CommonMark / GFM (tables, code, math, flowcharts, sequence diagrams), supports a HTML tag escape hatch (`<sub>`, `<sup>`, `<abbr>`, `<mark>`), and ships a starter template tuned for DeepTutor product docs and learning notes.
### 📖 Book Engine — Interactive "Living Books"
@@ -462,37 +467,77 @@ Select any text and choose **Rewrite**, **Expand**, or **Shorten** — optionall
Give DeepTutor a topic, point it at your knowledge base, and it produces a structured, interactive book — not a static export, but a living document you can read, quiz yourself on, and discuss in context.
-Behind the scenes, a multi-agent pipeline handles the heavy lifting: proposing an outline, retrieving relevant sources from your knowledge base, synthesizing a chapter tree, planning each page, and compiling every block. You stay in control — review the proposal, reorder chapters, and chat alongside any page.
+Behind the scenes, a multi-agent pipeline handles the heavy lifting: proposing an outline, retrieving relevant sources from your KB, synthesising a chapter tree, planning each page, and compiling every block. You stay in control — review the proposal, reorder chapters, and chat alongside any page.
-Pages are assembled from 13 block types — text, callout, quiz, flash cards, code, figure, deep dive, animation, interactive demo, timeline, concept graph, section, and user note — each rendered with its own interactive component. A real-time progress timeline lets you watch compilation unfold as the book takes shape.
+Pages are assembled from 13 block types — text, callout, quiz, flash cards, code, figure, deep dive, animation, interactive demo (now including a **GeoGebra viewer**), timeline, concept graph, section, and user note — each rendered with its own interactive component. Book pages are fingerprinted against their source KB; `deeptutor book health` reports drift and `deeptutor book refresh-fingerprints` clears stale pages when sources change.
-### 📚 Knowledge Management — Your Learning Infrastructure
+### 📚 Knowledge Bases — RAG-Ready Document Libraries
<div align="center">
-<img src="assets/figs/dt-knowledge.png" alt="Knowledge Management" width="800">
+<img src="assets/figs/dt-kb.png" alt="Knowledge Bases" width="800">
</div>
-Knowledge is where you build and manage the document collections, notes, and teaching personas that power everything else in DeepTutor.
+A dedicated workspace for the document collections that power RAG. Each knowledge base has four tabs:
-- **Knowledge Bases** — Upload PDFs, Office files (DOCX/XLSX/PPTX), Markdown, and a wide range of text and code files to create searchable, RAG-ready collections. Add documents incrementally as your library grows.
-- **Notebooks** — Organize learning records across sessions. Save insights from Chat, Co-Writer, Book, or Deep Research into categorized, color-coded notebooks.
-- **Question Bank** — Browse and revisit all generated quiz questions. Bookmark entries and @-mention them directly in chat to reason over past performance.
-- **Skills** — Create custom teaching personas via `SKILL.md` files. Each skill defines a name, description, optional triggers, and a Markdown body that is injected into the chat system prompt when active — turning DeepTutor into a Socratic tutor, a peer study partner, a research assistant, or any role you design.
+- **Files** — Browse uploaded sources, preview PDFs inline, and see per-file size / status.
+- **Add documents** — Drop in PDFs, Office files (DOCX / XLSX / PPTX), Markdown, plain text, and a wide range of code / data file types. Documents are routed through the appropriate extractor automatically.
+- **Index versions** — Every (re-)index is a tracked version. Roll back to an earlier index, compare embedding models, or inspect chunking stats without losing the previous build.
+- **Settings** — Pick the embedding provider / model, chunking parameters, and reranker for the KB. Defaults are inherited from your global LLM and embedding profiles.
-Your knowledge base is not passive storage — it actively participates in every conversation, every research session, and every learning path you create.
+Indexing is built on **LlamaIndex** end-to-end (the previous dual-pipeline split was consolidated in the v1.4 refactor), with retry-safe re-index, embedding-mismatch detection, and resilient handling of corrupt persisted vectors.
-### 🧠 Memory — DeepTutor Learns As You Learn
+### 🌐 Space — Your Personal Learning Library
<div align="center">
-<img src="assets/figs/dt-memory.png" alt="Memory" width="800">
+<img src="assets/figs/dt-space.png" alt="Space" width="800">
</div>
-DeepTutor maintains a persistent, evolving understanding of you through two complementary dimensions:
+Space is the **read / review** counterpart to the active surfaces. Where Chat / Co-Writer / Book are where you *produce*, Space is where everything you produce lives, searchable and replayable.
-- **Summary** — A running digest of your learning progress: what you've studied, which topics you've explored, and how your understanding has developed.
-- **Profile** — Your learner identity: preferences, knowledge level, goals, and communication style — automatically refined through every interaction.
+- **Chat History** — Every conversation across every mode, with title-rename, delete, and resume; deleting individual turns is supported on every entry point.
+- **Notebooks** — Save outputs from Chat, Research, and Co-Writer into categorised, colour-coded notebooks; each record links back to the originating session and surface.
+- **Question Bank** — Every auto-generated quiz question, bookmarkable and @-mention-able in chat to reason over past performance.
+- **Skills** — User-authored `SKILL.md` files that define teaching personas (name, description, triggers, body). When active, a skill is injected into the chat system prompt — turning DeepTutor into a Socratic tutor, a research assistant, or any role you design.
-Memory is shared across all features and all your TutorBots. The more you use DeepTutor, the more personalized and effective it becomes.
+### 🧠 Memory — Three-Layer Architecture
+
+<div align="center">
+<img src="assets/figs/dt-memory.png" alt="Memory Workbench" width="800">
+</div>
+
+DeepTutor's memory is now a **three-layer pipeline** with an inspectable workbench at `/memory`. The two-file v1 `SUMMARY.md` / `PROFILE.md` model is gone; everything is migrated into the new layout on first boot.
+
+| Layer | Role | Storage |
+|:---|:---|:---|
+| **L1 · Workspace mirror** (LIVE) | Append-only trace of every interaction, per surface, per day. The lossless record of what actually happened. | `trace/<surface>/<YYYY-MM-DD>.jsonl` |
+| **L2 · Per-surface summaries** (CURATED) | Surface-specific facts extracted by the consolidator. Each fact carries footnote citations back to L1 traces. Supports per-doc **Update / Audit / Dedup** runs. | `L2/<surface>.md` |
+| **L3 · Cross-surface knowledge** (SYNTHESIS) | Cross-surface synthesis: your `profile`, `recent` timeline, `scope` of knowledge, and `preferences`. Hedged claims, each backed by L2 evidence. | `L3/<recent\|profile\|scope\|preferences>.md` |
+
+Seven surfaces feed the pipeline: **chat, notebook, quiz, kb, book, tutorbot, cowriter**. The consolidator is LLM-driven and runs asynchronously (`POST /memory/runs/start`) — you can fire it from the workbench, watch L1 → L2 → L3 propagate, and edit any layer by hand.
+
+<div align="center">
+<img src="assets/figs/dt-memgraph.png" alt="Memory Graph" width="800">
+</div>
+
+The **Memory Graph** (`/memory/graph`) renders all three layers at once: L3 synthesis at the centre, L2 facts in the middle ring, L1 traces on the outside, grouped by surface. Hover any node for an inline preview; click to lock the highlight and trace the L3 → L2 → L1 references inward, so you can audit *why* DeepTutor "knows" something about you.
+
+### ⚙️ Settings — Unified Control Center
+
+<div align="center">
+<img src="assets/figs/dt-settings.png" alt="Settings" width="800">
+</div>
+
+The settings surface was unified in v1.4 and split by concern, with a draft / **Apply** model so changes are atomic and can be reverted before save:
+
+- **Appearance** — UI language and theme (Cream, Snow, Dark, Glass).
+- **Status** — Live health probe across LLM, embedding, search, and storage backends.
+- **LLM**, **Embedding**, **Search** — Provider catalog, base URLs, API keys, and active model selection. Active models are picked from the catalog so every surface stays in sync.
+- **Capabilities** — Per-capability tunables (chunking, LLM budget, dedup and reference policies, max iterations) for Chat, Solve, Quiz, Research, Visualize, and Co-Writer. Backed by a unified `emit_capability_result` envelope and a shared `UsageTracker` that surfaces per-call cost.
+- **Memory** — Toggle consolidator runs, configure cadence and budget, and jump into the memory workbench.
+- **MCP servers** — Register external Model Context Protocol servers; their tools are surfaced alongside built-in tools.
+- **Tools** — Inspect every built-in tool, its parameters, status (enabled / coming-soon), and i18n status copy.
+
+A "Tour" launcher walks new users through the page, and every capability ships a canonical `capabilities/prompts/{en,zh}/<name>.yaml` so status messages stay consistent in both English and 中文.
---
@@ -505,7 +550,7 @@ Memory is shared across all features and all your TutorBots. The more you use De
TutorBot is not a chatbot — it is a **persistent, multi-instance agent** built on [nanobot](https://github.com/HKUDS/nanobot). Each TutorBot runs its own agent loop with independent workspace, memory, and personality. Create a Socratic math tutor, a patient writing coach, and a rigorous research advisor — all running simultaneously, each evolving with you.
<div align="center">
-<img src="assets/figs/tb.png" alt="TutorBot" width="800">
+<img src="assets/figs/dt-tutorbot.png" alt="TutorBot Agents" width="800">
</div>
- **Soul Templates** — Define your tutor's personality, tone, and teaching philosophy through editable Soul files. Choose from built-in archetypes (Socratic, encouraging, rigorous) or craft your own — the soul shapes every response.
@@ -728,21 +773,6 @@ multi-user/
> ⚠️ **Single-process recommendation.** The first-user-becomes-admin promotion is protected by an in-process `threading.Lock`. Multi-worker deployments should provision the first admin offline (start with `auth.json.enabled=false`, register the admin via the bootstrap flow, then set `auth.json.enabled=true`) or back the user store with an external system.
-## 🗺️ Roadmap
-
-| Status | Milestone |
-|:---:|:---|
-| 🎯 | **Authentication & Login** — Optional login page for public deployments with multi-user support |
-| 🎯 | **Themes & Appearance** — Diverse theme options and customizable UI appearance |
-| 🎯 | **Interaction Improvement** — optimize icon design and interaction details |
-| 🔜 | **Better Memories** — integrating better memory management |
-| 🔜 | **LightRAG Integration** — Integrate [LightRAG](https://github.com/HKUDS/LightRAG) as an advanced knowledge base engine |
-| 🔜 | **Documentation Site** — Comprehensive docs page with guides, API reference, and tutorials |
-
-> If you find DeepTutor useful, [give us a star](https://github.com/HKUDS/DeepTutor/stargazers) — it helps us keep going!
-
----
-
## 🌐 Community & Ecosystem
DeepTutor stands on the shoulders of outstanding open-source projects: