Khoj
An AI second brain. Ask questions about your notes and documents, get in-depth answers, and learn any topic, with an online or local AI model.
- Best for
- Asking questions about documents you give itSummarising and comparing reports, papers and contractsFinding what you wrote in your own notesLearning a topic step by stepPrivate use with AI on your own computer
- Not for
- Chat apps, email or scheduled tasks (use Hermes or OpenClaw)Searching the open web (needs a search service Khoj isn't set up with in deputyOS)Doing things on websites or in your accounts
- Needs
- 4 GB memoryAn AI service, or AI on your computer
Overview
Khoj is an open-source AI second brain. You ask a question in plain words and Khoj looks through the documents and notes you have shared with it for the passages that matter, then has your AI model answer from them. It also answers from general knowledge, reads web pages you link, goes deeper with a research mode, and explains topics like a patient tutor. It suits students, researchers and anyone with a lot of notes or paperwork.
Khoj finds passages by meaning, not just by matching words: a question about “the rent going up” finds the paragraph about “a 5% increase to the monthly lease”. That search runs inside the agent with Khoj’s own small search model. Only the passages relevant to your question are sent to your AI service, together with the question.
In deputyOS you talk to Khoj in the agent’s Chat tab; there is no separate app tab. deputyOS doesn’t open Khoj’s own web app, so the features set up there (its settings and admin pages, the Obsidian and desktop sync apps, Notion, custom agents, image models and emailed automations) aren’t available in a deputyOS agent. Khoj keeps its data inside the agent, and it is in every backup.
Key ideas
- Second brain: the documents and notes you share with Khoj, which it can search and quote from.
- Search by meaning: Khoj compares the meaning of your question with the meaning of each passage, so you don’t need the exact words.
- Chat model: the AI model that writes the answers. Khoj also uses it for in-between steps, such as deciding where to look.
- Slash commands: start a message with
/notes,/general,/online,/researchor/helpto tell Khoj where to look or how hard to work. - Research mode:
/researchmakes Khoj dig deeper into a topic for more accurate, in-depth answers. - Query filters: short codes like
file:"lease.pdf"or-"draft"that limit which passages Khoj uses. - References: the passages and pages Khoj used. Ask for them so you can check its answer.
Set up
- Create the agent. Add an agent → Khoj → Create. The first one downloads once. It needs about 4 GB of memory.
- Connect an AI service. In the Chat tab, choose your AI service and paste its API key, or choose Use AI on this computer.
- Give it a minute. Khoj starts a little slower than other agents because it loads its search models. If Chat says the agent is still starting, wait and send again.
- Ask a general question to check it answers, for example “Explain compound interest with a simple example.”
- Add a document (below) and ask about it.
Add your documents and notes
- In Chat, drop a file on the chat or use the paperclip. Each file can be up to 25 MB. Khoj understands PDF, Word, Markdown, plain text and org-mode files.
- Ask about it. deputyOS also adds each file to Khoj’s library, so you
can ask about it later in any conversation. Start with
/noteswhen the answer must come only from your documents. - If Khoj says it can’t see the document, paste the part you care about straight into your message. Text in the message always reaches it.
- Notes apps like Obsidian keep each note as a Markdown file, so you can attach the notes you need directly.
Use cases
Chat with your documents
Get a summary, the key points or a straight answer from a long document, without reading it all.
You’ll need:
- The agent set up.
- The document (PDF, Word, Markdown or text).
Steps:
- Start a New chat and attach the document.
- Ask for what you need: a summary, the risks, the dates, a comparison.
- Ask follow-up questions; Khoj remembers the conversation.
- Ask which passages it used, and check the important ones yourself.
/notes Summarise this tenancy contract in plain English. List the notice period, the deposit, who pays for repairs, and anything unusual I should ask the landlord about.
/notes Compare the two insurance quotes I attached: price, excess, what's covered and what's excluded. Put it in a table and tell me which pages you used.
A second brain for your notes
Ask questions across your own notes, such as journals, meeting notes, study notes or trip plans, and get answers from what you actually wrote.
You’ll need:
- Your notes as files (Markdown, text, Word or PDF).
Steps:
- Attach the notes you want to ask about (see Set up).
- Start questions with
/notesso Khoj answers from your notes, not from general knowledge. - Narrow it down with query filters:
file:"lisbon-trip.md"uses only that file.+"budget"keeps passages that contain budget;-"draft"drops passages that contain draft.dt>="2024-01-01"keeps passages that mention a date (written as YYYY-MM-DD) from that day on.
/notes What did I decide about the Lisbon trip: dates, where we're staying, and what's still not booked?
/notes What have I written about my knee injury? List each mention with its date, oldest first. dt>="2024-01-01"
Go deep on a question
Get a thorough, well-reasoned answer when a quick reply isn’t enough, using your documents and the web pages you point it to.
You’ll need:
- A capable AI model.
- Optionally, documents or links to work from.
Steps:
- Start your message with
/research. - Attach the documents and paste links to the pages it should read. Khoj reads linked pages without any extra setup.
- Say what you want back: a recommendation, a table, pros and cons.
/research I'm choosing between a heat pump and a new gas boiler for a 1970s house. Using the two quotes I attached and these pages, compare running costs, upfront costs and grants, and give me a recommendation: <paste links here>
Summarise this article in five bullet points and list any claims that need a source: <paste the link here>
Learn a topic
Use Khoj as a patient tutor: explanations at your level, examples, and quizzes.
You’ll need:
- The agent set up. Optionally your course notes or slides.
Steps:
- Say what you’re learning and your level.
- Use
/generalfor general knowledge, or/notesto stick to your course material. - Ask it to quiz you, and to explain anything you get wrong.
/general I'm learning statistics from scratch. Explain what a p-value is in plain words with an everyday example, then ask me three questions to check I understood.
/notes Using my lecture notes, make ten flashcard-style questions on photosynthesis, with short answers at the end.
With AI on your computer
Keep your documents and questions completely private: nothing leaves your computer.
You’ll need:
- An AI app running on this computer (LM Studio or Ollama). See Use AI on your own computer.
- Enough memory for the model and the agent. Khoj’s own guidance for local models is at least 8 GB of memory, ideally a graphics card with 16 GB; a graphics card or an Apple M1 or newer makes answers much faster.
Steps:
- Install the AI app and a model, then Settings → Local AI → Detect again, choose the model and Test.
- In the agent’s Chat setup choose Use AI on this computer (for an agent already set up, choose it in Details).
- Ask questions with
/notesas usual. Expect slower answers than online models: Khoj asks the model several times per answer, so on a computer without a graphics card or Apple M-series chip an answer can take several minutes.
/notes Summarise my notes from this week's meetings into a list of decisions and a list of open action items with owners.
Tips and limits
- Cost: Khoj is free. Your AI service charges for each answer, including
the passages Khoj sends with your question.
/researchcan cost more. Set a spending limit with your AI service. - Privacy: the search index is built inside the agent. With an online AI service, the passages relevant to each question are sent to it; with AI on your computer nothing leaves. Self-hosted Khoj also sends anonymous usage counts (never your content) to its developers unless telemetry is turned off; see Khoj’s privacy page.
- Model choice: larger models follow your documents more faithfully. Ask for page numbers or quotes when accuracy matters.
- Big collections: searching many documents uses memory. If the agent struggles, Details → Performance suggests a better size.
- Not in deputyOS: Khoj’s web app and admin panel, the Obsidian, desktop and Emacs sync apps, Notion and GitHub sync, custom agents, image generation, voice, and automations (which send email).
- Keep it running: the agent stops when your computer sleeps. See Sleep and power.
Troubleshooting
Chat says the agent is still starting
Khoj loads its search models when it starts, which takes longer than other platforms. Wait a minute and send your message again. If it never becomes ready, Stop and Start the agent.
The answer ignores my document
- Attach the document again in the conversation you’re asking in.
- Start the question with
/notes, and addfile:"<file name>"to point at that file. - Paste the important section straight into your message.
- Ask a more specific question: names, dates or headings from the document.
Online questions come back without web results
Khoj has no web search service key in deputyOS. Paste links to the pages
you want it to read, or use /general for general knowledge.
Answers sound confident but are wrong
Use /notes so it answers only from your documents, ask it to quote the
passage it relied on, and try a larger model.
Chat says the AI service rejected the key or ran out of credit
Check your account with that service (key valid, credit left), then connect it again from the agent’s setup. With AI on your computer, make sure LM Studio or Ollama is running.
It’s very slow, or the agent stops by itself
It may be short of memory: open Details → Performance and use Apply and restart, or stop other agents. With AI on your computer, try a smaller model. See When something isn’t working.