@autorag/librarian 2.7.0 → 2.8.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 +6 -0
- package/README.md +66 -23
- package/dist/agent/agent.d.ts +119 -25
- package/dist/agent/answer-guidelines.d.ts +19 -0
- package/dist/agent/citations.d.ts +20 -0
- package/dist/agent/index.d.ts +1 -0
- package/dist/agent/jev-extension.d.ts +68 -0
- package/dist/agent/pi-session.d.ts +21 -1
- package/dist/agent/query-decomposition.d.ts +25 -0
- package/dist/agent/query-routing.d.ts +54 -0
- package/dist/agent/search-documents.d.ts +2 -2
- package/dist/agent/system-prompt.d.ts +1 -0
- package/dist/cli/commands/evidence.d.ts +22 -0
- package/dist/cli/commands/init.d.ts +2 -1
- package/dist/cli/commands/update-check.d.ts +8 -0
- package/dist/cli/config.d.ts +66 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +9432 -8427
- package/dist/cli/update-check.d.ts +34 -0
- package/dist/cli/version.d.ts +5 -0
- package/dist/core.d.ts +33 -1
- package/dist/core.js +9505 -8630
- 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 +1 -0
- package/dist/index.js +10824 -8655
- package/dist/jikji/client.d.ts +6 -1
- package/dist/mcp/index.d.ts +2 -0
- package/dist/mcp/index.js +29949 -0
- package/dist/mcp/server.d.ts +9 -0
- package/dist/minsync/method.d.ts +6 -3
- package/dist/mirror/index.d.ts +1 -1
- package/dist/mirror/paths.d.ts +6 -0
- package/dist/retrieval/engine.d.ts +32 -1
- package/dist/retrieval/index.d.ts +2 -1
- package/dist/retrieval/rerank.d.ts +2 -0
- package/dist/retrieval/selection.d.ts +97 -0
- package/package.json +7 -3
- package/skills/autorag/SKILL.md +25 -4
- package/skills/autorag-doctor/SKILL.md +27 -18
- package/skills/autorag-lite-setup/SKILL.md +115 -59
- package/skills/autorag-setup/SKILL.md +79 -7
- package/skills/autorag-lite-search/SKILL.md +0 -245
|
@@ -1,16 +1,15 @@
|
|
|
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
|
|
|
@@ -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 and authorization 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
|
|
@@ -97,25 +146,26 @@ can never grant it. Store only env-var names such as `tokenEnv` or
|
|
|
97
146
|
|
|
98
147
|
## Build and refresh indexes
|
|
99
148
|
|
|
149
|
+
After connecting, call MCP `autorag.refresh` with `{}` for an incremental run.
|
|
150
|
+
Use `{"methods":["parsed","minsync"]}` to narrow indexing, or
|
|
151
|
+
`{"force":true}` only when a full resync is needed. Omit `methods` to run all
|
|
152
|
+
configured methods; MCP does not accept `"all"` as a method value.
|
|
153
|
+
|
|
154
|
+
CLI refresh remains available for bootstrap, read-only deployments, and repair:
|
|
155
|
+
|
|
100
156
|
```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
|
|
157
|
+
AUTORAG_CONFIG=/absolute/path/to/.autorag/config.json autorag lite refresh --json
|
|
105
158
|
```
|
|
106
159
|
|
|
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.
|
|
160
|
+
- Refresh syncs parsed mirrors, MinSync, Jikji, and configured datasources.
|
|
161
|
+
- CLI `--full` and `--force` request a full resync; MCP uses `force: true`.
|
|
162
|
+
- CLI `--method <csv>` accepts `parsed`, `minsync`, `datasources`, `jikji`,
|
|
163
|
+
`everything` (Windows), `fsearch` (macOS/Linux), and `all`. MCP `methods`
|
|
164
|
+
accepts the same individual methods, not `all`. Unknown values are rejected.
|
|
165
|
+
- Indexing never runs while answering: retrieval only reads what refresh built.
|
|
166
|
+
MinSync and Jikji auto-install during refresh (never during a query). If they
|
|
167
|
+
are missing or broken, run a full refresh or return to setup rather than
|
|
168
|
+
silently degrading to lexical-only search.
|
|
119
169
|
- MinSync's default embedder is in-process native Qwen3 embeddings
|
|
120
170
|
(`native:Qwen/Qwen3-Embedding-0.6B`, 1024 dimensions, MinSync 0.4.5+): no
|
|
121
171
|
embedder flags, no API key, and no external daemon (such as Ollama) are
|
|
@@ -131,18 +181,12 @@ autorag lite refresh --force --json
|
|
|
131
181
|
and the user is told duplicate exclusion is off. Set
|
|
132
182
|
`"excludeExactDuplicates": false` to index every copy.
|
|
133
183
|
|
|
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.
|
|
184
|
+
Content search requires a completed refresh. MCP `autorag.search` returns
|
|
185
|
+
`isError: true` with `errorCode: "index-not-ready"` until refresh completes.
|
|
186
|
+
Always refresh first, and refresh again when roots change. Stale indexes can
|
|
187
|
+
still return results with `stale: true` and diagnostics; use `strict: true`
|
|
188
|
+
to reject stale answers, or call `autorag.refresh` before searching. Sources
|
|
189
|
+
deliberately skipped during refresh do not count as stale.
|
|
146
190
|
Jikji is a discovery/indexing preparer, not a lite retrieval method.
|
|
147
191
|
|
|
148
192
|
## Watch and scheduled freshness
|
|
@@ -162,16 +206,13 @@ hourly freshness is set up.
|
|
|
162
206
|
|
|
163
207
|
## Status and index maintenance
|
|
164
208
|
|
|
209
|
+
Use MCP `autorag.status` for health and `autorag.duplicates` for read-only
|
|
210
|
+
duplicate-family inspection. No search model is required. CLI-only repair:
|
|
211
|
+
|
|
165
212
|
```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
|
|
213
|
+
AUTORAG_CONFIG=/absolute/path/to/.autorag/config.json autorag lite index rebuild --yes --json
|
|
214
|
+
AUTORAG_CONFIG=/absolute/path/to/.autorag/config.json autorag lite index reset --method parsed --yes --json
|
|
171
215
|
```
|
|
172
|
-
|
|
173
|
-
- `status` shows path-opaque corpus freshness and index health. `health` is an
|
|
174
|
-
alias of `status`; neither resolves a model.
|
|
175
216
|
- `index reset` and `index rebuild` remove or rebuild only workspace
|
|
176
217
|
`.autorag` indexes selected by `--method`. They never target source
|
|
177
218
|
documents.
|
|
@@ -180,19 +221,34 @@ autorag lite duplicates --json
|
|
|
180
221
|
|
|
181
222
|
## Unavailable components and failure handling
|
|
182
223
|
|
|
183
|
-
|
|
184
|
-
with
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
224
|
+
Inspect MCP `isError`, `errorCode`, `diagnostics`, and `unsearched` before
|
|
225
|
+
trusting results. `ok: true` with skipped surfaces is partial coverage, not
|
|
226
|
+
proof that the whole corpus was searched. Preserve the underlying error text
|
|
227
|
+
when reporting unavailable components such as `minsync-unavailable` or
|
|
228
|
+
`retrieval-method-failed`. Repair the component rather than silently accepting
|
|
229
|
+
degraded search.
|
|
230
|
+
|
|
231
|
+
## Normal MCP workflow and curation lifecycle
|
|
232
|
+
|
|
233
|
+
MCP results carry source, method, and content directly. After a search, the
|
|
234
|
+
optional curation lifecycle is also exposed through MCP: `autorag.report`
|
|
235
|
+
records a curated answer, `autorag.evidence` returns the exact chunks behind
|
|
236
|
+
numbered results, and `autorag.feedback` records which numbers were useful or
|
|
237
|
+
not. These accept and return JSON matching the CLI's report/evidence/feedback
|
|
238
|
+
contracts; discover the exact schemas with MCP `tools/list` rather than
|
|
239
|
+
restating them here. Every bracketed `[n]` citation in a report `answer` must
|
|
240
|
+
be a `results[].number`; an unmatched citation is removed from the persisted
|
|
241
|
+
answer and returned as a `citation-without-result` diagnostic. The CLI
|
|
242
|
+
`autorag report`, `autorag evidence`, and `autorag feedback` commands remain
|
|
243
|
+
available for terminal maintenance.
|
|
190
244
|
|
|
191
245
|
## Completion condition
|
|
192
246
|
|
|
193
|
-
Setup is complete only when the
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
247
|
+
Setup is complete only when the package and stdio executable are installed,
|
|
248
|
+
roots are approved, trusted model-free config is written, every datasource has
|
|
249
|
+
been probed and configured/skipped lists reported, and dupey is installed or
|
|
250
|
+
its absence reported. The host must connect, discover tools, refresh requested
|
|
251
|
+
indexes, return acceptable MCP status, and retrieve known source content via
|
|
252
|
+
MCP. Any requested watch schedule must use the same config and be verified.
|
|
253
|
+
Remove any previously copied Lite search skill from the host's skill directory
|
|
254
|
+
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.
|
|
@@ -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
|
|
@@ -197,6 +211,45 @@ 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
212
|
(default Qwen3 is 1024; legacy EmbeddingGemma is 768; text-embedding-3-small is 1536).
|
|
199
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, or a direct answer (general knowledge or small
|
|
222
|
+
talk skips retrieval entirely), and decides whether to decompose it. After
|
|
223
|
+
the fast answer it decides whether verification is needed, so a complete,
|
|
224
|
+
evidence-backed fast answer ends the run.
|
|
225
|
+
- **Question decomposition** (`queryDecomposition`, default model
|
|
226
|
+
`openrouter/qwen/qwen3.7-flash`) splits a multi-part question into at most
|
|
227
|
+
five search queries that run in parallel.
|
|
228
|
+
|
|
229
|
+
Both use the user's `OPENROUTER_API_KEY`; confirm it is set (`test -n
|
|
230
|
+
"$OPENROUTER_API_KEY"`, never print it) and tell the user Jev routing is on.
|
|
231
|
+
Without the key, routing falls back to a single local search and the run
|
|
232
|
+
always verifies, so searches still work. A `query-route-fallback` diagnostic
|
|
233
|
+
(`autorag search --debug`) shows that state.
|
|
234
|
+
|
|
235
|
+
```json
|
|
236
|
+
{
|
|
237
|
+
"jev": { "backend": "openrouter" },
|
|
238
|
+
"queryDecomposition": { "model": { "provider": "openrouter", "id": "qwen/qwen3.7-flash" } }
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
`autorag init` writes these defaults into new configs. To change them:
|
|
243
|
+
|
|
244
|
+
- Jev backend: `"backend": "typesafe"` (`TYPESAFE_API_KEY`) or `"vercel"`
|
|
245
|
+
(`AI_GATEWAY_API_KEY`).
|
|
246
|
+
- Decomposition model: any catalog `provider`/`id`, with the same fields as
|
|
247
|
+
the top-level `model`.
|
|
248
|
+
- `"queryDecomposition": false` decomposes with the search model itself.
|
|
249
|
+
- `"jev": false` turns routing off entirely. Do this only when the user
|
|
250
|
+
explicitly opts out, for example because questions must never leave the
|
|
251
|
+
machine (Jev and decomposition send the question text to OpenRouter).
|
|
252
|
+
|
|
200
253
|
### Retrieval and ingest caps
|
|
201
254
|
|
|
202
255
|
`limits` bounds retrieval, baseline prefetch, and the candidate lists handed to
|
|
@@ -340,6 +393,23 @@ autorag search "summarize the collection" --top-k 3 --json --debug
|
|
|
340
393
|
exact source chunks behind numbered results, including source, method,
|
|
341
394
|
stable evidence ID, excerpt/content, chunk index, and line number.
|
|
342
395
|
|
|
396
|
+
## Connect external agents through MCP
|
|
397
|
+
|
|
398
|
+
When setting up AutoRAG for a coding agent, register the package's
|
|
399
|
+
`autorag-mcp` stdio executable with the same absolute `AUTORAG_CONFIG` path.
|
|
400
|
+
Follow `autorag-lite-setup`'s MCP registration and verification procedure:
|
|
401
|
+
inspect existing host registration, use an absolute executable path,
|
|
402
|
+
reload/reconnect, discover schemas with `tools/list`, and exercise
|
|
403
|
+
`autorag.status`, `autorag.datasources.list`, and a known-phrase
|
|
404
|
+
`autorag.search` through MCP. Restart the MCP server after config changes.
|
|
405
|
+
The MCP server returns model-free source chunks; the calling agent curates
|
|
406
|
+
them. It does not invoke the configured librarian model. The same server also
|
|
407
|
+
exposes `autorag.report`, `autorag.evidence`, and `autorag.feedback` for the
|
|
408
|
+
curation lifecycle; the matching CLI commands remain a maintenance path.
|
|
409
|
+
Discover the exact schemas with MCP `tools/list`. Keep the full `autorag` skill
|
|
410
|
+
only when model-backed curated search is also wanted. For MCP-only setup, use
|
|
411
|
+
`autorag-lite-setup` instead of requiring live model health.
|
|
412
|
+
|
|
343
413
|
## Keep indexes fresh
|
|
344
414
|
|
|
345
415
|
For continuous freshness, create or verify an OS-appropriate scheduled
|
|
@@ -369,3 +439,5 @@ installed or its absence reported, `status` is acceptable, live `health`
|
|
|
369
439
|
passes, `refresh` builds the requested indexes, one real structured search
|
|
370
440
|
succeeds, and any requested ongoing schedule is installed or verified with the
|
|
371
441
|
user told it is active.
|
|
442
|
+
For external-agent integration, also require successful MCP discovery and a
|
|
443
|
+
known-source MCP search; CLI success alone does not prove the host connection.
|
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: autorag-lite-search
|
|
3
|
-
description: Retrieve documents from an indexed AutoRAG Lite corpus without a model, then persist externally curated reports, inspect evidence, and record numbered feedback. Use when the user wants model-free search, scoped or tag-narrowed retrieval, or the report/evidence/feedback workflow over local documents and authorized datasources.
|
|
4
|
-
license: MIT
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# AutoRAG Lite search
|
|
8
|
-
|
|
9
|
-
Use this skill when AutoRAG Lite is already configured and indexed, and the
|
|
10
|
-
user wants model-free retrieval, or wants to persist an externally curated
|
|
11
|
-
report, inspect its evidence, or record feedback. Use `autorag-lite-setup`
|
|
12
|
-
when config, indexing, or refresh is missing or broken. Use the `autorag`
|
|
13
|
-
skill when a model-backed curated answer is requested.
|
|
14
|
-
|
|
15
|
-
AutoRAG Lite never mutates sources. Retrieval reads local source documents and
|
|
16
|
-
authorized datasource content; writes go only to workspace `.autorag/` indexes,
|
|
17
|
-
the memory file, and Jikji `.jikji/` caches.
|
|
18
|
-
|
|
19
|
-
## Preflight
|
|
20
|
-
|
|
21
|
-
Retrieval needs a completed refresh. If `autorag lite retrieve` returns exit
|
|
22
|
-
code 2 with an `index-not-ready` diagnostic, no refresh has completed yet —
|
|
23
|
-
run `autorag lite refresh` (or `autorag refresh`) first, then retry. Confirm
|
|
24
|
-
freshness with:
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
autorag lite status --json
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
`status` is model-free and path-opaque, and its `stale` field is read from disk,
|
|
31
|
-
so it answers "is indexing complete?" even from a fresh process.
|
|
32
|
-
|
|
33
|
-
A stale corpus is not a failure: `retrieve` answers from the index it has and
|
|
34
|
-
reports the staleness it is answering past (`"stale": true` plus `stale-index`
|
|
35
|
-
diagnostics). Pass `--refresh` to rebuild incrementally before answering, or
|
|
36
|
-
`--strict` to keep the old fail-closed behavior and exit 2 instead of answering.
|
|
37
|
-
|
|
38
|
-
## Retrieve
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
autorag lite retrieve "key findings in the Q3 report" --top-k 5 --json
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
The JSON envelope is:
|
|
45
|
-
|
|
46
|
-
```json
|
|
47
|
-
{
|
|
48
|
-
"ok": true,
|
|
49
|
-
"query": "key findings in the Q3 report",
|
|
50
|
-
"stale": false,
|
|
51
|
-
"results": [
|
|
52
|
-
{
|
|
53
|
-
"number": 1,
|
|
54
|
-
"source": "<opaque source identifier>",
|
|
55
|
-
"method": "minsync",
|
|
56
|
-
"score": 0.83,
|
|
57
|
-
"metadata": {},
|
|
58
|
-
"content": "..."
|
|
59
|
-
}
|
|
60
|
-
],
|
|
61
|
-
"unsearched": [],
|
|
62
|
-
"diagnostics": []
|
|
63
|
-
}
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
- `--top-k N` must be a positive integer. Invalid values exit with code 2 and
|
|
67
|
-
an `{"ok": false, "error": "..."}` rejection envelope.
|
|
68
|
-
- Before any refresh, the envelope is `{"ok": false, "query": ..., "diagnostics":
|
|
69
|
-
[{"code": "index-not-ready", "severity": "error", ...}]}` with exit code 2.
|
|
70
|
-
- `stale: true` means the last refresh does not cover the current sources; the
|
|
71
|
-
results are still returned. Each entry in `diagnostics` with code
|
|
72
|
-
`stale-index` names the opaque source and a `reason` (for example
|
|
73
|
-
`mtime-and-size-changed`) plus `action: "refresh"`. Sources the refresh
|
|
74
|
-
deliberately skipped (exact duplicates, oversized or unparseable files, and
|
|
75
|
-
AutoRAG/Jikji product artifacts) are not stale.
|
|
76
|
-
- `--refresh` runs an incremental refresh before answering and reports the
|
|
77
|
-
corpus current; `--strict` exits 2 with the `index-not-ready` envelope when the
|
|
78
|
-
index is stale, for callers that must not answer from a stale index.
|
|
79
|
-
- Each result carries a provenance pair: the `source` identity and the
|
|
80
|
-
`method` that produced it. Source identities are source-native: real file
|
|
81
|
-
paths for local files, datasource identities for datasource results. Never
|
|
82
|
-
rewrite, guess, or flatten them.
|
|
83
|
-
- `unsearched` lists the retrieval surfaces that did not run for this query.
|
|
84
|
-
`ok: true` with a non-empty `unsearched` means the answer is partial: for
|
|
85
|
-
example local MinSync files are skipped while an index sync holds the
|
|
86
|
-
workspace lock, leaving only datasource hits. Check `unsearched.length > 0`
|
|
87
|
-
before concluding that the returned sources are the whole corpus. Each entry
|
|
88
|
-
is:
|
|
89
|
-
|
|
90
|
-
```json
|
|
91
|
-
{
|
|
92
|
-
"surface": "minsync",
|
|
93
|
-
"methods": ["hybrid", "minsync"],
|
|
94
|
-
"reason": "MinSyncQueryError: another sync is in progress (/Users/me/corpus/.autorag/minsync)"
|
|
95
|
-
}
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
`surface` is `minsync` for local files or the datasource id. `reason` is the
|
|
99
|
-
underlying failure verbatim — the CLI's failure kind, exit status, stderr and
|
|
100
|
-
real paths — so the operator can act on it directly. Report it to the user as
|
|
101
|
-
given; do not summarize it away.
|
|
102
|
-
- `diagnostics` carry the same transparency: `source` is the component or
|
|
103
|
-
method label, `reason` repeats the underlying error, and codes include
|
|
104
|
-
`retrieval-method-failed` and `minsync-unavailable`. A degraded component
|
|
105
|
-
produces a diagnostic, not a failed run; check `diagnostics` before trusting
|
|
106
|
-
an empty result set.
|
|
107
|
-
- `--debug` adds per-result metadata and the diagnostics list to human output.
|
|
108
|
-
Skipped-surface warnings print without it, and their reasons carry real
|
|
109
|
-
filesystem paths.
|
|
110
|
-
- Exit codes: 0 on success (results may be empty, and a stale index is a
|
|
111
|
-
warning rather than a failure), 2 for usage, config, not-ready, or
|
|
112
|
-
`--strict` staleness errors, 1 for runtime errors.
|
|
113
|
-
|
|
114
|
-
Retrieval methods run in parallel and merge: parsed mirrors and MinSync
|
|
115
|
-
lexical/vector/hybrid methods, plus configured datasource methods. Jikji is a
|
|
116
|
-
local discovery/indexing preparer, not a retrieval method in the lite registry.
|
|
117
|
-
`--method` selection applies to refresh, not retrieve; retrieval always queries
|
|
118
|
-
every active retrieval method.
|
|
119
|
-
|
|
120
|
-
## Scope and tag narrowing (default-deny)
|
|
121
|
-
|
|
122
|
-
Datasource access is default-deny from trusted config
|
|
123
|
-
(`datasourceAccess.allowedTags`, `allowedScopes`). Retrieval flags can only
|
|
124
|
-
narrow that access, never widen it:
|
|
125
|
-
|
|
126
|
-
- `--scope SCOPE` narrows datasource retrieval to a requested sub-path; it
|
|
127
|
-
cannot grant access to anything the config does not already allow.
|
|
128
|
-
- `--tags tag1,tag2` further narrows already-authorized datasource results by
|
|
129
|
-
intersecting with configured allowed tags; it never grants new access.
|
|
130
|
-
|
|
131
|
-
## Persisting a curated report
|
|
132
|
-
|
|
133
|
-
An external agent curates the raw retrieval results, then persists the
|
|
134
|
-
structured report so evidence and feedback commands work against it:
|
|
135
|
-
|
|
136
|
-
```bash
|
|
137
|
-
autorag lite report "key findings in the Q3 report" --input report.json --json
|
|
138
|
-
cat report.json | autorag lite report "key findings in the Q3 report" --json
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
The input is the `emit_autorag_results` JSON schema. Every field below that is
|
|
142
|
-
not marked optional is required — `results[].evidence` and `mapping[].content`
|
|
143
|
-
are the two that are easiest to forget:
|
|
144
|
-
|
|
145
|
-
- `answer` (string) — the curated answer, citing results as `[1]`, `[2]`.
|
|
146
|
-
- `results` (array) — one entry per numbered knowledge unit, each with
|
|
147
|
-
`number` (1-based integer), `title` (string), `summary` (string),
|
|
148
|
-
`evidence` (array of `{"excerpt": "..."}` objects, each with an optional
|
|
149
|
-
`lineNumber`), and `confidence` (number in `[0, 1]`). A result carries no
|
|
150
|
-
`source`; source identity lives in `mapping`.
|
|
151
|
-
- `mapping` (array) — exactly one entry per result `number`, each with
|
|
152
|
-
`number`, `source` (the opaque identity carried from retrieve), `method`,
|
|
153
|
-
and `content` (the raw snippet kept for feedback tracking). `evidenceRefs`
|
|
154
|
-
is optional; each ref needs `method` and `source` and may add `excerpt`,
|
|
155
|
-
`content`, `chunkIndex`, `lineNumber`, `retrievalResultId`, and
|
|
156
|
-
`confidence` in `[0, 1]`.
|
|
157
|
-
- `warnings` (optional array of strings).
|
|
158
|
-
|
|
159
|
-
Result and mapping numbers must be one-to-one positive integers, and every
|
|
160
|
-
`confidence` must be in `[0, 1]`. A complete minimal input:
|
|
161
|
-
|
|
162
|
-
```json
|
|
163
|
-
{
|
|
164
|
-
"answer": "[1] Refund exceptions need director approval before payout.",
|
|
165
|
-
"results": [
|
|
166
|
-
{
|
|
167
|
-
"number": 1,
|
|
168
|
-
"title": "Refund exception approval",
|
|
169
|
-
"summary": "Refund exceptions require director approval before payout.",
|
|
170
|
-
"evidence": [
|
|
171
|
-
{
|
|
172
|
-
"excerpt": "Refund exceptions require director approval.",
|
|
173
|
-
"lineNumber": 12
|
|
174
|
-
}
|
|
175
|
-
],
|
|
176
|
-
"confidence": 0.9
|
|
177
|
-
}
|
|
178
|
-
],
|
|
179
|
-
"mapping": [
|
|
180
|
-
{
|
|
181
|
-
"number": 1,
|
|
182
|
-
"source": "/Users/me/corpus/refund-policy.txt",
|
|
183
|
-
"method": "minsync",
|
|
184
|
-
"content": "Refund exceptions require director approval before payout."
|
|
185
|
-
}
|
|
186
|
-
],
|
|
187
|
-
"warnings": []
|
|
188
|
-
}
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
Invalid input exits with code 2 and `{"ok": false, "error": "..."}`. The
|
|
192
|
-
rejection names every field that failed, by JSON path, so fix exactly what it
|
|
193
|
-
points at instead of guessing:
|
|
194
|
-
|
|
195
|
-
```text
|
|
196
|
-
{"ok": false, "error": "Invalid report: expected the emit_autorag_results JSON schema (/results/0: must have required properties evidence; /mapping/0: must have required properties content)"}
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
`source` values in a report are opaque identifiers carried from retrieval
|
|
200
|
-
output. Report persistence performs no filesystem reads against them; it
|
|
201
|
-
stores the identifiers as given. Preserve the exact source-native identities
|
|
202
|
-
from the retrieve envelope.
|
|
203
|
-
|
|
204
|
-
On success the JSON envelope is:
|
|
205
|
-
|
|
206
|
-
```json
|
|
207
|
-
{
|
|
208
|
-
"ok": true,
|
|
209
|
-
"sessionId": "<uuid>",
|
|
210
|
-
"query": "key findings in the Q3 report",
|
|
211
|
-
"answer": "...",
|
|
212
|
-
"resultCount": 3
|
|
213
|
-
}
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
Use the returned `sessionId` for evidence inspection and feedback.
|
|
217
|
-
|
|
218
|
-
## Evidence and feedback
|
|
219
|
-
|
|
220
|
-
```bash
|
|
221
|
-
autorag evidence <sessionId> --result 1 --json
|
|
222
|
-
autorag feedback <sessionId> --useful 1,3 --not-useful 2 --json
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
- `evidence` shows the persisted source, retrieval method, stable evidence ID,
|
|
226
|
-
excerpt or content, and any `chunkIndex`, `lineNumber`, and
|
|
227
|
-
`retrievalResultId` behind a numbered result. Omit `--result` to inspect the
|
|
228
|
-
whole session.
|
|
229
|
-
- `feedback` records numbered usefulness so retrieval memory can learn.
|
|
230
|
-
Numbers refer to the report's result numbers. Supply at least one feedback
|
|
231
|
-
list.
|
|
232
|
-
- Preserve real source mapping and numbered identifiers end to end: retrieve
|
|
233
|
-
output feeds the report, the report's session feeds evidence and feedback.
|
|
234
|
-
|
|
235
|
-
## Rules
|
|
236
|
-
|
|
237
|
-
- Refresh before retrieval; refresh again when roots change.
|
|
238
|
-
- Use only configured and approved search paths and datasources.
|
|
239
|
-
- Never move, rename, edit, or delete source documents.
|
|
240
|
-
- Never expose provider credentials or authentication payloads.
|
|
241
|
-
- Treat report `source` values as opaque: persist them verbatim, never read
|
|
242
|
-
the filesystem through them.
|
|
243
|
-
- Surface diagnostics and `unsearched` reasons to the user as written; they
|
|
244
|
-
carry the real error text needed to fix the failure.
|
|
245
|
-
- Prefer `--json` whenever another agent consumes the output.
|