Overview: Khoj is an open-source personal AI assistant designed to act as your second brain—integrating your local documents, web knowledge, and any LLM (like Llama3, GPT, Claude, or Gemini) into a unified interface. It’s built for users who want control over their data and AI interactions without relying on third-party cloud services. Whether you’re a researcher, writer, or developer managing large document sets, Khoj lets you ask natural language questions and get precise answers pulled from your PDFs, Markdown files, Notion pages, or live web results. With support for self-hosting on your machine or deploying to the cloud, Khoj ensures privacy while scaling from a personal tool to an enterprise-grade AI system.
Khoj’s architecture is modular and extensible, supporting semantic search over local files, multi-model LLM backends, custom agent creation, and integrations with Obsidian, Emacs, WhatsApp, and desktop apps. It removes the friction of switching between tools by unifying search, chat, automation, and content generation into a single interface—making it ideal for knowledge workers who need to process, recall, and act on information quickly and privately.
What You Get
- Chat with any LLM - Connect to local models (Llama3, Qwen, Mistral via llama.cpp) or cloud APIs (GPT, Claude, Gemini) through a unified chat interface. Configure models per conversation or globally via config file.
- Semantic search across documents - Index and query PDFs, Markdown (.md), Word docs, Org-mode files, and Notion pages with context-aware retrieval. Uses advanced embedding models for accurate results.
- Custom agent creation - Build autonomous agents with custom personas, knowledge bases, and tools. Define behavior via YAML configuration to automate research, summarization, or task execution.
- Web and offline search - Ask questions about live web content using built-in browsing tools or query your local document store without internet access.
- Multi-platform access - Use Khoj via web UI, Obsidian plugin, Emacs package, desktop app (Windows/macOS/Linux), or WhatsApp bot—all synced to the same backend.
- Automation & notifications - Schedule automated research tasks (e.g., daily newsletter generation) and receive summaries via email or in-app alerts.
- Image generation & TTS - Generate images from text prompts using integrated diffusion models and enable text-to-speech to listen to responses on desktop or mobile.
- Self-hosted and open source - Deploy Khoj entirely on your own infrastructure using Docker or pip install. No data leaves your system unless you opt-in.
Common Use Cases
- Building a personal knowledge base - A researcher indexes 50+ PDFs and Notion pages on quantum computing, then asks Khoj to compare theories across papers—getting cited answers with source links.
- Automating daily research tasks - A journalist sets up an agent to scan news sites and internal docs every morning, then emails a summary of key developments with sources.
- Problem → Solution flow: Lost in documents - You have 200 Markdown notes from Obsidian and can’t find that one command. Khoj lets you ask, “How do I set up Emacs org-mode calendar?” and returns the exact note with context.
- Team knowledge consolidation - A DevOps team uses Khoj Enterprise to centralize internal wikis, runbooks, and incident reports into a searchable AI assistant accessible via chat or Slack integration.
- Offline AI for privacy-sensitive work - A lawyer uses Khoj locally on their machine to analyze case files without uploading sensitive data to cloud APIs.
- Building custom AI assistants - A developer creates an agent named “ResearchBot” that only uses Llama3, knows all company project docs, and answers engineering questions—deployed via Docker on a private server.
Under The Hood
Khoj is a multifaceted AI-powered personal knowledge management platform designed to unify various productivity tools and data sources into a cohesive experience. It supports multiple deployment models and client interfaces, offering users a seamless way to organize, search, and interact with their information across desktop, web, and mobile environments.
Architecture
Khoj follows a monolithic architecture with a modular structure that supports diverse deployment targets and client interfaces. The system emphasizes clear separation of concerns and extensible design patterns.
- Modular organization allows for independent development and integration of features
- Supports multiple client interfaces including web, desktop, and mobile applications
- Extensible architecture enables integration of various AI models and data sources
Tech Stack
The project leverages a diverse tech stack to support its cross-platform and AI-driven capabilities, combining modern web and backend technologies.
- Built primarily in Python with Django as the core backend framework, complemented by React and Electron for client interfaces
- Integrates AI and NLP libraries such as Hugging Face Transformers, Sentence Transformers, and OpenAI for language processing
- Uses Bun, Gradle, and Docusaurus alongside Django, FastAPI, and other utility packages for build, development, and documentation
- Employs pytest, ESLint, and Ruff for testing, linting, and code quality validation across environments
Code Quality
The codebase reflects a mature approach to testing and error handling, with consistent patterns and good structural organization.
- Comprehensive test suite covers various modules and scenarios to ensure reliability
- Widespread use of exception handling and try/catch blocks for robust error management
- Code consistency is maintained through established conventions and linting practices
- Some technical debt remains in the form of duplicated logic and legacy configurations
What Makes It Unique
Khoj distinguishes itself through its unified approach to AI-powered knowledge management across multiple platforms and data sources.
- Combines a robust backend with cross-platform frontend implementations for consistent user experience
- Modular architecture supports diverse data ingestion methods and extensible AI model integration
- Designed for local-first deployment while enabling cloud and hybrid usage patterns