@autorag/librarian 2.2.0 → 2.4.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 (106) hide show
  1. package/README.md +194 -47
  2. package/dist/agent/agent.d.ts +34 -47
  3. package/dist/agent/bash-tool.d.ts +2 -11
  4. package/dist/agent/dupey-tool.d.ts +15 -0
  5. package/dist/agent/emit-results-tool.d.ts +14 -0
  6. package/dist/agent/index.d.ts +1 -0
  7. package/dist/agent/local-model.d.ts +12 -0
  8. package/dist/agent/search-bm25-tool.d.ts +11 -3
  9. package/dist/agent/search-documents.d.ts +2 -2
  10. package/dist/agent/search-minsync-tool.d.ts +2 -2
  11. package/dist/agent/system-prompt.d.ts +1 -2
  12. package/dist/cli/commands/duplicates.d.ts +4 -0
  13. package/dist/cli/commands/health.d.ts +9 -65
  14. package/dist/cli/commands/index.d.ts +3 -3
  15. package/dist/cli/commands/init.d.ts +1 -1
  16. package/dist/cli/commands/search.d.ts +2 -2
  17. package/dist/cli/commands/tui.d.ts +36 -0
  18. package/dist/cli/commands/ui.d.ts +13 -0
  19. package/dist/cli/config.d.ts +27 -22
  20. package/dist/cli/index.js +14965 -12563
  21. package/dist/cli/tui-commands.d.ts +16 -0
  22. package/dist/cli/tui-session-store.d.ts +16 -0
  23. package/dist/datasource/access-context.d.ts +6 -12
  24. package/dist/datasource/aliased-skill.d.ts +28 -0
  25. package/dist/datasource/chunk-store.d.ts +2 -0
  26. package/dist/datasource/connector-skill.d.ts +3 -0
  27. package/dist/datasource/connector.d.ts +4 -0
  28. package/dist/datasource/crawler-skill.d.ts +6 -0
  29. package/dist/datasource/crawler-types.d.ts +2 -0
  30. package/dist/datasource/described-skill.d.ts +17 -0
  31. package/dist/datasource/index.d.ts +4 -2
  32. package/dist/datasource/result-filter.d.ts +2 -1
  33. package/dist/datasource/skills/clawgallery/client.d.ts +9 -0
  34. package/dist/datasource/skills/clawgallery/index.d.ts +5 -0
  35. package/dist/datasource/skills/clawgallery/methods.d.ts +19 -0
  36. package/dist/datasource/skills/clawgallery/paths.d.ts +7 -0
  37. package/dist/datasource/skills/clawgallery/skill.d.ts +35 -0
  38. package/dist/datasource/skills/clawgallery/types.d.ts +58 -0
  39. package/dist/datasource/skills/cloud-drive/index.d.ts +2 -0
  40. package/dist/datasource/skills/cloud-drive/rclone-connector.d.ts +47 -0
  41. package/dist/datasource/skills/cloud-drive/skill.d.ts +14 -0
  42. package/dist/datasource/skills/discrawl/skill.d.ts +3 -0
  43. package/dist/datasource/skills/discrawl/types.d.ts +4 -8
  44. package/dist/datasource/skills/factory.d.ts +9 -0
  45. package/dist/datasource/skills/gmail/himalaya-connector.d.ts +12 -1
  46. package/dist/datasource/skills/katok/methods.d.ts +6 -4
  47. package/dist/datasource/skills/katok/types.d.ts +8 -26
  48. package/dist/datasource/skills/mailcrawl/client.d.ts +15 -0
  49. package/dist/datasource/skills/mailcrawl/config.d.ts +2 -0
  50. package/dist/datasource/skills/mailcrawl/index.d.ts +4 -0
  51. package/dist/datasource/skills/mailcrawl/methods.d.ts +15 -0
  52. package/dist/datasource/skills/mailcrawl/skill.d.ts +34 -0
  53. package/dist/datasource/skills/mailcrawl/types.d.ts +71 -0
  54. package/dist/datasource/skills/obsidian/skill.d.ts +2 -0
  55. package/dist/datasource/skills/obsidian/types.d.ts +2 -0
  56. package/dist/datasource/types.d.ts +5 -2
  57. package/dist/dupey/cli.d.ts +40 -0
  58. package/dist/dupey/filter.d.ts +8 -0
  59. package/dist/dupey/index.d.ts +2 -0
  60. package/dist/filesystem/cloud-placeholder.d.ts +26 -0
  61. package/dist/index.d.ts +1 -0
  62. package/dist/index.js +8889 -9292
  63. package/dist/jikji/client.d.ts +1 -0
  64. package/dist/memory/check-memory-tool.d.ts +1 -0
  65. package/dist/memory/index.d.ts +2 -2
  66. package/dist/memory/memory.d.ts +33 -3
  67. package/dist/memory/renderer.d.ts +2 -1
  68. package/dist/minsync/client.d.ts +5 -1
  69. package/dist/minsync/embedder-config.d.ts +4 -1
  70. package/dist/minsync/index.d.ts +4 -4
  71. package/dist/minsync/installer.d.ts +1 -0
  72. package/dist/minsync/method.d.ts +22 -1
  73. package/dist/minsync/types.d.ts +5 -0
  74. package/dist/mirror/sync.d.ts +3 -1
  75. package/dist/observability/run-log.d.ts +1 -26
  76. package/dist/parser/defaults.d.ts +2 -0
  77. package/dist/parser/index.d.ts +2 -2
  78. package/dist/parser/opendataloader-pdf.d.ts +10 -0
  79. package/dist/parser/types.d.ts +7 -0
  80. package/dist/process/portable-spawn.d.ts +10 -0
  81. package/dist/retrieval/index.d.ts +2 -2
  82. package/dist/retrieval/methods/bm25.d.ts +7 -36
  83. package/dist/ui/browse.d.ts +11 -0
  84. package/dist/ui/catalog.d.ts +59 -0
  85. package/dist/ui/config-store.d.ts +43 -0
  86. package/dist/ui/discover.d.ts +19 -0
  87. package/dist/ui/html.d.ts +2 -0
  88. package/dist/ui/probe.d.ts +24 -0
  89. package/dist/ui/prompt.d.ts +21 -0
  90. package/dist/ui/server.d.ts +28 -0
  91. package/package.json +17 -15
  92. package/skills/autorag/SKILL.md +79 -108
  93. package/skills/autorag-setup/SKILL.md +170 -395
  94. package/dist/datasource/skills/discrawl/config.d.ts +0 -9
  95. package/dist/datasource/skills/gdrive/connector.d.ts +0 -30
  96. package/dist/datasource/skills/gdrive/index.d.ts +0 -3
  97. package/dist/datasource/skills/gdrive/rclone-connector.d.ts +0 -51
  98. package/dist/datasource/skills/gdrive/skill.d.ts +0 -24
  99. package/dist/subagents/contracts.d.ts +0 -90
  100. package/dist/subagents/dispatch-templates.d.ts +0 -104
  101. package/dist/subagents/dispatch-validation.d.ts +0 -169
  102. package/dist/subagents/explorer-tools-extension.d.ts +0 -4
  103. package/dist/subagents/explorer-tools-extension.js +0 -130
  104. package/dist/subagents/local-models.d.ts +0 -14
  105. package/dist/subagents/model-policy.d.ts +0 -31
  106. package/dist/subagents/runtime.d.ts +0 -52
