@autorag/librarian 2.4.1 → 2.4.2

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.
@@ -5,6 +5,7 @@ export interface MinSyncClientOptions {
5
5
  readonly embedder?: MinSyncEmbedderConfig;
6
6
  readonly maxChunkSize?: number;
7
7
  }
8
+ /** MinSync v0.4.2 supports vector, BM25, and hybrid query modes. */
8
9
  export type MinSyncQueryMode = "vector" | "bm25" | "hybrid";
9
10
  export declare class MinSyncClient {
10
11
  private readonly binaryPath;
@@ -12,7 +13,7 @@ export declare class MinSyncClient {
12
13
  private readonly embedder;
13
14
  private readonly maxChunkSize;
14
15
  constructor(options: MinSyncClientOptions);
15
- sync(): Promise<MinSyncSyncResult>;
16
+ sync(force?: boolean): Promise<MinSyncSyncResult>;
16
17
  query(text: string, topK: number, mode?: MinSyncQueryMode): Promise<readonly MinSyncQueryHit[]>;
17
18
  private spawn;
18
19
  }
@@ -1,4 +1,5 @@
1
- export declare const MINSYNC_VERSION = "0.3.0";
1
+ export declare const MINSYNC_VERSION = "0.4.2";
2
+ export declare const MINSYNC_CARGO_INSTALL_TIMEOUT_MS: number;
2
3
  export interface MinSyncReleaseAsset {
3
4
  readonly name: string;
4
5
  readonly downloadUrl: string;
@@ -18,6 +19,11 @@ export interface EnsureMinSyncBinaryOptions {
18
19
  readonly arch?: NodeJS.Architecture;
19
20
  readonly releaseProvider?: () => Promise<MinSyncRelease>;
20
21
  readonly assetInstaller?: (asset: MinSyncReleaseAsset, destination: string) => Promise<void>;
22
+ /** Test seam: cargo-first installer. Return undefined to fall back to GitHub. */
23
+ readonly cargoInstaller?: (destination: string) => Promise<InstalledMinSyncBinary | undefined>;
24
+ /** Test seam: locate cargo on PATH. */
25
+ readonly cargoLocator?: (env: NodeJS.ProcessEnv) => string | undefined;
26
+ readonly env?: NodeJS.ProcessEnv;
21
27
  }
22
28
  export declare function ensureMinSyncBinary(options: EnsureMinSyncBinaryOptions): Promise<InstalledMinSyncBinary>;
23
29
  export declare function fetchLatestMinSyncRelease(): Promise<MinSyncRelease>;
@@ -23,11 +23,14 @@ export declare class MinSyncVectorMethod implements RetrievalMethod {
23
23
  private readonly embedder;
24
24
  private readonly maxChunkSize;
25
25
  private readonly mode;
26
+ private installFailed;
26
27
  constructor(options: MinSyncVectorMethodOptions);
27
28
  describe(): RetrievalMethodDescriptor;
28
- sync(): Promise<MinSyncSyncResult>;
29
- /** MinSync is resolved from PATH, then the workspace cache. */
29
+ sync(force?: boolean): Promise<MinSyncSyncResult>;
30
+ /** Report unavailable binaries without treating auto-install as already failed. */
30
31
  isBinaryMissing(): boolean;
32
+ /** Status distinguishes an explicit missing override from deferred resolution. */
33
+ isExplicitBinaryMissing(): boolean;
31
34
  /** A vector index is ready only after MinSync has written its cursor. */
32
35
  isReady(): boolean;
33
36
  retrieve(query: string, options: RetrievalOptions): Promise<RetrievalResult[]>;
@@ -1,5 +1,5 @@
1
1
  export type { ParsedMirrorEntry, ParsedMirrorIndex } from "./index-store.js";
2
2
  export { emptyMirrorIndex, loadMirrorIndex, saveMirrorIndex } from "./index-store.js";
3
- export { parsedMirrorIndexPath, parsedMirrorRoot, parsedOutputPath } from "./paths.js";
3
+ export { parsedMirrorIndexPath, parsedMirrorRoot, parsedOutputPath, refreshReadinessPath } from "./paths.js";
4
4
  export type { ParsedMirrorDiagnostic, ParsedMirrorDiagnosticCode, ParsedMirrorSyncOptions, ParsedMirrorSyncResult, } from "./sync.js";
5
5
  export { DEFAULT_MAX_SOURCE_BYTES, detectMirrorStaleness, syncParsedMirrors } from "./sync.js";
@@ -1,6 +1,8 @@
1
1
  export declare const PARSED_MIRROR_SUBDIR: string;
2
2
  export declare const PARSED_FILES_SUBDIR = "files";
3
3
  export declare const PARSED_INDEX_FILE = "index.json";
4
+ export declare const REFRESH_READINESS_FILE = "refresh-complete.json";
4
5
  export declare function parsedMirrorRoot(root: string): string;
5
6
  export declare function parsedMirrorIndexPath(root: string): string;
6
7
  export declare function parsedOutputPath(root: string, virtualPath: string): string;
8
+ export declare function refreshReadinessPath(root: string): string;
@@ -0,0 +1,123 @@
1
+ /**
2
+ * RetrievalEngine — standalone typed seam for model-free retrieval.
3
+ *
4
+ * Wraps the existing retrieval pipeline (registry, parallel retriever,
5
+ * datasource result filter, and merger) into a single public entry point.
6
+ * Exposes a deterministic, self-contained retrieval API with diagnostics.
7
+ *
8
+ * Security invariants (delegated to {@link DatasourceAccessContext} and
9
+ * {@link DatasourceResultFilter}):
10
+ * - Access is default-deny: when no trusted allow-tags are configured,
11
+ * every datasource method result is dropped.
12
+ * - Deny is always an explicit empty result array, never `undefined`.
13
+ * - Model/tool arguments (`allowedTags`, `allowedScopes`) cannot widen the
14
+ * trusted access context constructed during engine creation.
15
+ */
16
+ import { DatasourceAccessContext, type DatasourceAccessContextOptions } from "../datasource/access-context.js";
17
+ import { RetrievalMethodRegistry } from "./registry.js";
18
+ import type { RetrievalDiagnostic, RetrievalMethod, RetrievalOptions, RetrievalResult } from "./types.js";
19
+ /** Options for constructing a standalone {@link RetrievalEngine}. */
20
+ export interface RetrievalEngineOptions {
21
+ /**
22
+ * Datasource access configuration. Default-deny when omitted.
23
+ * @default { allowedTags: undefined, allowedScopes: undefined }
24
+ */
25
+ readonly datasourceAccess?: DatasourceAccessContextOptions;
26
+ /** Default `topK` when the caller omits it. @default 20 */
27
+ readonly defaultTopK?: number;
28
+ /** Default deduplication flag. @default true */
29
+ readonly defaultDedup?: boolean;
30
+ /**
31
+ * Optional predicate that returns `true` when the MinSync binary is missing.
32
+ * When set, the engine checks every method named `"minsync"`: if the binary
33
+ * is unavailable the method returns empty results without throwing, the engine
34
+ * emits a `minsync-unavailable` diagnostic with full method-agnostic path
35
+ * preservation — matching the existing {@link AutoRAGAgent} behavior.
36
+ */
37
+ readonly isMinSyncBinaryMissing?: () => boolean;
38
+ }
39
+ /**
40
+ * Model-free retrieval pipeline.
41
+ *
42
+ * The engine composes the standard AutoRAG retrieval chain:
43
+ * ```
44
+ * methods = registry.list()
45
+ * byMethod = retriever.retrieveWithDiagnostics(methods, query, options)
46
+ * filtered = filter.filter(byMethod, methods, ctx, options.scope)
47
+ * merged = merger.merge(filtered, { topK, dedup: true })
48
+ * → { results: merged, diagnostics }
49
+ * ```
50
+ *
51
+ * Exposes two paths:
52
+ * 1. `retrieve(query, options?)` — merged results + diagnostics (the standard
53
+ * pipeline).
54
+ * 2. `retrieveByMethod(query, options?)` — per-method results (unmerged) with
55
+ * diagnostics, for callers that need the raw per-method view.
56
+ *
57
+ * The engine does NOT handle refresh lifecycle, MinSync sync, Jikji, or
58
+ * agent-level concerns. It is purely the retrieval composition seam.
59
+ */
60
+ export declare class RetrievalEngine {
61
+ private readonly registry;
62
+ private readonly retriever;
63
+ private readonly filter;
64
+ private readonly merger;
65
+ private readonly accessContext;
66
+ private readonly defaultTopK;
67
+ private readonly defaultDedup;
68
+ private readonly isMinSyncBinaryMissing;
69
+ constructor(options?: RetrievalEngineOptions);
70
+ /** The underlying method registry. Intentionally public for tooling. */
71
+ getMethodRegistry(): RetrievalMethodRegistry;
72
+ /** The underlying datasource access context. Read-only for inspection. */
73
+ getAccessContext(): DatasourceAccessContext;
74
+ /**
75
+ * Register a retrieval method. Overrides the registered-once check from
76
+ * {@link RetrievalMethodRegistry} per caller requirement.
77
+ *
78
+ * @throws {Error} if a method with the same name is already registered.
79
+ */
80
+ register(method: RetrievalMethod): void;
81
+ /**
82
+ * Register multiple methods in one call. Stop-on-first-error semantics:
83
+ * registration fails atomically if any method conflicts with an already-
84
+ * registered name; earlier methods in the batch are not retained.
85
+ *
86
+ * @throws {Error} if any method name duplicates an existing or in-batch registration.
87
+ */
88
+ registerMany(methods: readonly RetrievalMethod[]): void;
89
+ /**
90
+ * Run the full retrieval pipeline — parallel retrieve, datasource filter,
91
+ * merge — and return merged results with diagnostics.
92
+ */
93
+ retrieve(query: string, options?: RetrievalOptions): Promise<{
94
+ results: RetrievalResult[];
95
+ diagnostics: RetrievalDiagnostic[];
96
+ }>;
97
+ /**
98
+ * Run retrieval and return results keyed per method (unmerged) with
99
+ * diagnostics. Unlike {@link retrieve}, this does NOT merge or sort —
100
+ * callers get the raw per-method view after datasource filtering.
101
+ */
102
+ retrieveByMethod(query: string, options?: RetrievalOptions): Promise<{
103
+ byMethod: Map<string, RetrievalResult[]>;
104
+ diagnostics: RetrievalDiagnostic[];
105
+ }>;
106
+ /**
107
+ * Post-check for MinSync binary-missing diagnostic.
108
+ *
109
+ * When a registered method named `"minsync"` fails to throw (the method returns
110
+ * `[]` because the binary is missing), {@link ParallelRetriever} cannot record
111
+ * a diagnostic. This method checks whether the minsync binary is unavailable
112
+ * and emits a `minsync-unavailable` diagnostic when every minsync method's
113
+ * result set is empty, exactly matching the existing {@link AutoRAGAgent}
114
+ * behavior (see `agent.src/agent/agent.ts` `retrieveWithDiagnostics`).
115
+ */
116
+ private appendMinSyncUnavailableDiagnostic;
117
+ /**
118
+ * Build a datasource access context scoped to the caller's options.
119
+ * Model/tool arguments (allowedTags, allowedScopes) from options can only
120
+ * further restrict the trusted context, never widen it.
121
+ */
122
+ private accessContextFor;
123
+ }
@@ -1,3 +1,4 @@
1
+ export { RetrievalEngine, type RetrievalEngineOptions } from "./engine.js";
1
2
  export type { MergeOptions } from "./merger.js";
2
3
  export { ParallelRetriever, ResultMerger } from "./merger.js";
3
4
  export { RetrievalMethodRegistry } from "./registry.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autorag/librarian",
3
- "version": "2.4.1",
3
+ "version": "2.4.2",
4
4
  "description": "Self-evolving librarian agent on Pi framework with pluggable retrieval methods",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -14,6 +14,10 @@
14
14
  ".": {
15
15
  "types": "./dist/index.d.ts",
16
16
  "default": "./dist/index.js"
17
+ },
18
+ "./core": {
19
+ "types": "./dist/core.d.ts",
20
+ "default": "./dist/core.js"
17
21
  }
18
22
  },
19
23
  "bin": {
@@ -28,7 +32,7 @@
28
32
  "access": "public"
29
33
  },
30
34
  "scripts": {
31
- "build": "bun build src/index.ts src/cli/index.ts --outdir dist --target node --packages external && tsc -p tsconfig.build.json && node scripts/fixup-dts.mjs",
35
+ "build": "bun build src/index.ts src/core.ts src/cli/index.ts --outdir dist --target node --packages external && tsc -p tsconfig.build.json && node scripts/fixup-dts.mjs",
32
36
  "prepublishOnly": "bun run typecheck && bun run build",
33
37
  "prepare": "bun run build",
34
38
  "test": "node scripts/run-test-files.mjs",
@@ -0,0 +1,155 @@
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 requires a completed refresh. If `autorag lite retrieve` returns
22
+ exit code 2 with an `index-not-ready` diagnostic, run `autorag lite refresh`
23
+ (or `autorag refresh`) first, then retry. Confirm freshness with:
24
+
25
+ ```bash
26
+ autorag lite status --json
27
+ ```
28
+
29
+ `status` is model-free and path-opaque.
30
+
31
+ ## Retrieve
32
+
33
+ ```bash
34
+ autorag lite retrieve "key findings in the Q3 report" --top-k 5 --json
35
+ ```
36
+
37
+ The JSON envelope is:
38
+
39
+ ```json
40
+ {
41
+ "ok": true,
42
+ "query": "key findings in the Q3 report",
43
+ "results": [
44
+ {
45
+ "number": 1,
46
+ "source": "<opaque source identifier>",
47
+ "method": "minsync",
48
+ "score": 0.83,
49
+ "metadata": {},
50
+ "content": "..."
51
+ }
52
+ ],
53
+ "diagnostics": []
54
+ }
55
+ ```
56
+
57
+ - `--top-k N` must be a positive integer. Invalid values exit with code 2 and
58
+ an `{"ok": false, "error": "..."}` rejection envelope.
59
+ - Before any refresh, the envelope is `{"ok": false, "query": ..., "diagnostics":
60
+ [{"code": "index-not-ready", "severity": "error", ...}]}` with exit code 2.
61
+ - Each result carries a provenance pair: the `source` identity and the
62
+ `method` that produced it. Source identities are source-native: real file
63
+ paths for local files, datasource identities for datasource results. Never
64
+ rewrite, guess, or flatten them.
65
+ - `diagnostics` are path-opaque: `source` is a component or method label,
66
+ never a real filesystem path. Codes include `retrieval-method-failed` and
67
+ `minsync-unavailable`. A degraded component produces a diagnostic, not a
68
+ failed run; check `diagnostics` before trusting an empty result set.
69
+ - `--debug` adds diagnostic detail to human output without printing real
70
+ filesystem paths.
71
+ - Exit codes: 0 on success (results may be empty), 2 for usage, config, or
72
+ not-ready errors, 1 for runtime errors.
73
+
74
+ Retrieval methods run in parallel and merge: parsed mirrors and MinSync
75
+ lexical/vector/hybrid methods, plus configured datasource methods. Jikji is a
76
+ local discovery/indexing preparer, not a retrieval method in the lite registry.
77
+ `--method` selection applies to refresh, not retrieve; retrieval always queries
78
+ every active retrieval method.
79
+
80
+ ## Scope and tag narrowing (default-deny)
81
+
82
+ Datasource access is default-deny from trusted config
83
+ (`datasourceAccess.allowedTags`, `allowedScopes`). Retrieval flags can only
84
+ narrow that access, never widen it:
85
+
86
+ - `--scope SCOPE` narrows datasource retrieval to a requested sub-path; it
87
+ cannot grant access to anything the config does not already allow.
88
+ - `--tags tag1,tag2` further narrows already-authorized datasource results by
89
+ intersecting with configured allowed tags; it never grants new access.
90
+
91
+ ## Persisting a curated report
92
+
93
+ An external agent curates the raw retrieval results, then persists the
94
+ structured report so evidence and feedback commands work against it:
95
+
96
+ ```bash
97
+ autorag lite report "key findings in the Q3 report" --input report.json --json
98
+ cat report.json | autorag lite report "key findings in the Q3 report" --json
99
+ ```
100
+
101
+ The input is the `emit_autorag_results` JSON schema: `answer`, numbered
102
+ `results` (with `number`, `title`, `summary`, `confidence` in `[0, 1]`,
103
+ optional `source`), and a `mapping` whose entries map each result number to
104
+ its `method` and `source`, plus optional `evidenceRefs` and `warnings`.
105
+ Result and mapping numbers must be one-to-one positive integers. Evidence
106
+ confidence values must be in `[0, 1]`. Invalid input exits with code 2 and
107
+ `{"ok": false, "error": "..."}`.
108
+
109
+ `source` values in a report are opaque identifiers carried from retrieval
110
+ output. Report persistence performs no filesystem reads against them; it
111
+ stores the identifiers as given. Preserve the exact source-native identities
112
+ from the retrieve envelope.
113
+
114
+ On success the JSON envelope is:
115
+
116
+ ```json
117
+ {
118
+ "ok": true,
119
+ "sessionId": "<uuid>",
120
+ "query": "key findings in the Q3 report",
121
+ "answer": "...",
122
+ "resultCount": 3
123
+ }
124
+ ```
125
+
126
+ Use the returned `sessionId` for evidence inspection and feedback.
127
+
128
+ ## Evidence and feedback
129
+
130
+ ```bash
131
+ autorag evidence <sessionId> --result 1 --json
132
+ autorag feedback <sessionId> --useful 1,3 --not-useful 2 --json
133
+ ```
134
+
135
+ - `evidence` shows the persisted source, retrieval method, stable evidence ID,
136
+ excerpt or content, and any `chunkIndex`, `lineNumber`, and
137
+ `retrievalResultId` behind a numbered result. Omit `--result` to inspect the
138
+ whole session.
139
+ - `feedback` records numbered usefulness so retrieval memory can learn.
140
+ Numbers refer to the report's result numbers. Supply at least one feedback
141
+ list.
142
+ - Preserve real source mapping and numbered identifiers end to end: retrieve
143
+ output feeds the report, the report's session feeds evidence and feedback.
144
+
145
+ ## Rules
146
+
147
+ - Refresh before retrieval; refresh again when roots change.
148
+ - Use only configured and approved search paths and datasources.
149
+ - Never move, rename, edit, or delete source documents.
150
+ - Never expose provider credentials or authentication payloads.
151
+ - Treat report `source` values as opaque: persist them verbatim, never read
152
+ the filesystem through them.
153
+ - Keep diagnostics path-opaque; do not reconstruct or disclose real paths
154
+ from them.
155
+ - Prefer `--json` whenever another agent consumes the output.
@@ -0,0 +1,182 @@
1
+ ---
2
+ name: autorag-lite-setup
3
+ description: Initialize, index, refresh, and maintain the model-free AutoRAG Lite lifecycle (config, roots, datasources, refresh, watch, status, index reset/rebuild) without configuring any model. Use when autorag lite init/refresh/status is needed, indexes are missing or stale, or the user wants local document indexing without a search model.
4
+ license: MIT
5
+ ---
6
+
7
+ # AutoRAG Lite setup
8
+
9
+ Use this skill when the user wants AutoRAG's indexing lifecycle without a
10
+ model: initialize a config, build and refresh indexes, watch roots, and inspect
11
+ index health. Everything here is model-free. Use `autorag-setup` instead when a
12
+ search model must be configured or repaired. Use `autorag-lite-search` for
13
+ retrieval, reports, evidence, and feedback.
14
+
15
+ ## Safety
16
+
17
+ - Inspect only non-secret config metadata: `searchPaths`, `workspacePath`,
18
+ `memoryPath`, `minSync`, `jikji`, `datasources`, `datasourceAccess`.
19
+ - Never print, copy, migrate, compare, or persist credential values. Store only
20
+ environment-variable names such as `tokenEnv` or `apiKeyEnv`.
21
+ - Never move, rename, edit, or delete source documents. Lite commands write
22
+ indexes only under the configured workspace `.autorag/` directory and
23
+ Jikji's per-source `.jikji/` caches.
24
+ - Do not index system trees, app bundles, caches, credential stores,
25
+ `node_modules`, `.git`, `dist`, `build`, `target`, `.cache`, `.autorag`, or
26
+ `.jikji`.
27
+
28
+ ## Install the CLI if needed
29
+
30
+ The CLI is `@autorag/librarian` (`autorag`). Runtime is Node.js >= 24 or Bun.
31
+
32
+ ```bash
33
+ command -v autorag >/dev/null || bun install -g @autorag/librarian
34
+ autorag lite --help
35
+ ```
36
+
37
+ If Bun is unavailable, `npm install -g @autorag/librarian` is acceptable.
38
+
39
+ ## Initialize a model-free config
40
+
41
+ ```bash
42
+ autorag lite init \
43
+ --search-paths "/path/to/documents,/path/to/notes" \
44
+ --workspace "/path/to/workspace" \
45
+ --memory-path "/path/to/memory.json"
46
+ ```
47
+
48
+ `lite init` writes the configured model-free lifecycle config. Use `--force`
49
+ only when intentionally replacing an existing config. Explicit user paths win;
50
+ otherwise propose one to three document-dense roots and get approval before
51
+ indexing. Supported parsed formats are `md`, `markdown`, `txt`, `text`, `pdf`,
52
+ `docx`, `pptx`, `xlsx`, `xls`, `hwp`, `hwpx`, and `eml`. Legacy `.doc` is not
53
+ a supported parsed format.
54
+
55
+ Config resolution follows the usual order: `--config`, `AUTORAG_CONFIG`,
56
+ `$AUTORAG_HOME/config.json`, or `~/.autorag/config.json`. Environment overrides
57
+ include `AUTORAG_HOME`, `AUTORAG_CONFIG`, `AUTORAG_SEARCH_PATHS`,
58
+ `AUTORAG_WORKSPACE`, and `AUTORAG_MEMORY_PATH`.
59
+
60
+ ## Probe and configure datasources (setup wizard)
61
+
62
+ `autorag lite ui` is still in development — do not recommend it for datasource
63
+ setup. Configure datasources directly in trusted config, wizard-style:
64
+
65
+ 1. Probe every datasource for setup feasibility before asking the user
66
+ anything: the backing CLI exists (`katok`, `discrawl`, `slacrawl`,
67
+ `wacrawl`, `telecrawl`, `notcrawl`, `qmd`, `mailcrawl`, `rclone`), its
68
+ local store or archive is present, and any credentials it needs are
69
+ available as environment variables or in the tool's own external
70
+ configuration.
71
+ 2. Auto-configure every datasource that probes feasible — write its trusted
72
+ `datasources` / `datasourceAccess` entries without asking. For example,
73
+ when Slack (`slacrawl`) and Discord (`discrawl`) are installed, set both up
74
+ automatically.
75
+ 3. Skip every datasource that probes infeasible (for example Notion or
76
+ Telegram when their CLIs are not installed) and always report the skipped
77
+ list to the user, with what is missing for each.
78
+ 4. Set up a skipped datasource only when the user explicitly asks for it:
79
+ install or authenticate the backing CLI first, then configure it.
80
+ 5. E-mail datasources (`gmail`, `mail-export`, `mailcrawl`) matter to most
81
+ users — always probe them and report their status, even when they end up
82
+ skipped.
83
+
84
+ Datasource skills belong in trusted config and remain default-deny.
85
+
86
+ Config keys may be builtin template names (`kakao`, `whatsapp`, `telegram`,
87
+ `slack`, `discord`, `clawgallery`, `notion`, `github`, `cloud-drive`, `gmail`,
88
+ `mail-export`, `mailcrawl`, `obsidian`, `rss`, `spotlight`) or connection
89
+ aliases with `"type": "<template>"`. Unknown names are skipped with an
90
+ `unknown-datasource-skill` warning; they do not fail config resolution.
91
+ `datasourceAccess.allowedTags` and `allowedScopes` narrow trusted access and
92
+ can never grant it. Store only env-var names such as `tokenEnv` or
93
+ `apiKeyEnv`, never credential values.
94
+
95
+ ## Build and refresh indexes
96
+
97
+ ```bash
98
+ autorag lite refresh --json
99
+ autorag lite refresh --method parsed,minsync --json
100
+ autorag lite refresh --full --json
101
+ autorag lite refresh --force --json
102
+ ```
103
+
104
+ - A plain `refresh` is incremental: it syncs parsed mirrors, MinSync, Jikji,
105
+ and configured datasources against what changed.
106
+ - `--full` and `--force` both request a full resync. Use them only when
107
+ incremental refresh is not enough, such as after config changes to roots or
108
+ index settings.
109
+ - `--method <csv>` deliberately narrows the refresh. Valid values are
110
+ `parsed`, `minsync`, `datasources`, `jikji`, and `all`. Omit the flag to run
111
+ all methods. Unknown values are rejected.
112
+ - MinSync and Jikji auto-install on first use by default. If they are missing
113
+ or broken, run a full refresh or return to setup rather than silently
114
+ degrading to lexical-only search.
115
+ - MinSync's default embedder is local EmbeddingGemma (768 dimensions, served
116
+ locally via Ollama): no embedder flags and no API key are needed, and no
117
+ corpus text leaves the machine. During setup, verify the local model is
118
+ available (`ollama pull embeddinggemma` with `ollama serve` running);
119
+ override it only when intentionally using a remote embedder.
120
+ - Exact duplicate exclusion during refresh is enabled by default via the
121
+ external `dupey` CLI. Install dupey during setup when it is missing
122
+ (`command -v dupey || cargo install dupey`) and tell the user the feature is
123
+ available; when installation is impossible, refresh continues without it
124
+ and the user is told duplicate exclusion is off. Set
125
+ `"excludeExactDuplicates": false` to index every copy.
126
+
127
+ Retrieval requires a completed refresh. `autorag lite retrieve` before any
128
+ refresh exits with code 2 and an `index-not-ready` diagnostic; a successful
129
+ refresh is recorded even when the corpus is empty or only a non-parsed method
130
+ was selected. Always refresh first, and refresh again when roots change.
131
+ Jikji is a discovery/indexing preparer, not a lite retrieval method.
132
+
133
+ ## Watch and scheduled freshness
134
+
135
+ ```bash
136
+ autorag lite watch --once --json
137
+ autorag lite watch
138
+ ```
139
+
140
+ Prefer non-daemon `autorag lite watch --once` from cron, launchd, a systemd
141
+ user timer, or Task Scheduler, hourly by default (every 1 hour; shorten only
142
+ when the user asks for fresher indexes). Use the same config as retrieval,
143
+ avoid overlapping runs, and keep logs outside source trees. `--immediate`
144
+ triggers a first refresh on start and `--debounce-ms N` tunes change
145
+ coalescing. Once the schedule is installed, tell the user right away that
146
+ hourly freshness is set up.
147
+
148
+ ## Status and index maintenance
149
+
150
+ ```bash
151
+ autorag lite status --json
152
+ autorag lite health --json
153
+ autorag lite index rebuild --yes --json
154
+ autorag lite index reset --method parsed --yes --json
155
+ autorag lite duplicates --json
156
+ ```
157
+
158
+ - `status` shows path-opaque corpus freshness and index health. `health` is an
159
+ alias of `status`; neither resolves a model.
160
+ - `index reset` and `index rebuild` remove or rebuild only workspace
161
+ `.autorag` indexes selected by `--method`. They never target source
162
+ documents.
163
+ - `duplicates` scans duplicate document families read-only and never deletes
164
+ or moves files.
165
+
166
+ ## Unavailable components and failure handling
167
+
168
+ Missing optional components degrade gracefully: refresh and retrieval continue
169
+ with path-opaque diagnostics such as `minsync-unavailable` or
170
+ `retrieval-method-failed` instead of failing the whole run. Exit codes are 0
171
+ on success, 2 for config or usage errors, and 1 for runtime errors. When a
172
+ component stays unavailable after a full refresh, return to setup rather than
173
+ accepting silently degraded search.
174
+
175
+ ## Completion condition
176
+
177
+ Setup is complete only when the CLI is installed, roots are approved, a
178
+ non-secret model-free config is written, every datasource has been probed and
179
+ the auto-configured and skipped lists reported to the user, dupey is installed
180
+ or its absence reported, `refresh` has built the requested indexes, `status`
181
+ reports healthy indexes, and any requested watch schedule is installed or
182
+ verified with the user told it is active.
@@ -136,11 +136,21 @@ defaults to true; requires the Rust toolchain).
136
136
 
137
137
  Exact duplicate exclusion is enabled by default. AutoRAG invokes the external
138
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.
142
-
143
- Optional MinSync embedder settings:
139
+ each exact canonical-text hash, and excludes older copies from the mirror.
140
+ Install dupey during setup when it is missing (`command -v dupey || cargo
141
+ install dupey`) and tell the user the feature is available; when installation
142
+ is impossible, refresh continues without this optimization and the user is
143
+ told duplicate exclusion is off. Set `"excludeExactDuplicates": false` to
144
+ index every copy.
145
+
146
+ MinSync's default embedder is local EmbeddingGemma (768 dimensions, served
147
+ locally via Ollama). The default needs no embedder flags and no API key, and
148
+ no corpus text is sent to a remote embedding service. During setup, verify the
149
+ local model is available (`ollama pull embeddinggemma` with `ollama serve`
150
+ running) instead of silently falling back.
151
+
152
+ Override the embedder only when intentionally using a different, for example
153
+ remote, provider:
144
154
 
