Khoj

Self-hostable AI assistant over your personal notes

Notes & Knowledge Base ★ 37.5k stars Medium setup AGPL-3.0

Khoj is an open-source, self-hostable AI application that lets you search and chat with your notes, documents, and knowledge base. It connects to Markdown, Org-mode, PDF, and other personal data sources.

Key features

  • AI chat over personal notes
  • Semantic search across documents
  • Connects many data sources
  • Self-hostable

Pros & cons

Strengths

  • Turns notes into an AI knowledge base
  • Supports local LLMs

Trade-offs

  • Higher resource needs
  • Setup more involved

Khoj replaces

Last reviewed Aug 26, 2026 · 796 words

Khoj is what you want when the question is "what did I write about this in 2022" rather than "explain quantum computing": a chat interface whose retrieval is built around your own notes, documents and PDFs, with a local model answering if you choose. That separates it from the general chat front-ends, which treat your files as an attachment to a conversation. It is heavier than a note app and lighter than a RAG platform: plan on 2 GB of RAM before the model, a Postgres database with pgvector, and an hour of setup. 36,719 stars, AGPL-3.0, Python, and a hosted version exists if you want to try the experience before running it.

The stack is Khoj plus Postgres, nothing else

services:
  database:
    image: pgvector/pgvector:pg16
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: postgres
    volumes:
      - ./khoj_db:/var/lib/postgresql/data
  server:
    image: ghcr.io/khoj-ai/khoj:latest
    ports:
      - "42110:42110"
    environment:
      POSTGRES_HOST: database
      POSTGRES_PORT: 5432
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: postgres
      KHOJ_ADMIN_EMAIL: [email protected]
      KHOJ_ADMIN_PASSWORD: change-me
    volumes:
      - ./khoj_models:/root/.cache/torch
      - ./khoj_config:/root/.khoj
    depends_on: [database]

First boot downloads the embedding model into the torch cache, which is a few hundred megabytes and why that volume matters. The UI is at port 42110; the admin panel is at /server/admin and it is a Django admin, which tells you what kind of project this is under the hood. With no login provider configured the server runs in anonymous mode, which is fine on a VPN and wrong on the public internet. For a household, wire up Google sign-in or email magic links (the latter needs an outbound email service configured) so each person gets their own indexed notes and chat history; the multi-user tag is real, not marketing.

Chat models are configured in the admin, not in env vars

This is the step that trips people. Khoj does not read an Ollama URL from the environment; you open the admin panel, add an AI model API entry with the base URL of any OpenAI-compatible server (for Ollama that is http://ollama:11434/v1/), then add a chat model referencing it by name, and finally set it as the default. Embeddings are separate and default to a local sentence-transformers model that runs on CPU, so search works with no external model at all. The result is a fully offline stack if you want one, or a hybrid where search is local and chat goes to a paid API.

Getting your notes in

Three routes. The desktop app watches folders and pushes changes. The Obsidian plugin syncs a vault directly and adds a chat pane inside Obsidian. The Emacs package does the same for Org-mode, which is a tell about the project's origins. Markdown, Org, PDF and plain text are the core formats, with Notion and GitHub as connected sources; everything is chunked, embedded and stored in Postgres, and re-indexing happens incrementally as files change. A few thousand Markdown notes index in minutes on a laptop-class CPU.

Where it beats AnythingLLM and where it doesn't

AnythingLLM is the closest rival and is more of a general RAG workbench: many document sources, a workspace per project, agents. Khoj is narrower and better at the "my personal notes" case because of the sync clients and because search, not just chat, is a first-class feature; typing a half-remembered phrase and getting the note back is often more useful than a chat answer. Khoj also has agents with custom instructions and scheduled automations that email you, which are fun but not why you install it. Neither replaces a note app; both sit next to one, and the notes category is where the writing tools live.

Resource reality

Idle RAM sits between 1 and 2 GB with the embedding model loaded. Indexing spikes CPU. Add a chat model on the same box and you are into the Ollama in production territory of GPU sizing. It will run on a 4 GB VPS for search alone; it will not run comfortably there with a local chat model beside it.

What I'd do

The compose stack above on a box with 8 GB or more, Ollama on the same host with an 8B model, and the Obsidian plugin or desktop app pointing at your notes folder. Leave the local sentence-transformers embedder as-is and configure Ollama as the default chat model in the admin panel. Give it a week of real questions. If you find yourself using search more than chat, you have found the reason it exists; if you want to chat with arbitrary uploaded PDFs across projects, AnythingLLM is the better fit.

Compare Khoj

21 head-to-head comparisons.

Similar notes & knowledge base apps