TiloBox
Back to directory
Khoj project preview

Khoj

Open-source AI second brain, personal search assistant, and ChatGPT for your local documents.

LicenseAGPL-3.0
GitHub stars36.7k
Last commit1 months ago
Tags6 topics
SearchAiSecond BrainSelf HostedPythonOllama
Overview

Why consider Khoj?

An open-source, self-hostable personal AI assistant that uses RAG to index and chat with your own documents and data.

Guided learning

Learn Khoj by building

Practical setup notes, real use cases, and copy-ready examples in one focused guide.

4 min read 3 sections
In this guide3 sections

Khoj: Your Personal AI Second Brain

Khoj is a self-hostable, open-source AI application built to serve as a personal research copilot. Unlike general-purpose AI chat interfaces, Khoj is designed to connect directly with your own knowledge base. By using Retrieval-Augmented Generation (RAG), it allows you to index and search through your personal data—including Markdown notes, PDFs, Word documents, Notion workspaces, and GitHub repositories.

The primary goal of Khoj is to provide a unified, privacy-first interface where you can leverage large language models (LLMs) to reason about your own files. You have the flexibility to run the application locally on your own hardware to ensure maximum data privacy, or use cloud-hosted options if convenience is the priority. Khoj supports a wide variety of AI models, enabling you to integrate local models via Ollama or connect to external providers like OpenAI, Anthropic, and Google Gemini.

For users who want to retain ownership of their personal data while benefiting from modern AI capabilities, Khoj fills a critical gap. It is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0) and offers multiple access methods, including a web interface, a desktop application, and direct integrations with popular editors like Obsidian and Emacs. Official documentation and source code are available at https://github.com/khoj-ai/khoj.

Orchestrating Khoj with Docker Compose

Running Khoj locally requires several integrated services to function correctly. Beyond the main application server, Khoj depends on a PostgreSQL database with the pgvector extension for storing and querying vector embeddings, as well as a search engine component (like SearXNG) for web queries.

Because of these interconnected dependencies, the official and most reliable method to deploy Khoj is using Docker Compose. This approach orchestrates the networking and persistent volumes required by the database and application containers automatically.

To get started on a local machine, you need to download the official Docker Compose configuration provided by the Khoj repository. This configuration defines the multi-container environment needed to run the application seamlessly. Official source: https://github.com/khoj-ai/khoj.

Downloading and Starting the Services

The official installation process involves creating a dedicated directory for your Khoj deployment and fetching the docker-compose.yml file from the main branch of the repository. Once the file is downloaded, you can use Docker Compose to pull the necessary images and start the services in detached mode.

Here is the officially documented sequence to download the configuration and start the environment:

bash
1mkdir ~/.khoj && cd ~/.khoj
2wget https://raw.githubusercontent.com/khoj-ai/khoj/master/docker-compose.yml

After the configuration file is saved to your machine, you can start the Khoj environment using the standard Docker Compose command:

bash
1docker-compose up -d

These commands ensure that the necessary volumes are created and the containers are brought up in the correct order. You can optionally open the docker-compose.yml file before running the up command to configure environment variables, such as API keys for external models or an admin password for the Khoj instance.

Connecting Your Data and Clients

Once the Docker Compose stack is running, Khoj exposes a web interface where you can begin indexing your personal files. The initial setup usually involves pointing the application to your local directories or authenticating it with external services like Notion or GitHub.

Khoj processes these inputs by generating vector embeddings, which are stored in the local pgvector database. When you ask a question through one of the supported interfaces, Khoj performs a semantic search against these embeddings, retrieves the most relevant context, and passes it to the selected language model to generate a grounded, accurate response based purely on your personal data.

Whether you prefer interacting with your AI assistant through a dedicated desktop app, directly within your Obsidian vault, or via the web browser, Khoj provides a flexible and privacy-focused solution for managing and querying your digital life.

Related tools

More options with a similar category or technology profile.

Khoj FAQs

Khoj is listed as a Ai Ml tool on TiloBox. Review the overview, features, and official documentation on this page to decide whether it solves your specific workflow.

Start with the project's GitHub repository and official website for supported installation and deployment instructions. Test the setup with representative data or a small project before rolling it out more widely.

Khoj is listed under the AGPL-3.0 license. Read the complete license text and the project's notices before using, modifying, or distributing the software.

Production readiness depends on your requirements. Review maintenance activity, security practices, documentation, backup and upgrade procedures, and compatibility with your stack; then validate it in a non-production environment.

Khoj is listed as an alternative to Notion AI. Compare the core workflow, deployment model, integrations, and licensing against your must-have requirements before switching.