145
155
  ```bash
146
156
  autorag init \
@@ -152,14 +162,32 @@ autorag init \
152
162
  ```
153
163
 
154
164
  Only store the environment-variable name, never its value. Dimension and batch
155
- size must be positive integers.
156
-
157
- ## Configure datasource skills when requested
158
-
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`.
165
+ size must be positive integers, and the dimension must match the embedder
166
+ (EmbeddingGemma is 768; text-embedding-3-small is 1536).
167
+
168
+ ## Probe and configure datasource skills (setup wizard)
169
+
170
+ `autorag ui` is still in development — do not recommend it for datasource
171
+ setup. Configure datasources directly in trusted config, wizard-style:
172
+
173
+ 1. Probe every datasource for setup feasibility before asking the user
174
+ anything: the backing CLI exists (`katok`, `discrawl`, `slacrawl`,
175
+ `wacrawl`, `telecrawl`, `notcrawl`, `qmd`, `mailcrawl`, `rclone`), its
176
+ local store or archive is present, and any credentials it needs are
177
+ available as environment variables or in the tool's own external
178
+ configuration.
179
+ 2. Auto-configure every datasource that probes feasible — write its trusted
180
+ `datasources` / `datasourceAccess` entries without asking. For example,
181
+ when Slack (`slacrawl`) and Discord (`discrawl`) are installed, set both up
182
+ automatically.
183
+ 3. Skip every datasource that probes infeasible (for example Notion or
184
+ Telegram when their CLIs are not installed) and always report the skipped
185
+ list to the user, with what is missing for each.
186
+ 4. Set up a skipped datasource only when the user explicitly asks for it:
187
+ install or authenticate the backing CLI first, then configure it.
188
+ 5. E-mail datasources (`gmail`, `mail-export`, `mailcrawl`) matter to most
189
+ users — always probe them and report their status, even when they end up
190
+ skipped.
163
191
 
164
192
  Datasource skills belong in trusted config and remain default-deny. Builtin
165
193
  template names are `kakao`, `whatsapp`, `telegram`, `slack`, `discord`,
@@ -228,10 +256,12 @@ autorag search "summarize the collection" --top-k 3 --json --debug
228
256
  ## Keep indexes fresh
229
257
 
230
258
  For continuous freshness, create or verify an OS-appropriate scheduled
231
- `autorag watch --once` job, typically every 15–30 minutes. Prefer cron or
232
- launchd on macOS, cron or a user systemd timer on Linux, and Task Scheduler on
233
- Windows. Use the same config as search, avoid overlapping runs, and keep logs
234
- outside source trees.
259
+ `autorag watch --once` job, hourly by default (every 1 hour; shorten only when
260
+ the user asks for fresher indexes). Prefer cron or launchd on macOS, cron or a
261
+ user systemd timer on Linux, and Task Scheduler on Windows. Use the same
262
+ config as search, avoid overlapping runs, and keep logs outside source trees.
263
+ Once the schedule is installed, tell the user right away that hourly freshness
264
+ is set up.
235
265
 
236
266
  ## Environment overrides
237
267
 
@@ -246,6 +276,9 @@ outside source trees.
246
276
  ## Completion condition
247
277
 
248
278
  Setup is complete only when the CLI is installed, roots are approved, a
249
- non-secret single-model config is written, `status` is acceptable, live `health`
279
+ non-secret single-model config is written, every datasource has been probed
280
+ and the auto-configured and skipped lists reported to the user, dupey is
281
+ installed or its absence reported, `status` is acceptable, live `health`
250
282
  passes, `refresh` builds the requested indexes, one real structured search
251
- succeeds, and any requested ongoing schedule is installed or verified.
283
+ succeeds, and any requested ongoing schedule is installed or verified with the
284
+ user told it is active.