How ahaugusto/tusab works
Tusab is a local-first personal knowledge system: users ingest videos, documents, text, or public research sources; the backend stores and indexes that material, then answers chat queries with retrieved passages and source citations. The graph separates ingestion, retrieval/chat, and study workflows, plus the API/UI and shared persistence layers. README statements support several capabilities whose source was not sampled; those links are documented relationships, not claims of source-level inspection.
Main entry points: api_tusab.py REST application · index.py Chunk indexing · chat.py Cited RAG chat · api.js API client
Components 24
Client experience
- Tusab interface
web_interface/src/App.jsx - Chat controls
web_interface/src/hooks/useChatEngine.js - API client
web_interface/src/services/api.js
API and integration
- REST application
api_tusab.py - Agent routes
tusab_engine/api/router_agent.py - Ingestion routes
tusab_engine/api/router_extraction.py - Repository routes
tusab_engine/api/router_repositorio.py - Study routes
tusab_engine/api/router_estudo.py - MCP server
tusab_engine/mcp_server.py
Knowledge ingestion
- YouTube extraction
tusab_engine/motor/extraction.py - Public source search
tusab_engine/motor/fontes - Clinical study search
tusab_engine/motor/fhir.py - Document processing
tusab_engine/api/router_repositorio.py
Retrieval and study
- Chunk indexing
tusab_engine/agent/index.py - Hybrid retrieval
tusab_engine/agent/fts.py - Cited RAG chat
tusab_engine/agent/chat.py - Model providers
tusab_engine/agent/llm_providers.py - Study materials
tusab_engine/api/router_estudo.py
Shared foundation
- Local data storage
tusab_engine/storage.py - Runtime state
tusab_engine/state.py
Other components
- Learner
- Google Drive
- LLM services
- MCP-compatible tools
Connections 30
- Learner → Tusab interface: uses
- Tusab interface → API client: requests
web_interface/src/App.jsx - Chat controls → API client: streams chat
web_interface/src/hooks/useChatEngine.js - REST application → Agent routes: registers
api_tusab.py - REST application → Ingestion routes: registers
api_tusab.py - REST application → Repository routes: registers
api_tusab.py - REST application → Study routes: registers
api_tusab.py - API client → REST application: calls REST
- Ingestion routes → YouTube extraction: invokes extraction
tusab_engine/api/router_extraction.py - Repository routes → Document processing: receives uploads
tusab_engine/api/router_repositorio.py - Ingestion routes → Public source search: dispatches searches
- Repository routes → Clinical study search: searches studies
tusab_engine/api/router_repositorio.py - YouTube extraction → Chunk indexing: indexes content
- Public source search → Chunk indexing: indexes results
- Clinical study search → Chunk indexing: indexes results
- Document processing → Chunk indexing: indexes content
- Agent routes → Chunk indexing: requests indexing
tusab_engine/api/router_agent.py - Agent routes → Cited RAG chat: dispatches chat
tusab_engine/api/router_agent.py - Chat controls → API client: resumes context
web_interface/src/hooks/useChatEngine.js - Cited RAG chat → Hybrid retrieval: retrieves passages
tusab_engine/agent/chat.py - Cited RAG chat → Model providers: generates answer
tusab_engine/agent/chat.py - Model providers → LLM services: sends prompts
- Cited RAG chat → Local data storage: reads and writes
tusab_engine/agent/chat.py - Chunk indexing → Local data storage: stores index
tusab_engine/agent/index.py - Study routes → Study materials: serves study mode
tusab_engine/api/router_estudo.py - Study materials → Local data storage: saves study items
tusab_engine/api/router_estudo.py - REST application → Runtime state: shares runtime state
api_tusab.py - MCP-compatible tools → MCP server: queries knowledge
- MCP server → Cited RAG chat: queries assistant
- Tusab interface → Google Drive: backs up optionally