<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What classes and functions are in GUI/router.py?<|im_end|>
<|im_start|>assistant
**GUI/router.py** — Main FastAPI router defining most API endpoints

**Lines**: 5085
**Classes** (17): JournalEntry, Task, EmailDraft, EmailDraftLaunchRequest, ChatRequest, SemanticSearchRequest, SemanticGraphBonesRequest, ModelEndpointRequest, ... (+9 more)
**Functions** (172): _add_extension_venv_site_packages, _normalize_context_window_tokens, _validate_endpoint_context_window_tokens, _ai_request_timeout, _chat_generation_timeout, _chat_max_output_tokens, _chat_temperature, _load_extension_module, resolve_data_dir, save_msal_cache, ... (+162 more)
<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What classes and functions are in GUI/router.py?

[Assistant]
**GUI/router.py** — Main FastAPI router defining most API endpoints

**Lines**: 5085
**Classes** (17): JournalEntry, Task, EmailDraft, EmailDraftLaunchRequest, ChatRequest, SemanticSearchRequest, SemanticGraphBonesRequest, ModelEndpointRequest, ... (+9 more)
**Functions** (172): _add_extension_venv_site_packages, _normalize_context_window_tokens, _validate_endpoint_context_window_tokens, _ai_request_timeout, _chat_generation_timeout, _chat_max_output_tokens, _chat_temperature, _load_extension_module, resolve_data_dir, save_msal_cache, ... (+162 more)


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `resolve_data_dir()` function in `GUI/router.py` do?<|im_end|>
<|im_start|>assistant
**`resolve_data_dir()`** in `GUI/router.py`:
```python
def resolve_data_dir() -> Path:
```

This function is part of the main fastapi router defining most api endpoints.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `resolve_data_dir()` function in `GUI/router.py` do?

[Assistant]
**`resolve_data_dir()`** in `GUI/router.py`:
```python
def resolve_data_dir() -> Path:
```

This function is part of the main fastapi router defining most api endpoints.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `save_msal_cache()` function in `GUI/router.py` do?<|im_end|>
<|im_start|>assistant
**`save_msal_cache()`** in `GUI/router.py`:
```python
def save_msal_cache():
```

---------- API key encryption helpers ----------<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `save_msal_cache()` function in `GUI/router.py` do?

[Assistant]
**`save_msal_cache()`** in `GUI/router.py`:
```python
def save_msal_cache():
```

---------- API key encryption helpers ----------


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `init_db()` function in `GUI/router.py` do?<|im_end|>
<|im_start|>assistant
**`init_db()`** in `GUI/router.py`:
```python
def init_db():
```

This function is part of the main fastapi router defining most api endpoints.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `init_db()` function in `GUI/router.py` do?

[Assistant]
**`init_db()`** in `GUI/router.py`:
```python
def init_db():
```

This function is part of the main fastapi router defining most api endpoints.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `normalize_email_status()` function in `GUI/router.py` do?<|im_end|>
<|im_start|>assistant
**`normalize_email_status()`** in `GUI/router.py`:
```python
def normalize_email_status(value: Optional[str]) -> str:
```

This function is part of the main fastapi router defining most api endpoints.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `normalize_email_status()` function in `GUI/router.py` do?

[Assistant]
**`normalize_email_status()`** in `GUI/router.py`:
```python
def normalize_email_status(value: Optional[str]) -> str:
```

This function is part of the main fastapi router defining most api endpoints.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `normalize_task_color()` function in `GUI/router.py` do?<|im_end|>
<|im_start|>assistant
**`normalize_task_color()`** in `GUI/router.py`:
```python
def normalize_task_color(value: Optional[str]) -> Optional[str]:
```

This function is part of the main fastapi router defining most api endpoints.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `normalize_task_color()` function in `GUI/router.py` do?

[Assistant]
**`normalize_task_color()`** in `GUI/router.py`:
```python
def normalize_task_color(value: Optional[str]) -> Optional[str]:
```

This function is part of the main fastapi router defining most api endpoints.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `validate_extension_manifest()` function in `GUI/router.py` do?<|im_end|>
<|im_start|>assistant
**`validate_extension_manifest()`** in `GUI/router.py`:
```python
def validate_extension_manifest(req: ExtensionManifestValidationRequest):
```

This function is part of the main fastapi router defining most api endpoints.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `validate_extension_manifest()` function in `GUI/router.py` do?

[Assistant]
**`validate_extension_manifest()`** in `GUI/router.py`:
```python
def validate_extension_manifest(req: ExtensionManifestValidationRequest):
```

This function is part of the main fastapi router defining most api endpoints.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What is the purpose of `GUI/router.py`?<|im_end|>
<|im_start|>assistant
**`GUI/router.py`** — Main FastAPI router defining most API endpoints

This module contains 5085 lines of Python code with 17 class(es) and 172 function(s). It defines FastAPI route handlers for various endpoints.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What is the purpose of `GUI/router.py`?

[Assistant]
**`GUI/router.py`** — Main FastAPI router defining most API endpoints

This module contains 5085 lines of Python code with 17 class(es) and 172 function(s). It defines FastAPI route handlers for various endpoints.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What classes and functions are in GUI/pdf_parser.py?<|im_end|>
<|im_start|>assistant
**GUI/pdf_parser.py** — PDF parsing and document management

**Lines**: 5949
**Classes** (3): DatabaseManager, RAGManager, TopicUpdateRequest
**Functions** (30): normalize_rerank_candidate_k, normalize_chunking_engine, resolve_data_dir, set_configured_endpoint_caller, set_reranker_model_path, _get_reranker, load_documents_from_db, call_configured_pdf_endpoint, cancel_configured_pdf_endpoint, _clean_graph_analysis_cache_key, ... (+20 more)
**Async functions** (53): root, health_check, get_graph_analysis_cache, save_graph_analysis_cache, delete_graph_analysis_cache, ... (+48 more)
<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What classes and functions are in GUI/pdf_parser.py?

[Assistant]
**GUI/pdf_parser.py** — PDF parsing and document management

**Lines**: 5949
**Classes** (3): DatabaseManager, RAGManager, TopicUpdateRequest
**Functions** (30): normalize_rerank_candidate_k, normalize_chunking_engine, resolve_data_dir, set_configured_endpoint_caller, set_reranker_model_path, _get_reranker, load_documents_from_db, call_configured_pdf_endpoint, cancel_configured_pdf_endpoint, _clean_graph_analysis_cache_key, ... (+20 more)
**Async functions** (53): root, health_check, get_graph_analysis_cache, save_graph_analysis_cache, delete_graph_analysis_cache, ... (+48 more)


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `normalize_rerank_candidate_k()` function in `GUI/pdf_parser.py` do?<|im_end|>
<|im_start|>assistant
**`normalize_rerank_candidate_k()`** in `GUI/pdf_parser.py`:
```python
def normalize_rerank_candidate_k(top_k: int, candidate_k: Optional[int] = None) -> int:
```

This function is part of the pdf parsing and document management.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `normalize_rerank_candidate_k()` function in `GUI/pdf_parser.py` do?

