@autorag/librarian 2.10.5 → 2.11.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/NOTICE +14 -9
  2. package/README.md +65 -25
  3. package/dist/agent/agent.d.ts +51 -49
  4. package/dist/agent/answer-guidelines.d.ts +22 -1
  5. package/dist/agent/context-token-guard.d.ts +11 -0
  6. package/dist/agent/discord-remote.d.ts +30 -0
  7. package/dist/agent/embedding-controls.d.ts +22 -0
  8. package/dist/agent/index.d.ts +1 -2
  9. package/dist/agent/mcp-client.d.ts +27 -0
  10. package/dist/agent/pi-session.d.ts +8 -1
  11. package/dist/agent/query-decomposition.d.ts +1 -1
  12. package/dist/agent/search-documents.d.ts +2 -2
  13. package/dist/agent/search-progress.d.ts +96 -0
  14. package/dist/agent/system-prompt.d.ts +1 -1
  15. package/dist/agent/welcome-header.d.ts +35 -0
  16. package/dist/cli/commands/models.d.ts +0 -14
  17. package/dist/cli/commands/search.d.ts +3 -4
  18. package/dist/cli/commands/setup.d.ts +2 -0
  19. package/dist/cli/config.d.ts +7 -19
  20. package/dist/cli/index.d.ts +1 -1
  21. package/dist/cli/index.js +16364 -18337
  22. package/dist/cli/setup.d.ts +22 -36
  23. package/dist/cloud/config.d.ts +3 -3
  24. package/dist/core.js +7372 -9206
  25. package/dist/datasource/embedding-env.d.ts +29 -0
  26. package/dist/datasource/errors.d.ts +1 -1
  27. package/dist/datasource/index.d.ts +2 -1
  28. package/dist/datasource/sidecar/config.d.ts +3 -0
  29. package/dist/datasource/sidecar/index.d.ts +1 -1
  30. package/dist/datasource/skills/discrawl/client.d.ts +1 -0
  31. package/dist/datasource/skills/discrawl/embedding.d.ts +17 -0
  32. package/dist/datasource/skills/discrawl/types.d.ts +11 -3
  33. package/dist/datasource/skills/factory.d.ts +17 -1
  34. package/dist/datasource/skills/github-gist/semantic.d.ts +5 -5
  35. package/dist/datasource/skills/github-gist/skill.d.ts +2 -3
  36. package/dist/datasource/skills/hister/client.d.ts +83 -0
  37. package/dist/datasource/skills/hister/embedding.d.ts +64 -0
  38. package/dist/datasource/skills/hister/index.d.ts +2 -0
  39. package/dist/datasource/skills/hister/setup.d.ts +87 -0
  40. package/dist/datasource/skills/hister/skill.d.ts +63 -0
  41. package/dist/datasource/skills/lazykatok/types.d.ts +9 -1
  42. package/dist/datasource/skills/mailcrawl/types.d.ts +9 -1
  43. package/dist/datasource/skills/obsidian/index.d.ts +4 -6
  44. package/dist/datasource/skills/obsidian/methods.d.ts +13 -17
  45. package/dist/datasource/skills/obsidian/paths.d.ts +24 -24
  46. package/dist/datasource/skills/obsidian/skill.d.ts +10 -15
  47. package/dist/datasource/skills/obsidian/staging.d.ts +50 -0
  48. package/dist/datasource/skills/obsidian/vault-index.d.ts +44 -0
  49. package/dist/embedding/daemon.d.ts +57 -0
  50. package/dist/embedding/embedder.d.ts +59 -0
  51. package/dist/embedding/http-embedder.d.ts +28 -0
  52. package/dist/embedding/in-process.d.ts +19 -0
  53. package/dist/embedding/index.d.ts +28 -0
  54. package/dist/embedding/managed.d.ts +44 -0
  55. package/dist/embedding/prefixes.d.ts +18 -0
  56. package/dist/embedding/settings.d.ts +9 -0
  57. package/dist/index.js +7465 -9298
  58. package/dist/mcp/index.js +7460 -9294
  59. package/dist/memory/context.d.ts +1 -1
  60. package/dist/memory/similar-queries.d.ts +1 -1
  61. package/dist/minsync/binary.d.ts +21 -0
  62. package/dist/minsync/client.d.ts +11 -10
  63. package/dist/minsync/index.d.ts +1 -1
  64. package/dist/minsync/installer.d.ts +1 -1
  65. package/dist/minsync/method.d.ts +3 -11
  66. package/dist/minsync/process.d.ts +1 -0
  67. package/dist/minsync/types.d.ts +0 -2
  68. package/dist/minsync/workspace-lock.d.ts +7 -0
  69. package/dist/process/terminate-tree.d.ts +4 -5
  70. package/dist/retrieval/rerank.d.ts +10 -3
  71. package/licenses/hister-AGPL-3.0-notice.txt +47 -0
  72. package/package.json +4 -4
  73. package/skills/autorag/SKILL.md +9 -11
  74. package/skills/autorag-doctor/SKILL.md +50 -29
  75. package/skills/autorag-lite-setup/SKILL.md +31 -13
  76. package/skills/autorag-setup/SKILL.md +99 -26
  77. package/dist/agent/peer-target-tool.d.ts +0 -19
  78. package/dist/agent/query-peer-tool.d.ts +0 -51
  79. package/dist/cli/commands/gateway.d.ts +0 -7
  80. package/dist/cli/commands/p2p-policy.d.ts +0 -2
  81. package/dist/cli/commands/p2p.d.ts +0 -7
  82. package/dist/cli/commands/serve.d.ts +0 -19
  83. package/dist/datasource/skills/obsidian/client.d.ts +0 -15
  84. package/dist/datasource/skills/obsidian/types.d.ts +0 -92
  85. package/dist/embedding-runtime/cache.d.ts +0 -30
  86. package/dist/embedding-runtime/gateway-embedder.d.ts +0 -41
  87. package/dist/embedding-runtime/gateway.d.ts +0 -27
  88. package/dist/embedding-runtime/index.d.ts +0 -120
  89. package/dist/embedding-runtime/manifest.d.ts +0 -20
  90. package/dist/embedding-runtime/supervisor.d.ts +0 -74
  91. package/dist/embedding-runtime/types.d.ts +0 -70
  92. package/dist/p2p/approval-store.d.ts +0 -32
  93. package/dist/p2p/egress-gate.d.ts +0 -22
  94. package/dist/p2p/file-sharing.d.ts +0 -33
  95. package/dist/p2p/injection-classifier.d.ts +0 -33
  96. package/dist/p2p/injection-gate.d.ts +0 -37
  97. package/dist/p2p/pii-gate.d.ts +0 -47
  98. package/dist/p2p/policy-filter.d.ts +0 -15
  99. package/dist/p2p/policy.d.ts +0 -77
  100. package/dist/p2p/simplex-query-store.d.ts +0 -44
  101. package/dist/p2p/simplex-server.d.ts +0 -115
  102. package/dist/p2p/simplex-transport.d.ts +0 -62
  103. package/dist/p2p/wire.d.ts +0 -39
  104. package/licenses/embedding-assets.json +0 -85
  105. package/licenses/llama.cpp-MIT.txt +0 -21
  106. package/licenses/qwen3-embedding-notice.txt +0 -13
