How ontos-ai/knowhere works
Knowhere turns uploaded documents into persistent, hierarchy-aware memory and exposes that memory for agent retrieval. The documented flow runs from API submission through worker ingestion, format-specific parsing, unified memory construction, and retrieval with evidence references. Major documented branches include vision and text parsing, built-in retrieval and MCP tools, plus account and billing APIs. The README describes product behavior broadly; sampled source confirms the parser pipeline, worker task entry points, storage responsibilities, and retrieval routing, but not every API-to-service call.
Main entry points: service.py Worker ingestion · jobs.py Jobs API · routes.py Retrieval routing · database.py Application database
Components 27
API and access
- Document API
apps/api/main.py - Jobs API
apps/api/app/api/v2/routes/jobs.py - Documents API
apps/api/app/api/v2/routes/documents.py - Retrieval API
apps/api/app/api/v2/routes/retrieval.py - Job admission
apps/api/app/api/dependencies/job_admission.py
Ingestion and parsing
- Ingestion workflow
apps/api/app/services/document_ingestion/service.py - Ingestion tasks
apps/worker/app/core/tasks/document_ingestion_tasks.py - Worker ingestion
apps/worker/app/services/document_ingestion/service.py - Format parser
apps/worker/app/services/document_parser/orchestration/parse_pipeline.py - Text track
apps/worker/app/services/document_parser/formats - Vision track
apps/worker/app/services/document_agent - Summary engine
packages/shared-python/shared/services/ai/summary/engine.py
Memory and storage
- Page memory
apps/worker/app/services/page_memory/memory_service.py - Result storage
packages/shared-python/shared/services/storage/result_storage.py - Source storage
packages/shared-python/shared/services/storage/job_file_storage.py - Application database
packages/shared-python/shared/core/database.py
Retrieval and tools
- MCP tools
apps/api/app/mcp/retrieval_server.py - Retrieval routing
packages/shared-python/shared/services/retrieval/execution/routes.py - Graph queries
packages/shared-python/shared/services/retrieval/graph/query_service.py
Account and billing
- Billing workflows
apps/api/app/services/billing/billing_workflow_service.py - Billing API
apps/api/app/api/v1/routes/billing.py - Authentication
apps/api/app/services/auth/dashboard_jwt_authentication_service.py
Other components
- Uploader
- Agent client
- Object store
- Dashboard
- AI models
Connections 29
- Uploader → Document API: submits documents
- Document API → Jobs API: routes requests
- Jobs API → Job admission: checks capacity
- Jobs API → Ingestion workflow: starts ingestion
- Ingestion workflow → Ingestion tasks: dispatches work
- Ingestion tasks → Worker ingestion: runs job
- Worker ingestion → Format parser: parses source
- Format parser → Text track: routes text formats
- Format parser → Vision track: routes vision formats
- Text track → Summary engine: requests summaries
- Vision track → Summary engine: requests summaries
- Summary engine → AI models: calls models
- Worker ingestion → Page memory: builds memory
- Worker ingestion → Source storage: reads source files
- Worker ingestion → Result storage: stores results
- Source storage → Object store: reads and writes
- Result storage → Object store: uploads artifacts
- Jobs API → Application database: reads and writes jobs
- Page memory → Application database: persists memory
- Uploader → Documents API: manages documents
- Agent client → Retrieval API: requests retrieval
- Retrieval API → Retrieval routing: routes query
- Retrieval routing → Graph queries: queries sections
- Retrieval routing → Application database: loads memory
- Agent client → MCP tools: uses corpus tools
- MCP tools → Retrieval routing: dispatches retrieval
- Dashboard → Authentication: provides JWT
- Billing API → Billing workflows: runs billing
- Billing workflows → Application database: reads and writes records