[Assistant]
**`normalize_rerank_candidate_k()`** in `GUI/pdf_parser.py`:
```python
def normalize_rerank_candidate_k(top_k: int, candidate_k: Optional[int] = None) -> int:
```

This function is part of the pdf parsing and document management.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `normalize_chunking_engine()` function in `GUI/pdf_parser.py` do?<|im_end|>
<|im_start|>assistant
**`normalize_chunking_engine()`** in `GUI/pdf_parser.py`:
```python
def normalize_chunking_engine(value: Optional[str]) -> str:
```

This function is part of the pdf parsing and document management.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `normalize_chunking_engine()` function in `GUI/pdf_parser.py` do?

[Assistant]
**`normalize_chunking_engine()`** in `GUI/pdf_parser.py`:
```python
def normalize_chunking_engine(value: Optional[str]) -> str:
```

This function is part of the pdf parsing and document management.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `resolve_data_dir()` function in `GUI/pdf_parser.py` do?<|im_end|>
<|im_start|>assistant
**`resolve_data_dir()`** in `GUI/pdf_parser.py`:
```python
def resolve_data_dir() -> Path:
```

Create directories if they don't exist<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `resolve_data_dir()` function in `GUI/pdf_parser.py` do?

[Assistant]
**`resolve_data_dir()`** in `GUI/pdf_parser.py`:
```python
def resolve_data_dir() -> Path:
```

Create directories if they don't exist


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `set_configured_endpoint_caller()` function in `GUI/pdf_parser.py` do?<|im_end|>
<|im_start|>assistant
**`set_configured_endpoint_caller()`** in `GUI/pdf_parser.py`:
```python
def set_configured_endpoint_caller(caller: Any) -> None:
```

This function is part of the pdf parsing and document management.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `set_configured_endpoint_caller()` function in `GUI/pdf_parser.py` do?

[Assistant]
**`set_configured_endpoint_caller()`** in `GUI/pdf_parser.py`:
```python
def set_configured_endpoint_caller(caller: Any) -> None:
```

This function is part of the pdf parsing and document management.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `set_reranker_model_path()` function in `GUI/pdf_parser.py` do?<|im_end|>
<|im_start|>assistant
**`set_reranker_model_path()`** in `GUI/pdf_parser.py`:
```python
def set_reranker_model_path(path: Optional[str]) -> None:
```

This function is part of the pdf parsing and document management.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `set_reranker_model_path()` function in `GUI/pdf_parser.py` do?

[Assistant]
**`set_reranker_model_path()`** in `GUI/pdf_parser.py`:
```python
def set_reranker_model_path(path: Optional[str]) -> None:
```

This function is part of the pdf parsing and document management.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `load_documents_from_db()` function in `GUI/pdf_parser.py` do?<|im_end|>
<|im_start|>assistant
**`load_documents_from_db()`** in `GUI/pdf_parser.py`:
```python
def load_documents_from_db():
```

This function is part of the pdf parsing and document management.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `load_documents_from_db()` function in `GUI/pdf_parser.py` do?

[Assistant]
**`load_documents_from_db()`** in `GUI/pdf_parser.py`:
```python
def load_documents_from_db():
```

This function is part of the pdf parsing and document management.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What is the purpose of `GUI/pdf_parser.py`?<|im_end|>
<|im_start|>assistant
**`GUI/pdf_parser.py`** — PDF parsing and document management

This module contains 5949 lines of Python code with 3 class(es) and 30 function(s). It handles PDF document parsing, chunking, and text extraction using PyMuPDF.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What is the purpose of `GUI/pdf_parser.py`?

[Assistant]
**`GUI/pdf_parser.py`** — PDF parsing and document management

This module contains 5949 lines of Python code with 3 class(es) and 30 function(s). It handles PDF document parsing, chunking, and text extraction using PyMuPDF.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What classes and functions are in GUI/chat_streaming.py?<|im_end|>
<|im_start|>assistant
**GUI/chat_streaming.py** — Chat streaming and context assembly

**Lines**: 3119
**Classes** (3): PdfChatStreamRequest, PdfVisualizationPlan, VisualizationPlanError
**Functions** (78): _sanitize_visualization_plan_text, _normalize_pdf_conversation_context, configure, stream_json_event, _require_pdf_service, _session_db_path, _connect_session_db, _init_session_db, _ensure_session_column, _session_now, ... (+68 more)
**Async functions** (1): upload_session_document
<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What classes and functions are in GUI/chat_streaming.py?

[Assistant]
**GUI/chat_streaming.py** — Chat streaming and context assembly

**Lines**: 3119
**Classes** (3): PdfChatStreamRequest, PdfVisualizationPlan, VisualizationPlanError
**Functions** (78): _sanitize_visualization_plan_text, _normalize_pdf_conversation_context, configure, stream_json_event, _require_pdf_service, _session_db_path, _connect_session_db, _init_session_db, _ensure_session_column, _session_now, ... (+68 more)
**Async functions** (1): upload_session_document


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `configure()` function in `GUI/chat_streaming.py` do?<|im_end|>
<|im_start|>assistant
**`configure()`** in `GUI/chat_streaming.py`:
```python
def configure(
```

This function is part of the chat streaming and context assembly.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `configure()` function in `GUI/chat_streaming.py` do?

[Assistant]
**`configure()`** in `GUI/chat_streaming.py`:
```python
def configure(
```

This function is part of the chat streaming and context assembly.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `stream_json_event()` function in `GUI/chat_streaming.py` do?<|im_end|>
<|im_start|>assistant
**`stream_json_event()`** in `GUI/chat_streaming.py`:
```python
def stream_json_event(event_type: str, **payload: Any) -> str:
```

This function is part of the chat streaming and context assembly.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `stream_json_event()` function in `GUI/chat_streaming.py` do?

[Assistant]
**`stream_json_event()`** in `GUI/chat_streaming.py`:
```python
def stream_json_event(event_type: str, **payload: Any) -> str:
```

This function is part of the chat streaming and context assembly.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `list_session_documents()` function in `GUI/chat_streaming.py` do?<|im_end|>
<|im_start|>assistant
**`list_session_documents()`** in `GUI/chat_streaming.py`:
```python
def list_session_documents(session_id: str) -> Dict[str, Any]:
```

This function is part of the chat streaming and context assembly.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `list_session_documents()` function in `GUI/chat_streaming.py` do?

[Assistant]
**`list_session_documents()`** in `GUI/chat_streaming.py`:
```python
def list_session_documents(session_id: str) -> Dict[str, Any]:
```

This function is part of the chat streaming and context assembly.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `clear_session_documents()` function in `GUI/chat_streaming.py` do?<|im_end|>
<|im_start|>assistant
**`clear_session_documents()`** in `GUI/chat_streaming.py`:
```python
def clear_session_documents(session_id: str) -> Dict[str, Any]:
```

This function is part of the chat streaming and context assembly.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `clear_session_documents()` function in `GUI/chat_streaming.py` do?

[Assistant]
**`clear_session_documents()`** in `GUI/chat_streaming.py`:
```python
def clear_session_documents(session_id: str) -> Dict[str, Any]:
```

