In Claude Code the client is the model, so the server no longer runs one. execute_code runs a Python program per call in the analysis sandbox over the selected documents and returns what it printed; the sandbox is created and closed per call so Monty's cumulative budget and a frozen mount never outlive a program. --no-agents goes with the two tools, and format_citations in haiku.rag.utils goes with its only caller. The sandbox exposes chunk metadata to code: chunk_meta on search results, metadata on list_documents rows and in metadata.json, and chunks.jsonl per document. A host-side failure inside a program, a document read or an in-code search raising, reaches the program by exception type only and is logged with its traceback. recovery_hint moves to haiku.rag.sandbox. Closes #604.
3 KiB
| name | description | allowed-tools | |||||||
|---|---|---|---|---|---|---|---|---|---|
| haiku-rag | Search, read and compute over the user's haiku.rag knowledge base through the haiku-rag MCP tools. Use whenever a request could be answered from the user's ingested documents, when asked to find, look up, check or cite something in their documents or knowledge base, or when the question is about the user's own material rather than general knowledge. |
|
Working with the knowledge base
Check the knowledge base before answering from memory whenever the question could be about the user's documents. Say so when it has nothing relevant.
Find
search_documents is the first call. Results come best first with the document
title, section headings, the matched chunk's metadata when it has any, and the
passage in its section. filter restricts which
documents are searched, limit how many results come back. If it misses,
rephrase once or narrow with a filter before concluding the material is not
there.
Read
Every search result shows its Document ID (and Collection when there are
several); pass them to the read tools. get_document returns a document's
whole text in reading order. For a long one, get_document_outline gives the
heading tree with page numbers and get_document_section the text of one
section, subsections included.
Compute
execute_code runs a Python program on the server over the same documents.
Under /documents/{id}/ each has metadata.json, content.txt, items.jsonl,
chunks.jsonl and toc.json, and the program can await search(query) and
await list_documents(). Write code when the answer is a count, an aggregate, a
comparison across many documents, a lookup by document or chunk metadata, or a
pattern over whole documents: whatever search cannot rank. Each call is one
program and variables do not carry over, so gather, compute and print a
compact result in the same program. filter and sources select the documents
it sees. Answer and cite from what it printed.
Explore
list_documents shows what is stored: titles, URIs and metadata. It is how you
learn what a filter can match.
Filters
A SQL WHERE clause over the document columns id, uri, title,
created_at, updated_at, metadata. metadata is a JSON string, so match
it with LIKE: metadata LIKE '%"author": "Smith"%'. Also uri LIKE '%.pdf',
title = 'Q3 report'.
Results and citations
Rank is the signal; scores are not comparable across queries and are never
confidence. Cite the document title or URI, the section heading and page
numbers when present. When results carry source, the server covers several
collections: name it, and pass sources to search a subset.