@@ -1,4 +1,4 @@
1
- import type { Embedder } from "../embedding-runtime/gateway-embedder.js";
1
+ import type { Embedder } from "../embedding/embedder.js";
2
2
  import type { JudgedEvidenceRecord } from "./judged-evidence.js";
3
3
  import type { RetrievalInsight, RetrievalMemory } from "./memory.js";
4
4
  import { type SimilarQuestion } from "./similar-queries.js";
@@ -1,4 +1,4 @@
1
- import type { Embedder } from "../embedding-runtime/gateway-embedder.js";
1
+ import type { Embedder } from "../embedding/embedder.js";
2
2
  import type { JudgedEvidenceRecord } from "./judged-evidence.js";
3
3
  /** How many similar past questions memory brings back for one question. */
4
4
  export declare const SIMILAR_QUESTION_LIMIT = 25;
@@ -0,0 +1,21 @@
1
+ import { type EnsureMinSyncBinaryOptions } from "./installer.js";
2
+ export interface ResolveMinSyncBinaryOptions {
3
+ /** Workspace project root; the cached binary lives under `<root>/.autorag/bin`. */
4
+ readonly root: string;
5
+ /** Test/embedded override; CLI config intentionally does not persist this. */
6
+ readonly binaryPath?: string;
7
+ readonly autoInstall?: boolean;
8
+ readonly installer?: Omit<EnsureMinSyncBinaryOptions, "root">;
9
+ /** False for query paths: they use an existing binary or fail, and never wait on `cargo install`. */
10
+ readonly install?: boolean;
11
+ }
12
+ /** Resolve the `minsync` executable from PATH directories. Returns the first match or undefined. */
13
+ export declare function lookupMinSyncInPath(env: NodeJS.ProcessEnv): string | undefined;
14
+ /**
15
+ * Resolve the MinSync CLI from the user's global PATH first, then the workspace cache, and finally the
16
+ * verified auto-install fallback. Throws {@link MinSyncRequiredError}: MinSync is required, so there is
17
+ * no "no binary" value to degrade on.
18
+ */
19
+ export declare function resolveMinSyncBinary(options: ResolveMinSyncBinaryOptions): Promise<string>;
20
+ /** True when no `minsync` is resolvable right now without installing one. */
21
+ export declare function isMinSyncBinaryMissing(options: Pick<ResolveMinSyncBinaryOptions, "root" | "binaryPath">): boolean;
@@ -1,18 +1,9 @@
1
- import type { EnsuredRuntime } from "../embedding-runtime/index.js";
2
1
  import type { MinSyncEmbedderConfig, MinSyncQueryHit, MinSyncSyncResult } from "./types.js";
3
- export declare const MINSYNC_OLLAMA_MIGRATION_MESSAGE = "This workspace uses the legacy 768-dimensional Ollama/TEI embedding path. Reindex explicitly, or pin an explicit Ollama/TEI embedder config before using the new default runtime.";
4
- export interface MinSyncRuntime {
5
- ensureRuntime(options?: {
6
- readonly profileId?: MinSyncEmbedderConfig["profile"];
7
- readonly cachedOnly?: boolean;
8
- }): Promise<EnsuredRuntime>;
9
- }
10
2
  export interface MinSyncClientOptions {
11
3
  readonly binaryPath: string;
12
4
  readonly workspacePath: string;
13
5
  readonly embedder?: MinSyncEmbedderConfig;
14
6
  readonly maxChunkSize?: number;
15
- readonly runtime?: MinSyncRuntime;
16
7
  }
17
8
  /** MinSync's native query modes: vector, BM25, and hybrid. */
18
9
  export type MinSyncQueryMode = "vector" | "bm25" | "hybrid";