This function is part of the chat streaming and context assembly.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `delete_session_document()` function in `GUI/chat_streaming.py` do?<|im_end|>
<|im_start|>assistant
**`delete_session_document()`** in `GUI/chat_streaming.py`:
```python
def delete_session_document(doc_id: str, session_id: str) -> Dict[str, Any]:
```

This function is part of the chat streaming and context assembly.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `delete_session_document()` function in `GUI/chat_streaming.py` do?

[Assistant]
**`delete_session_document()`** in `GUI/chat_streaming.py`:
```python
def delete_session_document(doc_id: str, session_id: str) -> Dict[str, Any]:
```

This function is part of the chat streaming and context assembly.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `stream_pdf_chat()` function in `GUI/chat_streaming.py` do?<|im_end|>
<|im_start|>assistant
**`stream_pdf_chat()`** in `GUI/chat_streaming.py`:
```python
def stream_pdf_chat(request: PdfChatStreamRequest):
```

This function is part of the chat streaming and context assembly.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `stream_pdf_chat()` function in `GUI/chat_streaming.py` do?

[Assistant]
**`stream_pdf_chat()`** in `GUI/chat_streaming.py`:
```python
def stream_pdf_chat(request: PdfChatStreamRequest):
```

This function is part of the chat streaming and context assembly.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What is the purpose of `GUI/chat_streaming.py`?<|im_end|>
<|im_start|>assistant
**`GUI/chat_streaming.py`** — Chat streaming and context assembly

This module contains 3119 lines of Python code with 3 class(es) and 78 function(s). It manages LLM chat interactions, streaming, and context assembly.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What is the purpose of `GUI/chat_streaming.py`?

[Assistant]
**`GUI/chat_streaming.py`** — Chat streaming and context assembly

This module contains 3119 lines of Python code with 3 class(es) and 78 function(s). It manages LLM chat interactions, streaming, and context assembly.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What classes and functions are in GUI/discord_bot.py?<|im_end|>
<|im_start|>assistant
**GUI/discord_bot.py** — Discord bot integration

**Lines**: 2844
**Classes** (1): SimpleRAGBackendError
**Functions** (98): _web_evidence_system_prompt, _normalize_web_length_limit_notice, _strip_web_length_limit_notice, _claim_discord_dispatch, _claim_interaction_dispatch, _acquire_windows_named_mutex, _release_windows_named_mutex, _acquire_discord_single_instance, _normalize_text, _import_web_search_runtime, ... (+88 more)
**Async functions** (17): read_discord_attachments, _send_channel_response, _run_backend_query, _send_interaction_response, setup_hook, ... (+12 more)
<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What classes and functions are in GUI/discord_bot.py?

[Assistant]
**GUI/discord_bot.py** — Discord bot integration

**Lines**: 2844
**Classes** (1): SimpleRAGBackendError
**Functions** (98): _web_evidence_system_prompt, _normalize_web_length_limit_notice, _strip_web_length_limit_notice, _claim_discord_dispatch, _claim_interaction_dispatch, _acquire_windows_named_mutex, _release_windows_named_mutex, _acquire_discord_single_instance, _normalize_text, _import_web_search_runtime, ... (+88 more)
**Async functions** (17): read_discord_attachments, _send_channel_response, _run_backend_query, _send_interaction_response, setup_hook, ... (+12 more)


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `resolve_simplerag_backend()` function in `GUI/discord_bot.py` do?<|im_end|>
<|im_start|>assistant
**`resolve_simplerag_backend()`** in `GUI/discord_bot.py`:
```python
def resolve_simplerag_backend(*, refresh: bool = False) -> Dict[str, str]:
```

Find the running Electron backend and its RAG Workspace route prefix.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `resolve_simplerag_backend()` function in `GUI/discord_bot.py` do?

[Assistant]
**`resolve_simplerag_backend()`** in `GUI/discord_bot.py`:
```python
def resolve_simplerag_backend(*, refresh: bool = False) -> Dict[str, str]:
```

Find the running Electron backend and its RAG Workspace route prefix.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `resolve_active_model()` function in `GUI/discord_bot.py` do?<|im_end|>
<|im_start|>assistant
**`resolve_active_model()`** in `GUI/discord_bot.py`:
```python
def resolve_active_model(backend: Dict[str, str]) -> Dict[str, str]:
```

Return one unambiguous resident chat model, or an explicit Discord override.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `resolve_active_model()` function in `GUI/discord_bot.py` do?

[Assistant]
**`resolve_active_model()`** in `GUI/discord_bot.py`:
```python
def resolve_active_model(backend: Dict[str, str]) -> Dict[str, str]:
```

Return one unambiguous resident chat model, or an explicit Discord override.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `load_discord_model()` function in `GUI/discord_bot.py` do?<|im_end|>
<|im_start|>assistant
**`load_discord_model()`** in `GUI/discord_bot.py`:
```python
def load_discord_model(endpoint_query: str, model_query: str) -> str:
```

Load an exact local chat model through SimpleRAG and bind Discord to it.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `load_discord_model()` function in `GUI/discord_bot.py` do?

[Assistant]
**`load_discord_model()`** in `GUI/discord_bot.py`:
```python
def load_discord_model(endpoint_query: str, model_query: str) -> str:
```

Load an exact local chat model through SimpleRAG and bind Discord to it.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `resolve_active_embedder()` function in `GUI/discord_bot.py` do?<|im_end|>
<|im_start|>assistant
**`resolve_active_embedder()`** in `GUI/discord_bot.py`:
```python
def resolve_active_embedder(backend: Dict[str, str]) -> Optional[Dict[str, str]]:
```

Return the locally loaded embedding model if one is active, else None.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `resolve_active_embedder()` function in `GUI/discord_bot.py` do?

[Assistant]
**`resolve_active_embedder()`** in `GUI/discord_bot.py`:
```python
def resolve_active_embedder(backend: Dict[str, str]) -> Optional[Dict[str, str]]:
```

Return the locally loaded embedding model if one is active, else None.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `active_model_summary()` function in `GUI/discord_bot.py` do?<|im_end|>
<|im_start|>assistant
**`active_model_summary()`** in `GUI/discord_bot.py`:
```python
def active_model_summary() -> str:
```

This function is part of the discord bot integration.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `active_model_summary()` function in `GUI/discord_bot.py` do?

[Assistant]
**`active_model_summary()`** in `GUI/discord_bot.py`:
```python
def active_model_summary() -> str:
```

This function is part of the discord bot integration.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `create_bot()` function in `GUI/discord_bot.py` do?<|im_end|>
<|im_start|>assistant
**`create_bot()`** in `GUI/discord_bot.py`:
```python
def create_bot(enable_message_content: bool = True) -> commands.Bot:
```

Create and configure the SimpleRAG Discord bot with slash commands.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `create_bot()` function in `GUI/discord_bot.py` do?

[Assistant]
**`create_bot()`** in `GUI/discord_bot.py`:
```python
def create_bot(enable_message_content: bool = True) -> commands.Bot:
```

