@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
package/README.md CHANGED
@@ -10,7 +10,11 @@
10
10
 
11
11
  AutoRAG searches your PDFs, wikis, notes, research papers, and knowledge bases — then curates the results into clean, numbered knowledge units. No raw grep dumps. Just answers.
12
12
 
13
- AutoRAG is a customized [Pi](https://github.com/earendil-works/pi-mono) agent — the Pi agent loop configured into a librarian. Searches use a two-tier workflow: a parent orchestrator delegates exploration to explorer agents. The roles and providers are independently configured from the models available in the user's authenticated runtime; AutoRAG does not ship a private provider default.
13
+ AutoRAG is a customized [Pi](https://github.com/earendil-works/pi-mono) agent — the Pi agent loop configured into a librarian. The AutoRAG librarian retrieves candidates, reads source files directly, judges the evidence, and curates the structured answer. Its model and provider come from the user's authenticated runtime; AutoRAG does not ship a private provider default.
14
+
15
+ AutoRAG itself is the specialized search agent, not a coordinator for other
16
+ model roles. You configure one model, and that model owns the complete
17
+ retrieval, reading, judgment, and curation loop.
14
18
 
15
19
  ## Why AutoRAG
16
20
 
@@ -61,43 +65,96 @@ Different documents need different search strategies:
61
65
  | Legal documents, specifications | BM25 (keyword ranking) | Handles domain terminology well |
62
66
  | Mixed collections | Hybrid (vector + BM25) | Combines precision and recall |
63
67
 
64
- AutoRAG supports **pluggable retrieval methods**. It ships with lexical **BM25** and semantic **MinSync** methods wired through the `RetrievalMethodRegistry`, and the architecture is ready for additional vector and hybrid backends. The parent orchestrator owns process-bound retrieval tools and gives bounded seed packs to explorers; explorers use read-only `read`/`grep`/`find`/`ls` tools to inspect the underlying documents. The `ResultMerger` handles cross-method score normalization and deduplication — you get one unified result set regardless of how many methods contributed.
68
+ AutoRAG supports **pluggable retrieval methods**. Local lexical BM25, semantic vector, and hybrid retrieval all go through **MinSync** over one shared CDC chunk lifecycle, wired through the `RetrievalMethodRegistry`. The librarian invokes retrieval tools, reads the underlying documents directly through `bash`, and curates one unified result set after `ResultMerger` score normalization and deduplication. External datasources keep their own archive/index lifecycle.
69
+
70
+ BM25, vector, and hybrid are **enabled by default** whenever MinSync is enabled. Disable local indexing with `"minSync": false`, or disable only lexical search with `"bm25": false`. MinSync auto-installs a verified release into `<workspace>/.autorag/bin` on first use (`autoInstall: true`); set `"autoInstall": false` only when managing the binary yourself. Configure `minSync.embedder` via `autorag init --embedder-*` flags for remote embedding endpoints, and set `minSync.maxChunkSize` (or `--minsync-max-chunk-size`) when a local embedder has a smaller context window. AutoRAG never forces TEI or any external embedding service.
65
71
 
66
- BM25 and MinSync are **enabled by default** — no explicit configuration is needed for standard lexical + semantic retrieval. Both can be disabled by setting `"bm25": false` or `"minSync": false` in the config file. MinSync uses a pre-installed binary (`autoInstall: false`); configure `minSync.embedder` via `autorag init --embedder-*` flags for remote embedding endpoints. AutoRAG never forces TEI or any external embedding service.
72
+ See [docs/minsync-setup.md](docs/minsync-setup.md) for automatic installation,
73
+ managed binary paths, and the local EmbeddingGemma QA flow.
67
74
 
68
75
  ### Real directory access
69
76
 
70
- AutoRAG reads configured source directories through delegated explorer tasks. Each explorer is assigned exactly one normalized configured search root as its `cwd`; the top-level `subagent` invocation sets `agentScope: "user"` and `artifacts: false` exactly once for single, `tasks`, `chain`, or `parallel` dispatch, and nested explorer task items omit both fields. Project-local `.pi-subagents` debug artifacts are disabled. Explorers use read-only `read`/`grep`/`find`/`ls`; the parent orchestrator owns retrieval seed tools and must delegate document reading before curating. Curated answers are returned as a structured `SearchDocumentsResponse`; results carry their real source (file path or datasource id) in the internal mapping for feedback and curation. BM25 and MinSync index parsed markdown mirrors under `.autorag`.
77
+ AutoRAG reads configured source directories directly through its built-in `bash` tool. Retrieval tools can supply candidate paths, but the same agent opens the source material before curating. Answers are returned as a structured `SearchDocumentsResponse`; results carry their real source (file path or datasource id) in the internal mapping for feedback and curation. MinSync indexes parsed markdown mirrors under `.autorag` for BM25, vector, and hybrid retrieval.
71
78
 
72
- Each explorer `task` contains an Assignment V1 block — a sentinel-wrapped JSON body with `originalQuery` (the caller query verbatim), `method` (the selected retrieval path), and `queryVariants` (a nonempty array), followed by canonical role lines requiring `retrievedAt` and temporal metadata:
79
+ ### Thin PDF extraction retry
73
80
 
74
- ```text
75
- <<<AUTORAG_ASSIGNMENT_V1>>>
76
- {"originalQuery":"<caller query verbatim>","method":"<selected retrieval method>","queryVariants":["<variant 1>","<variant 2>"]}
77
- <<<END_AUTORAG_ASSIGNMENT_V1>>>
78
- Required handoff: include retrievedAt.
79
- Required handoff: include temporal metadata.
81
+ The default PDF parser performs a cheap quality check for multi-page PDFs.
82
+ When local markdown is unusually sparse (fewer than 800 characters or fewer
83
+ than 40 characters per detected page, for at least three pages), it retries
84
+ through OpenDataLoader's `docling-fast` hybrid backend with `hybridMode:
85
+ "auto"` and a 30-second timeout. Dense PDFs are not retried, and hybrid is
86
+ never used for single-page PDFs or as the first path for images.
87
+
88
+ The gate is parser-owned and can be tuned through trusted programmatic
89
+ `parserOptions`:
90
+
91
+ ```typescript
92
+ new AutoRAGAgent({
93
+ searchPaths: ["/path/to/documents"],
94
+ parserOptions: {
95
+ thinExtract: {
96
+ minPages: 3,
97
+ minChars: 800,
98
+ minCharsPerPage: 40,
99
+ timeoutMs: 30_000,
100
+ hybrid: "docling-fast",
101
+ hybridMode: "auto",
102
+ },
103
+ },
104
+ });
80
105
  ```
81
106
 
82
- A legacy labeled format (`Original query:`, `Selected retrieval method:`, `Query variants:`) is accepted for compatibility. Missing or null top-level `artifacts`, `agentScope`, and leaf `model` fields are safely autofilled before validation; explicit wrong values (`artifacts: true`, `agentScope: "project"`, a non-configured model) remain rejected. There is no single-agent fallback. See [docs/subagent-orchestration.md](docs/subagent-orchestration.md) for the full dispatch contract, templates, anti-examples, and stable coded dispatch errors.
107
+ If the hybrid sidecar is missing, times out, or fails, AutoRAG keeps the local
108
+ markdown and emits `pdf-extract-thin` plus `pdf-hybrid-unavailable`
109
+ diagnostics; refresh remains successful.
110
+
111
+ ### Default Jikji discovery and indexing
83
112
 
84
- ### Optional Jikji discovery and indexing
113
+ AutoRAG uses [Jikji](https://github.com/NomaDamas/jikji) by default as a local CLI-backed **find-first discovery and indexing** layer. Jikji is not registered as a retrieval backend: it supplies bounded discovery answer packs while the librarian still reads original files directly.
85
114
 
86
- AutoRAG can opt into [Jikji](https://github.com/NomaDamas/jikji) as a local CLI-backed **find-first discovery and indexing** layer. Jikji is optional: AutoRAG does not vendor it, install it, or register it as a retrieval backend when enabled.
115
+ The default agent calls `jikji find ROOT "query" --json` via the `jikji_find` tool. The tool parses and validates the upstream answer pack and exposes its `handoff_action`, `tool_call_policy`, and `agent_should_not_rerank` to the librarian. Direct file reading remains available for source verification. `prepare`/`refresh` remain for indexing only and do not answer queries directly. If the binary or Rust toolchain is unavailable, Jikji reports a diagnostic and the normal filesystem/retrieval paths continue.
87
116
 
88
- When Jikji is configured, AutoRAG calls `jikji find ROOT "query" --json` via a policy-aware `jikji_find` tool as the first local-discovery action. The tool parses and validates the upstream answer-pack and honors its `handoff_action` (`direct_use` / `jikji_retry` / `raw_fallback_after_retry`), `tool_call_policy` (`stop_after_find`, `forbidden_tools`, `allowed_followups`), and `agent_should_not_rerank`. Explorer `read`/`grep`/`find`/`ls` discovery is the fallback only when the answer-pack permits raw fallback (`raw_fallback_after_retry`, after the required retry) or when Jikji is unavailable/unconfigured. `prepare`/`refresh` remain for indexing only and do not answer queries directly.
117
+ New `autorag init` configs include `"jikji": {}`. To opt out, set `"jikji": false` in `config.json`; programmatic callers can pass `jikji: false`.
89
118
 
90
119
  Programmatic use:
91
120
 
92
121
  ```typescript
93
122
  const agent = new AutoRAGAgent({
94
123
  searchPaths: ["/path/to/documents"],
95
- jikji: { binaryPath: "jikji" },
96
124
  });
97
125
  await agent.prepareJikji();
98
126
  ```
99
127
 
100
- The same `.autorag/jikji.json` shape configures Jikji when present:
128
+ ### Duplicate document management with dupey
129
+
130
+ AutoRAG can use the external [`dupey`](https://github.com/NomaDamas/dupey) CLI
131
+ to detect exact, near, and containment document families.
132
+
133
+ ```bash
134
+ autorag duplicates /path/to/documents
135
+ autorag duplicates --json
136
+ ```
137
+
138
+ The command is read-only: it reports exact duplicate groups and review
139
+ guidance, but never moves or deletes source files. The `scan_duplicate_documents`
140
+ Agent tool exposes the same read-only scan to the orchestrator.
141
+
142
+ Exact duplicate exclusion is enabled by default during parsed-mirror refresh.
143
+ For each exact canonical-text hash, the newest filesystem copy is indexed and
144
+ older copies are omitted. Disable it in `config.json` when both copies must be
145
+ searchable:
146
+
147
+ ```json
148
+ {
149
+ "dupey": { "enabled": true },
150
+ "excludeExactDuplicates": false
151
+ }
152
+ ```
153
+
154
+ If `dupey` is not installed or fails, refresh continues without exclusion and
155
+ reports no destructive action; install it with `cargo install dupey`.
156
+
157
+ The same configuration shape customizes Jikji when needed:
101
158
 
102
159
  ```json
103
160
  {
@@ -122,9 +179,17 @@ The upstream Rust `PrepareArgs` defines reference defaults that AutoRAG does not
122
179
 
123
180
  Datasource skills let AutoRAG search external, server-configured data sources through the same retrieval pipeline as local documents. A skill describes what it indexes, how it should be refreshed, what source instances exist, and which permission tags/scopes bound access. Retrieval still flows through `RetrievalMethodRegistry` → `ParallelRetriever` → datasource result filtering → `ResultMerger`; datasource skills do not create a parallel search path.
124
181
 
182
+ Every datasource can be registered multiple times through a connection alias:
183
+ use the config key as the unique name and set `type` to the reusable backend
184
+ (`gmail`, `github`, `slack`, `discord`, `kakao`, `cloud-drive`, and so on).
185
+ Each alias becomes an independently loadable agent skill with its own source
186
+ scope and workspace namespace. Chat aliases search all channels by default;
187
+ trusted `channels.ids` / `channels.names` allowlists can expose a particular
188
+ channel or group chat as its own datasource.
189
+
125
190
  Security defaults are intentionally strict:
126
191
 
127
- - datasource access is default-deny unless trusted server/API configuration supplies `datasourceAccess.allowedTags` and `datasourceAccess.allowedScopes`;
192
+ - datasource access is default-deny unless trusted server/API configuration supplies `datasourceAccess.allowedTags`; `allowedScopes` applies only to datasource methods that advertise the `scoped` capability;
128
193
  - model/tool arguments never grant datasource tags or scopes;
129
194
  - `search_datasource_documents` accepts only `{ query, topK?, scope? }`, and `scope` can only narrow trusted access.
130
195
 
@@ -139,9 +204,10 @@ Security defaults are intentionally strict:
139
204
  | Discord | `discord` | external [`discrawl`](https://github.com/openclaw/discrawl) CLI | guild/channel/thread/DM archive; FTS5 + semantic + hybrid retrieval, incremental sync |
140
205
  | Notion | `notion` | external [`notcrawl`](https://github.com/openclaw/notcrawl) CLI | local-first page/database/block archive + FTS5 search |
141
206
  | GitHub Issues/PRs | `github` | GitHub REST (token optional) | issues + PR bodies per `owner/repo`; public repos work unauthenticated |
142
- | Google Drive | `gdrive` | Drive REST v3, or **[`rclone`](https://rclone.org) CLI** (`backend: "rclone"`) | Docs/Sheets exported as text; the rclone backend also opens any of rclone's 70+ remotes |
207
+ | Cloud drives | `cloud-drive` | **[`rclone`](https://rclone.org) CLI** | Incremental Google Drive Tier-1; OneDrive/network remotes; iCloud experimental |
143
208
  | Gmail / IMAP | `gmail` | Gmail REST v1, or **[`himalaya`](https://pimalaya.org) CLI** (`backend: "himalaya"`) | the himalaya backend indexes any IMAP/Maildir account it has configured — no OAuth plumbing |
144
209
  | Local mail exports | `mail-export` | filesystem (`.mbox` / `.eml`) | classic `From_` splitting, mailparser-based; count-only warnings |
210
+ | Mail archives | `mailcrawl` | external [`mailcrawl`](https://github.com/NomaDamas/mailcrawl) CLI | local email sync plus BM25, semantic, and hybrid retrieval |
145
211
  | Obsidian vault | `obsidian` | external [`qmd`](https://github.com/tobi/qmd) CLI | incremental `qmd update`, BM25 `qmd search`, semantic `qmd vsearch`; vault path via `connector.vaultPath` |
146
212
  | RSS / news | `rss` | HTTP feed polling | RSS 2.0 + Atom, feed/category hierarchy, 24h dedupe window |
147
213
 
@@ -158,13 +224,15 @@ Configure them in `config.json` (CLI) or pass `datasourceSkills` programmaticall
158
224
  "notion": { "connector": { "binaryPath": "notcrawl", "configPath": "/path/to/notcrawl.yaml" } },
159
225
  "github": { "connector": { "repos": ["owner/repo"] } },
160
226
  "gmail": { "connector": { "backend": "himalaya", "account": "gmail", "folder": "INBOX" } },
161
- "gdrive": { "connector": { "backend": "rclone", "remote": "gdrive:" } },
227
+ "mailcrawl": { "instanceId": "personal", "connector": { "account": "personal", "mailbox": "INBOX", "binaryPath": "mailcrawl" } },
228
+ "personal-google-drive": { "type": "cloud-drive", "instanceId": "personal", "connector": { "provider": "google-drive", "remote": "personal-gdrive:", "include": ["**/*.md"] } },
229
+ "company-onedrive": { "type": "cloud-drive", "instanceId": "work", "connector": { "provider": "onedrive", "remote": "company-onedrive:Documents" } },
162
230
  "obsidian": { "connector": { "vaultPath": "/path/to/vault" } },
163
231
  "rss": { "connector": { "feeds": [{ "url": "https://example.com/feed.xml" }] } }
164
232
  },
165
233
  "datasourceAccess": {
166
- "allowedTags": ["whatsapp", "telegram", "slack", "notion", "github", "gmail", "gdrive", "obsidian", "rss"],
167
- "allowedScopes": ["/whatsapp/**", "/telegram/**", "/slack/**", "/notion/**", "/github/**", "/gmail/**", "/gdrive/**", "/obsidian/**", "/rss/**"]
234
+ "allowedTags": ["whatsapp", "telegram", "slack", "notion", "github", "gmail", "mailcrawl", "cloud-drive", "obsidian", "rss"],
235
+ "allowedScopes": ["/whatsapp/**", "/telegram/**", "/slack/**", "/notion/**", "/github/**", "/gmail/**", "/mailcrawl/**", "/personal-google-drive/**", "/company-onedrive/**", "/obsidian/**", "/rss/**"]
168
236
  }
169
237
  }
170
238
  ```
@@ -177,6 +245,30 @@ Install slacrawl with `brew install openclaw/tap/slacrawl`. AutoRAG invokes `sla
177
245
 
178
246
  Install notcrawl with `brew install openclaw/tap/notcrawl`. AutoRAG invokes `notcrawl sync` during datasource refresh and `notcrawl search --json` during retrieval. Optional trusted connector fields are `binaryPath` and `configPath`. Notion credentials and workspace definitions remain in notcrawl's own configuration rather than AutoRAG.
179
247
 
248
+ Install and configure [`mailcrawl`](https://github.com/NomaDamas/mailcrawl)
249
+ `@nomadamas/mailcrawl@0.1.4` or newer separately. AutoRAG invokes
250
+ `mailcrawl sync` followed by `mailcrawl index` during datasource refresh, then
251
+ calls `mailcrawl search` in BM25, semantic, or hybrid mode. The archive remains
252
+ in mailcrawl's native store unless the operator explicitly sets
253
+ `connector.dataDir`; Himalaya credentials and provider configuration remain
254
+ owned by mailcrawl. 0.1.3 and earlier fail a repeated
255
+ `index` after a no-op sync.
256
+
257
+ Install and authenticate rclone separately (`brew install rclone && rclone
258
+ config` on macOS), then configure the provider-neutral `cloud-drive` skill.
259
+ `cloud-drive` is a reusable `type`: each datasource config key is a connection
260
+ alias and becomes a separate agent skill and scope. Multiple Google accounts,
261
+ or Google Drive plus OneDrive/iCloud, can therefore be loaded and searched
262
+ independently.
263
+ AutoRAG inventories with `rclone lsjson`, keeps a workspace-local manifest and
264
+ managed mirror, and downloads only added or changed indexable files. Google
265
+ Drive is Tier-1. OneDrive, Dropbox, SMB/SFTP/WebDAV, and mounted drives share
266
+ the same manifest contract. iCloud Drive is experimental because rclone marks
267
+ that backend Tier 4 and Apple ID/2FA sessions periodically require
268
+ reauthentication. See [docs/datasource-skills.md](docs/datasource-skills.md)
269
+ for filtering, size, concurrency, bandwidth, dry-run, and agent tool-calling
270
+ details.
271
+
180
272
  #### KakaoTalk (katok)
181
273
 
182
274
  KakaoTalk was the first datasource skill. It uses the external [`katok`](https://github.com/NomaDamas/katok) CLI only — AutoRAG never reads KakaoTalk databases directly. `katok` failures return diagnostics instead of throwing, and remote embedding egress configuration is rejected before the CLI is spawned.
@@ -195,7 +287,6 @@ const agent = new AutoRAGAgent({
195
287
  datasourceSkills: [kakao],
196
288
  datasourceAccess: {
197
289
  allowedTags: ["kakaotalk"],
198
- allowedScopes: ["/kakao/personal/**"],
199
290
  },
200
291
  });
201
292
 
@@ -226,7 +317,6 @@ const agent = new AutoRAGAgent({
226
317
  datasourceSkills: [discord],
227
318
  datasourceAccess: {
228
319
  allowedTags: ["discord"],
229
- allowedScopes: ["/discord/community/**"],
230
320
  },
231
321
  });
232
322
  ```
@@ -252,7 +342,7 @@ Or through the trusted config factory:
252
342
  Two defaults are deliberate and worth keeping:
253
343
 
254
344
  - **`defaultMode: "hybrid"`** — discrawl's FTS index strips newlines without substituting a space, welding words across line breaks into a single unsearchable token (measured at ~47% of post-newline words on a real archive). Semantic recall covers that gap. See [#1413](https://github.com/Marker-Inc-Korea/AutoRAG/issues/1413).
255
- - **`embeddingProvider: "ollama"` + `embeddingModel: "embeddinggemma"`** — semantic search requires an embedding provider (`ollama serve && ollama pull embeddinggemma`). For workspace-managed discrawl state, AutoRAG writes these values to `.autorag/datasources/discrawl/config.toml` while preserving unrelated discrawl settings. An explicit `connector.configPath` remains operator-owned and is never rewritten. EmbeddingGemma (Gemma 3 300M, 768-dim, 100+ languages) is the same model family katok uses for KakaoTalk, so all CLI-backed datasources share one local embedder. Do **not** use `nomic-embed-text`: it is English-only and collapses non-English text into one narrow similarity band, silently degrading semantic search to noise. AutoRAG emits a diagnostic when an English-only model is configured. See [#1414](https://github.com/Marker-Inc-Korea/AutoRAG/issues/1414).
345
+ - **`embeddingProvider: "ollama"` + `embeddingModel: "embeddinggemma"`** — semantic search requires an embedding provider (`ollama serve && ollama pull embeddinggemma`). Configure these values in discrawl's own config; AutoRAG uses discrawl's native store unless an explicit `connector.configPath` is supplied. EmbeddingGemma (Gemma 3 300M, 768-dim, 100+ languages) is the same model family katok uses for KakaoTalk, so all CLI-backed datasources can share one local embedder. Do **not** use `nomic-embed-text`: it is English-only and collapses non-English text into one narrow similarity band, silently degrading semantic search to noise. AutoRAG emits a diagnostic when an English-only model is configured. See [#1414](https://github.com/Marker-Inc-Korea/AutoRAG/issues/1414).
256
346
 
257
347
  A datasource skill should provide polling/cron metadata for routine indexing, source descriptions for the agent prompt, slash-hierarchical opaque source paths such as `/kakao/personal/chunks/<chunk-id>`, and permission tags that match your server-side access policy.
258
348
 
@@ -260,7 +350,7 @@ A datasource skill should provide polling/cron metadata for routine indexing, so
260
350
 
261
351
  AutoRAG is built for **non-code document retrieval**: manuals, legal docs, internal wikis, meeting notes, research literature, knowledge bases, PDFs.
262
352
 
263
- Code repositories work too (the explorer's `grep` is useful), but AutoRAG's real value shows on unstructured text where simple pattern matching isn't enough.
353
+ Code repositories work too (direct `grep` is useful), but AutoRAG's real value shows on unstructured text where simple pattern matching isn't enough.
264
354
 
265
355
  ## Configuration and state
266
356
 
@@ -270,38 +360,63 @@ The default home state is kept outside the workspace:
270
360
  ~/.autorag/
271
361
  ├── config.json
272
362
  ├── memory.json
273
- ├── logs/
274
- │ └── runs.jsonl
275
- └── pi-agent/
276
- ├── auth.json
277
- ├── models.json
278
- ├── settings.json
279
- └── sessions/
363
+ └── logs/
364
+ └── runs.jsonl
280
365
  ```
281
366
 
282
- `config.json` selects sources, the workspace, memory path, retrieval settings, and the two agent models. Configure the roles independently with `agents.orchestrator` and `agents.explorer`. Provider and model IDs must refer to models available in the user's authenticated runtime:
367
+ `config.json` selects sources, the workspace, memory path, retrieval settings, and the agent model. Provider and model IDs must refer to a model available in the user's authenticated runtime:
283
368
 
284
369
  ```json
285
370
  {
286
371
  "searchPaths": ["/path/to/documents"],
287
372
  "workspacePath": "/path/to/workspace",
288
373
  "memoryPath": "/Users/you/.autorag/memory.json",
289
- "agents": {
290
- "orchestrator": { "provider": "provider-name", "id": "reasoning-model" },
291
- "explorer": { "provider": "provider-name", "id": "exploration-model" }
292
- }
374
+ "model": { "provider": "provider-name", "id": "reasoning-model" }
293
375
  }
294
376
  ```
295
377
 
296
- `autorag init` leaves `agents` unset when no role-model flags are supplied. At search time AutoRAG resolves an authenticated local provider when possible; otherwise configure both roles explicitly.
378
+ `autorag init` leaves `model` unset when no model flags are supplied. At search time AutoRAG resolves an authenticated local provider when possible; otherwise configure the model explicitly.
379
+
380
+ For fast interactive search, prefer a model with reliable tool calling, high
381
+ output TPS, and low first-token latency. A query can require several short
382
+ model turns while AutoRAG alternates between retrieval tools and direct source
383
+ reading, so model throughput has a visible effect on end-to-end response time.
384
+ It does not accelerate BM25, MinSync, Jikji, filesystem access, or indexing
385
+ itself. Larger reasoning models remain useful for difficult synthesis,
386
+ conflicting evidence, and specialized domain judgment, but they are not a
387
+ requirement for ordinary retrieval.
297
388
 
298
389
  Config path precedence is `--config` > `AUTORAG_CONFIG` > `~/.autorag/config.json`. When the home config is absent and `<cwd>/autorag.config.json` exists, AutoRAG copies the legacy file to `~/.autorag/config.json` without deleting or modifying the legacy file. The legacy cwd file is a migration source, not the default location.
299
390
 
300
- `memory.json` stores retrieval memory, `logs/runs.jsonl` records run events, and durable Pi models, settings, and sessions stay under `~/.autorag/pi-agent`. Corpus indexes remain workspace-local: refresh keeps parsed mirrors and BM25/MinSync indexes under `<workspace>/.autorag`.
391
+ `memory.json` stores retrieval memory and `logs/runs.jsonl` records run events. Model authentication remains with the user's configured provider or authenticated local runtime. Corpus indexes remain workspace-local: refresh keeps parsed mirrors and BM25/MinSync indexes under `<workspace>/.autorag`.
301
392
 
302
393
  `autorag refresh` and `autorag index reset|rebuild` accept `--method <csv>` (e.g. `--method bm25,minsync,parsed`) to scope which indexing methods run or which index directories are removed. When omitted, all methods run. `autorag init` accepts `--embedder-*` flags to configure the MinSync embedder endpoint in the config file.
303
394
 
304
- `autorag health` checks model/provider auth and explorer subagent setup before a search — it resolves both role models, verifies credential presence, and optionally probes a completion call per role. Use it to diagnose model, provider, auth, timeout, or subagent dispatch failures. `autorag status` remains the model-free index-health command (corpus freshness and BM25/MinSync readiness); it does not check models or subagent dispatch. When `autorag search` fails for a model/provider/subagent reason, the error output includes a hint pointing to `autorag health`.
395
+ `autorag health` checks model/provider auth before a search — it resolves the model, verifies credential presence, and optionally probes one completion call. Use it to diagnose model, provider, auth, or timeout failures. `autorag status` remains the model-free index-health command (corpus freshness and BM25/MinSync readiness). When `autorag search` fails for a model/provider reason, the error output includes a hint pointing to `autorag health`.
396
+
397
+ `autorag ui` opens a loopback-only page (`127.0.0.1`) to connect local folders and datasource skills without editing JSON. It writes the same trusted `datasources` / `datasourceAccess` fields as a hand-edited config, stores env-var *names* rather than secrets, and refuses non-loopback binds. Use `--no-open` to print the URL without launching a browser.
398
+
399
+ For a deliberately deployed UI, opt in explicitly in `config.json`. Keep the
400
+ session token in the environment, set the public URL used by the browser, and
401
+ allow only the frontend origins that should make credentialed API requests:
402
+
403
+ ```json
404
+ {
405
+ "ui": {
406
+ "host": "0.0.0.0",
407
+ "port": 8787,
408
+ "allowRemote": true,
409
+ "publicOrigin": "https://autorag.example.com",
410
+ "corsOrigins": ["https://autorag.example.com"],
411
+ "tokenEnv": "AUTORAG_UI_TOKEN"
412
+ }
413
+ }
414
+ ```
415
+
416
+ Start it with `AUTORAG_UI_TOKEN` set to a random value of at least 16
417
+ characters. Local use remains the safe default: omit `ui` (or leave
418
+ `allowRemote` false) and AutoRAG binds to loopback, including a working
419
+ `localhost` URL on systems that resolve it to IPv6.
305
420
 
306
421
  ## Installation
307
422
 
@@ -314,9 +429,45 @@ bun install -g @autorag/librarian # autorag CLI
314
429
  bun add github:NomaDamas/AutoRAG-2.0
315
430
  ```
316
431
 
432
+ PDF parsing requires **Java 11 or newer** because the bundled
433
+ `@opendataloader/pdf` runtime is compiled for Java 11. This applies to
434
+ Windows, macOS, and Linux. Verify the runtime that will be selected from
435
+ `PATH` before indexing PDFs:
436
+
437
+ ```bash
438
+ java -version
439
+ ```
440
+
441
+ On Windows, ensure a Java 11+ installation appears before older Java
442
+ installations in `PATH` (or set `JAVA_HOME` to the Java 11+ installation and
443
+ start a new shell). Java 8 is not supported by the PDF parser.
444
+
317
445
  Git-based installs build `dist/` via the `prepare` script and require Bun on the installing machine.
318
446
  External tool binaries auto-install on first use into `<workspace>/.autorag/bin`: **MinSync** downloads a verified GitHub release asset (on by default; `minSync.autoInstall: false` to opt out), and **Jikji** compiles the [`jikji-cli`](https://crates.io/crates/jikji-cli) crate via cargo (requires the [Rust toolchain](https://rustup.rs); `jikji.autoInstall: false` to opt out). New `autorag init` configs enable Jikji find-first discovery by default. KakaoTalk (`katok`) and Discord (`discrawl`) stay manual, optional installs. All of them degrade gracefully when missing — core BM25 search works without any of them.
319
447
 
448
+ ### Experimental TUI (beta)
449
+
450
+ The latest TUI work is currently available on the `feat/experimental-tui`
451
+ branch. To use this beta version from source:
452
+
453
+ ```bash
454
+ git clone --branch feat/experimental-tui https://github.com/Marker-Inc-Korea/AutoRAG.git
455
+ cd AutoRAG
456
+ bun install
457
+ bun run build
458
+
459
+ # Configure your document roots and model once:
460
+ node dist/cli/index.js init --search-paths /path/to/documents
461
+
462
+ # Start the beta TUI:
463
+ node dist/cli/index.js tui
464
+ ```
465
+
466
+ Inside the TUI, use `/resume` to browse saved sessions. Selecting a session
467
+ replaces the current view with that session instead of mixing the two
468
+ conversation histories. This branch is experimental and may change before the
469
+ feature is included in a published release.
470
+
320
471
  ## Quick Start
321
472
 
322
473
  ```typescript
@@ -345,15 +496,11 @@ agent.recordFeedbackByNumbers(response.sessionId, [1, 3], [2]);
345
496
  │
346
497
  ▼
347
498
  ┌──────────────┐
348
- │ Plan + seed │ ← parent check_memory, Jikji, and retrieval tools
349
- └──────┬───────┘
350
- ▼
351
- ┌──────────────┐
352
- │ Delegate │ ← pi-subagents → gpt-5.6-luna explorer
499
+ │ Plan + search│ ← check_memory, Jikji, and retrieval tools
353
500
  └──────┬───────┘
354
501
  ▼
355
502
  ┌──────────────┐
356
- │ Search + read│ ← explorer read/grep/find/ls
503
+ │ Direct read │ ← bash find/grep/cat
357
504
  └──────┬──────┘
358
505
  ▼
359
506
  ┌─────────────┐
@@ -2,15 +2,16 @@ import { Agent, type AgentTool, type Skill } from "@earendil-works/pi-agent-core
2
2
  import type { Api, Model } from "@earendil-works/pi-ai";
3
3
  import { type DatasourceAccessContextOptions } from "../datasource/access-context.js";
4
4
  import type { DatasourceIndexResult, DatasourceSkill } from "../datasource/types.js";
5
+ import { type DupeyCliOptions } from "../dupey/index.js";
5
6
  import { type JikjiFailureReason, type JikjiOptions } from "../jikji/index.js";
6
7
  import type { ResultFeedback } from "../memory/memory.js";
7
- import { type MinSyncSyncResult, type MinSyncVectorMethodOptions } from "../minsync/index.js";
8
+ import { type MinSyncBM25MethodOptions, type MinSyncSyncResult, type MinSyncVectorMethodOptions } from "../minsync/index.js";
8
9
  import { type ParsedMirrorSyncResult } from "../mirror/sync.js";
9
10
  import type { DefaultParserRegistryOptions } from "../parser/index.js";
10
- import { type BM25MethodOptions, type BM25SyncResult } from "../retrieval/methods/bm25.js";
11
+ import { type BM25SyncResult } from "../retrieval/methods/bm25.js";
11
12
  import { RetrievalMethodRegistry } from "../retrieval/registry.js";
12
13
  import type { CuratedResult, RetrievalDiagnostic, RetrievalOptions, RetrievalResult } from "../retrieval/types.js";
13
- import { type MandatorySubagentSessionOptions } from "../subagents/runtime.js";
14
+ import { type ScanDuplicateDocumentsDetails } from "./dupey-tool.js";
14
15
  import { type JikjiFindProviderResult } from "./jikji-find-tool.js";
15
16
  import { type SearchDocumentDiagnostic, type SearchDocumentsResponse } from "./search-documents.js";
16
17
  import { type WatcherFactory, type WatchRefreshHandle } from "./watch-refresh.js";
@@ -29,7 +30,8 @@ export interface AutoRAGMinSyncRefreshResult {
29
30
  readonly synced: number;
30
31
  readonly reason?: string;
31
32
  }
32
- export interface AutoRAGRefreshResult extends ParsedMirrorSyncResult {
33
+ export interface AutoRAGRefreshResult extends Omit<ParsedMirrorSyncResult, "diagnostics"> {
34
+ readonly diagnostics: readonly SearchDocumentDiagnostic[];
33
35
  readonly bm25?: BM25SyncResult;
34
36
  readonly minsync?: AutoRAGMinSyncRefreshResult;
35
37
  readonly datasources?: readonly DatasourceIndexResult[];
@@ -68,7 +70,6 @@ export interface AutoRAGWatchRefreshOptions {
68
70
  export type AutoRAGWatchRefreshHandle = WatchRefreshHandle;
69
71
  export interface AutoRAGAgentOptions {
70
72
  model?: Model<Api>;
71
- explorerModel?: Model<Api>;
72
73
  apiKey?: string;
73
74
  providerApiKeys?: Readonly<Record<string, string>>;
74
75
  searchPaths: string[];
@@ -77,13 +78,20 @@ export interface AutoRAGAgentOptions {
77
78
  workspacePath?: string;
78
79
  tools?: AgentTool[];
79
80
  minSync?: Omit<MinSyncVectorMethodOptions, "root"> | false;
80
- bm25?: Omit<BM25MethodOptions, "root"> | false;
81
- jikji?: JikjiOptions;
81
+ bm25?: Omit<MinSyncBM25MethodOptions, "root"> | false;
82
+ jikji?: JikjiOptions | false;
82
83
  autoRefresh?: AutoRefreshOptions;
83
84
  parserOptions?: DefaultParserRegistryOptions;
85
+ dupey?: DupeyCliOptions | false;
86
+ excludeExactDuplicates?: boolean;
84
87
  datasourceSkills?: readonly DatasourceSkill[];
85
88
  datasourceAccess?: DatasourceAccessContextOptions;
86
- sessionFactory?: AutoRAGSessionFactory;
89
+ /** Non-fatal diagnostics from config/agent construction (e.g. skipped unknown datasources). */
90
+ startupDiagnostics?: readonly SearchDocumentDiagnostic[];
91
+ /** Maximum time a model/tool search may run before it is aborted. */
92
+ searchTimeoutMs?: number;
93
+ /** Maximum number of retrieval/tool executions allowed in one search. */
94
+ maxSearchToolCalls?: number;
87
95
  }
88
96
  export interface AutoRAGSearchSession {
89
97
  readonly agent: Agent;
@@ -91,7 +99,6 @@ export interface AutoRAGSearchSession {
91
99
  abort(): Promise<void> | void;
92
100
  dispose(): void;
93
101
  }
94
- export type AutoRAGSessionFactory = (options: MandatorySubagentSessionOptions) => Promise<AutoRAGSearchSession>;
95
102
  export type AutoRAGJikjiPrepareResult = {
96
103
  readonly ok: true;
97
104
  readonly code: number;
@@ -106,17 +113,10 @@ export declare class AutoRAGAgent {
106
113
  private readonly innerAgent;
107
114
  private readonly tools;
108
115
  private readonly configuredModel;
109
- private readonly configuredExplorerModel;
110
116
  private readonly apiKey;
111
117
  private readonly providerApiKeys;
112
- private readonly sessionFactory;
113
118
  private readonly listeners;
114
119
  private activeSession;
115
- private readonly pendingSubagentCalls;
116
- private readonly dispatchSequenceBySession;
117
- private readonly dispatchArgsTracker;
118
- private dispatchSyntheticCounter;
119
- private successfulExplorerCalls;
120
120
  private readonly memory;
121
121
  private readonly runLogger;
122
122
  private lastQuery;
@@ -131,7 +131,6 @@ export declare class AutoRAGAgent {
131
131
  private readonly configuredSearchPaths;
132
132
  private retrievalScopeBindings;
133
133
  private readonly datasourceVirtualScopePrefixes;
134
- private readonly allowedExplorerRoots;
135
134
  private readonly workspaceProjectRoot;
136
135
  private readonly methodRegistry;
137
136
  private readonly retriever;
@@ -142,25 +141,23 @@ export declare class AutoRAGAgent {
142
141
  private readonly jikjiClient;
143
142
  private readonly datasourceSkills;
144
143
  private readonly datasourceAccessOptions;
144
+ private readonly startupDiagnostics;
145
145
  private readonly datasourceAgentSkills;
146
146
  private readonly parserOptions;
147
+ private readonly dupeyOptions;
148
+ private readonly excludeExactDuplicates;
147
149
  private readonly baseSystemPromptConfig;
148
- /** Run-scoped merged Jikji policy, set during searchDocuments; cleared after. */
149
- private activeJikjiPolicy;
150
- private activeExplorerModel;
151
- /** Run-scoped jikji_find call count for the two-phase raw-fallback gate. */
152
- private jikjiFindCallCount;
153
150
  private readonly droppedCallerToolNames;
151
+ private readonly searchTimeoutMs;
152
+ private readonly maxSearchToolCalls;
153
+ private searchToolCallCount;
154
154
  constructor(options: AutoRAGAgentOptions);
155
+ scanDuplicateDocuments(): Promise<ScanDuplicateDocumentsDetails>;
155
156
  private withMemoryContext;
156
157
  private resolveSessionModel;
158
+ private createSearchSession;
157
159
  private configureSearchSession;
158
160
  private recordSearchToolEvent;
159
- private nextDispatchSequence;
160
- private resolveToolCallId;
161
- private emitDispatchAutofilled;
162
- private emitDispatchRejected;
163
- private emitDispatchRejectedFromRejection;
164
161
  private currentSystemPromptConfig;
165
162
  subscribe(listener: Parameters<Agent["subscribe"]>[0]): () => void;
166
163
  abort(): void;
@@ -177,6 +174,7 @@ export declare class AutoRAGAgent {
177
174
  submitFeedback(sessionId: string | undefined, satisfied: boolean): void;
178
175
  recordResultFeedback(feedback: ResultFeedback[]): void;
179
176
  recordFeedbackByNumbers(sessionId: string, usefulNumbers: number[], notUsefulNumbers?: number[]): void;
177
+ recordFeedbackByIds(usefulFeedbackIds: readonly string[], notUsefulFeedbackIds?: readonly string[]): void;
180
178
  getResultRegistry(sessionId?: string): ReadonlyMap<number, CuratedResult>;
181
179
  searchDocuments(query: string, options?: RetrievalOptions): Promise<SearchDocumentsResponse>;
182
180
  private datasourceAccessContext;
@@ -195,7 +193,8 @@ export declare class AutoRAGAgent {
195
193
  private indexDatasources;
196
194
  /** Path-opaque component diagnostics (e.g. BM25 readiness) for the search response. */
197
195
  private collectComponentDiagnostics;
198
- buildSearchPrompt(query: string, options: RetrievalOptions, explorerModel?: string): string;
196
+ private prefetchInitialRetrievalContext;
197
+ buildSearchPrompt(query: string, options: RetrievalOptions, initialRetrievalContext?: string): string;
199
198
  refresh(force?: boolean, opts?: AutoRAGRefreshOptions): Promise<AutoRAGRefreshResult>;
200
199
  /**
201
200
  * Path-opaque snapshot of corpus freshness and the last refresh outcome. Runs
@@ -221,7 +220,8 @@ export declare class AutoRAGAgent {
221
220
  * so the refresh result and status remain consistent.
222
221
  */
223
222
  private scanMirrorStaleness;
224
- syncBM25(): Promise<BM25SyncResult | undefined>;
223
+ private exactDuplicateExclusions;
224
+ syncBM25(minsync?: MinSyncSyncResult): Promise<BM25SyncResult | undefined>;
225
225
  syncMinSync(): Promise<MinSyncSyncResult | undefined>;
226
226
  prepareJikji(): Promise<readonly AutoRAGJikjiPrepareResult[] | undefined>;
227
227
  private executeJikjiPrepare;
@@ -229,12 +229,9 @@ export declare class AutoRAGAgent {
229
229
  /**
230
230
  * Provider method for the jikji_find tool. Runs JikjiClient.find over all
231
231
  * configured search roots, normalizes answer paths against planned source
232
- * roots, merges per-root answer packs using least-privilege (restrictive-
233
- * wins) semantics, and sets the run-scoped activeJikjiPolicy. Only mutates
234
- * run state (activeJikjiPolicy / jikjiFindCallCount) when a searchDocuments
235
- * run is active; direct out-of-run calls compute and return the result
236
- * without persisting. When jikji is unavailable or all roots fail, returns
237
- * an unavailable result and leaves the policy undefined (bash is allowed).
232
+ * roots, and merges per-root answer packs using least-privilege
233
+ * (restrictive-wins) semantics. Jikji policy metadata remains visible to the
234
+ * model, but it does not gate the librarian's direct file-reading tools.
238
235
  */
239
236
  findJikji(query: string, opts?: {
240
237
  readonly topK?: number;
@@ -253,20 +250,9 @@ export declare class AutoRAGAgent {
253
250
  * - stopAfterFind: OR
254
251
  * - agentShouldNotRerank: OR
255
252
  * - handoffAction: MOST RESTRICTIVE (direct_use < jikji_retry < raw_fallback_after_retry)
256
- * - rawFallbackAllowed: handoffAction===raw_fallback_after_retry AND callCount>=2
253
+ * - rawFallbackAllowed: handoffAction===raw_fallback_after_retry
257
254
  */
258
255
  private mergePolicy;
259
- /**
260
- * Deny-by-default bash gate. When jikji is configured but no jikji_find has
261
- * run yet this run (count===0), bash is blocked so the agent discovers local
262
- * files via jikji_find first. After a find, the run-scoped activeJikjiPolicy
263
- * applies: when no policy is active, bash behaves exactly as before
264
- * (allowed). Under an active policy, bash is denied unless handoffAction is
265
- * raw_fallback_after_retry AND rawFallbackAllowed is true (after a second
266
- * jikji_find). When jikji is not configured, the find-first branch is
267
- * skipped entirely (bash unchanged).
268
- */
269
- private bashGate;
270
256
  /**
271
257
  * Programmatic retrieval across all registered methods, merged via min-max
272
258
  * normalization + source dedup. Activates the RetrievalMethodRegistry /
@@ -300,6 +286,7 @@ export declare class AutoRAGAgent {
300
286
  /** The retrieval method registry (posix active; vector/bm25/hybrid pluggable). */
301
287
  getMethodRegistry(): RetrievalMethodRegistry;
302
288
  getSystemPrompt(): string;
289
+ private rerankWithMemory;
303
290
  private normalizeRetrievalOptions;
304
291
  private resolveRetrievalScope;
305
292
  }
@@ -13,24 +13,15 @@ export interface BashToolOptions {
13
13
  readonly timeoutMs?: number;
14
14
  /** Maximum captured output bytes before truncation. */
15
15
  readonly maxOutputBytes?: number;
16
- /**
17
- * Optional deny-by-default gate. When present and returns
18
- * `{ allowed: false }`, the command is NOT spawned; the tool returns the
19
- * gate message with `blockedByJikjiPolicy: true`. Used by the Jikji policy
20
- * to enforce stop_after_find / direct_use / forbidden bash restrictions.
21
- */
22
- readonly gate?: () => {
23
- allowed: boolean;
24
- message: string;
25
- };
26
16
  }
27
17
  export interface BashToolDetails {
28
18
  readonly method: "bash";
29
19
  readonly command: string;
20
+ readonly aborted: boolean;
30
21
  readonly exitCode: number | undefined;
22
+ readonly terminationFailed: boolean;
31
23
  readonly timedOut: boolean;
32
24
  readonly truncated: boolean;
33
- readonly blockedByJikjiPolicy?: boolean;
34
25
  }
35
26
  /**
36
27
  * Real shell access for the librarian agent. AutoRAG navigates and reads the