@@ -1,213 +1,149 @@
1
1
  ---
2
2
  name: autorag-setup
3
- description: Configure AutoRAG for first use or repair its setup. Detect the current agent's usable subscription-backed runtime or API provider without exposing private provider identities, select orchestrator and explorer models, propose OS-aware document folders for approval, initialize configuration, and build indexes (parsed mirrors, BM25, MinSync vectors, optional Jikji maps).
3
+ description: Install and configure AutoRAG, or repair its single search model, approved document roots, retrieval indexes, datasource skills, and health checks without exposing credentials. Use when autorag is missing, init/refresh/health fails, indexes are stale, or the user wants to add folders or datasources.
4
+ license: MIT
4
5
  ---
5
6
 
6
- # AutoRAG Setup Skill
7
+ # AutoRAG setup
7
8
 
8
- Use this skill for first-time setup, missing or broken model configuration,
9
- provider/authentication discovery, changing indexed folders, or rebuilding the
10
- initial indexes. After setup succeeds, use the separate `autorag` skill for
11
- normal searches and feedback.
9
+ Use this skill when AutoRAG is unconfigured, the `autorag` CLI is missing, model
10
+ resolution fails, indexes are missing or stale, or the user wants to change the
11
+ document collection or datasources.
12
12
 
13
- ## Safety boundaries
13
+ ## Safety
14
14
 
15
15
  - Inspect only non-secret provider/model metadata and credential availability.
16
- - Never print, copy, migrate, compare, or persist credential values.
17
- - Never expose private provider aliases or internal model catalogs in generated
18
- configuration, logs, or user-facing explanations.
16
+ - Never print, copy, migrate, compare, or persist credential values. Store only
17
+ environment-variable names such as `apiKeyEnv`.
19
18
  - Do not scan the whole filesystem or home directory without explicit approval.
20
19
  - Never move, rename, edit, or delete source documents.
21
- - Recommend document-dense folders only. Do not index system trees, app bundles,
22
- caches, or credential stores.
20
+ - Do not index system trees, app bundles, caches, credential stores,
21
+ `node_modules`, `.git`, `dist`, `build`, `target`, `.cache`, `.autorag`, or
22
+ `.jikji`.
23
23
 
24
- ## Detect an authenticated model runtime
24
+ ## Install the CLI if needed
25
25
 
26
- Do not begin by asking the user to manually name a provider. Determine the best
27
- usable configuration from available evidence.
26
+ The CLI is `@autorag/librarian` (`autorag`). Runtime is Node.js ≥ 24 or Bun.
28
27
 
29
- 1. Preserve explicit user choices and a working `~/.autorag/config.json`.
30
- 2. Inspect the current agent's exposed provider/model capabilities.
31
- 3. Inspect compatible non-secret local metadata, including configured model
32
- registries and `~/.autorag/pi-agent/models.json`. Provider-specific local
33
- configuration may be used only to determine endpoint compatibility, model
34
- IDs, credential environment-variable names, and whether credentials exist.
35
- 4. Check Pi authentication entries by provider identity without reading or
36
- showing their secret payloads.
37
- 5. Treat ChatGPT, Claude, Gemini, and other consumer subscriptions as usable
38
- only when the active runtime can demonstrably delegate that authenticated
39
- session to AutoRAG or compatible authentication already exists in AutoRAG's
40
- Pi state. A subscription is not automatically an API entitlement.
41
- 6. Do not infer usability from an installed CLI, a config filename, or an
42
- environment-variable name alone. Authentication and protocol compatibility
43
- must both be established.
44
-
45
- If no compatible authenticated runtime exists, report the exact missing public
46
- provider/authentication requirement. Do not write a configuration that cannot
47
- run. Ask one concise question only when multiple equally suitable public
48
- providers remain and runtime evidence cannot choose between them.
49
-
50
- ## Select role models
51
-
52
- Select only models actually advertised by the authenticated runtime:
28
+ ```bash
29
+ command -v autorag >/dev/null || bun install -g @autorag/librarian
30
+ autorag --help
31
+ ```
53
32
 