Create and configure the SimpleRAG Discord bot with slash commands.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What is the purpose of `GUI/discord_bot.py`?<|im_end|>
<|im_start|>assistant
**`GUI/discord_bot.py`** — Discord bot integration

This module contains 2844 lines of Python code with 1 class(es) and 98 function(s). It integrates with Discord via discord.py for bot functionality.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What is the purpose of `GUI/discord_bot.py`?

[Assistant]
**`GUI/discord_bot.py`** — Discord bot integration

This module contains 2844 lines of Python code with 1 class(es) and 98 function(s). It integrates with Discord via discord.py for bot functionality.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What classes and functions are in GUI/llama_cpp_runtime.py?<|im_end|>
<|im_start|>assistant
**GUI/llama_cpp_runtime.py** — Model loading and management

**Lines**: 4406
**Classes** (3): InstallationCancelled, WorkerStartupFailure, LlamaCppRuntimeManager
**Functions** (16): _utc_now, _creation_flags, _atomic_write_json, _clean_text, _safe_int, _safe_bool, _normalize_backend, _normalize_split_mode, _normalize_embedding_pooling, _resolve_embedding_pooling, ... (+6 more)
<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What classes and functions are in GUI/llama_cpp_runtime.py?

[Assistant]
**GUI/llama_cpp_runtime.py** — Model loading and management

**Lines**: 4406
**Classes** (3): InstallationCancelled, WorkerStartupFailure, LlamaCppRuntimeManager
**Functions** (16): _utc_now, _creation_flags, _atomic_write_json, _clean_text, _safe_int, _safe_bool, _normalize_backend, _normalize_split_mode, _normalize_embedding_pooling, _resolve_embedding_pooling, ... (+6 more)


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What is the purpose of `GUI/llama_cpp_runtime.py`?<|im_end|>
<|im_start|>assistant
**`GUI/llama_cpp_runtime.py`** — Model loading and management

This module contains 4406 lines of Python code with 3 class(es) and 16 function(s). It manages llama.cpp model loading, inference, and GPU layer offloading.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What is the purpose of `GUI/llama_cpp_runtime.py`?

[Assistant]
**`GUI/llama_cpp_runtime.py`** — Model loading and management

This module contains 4406 lines of Python code with 3 class(es) and 16 function(s). It manages llama.cpp model loading, inference, and GPU layer offloading.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What classes and functions are in GUI/hybrid_graph_service.py?<|im_end|>
<|im_start|>assistant
**GUI/hybrid_graph_service.py** — Knowledge graph service

**Lines**: 1572
**Classes** (3): HybridGraphUnavailable, _ApplicationEmbeddingAdapter, HybridGraphService
**Functions** (6): _default_project_root, _bounded_int, _clean_text, _json_string_list, _model_alias, _empty_graph_metadata
<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What classes and functions are in GUI/hybrid_graph_service.py?

[Assistant]
**GUI/hybrid_graph_service.py** — Knowledge graph service

**Lines**: 1572
**Classes** (3): HybridGraphUnavailable, _ApplicationEmbeddingAdapter, HybridGraphService
**Functions** (6): _default_project_root, _bounded_int, _clean_text, _json_string_list, _model_alias, _empty_graph_metadata


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What is the purpose of `GUI/hybrid_graph_service.py`?<|im_end|>
<|im_start|>assistant
**`GUI/hybrid_graph_service.py`** — Knowledge graph service

This module contains 1572 lines of Python code with 3 class(es) and 6 function(s). It builds and queries the knowledge graph from document entities.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What is the purpose of `GUI/hybrid_graph_service.py`?

[Assistant]
**`GUI/hybrid_graph_service.py`** — Knowledge graph service

This module contains 1572 lines of Python code with 3 class(es) and 6 function(s). It builds and queries the knowledge graph from document entities.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What classes and functions are in GUI/embedding_manager.py?<|im_end|>
<|im_start|>assistant
**GUI/embedding_manager.py** — Embedding model management

**Lines**: 1642
**Classes** (1): EmbeddingManager
**Functions** (12): detect_cuda_version, normalize_embedding_runtime_backend, normalize_embedding_provider, clean_embedding_setting_text, resolve_embedding_runtime_backend, _embedding_task_snapshot, get_windows_creation_flags, run_capture_text, get_detected_gpu_names, detect_gpu_vendors, ... (+2 more)
<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What classes and functions are in GUI/embedding_manager.py?

[Assistant]
**GUI/embedding_manager.py** — Embedding model management

**Lines**: 1642
**Classes** (1): EmbeddingManager
**Functions** (12): detect_cuda_version, normalize_embedding_runtime_backend, normalize_embedding_provider, clean_embedding_setting_text, resolve_embedding_runtime_backend, _embedding_task_snapshot, get_windows_creation_flags, run_capture_text, get_detected_gpu_names, detect_gpu_vendors, ... (+2 more)


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `detect_cuda_version()` function in `GUI/embedding_manager.py` do?<|im_end|>
<|im_start|>assistant
**`detect_cuda_version()`** in `GUI/embedding_manager.py`:
```python
def detect_cuda_version():
```

Detect the CUDA driver version via nvidia-smi. Returns string like 12.4 or None.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `detect_cuda_version()` function in `GUI/embedding_manager.py` do?

[Assistant]
**`detect_cuda_version()`** in `GUI/embedding_manager.py`:
```python
def detect_cuda_version():
```

Detect the CUDA driver version via nvidia-smi. Returns string like 12.4 or None.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `normalize_embedding_runtime_backend()` function in `GUI/embedding_manager.py` do?<|im_end|>
<|im_start|>assistant
**`normalize_embedding_runtime_backend()`** in `GUI/embedding_manager.py`:
```python
def normalize_embedding_runtime_backend(runtime_backend: Optional[str]) -> str:
```

This function is part of the embedding model management.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `normalize_embedding_runtime_backend()` function in `GUI/embedding_manager.py` do?

[Assistant]
**`normalize_embedding_runtime_backend()`** in `GUI/embedding_manager.py`:
```python
def normalize_embedding_runtime_backend(runtime_backend: Optional[str]) -> str:
```

This function is part of the embedding model management.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `normalize_embedding_provider()` function in `GUI/embedding_manager.py` do?<|im_end|>
<|im_start|>assistant
**`normalize_embedding_provider()`** in `GUI/embedding_manager.py`:
```python
def normalize_embedding_provider(provider: Optional[str]) -> str:
```

This function is part of the embedding model management.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `normalize_embedding_provider()` function in `GUI/embedding_manager.py` do?

[Assistant]
**`normalize_embedding_provider()`** in `GUI/embedding_manager.py`:
```python
def normalize_embedding_provider(provider: Optional[str]) -> str:
```

This function is part of the embedding model management.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `clean_embedding_setting_text()` function in `GUI/embedding_manager.py` do?<|im_end|>
<|im_start|>assistant
**`clean_embedding_setting_text()`** in `GUI/embedding_manager.py`:
```python
def clean_embedding_setting_text(value: Optional[str], max_length: int = 240) -> str:
```

