@autorag/librarian 2.10.0 → 2.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/LICENSE +195 -21
  2. package/NOTICE +17 -21
  3. package/README.md +335 -161
  4. package/dist/agent/agent.d.ts +67 -2
  5. package/dist/agent/context-token-guard.d.ts +23 -0
  6. package/dist/agent/jev-extension.d.ts +5 -4
  7. package/dist/agent/jikji-find-tool.d.ts +1 -0
  8. package/dist/agent/pi-session.d.ts +35 -2
  9. package/dist/agent/request-limits.d.ts +20 -0
  10. package/dist/agent/search-all-tool.d.ts +1 -0
  11. package/dist/agent/search-single-datasource-tool.d.ts +1 -0
  12. package/dist/cli/config.d.ts +13 -11
  13. package/dist/cli/index.js +2573 -800
  14. package/dist/cloud/config.d.ts +18 -0
  15. package/dist/cloud/jev-backend.d.ts +90 -0
  16. package/dist/core.js +2185 -418
  17. package/dist/datasource/crawler-skill.d.ts +17 -0
  18. package/dist/datasource/sidecar/config.d.ts +26 -0
  19. package/dist/datasource/sidecar/descriptors.d.ts +67 -0
  20. package/dist/datasource/sidecar/fusion.d.ts +25 -0
  21. package/dist/datasource/sidecar/index.d.ts +131 -0
  22. package/dist/datasource/sidecar/methods.d.ts +27 -0
  23. package/dist/datasource/types.d.ts +3 -1
  24. package/dist/embedding-runtime/index.d.ts +6 -6
  25. package/dist/embedding-runtime/manifest.d.ts +0 -12
  26. package/dist/embedding-runtime/types.d.ts +1 -1
  27. package/dist/index.js +2210 -439
  28. package/dist/mcp/index.js +2205 -438
  29. package/dist/minsync/client.d.ts +3 -3
  30. package/dist/minsync/installer.d.ts +1 -1
  31. package/dist/minsync/process.d.ts +1 -0
  32. package/dist/minsync/types.d.ts +1 -1
  33. package/dist/parser/defaults.d.ts +6 -4
  34. package/dist/parser/ocr-engines.d.ts +6 -0
  35. package/dist/retrieval/index.d.ts +1 -1
  36. package/dist/retrieval/rerank.d.ts +20 -3
  37. package/licenses/embedding-assets.json +0 -35
  38. package/package.json +24 -27
  39. package/skills/autorag/SKILL.md +1 -1
  40. package/skills/autorag-doctor/SKILL.md +1 -1
  41. package/skills/autorag-lite-setup/SKILL.md +2 -2
  42. package/skills/autorag-setup/SKILL.md +2 -2
  43. package/licenses/gemma-notice.txt +0 -24
  44. package/licenses/gemma-section-3.2-flow-down.txt +0 -9
  45. package/licenses/gemma-terms-of-use.html +0 -4750
  46. package/licenses/gemma-terms-of-use.txt +0 -158
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  <a href="https://www.npmjs.com/package/@autorag/librarian"><img src="https://img.shields.io/npm/dm/@autorag/librarian.svg?style=flat-square&color=818cf8" alt="npm downloads" /></a>
8
8
  <a href="https://github.com/Marker-Inc-Korea/AutoRAG/stargazers"><img src="https://img.shields.io/github/stars/Marker-Inc-Korea/AutoRAG?style=flat-square&logo=github&color=f59e0b" alt="GitHub stars" /></a>
9
9
  <a href="https://github.com/Marker-Inc-Korea/AutoRAG/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/Marker-Inc-Korea/AutoRAG/ci.yml?branch=main&label=CI&style=flat-square" alt="CI Status" /></a>
10
- <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg?style=flat-square" alt="License: MIT" /></a>
10
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-green.svg?style=flat-square" alt="License: Apache-2.0" /></a>
11
11
  <img src="https://img.shields.io/badge/node-%3E%3D24.0.0-informational.svg?style=flat-square" alt="Node >= 24" />
12
12
  <img src="https://img.shields.io/badge/bun-%3E%3D1.2-black.svg?style=flat-square&logo=bun" alt="Bun >= 1.2" />
13
13
  </p>
@@ -24,6 +24,141 @@
24
24
 
25
25
  ---
26
26
 