54
- - `agents.orchestrator`: strongest reliable reasoning and high-context model.
55
- - `agents.explorer`: faster, cheaper high-recall model with sufficient context.
56
- - If only one usable model exists, configure it for both roles.
57
- - Preserve an existing working explicit pair.
58
- - Never invent model IDs or write a private provider alias into distributed or
59
- user-facing configuration.
33
+ If Bun is unavailable, `npm install -g @autorag/librarian` is acceptable.
60
34
 
61
- Provider and model ID must always be supplied together for each configured role.
62
- If role models are intentionally omitted, leave them unset so search-time
63
- resolution can still pick up an authenticated local runtime when available.
35
+ ## Inspect existing configuration
64
36
 
65
- ## Discover and approve document folders
37
+ Check `--config`, `AUTORAG_CONFIG`, `$AUTORAG_HOME/config.json`, or
38
+ `~/.autorag/config.json`. Relevant fields are:
66
39
 
67
- Propose a **short list of recommended folders** tailored to the user's OS, then
68
- let the user accept, drop, or replace entries before any indexing. Explicit user
69
- paths always win. Reuse previously approved folders without re-asking.
40
+ - `searchPaths`, `workspacePath`, and `memoryPath`
41
+ - `model.provider`, `model.id`, `model.api`, `model.baseUrl`, `model.apiKeyEnv`
42
+ - `bm25`, `minSync`, and `jikji`
43
+ - `datasources`, `datasourceAccess`, and `ui`
70
44
 
71
- ### 1. Detect OS and home roots
45
+ Preserve explicit user choices and a working config unless the user asks to
46
+ replace them or health checks fail.
72
47
 
73
- Resolve the user home once:
48
+ ## Configure one search model
74
49
 
75
- | OS | User home |
76
- |---|---|
77
- | macOS | `$HOME` (e.g. `/Users/<name>`) |
78
- | Linux | `$HOME` (e.g. `/home/<name>`; honor `XDG_*` when set) |
79
- | Windows | `%USERPROFILE%` / `$HOME` under Git Bash (e.g. `C:\Users\<name>`) |
50
+ AutoRAG is the specialized librarian agent. One configured model plans the
51
+ search, calls retrieval and filesystem tools, reads sources, judges evidence,
52
+ and curates the answer in one loop. There are no orchestrator/explorer roles.
80
53
 
81
- Do not walk the entire home tree. Check only the recommended candidates below
82
- for existence and approximate document density (counts of supported extensions),
83
- then present the findings.
54
+ Prefer a model with reliable tool calling and structured output, enough context
55
+ for source excerpts, high output TPS, and low first-token latency. Use a larger
56
+ reasoning model only when difficult synthesis or domain judgment matters more
57
+ than latency.
84
58
 
85
- ### 2. Recommend document-dense anchors per OS
59
+ Start from a provider/model the current runtime can actually call. A Pi-usable
60
+ ChatGPT, Claude, Gemini, or other authenticated subscription is valid; an
61
+ installed CLI or subscription that Pi cannot invoke is not. For custom
62
+ OpenAI-compatible endpoints, record the real wire API, base URL, and credential
63
+ environment-variable name.
86
64
 
87
- Offer candidates that commonly hold PDFs, Office docs, notes, and downloads.
88
- Mark each as **recommended** or **optional**, and never enable a path that does
89
- not exist.
65
+ Allowed `api` values:
90
66
 
91
- **macOS**
67
+ - `openai-completions`
68
+ - `openai-responses`
69
+ - `anthropic-messages`
70
+ - `openai-codex-responses`
71
+ - `azure-openai-responses`
92
72
 
93
- | Priority | Path | Why |
94
- |---|---|---|
95
- | Recommended | `~/Documents` | Default document library |
96
- | Recommended | `~/Downloads` | Fresh PDFs, reports, attachments |
97
- | Recommended | `~/Desktop` | Dropped working files |
98
- | Optional | `~/Notes`, `~/Obsidian`, `~/iCloud Drive/Documents` when present | Personal knowledge bases |
99
- | Optional | Current project docs roots the user already named | Repo/wiki collections |
73
+ If no callable setup can be established, ask the user for the provider, model
74
+ id, API protocol, base URL when custom, and credential environment-variable
75
+ name. Do not invent provider identities or model ids.
100
76
 
101
- Prefer user-visible folders over iCloud container UUIDs or Library internals.
102
- Skip `~/Library`, `~/Applications`, and Time Machine volumes unless the user
103
- explicitly points there.
77
+ ## Propose and approve document roots
104
78
 
105
- **Linux**
79
+ Explicit user paths win. Otherwise inspect only these likely document-dense
80
+ candidates for existence and approximate supported-file counts, then ask for
81
+ approval before indexing:
106
82
 
107
- | Priority | Path | Why |
83
+ | OS | Recommended | Optional |
108
84
  |---|---|---|