This function is part of the embedding model management.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `clean_embedding_setting_text()` function in `GUI/embedding_manager.py` do?

[Assistant]
**`clean_embedding_setting_text()`** in `GUI/embedding_manager.py`:
```python
def clean_embedding_setting_text(value: Optional[str], max_length: int = 240) -> str:
```

This function is part of the embedding model management.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `resolve_embedding_runtime_backend()` function in `GUI/embedding_manager.py` do?<|im_end|>
<|im_start|>assistant
**`resolve_embedding_runtime_backend()`** in `GUI/embedding_manager.py`:
```python
def resolve_embedding_runtime_backend(runtime_backend: Optional[str]) -> str:
```

This function is part of the embedding model management.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `resolve_embedding_runtime_backend()` function in `GUI/embedding_manager.py` do?

[Assistant]
**`resolve_embedding_runtime_backend()`** in `GUI/embedding_manager.py`:
```python
def resolve_embedding_runtime_backend(runtime_backend: Optional[str]) -> str:
```

This function is part of the embedding model management.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `get_windows_creation_flags()` function in `GUI/embedding_manager.py` do?<|im_end|>
<|im_start|>assistant
**`get_windows_creation_flags()`** in `GUI/embedding_manager.py`:
```python
def get_windows_creation_flags() -> int:
```

This function is part of the embedding model management.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `get_windows_creation_flags()` function in `GUI/embedding_manager.py` do?

[Assistant]
**`get_windows_creation_flags()`** in `GUI/embedding_manager.py`:
```python
def get_windows_creation_flags() -> int:
```

This function is part of the embedding model management.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What is the purpose of `GUI/embedding_manager.py`?<|im_end|>
<|im_start|>assistant
**`GUI/embedding_manager.py`** — Embedding model management

This module contains 1642 lines of Python code with 1 class(es) and 12 function(s). <|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What is the purpose of `GUI/embedding_manager.py`?

[Assistant]
**`GUI/embedding_manager.py`** — Embedding model management

This module contains 1642 lines of Python code with 1 class(es) and 12 function(s).


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What classes and functions are in GUI/chat_context_budget.py?<|im_end|>
<|im_start|>assistant
**GUI/chat_context_budget.py** — Context window budget management

**Lines**: 380
**Classes** (1): PromptContextSegment
**Functions** (11): _positive_token_count, classify_length_limit, length_limit_notice, utf8_token_upper_bound, _safe_token_count, _compose_system, _default_output_reserve, _allocate_segment_tokens, _prefer_text_boundary, clip_text_to_token_budget, ... (+1 more)
<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What classes and functions are in GUI/chat_context_budget.py?

[Assistant]
**GUI/chat_context_budget.py** — Context window budget management

**Lines**: 380
**Classes** (1): PromptContextSegment
**Functions** (11): _positive_token_count, classify_length_limit, length_limit_notice, utf8_token_upper_bound, _safe_token_count, _compose_system, _default_output_reserve, _allocate_segment_tokens, _prefer_text_boundary, clip_text_to_token_budget, ... (+1 more)


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `classify_length_limit()` function in `GUI/chat_context_budget.py` do?<|im_end|>
<|im_start|>assistant
**`classify_length_limit()`** in `GUI/chat_context_budget.py`:
```python
def classify_length_limit(
```

Classify a provider ``finish_reason=length`` without guessing context loss.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `classify_length_limit()` function in `GUI/chat_context_budget.py` do?

[Assistant]
**`classify_length_limit()`** in `GUI/chat_context_budget.py`:
```python
def classify_length_limit(
```

Classify a provider ``finish_reason=length`` without guessing context loss.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `length_limit_notice()` function in `GUI/chat_context_budget.py` do?<|im_end|>
<|im_start|>assistant
**`length_limit_notice()`** in `GUI/chat_context_budget.py`:
```python
def length_limit_notice(limit_reason: Any) -> str:
```

This function is part of the context window budget management.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `length_limit_notice()` function in `GUI/chat_context_budget.py` do?

[Assistant]
**`length_limit_notice()`** in `GUI/chat_context_budget.py`:
```python
def length_limit_notice(limit_reason: Any) -> str:
```

This function is part of the context window budget management.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `utf8_token_upper_bound()` function in `GUI/chat_context_budget.py` do?<|im_end|>
<|im_start|>assistant
**`utf8_token_upper_bound()`** in `GUI/chat_context_budget.py`:
```python
def utf8_token_upper_bound(value: str) -> int:
```

Return a conservative fallback when the active tokenizer is unavailable.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `utf8_token_upper_bound()` function in `GUI/chat_context_budget.py` do?

[Assistant]
**`utf8_token_upper_bound()`** in `GUI/chat_context_budget.py`:
```python
def utf8_token_upper_bound(value: str) -> int:
```

Return a conservative fallback when the active tokenizer is unavailable.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `clip_text_to_token_budget()` function in `GUI/chat_context_budget.py` do?<|im_end|>
<|im_start|>assistant
**`clip_text_to_token_budget()`** in `GUI/chat_context_budget.py`:
```python
def clip_text_to_token_budget(
```

This function is part of the context window budget management.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `clip_text_to_token_budget()` function in `GUI/chat_context_budget.py` do?

[Assistant]
**`clip_text_to_token_budget()`** in `GUI/chat_context_budget.py`:
```python
def clip_text_to_token_budget(
```

This function is part of the context window budget management.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `pack_prompt_context()` function in `GUI/chat_context_budget.py` do?<|im_end|>
<|im_start|>assistant
**`pack_prompt_context()`** in `GUI/chat_context_budget.py`:
```python
def pack_prompt_context(
```

This function is part of the context window budget management.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `pack_prompt_context()` function in `GUI/chat_context_budget.py` do?

[Assistant]
**`pack_prompt_context()`** in `GUI/chat_context_budget.py`:
```python
def pack_prompt_context(
```

This function is part of the context window budget management.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What is the purpose of `GUI/chat_context_budget.py`?<|im_end|>
<|im_start|>assistant
**`GUI/chat_context_budget.py`** — Context window budget management

This module contains 380 lines of Python code with 1 class(es) and 11 function(s). It manages LLM chat interactions, streaming, and context assembly.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What is the purpose of `GUI/chat_context_budget.py`?

[Assistant]
**`GUI/chat_context_budget.py`** — Context window budget management

This module contains 380 lines of Python code with 1 class(es) and 11 function(s). It manages LLM chat interactions, streaming, and context assembly.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What classes and functions are in GUI/secure_credentials.py?<|im_end|>
<|im_start|>assistant
**GUI/secure_credentials.py** — Secure credential handling

**Lines**: 184
**Classes** (2): _DataBlob, CredentialStore
<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What classes and functions are in GUI/secure_credentials.py?

[Assistant]
**GUI/secure_credentials.py** — Secure credential handling

**Lines**: 184
**Classes** (2): _DataBlob, CredentialStore


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What is the purpose of `GUI/secure_credentials.py`?<|im_end|>
<|im_start|>assistant
**`GUI/secure_credentials.py`** — Secure credential handling

