@autorag/librarian 2.7.0 → 2.9.0
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.
- package/NOTICE +10 -4
- package/README.md +122 -38
- package/dist/agent/agent.d.ts +210 -53
- package/dist/agent/answer-guidelines.d.ts +19 -0
- package/dist/agent/citations.d.ts +43 -0
- package/dist/agent/datasource-skill.d.ts +30 -16
- package/dist/agent/emit-results-tool.d.ts +37 -2
- package/dist/agent/evidence-judgment.d.ts +58 -0
- package/dist/agent/evidence-ledger.d.ts +59 -0
- package/dist/agent/evidence-origins.d.ts +49 -0
- package/dist/agent/fast-answer-tool.d.ts +16 -6
- package/dist/agent/index.d.ts +2 -1
- package/dist/agent/jev-extension.d.ts +68 -0
- package/dist/agent/jikji-find-tool.d.ts +2 -1
- package/dist/agent/pi-session.d.ts +28 -1
- package/dist/agent/query-decomposition.d.ts +25 -0
- package/dist/agent/query-peer-tool.d.ts +3 -0
- package/dist/agent/query-routing.d.ts +115 -0
- package/dist/agent/search-all-tool.d.ts +5 -5
- package/dist/agent/search-documents.d.ts +3 -11
- package/dist/agent/search-minsync-tool.d.ts +5 -5
- package/dist/agent/search-single-datasource-tool.d.ts +9 -8
- package/dist/agent/self-config.d.ts +40 -0
- package/dist/agent/system-prompt.d.ts +3 -3
- package/dist/agent/web-fetch-tool.d.ts +2 -1
- package/dist/agent/web-search-tool.d.ts +2 -1
- package/dist/cli/commands/evidence.d.ts +22 -0
- package/dist/cli/commands/init.d.ts +2 -1
- package/dist/cli/commands/memory.d.ts +1 -1
- package/dist/cli/commands/report.d.ts +1 -1
- package/dist/cli/commands/update-check.d.ts +8 -0
- package/dist/cli/config.d.ts +80 -7
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +3844 -2291
- package/dist/cli/output.d.ts +2 -6
- package/dist/cli/update-check.d.ts +34 -0
- package/dist/cli/version.d.ts +5 -0
- package/dist/config/home.d.ts +6 -0
- package/dist/core.d.ts +30 -6
- package/dist/core.js +7742 -6225
- package/dist/datasource/chunk-store.d.ts +2 -6
- package/dist/datasource/connector-skill.d.ts +2 -3
- package/dist/datasource/index.d.ts +2 -4
- package/dist/datasource/registry.d.ts +11 -13
- package/dist/datasource/scope.d.ts +19 -0
- package/dist/datasource/skills/github-gist/index.d.ts +1 -1
- package/dist/datasource/skills/github-gist/semantic.d.ts +3 -44
- package/dist/datasource/skills/github-gist/skill.d.ts +3 -3
- package/dist/datasource/types.d.ts +14 -28
- package/dist/embedding-runtime/gateway-embedder.d.ts +41 -0
- package/dist/everything/bundle.d.ts +15 -3
- package/dist/everything/client.d.ts +22 -5
- package/dist/everything/index.d.ts +1 -1
- package/dist/filesystem/name-search.d.ts +57 -0
- package/dist/fsearch/client.d.ts +7 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +9139 -6376
- package/dist/jikji/client.d.ts +6 -1
- package/dist/language.d.ts +2 -1
- package/dist/mcp/index.d.ts +2 -0
- package/dist/mcp/index.js +30542 -0
- package/dist/mcp/server.d.ts +9 -0
- package/dist/memory/check-memory-tool.d.ts +8 -4
- package/dist/memory/context.d.ts +51 -0
- package/dist/memory/index.d.ts +8 -1
- package/dist/memory/judged-evidence.d.ts +32 -0
- package/dist/memory/memory.d.ts +36 -120
- package/dist/memory/renderer.d.ts +16 -7
- package/dist/memory/similar-queries.d.ts +40 -0
- package/dist/minsync/errors.d.ts +14 -0
- package/dist/minsync/index.d.ts +1 -0
- package/dist/minsync/method.d.ts +8 -5
- package/dist/mirror/index.d.ts +1 -1
- package/dist/mirror/paths.d.ts +6 -0
- package/dist/mirror/sync.d.ts +5 -2
- package/dist/parser/defaults.d.ts +16 -5
- package/dist/parser/index.d.ts +1 -1
- package/dist/parser/kordoc.d.ts +8 -1
- package/dist/parser/ocr-engines.d.ts +19 -0
- package/dist/retrieval/bm25.d.ts +19 -0
- package/dist/retrieval/engine.d.ts +33 -43
- package/dist/retrieval/index.d.ts +3 -1
- package/dist/retrieval/merger.d.ts +6 -0
- package/dist/retrieval/rerank.d.ts +4 -2
- package/dist/retrieval/selection.d.ts +89 -0
- package/dist/retrieval/types.d.ts +1 -3
- package/dist/web/search/format.d.ts +5 -2
- package/dist/web/search/index.d.ts +7 -1
- package/package.json +11 -7
- package/skills/autorag/SKILL.md +43 -23
- package/skills/autorag-doctor/SKILL.md +40 -26
- package/skills/autorag-lite-setup/SKILL.md +123 -64
- package/skills/autorag-setup/SKILL.md +107 -22
- package/dist/cli/commands/feedback.d.ts +0 -8
- package/dist/datasource/access-context.d.ts +0 -43
- package/dist/datasource/result-filter.d.ts +0 -64
- package/dist/parser/ocr.d.ts +0 -31
- package/skills/autorag-lite-search/SKILL.md +0 -245
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: autorag-lite-setup
|
|
3
|
-
description:
|
|
3
|
+
description: Install and register the model-free AutoRAG Lite MCP server, configure approved roots and datasources, build indexes, and verify MCP discovery and search. Use when autorag-mcp is missing, MCP connection fails, indexes are stale, or the user wants document search without configuring a search model.
|
|
4
4
|
license: MIT
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# AutoRAG Lite setup
|
|
8
8
|
|
|
9
|
-
Use this skill
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
retrieval, reports, evidence, and feedback.
|
|
9
|
+
Use this skill only to bootstrap, register, or repair AutoRAG Lite MCP:
|
|
10
|
+
initialize trusted config, connect the host, build indexes, and verify search.
|
|
11
|
+
Normal Lite use is MCP tool calling, not a search skill or shell command.
|
|
12
|
+
Use `autorag-setup` instead when the model-backed librarian must be configured.
|
|
14
13
|
|
|
15
14
|
## Safety
|
|
16
15
|
|
|
17
16
|
- Inspect only non-secret config metadata: `searchPaths`, `workspacePath`,
|
|
18
|
-
`memoryPath`, `minSync`, `jikji`, `datasources
|
|
17
|
+
`memoryPath`, `minSync`, `jikji`, `datasources`.
|
|
19
18
|
- Never print, copy, migrate, compare, or persist credential values. Store only
|
|
20
19
|
environment-variable names such as `tokenEnv` or `apiKeyEnv`.
|
|
21
20
|
- Never move, rename, edit, or delete source documents. Lite commands write
|
|
@@ -25,16 +24,22 @@ retrieval, reports, evidence, and feedback.
|
|
|
25
24
|
`node_modules`, `.git`, `dist`, `build`, `target`, `.cache`, `.autorag`, or
|
|
26
25
|
`.jikji`.
|
|
27
26
|
|
|
28
|
-
## Install the
|
|
27
|
+
## Install the package if needed
|
|
29
28
|
|
|
30
|
-
|
|
29
|
+
`@autorag/librarian` ships both `autorag` (bootstrap/maintenance) and
|
|
30
|
+
`autorag-mcp` (stdio server). The executable requires Node.js >= 24 on PATH.
|
|
31
31
|
|
|
32
32
|
```bash
|
|
33
|
-
command -v autorag >/dev/null || bun install -g @autorag/librarian
|
|
33
|
+
command -v autorag-mcp >/dev/null || bun install -g @autorag/librarian
|
|
34
|
+
command -v autorag
|
|
35
|
+
command -v autorag-mcp
|
|
34
36
|
autorag lite --help
|
|
35
37
|
```
|
|
36
38
|
|
|
37
39
|
If Bun is unavailable, `npm install -g @autorag/librarian` is acceptable.
|
|
40
|
+
If only `autorag` exists, upgrade the package rather than substituting CLI
|
|
41
|
+
retrieval for MCP. For a source checkout, run `bun run build` and register the
|
|
42
|
+
absolute `dist/mcp/index.js` path instead of the installed executable.
|
|
38
43
|
|
|
39
44
|
## Initialize a model-free config
|
|
40
45
|
|
|
@@ -46,7 +51,9 @@ autorag lite init \
|
|
|
46
51
|
```
|
|
47
52
|
|
|
48
53
|
`lite init` writes the configured model-free lifecycle config. Use `--force`
|
|
49
|
-
only when intentionally replacing an existing config
|
|
54
|
+
only when intentionally replacing an existing config, and target it with an
|
|
55
|
+
explicit path (`--config` or `AUTORAG_CONFIG`); `--force` refuses to replace the
|
|
56
|
+
implicit `~/.autorag/config.json`. Explicit user paths win;
|
|
50
57
|
otherwise propose one to three document-dense roots and get approval before
|
|
51
58
|
indexing. Supported parsed formats are `md`, `markdown`, `txt`, `text`, `pdf`,
|
|
52
59
|
`docx`, `pptx`, `xlsx`, `xls`, `hwp`, `hwpx`, and `eml`. Legacy `.doc` is not
|
|
@@ -57,6 +64,48 @@ Config resolution follows the usual order: `--config`, `AUTORAG_CONFIG`,
|
|
|
57
64
|
include `AUTORAG_HOME`, `AUTORAG_CONFIG`, `AUTORAG_SEARCH_PATHS`,
|
|
58
65
|
`AUTORAG_WORKSPACE`, and `AUTORAG_MEMORY_PATH`.
|
|
59
66
|
|
|
67
|
+
## Register and verify the MCP connection
|
|
68
|
+
|
|
69
|
+
After config and datasource setup, register the server with the host. Use
|
|
70
|
+
absolute config, search root, workspace, and executable paths: hosts may start
|
|
71
|
+
the server from a different working directory or with a restricted PATH.
|
|
72
|
+
Resolve `command -v autorag-mcp` and substitute its absolute path below.
|
|
73
|
+
Inspect an existing `autorag` registration first; keep a working registration
|
|
74
|
+
and update only an outdated command or config path.
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# Claude Code: project-local registration
|
|
78
|
+
claude mcp add --transport stdio --scope local autorag \
|
|
79
|
+
--env AUTORAG_CONFIG=/absolute/path/to/.autorag/config.json \
|
|
80
|
+
-- /absolute/path/to/autorag-mcp
|
|
81
|
+
|
|
82
|
+
# Codex: user registration
|
|
83
|
+
codex mcp add autorag \
|
|
84
|
+
--env AUTORAG_CONFIG=/absolute/path/to/.autorag/config.json \
|
|
85
|
+
-- /absolute/path/to/autorag-mcp
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
For other hosts, use their stdio MCP configuration with the same command,
|
|
89
|
+
empty arguments, and `AUTORAG_CONFIG` environment variable. The host starts
|
|
90
|
+
the subprocess; do not run it as a background HTTP service. Pass any required
|
|
91
|
+
credential environment-variable names through the host's secret mechanism;
|
|
92
|
+
never put credential values in registration examples or logs.
|
|
93
|
+
|
|
94
|
+
Reload/reconnect the host, then use MCP `tools/list` to discover the actual
|
|
95
|
+
tools and schemas. Verify `autorag.status`, `autorag.refresh`, `autorag.search`,
|
|
96
|
+
`autorag.search.files`, and `autorag.datasources.list` are available. Configured
|
|
97
|
+
integrated datasources add their own search tools; do not assume a fixed count.
|
|
98
|
+
Run `autorag.status` and `autorag.datasources.list` through MCP, then refresh
|
|
99
|
+
and search a known phrase from an approved document. Registration alone is
|
|
100
|
+
not proof of a connected or searchable server. After config changes, restart
|
|
101
|
+
the server so datasource tools are rebuilt.
|
|
102
|
+
|
|
103
|
+
`AUTORAG_MCP_READ_ONLY=1` omits refresh; build indexes with the CLI before
|
|
104
|
+
connecting that mode. `AUTORAG_MCP_TOOLS` is an optional comma-separated exact
|
|
105
|
+
tool allowlist; omitted tools cannot be called. Use unrestricted tools for
|
|
106
|
+
initial setup unless the user intentionally requests a restricted connection.
|
|
107
|
+
|
|
108
|
+
|
|
60
109
|
## Probe and configure datasources (setup wizard)
|
|
61
110
|
|
|
62
111
|
A datasource setup UI is not shipped in this build — do not recommend it for datasource
|
|
@@ -71,7 +120,7 @@ setup. Configure datasources directly in trusted config, wizard-style:
|
|
|
71
120
|
(such as `github`) require their credential environment variable
|
|
72
121
|
(`GITHUB_TOKEN`).
|
|
73
122
|
2. Auto-configure every datasource that probes feasible — write its trusted
|
|
74
|
-
`datasources`
|
|
123
|
+
`datasources` entries without asking. For example,
|
|
75
124
|
when Slack (`slacrawl`) and Discord (`discrawl`) are installed with local
|
|
76
125
|
stores present, set both up automatically. Discord uses discrawl's local
|
|
77
126
|
desktop wiretap archive; no Discord bot token is configured or needed.
|
|
@@ -84,38 +133,41 @@ setup. Configure datasources directly in trusted config, wizard-style:
|
|
|
84
133
|
users — always probe them and report their status, even when they end up
|
|
85
134
|
skipped.
|
|
86
135
|
|
|
87
|
-
Datasource skills belong in trusted config
|
|
136
|
+
Datasource skills belong in trusted config.
|
|
88
137
|
|
|
89
138
|
Config keys may be builtin template names (`kakao`, `whatsapp`, `telegram`,
|
|
90
139
|
`slack`, `discord`, `clawgallery`, `notion`, `github`, `cloud-drive`,
|
|
91
140
|
`mail-export`, `mailcrawl`, `obsidian`, `rss`, `spotlight`, `lark`) or connection
|
|
92
141
|
aliases with `"type": "<template>"`. Unknown names are skipped with an
|
|
93
142
|
`unknown-datasource-skill` warning; they do not fail config resolution.
|
|
94
|
-
`
|
|
95
|
-
|
|
143
|
+
`scope` narrows a query to a sub-path as ordinary filtering. Tags are
|
|
144
|
+
descriptive metadata only, not search filters. Use MCP `datasourceIds` to
|
|
145
|
+
select configured connections before retrieval; discover their IDs with
|
|
146
|
+
`autorag.datasources.list`. Store only env-var names such as `tokenEnv` or
|
|
96
147
|
`apiKeyEnv`, never credential values.
|
|
97
148
|
|
|
98
149
|
## Build and refresh indexes
|
|
99
150
|
|
|
151
|
+
After connecting, call MCP `autorag.refresh` with `{}` for an incremental run.
|
|
152
|
+
Use `{"methods":["parsed","minsync"]}` to narrow indexing, or
|
|
153
|
+
`{"force":true}` only when a full resync is needed. Omit `methods` to run all
|
|
154
|
+
configured methods; MCP does not accept `"all"` as a method value.
|
|
155
|
+
|
|
156
|
+
CLI refresh remains available for bootstrap, read-only deployments, and repair:
|
|
157
|
+
|
|
100
158
|
```bash
|
|
101
|
-
autorag lite refresh --json
|
|
102
|
-
autorag lite refresh --method parsed,minsync --json
|
|
103
|
-
autorag lite refresh --full --json
|
|
104
|
-
autorag lite refresh --force --json
|
|
159
|
+
AUTORAG_CONFIG=/absolute/path/to/.autorag/config.json autorag lite refresh --json
|
|
105
160
|
```
|
|
106
161
|
|
|
107
|
-
-
|
|
108
|
-
|
|
109
|
-
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
- MinSync and Jikji auto-install on first use by default. If they are missing
|
|
117
|
-
or broken, run a full refresh or return to setup rather than silently
|
|
118
|
-
degrading to lexical-only search.
|
|
162
|
+
- Refresh syncs parsed mirrors, MinSync, Jikji, and configured datasources.
|
|
163
|
+
- CLI `--full` and `--force` request a full resync; MCP uses `force: true`.
|
|
164
|
+
- CLI `--method <csv>` accepts `parsed`, `minsync`, `datasources`, `jikji`,
|
|
165
|
+
`everything` (Windows), `fsearch` (macOS/Linux), and `all`. MCP `methods`
|
|
166
|
+
accepts the same individual methods, not `all`. Unknown values are rejected.
|
|
167
|
+
- Indexing never runs while answering: retrieval only reads what refresh built.
|
|
168
|
+
MinSync and Jikji auto-install during refresh (never during a query). If they
|
|
169
|
+
are missing or broken, run a full refresh or return to setup rather than
|
|
170
|
+
silently degrading to lexical-only search.
|
|
119
171
|
- MinSync's default embedder is in-process native Qwen3 embeddings
|
|
120
172
|
(`native:Qwen/Qwen3-Embedding-0.6B`, 1024 dimensions, MinSync 0.4.5+): no
|
|
121
173
|
embedder flags, no API key, and no external daemon (such as Ollama) are
|
|
@@ -131,18 +183,12 @@ autorag lite refresh --force --json
|
|
|
131
183
|
and the user is told duplicate exclusion is off. Set
|
|
132
184
|
`"excludeExactDuplicates": false` to index every copy.
|
|
133
185
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
refresh
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
diagnostics (and `autorag lite status` reports `stale: true`) while retrieval
|
|
141
|
-
still answers from the index. Sources the refresh deliberately skipped — exact
|
|
142
|
-
duplicates, oversized or unparseable files, and AutoRAG/Jikji product artifacts
|
|
143
|
-
such as `.jikji_agent_map.md` — do not count as stale. Use `autorag lite
|
|
144
|
-
retrieve --refresh` to rebuild incrementally before one query, or `--strict`
|
|
145
|
-
when a stale index must fail instead of answering.
|
|
186
|
+
Content search requires a completed refresh. MCP `autorag.search` returns
|
|
187
|
+
`isError: true` with `errorCode: "index-not-ready"` until refresh completes.
|
|
188
|
+
Always refresh first, and refresh again when roots change. Stale indexes can
|
|
189
|
+
still return results with `stale: true` and diagnostics; use `strict: true`
|
|
190
|
+
to reject stale answers, or call `autorag.refresh` before searching. Sources
|
|
191
|
+
deliberately skipped during refresh do not count as stale.
|
|
146
192
|
Jikji is a discovery/indexing preparer, not a lite retrieval method.
|
|
147
193
|
|
|
148
194
|
## Watch and scheduled freshness
|
|
@@ -162,16 +208,13 @@ hourly freshness is set up.
|
|
|
162
208
|
|
|
163
209
|
## Status and index maintenance
|
|
164
210
|
|
|
211
|
+
Use MCP `autorag.status` for health and `autorag.duplicates` for read-only
|
|
212
|
+
duplicate-family inspection. No search model is required. CLI-only repair:
|
|
213
|
+
|
|
165
214
|
```bash
|
|
166
|
-
autorag lite
|
|
167
|
-
autorag lite
|
|
168
|
-
autorag lite index rebuild --yes --json
|
|
169
|
-
autorag lite index reset --method parsed --yes --json
|
|
170
|
-
autorag lite duplicates --json
|
|
215
|
+
AUTORAG_CONFIG=/absolute/path/to/.autorag/config.json autorag lite index rebuild --yes --json
|
|
216
|
+
AUTORAG_CONFIG=/absolute/path/to/.autorag/config.json autorag lite index reset --method parsed --yes --json
|
|
171
217
|
```
|
|
172
|
-
|
|
173
|
-
- `status` shows path-opaque corpus freshness and index health. `health` is an
|
|
174
|
-
alias of `status`; neither resolves a model.
|
|
175
218
|
- `index reset` and `index rebuild` remove or rebuild only workspace
|
|
176
219
|
`.autorag` indexes selected by `--method`. They never target source
|
|
177
220
|
documents.
|
|
@@ -180,19 +223,35 @@ autorag lite duplicates --json
|
|
|
180
223
|
|
|
181
224
|
## Unavailable components and failure handling
|
|
182
225
|
|
|
183
|
-
|
|
184
|
-
with
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
226
|
+
Inspect MCP `isError`, `errorCode`, `diagnostics`, and `unsearched` before
|
|
227
|
+
trusting results. `ok: true` with skipped surfaces is partial coverage, not
|
|
228
|
+
proof that the whole corpus was searched. Preserve the underlying error text
|
|
229
|
+
when reporting unavailable components such as `retrieval-method-failed`.
|
|
230
|
+
MinSync is required: when its binary is missing the call fails with an
|
|
231
|
+
`MinSync is required ...` error rather than returning partial results, so
|
|
232
|
+
install it (`cargo install minsync`) instead of working around it. Repair the
|
|
233
|
+
component rather than silently accepting degraded search.
|
|
234
|
+
|
|
235
|
+
## Normal MCP workflow and curation lifecycle
|
|
236
|
+
|
|
237
|
+
MCP results carry source, method, and content directly. After a search, the
|
|
238
|
+
optional curation lifecycle is also exposed through MCP: `autorag.report`
|
|
239
|
+
records a curated answer, and `autorag.evidence` returns the exact chunks behind
|
|
240
|
+
numbered results. These accept and return JSON matching the CLI's
|
|
241
|
+
report/evidence contracts; discover the exact schemas with MCP `tools/list`
|
|
242
|
+
rather than restating them here. Every bracketed `[n]` citation in a report
|
|
243
|
+
`answer` must be a `results[].number`; an unmatched citation is removed from
|
|
244
|
+
the persisted answer and returned as a `citation-without-result` diagnostic.
|
|
245
|
+
The CLI `autorag report` and `autorag evidence` commands remain available for
|
|
246
|
+
terminal maintenance.
|
|
190
247
|
|
|
191
248
|
## Completion condition
|
|
192
249
|
|
|
193
|
-
Setup is complete only when the
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
250
|
+
Setup is complete only when the package and stdio executable are installed,
|
|
251
|
+
roots are approved, trusted model-free config is written, every datasource has
|
|
252
|
+
been probed and configured/skipped lists reported, and dupey is installed or
|
|
253
|
+
its absence reported. The host must connect, discover tools, refresh requested
|
|
254
|
+
indexes, return acceptable MCP status, and retrieve known source content via
|
|
255
|
+
MCP. Any requested watch schedule must use the same config and be verified.
|
|
256
|
+
Remove any previously copied Lite search skill from the host's skill directory
|
|
257
|
+
so it no longer routes routine search through shell commands.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: autorag-setup
|
|
3
|
-
description: Install and configure AutoRAG, or repair its single search model, approved
|
|
3
|
+
description: Install and configure AutoRAG, register its Lite MCP server for external agents, or repair its single search model, approved roots, indexes, datasources, and health checks without exposing credentials. Use when AutoRAG or MCP is missing, init/refresh/health fails, indexes are stale, or the user wants to add folders or datasources.
|
|
4
4
|
license: MIT
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -10,6 +10,11 @@ Use this skill when AutoRAG is unconfigured, the `autorag` CLI is missing, model
|
|
|
10
10
|
resolution fails, indexes are missing or stale, or the user wants to change the
|
|
11
11
|
document collection or datasources.
|
|
12
12
|
|
|
13
|
+
For model-free external-agent search, use `autorag-lite-setup` to configure
|
|
14
|
+
and register `autorag-mcp`; do not configure a search model or install a search
|
|
15
|
+
skill for Lite. This skill's model setup and CLI search apply to the full
|
|
16
|
+
librarian, not the Lite MCP server.
|
|
17
|
+
|
|
13
18
|
## Safety
|
|
14
19
|
|
|
15
20
|
- Inspect only non-secret provider/model metadata and credential availability.
|
|
@@ -41,7 +46,7 @@ Check `--config`, `AUTORAG_CONFIG`, `$AUTORAG_HOME/config.json`, or
|
|
|
41
46
|
- `model.provider`, `model.id`, `model.api`, `model.baseUrl`, `model.apiKeyEnv`
|
|
42
47
|
- `bm25`, `minSync`, and `jikji`
|
|
43
48
|
- `limits` (retrieval, baseline-prefetch, and model-facing candidate caps)
|
|
44
|
-
- `datasources
|
|
49
|
+
- `datasources` and `ui`
|
|
45
50
|
|
|
46
51
|
Preserve explicit user choices and a working config unless the user asks to
|
|
47
52
|
replace them or health checks fail.
|
|
@@ -126,7 +131,7 @@ For a custom endpoint, add `api`, `baseUrl`, and `apiKeyEnv` to the single
|
|
|
126
131
|
"searchPaths": ["/path/to/documents"],
|
|
127
132
|
"model": {
|
|
128
133
|
"provider": "openrouter",
|
|
129
|
-
"id": "anthropic/claude-sonnet-
|
|
134
|
+
"id": "anthropic/claude-sonnet-5.5",
|
|
130
135
|
"api": "openai-completions",
|
|
131
136
|
"baseUrl": "https://openrouter.ai/api/v1",
|
|
132
137
|
"apiKeyEnv": "OPENROUTER_API_KEY"
|
|
@@ -141,17 +146,26 @@ reasoning, thinking, and compat settings are kept. Only an id outside the
|
|
|
141
146
|
catalog (private proxy, Ollama, LiteLLM) gets a generic text model with a 128k
|
|
142
147
|
context window unless those fields are declared.
|
|
143
148
|
|
|
144
|
-
Use `--force` only when intentionally replacing an existing config
|
|
149
|
+
Use `--force` only when intentionally replacing an existing config, and target it
|
|
150
|
+
with an explicit path (`--config` or `AUTORAG_CONFIG`); `--force` refuses to
|
|
151
|
+
replace the implicit `~/.autorag/config.json`. Legacy cwd
|
|
145
152
|
`autorag.config.json` is a migration source only and is never deleted by init.
|
|
146
153
|
|
|
147
154
|
### Retrieval defaults
|
|
148
155
|
|
|
149
156
|
MinSync and Jikji are enabled by default. Leave them enabled unless the
|
|
150
|
-
user explicitly asks otherwise.
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
157
|
+
user explicitly asks otherwise. Indexing never happens while answering: a
|
|
158
|
+
question only reads indexes that `autorag refresh` (or `autorag watch`) built,
|
|
159
|
+
so run a refresh after setup and whenever documents change. A never-refreshed
|
|
160
|
+
workspace still answers, but without MinSync/Jikji evidence.
|
|
161
|
+
|
|
162
|
+
Refresh (never a query) auto-installs the binaries: MinSync installs a verified
|
|
163
|
+
GitHub release into `<workspace>/.autorag/bin` (`minSync.autoInstall` defaults
|
|
164
|
+
to true), and Jikji installs `jikji-cli` through cargo (`jikji.autoInstall`
|
|
165
|
+
defaults to true; requires the Rust toolchain). Set `"autoInstall": false` only
|
|
166
|
+
when managing the binary yourself. Refresh is incremental: MinSync syncs only
|
|
167
|
+
changed parsed mirrors, and `jikji prepare` reuses unchanged documents. Roots
|
|
168
|
+
prepare in parallel.
|
|
155
169
|
|
|
156
170
|
Jikji stores its prepared corpus metadata in a hidden `.jikji` directory
|
|
157
171
|
inside each indexed source root — that is Jikji's native index layout and
|
|
@@ -186,16 +200,72 @@ remote, provider:
|
|
|
186
200
|
|
|
187
201
|
```bash
|
|
188
202
|
autorag init \
|
|
189
|
-
--embedder-id "
|
|
190
|
-
--embedder-base-url "https://
|
|
191
|
-
--embedder-api-key-env "
|
|
192
|
-
--embedder-dimension
|
|
203
|
+
--embedder-id "voyageai/voyage-4-lite" \
|
|
204
|
+
--embedder-base-url "https://openrouter.ai/api/v1" \
|
|
205
|
+
--embedder-api-key-env "OPENROUTER_API_KEY" \
|
|
206
|
+
--embedder-dimension 1024 \
|
|
193
207
|
--embedder-batch-size 64
|
|
194
208
|
```
|
|
195
209
|
|
|
196
210
|
Only store the environment-variable name, never its value. Dimension and batch
|
|
197
211
|
size must be positive integers, and the dimension must match the embedder
|
|
198
|
-
(default Qwen3 is 1024; legacy EmbeddingGemma is 768;
|
|
212
|
+
(default Qwen3 is 1024; legacy EmbeddingGemma is 768; `voyageai/voyage-4-lite` via OpenRouter is 1024).
|
|
213
|
+
|
|
214
|
+
### Jev routing and question decomposition (on by default)
|
|
215
|
+
|
|
216
|
+
Leave both enabled. They are the recommended setup: they make simple questions
|
|
217
|
+
fast and multi-part questions thorough.
|
|
218
|
+
|
|
219
|
+
- **Jev** (`jev`, default `{ "backend": "openrouter" }`, model
|
|
220
|
+
`typesafe/jev-1.13`) runs before the fast answer. It routes each question to
|
|
221
|
+
local search, web search, a direct answer (general knowledge or small
|
|
222
|
+
talk skips retrieval entirely), or the `config` branch, and decides whether
|
|
223
|
+
to decompose it. On
|
|
224
|
+
local search it also decides, per registered datasource, whether to search
|
|
225
|
+
it before the fast answer, using each datasource's `description` and where
|
|
226
|
+
similar past questions were answered (retrieval memory). When setting up a
|
|
227
|
+
datasource, always write a `description` from what it actually holds:
|
|
228
|
+
channels or rooms, people, topics, time range (for example `"Team Slack,
|
|
229
|
+
2024-2026: #release and #on-call channels, dependabot notifications"`).
|
|
230
|
+
Jev is told descriptions are short, non-exhaustive summaries, so list the
|
|
231
|
+
main content and do not try to list everything. After the fast answer it
|
|
232
|
+
decides whether verification is needed, so a complete, evidence-backed fast
|
|
233
|
+
answer ends the run.
|
|
234
|
+
- **Question decomposition** (`queryDecomposition`, default model
|
|
235
|
+
`openrouter/qwen/qwen3.7-flash`) splits a multi-part question into at most
|
|
236
|
+
five search queries that run in parallel.
|
|
237
|
+
|
|
238
|
+
Both use the user's `OPENROUTER_API_KEY`; confirm it is set (`test -n
|
|
239
|
+
"$OPENROUTER_API_KEY"`, never print it) and tell the user Jev routing is on.
|
|
240
|
+
Without the key, routing falls back to a single local search and the run
|
|
241
|
+
always verifies, so searches still work. A `query-route-fallback` diagnostic
|
|
242
|
+
(`autorag search --debug`) shows that state.
|
|
243
|
+
|
|
244
|
+
```json
|
|
245
|
+
{
|
|
246
|
+
"jev": { "backend": "openrouter" },
|
|
247
|
+
"queryDecomposition": { "model": { "provider": "openrouter", "id": "qwen/qwen3.7-flash" } }
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
`autorag init` writes these defaults into new configs. To change them:
|
|
252
|
+
|
|
253
|
+
- Jev backend: `"backend": "typesafe"` (`TYPESAFE_API_KEY`) or `"vercel"`
|
|
254
|
+
(`AI_GATEWAY_API_KEY`).
|
|
255
|
+
- Decomposition model: any catalog `provider`/`id`, with the same fields as
|
|
256
|
+
the top-level `model`.
|
|
257
|
+
- `"queryDecomposition": false` decomposes with the search model itself.
|
|
258
|
+
- `"jev": false` turns routing off entirely. Do this only when the user
|
|
259
|
+
explicitly opts out, for example because questions must never leave the
|
|
260
|
+
machine (Jev and decomposition send the question text to OpenRouter).
|
|
261
|
+
|
|
262
|
+
When a user asks the running agent itself to change its settings (switch the
|
|
263
|
+
default model, add a provider, check that a provider works), Jev's `config`
|
|
264
|
+
branch loads this whole skill into that turn. The agent edits only the active
|
|
265
|
+
config file (and `models.json` for a custom provider), verifies with
|
|
266
|
+
`autorag health --json` and `autorag models list --available`, and reports each
|
|
267
|
+
change as old → new through `emit_autorag_results`. It never prints a
|
|
268
|
+
credential value and never uses `init --force`.
|
|
199
269
|
|
|
200
270
|
### Retrieval and ingest caps
|
|
201
271
|
|
|
@@ -260,7 +330,7 @@ setup. Configure datasources directly in trusted config, wizard-style:
|
|
|
260
330
|
(such as `github`) require their credential environment variable
|
|
261
331
|
(`GITHUB_TOKEN`).
|
|
262
332
|
2. Auto-configure every datasource that probes feasible — write its trusted
|
|
263
|
-
`datasources`
|
|
333
|
+
`datasources` entries without asking. For example,
|
|
264
334
|
when Slack (`slacrawl`) and Discord (`discrawl`) are installed with local
|
|
265
335
|
stores present, set both up automatically. Discord uses discrawl's local
|
|
266
336
|
desktop wiretap archive; no Discord bot token is configured or needed.
|
|
@@ -273,13 +343,13 @@ setup. Configure datasources directly in trusted config, wizard-style:
|
|
|
273
343
|
users — always probe them and report their status, even when they end up
|
|
274
344
|
skipped.
|
|
275
345
|
|
|
276
|
-
Datasource skills belong in trusted config
|
|
346
|
+
Datasource skills belong in trusted config. Builtin
|
|
277
347
|
template names are `kakao`, `whatsapp`, `telegram`, `slack`, `discord`,
|
|
278
348
|
`clawgallery`, `notion`, `github`, `github-gist`, `cloud-drive`, `mail-export`,
|
|
279
349
|
`mailcrawl`, `obsidian`, `rss`, `spotlight`, and `lark`. Config keys may be connection
|
|
280
350
|
aliases with `"type": "<template>"`. Unknown names are skipped with an
|
|
281
351
|
`unknown-datasource-skill` warning; they do not fail config resolution.
|
|
282
|
-
`scope`
|
|
352
|
+
`scope` narrows a query to a sub-path as ordinary filtering. Tags are descriptive metadata only, not search filters. MCP `datasourceIds` selects configured connections before retrieval; discover their IDs with `autorag.datasources.list`.
|
|
283
353
|
|
|
284
354
|
```jsonc
|
|
285
355
|
{
|
|
@@ -291,10 +361,6 @@ aliases with `"type": "<template>"`. Unknown names are skipped with an
|
|
|
291
361
|
"mailcrawl": { "instanceId": "personal", "connector": { "account": "personal", "mailbox": "INBOX", "binaryPath": "mailcrawl" } },
|
|
292
362
|
"obsidian": { "connector": { "vaultPath": "/path/to/vault" } },
|
|
293
363
|
"rss": { "connector": { "feeds": [{ "url": "https://example.com/feed.xml" }] } }
|
|
294
|
-
},
|
|
295
|
-
"datasourceAccess": {
|
|
296
|
-
"allowedTags": ["github", "cloud-drive", "mailcrawl", "obsidian", "rss"],
|
|
297
|
-
"allowedScopes": ["/github/**", "/google-drive/**", "/archive-drive/**", "/mailcrawl/**", "/obsidian/**", "/rss/**"]
|
|
298
364
|
}
|
|
299
365
|
}
|
|
300
366
|
```
|
|
@@ -330,7 +396,7 @@ autorag search "summarize the collection" --top-k 3 --json --debug
|
|
|
330
396
|
performs one live completion probe.
|
|
331
397
|
- `health --skip-probes` is only for intentionally offline validation and does
|
|
332
398
|
not prove live provider access.
|
|
333
|
-
- `refresh` syncs parsed mirrors, MinSync, Jikji,
|
|
399
|
+
- `refresh` syncs parsed mirrors, MinSync, Jikji, configured datasources, and
|
|
334
400
|
on Windows the bundled Everything file-name index. `--method <csv>` may
|
|
335
401
|
deliberately narrow it (`parsed,minsync,datasources,jikji,everything,all`).
|
|
336
402
|
- Use `refresh --force` for a full resync only when incremental refresh is not
|
|
@@ -340,6 +406,23 @@ autorag search "summarize the collection" --top-k 3 --json --debug
|
|
|
340
406
|
exact source chunks behind numbered results, including source, method,
|
|
341
407
|
stable evidence ID, excerpt/content, chunk index, and line number.
|
|
342
408
|
|
|
409
|
+
## Connect external agents through MCP
|
|
410
|
+
|
|
411
|
+
When setting up AutoRAG for a coding agent, register the package's
|
|
412
|
+
`autorag-mcp` stdio executable with the same absolute `AUTORAG_CONFIG` path.
|
|
413
|
+
Follow `autorag-lite-setup`'s MCP registration and verification procedure:
|
|
414
|
+
inspect existing host registration, use an absolute executable path,
|
|
415
|
+
reload/reconnect, discover schemas with `tools/list`, and exercise
|
|
416
|
+
`autorag.status`, `autorag.datasources.list`, and a known-phrase
|
|
417
|
+
`autorag.search` through MCP. Restart the MCP server after config changes.
|
|
418
|
+
The MCP server returns model-free source chunks; the calling agent curates
|
|
419
|
+
them. It does not invoke the configured librarian model. The same server also
|
|
420
|
+
exposes `autorag.report` and `autorag.evidence` for the
|
|
421
|
+
curation lifecycle; the matching CLI commands remain a maintenance path.
|
|
422
|
+
Discover the exact schemas with MCP `tools/list`. Keep the full `autorag` skill
|
|
423
|
+
only when model-backed curated search is also wanted. For MCP-only setup, use
|
|
424
|
+
`autorag-lite-setup` instead of requiring live model health.
|
|
425
|
+
|
|
343
426
|
## Keep indexes fresh
|
|
344
427
|
|
|
345
428
|
For continuous freshness, create or verify an OS-appropriate scheduled
|
|
@@ -369,3 +452,5 @@ installed or its absence reported, `status` is acceptable, live `health`
|
|
|
369
452
|
passes, `refresh` builds the requested indexes, one real structured search
|
|
370
453
|
succeeds, and any requested ongoing schedule is installed or verified with the
|
|
371
454
|
user told it is active.
|
|
455
|
+
For external-agent integration, also require successful MCP discovery and a
|
|
456
|
+
known-source MCP search; CLI success alone does not prove the host connection.
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { CommandContext } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Run the `autorag feedback` command. Records per-result useful/not-useful
|
|
4
|
-
* signals against an existing curated-results session. Returns 0 when at least
|
|
5
|
-
* one feedback signal was applied, 2 for usage errors or an unknown session,
|
|
6
|
-
* 1 for runtime/IO errors.
|
|
7
|
-
*/
|
|
8
|
-
export declare function runFeedback(ctx: CommandContext): Promise<number>;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Trusted, server-bound access context for the datasource layer.
|
|
3
|
-
*
|
|
4
|
-
* Constructed from server-supplied allow-tags and allow-scopes ONLY — never
|
|
5
|
-
* from model or tool arguments. Tags authorize datasource skills; scopes are
|
|
6
|
-
* applied only to skills that advertise the `scoped` capability.
|
|
7
|
-
*/
|
|
8
|
-
import type { DatasourceAccessible } from "./types.js";
|
|
9
|
-
export interface DatasourceAccessContextOptions {
|
|
10
|
-
/** Trusted allow-tags. Undefined or empty ⇒ default-deny (isDenyAll). */
|
|
11
|
-
readonly allowedTags?: readonly string[];
|
|
12
|
-
/** Trusted allow-scopes as slash-hierarchical paths or globs. */
|
|
13
|
-
readonly allowedScopes?: readonly string[];
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Access context for gating datasource descriptors and sources.
|
|
17
|
-
*
|
|
18
|
-
* Non-datasource descriptors (those without a `datasourceId`) are NOT gated
|
|
19
|
-
* by this context: {@link isAccessible} returns `true` for them so plain
|
|
20
|
-
* retrieval methods (e.g. `posix`) pass through unchanged.
|
|
21
|
-
*/
|
|
22
|
-
export declare class DatasourceAccessContext {
|
|
23
|
-
readonly allowedTags: readonly string[];
|
|
24
|
-
readonly allowedScopes: readonly string[];
|
|
25
|
-
private readonly denyAll;
|
|
26
|
-
constructor(options?: DatasourceAccessContextOptions);
|
|
27
|
-
/** True when the context denies everything (no trusted allow-tags). */
|
|
28
|
-
get isDenyAll(): boolean;
|
|
29
|
-
/**
|
|
30
|
-
* Whether a descriptor is accessible.
|
|
31
|
-
*
|
|
32
|
-
* Non-datasource descriptors (no `datasourceId`) pass through (`true`) —
|
|
33
|
-
* they are not gated by this context. Datasource descriptors require at
|
|
34
|
-
* least one tag intersecting the trusted allow-tags.
|
|
35
|
-
*/
|
|
36
|
-
isAccessible(descriptor: DatasourceAccessible): boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Scope-capable datasource results are filtered by trusted and user scopes.
|
|
39
|
-
* Datasources without the `scoped` capability bypass this predicate and
|
|
40
|
-
* are authorized only at the skill/tag level.
|
|
41
|
-
*/
|
|
42
|
-
allowedSourcesPredicate(_userScope?: string, userScopes?: readonly string[]): (source: string) => boolean;
|
|
43
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Result filter that applies datasource access gating to the shared retrieval
|
|
3
|
-
* result stream.
|
|
4
|
-
*
|
|
5
|
-
* The filter sits *after* {@link ParallelRetriever} and *before* merging: it
|
|
6
|
-
* takes the per-method result map and the {@link RetrievalMethod}s that
|
|
7
|
-
* produced it, then for every datasource-backed method either drops all of
|
|
8
|
-
* its results (when the trusted access context denies the descriptor) or
|
|
9
|
-
* keeps only the sources the context allows for the current user scope when
|
|
10
|
-
* the method advertises the `scoped` capability.
|
|
11
|
-
*
|
|
12
|
-
* Non-datasource methods (those whose descriptor has no `datasourceId`) pass
|
|
13
|
-
* through completely untouched — they are gated by their own retrieval
|
|
14
|
-
* pipeline, not by the datasource access context.
|
|
15
|
-
*
|
|
16
|
-
* Security invariants:
|
|
17
|
-
* - Deny is always an explicit `false` (an empty result array), never
|
|
18
|
-
* `undefined`-as-deny. {@link DatasourceAccessContext} itself returns
|
|
19
|
-
* explicit booleans from its predicate; this filter never passes
|
|
20
|
-
* `undefined` to `matchesVirtualPathScope` as a deny signal.
|
|
21
|
-
* - The filter never grants access. It only narrows results using the
|
|
22
|
-
* trusted, server-supplied {@link DatasourceAccessContext}; model/tool
|
|
23
|
-
* arguments (such as `userScope`) can only *further restrict* the trusted
|
|
24
|
-
* allow-scopes, never widen them.
|
|
25
|
-
*/
|
|
26
|
-
import type { RetrievalMethod, RetrievalResult } from "../retrieval/types.js";
|
|
27
|
-
import type { DatasourceAccessContext } from "./access-context.js";
|
|
28
|
-
/** Per-method retrieval results keyed by method name. */
|
|
29
|
-
export type ResultsByMethod = Map<string, RetrievalResult[]>;
|
|
30
|
-
/**
|
|
31
|
-
* Applies datasource access gating to a per-method result map.
|
|
32
|
-
*
|
|
33
|
-
* The instance form lets callers wire a {@link DatasourceSkillRegistry} for
|
|
34
|
-
* future descriptor enrichment; the v1 filter only needs the
|
|
35
|
-
* {@link RetrievalMethodDescriptor} carried by each method, which already
|
|
36
|
-
* satisfies {@link DatasourceAccessible} structurally (`datasourceId?` +
|
|
37
|
-
* `tags?`).
|
|
38
|
-
*/
|
|
39
|
-
export declare class DatasourceResultFilter {
|
|
40
|
-
/**
|
|
41
|
-
* Filter `byMethod` according to datasource access rules.
|
|
42
|
-
*
|
|
43
|
-
* For each method present in both `byMethod` and `methods`:
|
|
44
|
-
* - non-datasource methods (`descriptor.datasourceId` unset) are passed
|
|
45
|
-
* through with their result array unchanged;
|
|
46
|
-
* - datasource methods whose descriptor is denied by `ctx` are reduced to
|
|
47
|
-
* an empty result array (`[]` — explicit deny, never `undefined`);
|
|
48
|
-
* - datasource methods whose descriptor is allowed are filtered so only
|
|
49
|
-
* sources matching `ctx.allowedSourcesPredicate(userScope)` survive.
|
|
50
|
-
*
|
|
51
|
-
* Result entries for methods not present in `methods` are passed through
|
|
52
|
-
* unchanged (the filter cannot classify them and must not fabricate a
|
|
53
|
-
* descriptor). A new {@link ResultsByMethod} is returned; the input map is
|
|
54
|
-
* not mutated.
|
|
55
|
-
*
|
|
56
|
-
* @param byMethod Per-method results from the retriever.
|
|
57
|
-
* @param methods The {@link RetrievalMethod}s that produced them.
|
|
58
|
-
* @param ctx Trusted, server-supplied access context.
|
|
59
|
-
* @param userScope Optional user/model-requested scope; when provided it
|
|
60
|
-
* is intersected with the trusted allow-scopes and can only narrow
|
|
61
|
-
* results. `undefined` means "no extra user restriction".
|
|
62
|
-
*/
|
|
63
|
-
filter(byMethod: ResultsByMethod, methods: readonly RetrievalMethod[], ctx: DatasourceAccessContext, userScope?: string, userScopes?: readonly string[]): ResultsByMethod;
|
|
64
|
-
}
|