109
- | Recommended | `~/Documents` or `$XDG_DOCUMENTS_DIR` | Document library |
110
- | Recommended | `~/Downloads` or `$XDG_DOWNLOAD_DIR` | Incoming files |
111
- | Recommended | `~/Desktop` or `$XDG_DESKTOP_DIR` | Working files |
112
- | Optional | `~/Notes`, `~/Sync`, Nextcloud/Syncthing folders when present | Synced knowledge |
113
- | Optional | Current project docs roots the user already named | Repo/wiki collections |
114
-
115
- When XDG user-dirs are configured, prefer those resolved paths over bare
116
- `~/Documents`-style guesses.
117
-
118
- **Windows**
119
-
120
- | Priority | Path | Why |
121
- |---|---|---|
122
- | Recommended | `%USERPROFILE%\Documents` | Document library (also OneDrive Documents if that is the real shell folder) |
123
- | Recommended | `%USERPROFILE%\Downloads` | Incoming PDFs and exports |
124
- | Recommended | `%USERPROFILE%\Desktop` | Working files |
125
- | Optional | OneDrive `Documents` / `Desktop` when they differ from the local shell folders | Cloud-backed corp libraries |
126
- | Optional | Current project docs roots the user already named | Repo/wiki collections |
127
-
128
- Prefer the shell-known special folders. Do not crawl `AppData`, `Program Files`,
129
- or system roots.
130
-
131
- ### 3. Density and format filter
132
-
133
- Prefer folders dense with formats AutoRAG parses into `.autorag/parsed` for
134
- BM25/MinSync:
135
-
136
- - text notes: `md`, `markdown`, `txt`, `text`
137
- - documents: `pdf`, `docx`, `pptx`, `xlsx`, `hwpx`, `eml`
138
- - optional OCR images only when enabled: `jpg`, `jpeg`, `png`, `bmp`, `tiff`
139
-
140
- Do not present legacy binary shells that currently fail pure-JS parsing as fully
141
- supported: bare `doc`, `xls`, and legacy `hwp` (use `docx` / `xlsx` / `hwpx`
142
- instead). Explorers can still open any readable text under approved paths with
143
- `read`/`grep`/`find`/`ls`, but those files will not contribute to BM25/MinSync
144
- indexes.
85
+ | macOS | `~/Documents`, `~/Downloads`, `~/Desktop` | `~/Notes`, `~/Obsidian`, user-named project docs |
86
+ | Linux | XDG Documents/Downloads/Desktop or their `~/` defaults | `~/Notes`, `~/Sync`, Nextcloud/Syncthing roots |
87
+ | Windows | Documents, Downloads, Desktop shell folders | OneDrive document roots, user-named project docs |
145
88
 
146
- Skip generated/vendor directories including `node_modules`, `.git`, `dist`,
147
- `build`, `target`, `.cache`, `.autorag`, and `.jikji`.
89
+ Supported parsed formats are `md`, `markdown`, `txt`, `text`, `pdf`, `docx`,
90
+ `pptx`, `xlsx`, `xls`, `hwp`, `hwpx`, and `eml`. OCR for `jpg`, `jpeg`, `png`, `bmp`,
91
+ and `tiff` is optional (`parserOptions.ocr.enabled`). Do not present legacy
92
+ `.doc` as a supported parsed format.
148
93
 
149
- ### 4. Present a proposal, then require approval
150
-
151
- Summarize a concrete proposal, for example:
152
-
153
- ```text
154
- Recommended index roots (macOS):
155
- [R] ~/Documents (~120 pdf/md/docx)
156
- [R] ~/Downloads (~45 pdf/pptx)
157
- [R] ~/Desktop (~12 md/pdf)
158
- [O] ~/Notes (~80 md) — optional personal vault
159
-
160
- Reply with: accept all / keep only Documents+Downloads / custom list
161
- ```
162
-
163
- Rules:
164
-
165
- 1. Prefer an explicit directory already named by the user over any suggestion.
166
- 2. Do not silently index large or sensitive trees.
167
- 3. Keep the first-run set small (typically 1–3 approved roots). Users can add
168
- more after the initial index build.
169
- 4. Wallpaper/background folders are rarely useful; only suggest Desktop itself
170
- (where people leave docs), not OS wallpaper asset caches.
94
+ Keep the first-run set small, usually one to three roots. Present a concrete
95
+ proposal and require `yes`, a narrowed keep-list, a custom list, or `skip`
96
+ before running `refresh`.
171
97
 
172
98
  ## Initialize
173
99
 
174
- Write the approved paths and selected role models:
175
-
176
100
  ```bash
177
101
  autorag init \
178
- --search-paths "/path/to/docs,/path/to/notes" \
179
- --orchestrator-model-provider PROVIDER \
180
- --orchestrator-model-id ORCHESTRATOR_MODEL \
181
- --explorer-model-provider PROVIDER \
182
- --explorer-model-id EXPLORER_MODEL
102
+ --search-paths "/path/to/documents,/path/to/notes" \
103
+ --workspace "/path/to/workspace" \
104
+ --model-provider PROVIDER \
105
+ --model-id MODEL
183
106
  ```
184
107
 
185
- This writes `~/.autorag/config.json` by default. Use `--config PATH` (or
186
- `AUTORAG_CONFIG`) for an explicit location. Optional:
108
+ If the authenticated local runtime already supplies the intended model, model
109
+ flags may be omitted. For a custom endpoint, add `api`, `baseUrl`, and
110
+ `apiKeyEnv` to the single `model` object in the trusted config:
187
111
 
