Skip to content

Overview

Knowledge ​

Knowledge is a folder of your documents that the assistant searches by meaning before it answers.

AskWhat does the lease say about pets?

The assistant calls knowledge_search and answers from the passages it gets back, naming the file and the section. It says so when nothing matches.

AskWhich of my notes mention the boiler?

Exact words count too: a passage found by its words is marked as a keyword match, which suits a name or a code.

AskSummarise the invoice.pdf I put in the folder.

A PDF is not indexed, so the search finds nothing in it. Convert it to text or Markdown first.

What it gives you ​

  • A folder, not an upload. Put files into nocturn-data/workspaces/<name>/mnt/knowledge/, in subfolders as you like. Files that start with a dot are ignored.
  • Search by meaning and by words. Each document is cut at its headings into passages. A question is matched by similarity of embeddings and by exact terms. Results carry the file, the heading and a similarity score the assistant weighs itself.
  • Found by the assistant, not trusted. A passage reaches the model as quoted text, never as an instruction, so a document that says "ignore your rules" does not change them.
  • Kept up to date. A running daemon compares the folder with the index every minute. Only files that changed are embedded again.
  • Free to ask. knowledge_search is allowed in chats and voice without a question, and an agent gets it when you accept its request; it only reads.

Which files are indexed ​

FileIndexed
.md, .markdown, .mdxyes, cut at headings
.txt, .textyes
.pdf, Office files, pictures, anything elseno: named as skipped
a file over 8 MiBno
a file whose name starts with .no

PDFs are not read: extracting text from them needs a reader nocturn does not have. The index also holds at most 50,000 passages; a file that would pass it is refused and named, and the rest still works.

Set it up ​

Searching needs an embedding endpoint: NOCTURN_EMBED_BASE_URL, or OPENAI_BASE_URL when that is not set, with NOCTURN_EMBED_API_KEY, NOCTURN_EMBED_MODEL and NOCTURN_EMBED_DIMS (Configuration). With no endpoint at all the tool does not exist.

Indexing sends your documents out

Embedding a document sends its text to the configured endpoint, and so does every question. Point it at a provider you accept that for, or at one on your own network.

sh
nocturn knowledge index     # now, instead of within a minute
nocturn knowledge status    # how many files and passages are indexed, and where
nocturn knowledge ls        # the documents in the index

Each takes -w <workspace> (default main), before the other arguments. index names every file it skipped and every file it could not index, with the reason. When you change the embedding model or its length, delete knowledge.idx.json in the workspace's folder and run nocturn knowledge index again: the old vectors do not fit.

How it works ​

The index is the file knowledge.idx.json in the workspace's folder. A file whose size and time are unchanged is not even opened; one that was only touched is not embedded again.

Explore know ​

nocturn is open source. Example hosts and people on these pages are made up.