# KuraDB RAG

KuraDB is an independent RAG (Retrieval-Augmented Generation) daemon. It is a separate binary (`kura`) that Agenvoy neither spawns nor owns — Agenvoy reaches it the same way it reaches any other external capability: **as an MCP server**. Registering it writes one entry into `mcp.json`; from then on KuraDB's tools appear in the registry under the `mcp__` prefix like any other MCP tool, and disappear when the server is not registered or not connected.

## What it is

KuraDB ([pardnchiu/KuraDB](https://github.com/pardnchiu/KuraDB)) is a self-developed local document index that:

- Indexes user files (notes, inbox, code, ...) into multiple named databases
- Provides keyword search via `gse` tokenization (Chinese-aware)
- Runs entirely on the user's machine — no external service

## Integration model

There is **no** Agenvoy-side KuraDB package any more. The integration became a plain MCP registration in v0.32.1, and `internal/runtime/kuradb/` plus the `/kuradb` TUI wizard were removed in v0.35.0 — install, update and reconnect are no longer Agenvoy's job. What remains is the ordinary MCP client path:

| Step | Where |
|---|---|
| Install the binary | `curl -fsSL https://agenvoy.com/scripts/kuradb.sh \| bash`, run yourself in a real terminal (it needs a TTY for `sudo` and package-manager prompts) |
| Register the server | `/mcp` → add, or one entry in `~/.config/agenvoy/mcp.json` |
| Reconnect after a change | `/mcp` → `kura` → reconnect, or `POST /v1/mcp/reconnect` (all servers) |

```json
{
  "kura": { "command": "kura", "args": ["mcp"] }
}
```

There is no HTTP client, no endpoint file, no health-check goroutine, and no key syncing on the Agenvoy side. Agenvoy's own updater (`public/scripts/update.sh`) no longer touches `kura` either — update it with the same install script.

### Tools

KuraDB's own MCP server decides what it exposes; Agenvoy does not define these tools:

| Tool | Description |
|---|---|
| `mcp__kura__list_rag` | List available KuraDB databases (e.g. `notes`, `inbox`, `code`) |
| `mcp__kura__search_rag` | Search a database by keyword (`mode` accepts only `keyword`; `limit` 1-100, default 10), results grouped by source file |

Because they arrive through the MCP client, they are absent from the registry entirely when the server is unregistered or fails to connect — the LLM never sees a stub it cannot call.

## Web-search guide and RAG tools

`reasoning_guide(topics=[web_search])` carries the live-web rule: any non-smalltalk information query (people, organisations, facts, current events, prices) goes through `search_web`, a result worth citing is read with `fetch_page`, live figures come from tool output only, and each claim names the page and a URL that appeared in tool output. The topic was `rag_web` until v1.2.1, when the RAG-pairing half of the rule was dropped: the guide no longer tells the model to query a RAG collection alongside the web search. A KuraDB tool in the list is an ordinary tool the model may call when a question plausibly falls in an operator-curated collection (house rules, conventions, internal docs); nothing in the guide forces it.

## Files & paths

| Path | Purpose |
|---|---|
| `kura` on `PATH` | KuraDB binary, installed by `kuradb.sh` |
| `~/.config/agenvoy/mcp.json` | Where the `kura` server entry is written |
| `~/.config/kuradb/` | KuraDB-side config / data dir, managed entirely by KuraDB |
