# agentxzy/aether architecture

> Architecture diagram of the GitHub repository agentxzy/aether, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/agentxzy/aether
- Repository: https://github.com/agentxzy/aether

## Overview

Aether’s backend exposes Alfred chat and document/search REST APIs. The main chat flow routes a query by intent, retrieves relevant context when needed, builds a prompt, and generates a response through local or cloud AI; conversation history is persisted. Separate capabilities ingest and search PDFs and provide web search, scraping, and web-content ingestion. The README documents several workflows whose implementation was not sampled, so their links are dashed where source-level ownership could not be verified.

Main entry points: [`src/main/java/com/alfred_core/service/AlfredChatService.java`](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/service/AlfredChatService.java) (Chat orchestrator), [`src/main/java/com/alfred_core/service/PdfDocumentService.java`](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/service/PdfDocumentService.java) (PDF ingestion), [`src/main/java/com/alfred_core/automation/web/ingestion/WebIngestionService.java`](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/automation/web/ingestion/WebIngestionService.java) (Web ingestion), [`src/main/java/com/alfred_core/intent/IntentRouterService.java`](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/intent/IntentRouterService.java) (Intent routing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["REST API"]
  node_chat_api["Chat endpoint"]
  node_pdf_api["PDF endpoint"]
  node_query_api["Query endpoint"]
  node_history_api["History endpoint"]
  node_web_search_api["Web search API"]
  node_web_scrape_api["Scraping API"]
end

subgraph group_chat["Chat and AI"]
  node_chat_orchestrator["Chat orchestrator"]
  node_intent["Intent routing"]
  node_minilm["Intent embeddings"]
  node_intent_data["Intent dataset"]
  node_prompt["Prompt strategies"]
  node_provider["AI provider router"]
  node_ollama["Ollama inference<br/>[OllamaService.java]"]
  node_gemini["Gemini inference<br/>[GeminiService.java]"]
end

subgraph group_documents["PDF Knowledge"]
  node_pdf_api_service["PDF ingestion"]
  node_chunker["Text chunking<br/>[TextChunker.java]"]
  node_embedding["Embedding service"]
  node_semantic["Semantic search"]
  node_keyword["Keyword search"]
  node_retrieval["Unified retrieval"]
  node_pdf_store[("PDF chunks")]
end

subgraph group_web["Web Intelligence"]
  node_web_search["Web search service"]
  node_tavily["Tavily provider"]
  node_scraping["Scraping service"]
  node_scraper["Web scraper<br/>[JinaScraper.java]"]
  node_web_ingest["Web ingestion"]
  node_web_chunks["Web chunks<br/>[WebChunk.java]"]
end

subgraph group_persistence["Conversation Storage"]
  node_context["Conversation context"]
  node_messages["Message service"]
  node_message_store[("Chat messages<br/>[ChatMessage.java]")]
end

node_user(("User"))
node_ollama_service["Ollama service"]
node_gemini_service["Gemini service"]
node_tavily_service["Tavily API"]

node_user -->|"sends chat"| node_chat_api
node_chat_api -->|"delegates"| node_chat_orchestrator
node_chat_orchestrator -->|"routes intent"| node_intent
node_intent -->|"embeds query"| node_minilm
node_intent -->|"loads examples"| node_intent_data
node_chat_orchestrator -->|"selects prompt"| node_prompt
node_chat_orchestrator -->|"retrieves context"| node_retrieval
node_chat_orchestrator -.->|"loads history"| node_context
node_chat_orchestrator -.->|"requests generation"| node_provider
node_provider -.->|"routes locally"| node_ollama
node_provider -.->|"cloud fallback"| node_gemini
node_ollama -.->|"calls"| node_ollama_service
node_gemini -.->|"calls"| node_gemini_service
node_chat_orchestrator -.->|"persists turns"| node_messages
node_history_api -->|"delegates"| node_messages
node_context -->|"reads history"| node_message_store
node_messages -.->|"stores messages"| node_message_store
node_user -->|"uploads PDF"| node_pdf_api
node_pdf_api -->|"delegates"| node_pdf_api_service
node_pdf_api_service -.->|"chunks text"| node_chunker
node_pdf_api_service -.->|"embeds chunks"| node_embedding
node_pdf_api_service -.->|"stores chunks"| node_pdf_store
node_user -->|"submits query"| node_query_api
node_query_api -->|"delegates"| node_keyword
node_retrieval -->|"tries semantic"| node_semantic
node_retrieval -->|"falls back"| node_keyword
node_semantic -->|"embeds query"| node_embedding
node_semantic -->|"reads chunks"| node_pdf_store
node_keyword -->|"searches chunks"| node_pdf_store
node_user -.->|"requests web search"| node_web_search_api
node_web_search_api -.->|"delegates"| node_web_search
node_web_search -->|"dispatches search"| node_tavily
node_tavily -.->|"queries"| node_tavily_service
node_user -->|"requests scraping"| node_web_scrape_api
node_web_scrape_api -.->|"delegates"| node_scraping
node_scraping -->|"scrapes page"| node_scraper
node_scraping -.->|"ingests page"| node_web_ingest
node_web_ingest -->|"chunks content"| node_chunker
node_web_ingest -->|"embeds chunks"| node_embedding
node_web_ingest -->|"creates chunks"| node_web_chunks

click node_chat_api "https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/controller/AlfredChatController.java"
click node_pdf_api "https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/controller/PdfDocumentController.java"
click node_query_api "https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/controller/QueryController.java"
click node_history_api "https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/controller/ChatMessageController.java"
click node_chat_orchestrator "https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/service/AlfredChatService.java"
click node_intent "https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/intent/IntentRouterService.java"
click node_minilm "https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/intent/MiniLMEmbeddingService.java"
click node_intent_data "https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/intent/IntentDatasetService.java"
click node_prompt "https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/prompt/prompt_service/PromptOrchestrator.java"
click node_provider "https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/service/AIProviderRouter.java"
click node_ollama "https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/service/OllamaService.java"
click node_gemini "https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/service/GeminiService.java"
click node_context "https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/service/ConversationContextService.java"
click node_messages "https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/service/ChatMessageService.java"
click node_message_store "https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/entity/ChatMessage.java"
click node_pdf_api_service "https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/service/PdfDocumentService.java"
click node_chunker "https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/util/TextChunker.java"
click node_embedding "https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/service/EmbeddingService.java"
click node_semantic "https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/service/SemanticSearchService.java"
click node_keyword "https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/service/PdfSearchService.java"
click node_retrieval "https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/service/RetrievalService.java"
click node_pdf_store "https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/repository/PdfChunkRepository.java"
click node_web_search_api "https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/controller/SearchController.java"
click node_web_search "https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/automation/web/search/WebSearchService.java"
click node_tavily "https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/automation/web/search/TavilySearchProvider.java"
click node_web_scrape_api "https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/controller/ScrapingController.java"
click node_scraping "https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/automation/web/scraping/ScrapingService.java"
click node_scraper "https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/automation/web/scraping/JinaScraper.java"
click node_web_ingest "https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/automation/web/ingestion/WebIngestionService.java"
click node_web_chunks "https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/automation/web/ingestion/WebChunk.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_chat_api,node_pdf_api,node_query_api,node_history_api,node_web_search_api,node_web_scrape_api,node_user toneBlue
class node_chat_orchestrator,node_intent,node_minilm,node_intent_data,node_prompt,node_provider,node_ollama,node_gemini toneAmber
class node_pdf_api_service,node_chunker,node_embedding,node_semantic,node_keyword,node_retrieval,node_pdf_store,node_tavily_service toneMint
class node_web_search,node_tavily,node_scraping,node_scraper,node_web_ingest,node_web_chunks toneRose
class node_context,node_messages,node_message_store,node_ollama_service,node_gemini_service toneIndigo
```

## Components

### REST API

- [Chat endpoint](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/controller/AlfredChatController.java): `src/main/java/com/alfred_core/controller/AlfredChatController.java`
- [PDF endpoint](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/controller/PdfDocumentController.java): `src/main/java/com/alfred_core/controller/PdfDocumentController.java`
- [Query endpoint](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/controller/QueryController.java): `src/main/java/com/alfred_core/controller/QueryController.java`
- [History endpoint](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/controller/ChatMessageController.java): `src/main/java/com/alfred_core/controller/ChatMessageController.java`
- [Web search API](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/controller/SearchController.java): `src/main/java/com/alfred_core/controller/SearchController.java`
- [Scraping API](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/controller/ScrapingController.java): `src/main/java/com/alfred_core/controller/ScrapingController.java`

### Chat and AI

- [Chat orchestrator](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/service/AlfredChatService.java): `src/main/java/com/alfred_core/service/AlfredChatService.java`
- [Intent routing](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/intent/IntentRouterService.java): `src/main/java/com/alfred_core/intent/IntentRouterService.java`
- [Intent embeddings](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/intent/MiniLMEmbeddingService.java): `src/main/java/com/alfred_core/intent/MiniLMEmbeddingService.java`
- [Intent dataset](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/intent/IntentDatasetService.java): `src/main/java/com/alfred_core/intent/IntentDatasetService.java`
- [Prompt strategies](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/prompt/prompt_service/PromptOrchestrator.java): `src/main/java/com/alfred_core/prompt/prompt_service/PromptOrchestrator.java`
- [AI provider router](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/service/AIProviderRouter.java): `src/main/java/com/alfred_core/service/AIProviderRouter.java`
- [Ollama inference](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/service/OllamaService.java): `src/main/java/com/alfred_core/service/OllamaService.java`
- [Gemini inference](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/service/GeminiService.java): `src/main/java/com/alfred_core/service/GeminiService.java`

### PDF Knowledge

- [PDF ingestion](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/service/PdfDocumentService.java): `src/main/java/com/alfred_core/service/PdfDocumentService.java`
- [Text chunking](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/util/TextChunker.java): `src/main/java/com/alfred_core/util/TextChunker.java`
- [Embedding service](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/service/EmbeddingService.java): `src/main/java/com/alfred_core/service/EmbeddingService.java`
- [Semantic search](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/service/SemanticSearchService.java): `src/main/java/com/alfred_core/service/SemanticSearchService.java`
- [Keyword search](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/service/PdfSearchService.java): `src/main/java/com/alfred_core/service/PdfSearchService.java`
- [Unified retrieval](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/service/RetrievalService.java): `src/main/java/com/alfred_core/service/RetrievalService.java`
- [PDF chunks](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/repository/PdfChunkRepository.java): `src/main/java/com/alfred_core/repository/PdfChunkRepository.java`

### Web Intelligence

- [Web search service](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/automation/web/search/WebSearchService.java): `src/main/java/com/alfred_core/automation/web/search/WebSearchService.java`
- [Tavily provider](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/automation/web/search/TavilySearchProvider.java): `src/main/java/com/alfred_core/automation/web/search/TavilySearchProvider.java`
- [Scraping service](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/automation/web/scraping/ScrapingService.java): `src/main/java/com/alfred_core/automation/web/scraping/ScrapingService.java`
- [Web scraper](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/automation/web/scraping/JinaScraper.java): `src/main/java/com/alfred_core/automation/web/scraping/JinaScraper.java`
- [Web ingestion](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/automation/web/ingestion/WebIngestionService.java): `src/main/java/com/alfred_core/automation/web/ingestion/WebIngestionService.java`
- [Web chunks](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/automation/web/ingestion/WebChunk.java): `src/main/java/com/alfred_core/automation/web/ingestion/WebChunk.java`

### Conversation Storage

- [Conversation context](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/service/ConversationContextService.java): `src/main/java/com/alfred_core/service/ConversationContextService.java`
- [Message service](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/service/ChatMessageService.java): `src/main/java/com/alfred_core/service/ChatMessageService.java`
- [Chat messages](https://github.com/agentxzy/aether/blob/main/src/main/java/com/alfred_core/entity/ChatMessage.java): `src/main/java/com/alfred_core/entity/ChatMessage.java`

### Other components

- **User**
- **Ollama service**
- **Gemini service**
- **Tavily API**

## Connections

- User → Chat endpoint: sends chat
- Chat endpoint → Chat orchestrator: delegates (evidence: `src/main/java/com/alfred_core/controller/AlfredChatController.java`)
- Chat orchestrator → Intent routing: routes intent (evidence: `src/main/java/com/alfred_core/service/AlfredChatService.java`)
- Intent routing → Intent embeddings: embeds query (evidence: `src/main/java/com/alfred_core/intent/IntentRouterService.java`)
- Intent routing → Intent dataset: loads examples (evidence: `src/main/java/com/alfred_core/intent/IntentRouterService.java`)
- Chat orchestrator → Prompt strategies: selects prompt (evidence: `src/main/java/com/alfred_core/service/AlfredChatService.java`)
- Chat orchestrator → Unified retrieval: retrieves context (evidence: `src/main/java/com/alfred_core/service/AlfredChatService.java`)
- Chat orchestrator → Conversation context: loads history (evidence: `src/main/java/com/alfred_core/service/AlfredChatService.java`)
- Chat orchestrator → AI provider router: requests generation (evidence: `src/main/java/com/alfred_core/service/AlfredChatService.java`)
- AI provider router → Ollama inference: routes locally
- AI provider router → Gemini inference: cloud fallback
- Ollama inference → Ollama service: calls
- Gemini inference → Gemini service: calls
- Chat orchestrator → Message service: persists turns (evidence: `src/main/java/com/alfred_core/service/AlfredChatService.java`)
- History endpoint → Message service: delegates (evidence: `src/main/java/com/alfred_core/controller/ChatMessageController.java`)
- Conversation context → Chat messages: reads history (evidence: `src/main/java/com/alfred_core/service/ConversationContextService.java`)
- Message service → Chat messages: stores messages
- User → PDF endpoint: uploads PDF
- PDF endpoint → PDF ingestion: delegates (evidence: `src/main/java/com/alfred_core/controller/PdfDocumentController.java`)
- PDF ingestion → Text chunking: chunks text (evidence: `src/main/java/com/alfred_core/service/PdfDocumentService.java`)
- PDF ingestion → Embedding service: embeds chunks (evidence: `src/main/java/com/alfred_core/service/PdfDocumentService.java`)
- PDF ingestion → PDF chunks: stores chunks (evidence: `src/main/java/com/alfred_core/service/PdfDocumentService.java`)
- User → Query endpoint: submits query
- Query endpoint → Keyword search: delegates (evidence: `src/main/java/com/alfred_core/controller/QueryController.java`)
- Unified retrieval → Semantic search: tries semantic (evidence: `src/main/java/com/alfred_core/service/RetrievalService.java`)
- Unified retrieval → Keyword search: falls back (evidence: `src/main/java/com/alfred_core/service/RetrievalService.java`)
- Semantic search → Embedding service: embeds query (evidence: `src/main/java/com/alfred_core/service/SemanticSearchService.java`)
- Semantic search → PDF chunks: reads chunks (evidence: `src/main/java/com/alfred_core/service/SemanticSearchService.java`)
- Keyword search → PDF chunks: searches chunks (evidence: `src/main/java/com/alfred_core/service/PdfSearchService.java`)
- User → Web search API: requests web search
- Web search API → Web search service: delegates
- Web search service → Tavily provider: dispatches search (evidence: `src/main/java/com/alfred_core/automation/web/search/WebSearchService.java`)
- Tavily provider → Tavily API: queries
- User → Scraping API: requests scraping
- Scraping API → Scraping service: delegates
- Scraping service → Web scraper: scrapes page (evidence: `src/main/java/com/alfred_core/automation/web/scraping/ScrapingService.java`)
- Scraping service → Web ingestion: ingests page
- Web ingestion → Text chunking: chunks content (evidence: `src/main/java/com/alfred_core/automation/web/ingestion/WebIngestionService.java`)
- Web ingestion → Embedding service: embeds chunks (evidence: `src/main/java/com/alfred_core/automation/web/ingestion/WebIngestionService.java`)
- Web ingestion → Web chunks: creates chunks (evidence: `src/main/java/com/alfred_core/automation/web/ingestion/WebIngestionService.java`)