This module contains 184 lines of Python code with 2 class(es) and 0 function(s). <|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What is the purpose of `GUI/secure_credentials.py`?

[Assistant]
**`GUI/secure_credentials.py`** — Secure credential handling

This module contains 184 lines of Python code with 2 class(es) and 0 function(s).


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What classes and functions are in GUI/web_search_runtime.py?<|im_end|>
<|im_start|>assistant
**GUI/web_search_runtime.py** — Web search functionality

**Lines**: 2265
**Classes** (4): _TextExtractor, _DDGHTMLParser, _PageContentExtractor, ProviderSearchError
**Functions** (63): _next_user_agent, _extract_json_ld_text, _extract_meta_text, _extract_noscript_text, _aggressive_text_extract, _try_weather_fallback, fetch_page_content, enrich_results_with_page_content, _is_usable_page_text, _is_weather_query, ... (+53 more)
<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What classes and functions are in GUI/web_search_runtime.py?

[Assistant]
**GUI/web_search_runtime.py** — Web search functionality

**Lines**: 2265
**Classes** (4): _TextExtractor, _DDGHTMLParser, _PageContentExtractor, ProviderSearchError
**Functions** (63): _next_user_agent, _extract_json_ld_text, _extract_meta_text, _extract_noscript_text, _aggressive_text_extract, _try_weather_fallback, fetch_page_content, enrich_results_with_page_content, _is_usable_page_text, _is_weather_query, ... (+53 more)


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `fetch_page_content()` function in `GUI/web_search_runtime.py` do?<|im_end|>
<|im_start|>assistant
**`fetch_page_content()`** in `GUI/web_search_runtime.py`:
```python
def fetch_page_content(url: str, max_chars: int = MAX_PAGE_TEXT_CHARS, timeout: float = 4.0) -> str:
```

Fetch target web page content, parsing HTML into clean readable text.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `fetch_page_content()` function in `GUI/web_search_runtime.py` do?

[Assistant]
**`fetch_page_content()`** in `GUI/web_search_runtime.py`:
```python
def fetch_page_content(url: str, max_chars: int = MAX_PAGE_TEXT_CHARS, timeout: float = 4.0) -> str:
```

Fetch target web page content, parsing HTML into clean readable text.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `enrich_results_with_page_content()` function in `GUI/web_search_runtime.py` do?<|im_end|>
<|im_start|>assistant
**`enrich_results_with_page_content()`** in `GUI/web_search_runtime.py`:
```python
def enrich_results_with_page_content(
```

Visit top target result URLs to extract real page text content into each result dictionary.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `enrich_results_with_page_content()` function in `GUI/web_search_runtime.py` do?

[Assistant]
**`enrich_results_with_page_content()`** in `GUI/web_search_runtime.py`:
```python
def enrich_results_with_page_content(
```

Visit top target result URLs to extract real page text content into each result dictionary.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `configure_runtime()` function in `GUI/web_search_runtime.py` do?<|im_end|>
<|im_start|>assistant
**`configure_runtime()`** in `GUI/web_search_runtime.py`:
```python
def configure_runtime(db_path: str | Path) -> None:
```

Point persisted web-search preferences at the workspace database.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `configure_runtime()` function in `GUI/web_search_runtime.py` do?

[Assistant]
**`configure_runtime()`** in `GUI/web_search_runtime.py`:
```python
def configure_runtime(db_path: str | Path) -> None:
```

Point persisted web-search preferences at the workspace database.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `extract_document_subject()` function in `GUI/web_search_runtime.py` do?<|im_end|>
<|im_start|>assistant
**`extract_document_subject()`** in `GUI/web_search_runtime.py`:
```python
def extract_document_subject(document_hint: str) -> str:
```

Extract clean subject matter from a document filename or title.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `extract_document_subject()` function in `GUI/web_search_runtime.py` do?

[Assistant]
**`extract_document_subject()`** in `GUI/web_search_runtime.py`:
```python
def extract_document_subject(document_hint: str) -> str:
```

Extract clean subject matter from a document filename or title.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `extract_key_terms_from_chunks()` function in `GUI/web_search_runtime.py` do?<|im_end|>
<|im_start|>assistant
**`extract_key_terms_from_chunks()`** in `GUI/web_search_runtime.py`:
```python
def extract_key_terms_from_chunks(workspace_context: str, top_n: int = 4) -> list[str]:
```

Extract top domain subject terms from retrieved document chunks.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `extract_key_terms_from_chunks()` function in `GUI/web_search_runtime.py` do?

[Assistant]
**`extract_key_terms_from_chunks()`** in `GUI/web_search_runtime.py`:
```python
def extract_key_terms_from_chunks(workspace_context: str, top_n: int = 4) -> list[str]:
```

Extract top domain subject terms from retrieved document chunks.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `generate_candidate_queries()` function in `GUI/web_search_runtime.py` do?<|im_end|>
<|im_start|>assistant
**`generate_candidate_queries()`** in `GUI/web_search_runtime.py`:
```python
def generate_candidate_queries(
```

This function is part of the web search functionality.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `generate_candidate_queries()` function in `GUI/web_search_runtime.py` do?

[Assistant]
**`generate_candidate_queries()`** in `GUI/web_search_runtime.py`:
```python
def generate_candidate_queries(
```

This function is part of the web search functionality.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What is the purpose of `GUI/web_search_runtime.py`?<|im_end|>
<|im_start|>assistant
**`GUI/web_search_runtime.py`** — Web search functionality

This module contains 2265 lines of Python code with 4 class(es) and 63 function(s). <|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What is the purpose of `GUI/web_search_runtime.py`?

[Assistant]
**`GUI/web_search_runtime.py`** — Web search functionality

This module contains 2265 lines of Python code with 4 class(es) and 63 function(s).


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What classes and functions are in GUI/calendar_runtime.py?<|im_end|>
<|im_start|>assistant
**GUI/calendar_runtime.py** — Calendar functionality

**Lines**: 1584
**Classes** (5): CalendarEventInput, CalendarProviderConfigure, GoogleAuthStart, CalendarImportRequest, CalendarOpenSystemRequest
**Functions** (91): _utc_now, _json, _safe_json, _connect, configure_runtime, init_calendar_db, _provider_settings, _provider_row, _upsert_provider, _parse_temporal, ... (+81 more)
<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What classes and functions are in GUI/calendar_runtime.py?

[Assistant]
**GUI/calendar_runtime.py** — Calendar functionality

**Lines**: 1584
**Classes** (5): CalendarEventInput, CalendarProviderConfigure, GoogleAuthStart, CalendarImportRequest, CalendarOpenSystemRequest
**Functions** (91): _utc_now, _json, _safe_json, _connect, configure_runtime, init_calendar_db, _provider_settings, _provider_row, _upsert_provider, _parse_temporal, ... (+81 more)


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `configure_runtime()` function in `GUI/calendar_runtime.py` do?<|im_end|>
<|im_start|>assistant
**`configure_runtime()`** in `GUI/calendar_runtime.py`:
```python
def configure_runtime(
```