@@ -31,8 +22,12 @@ export declare class MinSyncClient {
31
22
  private readonly workspacePath;
32
23
  private readonly embedder;
33
24
  private readonly maxChunkSize;
34
- private readonly runtime;
35
25
  constructor(options: MinSyncClientOptions);
26
+ /**
27
+ * What MinSync is told to embed with. No `id`, or a `native:` id, is MinSync's own Qwen3 engine, which
28
+ * MinSync provisions and runs (in-process, or through a `minsync serve` daemon it finds on its own).
29
+ * Anything else is an endpoint the operator configured, passed through untouched.
30
+ */
36
31
  private effectiveEmbedder;
37
32
  private readIdentity;
38
33
  private writeIdentity;
@@ -50,4 +45,10 @@ export declare class MinSyncClient {
50
45
  private checkAndSync;
51
46
  query(text: string, topK: number, mode?: MinSyncQueryMode, signal?: AbortSignal): Promise<readonly MinSyncQueryHit[]>;
52
47
  private spawn;
48
+ /**
49
+ * MinSync's `openai:` embedder reads its bearer token from `OPENAI_API_KEY` only. The operator names the
50
+ * variable that holds their key with `apiKeyEnv`, so that value is what the child receives as
51
+ * `OPENAI_API_KEY`. A local `native:` embedder needs no key and the environment is left as it is.
52
+ */
53
+ private childEnv;
53
54
  }
@@ -1,4 +1,4 @@
1
- export { MINSYNC_OLLAMA_MIGRATION_MESSAGE, MinSyncClient, type MinSyncClientOptions, MinSyncQueryError, type MinSyncQueryMode, } from "./client.js";
1
+ export { MinSyncClient, type MinSyncClientOptions, MinSyncQueryError, type MinSyncQueryMode, } from "./client.js";
2
2
  export { configuredVectorDimension, DEFAULT_MINSYNC_EMBEDDER_CONFIG, DEFAULT_MINSYNC_EMBEDDER_DIMENSION, DEFAULT_MINSYNC_EMBEDDER_ID, MINSYNC_CONFIG_DIR, MINSYNC_CONFIG_FILE, type MinSyncEmbeddingIdentity, minSyncConfigPath, minSyncEmbeddingIdentityPath, rewriteEmbedderConfig, } from "./embedder-config.js";
3
3
  export { MinSyncRequiredError } from "./errors.js";
4
4
  export { type EnsureMinSyncBinaryOptions, ensureMinSyncBinary, executableName, fetchLatestMinSyncRelease, type InstalledMinSyncBinary, MINSYNC_VERSION, type MinSyncRelease, type MinSyncReleaseAsset, MinSyncReleaseError, selectReleaseAsset, } from "./installer.js";
@@ -1,4 +1,4 @@
1
- export declare const MINSYNC_VERSION = "0.4.10";
1
+ export declare const MINSYNC_VERSION = "0.4.11";
2
2
  export declare const MINSYNC_CARGO_INSTALL_TIMEOUT_MS: number;
3
3
  export interface MinSyncReleaseAsset {
4
4
  readonly name: string;
@@ -1,7 +1,6 @@
1
1
  import type { RetrievalMethod, RetrievalMethodDescriptor, RetrievalOptions, RetrievalResult } from "../retrieval/types.js";
2
2
  import type { MinSyncQueryMode } from "./client.js";
3
- import { type MinSyncRuntime } from "./client.js";
4
- import { type EnsureMinSyncBinaryOptions } from "./installer.js";
3
+ import type { EnsureMinSyncBinaryOptions } from "./installer.js";
5
4
  import type { MinSyncEmbedderConfig, MinSyncSyncResult } from "./types.js";
6
5
  export interface MinSyncVectorMethodOptions {
7
6
  readonly root: string;
@@ -13,7 +12,6 @@ export interface MinSyncVectorMethodOptions {
13
12
  readonly embedder?: MinSyncEmbedderConfig;
14
13
  readonly maxChunkSize?: number;
15
14
  readonly mode?: MinSyncQueryMode;
16
- readonly runtime?: MinSyncRuntime;
17
15
  /** Default `topK` used when the caller omits one. Default 50. */
18
16
  readonly defaultTopK?: number;
19
17
  /** Fetch cap applied when a scope narrows the query. Default 100. */
@@ -29,7 +27,6 @@ export declare class MinSyncVectorMethod implements RetrievalMethod {
29
27
  private readonly embedder;
30
28
  private readonly maxChunkSize;
31
29
  private readonly mode;
32
- private readonly runtime;
33
30
  private readonly defaultTopK;
34
31
  private readonly scopedTopK;
35
32
  constructor(options: MinSyncVectorMethodOptions);
@@ -45,13 +42,8 @@ export declare class MinSyncVectorMethod implements RetrievalMethod {
45
42
  retrieve(query: string, options: RetrievalOptions): Promise<RetrievalResult[]>;
46
43
  private retrieveUnlocked;
47
44
  /**
48
- * Resolve the MinSync CLI from the user's global PATH first, then the
49
- * workspace cache, and finally the verified auto-install fallback. The
50
- * auto-install runs only for `sync` (refresh); queries pass
51
- * `install: false` so a user's turn never waits on `cargo install`.
52
- *
53
- * Returns the executable path, or throws {@link MinSyncRequiredError}:
54
- * MinSync is required, so there is no "no binary" value to degrade on.
45
+ * Queries pass `install: false` so a user's turn never waits on `cargo install`; only `sync` (refresh)
46
+ * may install. See {@link resolveMinSyncBinary}.
55
47
  */
56
48
  protected resolveBinary(options?: {
57
49
  readonly install?: boolean;
@@ -8,4 +8,5 @@ export interface ProcessResult {
8
8
  export declare function spawnProcess(command: string, args: readonly string[], cwd: string, options?: {
9
9
  readonly timeoutMs?: number;
10
10
  readonly signal?: AbortSignal;
11
+ readonly env?: NodeJS.ProcessEnv;
11
12
  }): Promise<ProcessResult>;
@@ -1,8 +1,6 @@
1
1
  /** Embedder configuration for MinSync vector indexing. Shared by config and method layers. */
2
2
  import type { MinSyncLexicalLanguage } from "./lexical-language.js";
3
3
  export interface MinSyncEmbedderConfig {
4
- /** Select an AutoRAG-owned embedding runtime profile. */
5
- readonly profile?: "qwen3-embedding-0.6b";
6
4
  readonly id?: string;
7
5
  readonly baseUrl?: string;
8
6
  /** Environment variable name whose value holds the embedder API key. /^[A-Za-z_][A-Za-z0-9_]*$/ */
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Run a sync (anything that rewrites the workspace). The in-flight count is raised
3
+ * before this returns, so a query issued right after the call already sees the sync.
4
+ */
5
+ export declare function runWorkspaceSync<T>(workspacePath: string, run: () => Promise<T>): Promise<T>;
6
+ /** Run a query. It is refused while a sync is pending, because the index is mid-rewrite. */
7
+ export declare function runWorkspaceQuery<T>(workspacePath: string, run: () => Promise<T>): Promise<T>;
@@ -4,11 +4,10 @@ export declare const TREE_KILL_GRACE_MS = 500;
4
4
  /**
5
5
  * Terminate a spawned external CLI together with the descendants it created.
6
6
  *
7
- * CLIs such as qmd 2.8.3 are launchers: the process AutoRAG spawns starts a
8
- * runtime descendant that inherits the launcher's stdout/stderr pipes. Node
9
- * emits `close` only once every holder of those pipes has exited, so signalling
10
- * just the direct child leaves the caller waiting on a descendant that may live
11
- * for minutes — the hang reported in #1578.
7
+ * CLIs that are launchers (an npm shim, a wrapper script) start a runtime descendant that inherits
8
+ * the launcher's stdout/stderr pipes. Node emits `close` only once every holder of those pipes has
9
+ * exited, so signalling just the direct child leaves the caller waiting on a descendant that may
10
+ * live for minutes — the hang reported in #1578.
12
11
  *
13
12
  * Spawn the child with `detached: true` on POSIX so it leads its own process
14
13
  * group; the group survives the direct child and stays addressable as `-pid`.
@@ -24,6 +24,13 @@ export declare const DEFAULT_RERANK_API_KEY_ENV = "OPENROUTER_API_KEY";
24
24
  * chat LLMs, so the project's 2026+ model rule does not cover them.
25
25
  */
26
26
  export declare const DEFAULT_DAZZI_RERANK_MODEL = "qwen/qwen3-reranker-8b";
27
+ /**
28
+ * Default per-request rerank timeout. A reranker that never answers would stall
29
+ * the fast answer. Measured against the hosted reranker, a 172-document pool
30
+ * takes ~15s and a 300-document pool ~45s, so 60s clears the largest baseline
31
+ * pool (3 x 100 candidates) with headroom.
32
+ */
33
+ export declare const DEFAULT_RERANK_TIMEOUT_MS = 60000;
27
34
  /** Default number of merged chunks kept after reranking. */
28
35
  export declare const DEFAULT_RERANK_TOP_N = 25;
29
36
  /** Rerank providers {@link createReranker} can build. */
@@ -65,7 +72,7 @@ export interface Reranker {
65
72
  */
66
73
  rerank(query: string, results: readonly RetrievalResult[], options?: RerankOptions): Promise<RetrievalResult[]>;
67
74
  }
68
- /** Minimal rerank client shape, so tests can inject a fake without the SDK. */
75
+ /** Minimal rerank client shape, so tests can inject a fake without network access. */
69
76
  export interface RerankClient {
70
77
  rerank(request: {
71
78
  requestBody: {
@@ -78,7 +85,7 @@ export interface RerankClient {
78
85
  signal?: AbortSignal;
79
86
  }): Promise<RerankResponse>;
80
87
  }
81
- /** Response body returned by OpenRouter's rerank router. */
88
+ /** Rerank response as {@link OpenRouterReranker} consumes it. */
82
89
  export interface RerankResponse {
83
90
  readonly results: ReadonlyArray<{
84
91
  readonly index: number;
@@ -123,7 +130,7 @@ export interface CreateRerankerOptions extends OpenRouterRerankerOptions {
123
130
  */
124
131
  export declare function createReranker(config: CreateRerankerOptions | false | undefined): Reranker | undefined;
125
132
  /**
126
- * Reranker backed by an OpenRouter-compatible rerank router.
133
+ * Reranker backed by an OpenRouter-compatible rerank endpoint.
127
134
  *
128
135
  * OpenRouter is the default provider; the hosted Dazzi Models plan serves the
129
136
  * same wire shape at `<root>/v1/rerank`, so {@link createReranker} reuses this
@@ -0,0 +1,47 @@
1
+ Hister — license notice for AutoRAG's `hister` datasource
2
+ ==========================================================
3
+
4
+ Program: Hister ("Your own search engine")
5
+ Source: https://github.com/asciimoo/hister
6
+ Copyright: asciimoo and Hister contributors (see the repository history)
7
+ License: GNU Affero General Public License, version 3 or (at your option)
8
+ any later version (AGPL-3.0-or-later)
9
+ License text: https://www.gnu.org/licenses/agpl-3.0.txt
10
+ (also the LICENSE file in the Hister repository)
11
+
12
+ How AutoRAG relates to Hister
13
+ -----------------------------
14
+ * AutoRAG does NOT contain, bundle, link, vendor, or redistribute any Hister
15
+ source code or binary. Nothing from the Hister repository is copied into
16
+ this package.
17
+ * Users install Hister themselves, unmodified, from its own releases
18
+ (https://github.com/asciimoo/hister/releases, `brew install hister`, Docker,
19
+ or Nix), and run it as a separate process (`hister listen`).
20
+ * AutoRAG talks to that process only over HTTP, using Hister's public JSON API
21
+ (`GET /search`, `GET /api/config`), the same API Hister's own `hister search`
22
+ command uses. Hister owns its index, its browser extension, its credentials,
23
+ and its optional embedding calls.
24
+ * AutoRAG does not modify Hister, and it never hides that Hister is the backend:
25
+ the datasource manifest shown to the agent names Hister, its license, and its
26
+ source URL.
27
+ * The `hister` datasource only reads web-page documents (`type:web`). It never
28
+ enables or uses Hister's local-directory indexing.
29
+
30
+ Combining separate programs that communicate over a network is "mere
31
+ aggregation" in the sense of the GNU licenses FAQ
32
+ (https://www.gnu.org/licenses/gpl-faq.html#MereAggregation); AutoRAG therefore
33
+ stays under its own license (Apache-2.0).
34
+
35
+ If you run Hister as a network service for other people, AGPL-3.0 section 13
36
+ applies to YOU as the operator of that Hister instance: you must offer those
37
+ users the Corresponding Source of the Hister version you run (and of any
38
+ modifications you made). Running an unmodified upstream release satisfies this
39
+ by pointing users at https://github.com/asciimoo/hister.
40
+
41
+ Obtaining the Hister source for a release you run
42
+ -------------------------------------------------
43
+ git clone https://github.com/asciimoo/hister
44
+ git checkout <the version printed by `hister --version`>
45
+
46
+ This file is a notice, not the license. The authoritative license terms are in
47
+ the Hister repository and at the AGPL URL above.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@autorag/librarian",
3
- "version": "2.10.5",
4
- "description": "Self-evolving librarian agent on Pi framework with pluggable retrieval methods",
3
+ "version": "2.11.0",
4
+ "description": "Personal librarian agent for office work on the Pi framework, with pluggable retrieval methods",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
@@ -44,7 +44,6 @@
44
44
  "check": "biome check --write .",
45
45
  "lint": "biome check .",
46
46
  "typecheck": "tsc --noEmit",
47
- "check:embedding-manifest": "node scripts/check-embedding-manifest.mjs",
48
47
  "supply-chain": "bun scripts/supply-chain/evaluate.ts gate --sbom sbom.local.cdx.json"
49
48
  },
50
49
  "engines": {
@@ -57,8 +56,8 @@
57
56
  "@earendil-works/pi-tui": "1.2.0",
58
57
  "@llblab/pi-telegram": "0.57.2",
59
58
  "@modelcontextprotocol/server": "^2.3.1",
60
- "@openrouter/sdk": "^1.4.25",
61
59
  "chardet": "^2.2.0",
60
+ "discord.js": "14.27.0",
62
61
  "fast-xml-parser": "^5.11.2",
63
62
  "iconv-lite": "^0.7.3",
64
63
  "jev-use": "^0.8.0",
@@ -66,6 +65,7 @@
66
65
  "kordoc": "^4.21.30",
67
66
  "mailparser": "^3.9.38",
68
67
  "pdfjs-dist": "^6.4.299",
68
+ "pi-discord-remote": "0.2.4",
69
69
  "puppeteer-core": "^25.13.0",
70
70
  "slides-grab": "^1.5.2",
71
71
  "smol-toml": "1.9.1",
@@ -15,10 +15,13 @@ search, calls MinSync, Jikji, datasource, and filesystem tools, reads
15
15
  sources, judges evidence, and curates the final answer. There is no subagent or
16
16
  separate model role.
17
17
 
18
- AutoRAG reads source documents and writes indexes only under the configured
18
+ Indexing and refresh read source documents and write only under the configured
19
19
  workspace `.autorag/` directory and Jikji's central store (`<OS data dir>/jikji/`,
20
- plus a `.jikji_agent_map.md` guide in each indexed root). Never
21
- move, rename, edit, or delete source files.
20
+ plus a `.jikji_agent_map.md` guide in each indexed root). The librarian may
21
+ organize, create, or modify the user's own files in local sessions when the
22
+ user asks; it never deletes permanently (OS trash only) and lists every change
23
+ as old path → new path. Do not move, rename, edit, or delete source files on your own
24
+ initiative while searching or diagnosing.
22
25
 
23
26
  ## Preflight
24
27
 
@@ -142,8 +145,6 @@ autorag index rebuild --yes --json
142
145
  autorag index reset --method parsed --yes --json
143
146
  autorag memory inspect --json
144
147
  autorag tui
145
- autorag serve --force
146
- autorag p2p policy list --json
147
148
  ```
148
149
 
149
150
  Prefer a full refresh so parsed mirrors, MinSync, Jikji, configured
@@ -153,9 +154,7 @@ aligned. `--method` accepts
153
154
  a `--method` name. Use `--method` only for deliberate narrowing. Scheduled
154
155
  maintenance should use non-daemon `autorag watch --once`, typically every
155
156
  1 hour, with the same config used by search and no overlapping runs.
156
- `autorag tui` is the shipped beta terminal UI. `autorag serve` / `autorag p2p`
157
- are opt-in SimpleX peer sharing (disabled until `p2p.enabled` is true, unless
158
- `--force`).
157
+ `autorag tui` is the shipped beta terminal UI.
159
158
 
160
159
  Reset and rebuild commands remove only selected workspace `.autorag` indexes.
161
160
  Never target source documents. `memory inspect` is read-only and path-opaque.
@@ -169,8 +168,7 @@ Never target source documents. `memory inspect` is read-only and path-opaque.
169
168
  - Preserve real source mapping.
170
169
  - Prefer `--json --debug` when another agent consumes search output.
171
170
  - Do not invent CLI commands. `autorag --help` is the command list of record,
172
- including the shipped `setup`, `gateway`, `models`, `serve`, `p2p`, `tui`, and `lite`
171
+ including the shipped `setup`, `models`, `tui`, and `lite`
173
172
  commands. `autorag <command> --help` prints that command's own flags, and
174
173
  `autorag --version` prints the installed version. See
175
- `docs/embedding-runtime.md` for the local embedding runtime
176
- and gateway setup.
174
+ `docs/minsync-setup.md#embedding-backends` for MinSync setup and embedding-backend selection.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: autorag-doctor
3
- description: Diagnose and repair a broken or half-working AutoRAG install so every configured source is both indexed and searchable. Checks AutoRAG, MinSync, Jikji, the embedding gateway, and every CLI-backed datasource (lazykatok, discrawl, slacrawl, wacrawl, telecrawl, notcrawl, qmd, mailcrawl, rclone, Spotlight), then fixes orphan locks, orphan processes, embedding dimension or identity mismatches, stale indexes, and missing setup. Use when search returns nothing or too little, refresh hangs or fails, a datasource disappeared from results, indexes look stale, the gateway will not start, or the user asks to check, diagnose, verify, or repair AutoRAG.
3
+ description: Diagnose and repair a broken or half-working AutoRAG install so every configured source is both indexed and searchable. Checks AutoRAG, MinSync, Jikji, the embedding backend, and every CLI-backed datasource (lazykatok, discrawl, slacrawl, wacrawl, telecrawl, notcrawl, mailcrawl, rclone, Spotlight), then fixes orphan locks, orphan processes, embedding dimension or identity mismatches, stale indexes, and missing setup. Use when search returns nothing or too little, refresh hangs or fails, a datasource disappeared from results, indexes look stale, the embedder is unavailable, or the user asks to check, diagnose, verify, or repair AutoRAG.
4
4
  license: Apache-2.0
5
5
  ---
6
6
 
@@ -15,9 +15,10 @@ Always finish with the status table in [Report](#report).
15
15
 
16
16
  ## Safety
17
17
 
18
- - Never delete, move, or edit source documents.
18
+ - Diagnosis and repair never delete, move, or edit source documents; a doctor
19
+ run changes only AutoRAG-owned state.
19
20
  - Never delete a datasource's **native** store (`~/Library/Application Support/katok`, `~/.discrawl`,
20
- `~/.mailcrawl`, `.qmd`, Telegram/WhatsApp/Notion archives). AutoRAG only
21
+ `~/.mailcrawl`, Telegram/WhatsApp/Notion archives). AutoRAG only
21
22
  reads them; rebuilding them is the owning CLI's job.
22
23
  - Only AutoRAG-owned state under `AUTORAG_HOME` and the workspace `.autorag`
23
24
  directory may be reset.
@@ -29,7 +30,7 @@ Always finish with the status table in [Report](#report).
29
30
  ```bash
30
31
  autorag status --json
31
32
  autorag health --json
32
- autorag gateway status --format json
33
+ autorag setup --format json
33
34
  ```
34
35
 
35
36
  - `status` reports `state`, `stale`, `diagnostics`, and per-component state for
@@ -38,8 +39,12 @@ autorag gateway status --format json
38
39
  - `health` resolves the single search model and does one live completion probe.
39
40
  `--skip-probes` only proves config shape, never live access; do not claim a
40
41
  healthy model from it.
41
- - The gateway is on-demand: `stopped` is normal when nothing is embedding.
42
- `unavailable` **while** a refresh is running is a real failure.
42
+ - `setup --format json` reports `embedding.backend` (`remote`, `daemon`, or
43
+ `in-process`) and the resolved `provider`/`model`/`dimension` when a backend
44
+ is alive, or `embedding.reason` and a `remediation` when none is. It only
45
+ probes; it never starts a daemon. Semantic search needs the daemon (or a
46
+ remote endpoint) to be running: a backend that is absent is a real
47
+ `embedding-unavailable` state, not normal.
43
48
 
44
49
  Config lives at `--config`, `AUTORAG_CONFIG`, `$AUTORAG_HOME/config.json`, or
45
50
  `~/.autorag/config.json`. Read `searchPaths`, `workspacePath`, `minSync`,
@@ -65,7 +70,7 @@ Each CLI owns its archive, so ask the CLI, not AutoRAG. A datasource is only
65
70
  | WhatsApp | `wacrawl --json doctor` | `wacrawl import` |
66
71
  | Telegram | `telecrawl --json doctor`, `telecrawl --json status` | `telecrawl import` |
67
72
  | Notion | `notcrawl doctor`, `notcrawl status` | `notcrawl sync --source desktop` |
68
- | Obsidian / notes | `qmd status` | `qmd update && qmd embed` |
73
+ | Obsidian / notes | `autorag status` (AutoRAG-owned index) | `autorag refresh --method datasources`; if corrupt, delete `.autorag/datasources/obsidian/<instance>` first |
69
74
  | Mail | `mailcrawl doctor`, `mailcrawl status` | `mailcrawl sync && mailcrawl index` |
70
75
  | Cloud drive | `rclone listremotes` | `autorag refresh --method datasources` |
71
76
  | Spotlight (macOS) | `mdutil -s /` | indexed by the OS; no AutoRAG sync |
@@ -129,19 +134,30 @@ autorag search "summarize the collection" --top-k 3 --json --debug
129
134
 
130
135
  ## 4. Repair playbook
131
136
 
132
- ### Orphan lock
137
+ ### Stuck embedding daemon
133
138
 
134
- The embedding runtime keeps `embedding-runtime.lock`, `embedding-runtime.pid`,
135
- and `embedding-runtime.port` in `AUTORAG_HOME`. It reclaims them automatically
136
- when the recorded PID is dead; a `lock-conflict` means the PID is **alive**.
139
+ AutoRAG owns no lock or pid file for embeddings. A running `minsync serve`
140
+ publishes `host`, `port`, and `pid` under `~/.cache/minsync/serve/<instance>/`
141
+ and removes them on a clean stop. A leftover file from a crashed daemon is
142
+ harmless: AutoRAG only adopts a daemon whose `GET /health` answers as a loopback
143
+ server of the wanted model, so a stale entry is skipped.
137
144
 
138
145
  ```bash
139
- autorag gateway status --format json
140
- autorag gateway stop
146
+ ls ~/.cache/minsync/serve/* 2>/dev/null
147
+ autorag setup --format json
141
148
  ```
142
149
 
143
- Only when `gateway stop` cannot clear it, and the recorded PID is confirmed
144
- dead (`kill -0 PID` fails), remove the three files by hand and retry.
150
+ To diagnose an embedding backend that is not alive, `setup --format json` and
151
+ `status` say so (`embedding.reason`, and the `embedding-unavailable`
152
+ diagnostic). AutoRAG never starts the daemon: run `minsync serve
153
+ --idle-timeout 0` by hand (or as a launchd/systemd service, see
154
+ `docs/minsync-setup.md`) and read its own error, or press Ctrl+Shift+E in the
155
+ TUI. When no daemon answers and the in-process addon
156
+ (`@nomadamas/minsync-native`) is missing, that is the `embedder-unavailable`
157
+ state. The daemon stops itself after `--idle-timeout` seconds (default 300), so
158
+ a semantic failure after a quiet spell usually means it timed out. Stop an
159
+ orphaned daemon by the pid from `~/.cache/minsync/serve/<instance>/pid` after
160
+ confirming no live refresh holds it.
145
161
 
146
162
  Index locks are owned by their engines: MinSync/tantivy locks under
147
163
  `<workspace>/.autorag/`, and per-CLI locks such as
@@ -152,11 +168,12 @@ that holds it.
152
168
  ### Orphan process
153
169
 
154
170
  ```bash
155
- pgrep -fl 'autorag|autorag-gateway|minsync' | grep -v pgrep
171
+ pgrep -fl 'autorag|minsync' | grep -v pgrep
156
172
  ```
157
173
 
158
- A refresh that was killed mid-run can leave the gateway or a `minsync` child
159
- alive. Stop the gateway with `autorag gateway stop` first; only kill a PID
174
+ A refresh that was killed mid-run can leave a `minsync serve` daemon or a
175
+ `minsync` child alive. A daemon idle-stops itself; stop a confirmed orphan by
176
+ the pid from `~/.cache/minsync/serve/<instance>/pid`, and only kill a PID
160
177
  directly when it is confirmed orphaned (no parent CLI, no live refresh).
161
178
  Re-run `autorag status --json` afterwards to confirm `inFlight: false`.
162
179
 
@@ -167,16 +184,21 @@ were built with a different embedder than the configured one. Vectors of two
167
184
  different dimensions can never be compared, so the index must be rebuilt:
168
185
 
169
186
  ```bash
170
- autorag models prefetch --profile qwen3-embedding-0.6b
171
187
  autorag index rebuild --method minsync
172
188
  ```
173
189
 
174
- The current default is the local `native:Qwen/Qwen3-Embedding-0.6B` runtime at
175
- 1024 dimensions. A workspace still pinned to the legacy 768-dimension
176
- Ollama/TEI path must be reindexed explicitly, or pinned to an explicit profile.
177
- Changing `embedder.dimension` in config **without** a rebuild leaves retrieval
178
- silently empty. Keep embeddings local; do not point the embedder at a remote
179
- endpoint to work around a local failure.
190
+ The default is MinSync's local `Qwen/Qwen3-Embedding-0.6B` engine at 1024
191
+ dimensions, reached through a running `minsync serve` daemon or, failing that,
192
+ MinSync's in-process engine. Both report one identity (`provider: minsync`), so
193
+ a store never re-embeds because the daemon appeared or went away. Vectors
194
+ written by the removed local Q8_0 gateway engine are **not** compatible: their
195
+ identity changed, so the memory store (`memory.json.vectors.db`), chat-sidecar
196
+ semantic DBs, and the gist `vectors.json` re-embed on the next refresh, while a
197
+ MinSync workspace created through the old gateway profile needs
198
+ `autorag index rebuild --method minsync` (or
199
+ `autorag index reset --method minsync --yes` then refresh). Changing the
200
+ embedder's `dimension` in config **without** a rebuild leaves retrieval silently
201
+ empty.
180
202
 
181
203
  ### Stale index
182
204
 
@@ -208,7 +230,7 @@ to retry those files once without re-indexing healthy ones.
208
230
  (`cargo install minsync`) or leave `minSync.autoInstall` on, then retry.
209
231
  - `jikji-unavailable`: the binary is missing and auto-install failed. It
210
232
  installs through cargo; verify the Rust toolchain, then `autorag refresh --method jikji` to retry.
211
- - `auth-error` / `rate-limited`: model or datasource credentials. Report the
233
+ - `datasource-auth-error` / `datasource-rate-limited`: datasource credentials or quota. Report the
212
234
  missing environment-variable **name** and let the user supply it.
213
235
  - A configured datasource that returns nothing is a native store, connector, or
214
236
  query problem — every configured connection is searchable. Run its native
@@ -227,13 +249,12 @@ to retry those files once without re-indexing healthy ones.
227
249
  | `jikji-unavailable` | Jikji binary missing or install failed | Check cargo, retry refresh |
228
250
  | `everything-index-failed` | Windows Everything instance could not start or index; message carries ES exit code and stderr | Fix the reported cause, `autorag refresh --method everything --json` |
229
251
  | `embedding-identity-mismatch` | Indexed vectors use a different embedder | `autorag index rebuild --method minsync` |
230
- | `embedder-unavailable` | Embedding gateway or runtime down | `autorag gateway status --format json` |
231
- | `lock-conflict` | Another runtime holds the lock | `autorag gateway stop` |
252
+ | `embedder-unavailable` | No remote endpoint answered, no daemon could start, and the in-process addon is missing or failed | Run `minsync serve` by hand to read its error, install MinSync (`cargo install minsync`) or `@nomadamas/minsync-native`, or configure a remote `minSync.embedder` |
232
253
  | `datasource-index-failed` | Backing CLI failed to index | Run that CLI's own doctor |
233
254
  | `datasource-empty` | Store has no matching content | Re-sync with the CLI, or accept as empty |
234
255
  | `unknown-datasource-skill` | Config name is not a known template | Fix the name or add `"type"` |
235
256
  | `retrieval-method-failed` | One method errored during the query | Read `--debug` diagnostics |
236
- | `auth-error` | Credentials missing or rejected | Report the env var name |
257
+ | `datasource-auth-error` | Datasource credentials missing or rejected | Report the env var name |
237
258
  | `query-route-fallback` | Jev routing unavailable (often `OPENROUTER_API_KEY` unset); searched local with the original question | `test -n "$OPENROUTER_API_KEY"`; report the env var name, never its value |
238
259
  | `query-decomposition-failed` | Decomposition model call failed; searched the original question | Check `queryDecomposition.model` resolves (`autorag models list --provider openrouter`) |
239
260
  | `follow-up-check-fallback` | Jev post-fast-answer check unavailable; the run verified | Same as `query-route-fallback` |
@@ -17,9 +17,9 @@ Use `autorag-setup` instead when the model-backed librarian must be configured.
17
17
  `memoryPath`, `minSync`, `jikji`, `datasources`.
18
18
  - Never print, copy, migrate, compare, or persist credential values. Store only
19
19
  environment-variable names such as `tokenEnv` or `apiKeyEnv`.
20
- - Never move, rename, edit, or delete source documents. Lite commands write
21
- indexes only under the configured workspace `.autorag/` directory and
22
- Jikji's central store (`<OS data dir>/jikji/`).
20
+ - Setup and Lite commands never move, rename, edit, or delete source documents.
21
+ They write indexes only under the configured workspace `.autorag/` directory
22
+ and Jikji's central store (`<OS data dir>/jikji/`).
23
23
  - Do not index system trees, app bundles, caches, credential stores,
24
24
  `node_modules`, `.git`, `dist`, `build`, `target`, `.cache`, `.autorag`, or
25
25
  `.jikji`.
@@ -113,7 +113,7 @@ setup. Configure datasources directly in trusted config, wizard-style:
113
113
 
114
114
  1. Probe every datasource for setup feasibility before asking the user
115
115
  anything: the backing CLI exists (`lazykatok`, `discrawl`, `slacrawl`,
116
- `wacrawl`, `telecrawl`, `notcrawl`, `qmd`, `mailcrawl`, `rclone`) and its
116
+ `wacrawl`, `telecrawl`, `notcrawl`, `mailcrawl`, `rclone`) and its
117
117
  local store or archive is present. CLI-backed datasources own their own
118
118
  archive, index, and authentication, so environment credentials (such as bot
119
119
  tokens) are never required or checked for them. Non-CLI connectors
@@ -137,7 +137,7 @@ Datasource skills belong in trusted config.
137
137
 
138
138
  Config keys may be builtin template names (`kakao`, `whatsapp`, `telegram`,
139
139
  `slack`, `discord`, `clawgallery`, `notion`, `github`, `cloud-drive`,
140
- `mail-export`, `mailcrawl`, `obsidian`, `rss`, `spotlight`, `lark`) or connection
140
+ `mail-export`, `mailcrawl`, `obsidian`, `rss`, `spotlight`, `lark`, `hister`) or connection
141
141
  aliases with `"type": "<template>"`. Unknown names are skipped with an
142
142
  `unknown-datasource-skill` warning; they do not fail config resolution.
143
143
  `scope` narrows a query to a sub-path as ordinary filtering. Tags are
@@ -146,6 +146,24 @@ select configured connections before retrieval; discover their IDs with
146
146
  `autorag.datasources.list`. Store only env-var names such as `tokenEnv` or
147
147
  `apiKeyEnv`, never credential values.
148
148
 
149
+ ### Browser history (Hister) and the shared embedding model
150
+
151
+ `hister` needs a separately installed, always-running Hister server (AGPL-3.0, never
152
+ bundled by AutoRAG). Run `autorag setup --format json` and read the `hister` object
153
+ (`installed`, `running`, `embedding`); each problem carries the exact command to run:
154
+ `brew install hister`, `brew services start hister`, then install the Hister browser
155
+ extension in the user's browser.
156
+
157
+ Hister embeds with its own `semantic_search` config, so it must use the same model as
158
+ AutoRAG (the `minsync serve` daemon, `Qwen/Qwen3-Embedding-0.6B`, 1024 dimensions) or
159
+ its vectors stop lining up without any error. `autorag setup --sync-hister` copies the
160
+ shared settings into Hister's `config.yml` (backup kept), restarts the service, waits
161
+ for it, and runs `hister reindex` when needed; it is idempotent, and it refuses a
162
+ remote or in-process backend. Re-run it after restarting the `minsync serve` daemon
163
+ (its port changes). Verify with `hister doctor`: `server.index.embeddings` must be `ok`.
164
+ Install a skip list in Hister's `rules.json` before importing past history, because the
165
+ importer re-downloads URLs without the browser's cookies (docs/datasource-skills.md).
166
+
149
167
  ## Build and refresh indexes
150
168
 
151
169
  After connecting, call MCP `autorag.refresh` with `{}` for an incremental run.
@@ -168,14 +186,14 @@ AUTORAG_CONFIG=/absolute/path/to/.autorag/config.json autorag lite refresh --jso
168
186
  MinSync and Jikji auto-install during refresh (never during a query). If they
169
187
  are missing or broken, run a full refresh or return to setup rather than
170
188
  silently degrading to lexical-only search.
171
- - MinSync's default embedder is in-process native Qwen3 embeddings
172
- (`native:Qwen/Qwen3-Embedding-0.6B`, 1024 dimensions, MinSync 0.4.10): no
173
- embedder flags, no API key, and no external daemon (such as Ollama) are
174
- needed, and no corpus text leaves the machine. For gateway-profiled
175
- embeddings, prefetch with `autorag models prefetch --profile qwen3-embedding-0.6b`.
176
- The legacy Ollama/TEI adapter path (EmbeddingGemma, 768 dimensions) is for
177
- manual QA only. Override the embedder only when intentionally using a
178
- different provider.
189
+ - AutoRAG owns no embedding model; MinSync provisions
190
+ `Qwen/Qwen3-Embedding-0.6B` (1024 dimensions) in `~/.cache/minsync/models`. A
191
+ configured remote `minSync.embedder` is used first; otherwise a running
192
+ `minsync serve` daemon (started by `refresh`/`watch`, never by a search), and
193
+ failing that MinSync's in-process engine via the optional
194
+ `@nomadamas/minsync-native` addon. The local default needs no embedder flags
195
+ and no API key. Override the embedder only when intentionally using a remote
196
+ provider.
179
197
  - Exact duplicate exclusion during refresh is enabled by default via the
180
198
  external `dupey` CLI. Install dupey during setup when it is missing
181
199
  (`command -v dupey || cargo install dupey --locked`) and tell the user the feature is