Khoj
AI second brain โ self-hosted RAG with web search, agents, and automation
๐ Overview
Khoj is an open-source AI second brain that indexes your documents (markdown, PDFs, org-mode, Notion, Google Drive) and makes them searchable via natural language โ with built-in web search, custom agents, scheduling, and deep research. Unlike Obsidian AI or Notion AI (which lock you into their ecosystem), Khoj connects to your existing tools and works with any LLM (GPT-4, Claude, Gemini, Llama, Mistral, Qwen). It supports offline LLMs via Ollama/Llama.cpp for full data sovereignty, and the agent system can schedule automations, run deep research, and generate images. Available as a web app, Obsidian plugin, Emacs package, WhatsApp bot, and desktop app.
โจ Key Features
- โข35K+ GitHub stars โ most popular open-source AI second brain
- โขMulti-source ingestion: markdown, PDFs, org-mode, Notion, Google Drive
- โขWorks with any LLM: GPT-4, Claude, Gemini, Llama, Mistral, Qwen
- โขOffline mode via Ollama/Llama.cpp โ full data sovereignty
- โขBuilt-in web search: Brave, DuckDuckGo, Perplexity
- โขAgent system: scheduled automations, deep research, image generation
- โขMulti-platform: web, Obsidian plugin, Emacs, WhatsApp, desktop
๐ฏ The Problem It Solves
Your knowledge is scattered across notes, docs, emails, and bookmarks โ traditional search finds keywords, not meaning. Khoj indexes everything into a vector DB and lets you ask natural language questions against your entire personal knowledge base, with web search fallback and agent-driven automation.
๐ง How It Works
Khoj ingests documents from multiple sources (local files, Notion, Google Drive, markdown, PDFs, org-mode), chunks and embeds them into a vector database, and serves retrieval-augmented generation (RAG) queries via any LLM. The agent system supports multi-step reasoning, scheduled automations (daily digests, research monitoring), and deep research (multi-source synthesis). Web search (Brave, DuckDuckGo) supplements your local knowledge. Offline mode uses Ollama/Llama.cpp for air-gapped deployments.
๐ Installation & Quick Start
Installation
docker run -p 42110:42110 ghcr.io/khoj-ai/khoj:latestQuick Start
- docker compose up
- Point to your documents
- Ask questions
- Create search agents
โ Pros
- โขMost comprehensive document ingestion โ connects to everything
- โขAny LLM support โ no vendor lock-in
- โขOffline mode for air-gapped deployments
- โขBuilt-in web search supplements local knowledge
- โขAgent system with scheduled automations
- โขMulti-platform: Obsidian, Emacs, WhatsApp, desktop
- โขSelf-hosted is completely free
โ Cons
- โขSelf-hosting requires PostgreSQL + vector DB โ not lightweight
- โขUI is functional but not polished
- โขFree cloud tier has tight query limits
- โขComplex multi-step agents can be slow
- โขAGPL-3.0 license has commercial use restrictions
๐ฌ Practitioner Verdict
โKhoj is the most practical AI knowledge base for power users โ the multi-source ingestion is best-in-class, the Obsidian/Emacs integrations are genuinely useful, and the offline LLM support is unmatched. The trade-off: self-hosting requires PostgreSQL and a vector DB, the UI is functional but not polished, and the free cloud tier has tight query limits. For researchers, writers, and anyone with a large personal knowledge base, Khoj is the default.โ
Self-Hosted (Free)
Open source, MIT/Apache licensed. Run it yourself.
โญ Star & Clone on GitHubFree forever. Your infrastructure, your data.
Khoj Cloud Free
Limited queries, basic features
- Limited queries
- Basic agents
- Community support
Khoj Cloud Pro
Unlimited queries, priority
- Unlimited queries
- Priority support
- Advanced agents
Deployment Options
Ways to run Khoj in production
๐ Specifications
- Language
- Python
- License
- AGPL-3.0
- Platform
- Linux, macOS, Windows
- Supported Models
- REST API, CLI
๐ฐ Pricing Reality
Self-hosted is 100% free AGPL-3.0. Cloud: Free tier (limited queries), Pro 0/mo (unlimited queries, priority), Enterprise custom (SSO, VPC, dedicated). LLM API usage billed separately unless using offline models.