Configure paths/callbacks. Tests use this to isolate their database.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `configure_runtime()` function in `GUI/calendar_runtime.py` do?

[Assistant]
**`configure_runtime()`** in `GUI/calendar_runtime.py`:
```python
def configure_runtime(
```

Configure paths/callbacks. Tests use this to isolate their database.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `init_calendar_db()` function in `GUI/calendar_runtime.py` do?<|im_end|>
<|im_start|>assistant
**`init_calendar_db()`** in `GUI/calendar_runtime.py`:
```python
def init_calendar_db() -> None:
```

This function is part of the calendar functionality.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `init_calendar_db()` function in `GUI/calendar_runtime.py` do?

[Assistant]
**`init_calendar_db()`** in `GUI/calendar_runtime.py`:
```python
def init_calendar_db() -> None:
```

This function is part of the calendar functionality.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `calendar_manifest()` function in `GUI/calendar_runtime.py` do?<|im_end|>
<|im_start|>assistant
**`calendar_manifest()`** in `GUI/calendar_runtime.py`:
```python
def calendar_manifest():
```

This function is part of the calendar functionality.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `calendar_manifest()` function in `GUI/calendar_runtime.py` do?

[Assistant]
**`calendar_manifest()`** in `GUI/calendar_runtime.py`:
```python
def calendar_manifest():
```

This function is part of the calendar functionality.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `calendar_status()` function in `GUI/calendar_runtime.py` do?<|im_end|>
<|im_start|>assistant
**`calendar_status()`** in `GUI/calendar_runtime.py`:
```python
def calendar_status(probe: bool = Query(default=False)):
```

This function is part of the calendar functionality.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `calendar_status()` function in `GUI/calendar_runtime.py` do?

[Assistant]
**`calendar_status()`** in `GUI/calendar_runtime.py`:
```python
def calendar_status(probe: bool = Query(default=False)):
```

This function is part of the calendar functionality.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `calendar_providers()` function in `GUI/calendar_runtime.py` do?<|im_end|>
<|im_start|>assistant
**`calendar_providers()`** in `GUI/calendar_runtime.py`:
```python
def calendar_providers(probe: bool = Query(default=False)):
```

This function is part of the calendar functionality.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `calendar_providers()` function in `GUI/calendar_runtime.py` do?

[Assistant]
**`calendar_providers()`** in `GUI/calendar_runtime.py`:
```python
def calendar_providers(probe: bool = Query(default=False)):
```

This function is part of the calendar functionality.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `configure_provider()` function in `GUI/calendar_runtime.py` do?<|im_end|>
<|im_start|>assistant
**`configure_provider()`** in `GUI/calendar_runtime.py`:
```python
def configure_provider(provider: str, req: CalendarProviderConfigure):
```

This function is part of the calendar functionality.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `configure_provider()` function in `GUI/calendar_runtime.py` do?

[Assistant]
**`configure_provider()`** in `GUI/calendar_runtime.py`:
```python
def configure_provider(provider: str, req: CalendarProviderConfigure):
```

This function is part of the calendar functionality.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What is the purpose of `GUI/calendar_runtime.py`?<|im_end|>
<|im_start|>assistant
**`GUI/calendar_runtime.py`** — Calendar functionality

This module contains 1584 lines of Python code with 5 class(es) and 91 function(s). <|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What is the purpose of `GUI/calendar_runtime.py`?

[Assistant]
**`GUI/calendar_runtime.py`** — Calendar functionality

This module contains 1584 lines of Python code with 5 class(es) and 91 function(s).


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What classes and functions are in GUI/memory_runtime.py?<|im_end|>
<|im_start|>assistant
**GUI/memory_runtime.py** — Memory/persistence runtime

**Lines**: 2702
**Classes** (14): ProvenanceInput, MemoryDraft, MemoryCreateRequest, MemoryCaptureRequest, MemoryUpdateRequest, ScopeRef, MemoryRecallRequest, ConflictResolveRequest, ... (+6 more)
**Functions** (69): _utc_now_dt, _utc_now, _parse_time, _json, _safe_json, _connect, configure_runtime, _migration_v1, _migration_v2, _configure_fts, ... (+59 more)
<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What classes and functions are in GUI/memory_runtime.py?

[Assistant]
**GUI/memory_runtime.py** — Memory/persistence runtime

**Lines**: 2702
**Classes** (14): ProvenanceInput, MemoryDraft, MemoryCreateRequest, MemoryCaptureRequest, MemoryUpdateRequest, ScopeRef, MemoryRecallRequest, ConflictResolveRequest, ... (+6 more)
**Functions** (69): _utc_now_dt, _utc_now, _parse_time, _json, _safe_json, _connect, configure_runtime, _migration_v1, _migration_v2, _configure_fts, ... (+59 more)


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `configure_runtime()` function in `GUI/memory_runtime.py` do?<|im_end|>
<|im_start|>assistant
**`configure_runtime()`** in `GUI/memory_runtime.py`:
```python
def configure_runtime(
```

Configure storage and an optional already-local semantic encoder.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `configure_runtime()` function in `GUI/memory_runtime.py` do?

[Assistant]
**`configure_runtime()`** in `GUI/memory_runtime.py`:
```python
def configure_runtime(
```

Configure storage and an optional already-local semantic encoder.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `init_memory_db()` function in `GUI/memory_runtime.py` do?<|im_end|>
<|im_start|>assistant
**`init_memory_db()`** in `GUI/memory_runtime.py`:
```python
def init_memory_db() -> None:
```

Apply versioned schema migrations without touching other workspace tables.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `init_memory_db()` function in `GUI/memory_runtime.py` do?

[Assistant]
**`init_memory_db()`** in `GUI/memory_runtime.py`:
```python
def init_memory_db() -> None:
```

Apply versioned schema migrations without touching other workspace tables.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `filter_secrets()` function in `GUI/memory_runtime.py` do?<|im_end|>
<|im_start|>assistant
**`filter_secrets()`** in `GUI/memory_runtime.py`:
```python
def filter_secrets(value: Any) -> tuple[str, List[str]]:
```

Deterministically redact credential-shaped material before persistence.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `filter_secrets()` function in `GUI/memory_runtime.py` do?

[Assistant]
**`filter_secrets()`** in `GUI/memory_runtime.py`:
```python
def filter_secrets(value: Any) -> tuple[str, List[str]]:
```

Deterministically redact credential-shaped material before persistence.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `list_memories()` function in `GUI/memory_runtime.py` do?<|im_end|>
<|im_start|>assistant
**`list_memories()`** in `GUI/memory_runtime.py`:
```python
def list_memories(
```

This function is part of the memory/persistence runtime.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `list_memories()` function in `GUI/memory_runtime.py` do?

[Assistant]
**`list_memories()`** in `GUI/memory_runtime.py`:
```python
def list_memories(
```

This function is part of the memory/persistence runtime.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `search_memories()` function in `GUI/memory_runtime.py` do?<|im_end|>
<|im_start|>assistant
**`search_memories()`** in `GUI/memory_runtime.py`:
```python
def search_memories(
```

