How hydra-db/open-glean works
Open Glean is an AI workspace over Hydra DB: users connect credentials, choose a database or collection scope, then ask questions against their knowledge and receive streamed, cited answers. Deep Research expands this into planned sub-questions and live progress; other major capabilities include context management, integrations, collections, and a knowledge mindmap. The graph combines sampled client/server relationships with documented capabilities; some feature-page internals and the exact Deep Research client-to-server wiring were not sampled.
Main entry points: api.ts Hydra client · [id]/page.tsx Chat workspace · qa.ts Q&A engine · settings/page.tsx Settings
Components 26
Workspace
- Ask composer
components/AskSearchBar.tsx - Chat workspace
app/(app)/chat/[id]/page.tsx - Scope switcher
components/ScopeSwitcher.tsx - Research timeline
components/ResearchTimeline.tsx - Context manager
app/(app)/context/page.tsx - Collections
app/(app)/collections/[slug]/page.tsx - Integrations
app/(app)/integrations/page.tsx - Knowledge mindmap
app/(app)/mindmap/page.tsx - Settings
app/(app)/settings/page.tsx
Question answering
- Q&A engine
lib/qa.ts - Research planner
app/api/research/route.ts - Citation rendering
lib/citations.ts
Server services
- Hydra client
lib/api.ts - Hydra proxy
app/api/hydra/[...path]/route.ts - Hydra SDK
lib/hydra/client.ts - LLM chat API
app/api/llm/chat/route.ts - LLM service
lib/llmServer.ts - Key management API
app/api/auth/key/route.ts - Encrypted session
lib/session.ts - Chat persistence API
app/api/chats/route.ts
Persistence
- Browser config
lib/store/config.tsx - Conversation state
lib/store/chat.tsx - MongoDB persistence
lib/mongo.ts
Other components
- User
- Hydra DB
- LLM provider
Connections 31
- User → Ask composer: asks
README.md - Ask composer → Q&A engine: starts query
components/AskSearchBar.tsx - Chat workspace → Q&A engine: runs Q&A
app/(app)/chat/[id]/page.tsx - Q&A engine → Hydra client: retrieves context
lib/qa.ts - Hydra client → Hydra proxy: proxies requests
lib/api.ts - Hydra proxy → Hydra SDK: delegates requests
app/api/hydra/[...path]/route.ts - Hydra SDK → Hydra DB: queries
README.md - Q&A engine → LLM chat API: requests streamed answer
README.md - LLM chat API → LLM service: uses
app/api/llm/chat/route.ts - LLM service → LLM provider: calls completions
lib/llmServer.ts - Q&A engine → Citation rendering: builds citations
lib/qa.ts - Citation rendering → Chat workspace: renders sources
app/(app)/chat/[id]/page.tsx - Chat workspace → Research planner: starts research
- Research planner → Hydra SDK: retrieves research context
- Research planner → LLM service: plans and synthesizes
app/api/research/route.ts - Research timeline → Chat workspace: shows progress
app/(app)/chat/[id]/page.tsx - User → Settings: connects account
README.md - Settings → Key management API: submits credentials
README.md - Key management API → Encrypted session: stores credentials
app/api/auth/key/route.ts - Key management API → Hydra SDK: verifies Hydra key
app/api/auth/key/route.ts - Browser config → Key management API: loads key status
lib/store/config.tsx - Scope switcher → Hydra client: sets query scope
- Context manager → Hydra client: manages knowledge
app/(app)/context/page.tsx - Collections → Hydra client: searches collection
app/(app)/collections/[slug]/page.tsx - Integrations → Hydra client: manages connectors
app/(app)/integrations/page.tsx - Knowledge mindmap → Hydra client: loads knowledge graph
app/(app)/mindmap/page.tsx - Chat workspace → Conversation state: updates conversations
app/(app)/chat/[id]/page.tsx - Conversation state → Chat persistence API: persists chats
- Chat persistence API → MongoDB persistence: reads and writes
app/api/chats/route.ts - User → Settings: chooses model
README.md - Settings → Browser config: stores preferences
app/(app)/settings/page.tsx