How karan-17/livin-book works
Novel Agent ingests a book into chapter-aware passage and summary indexes plus structured literary knowledge, then answers multi-turn reader questions through a planned, tool-using LangGraph agent. The main query path runs from terminal or Streamlit through the event runner, graph, and tools to hybrid retrieval or knowledge lookups, with citations returned to the UI. Memory adds thread history and reader preferences/spoiler limits. The README documents several connections; some implementation details are unsampled, so those relationships are shown only where documented or indexed.
Main entry points: ingest.py Ingestion CLI · resources.py Book resources · graph.py Reasoning graph · config.py Model configuration
Components 24
Book ingestion
- Ingestion CLI
novel_agent/ingest.py - Book sources
novel_agent/loaders.py - Book presets
novel_agent/books.py - Chapter splitting
novel_agent/chapters.py - Passage chunking
novel_agent/chunking.py - Literary enrichment
novel_agent/enrich.py - Index builder
novel_agent/indexing.py
Conversation and reasoning
- Prompt templates
novel_agent/prompts.py - Agent tools
novel_agent/tools.py - Reasoning graph
novel_agent/graph.py - Turn event runner
novel_agent/runner.py - Terminal chat
novel_agent/chat.py - Streamlit UI
app.py
Retrieval and knowledge
- Chroma indexes
- Book knowledge
- Book resources
novel_agent/resources.py - Hybrid retrieval
novel_agent/retrieval.py - Knowledge lookups
novel_agent/knowledge.py - BM25 corpus
Reader memory
- Thread and profile memory
novel_agent/memory.py
Model services
- Model configuration
novel_agent/config.py - Gemini API
- Voyage API
Other components
- Reader
Connections 32
- Reader → Terminal chat: asks questions
README.md - Reader → Streamlit UI: asks questions
README.md - Ingestion CLI → Book sources: loads book
novel_agent/ingest.py - Ingestion CLI → Book presets: selects preset
novel_agent/ingest.py - Ingestion CLI → Chapter splitting: splits chapters
novel_agent/ingest.py - Ingestion CLI → Passage chunking: creates chunks
novel_agent/ingest.py - Ingestion CLI → Index builder: builds indexes
README.md - Ingestion CLI → Literary enrichment: enriches chapters
README.md - Literary enrichment → Prompt templates: uses templates
novel_agent/enrich.py - Literary enrichment → Book knowledge: writes knowledge
novel_agent/enrich.py - Index builder → Chroma indexes: stores vectors
novel_agent/indexing.py - Index builder → BM25 corpus: saves chunks
novel_agent/indexing.py - Index builder → Model configuration: gets settings
novel_agent/indexing.py - Model configuration → Voyage API: creates embeddings
README.md - Book resources → Chroma indexes: opens collections
novel_agent/resources.py - Book resources → BM25 corpus: loads documents
novel_agent/resources.py - Book resources → Book knowledge: loads knowledge
novel_agent/resources.py - Book resources → Hybrid retrieval: builds retrievers
novel_agent/resources.py - Book resources → Knowledge lookups: loads lookups
novel_agent/resources.py - Model configuration → Voyage API: creates reranker
README.md - Terminal chat → Turn event runner: streams turns
novel_agent/chat.py - Streamlit UI → Turn event runner: streams turns
app.py - Turn event runner → Reasoning graph: streams graph
novel_agent/runner.py - Reasoning graph → Agent tools: dispatches tools
novel_agent/graph.py - Agent tools → Book resources: uses book data
novel_agent/tools.py - Agent tools → Thread and profile memory: updates profile
novel_agent/tools.py - Reasoning graph → Thread and profile memory: manages thread
novel_agent/graph.py - Reasoning graph → Prompt templates: uses templates
novel_agent/graph.py - Reasoning graph → Model configuration: gets model
novel_agent/graph.py - Model configuration → Gemini API: creates chat models
README.md - Hybrid retrieval → Voyage API: reranks results
README.md - Streamlit UI → Reader: shows answers
app.py