This function is part of the memory/persistence runtime.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `search_memories()` function in `GUI/memory_runtime.py` do?

[Assistant]
**`search_memories()`** in `GUI/memory_runtime.py`:
```python
def search_memories(
```

This function is part of the memory/persistence runtime.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `recall_memories()` function in `GUI/memory_runtime.py` do?<|im_end|>
<|im_start|>assistant
**`recall_memories()`** in `GUI/memory_runtime.py`:
```python
def recall_memories(req: MemoryRecallRequest) -> Dict[str, Any]:
```

This function is part of the memory/persistence runtime.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `recall_memories()` function in `GUI/memory_runtime.py` do?

[Assistant]
**`recall_memories()`** in `GUI/memory_runtime.py`:
```python
def recall_memories(req: MemoryRecallRequest) -> Dict[str, Any]:
```

This function is part of the memory/persistence runtime.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What is the purpose of `GUI/memory_runtime.py`?<|im_end|>
<|im_start|>assistant
**`GUI/memory_runtime.py`** — Memory/persistence runtime

This module contains 2702 lines of Python code with 14 class(es) and 69 function(s). <|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What is the purpose of `GUI/memory_runtime.py`?

[Assistant]
**`GUI/memory_runtime.py`** — Memory/persistence runtime

This module contains 2702 lines of Python code with 14 class(es) and 69 function(s).


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What classes and functions are in PDF_parser/chat_backend.py?<|im_end|>
<|im_start|>assistant
**PDF_parser/chat_backend.py** — FastAPI app definition

**Lines**: 658
**Classes** (6): ChatMessage, ChatRequest, ChatResponse, UploadResponse, DatabaseManager, RAGManager
**Functions** (2): mount_rag_workspace_gui_api, load_documents_from_db
**Async functions** (8): retrieve_for_query, get_doc_hits, root, health_check, upload_pdf, ... (+3 more)
<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What classes and functions are in PDF_parser/chat_backend.py?

[Assistant]
**PDF_parser/chat_backend.py** — FastAPI app definition

**Lines**: 658
**Classes** (6): ChatMessage, ChatRequest, ChatResponse, UploadResponse, DatabaseManager, RAGManager
**Functions** (2): mount_rag_workspace_gui_api, load_documents_from_db
**Async functions** (8): retrieve_for_query, get_doc_hits, root, health_check, upload_pdf, ... (+3 more)


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `mount_rag_workspace_gui_api()` function in `PDF_parser/chat_backend.py` do?<|im_end|>
<|im_start|>assistant
**`mount_rag_workspace_gui_api()`** in `PDF_parser/chat_backend.py`:
```python
def mount_rag_workspace_gui_api() -> None:
```

Mount the RAGWorkspace GUI backend.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `mount_rag_workspace_gui_api()` function in `PDF_parser/chat_backend.py` do?

[Assistant]
**`mount_rag_workspace_gui_api()`** in `PDF_parser/chat_backend.py`:
```python
def mount_rag_workspace_gui_api() -> None:
```

Mount the RAGWorkspace GUI backend.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `load_documents_from_db()` function in `PDF_parser/chat_backend.py` do?<|im_end|>
<|im_start|>assistant
**`load_documents_from_db()`** in `PDF_parser/chat_backend.py`:
```python
def load_documents_from_db():
```

Load persisted documents into in-memory retrieval index at startup.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `load_documents_from_db()` function in `PDF_parser/chat_backend.py` do?

[Assistant]
**`load_documents_from_db()`** in `PDF_parser/chat_backend.py`:
```python
def load_documents_from_db():
```

Load persisted documents into in-memory retrieval index at startup.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What is the purpose of `PDF_parser/chat_backend.py`?<|im_end|>
<|im_start|>assistant
**`PDF_parser/chat_backend.py`** — FastAPI app definition

This module contains 658 lines of Python code with 6 class(es) and 2 function(s). It manages LLM chat interactions, streaming, and context assembly.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What is the purpose of `PDF_parser/chat_backend.py`?

[Assistant]
**`PDF_parser/chat_backend.py`** — FastAPI app definition

This module contains 658 lines of Python code with 6 class(es) and 2 function(s). It manages LLM chat interactions, streaming, and context assembly.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What classes and functions are in PDF_parser/converter.py?<|im_end|>
<|im_start|>assistant
**PDF_parser/converter.py** — PDF to Markdown conversion

**Lines**: 1229
**Classes** (6): ConversionMode, ConversionConfig, ConversionStats, PDFValidator, PageProcessor, PDFConverter
**Functions** (8): get_physical_cores, _clean_pdf_metadata, _process_pages_worker, _process_page_worker, create_processing_tasks, assemble_results, build_default_config, run_full_conversion
<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What classes and functions are in PDF_parser/converter.py?

[Assistant]
**PDF_parser/converter.py** — PDF to Markdown conversion

**Lines**: 1229
**Classes** (6): ConversionMode, ConversionConfig, ConversionStats, PDFValidator, PageProcessor, PDFConverter
**Functions** (8): get_physical_cores, _clean_pdf_metadata, _process_pages_worker, _process_page_worker, create_processing_tasks, assemble_results, build_default_config, run_full_conversion


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `get_physical_cores()` function in `PDF_parser/converter.py` do?<|im_end|>
<|im_start|>assistant
**`get_physical_cores()`** in `PDF_parser/converter.py`:
```python
def get_physical_cores() -> int:
```

Return the number of **physical** CPU cores (ignoring logical hyper‑threads).<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `get_physical_cores()` function in `PDF_parser/converter.py` do?

[Assistant]
**`get_physical_cores()`** in `PDF_parser/converter.py`:
```python
def get_physical_cores() -> int:
```

Return the number of **physical** CPU cores (ignoring logical hyper‑threads).


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `create_processing_tasks()` function in `PDF_parser/converter.py` do?<|im_end|>
<|im_start|>assistant
**`create_processing_tasks()`** in `PDF_parser/converter.py`:
```python
def create_processing_tasks(
```

Create a list of processing tasks based on file size and core count.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `create_processing_tasks()` function in `PDF_parser/converter.py` do?

[Assistant]
**`create_processing_tasks()`** in `PDF_parser/converter.py`:
```python
def create_processing_tasks(
```

Create a list of processing tasks based on file size and core count.


<|im_start|>system
You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.<|im_end|>
<|im_start|>user
What does the `assemble_results()` function in `PDF_parser/converter.py` do?<|im_end|>
<|im_start|>assistant
**`assemble_results()`** in `PDF_parser/converter.py`:
```python
def assemble_results(
```

This function is part of the pdf to markdown conversion.<|im_end|>

[System] You are Echidna, the AI assistant for SimpleRAG — an offline-first RAG desktop application (FastAPI backend port 8010, React frontend port 8080). You understand every module, function, endpoint, and configuration in the codebase.

[User] What does the `assemble_results()` function in `PDF_parser/converter.py` do?

[Assistant]
**`assemble_results()`** in `PDF_parser/converter.py`:
```python
def assemble_results(
```

This function is part of the pdf to markdown conversion.