188
- - `--workspace DIR` for the workspace that owns `.autorag` indexes
189
- - `--memory-path FILE` for retrieval-memory storage
190
- - `--force` only when intentionally replacing an existing config
112
+ ```json
113
+ {
114
+ "searchPaths": ["/path/to/documents"],
115
+ "model": {
116
+ "provider": "openrouter",
117
+ "id": "anthropic/claude-sonnet-4",
118
+ "api": "openai-completions",
119
+ "baseUrl": "https://openrouter.ai/api/v1",
120
+ "apiKeyEnv": "OPENROUTER_API_KEY"
121
+ }
122
+ }
123
+ ```
191
124
 
192
- ### Indexing method defaults
125
+ Use `--force` only when intentionally replacing an existing config. Legacy cwd
126
+ `autorag.config.json` is a migration source only and is never deleted by init.
193
127
 
194
- BM25 and MinSync are **enabled by default**. `autorag init` writes
195
- `bm25: { enabled: true }` and `minSync: { enabled: true, autoInstall: false }`
196
- into the config even when no method flags are supplied. To disable a method,
197
- set it to `false` in the config file (`"bm25": false` or `"minSync": false`).
128
+ ### Retrieval defaults
198
129
 
199
- MinSync auto-install is off by default (`autoInstall: false`); the binary must
200
- be pre-installed or available on `PATH`. AutoRAG never forces TEI or any
201
- external embedding service.
130
+ BM25, MinSync, and Jikji are enabled by default. Leave them enabled unless the
131
+ user explicitly asks otherwise. MinSync auto-installs a verified GitHub release
132
+ into `<workspace>/.autorag/bin` on first use (`minSync.autoInstall` defaults to
133
+ true). Set `"autoInstall": false` only when managing the binary yourself. Jikji
134
+ auto-installs `jikji-cli` through cargo when enabled (`jikji.autoInstall`
135
+ defaults to true; requires the Rust toolchain).
202
136
 
203
- ### MinSync embedder flags
137
+ Exact duplicate exclusion is enabled by default. AutoRAG invokes the external
138
+ `dupey` CLI before parsed-mirror indexing, keeps the newest filesystem copy for
139
+ each exact canonical-text hash, and excludes older copies from the mirror. Set
140
+ `"excludeExactDuplicates": false` to index every copy. Missing dupey is
141
+ non-fatal; refresh continues without this optimization.
204
142
 
205
- `autorag init` accepts non-secret embedder configuration flags that are written
206
- into `minSync.embedder` in the config:
143
+ Optional MinSync embedder settings:
207
144
 
208
145
  ```bash
209
146
  autorag init \
210
- --search-paths "/path/to/docs" \
211
147
  --embedder-id "text-embedding-3-small" \
212
148
  --embedder-base-url "https://api.openai.com/v1" \
213
149
  --embedder-api-key-env "OPENAI_API_KEY" \
@@ -215,256 +151,95 @@ autorag init \
215
151
  --embedder-batch-size 64
216
152
  ```
217
153
 
218
- All fields are optional; only provided fields are written. `--embedder-api-key-env`
219
- accepts the **environment variable name** (e.g. `OPENAI_API_KEY`), never the key
220
- value itself. `--embedder-dimension` and `--embedder-batch-size` must be positive
221
- integers.
222
-
223
- If role models are intentionally omitted, `autorag init` must leave `agents`
224
- unset; it must never inject a private provider default. Legacy cwd
225
- `autorag.config.json` is a migration source only and is never deleted by init.
226
-
227
- Per-run overrides (flags and env take precedence over the file) are available
228
- via the role-specific flags or:
154
+ Only store the environment-variable name, never its value. Dimension and batch
155
+ size must be positive integers.
229
156
 
230
- - `AUTORAG_ORCHESTRATOR_MODEL_PROVIDER` / `AUTORAG_ORCHESTRATOR_MODEL_ID`
231
- - `AUTORAG_EXPLORER_MODEL_PROVIDER` / `AUTORAG_EXPLORER_MODEL_ID`
232
- - legacy single-model aliases: `AUTORAG_MODEL_PROVIDER` / `AUTORAG_MODEL_ID`
233
- - `AUTORAG_SEARCH_PATHS`, `AUTORAG_WORKSPACE`, `AUTORAG_MEMORY_PATH`
157
+ ## Configure datasource skills when requested
234
158
 
235
- ## Configure datasource skills (optional)
159
+ Prefer `autorag ui --no-open` to connect datasources. It writes the same trusted
160
+ `datasources` / `datasourceAccess` fields as a hand-edited config, stores
161
+ env-var names rather than secrets, and prints a loopback URL (`127.0.0.1`).
162
+ Do not bind non-loopback hosts unless the user explicitly set `ui.allowRemote`.
236
163
 
237
- External datasources (WhatsApp, Telegram, Slack, Discord, Notion, GitHub Issues/PRs, Google
238
- Drive, Gmail, local mail exports, Obsidian vaults, RSS/news) are configured
239
- as **datasource skills** in the trusted config file — never via model/tool
240
- arguments. Add a `datasources` section (skill name → config) plus a trusted
241
- `datasourceAccess` allow-list to `config.json`:
164
+ Datasource skills belong in trusted config and remain default-deny. Builtin
165
+ template names are `kakao`, `whatsapp`, `telegram`, `slack`, `discord`,
166
+ `clawgallery`, `notion`, `github`, `cloud-drive`, `gmail`, `mail-export`,
167
+ `mailcrawl`, `obsidian`, `rss`, and `spotlight`. Config keys may be connection
168
+ aliases with `"type": "<template>"`. Unknown names are skipped with an
169
+ `unknown-datasource-skill` warning; they do not fail config resolution.
170
+ `scope` and tags can narrow trusted access but cannot grant it.
242
171
 
