@autorag/librarian 2.6.3 → 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.
Files changed (54) hide show
  1. package/NOTICE +6 -0
  2. package/README.md +76 -25
  3. package/dist/agent/agent.d.ts +135 -27
  4. package/dist/agent/answer-guidelines.d.ts +19 -0
  5. package/dist/agent/citations.d.ts +20 -0
  6. package/dist/agent/index.d.ts +1 -0
  7. package/dist/agent/jev-extension.d.ts +68 -0
  8. package/dist/agent/pi-session.d.ts +55 -0
  9. package/dist/agent/query-decomposition.d.ts +25 -0
  10. package/dist/agent/query-routing.d.ts +54 -0
  11. package/dist/agent/search-documents.d.ts +2 -2
  12. package/dist/agent/system-prompt.d.ts +1 -0
  13. package/dist/cli/commands/evidence.d.ts +22 -0
  14. package/dist/cli/commands/health.d.ts +2 -3
  15. package/dist/cli/commands/init.d.ts +2 -1
  16. package/dist/cli/commands/models.d.ts +20 -0
  17. package/dist/cli/commands/search.d.ts +2 -2
  18. package/dist/cli/commands/serve.d.ts +2 -2
  19. package/dist/cli/commands/tui.d.ts +12 -35
  20. package/dist/cli/commands/update-check.d.ts +8 -0
  21. package/dist/cli/config.d.ts +82 -5
  22. package/dist/cli/index.d.ts +1 -1
  23. package/dist/cli/index.js +9802 -9324
  24. package/dist/cli/update-check.d.ts +34 -0
  25. package/dist/cli/version.d.ts +5 -0
  26. package/dist/core.d.ts +34 -2
  27. package/dist/core.js +9848 -8977
  28. package/dist/everything/bundle.d.ts +15 -3
  29. package/dist/everything/client.d.ts +22 -5
  30. package/dist/everything/index.d.ts +1 -1
  31. package/dist/filesystem/name-search.d.ts +57 -0
  32. package/dist/fsearch/client.d.ts +7 -1
  33. package/dist/index.d.ts +1 -0
  34. package/dist/index.js +11181 -9015
  35. package/dist/jikji/client.d.ts +6 -1
  36. package/dist/mcp/index.d.ts +2 -0
  37. package/dist/mcp/index.js +29949 -0
  38. package/dist/mcp/server.d.ts +9 -0
  39. package/dist/minsync/method.d.ts +6 -3
  40. package/dist/mirror/index.d.ts +1 -1
  41. package/dist/mirror/paths.d.ts +6 -0
  42. package/dist/retrieval/engine.d.ts +32 -1
  43. package/dist/retrieval/index.d.ts +2 -1
  44. package/dist/retrieval/rerank.d.ts +8 -3
  45. package/dist/retrieval/selection.d.ts +97 -0
  46. package/package.json +10 -3
  47. package/skills/autorag/SKILL.md +25 -4
  48. package/skills/autorag-doctor/SKILL.md +27 -18
  49. package/skills/autorag-lite-setup/SKILL.md +115 -59
  50. package/skills/autorag-setup/SKILL.md +99 -16
  51. package/dist/agent/bash-tool.d.ts +0 -32
  52. package/dist/cli/tui-commands.d.ts +0 -16
  53. package/dist/cli/tui-session-store.d.ts +0 -16
  54. package/skills/autorag-lite-search/SKILL.md +0 -245
@@ -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.