27
+ ## 🖥️ The desktop app
28
+
29
+ **A Finder for your computer that understands what's inside your files.** The
30
+ AutoRAG desktop app puts this librarian behind a real file manager: browse your
31
+ folders as usual, then ask a question and get an answer that cites the files,
32
+ chats, and mail it came from. Everything it searches with is the engine in this
33
+ repository.
34
+
35
+ <p align="center">
36
+ <img src="assets/app/finder.webp" alt="AutoRAG desktop app: a folder in list view with a version stack expanded and the index column" width="100%" />
37
+ </p>
38
+
39
+ <table>
40
+ <tr>
41
+ <td width="50%" valign="top">
42
+
43
+ ### 🔎 Just ask
44
+
45
+ Ask the way you'd ask a teammate. The librarian reads the files and writes back,
46
+ every claim linked to the passage behind it. Drag files, folders, or links into
47
+ a question to ask about just those.
48
+
49
+ </td>
50
+ <td width="50%" valign="top">
51
+
52
+ <img src="assets/app/ask.webp" alt="An answer about the Seoul office lease with numbered citations" />
53
+
54
+ </td>
55
+ </tr>
56
+ <tr>
57
+ <td width="50%" valign="top">
58
+
59
+ <img src="assets/app/versions.webp" alt="A folder in list view with document versions stacked under one row" />
60
+
61
+ </td>
62
+ <td width="50%" valign="top">
63
+
64
+ ### 🗂️ Spot the twins
65
+
66
+ `proposal-final`, `proposal-v3`, `proposal (1)`: stacked into one row, newest
67
+ on top, tagged **Latest**, **Similar**, or **Identical**. Powered by
68
+ [dupey](https://github.com/NomaDamas/dupey), the same scan as
69
+ `autorag duplicates`.
70
+
71
+ </td>
72
+ </tr>
73
+ <tr>
74
+ <td width="50%" valign="top">
75
+
76
+ ### ⌨️ Space to see anything
77
+
78
+ Markdown, code, PDF, video, audio, Office, and HWP/HWPX previewed instantly in
79
+ Quick Look. HWP pages are drawn locally by
80
+ [rhwp](https://github.com/edwardkim/rhwp); Hancom Office is not required.
81
+
82
+ </td>
83
+ <td width="50%" valign="top">
84
+
85
+ <img src="assets/app/quick-look.webp" alt="Quick Look showing a multi-page PDF with a page rail" />
86
+
87
+ </td>
88
+ </tr>
89
+ <tr>
90
+ <td width="50%" valign="top">
91
+
92
+ <img src="assets/app/panes.webp" alt="Two folder panes side by side, each with its own tabs" />
93
+
94
+ </td>
95
+ <td width="50%" valign="top">
96
+
97
+ ### 🪟 A real file manager
98
+
99
+ Tabs and split panes: drag a tab to an edge to split, and every pane keeps its
100
+ own tabs, so a folder and a conversation sit side by side. Folders update live
101
+ as other apps change them.
102
+
103
+ </td>
104
+ </tr>
105
+ </table>
106
+
107
+ **And more:** hybrid keyword + meaning search with a reranker · scheduled
108
+ re-indexing that runs even while the app is closed · an *Ask* entry in the
109
+ Finder and Explorer right-click menu · light and dark mode · Korean, English,
110
+ Japanese, and Simplified Chinese.
111
+
112
+ ### Every place, one search
113
+
114
+ The app connects the same [datasources](#-supported-datasources) the librarian
115
+ does, and searches them right alongside your files:
116
+
117
+ <table>
118
+ <tr>
119
+ <td align="center" width="25%">💬<br><b>Slack</b><br>Channels and threads</td>
120
+ <td align="center" width="25%">💛<br><b>KakaoTalk</b><br>Chats on this computer</td>
121
+ <td align="center" width="25%">🎮<br><b>Discord</b><br>Servers and forums</td>
122
+ <td align="center" width="25%">✈️<br><b>Telegram</b><br>Chats and channels</td>
123
+ </tr>
124
+ <tr>
125
+ <td align="center">📱<br><b>WhatsApp</b><br>Messages, read-only</td>
126
+ <td align="center">✉️<br><b>Mail</b><br>Every inbox you sign in to</td>
127
+ <td align="center">🐙<br><b>GitHub</b><br>Repos, issues, PRs</td>
128
+ <td align="center">🔮<br><b>Obsidian</b><br>Your vaults</td>
129
+ </tr>
130
+ </table>
131
+
132
+ ### Private by design
133
+
134
+ - **Embedded on your machine.** Document understanding runs on the local
135
+ [`qwen3-embedding-0.6b`](docs/model-cards/qwen3-embedding-0.6b.md) model.
136
+ File contents are never sent to a remote embedder.
137
+ - **Keys stay encrypted.** Sign-in tokens and API keys live in the system's
138
+ encrypted store, never in a config file.
139
+ - **Bring your own model.** Use the [hosted AutoRAG plan](#hosted-autorag-plan),
140
+ or connect your own provider key and pay the provider directly.
141
+
142
+ > [!TIP]
143
+ > **The app's source lives in [NomaDamas/AutoRAG-app](https://github.com/NomaDamas/AutoRAG-app)**
144
+ > (Electron + React, AGPL-3.0). It depends on `@autorag/librarian` from this
145
+ > repository; build, run, and file app issues there.
146
+
147
+ ### One engine, every surface
148
+
149
+ The app is one way in. The same librarian runs everywhere else:
150
+
151
+ | Surface | Use it for | Start here |
152
+ |---|---|---|
153
+ | **Desktop app** | Browsing and asking in one window | [NomaDamas/AutoRAG-app](https://github.com/NomaDamas/AutoRAG-app) |
154
+ | **Terminal UI** | Interactive, steerable search sessions | [`autorag tui`](#2-search-from-cli) |
155
+ | **CLI** | Scripts, indexing, health checks | [CLI Command Reference](#cli-command-reference) |
156
+ | **MCP server** | Feeding retrieval to Claude Code, Codex, and other agents | [AutoRAG Lite MCP Server](#autorag-lite-mcp-server) |
157
+ | **TypeScript API** | Embedding the librarian in your own app | [Programmatic usage](#3-programmatic-usage-typescript-api) |
158
+ | **Agent skills** | Letting a coding agent install and drive AutoRAG | [For AI Agents](#-for-ai-agents--llms-setup--skills) |
159
+
160
+ ---
161
+
27
162
  ## What is AutoRAG Agent?
28
163
 
29
164
  Search tools dump file paths and matching lines — forcing you to open files, read context, and synthesize answers yourself.
@@ -80,144 +215,9 @@ AutoRAG uses `@earendil-works/pi-coding-agent` as the runtime host for model ses
80
215
 
81
216
  The CLI TUI (`autorag tui`) is Pi's interactive mode hosted on the AutoRAG librarian: there is no separate AutoRAG renderer. Pi owns the terminal UI and its native in-session commands — `/login`/`/logout`, `/model`, `/resume`, `/new`, `/tree`, `/compact`, and `/settings` — so provider sign-in and model selection work on first launch even when no AutoRAG model is configured. AutoRAG registers its retrieval tools and runs the two-phase search in the same Pi session, where the model's progress notes, first answer, and final answer are ordinary assistant messages, so resume and two-phase search keep working together.
82
217
 
83
- Update notices are AutoRAG's, not Pi's: `autorag tui` suppresses Pi's "run `pi update`" banner (Pi is a bundled host, not a separate install) and instead checks the published `@autorag/librarian` release, showing a one-line notice in the session when a newer version exists. Set `AUTORAG_NO_UPDATE_CHECK=1` to skip the lookup; `AUTORAG_UPDATE_CHECK_URL` overrides the registry endpoint.
84
-
218
+ Typing while a search runs works like steering one of Pi's own turns. **Enter** steers the running search: AutoRAG treats the text as a correction of a search that is going wrong, delivers it before the search's next model request (also between phases, where no turn is streaming), cuts in-flight retrieval short so the correction lands promptly, and always runs the verification phase so the answer reflects the correction. **Alt+Enter** queues a new question that runs after the current search answers. **Esc** stops the search instead of letting it continue into its next phase. Pi's registered `/` commands still run during a search; any other line starting with `/` (a path, for example) is a steer like any other text. A query typed after a search answers is a new search in the same session, as before.
85
219
 
86
- ---
87
-
88
- ## 🤖 For AI Agents & LLMs: Setup & Skills
89
-
90
- If you are an AI coding agent or LLM (Claude Code, Cursor, Windsurf, Codex, Senpi, Pi, etc.) tasked with installing, configuring, or querying AutoRAG Agent, use our built-in skills located in the [`skills/`](skills/) directory:
91
-
92
- | Skill | Directory | When to Use |
93
- |---|---|---|
94
- | **`autorag`** | [`skills/autorag/`](skills/autorag/SKILL.md) | Model-backed querying, searching, comparing, and summarizing with an already configured AutoRAG librarian. |
95
- | **`autorag-setup`** | [`skills/autorag-setup/`](skills/autorag-setup/SKILL.md) | Installing AutoRAG, configuring the model-backed librarian, adding roots/datasources, running health checks, and registering Lite MCP when needed. |
96
- | **`autorag-lite-setup`** | [`skills/autorag-lite-setup/`](skills/autorag-lite-setup/SKILL.md) | Installing/registering `autorag-mcp`, initializing model-free config, maintaining indexes, and verifying MCP search. |
97
-
98
- ### Install the skills into your coding agent
99
-
100
- Skills are not auto-discovered — copy only the setup skill when an agent needs
101
- to bootstrap AutoRAG. **Routine AutoRAG Lite retrieval is provided by MCP
102
- tools, not by a `autorag-lite-search` skill or shell command.**
103
-
104
- ```bash
105
- # From a clone of this repository
106
- mkdir -p .claude/skills
107
- cp -R skills/autorag-lite-setup .claude/skills/
108
- ```
109
-
110
- ```bash
111
- # From a global install — the npm package ships the same skills/ folder
112
- AUTORAG_SKILLS="$(npm root -g)/@autorag/librarian/skills"
113
- # Bun global installs live at ~/.bun/install/global/node_modules/@autorag/librarian/skills
114
- mkdir -p .claude/skills
115
- cp -R "$AUTORAG_SKILLS/autorag-lite-setup" .claude/skills/
116
- ```
117
-
118
- Run the setup skill once to register the stdio server with the host. Reload the
119
- agent, then discover the actual tool names and schemas with MCP `tools/list`.
120
- The normal Lite path is `autorag.status` → `autorag.refresh` when needed →
121
- `autorag.search`; use `autorag.report` and `autorag.evidence` for the optional
122
- curation lifecycle. Copy `skills/autorag`
123
- and `skills/autorag-setup` only when the agent should also drive the
124
- model-backed librarian, and `skills/autorag-doctor` for diagnostics. Other
125
- agents read their own skill directories; copy the same setup folder there and
126
- reload the agent session so it picks up the MCP registration instructions.
127
- Do not copy or retain the removed `autorag-lite-search` skill.
128
-
129
- ### Quick Agent Workflow
130
-
131
- 1. **Install CLI:**
132
- ```bash
133
- command -v autorag >/dev/null || bun install -g @autorag/librarian
134
- ```
135
- 2. **Inspect & Preflight:**
136
- ```bash
137
- autorag status --json # check corpus freshness and index readiness
138
- autorag duplicates --json # scan for exact or near-duplicate document families
139
- ```
140
- 3. **Perform Curated Search:**
141
- ```bash
142
- autorag search "your question" --json
143
- ```
144
- 4. **Safety Guidelines for Agents:**
145
- - **Never delete, move, or modify original user documents.**
146
- - AutoRAG writes index artifacts strictly into `<workspace>/.autorag/` and `.jikji/` caches.
147
- - Never print or leak API keys, tokens, or credential values into stdout or logs.
148
-
149
- ---
150
-
151
- ## AutoRAG Lite MCP Server
152
-
153
- Register the package's stdio server with the host; the host owns the process
154
- lifecycle and sends MCP tool calls:
155
-
156
- ```bash
157
- AUTORAG_CONFIG=/absolute/path/to/.autorag/config.json autorag-mcp
158
- ```
159
-
160
- For Claude Code and Codex registration commands, use
161
- [`skills/autorag-lite-setup/SKILL.md`](skills/autorag-lite-setup/SKILL.md).
162
- The MCP contract source of truth is [`src/mcp/server.ts`](src/mcp/server.ts)
163
- (tool registration, schemas, handlers) plus [`src/mcp/index.ts`](src/mcp/index.ts)
164
- (stdio entrypoint). Discover tools and schemas with MCP `tools/list`; do not
165
- hard-code a tool count.
166
-
167
- Core Lite tools include `autorag.status`, `autorag.search`,
168
- `autorag.search.files`, `autorag.datasources.list`, `autorag.datasources.get`,
169
- `autorag.refresh`, `autorag.report`, and `autorag.evidence`. Configured
170
- integrated datasources expose additional scoped search tools. Read-only MCP
171
- mode omits mutating tools such as refresh and report.
172
-
173
- ## ⚡ AutoRAG Lite: Model-Free Retrieval Engine
174
-
175
- Need blazing fast local search without configuring an LLM or paying for API tokens? Use **AutoRAG Lite**.
176
-
177
- AutoRAG Lite provides the exact same high-performance indexing, BM25 ranking, and local MinSync vector/hybrid retrieval engine as the full librarian, but **runs 100% model-free**:
178
-
179
- - **Zero LLM Token Usage:** Run purely local BM25 and vector search offline.
180
- - **Agent Integration Ready:** Use the AutoRAG Lite MCP server to supply raw context chunks to an external model; the CLI remains a bootstrap and maintenance interface.
181
- - **Fast Local CLI:** The CLI remains available for terminal-only indexing and repair.
182
-
183
- ```bash
184
- # Initialize a model-free workspace
185
- autorag lite init --search-paths ./documents
186
-
187
- # Index local files and datasources
188
- autorag lite refresh
189
- ```
190
-
191
- Normal Lite retrieval runs through the MCP tools (`autorag.status`,
192
- `autorag.search`); the CLI remains the bootstrap and maintenance interface for
193
- indexing and repair.
194
-
195
- ---
196
-
197
- ## 🔌 Supported Datasources
198
-
199
- AutoRAG Agent connects to external tools and communication platforms using dedicated datasource skills. Data remains in each tool's native store — AutoRAG does not copy or ingest foreign databases into a centralized store:
200
-
201
- | Datasource | Skill Alias | Backend / Driver | Storage & Privacy Model | Search Capabilities |
202
- |---|---|---|---|---|
203
- | **Local Documents** | `local` | Native filesystem & MinSync | Workspace-local parsed mirrors (`.autorag/`) | BM25, Semantic, Hybrid |
204
- | **KakaoTalk** | `kakao` | [`lazykatok`](https://github.com/changeroa/lazykatok) CLI | Native KakaoTalk archive; zero direct DB access | BM25, Semantic, Hybrid |
205
- | **Discord** | `discord` | [`discrawl`](https://github.com/openclaw/discrawl) CLI | Native SQLite archive; token-free wiretap mode | BM25, Semantic, Hybrid |
206
- | **WhatsApp** | `whatsapp` | [`wacrawl`](https://github.com/openclaw/wacrawl) CLI | Local-first incremental archive + FTS5 | Lexical FTS5 |
207
- | **Telegram** | `telegram` | [`telecrawl`](https://github.com/openclaw/telecrawl) CLI | Local-first desktop archive + FTS5 | Lexical FTS5 |
208
- | **Slack** | `slack` | [`slacrawl`](https://github.com/openclaw/slacrawl) CLI | Local workspace/channel/thread archive + FTS5 | Lexical FTS5 |
209
- | **Notion** | `notion` | [`notcrawl`](https://github.com/openclaw/notcrawl) CLI | Local page/database/block archive + FTS5 | Lexical FTS5 |
210
- | **Email Archives** | `mailcrawl` | [`mailcrawl`](https://github.com/NomaDamas/mailcrawl) CLI | Local Gmail, IMAP, and Maildir storage | BM25, Semantic, Hybrid |
211
- | **Local Mail Export**| `mail-export` | Built-in `.mbox` / `.eml` parser | Local filesystem mailboxes | Lexical |
212
- | **Obsidian Vaults** | `obsidian` | [`qmd`](https://github.com/tobi/qmd) CLI | Direct markdown vault indexing | BM25, Semantic |
213
- | **GitHub** | `github` | GitHub REST API | In-memory fetched Issues and Pull Requests | Lexical, Scoped |
214
- | **GitHub Gists** | `github-gist` | GitHub REST API | Incremental local index of own-account public and permitted secret Gist content/metadata; token not stored | Lexical (BM25), Local Semantic, Scoped |
215
- | **Cloud Drives** | `cloud-drive` | [`rclone`](https://rclone.org) CLI | Google Drive (Tier-1), OneDrive, Dropbox, etc. | Incremental Mirror + BM25 |
216
- | **Photos & Shots** | `clawgallery` | `clawgallery` CLI | Local screenshot and photo store | Hybrid OCR/Visual Search |
217
- | **RSS / News** | `rss` | Native HTTP Poller | RSS 2.0 & Atom feeds (24h deduplication) | Lexical |
218
- | **macOS Spotlight** | `spotlight` | Native `mdfind` CLI | macOS system metadata and content index | System Native |
219
-
220
- For configuration syntax and connector details, see [docs/datasource-skills.md](docs/datasource-skills.md). Non-interactive `sync`/`index` steps get a 30-minute per-connector budget (`connector.indexTimeoutMs`) because first-run imports routinely take minutes; interactive search keeps its 60-second default.
220
+ Update notices are AutoRAG's, not Pi's: `autorag tui` suppresses Pi's "run `pi update`" banner (Pi is a bundled host, not a separate install) and instead checks the published `@autorag/librarian` release, showing a one-line notice in the session when a newer version exists. Set `AUTORAG_NO_UPDATE_CHECK=1` to skip the lookup; `AUTORAG_UPDATE_CHECK_URL` overrides the registry endpoint.
221
221
 
222
222
  ---
223
223
 
@@ -357,9 +357,186 @@ for (const result of response.results) {
357
357
  }
358
358
  ```
359
359
 
360
+ A caller can steer a search while it runs, the way Enter steers a TUI search, and stop it:
361
+
362
+ ```typescript
363
+ const run = (async () => {
364
+ for await (const event of agent.searchDocumentsStream("When is the launch?")) {
365
+ if (event.type === "preliminary") console.log("Quick:", event.response.answer);
366
+ if (event.type === "complete") console.log("Final:", event.response.answer);
367
+ }
368
+ })();
369
+
370
+ // A correction of the running search, not a new question. false = no search to steer.
371
+ agent.steer("Use the June plan, not the April one.");
372
+ // agent.abort() stops the whole search, including every later phase.
373
+ await run;
374
+ ```
375
+
376
+ `steer()` reaches the search's next model request (also between phases), cuts in-flight retrieval and the baseline prefetch short, and always runs verification, whose prompt restates the correction. It returns `false` when no search is running, the search was stopped, or it is past its last model request; ask the text as a new question then.
377
+
360
378
  ---
361
379
 
362
- ## Hosted AutoRAG Plan (Dazzi)
380
+ ## CLI Command Reference
381
+
382
+ | Command | Description |
383
+ |---|---|
384
+ | `autorag init` | Initialize `~/.autorag/config.json` with search roots, document languages, and model settings |
385
+ | `autorag refresh` | Refresh parsed mirrors, MinSync CDC chunks, datasources, Jikji, and the platform file-name index (Everything on Windows, FSearch on macOS/Linux) |
386
+ | `autorag search "<query>"` | Run the librarian agent to curate structured answers |
387
+ | `autorag status` | Inspect corpus freshness, indexing status, and vector readiness |
388
+ | `autorag health` | Check model provider authentication, token validity, and API reachability |
389
+ | `autorag models list` | List chat models the pi runtime can resolve (built-ins, `models.json`, custom/extension providers) with provider auth status; never prints credential values |
390
+ | `autorag update-check` | Compare the running `autorag` against the published npm version (also runs on `autorag tui` launch) |
391
+ | `autorag tui` | Open Pi's interactive librarian TUI (`/login`, `/model`, `/resume`, …) |
392
+ | `autorag duplicates [DIR]` | Read-only scan for exact and near-duplicate document families with `dupey` |
393
+ | `autorag lite ...` | CLI bootstrap, indexing repair, terminal maintenance, and fallback interface; agents use MCP for normal Lite operation |
394
+ | `autorag memory inspect` | Render a read-only, path-opaque snapshot of retrieval memory (judged evidence, curated results, evidence chunks, insights); model-free |
395
+ | `autorag evidence <session>` | Inspect persisted evidence behind numbered results; MCP clients normally use `autorag.evidence`, and the CLI stays available for terminal maintenance |
396
+ | `autorag serve` | Start the P2P query server over SimpleX (opt-in) |
397
+ | `autorag p2p ...` | Manage peer trust, query approvals, and sharing policies |
398
+
399
+ ---
400
+
401
+ ## AutoRAG Lite MCP Server
402
+
403
+ Register the package's stdio server with the host; the host owns the process
404
+ lifecycle and sends MCP tool calls:
405
+
406
+ ```bash
407
+ AUTORAG_CONFIG=/absolute/path/to/.autorag/config.json autorag-mcp
408
+ ```
409
+
410
+ For Claude Code and Codex registration commands, use
411
+ [`skills/autorag-lite-setup/SKILL.md`](skills/autorag-lite-setup/SKILL.md).
412
+ The MCP contract source of truth is [`src/mcp/server.ts`](src/mcp/server.ts)
413
+ (tool registration, schemas, handlers) plus [`src/mcp/index.ts`](src/mcp/index.ts)
414
+ (stdio entrypoint). Discover tools and schemas with MCP `tools/list`; do not
415
+ hard-code a tool count.
416
+
417
+ Core Lite tools include `autorag.status`, `autorag.search`,
418
+ `autorag.search.files`, `autorag.datasources.list`, `autorag.datasources.get`,
419
+ `autorag.refresh`, `autorag.report`, and `autorag.evidence`. Configured
420
+ integrated datasources expose additional scoped search tools. Read-only MCP
421
+ mode omits mutating tools such as refresh and report.
422
+
423
+ ---
424
+
425
+ ## ⚡ AutoRAG Lite: Model-Free Retrieval Engine
426
+
427
+ Need blazing fast local search without configuring an LLM or paying for API tokens? Use **AutoRAG Lite**.
428
+
429
+ AutoRAG Lite provides the exact same high-performance indexing, BM25 ranking, and local MinSync vector/hybrid retrieval engine as the full librarian, but **runs 100% model-free**:
430
+
431
+ - **Zero LLM Token Usage:** Run purely local BM25 and vector search offline.
432
+ - **Agent Integration Ready:** Use the AutoRAG Lite MCP server to supply raw context chunks to an external model; the CLI remains a bootstrap and maintenance interface.
433
+ - **Fast Local CLI:** The CLI remains available for terminal-only indexing and repair.
434
+
435
+ ```bash
436
+ # Initialize a model-free workspace
437
+ autorag lite init --search-paths ./documents
438
+
439
+ # Index local files and datasources
440
+ autorag lite refresh
441
+ ```
442
+
443
+ Normal Lite retrieval runs through the MCP tools (`autorag.status`,
444
+ `autorag.search`); the CLI remains the bootstrap and maintenance interface for
445
+ indexing and repair.
446
+
447
+ ---
448
+
449
+ ## 🤖 For AI Agents & LLMs: Setup & Skills
450
+
451
+ If you are an AI coding agent or LLM (Claude Code, Cursor, Windsurf, Codex, Senpi, Pi, etc.) tasked with installing, configuring, or querying AutoRAG Agent, use our built-in skills located in the [`skills/`](skills/) directory:
452
+
453
+ | Skill | Directory | When to Use |
454
+ |---|---|---|
455
+ | **`autorag`** | [`skills/autorag/`](skills/autorag/SKILL.md) | Model-backed querying, searching, comparing, and summarizing with an already configured AutoRAG librarian. |
456
+ | **`autorag-setup`** | [`skills/autorag-setup/`](skills/autorag-setup/SKILL.md) | Installing AutoRAG, configuring the model-backed librarian, adding roots/datasources, running health checks, and registering Lite MCP when needed. |
457
+ | **`autorag-lite-setup`** | [`skills/autorag-lite-setup/`](skills/autorag-lite-setup/SKILL.md) | Installing/registering `autorag-mcp`, initializing model-free config, maintaining indexes, and verifying MCP search. |
458
+
459
+ ### Install the skills into your coding agent
460
+
461
+ Skills are not auto-discovered — copy only the setup skill when an agent needs
462
+ to bootstrap AutoRAG. **Routine AutoRAG Lite retrieval is provided by MCP
463
+ tools, not by a `autorag-lite-search` skill or shell command.**
464
+
465
+ ```bash
466
+ # From a clone of this repository
467
+ mkdir -p .claude/skills
468
+ cp -R skills/autorag-lite-setup .claude/skills/
469
+ ```
470
+
471
+ ```bash
472
+ # From a global install — the npm package ships the same skills/ folder
473
+ AUTORAG_SKILLS="$(npm root -g)/@autorag/librarian/skills"
474
+ # Bun global installs live at ~/.bun/install/global/node_modules/@autorag/librarian/skills
475
+ mkdir -p .claude/skills
476
+ cp -R "$AUTORAG_SKILLS/autorag-lite-setup" .claude/skills/
477
+ ```
478
+
479
+ Run the setup skill once to register the stdio server with the host. Reload the
480
+ agent, then discover the actual tool names and schemas with MCP `tools/list`.
481
+ The normal Lite path is `autorag.status` → `autorag.refresh` when needed →
482
+ `autorag.search`; use `autorag.report` and `autorag.evidence` for the optional
483
+ curation lifecycle. Copy `skills/autorag`
484
+ and `skills/autorag-setup` only when the agent should also drive the
485
+ model-backed librarian, and `skills/autorag-doctor` for diagnostics. Other
486
+ agents read their own skill directories; copy the same setup folder there and
487
+ reload the agent session so it picks up the MCP registration instructions.
488
+ Do not copy or retain the removed `autorag-lite-search` skill.
489
+
490
+ ### Quick Agent Workflow
491
+
492
+ 1. **Install CLI:**
493
+ ```bash
494
+ command -v autorag >/dev/null || bun install -g @autorag/librarian
495
+ ```
496
+ 2. **Inspect & Preflight:**
497
+ ```bash
498
+ autorag status --json # check corpus freshness and index readiness
499
+ autorag duplicates --json # scan for exact or near-duplicate document families
500
+ ```
501
+ 3. **Perform Curated Search:**
502
+ ```bash
503
+ autorag search "your question" --json
504
+ ```
505
+ 4. **Safety Guidelines for Agents:**
506
+ - **Never delete, move, or modify original user documents.**
507
+ - AutoRAG writes index artifacts strictly into `<workspace>/.autorag/` and `.jikji/` caches.
508
+ - Never print or leak API keys, tokens, or credential values into stdout or logs.
509
+
510
+ ---
511
+
512
+ ## 🔌 Supported Datasources
513
+
514
+ AutoRAG Agent connects to external tools and communication platforms using dedicated datasource skills. Data remains in each tool's native store — AutoRAG does not copy or ingest foreign databases into a centralized store:
515
+
516
+ | Datasource | Skill Alias | Backend / Driver | Storage & Privacy Model | Search Capabilities |
517
+ |---|---|---|---|---|
518
+ | **Local Documents** | `local` | Native filesystem & MinSync | Workspace-local parsed mirrors (`.autorag/`) | BM25, Semantic, Hybrid |
519
+ | **KakaoTalk** | `kakao` | [`lazykatok`](https://github.com/changeroa/lazykatok) CLI | Native KakaoTalk archive; zero direct DB access | BM25, Semantic, Hybrid |
520
+ | **Discord** | `discord` | [`discrawl`](https://github.com/openclaw/discrawl) CLI | Native SQLite archive; token-free wiretap mode | BM25, Semantic, Hybrid |
521
+ | **WhatsApp** | `whatsapp` | [`wacrawl`](https://github.com/openclaw/wacrawl) CLI | Local-first incremental archive + FTS5 | Lexical FTS5; BM25 + Semantic + Hybrid by default via [`sidecar`](docs/datasource-skills.md#hybrid-search-for-chat-crawlers-sidecar) |
522
+ | **Telegram** | `telegram` | [`telecrawl`](https://github.com/openclaw/telecrawl) CLI | Local-first desktop archive + FTS5 | Lexical FTS5; BM25 + Semantic + Hybrid by default via [`sidecar`](docs/datasource-skills.md#hybrid-search-for-chat-crawlers-sidecar) |
523
+ | **Slack** | `slack` | [`slacrawl`](https://github.com/openclaw/slacrawl) CLI | Local workspace/channel/thread archive + FTS5 | Lexical FTS5; BM25 + Semantic + Hybrid by default via [`sidecar`](docs/datasource-skills.md#hybrid-search-for-chat-crawlers-sidecar) |
524
+ | **Notion** | `notion` | [`notcrawl`](https://github.com/openclaw/notcrawl) CLI | Local page/database/block archive + FTS5 | Lexical FTS5 |
525
+ | **Email Archives** | `mailcrawl` | [`mailcrawl`](https://github.com/NomaDamas/mailcrawl) CLI | Local Gmail, IMAP, and Maildir storage | BM25, Semantic, Hybrid |
526
+ | **Local Mail Export**| `mail-export` | Built-in `.mbox` / `.eml` parser | Local filesystem mailboxes | Lexical |
527
+ | **Obsidian Vaults** | `obsidian` | [`qmd`](https://github.com/tobi/qmd) CLI | Direct markdown vault indexing | BM25, Semantic |
528
+ | **GitHub** | `github` | GitHub REST API | In-memory fetched Issues and Pull Requests | Lexical, Scoped |
529
+ | **GitHub Gists** | `github-gist` | GitHub REST API | Incremental local index of own-account public and permitted secret Gist content/metadata; token not stored | Lexical (BM25), Local Semantic, Scoped |
530
+ | **Cloud Drives** | `cloud-drive` | [`rclone`](https://rclone.org) CLI | Google Drive (Tier-1), OneDrive, Dropbox, etc. | Incremental Mirror + BM25 |
531
+ | **Photos & Shots** | `clawgallery` | `clawgallery` CLI | Local screenshot and photo store | Hybrid OCR/Visual Search |
532
+ | **RSS / News** | `rss` | Native HTTP Poller | RSS 2.0 & Atom feeds (24h deduplication) | Lexical |
533
+ | **macOS Spotlight** | `spotlight` | Native `mdfind` CLI | macOS system metadata and content index | System Native |
534
+
535
+ For configuration syntax and connector details, see [docs/datasource-skills.md](docs/datasource-skills.md). Non-interactive `sync`/`index` steps get a 30-minute per-connector budget (`connector.indexTimeoutMs`) because first-run imports routinely take minutes; interactive search keeps its 60-second default.
536
+
537
+ ---
538
+
539
+ ## Hosted AutoRAG Plan
363
540
 
364
541
  AutoRAG can run on the hosted **AutoRAG** plan as a first-class model provider named
365
542
  `autorag`. The provider speaks the server's OpenAI Responses API surface (`<root>/v1`),
@@ -411,26 +588,21 @@ keeps resolving offline. When you are not signed in the provider still registers
411
588
  `/login`, contributes no models, and makes no network call. See
412
589
  [Hosted AutoRAG provider](docs/cloud-provider.md) for the full flow.
413
590
 
414
- ---
591
+ The same plan can also serve the **Jev** judgment model and **rerank** stage, so
592
+ the whole librarian loop runs on the hosted account:
415
593
 
416
- ## CLI Command Reference
594
+ ```json
595
+ {
596
+ "jev": { "backend": "autorag", "model": "jev-1.13" },
597
+ "rerank": { "provider": "autorag", "model": "qwen/qwen3-reranker-8b" }
598
+ }
599
+ ```
417
600
 
418
- | Command | Description |
419
- |---|---|
420
- | `autorag init` | Initialize `~/.autorag/config.json` with search roots, document languages, and model settings |
421
- | `autorag refresh` | Refresh parsed mirrors, MinSync CDC chunks, datasources, Jikji, and the platform file-name index (Everything on Windows, FSearch on macOS/Linux) |
422
- | `autorag search "<query>"` | Run the librarian agent to curate structured answers |
423
- | `autorag status` | Inspect corpus freshness, indexing status, and vector readiness |
424
- | `autorag health` | Check model provider authentication, token validity, and API reachability |
425
- | `autorag models list` | List chat models the pi runtime can resolve (built-ins, `models.json`, custom/extension providers) with provider auth status; never prints credential values |
426
- | `autorag update-check` | Compare the running `autorag` against the published npm version (also runs on `autorag tui` launch) |
427
- | `autorag tui` | Open Pi's interactive librarian TUI (`/login`, `/model`, `/resume`, …) |
428
- | `autorag duplicates [DIR]` | Read-only scan for exact and near-duplicate document families with `dupey` |
429
- | `autorag lite ...` | CLI bootstrap, indexing repair, terminal maintenance, and fallback interface; agents use MCP for normal Lite operation |
430
- | `autorag memory inspect` | Render a read-only, path-opaque snapshot of retrieval memory (judged evidence, curated results, evidence chunks, insights); model-free |
431
- | `autorag evidence <session>` | Inspect persisted evidence behind numbered results; MCP clients normally use `autorag.evidence`, and the CLI stays available for terminal maintenance |
432
- | `autorag serve` | Start the P2P query server over SimpleX (opt-in) |
433
- | `autorag p2p ...` | Manage peer trust, query approvals, and sharing policies |
601
+ `jev.backend: "autorag"` posts Jev's native dialect to `<root>/v1/jev`
602
+ (default model `jev-1.13`); `rerank.provider: "autorag"` reranks against
603
+ `<root>/v1/rerank` (default model `qwen/qwen3-reranker-8b`). Both read the
604
+ account key from `AUTORAG_API_KEY`, and an explicit `rerank.baseUrl`,
605
+ `rerank.apiKeyEnv`, or `rerank.model` still overrides the defaults.
434
606
 
435
607
  ---
436
608
 
@@ -438,9 +610,9 @@ keeps resolving offline. When you are not signed in the provider still registers
438
610
 
439
611
  Deep dive into AutoRAG Agent's architecture, security, and integration guides:
440
612
 
441
- - **[MinSync Setup & Embedding QA](docs/minsync-setup.md):** Automatic binary installation, CDC chunking, and EmbeddingGemma verification.
442
- - **[Local Embedding Runtime & Gateway](docs/embedding-runtime.md):** AutoRAG-owned local gateway, model prefetching, and zero-egress semantic search. Model cards: [`qwen3-embedding-0.6b`](docs/model-cards/qwen3-embedding-0.6b.md), [`embeddinggemma-300m`](docs/model-cards/embeddinggemma-300m.md).
443
- - **[Hosted AutoRAG Provider](docs/cloud-provider.md):** The `autorag` (Dazzi) model provider — PKCE `/login`, `AUTORAG_API_KEY`, `AUTORAG_BASE_URL`, live model discovery, and offline catalog snapshots.
613
+ - **[MinSync Setup & Embedding QA](docs/minsync-setup.md):** Automatic binary installation, CDC chunking, and local embedding verification.
614
+ - **[Local Embedding Runtime & Gateway](docs/embedding-runtime.md):** AutoRAG-owned local gateway, model prefetching, and zero-egress semantic search. Model card: [`qwen3-embedding-0.6b`](docs/model-cards/qwen3-embedding-0.6b.md).
615
+ - **[Hosted AutoRAG Provider](docs/cloud-provider.md):** The hosted `autorag` model provider — PKCE `/login`, `AUTORAG_API_KEY`, `AUTORAG_BASE_URL`, live model discovery, and offline catalog snapshots.
444
616
  - **[Datasource Skills Reference](docs/datasource-skills.md):** Full configuration contracts, connection aliases, and connector options.
445
617
  - **[Jev Decisions](docs/jev-decisions.md):** Jev query pipeline, **on by default** via OpenRouter: it routes each question to a direct answer (intrinsic knowledge) or local search (everything needing more information; web search is left to the agent after the fast answer), splits multi-part questions into up to five parallel searches (`openrouter/qwen/qwen3.7-flash`), picks which registered datasources to search before the fast answer, and ends the run after the fast answer when that answer is complete. Also covers the `jev` judgment tool, backends (OpenRouter, TypeSafe, Vercel AI Gateway), and how to opt out.
446
618
  - **[Manual QA & Datasource Test Harnesses](docs/manual-qa-datasources.md):** Real-world testing guides for Discord, KakaoTalk, Slack, Notion, and email.
@@ -517,9 +689,11 @@ Common failures and their fix:
517
689
 
518
690
  Native datasource stores stay owned by their CLIs — AutoRAG never rebuilds them. Fix a broken archive with `lazykatok doctor`, `discrawl --json metadata`, `slacrawl --json doctor`, `wacrawl --json doctor`, `telecrawl --json doctor`, `notcrawl doctor`, `qmd status`, or `mailcrawl doctor`, then re-run `autorag refresh --method datasources --json`.
519
691
 
692
+ ---
693
+
520
694
  ## License
521
695
 
522
- - **AutoRAG 2.0 (AutoRAG Agent):** Released under the [MIT License](LICENSE).
696
+ - **AutoRAG 2.0 (AutoRAG Agent):** Released under the [Apache License 2.0](LICENSE).
523
697
  - **Legacy Python AutoRAG (`legacy/`):** Released under the [Apache License 2.0](legacy/LICENSE).
524
698
  - Production third-party notices and licenses are documented in [`NOTICE`](NOTICE).
525
699
  - The bundled Windows binaries keep their own licenses: Everything (MIT, plus PCRE BSD-3-Clause) in [`licenses/everything-MIT-and-PCRE-BSD.txt`](licenses/everything-MIT-and-PCRE-BSD.txt) and ES (MIT) in [`licenses/es-MIT.txt`](licenses/es-MIT.txt). Everything's source code is not public; AutoRAG redistributes the unmodified voidtools portable ZIPs.