243
172
  ```jsonc
244
173
  {
245
174
  "datasources": {
246
- "whatsapp": { "instanceId": "personal", "connector": { "binaryPath": "wacrawl" } },
247
- "telegram": { "instanceId": "personal", "connector": { "binaryPath": "telecrawl" } },
248
- "slack": { "connector": { "binaryPath": "slacrawl", "configPath": "/path/to/slacrawl.yaml", "syncSource": "primary" } },
249
- "discord": { "connector": { "tokenEnv": "DISCORD_BOT_TOKEN", "guildId": "..." } },
250
- "notion": { "connector": { "binaryPath": "notcrawl", "configPath": "/path/to/notcrawl.yaml" } },
251
- "github": { "connector": { "repos": ["owner/repo"], "tokenEnv": "GITHUB_TOKEN" } },
252
- "gdrive": { "connector": { "backend": "rclone", "remote": "gdrive:" } },
253
- "gmail": { "connector": { "backend": "himalaya", "account": "gmail", "folder": "INBOX" } },
254
- "mail-export": { "connector": { "paths": ["/path/to/exports"] } },
175
+ "github": { "connector": { "repos": ["owner/repo"], "tokenEnv": "GITHUB_TOKEN" } },
176
+ "google-drive": { "type": "cloud-drive", "connector": { "provider": "google-drive", "remote": "gdrive:" } },
177
+ "archive-drive": { "type": "cloud-drive", "connector": { "remote": "archive:" } },
178
+ "gmail": { "connector": { "backend": "himalaya", "account": "gmail", "folder": "INBOX" } },
179
+ "mailcrawl": { "instanceId": "personal", "connector": { "account": "personal", "mailbox": "INBOX", "binaryPath": "mailcrawl" } },
255
180
  "obsidian": { "connector": { "vaultPath": "/path/to/vault" } },
256
- "rss": { "connector": { "feeds": [{ "url": "https://example.com/feed.xml" }] } }
181
+ "rss": { "connector": { "feeds": [{ "url": "https://example.com/feed.xml" }] } }
257
182
  },
258
183
  "datasourceAccess": {
259
- "allowedTags": ["whatsapp", "telegram", "slack", "github", "rss"],
260
- "allowedScopes": ["/whatsapp/**", "/telegram/**", "/slack/**", "/github/**", "/rss/**"]
184
+ "allowedTags": ["github", "cloud-drive", "gmail", "mailcrawl", "obsidian", "rss"],
185
+ "allowedScopes": ["/github/**", "/google-drive/**", "/archive-drive/**", "/gmail/**", "/mailcrawl/**", "/obsidian/**", "/rss/**"]
261
186
  }
262
187
  }
263
188
  ```
264
189
 
265
- Rules:
266
-
267
- - REST connector tokens are configured as **environment variable names** (`tokenEnv`), never
268
- raw secrets in the file. Each skill has a default env var
269
- (`DISCORD_BOT_TOKEN`, `GITHUB_TOKEN`,
270
- `GDRIVE_ACCESS_TOKEN`, `GMAIL_ACCESS_TOKEN`).
271
- - **CLI-bridge backends** (recommended where available): `gmail` accepts
272
- `"backend": "himalaya"` to index any IMAP/Maildir account the external
273
- [himalaya](https://pimalaya.org) CLI has configured (no OAuth plumbing);
274
- `gdrive` accepts `"backend": "rclone"` to index a Google Drive remote (or
275
- any of rclone's 70+ backends) configured via `rclone config` — Docs/Sheets
276
- are exported as text through `--drive-export-formats`. Auth lives entirely
277
- in the external tool's own config, matching the katok pattern.
278
- - `whatsapp` requires the external
279
- [wacrawl](https://github.com/openclaw/wacrawl) binary
280
- (`brew install openclaw/tap/wacrawl`). Optional trusted connector fields are
281
- `binaryPath`, `databasePath`, and `sourcePath`. Live desktop ingestion is
282
- macOS-only; the crawler owns Full Disk Access and archive setup.
283
- - `telegram` requires the external
284
- [telecrawl](https://github.com/openclaw/telecrawl) binary
285
- (`brew install openclaw/tap/telecrawl`). Optional trusted connector fields
286
- are `binaryPath`, `databasePath`, and `sourcePath`. Live desktop ingestion
287
- is macOS-only; the crawler owns Full Disk Access and archive setup.
288
- - `slack` requires the external
289
- [slacrawl](https://github.com/openclaw/slacrawl) binary
290
- (`brew install openclaw/tap/slacrawl`). Optional trusted connector fields
291
- are `binaryPath`, `configPath`, and `syncSource`; Slack credentials and
292
- remote source definitions stay in slacrawl's own configuration.
293
- - `notion` requires the external
294
- [notcrawl](https://github.com/openclaw/notcrawl) binary
295
- (`brew install openclaw/tap/notcrawl`). Optional trusted connector fields
296
- are `binaryPath` and `configPath`; Notion credentials and workspace
297
- definitions stay in notcrawl's own configuration.
298
- - Access is **default-deny**: without `datasourceAccess.allowedTags`, no
299
- datasource skill is announced or searchable, even when configured.
300
- `allowedScopes` are opaque slash-hierarchical roots like `/slack/<instance>/**`.
301
- - Per-skill options: `instanceId`, `pollingIntervalMs`, `tags`, and the
302
- connector-specific `connector` object. `false` or `{ "enabled": false }`
303
- disables an entry. Unknown skill names fail config resolution.
304
- - `autorag refresh --method datasources` indexes them; chunks persist under
305
- `<workspace>/.autorag/datasources/<skill>/<instance>/`.
306
- - Verify with the manual QA harness: `bun scripts/manual-qa/run-qa.ts`
307
- (see `docs/manual-qa-datasources.md`).
308
-
309
- ## Build indexes after install
310
-
311
- Installation + `init` alone does **not** make search useful. Immediately after
312
- the approved config is written, build the local indexes before handing off to
313
- the `autorag` skill.
314
-
315
- ### What `autorag refresh` builds
316
-
317
- `autorag refresh` is the post-setup indexing step. It is model-free and:
318
-
319
- 1. **Parses** approved source files into workspace-local `.autorag/parsed`
320
- markdown mirrors.
321
- 2. **Prepares BM25** lexical indexes over those mirrors.
322
- 3. **Embeds into the MinSync vector DB** (semantic index) over the same mirrors
323
- when MinSync is configured/available.
324
- 4. **Prepares Jikji maps/caches** under each approved source's `.jikji/` when
325
- Jikji is configured (indexing only — find answers come later via
326
- `jikji_find` at search time).
327
- 5. **Indexes authorized datasources** when datasource skills are configured.
328
-
329
- Order of operations for first-time setup:
190
+ Tokens are environment-variable names, not raw secrets. CLI-backed connectors
191
+ keep authentication in their external tool configuration.
330
192
 
331
- ```bash
332
- # 1) write approved folders + role models
333
- autorag init \
334
- --search-paths "$HOME/Documents,$HOME/Downloads,$HOME/Desktop" \
335
- --orchestrator-model-provider PROVIDER \
336
- --orchestrator-model-id ORCHESTRATOR_MODEL \
337
- --explorer-model-provider PROVIDER \
338
- --explorer-model-id EXPLORER_MODEL
339
-
340
- # 2) verify model/provider auth and explorer subagent preflight
341
- autorag health
342
-
343
- # 3) parse sources, build BM25, embed MinSync, prepare Jikji maps
344
- autorag refresh
345
-
346
- # 4) verify corpus freshness / index health (path-opaque)
347
- autorag status
348
- ```
349
-
350
- Interpret results:
351
-
352
- - `refresh` prints parse counts and BM25 readiness (and datasource rows when
353
- present). Re-run with `autorag refresh --force` only when a dirty/partial
354
- index needs a full rebuild path and a lighter incremental refresh is not
355
- enough.
356
- - `--method <csv>` restricts which methods refresh runs:
357
- `bm25,minsync,parsed,datasources,jikji,all`. When omitted, all methods run.
358
- Parsed mirrors are always synced when BM25 or MinSync is selected (they index
359
- over the parsed mirrors). Example: `autorag refresh --method bm25,minsync`.
360
- - `status` is model-free and path-opaque: inspect freshness and component
361
- health only; do not expect absolute source paths in the output.
362
- - `health` checks model/provider auth and explorer subagent setup: it resolves
363
- both role models, verifies credential presence, and (unless `--skip-probes`)
364
- probes a completion call per role. Use it to confirm both role models resolve
365
- from the authenticated runtime or written config without displaying
366
- credentials or private provider details.
367
- - Do not claim setup succeeded when authentication, indexes, role-model
368
- resolution, or subagent dispatch remain unverified.
369
- - Prefer bounded `refresh` over destructive resets. Reserve
370
- `autorag index rebuild --yes` for a full wipe+reindex of workspace
371
- `.autorag` parsed/BM25/MinSync dirs only — never against source documents.
372
- `index reset` and `index rebuild` also accept `--method` to scope which
373
- indexes are removed/rebuilt (e.g. `autorag index reset --method bm25 --yes`
374
- removes only the BM25 index).
375
-
376
- Large first-time corpora can take several minutes for parse + embed. Stay on
377
- the approximate status of the running refresh rather than starting concurrent
378
- index jobs.
379
-
380
- ## Customize and extend indexed folders
381
-
382
- Users can change the indexed set after the initial install. Always get explicit
383
- approval before adding paths, then re-init (or rewrite config) and refresh.
384
-
385
- ### Add or replace folders
386
-
387
- 1. Collect the desired absolute paths (user paste, or another short recommended
388
- proposal using the OS tables above).
389
- 2. Prefer merging with the existing approved list rather than silently dropping
390
- working roots, unless the user asks to replace everything.
391
- 3. Write the new list:
392
-
393
- ```bash
394
- # Replace/extend the configured search roots, preserve role models already set
395
- autorag init \
396
- --force \
397
- --search-paths "/existing/docs,/new/research,/path/to/notes"
398
- ```
399
-
400
- If role models must be preserved and you are rewriting via `init --force`, pass
401
- the same orchestrator/explorer provider+id pair already in
402
- `~/.autorag/config.json`. Alternatively edit `searchPaths` in that config when
403
- the agent can safely update JSON without touching credentials/private fields.
404
-
405
- 4. Rebuild indexes for the new roots:
406
-
407
- ```bash
408
- autorag refresh
409
- autorag status
410
- ```
411
-
412
- ### Narrow temporarily without re-init
413
-
414
- For a one-off search scope, prefer `autorag search "…" --scope <virtual-subpath>`
415
- through the `autorag` skill after setup. Scope narrows retrieval; it does not
416
- add new roots to the permanent index set.
417
-
418
- ### Env/flag overrides for automation
419
-
420
- Machine-driven agents may point at a custom list without rewriting the default
421
- home config:
422
-
423
- ```bash
424
- AUTORAG_SEARCH_PATHS="/docs,/notes" autorag refresh
425
- # or
426
- autorag refresh --search-paths "/docs,/notes"
427
- ```
193
+ Mailcrawl must be installed separately (`@nomadamas/mailcrawl@0.1.4` or newer)
194
+ and configured through its own Himalaya account. AutoRAG runs its local `sync`
195
+ and `index` lifecycle, then uses the mailcrawl CLI for BM25, semantic, or
196
+ hybrid search. Do not use 0.1.3 or earlier: a no-op sync followed by `index`
197
+ fails with `text array must be non-empty`.
428
198
 
429
- Remember that CLI flags / env vars take precedence for that invocation only;
430
- persist planned long-term folders with `autorag init` so later searches and
431
- refreshes share the same set.
199
+ ## Verify and build indexes
432
200
 
433
- ### Ongoing maintenance
201
+ Configuration alone is not a successful setup:
434
202
 
435
203
  ```bash
436
- autorag status # corpus freshness / index health
437
- autorag refresh # resync after documents change
438
- autorag watch --once # preferred single tick for cron / Task Scheduler / systemd timer
439
- autorag watch # long-running fs watch for interactive sessions
440
- autorag refresh --force # force a full re-sync when needed
441
- autorag index rebuild --yes # wipe parsed/BM25/MinSync under .autorag, then forced refresh
442
- autorag memory inspect # read-only retrieval memory snapshot
204
+ autorag status --json
205
+ autorag health --json
206
+ autorag refresh --json
207
+ autorag search "summarize the collection" --top-k 3 --json --debug
443
208
  ```
444
209
 
445
- After setup, install an **OS-appropriate periodic job** so indexes stay fresh without a permanent daemon. Agents MUST create or verify this schedule before claiming continuous indexing works.
446
-
447
- | OS | Scheduler | Suggested tick (every 30 min) |
448
- |---|---|---|
449
- | macOS | `cron` or LaunchAgent in `~/Library/LaunchAgents` | `*/30 * * * * PATH=... NODE_OPTIONS=--max-old-space-size=16384 autorag watch --once` |
450
- | Linux | `cron` or `systemd --user` timer | same crontab pattern, or a oneshot unit + timer |
451
- | Windows | Task Scheduler | repeating task every 30 minutes running `autorag watch --once` |
452
-
453
- Prefer `watch --once`/`refresh` for scheduled ticks. Reserve long-running `watch` for interactive foreground use. Log under `~/.autorag/` (or user temp), never into source document trees. Avoid overlapping concurrent refreshes.
454
-
455
- Never run reset/rebuild against source document trees. Indexes live under the
456
- configured workspace's `.autorag/`; Jikji prepare caches live under
457
- per-source `.jikji/` when enabled.
458
-
459
- ## Hand off
460
-
461
- After models authenticate, `autorag health` confirms model/provider auth and
462
- explorer subagent dispatch, folders are approved, `init` has written the config,
463
- `refresh` has built parsed + BM25 + MinSync (+ optional Jikji/datasource)
464
- indexes, and `status` looks healthy:
465
-
466
- - stop the setup skill
467
- - use the `autorag` skill for normal queries (`autorag search`, then
468
- `autorag feedback` with the returned `sessionId`)
469
- - return to this skill when the user adds folders, fixes providers/models, or
470
- needs a deliberate reindex
210
+ - `status` is model-free and path-opaque.
211
+ - `health` resolves the single model, checks credential presence, and normally
212
+ performs one live completion probe.
213
+ - `health --skip-probes` is only for intentionally offline validation and does
214
+ not prove live provider access.
215
+ - `refresh` syncs parsed mirrors, BM25, MinSync, Jikji, and authorized
216
+ datasources. `--method <csv>` may deliberately narrow it
217
+ (`parsed,bm25,minsync,datasources,jikji,all`).
218
+ - Use `refresh --force` for a full resync only when incremental refresh is not
219
+ enough. Keep destructive reset/rebuild operations scoped to workspace
220
+ `.autorag` indexes, never source documents.
221
+
222
+ ## Keep indexes fresh
223
+
224
+ For continuous freshness, create or verify an OS-appropriate scheduled
225
+ `autorag watch --once` job, typically every 15–30 minutes. Prefer cron or
226
+ launchd on macOS, cron or a user systemd timer on Linux, and Task Scheduler on
227
+ Windows. Use the same config as search, avoid overlapping runs, and keep logs
228
+ outside source trees.
229
+
230
+ ## Environment overrides
231
+
232
+ - `AUTORAG_HOME`
233
+ - `AUTORAG_CONFIG`
234
+ - `AUTORAG_SEARCH_PATHS`
235
+ - `AUTORAG_WORKSPACE`
236
+ - `AUTORAG_MEMORY_PATH`
237
+ - `AUTORAG_MODEL_PROVIDER`
238
+ - `AUTORAG_MODEL_ID`
239
+
240
+ ## Completion condition
241
+
242
+ Setup is complete only when the CLI is installed, roots are approved, a
243
+ non-secret single-model config is written, `status` is acceptable, live `health`
244
+ passes, `refresh` builds the requested indexes, one real structured search
245
+ succeeds, and any requested ongoing schedule is installed or verified.