@autorag/librarian 2.5.1 → 2.5.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.
Files changed (73) hide show
  1. package/NOTICE +3 -0
  2. package/README.md +229 -490
  3. package/dist/agent/agent.d.ts +44 -2
  4. package/dist/agent/index.d.ts +1 -0
  5. package/dist/agent/search-datasource-tool.d.ts +1 -0
  6. package/dist/agent/search-single-datasource-tool.d.ts +57 -0
  7. package/dist/agent/web-fetch-tool.d.ts +32 -0
  8. package/dist/agent/web-search-tool.d.ts +48 -0
  9. package/dist/cli/commands/lite-retrieve.d.ts +15 -0
  10. package/dist/cli/commands/search.d.ts +6 -0
  11. package/dist/cli/config.d.ts +20 -0
  12. package/dist/cli/index.js +6478 -372
  13. package/dist/core.d.ts +3 -1
  14. package/dist/core.js +6499 -409
  15. package/dist/datasource/connector-skill.d.ts +6 -0
  16. package/dist/datasource/crawler-skill.d.ts +2 -0
  17. package/dist/datasource/errors.d.ts +26 -0
  18. package/dist/datasource/skills/slack/index.d.ts +8 -0
  19. package/dist/datasource/tool-naming.d.ts +11 -0
  20. package/dist/index.js +6508 -419
  21. package/dist/minsync/types.d.ts +7 -0
  22. package/dist/retrieval/engine.d.ts +14 -5
  23. package/dist/retrieval/index.d.ts +2 -1
  24. package/dist/retrieval/merger.d.ts +30 -5
  25. package/dist/retrieval/skip.d.ts +41 -0
  26. package/dist/retrieval/types.d.ts +23 -2
  27. package/dist/web/entities.d.ts +10 -0
  28. package/dist/web/fetch/convert.d.ts +35 -0
  29. package/dist/web/fetch/feeds.d.ts +37 -0
  30. package/dist/web/fetch/html-renderer.d.ts +54 -0
  31. package/dist/web/fetch/index.d.ts +12 -0
  32. package/dist/web/fetch/negotiate.d.ts +27 -0
  33. package/dist/web/fetch/page-loader.d.ts +60 -0
  34. package/dist/web/fetch/render.d.ts +23 -0
  35. package/dist/web/fetch/turndown/gfm.d.ts +11 -0
  36. package/dist/web/fetch/turndown/html.d.ts +5 -0
  37. package/dist/web/fetch/turndown/index.d.ts +10 -0
  38. package/dist/web/fetch/turndown/service.d.ts +21 -0
  39. package/dist/web/fetch/turndown/types.d.ts +73 -0
  40. package/dist/web/fetch/url-target.d.ts +29 -0
  41. package/dist/web/search/browser-headers.d.ts +17 -0
  42. package/dist/web/search/browser-loader.d.ts +56 -0
  43. package/dist/web/search/browser-page.d.ts +41 -0
  44. package/dist/web/search/credentials.d.ts +10 -0
  45. package/dist/web/search/format.d.ts +30 -0
  46. package/dist/web/search/index.d.ts +46 -0
  47. package/dist/web/search/model-auth.d.ts +36 -0
  48. package/dist/web/search/provider.d.ts +62 -0
  49. package/dist/web/search/providers/anthropic.d.ts +9 -0
  50. package/dist/web/search/providers/base.d.ts +106 -0
  51. package/dist/web/search/providers/codex.d.ts +9 -0
  52. package/dist/web/search/providers/duckduckgo.d.ts +22 -0
  53. package/dist/web/search/providers/ecosia.d.ts +29 -0
  54. package/dist/web/search/providers/gemini.d.ts +9 -0
  55. package/dist/web/search/providers/google.d.ts +22 -0
  56. package/dist/web/search/providers/mojeek.d.ts +24 -0
  57. package/dist/web/search/providers/parallel.d.ts +10 -0
  58. package/dist/web/search/providers/perplexity.d.ts +10 -0
  59. package/dist/web/search/providers/public.d.ts +15 -0
  60. package/dist/web/search/providers/responses-api.d.ts +26 -0
  61. package/dist/web/search/providers/searxng.d.ts +19 -0
  62. package/dist/web/search/providers/startpage.d.ts +25 -0
  63. package/dist/web/search/providers/utils.d.ts +39 -0
  64. package/dist/web/search/providers/xai.d.ts +9 -0
  65. package/dist/web/search/query.d.ts +193 -0
  66. package/dist/web/search/types.d.ts +198 -0
  67. package/dist/web/search/utils.d.ts +8 -0
  68. package/package.json +2 -1
  69. package/skills/autorag/SKILL.md +2 -1
  70. package/skills/autorag-doctor/SKILL.md +237 -0
  71. package/skills/autorag-lite-search/SKILL.md +29 -7
  72. package/skills/autorag-lite-setup/SKILL.md +20 -13
  73. package/skills/autorag-setup/SKILL.md +32 -14
package/README.md CHANGED
@@ -1,591 +1,330 @@
1
- # AutoRAG
1
+ # AutoRAG Agent
2
2
 
3
- **A self-evolving librarian agent for document collections.**
3
+ **Now your agent can find anything in your computer.**
4
+
5
+ <p align="left">
6
+ <a href="https://www.npmjs.com/package/@autorag/librarian"><img src="https://img.shields.io/npm/v/@autorag/librarian.svg?style=flat-square&color=38bdf8" alt="npm version" /></a>
7
+ <a href="https://www.npmjs.com/package/@autorag/librarian"><img src="https://img.shields.io/npm/dm/@autorag/librarian.svg?style=flat-square&color=818cf8" alt="npm downloads" /></a>
8
+ <a href="https://github.com/Marker-Inc-Korea/AutoRAG/stargazers"><img src="https://img.shields.io/github/stars/Marker-Inc-Korea/AutoRAG?style=flat-square&logo=github&color=f59e0b" alt="GitHub stars" /></a>
9
+ <a href="https://github.com/Marker-Inc-Korea/AutoRAG/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/Marker-Inc-Korea/AutoRAG/ci.yml?branch=main&label=CI&style=flat-square" alt="CI Status" /></a>
10
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg?style=flat-square" alt="License: MIT" /></a>
11
+ <img src="https://img.shields.io/badge/node-%3E%3D24.0.0-informational.svg?style=flat-square" alt="Node >= 24" />
12
+ <img src="https://img.shields.io/badge/bun-%3E%3D1.2-black.svg?style=flat-square&logo=bun" alt="Bun >= 1.2" />
13
+ </p>
14
+
15
+ <p align="center">
16
+ <img src="assets/autorag-agent-social-preview.png" alt="AutoRAG Agent" width="100%" />
17
+ </p>
4
18
 
5
19
  > [!IMPORTANT]
6
20
  > **Looking for the original AutoRAG (RAG AutoML / pipeline optimization tool)?**
7
21
  > This repository now hosts **AutoRAG 2.0**, a complete reimagining of AutoRAG as a self-evolving librarian agent. The original Python-based AutoRAG — the RAG AutoML tool for automatically finding an optimal RAG pipeline for your data — now lives in the [`legacy/`](legacy/) directory of this repository.
8
22
  >
9
- > **The legacy AutoRAG is NOT abandoned.** It continues to be maintained (bug fixes, dependency updates, and PyPI releases via `pip install AutoRAG`) in maintenance mode. Existing users can keep using it exactly as before — see the [legacy README](legacy/README.md) for its documentation, and file issues in this repository as usual. New feature development is focused on AutoRAG 2.0.
23
+ > **The legacy AutoRAG is NOT abandoned.** It continues to be maintained (bug fixes, dependency updates, and PyPI releases via `pip install AutoRAG`) in maintenance mode. Existing users can keep using it exactly as before — see the [legacy README](legacy/README.md) for its documentation, and file issues in this repository as usual. New feature development is focused on AutoRAG Agent (2.0).
10
24
 
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.
25
+ ---
12
26
 
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.
27
+ ## What is AutoRAG Agent?
14
28
 
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.
29
+ Search tools dump file paths and matching lines — forcing you to open files, read context, and synthesize answers yourself.
18
30
 
19
- ## Core values
31
+ **AutoRAG Agent is a self-evolving librarian agent.** Built on the [Pi](https://github.com/earendil-works/pi-mono) agent framework, a single configured model searches across multiple retrieval methods, opens source documents directly via `bash` to verify ground truth, and curates answers into clean, numbered knowledge units:
20
32
 
21
- Three principles drive every design decision:
22
-
23
- 1. **Never migrate your data to search it.** AutoRAG federates CLI-owned
24
- stores (katok, discrawl, qmd, msgvault, rclone, …) in place. No forced
25
- ingestion into a central index, no third-party server holding a copy of
26
- your corpus. Results carry source-native identities
27
- (`/kakao/<instance>/chunks/<chunk>`) with scope-checked access — see the
28
- [competitive landscape study](docs/competitive-landscape-2026-09.md) for
29
- why this is the durable differentiator.
30
- 2. **Just works — no RAG degree required.** Install it and it works: minimal
31
- configuration, no pipeline tuning, no vector-DB operations, no API keys.
32
- The local embedder (EmbeddingGemma via Ollama) and MinSync auto-install
33
- handle the "RAG plumbing" invisibly.
34
- 3. **Fast by design.** One configured model owns the whole loop; retrieval
35
- runs locally over MinSync CDC chunks (BM25 / vector / hybrid); interactive
36
- search is optimized for low latency.
33
+ ```text
34
+ You ask: "What changes were made to the cloud infrastructure contract in Q3?"
37
35
 
38
- ## Why AutoRAG
36
+ AutoRAG Agent:
37
+ [1] Enterprise Compute Discount — AWS annual discount tier increased to 28% based on commitment volume. (contracts/cloud-2026.pdf:p.4)
38
+ [2] Regional Data Residency — Explicit compliance clause pinning customer data storage to the Seoul AWS region. (/slack/legal-ops/chunks/318)
39
+ [3] SLA Guarantee — Guaranteed uptime threshold adjusted to 99.95% with penalty credits starting at 15 minutes downtime. (contracts/sla-addendum.md:lines 45-62)
40
+ ```
39
41
 
40
- ### The problem with search tools
42
+ ---
41
43
 
42
- Every search tool gives you the same thing: a list of file paths and matching lines. Then *you* have to:
43
- - Open each file
44
- - Read the surrounding context
45
- - Decide what's relevant
46
- - Synthesize an answer
47
- - Remember what worked for next time
44
+ ## Core Values
48
45
 
49
- That's the human doing all the hard work. The tool just points.
46
+ <p align="center">
47
+ <img src="assets/autorag-agent-principles.png" alt="AutoRAG Agent Core Principles" width="100%" />
48
+ </p>
50
49
 
51
- ### AutoRAG does the hard work
50
+ Three principles drive every design decision in AutoRAG Agent:
52
51
 
53
- AutoRAG is not a search tool. It's a **librarian** — it searches, reads, thinks, and reports back:
52
+ 1. **Never migrate your data to search it.** Traditional RAG systems force you to upload, ETL, and duplicate your files into a centralized vector database. AutoRAG Agent federates your data **in place**, querying CLI-native stores (`katok`, `discrawl`, `slacrawl`, `mailcrawl`, `rclone`, `qmd`) where your data already lives. Results retain opaque, source-native identities (`/kakao/...`, `/slack/...`) that preserve local access control and privacy. *(See our [Competitive Landscape Study](docs/competitive-landscape-2026-09.md) on why in-place federation is the durable differentiator).*
54
53
 
55
- ```
56
- You ask: "What were the key findings in the Q3 report?"
54
+ 2. **Just works — no RAG degree required.** No pipeline tuning, no vector-DB maintenance, and no remote embedding API keys. AutoRAG Agent automatically manages [MinSync](docs/minsync-setup.md) for incremental Change Data Capture (CDC) chunking and provides a local [embedding gateway](docs/embedding-runtime.md) out of the box with zero external telemetry.
57
55
 
58
- AutoRAG:
59
- [1] Revenue grew 23% YoY to $4.2M, driven by enterprise contracts. (pages 3-5)
60
- [2] Three new risk factors: supply chain, regulatory, talent retention. (pages 12-14)
61
- [3] Headcount target missed by 12 — engineering hiring bottleneck. (page 8)
62
- ```
56
+ 3. **Fast by design.** Rather than coordinating slow multi-agent hierarchies, a single configured model owns the entire retrieval, direct-read, and curation loop. Local CDC chunks (BM25, vector, and hybrid modes) deliver rapid, low-latency turnaround across multi-turn research queries.
63
57
 
64
- No file paths. No line numbers. Just curated knowledge you can act on.
58
+ ---
65
59
 
66
- ### It gets smarter over time
60
+ ## Architecture & How It Works
67
61
 
68
- AutoRAG has a **self-evolving memory system**. Every search teaches it something:
62
+ AutoRAG Agent orchestrates five integrated subsystems:
69
63
 
70
- - Which retrieval methods work for which types of queries
71
- - Which document areas are most productive
72
- - What the caller found useful (via explicit feedback)
64
+ 1. **Self-Evolving Memory System (`check_memory`):** Before querying, the agent consults historical outcomes stored in `~/.autorag/memory.json` to prioritize retrieval methods that have proven successful for similar queries.
65
+ 2. **Pluggable Multi-Method Retrieval:**
66
+ - **BM25 Lexical Search:** Fast keyword ranking via MinSync over parsed markdown mirrors.
67
+ - **Semantic Vector Search:** Dense vector retrieval over CDC chunks via the built-in embedding gateway.
68
+ - **Hybrid Search:** Combines BM25 and vector ranking via Reciprocal Rank Fusion (RRF).
69
+ - **Jikji Find-First Discovery:** Local CLI-backed fast discovery answer packs.
70
+ - **Datasource Skills:** Server-authorized federated retrieval across external applications.
71
+ 3. **Result Merger & Scoped Access Gate:** Cross-method deduplication, score normalization, and default-deny permission checks.
72
+ 4. **Direct Evidence Reading (`bash`):** The agent directly opens and inspects promising files with `cat`, `grep`, or `find` to verify facts against ground truth.
73
+ 5. **Curation & Active Feedback:** Structured findings are returned via `emit_autorag_results`. When callers provide feedback on which items were useful, AutoRAG records this to optimize future queries.
73
74
 
74
- A fresh AutoRAG tries everything. A seasoned one knows exactly where to look. This is not a static configuration — it's learned behavior from real usage.
75
+ ---
75
76
 
76
- ### Multiple retrieval methods, one interface
77
+ ## 🤖 For AI Agents & LLMs: Setup & Skills
77
78
 
78
- Different documents need different search strategies:
79
+ If you are an AI coding agent or LLM (Claude Code, Cursor, Windsurf, Codex, Senpi, Pi, etc.) tasked with installing, configuring, or querying AutoRAG Agent, use our built-in skills located in the [`skills/`](skills/) directory:
79
80
 
80
- | Your documents | Best method | Why |
81
+ | Skill | Directory | When to Use |
81
82
  |---|---|---|
82
- | Plain text, config files | grep (pattern matching) | Fast, precise, literal |
83
- | Research papers, dense prose | Vector search (semantic) | Understands meaning, not just keywords |
84
- | Legal documents, specifications | BM25 (keyword ranking) | Handles domain terminology well |
85
- | Mixed collections | Hybrid (vector + BM25) | Combines precision and recall |
83
+ | **`autorag`** | [`skills/autorag/`](skills/autorag/SKILL.md) | Querying, searching, comparing, and summarizing documents with an already configured AutoRAG librarian. |
84
+ | **`autorag-setup`** | [`skills/autorag-setup/`](skills/autorag-setup/SKILL.md) | Installing AutoRAG, configuring models, adding document roots/datasources, running health checks, and repairing indexes. |
85
+ | **`autorag-lite-setup`** | [`skills/autorag-lite-setup/`](skills/autorag-lite-setup/SKILL.md) | Initializing and maintaining the model-free AutoRAG Lite lifecycle without an LLM. |
86
+ | **`autorag-lite-search`** | [`skills/autorag-lite-search/`](skills/autorag-lite-search/SKILL.md) | Performing model-free retrieval, reporting evidence, and recording feedback without an LLM. |
87
+
88
+ ### Quick Agent Workflow
89
+
90
+ 1. **Install CLI:**
91
+ ```bash
92
+ command -v autorag >/dev/null || bun install -g @autorag/librarian
93
+ ```
94
+ 2. **Inspect & Preflight:**
95
+ ```bash
96
+ autorag status --json # check corpus freshness and index readiness
97
+ autorag duplicates --json # scan for exact or near-duplicate document families
98
+ ```
99
+ 3. **Perform Curated Search:**
100
+ ```bash
101
+ autorag search "your question" --json
102
+ ```
103
+ 4. **Safety Guidelines for Agents:**
104
+ - **Never delete, move, or modify original user documents.**
105
+ - AutoRAG writes index artifacts strictly into `<workspace>/.autorag/` and `.jikji/` caches.
106
+ - Never print or leak API keys, tokens, or credential values into stdout or logs.
107
+
108
+ ---
109
+
110
+ ## ⚡ AutoRAG Lite: Model-Free Retrieval Engine
111
+
112
+ Need blazing fast local search without configuring an LLM or paying for API tokens? Use **AutoRAG Lite**.
113
+
114
+ AutoRAG Lite provides the exact same high-performance indexing, BM25 ranking, and local MinSync vector/hybrid retrieval engine as the full librarian, but **runs 100% model-free**:
115
+
116
+ - **Zero LLM Token Usage:** Run purely local BM25 and vector search offline.
117
+ - **Agent Integration Ready:** Use `autorag lite retrieve` inside your own agentic workflows to supply raw context chunks to an external model.
118
+ - **Fast Local CLI:** Instant responses directly from your terminal.
86
119
 
87
- 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.
88
-
89
- 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.
90
-
91
- See [docs/minsync-setup.md](docs/minsync-setup.md) for automatic installation,
92
- managed binary paths, and the local EmbeddingGemma QA flow.
93
-
94
- ### Real directory access
95
-
96
- 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.
97
-
98
- ### Thin PDF extraction retry
120
+ ```bash
121
+ # Initialize a model-free workspace
122
+ autorag lite init --search-paths ./documents
99
123
 
100
- The default PDF parser performs a cheap quality check for multi-page PDFs.
101
- When local markdown is unusually sparse (fewer than 800 characters or fewer
102
- than 40 characters per detected page, for at least three pages), it retries
103
- through OpenDataLoader's `docling-fast` hybrid backend with `hybridMode:
104
- "auto"` and a 30-second timeout. Dense PDFs are not retried, and hybrid is
105
- never used for single-page PDFs or as the first path for images.
124
+ # Index local files and datasources
125
+ autorag lite refresh
106
126
 
107
- The gate is parser-owned and can be tuned through trusted programmatic
108
- `parserOptions`:
127
+ # Retrieve ranked document chunks (returns JSON candidates with scores)
128
+ autorag lite retrieve "compliance policy exception process" --top-k 5 --json
109
129
 
110
- ```typescript
111
- new AutoRAGAgent({
112
- searchPaths: ["/path/to/documents"],
113
- parserOptions: {
114
- thinExtract: {
115
- minPages: 3,
116
- minChars: 800,
117
- minCharsPerPage: 40,
118
- timeoutMs: 30_000,
119
- hybrid: "docling-fast",
120
- hybridMode: "auto",
121
- },
122
- },
123
- });
130
+ # Check index status and freshness
131
+ autorag lite status
124
132
  ```
125
133
 
126
- If the hybrid sidecar is missing, times out, or fails, AutoRAG keeps the local
127
- markdown and emits `pdf-extract-thin` plus `pdf-hybrid-unavailable`
128
- diagnostics; refresh remains successful.
134
+ ---
129
135
 
130
- ### Default Jikji discovery and indexing
136
+ ## 🔌 Supported Datasources
131
137
 
132
- 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.
138
+ AutoRAG Agent connects to external tools and communication platforms using dedicated datasource skills. Data remains in each tool's native store — AutoRAG does not copy or ingest foreign databases into a centralized store:
133
139
 
134
- 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.
140
+ | Datasource | Skill Alias | Backend / Driver | Storage & Privacy Model | Search Capabilities |
141
+ |---|---|---|---|---|
142
+ | **Local Documents** | `local` | Native filesystem & MinSync | Workspace-local parsed mirrors (`.autorag/`) | BM25, Semantic, Hybrid |
143
+ | **KakaoTalk** | `katok` | [`katok`](https://github.com/NomaDamas/katok) CLI | Native KakaoTalk archive; zero direct DB access | BM25, Semantic, Hybrid |
144
+ | **Discord** | `discord` | [`discrawl`](https://github.com/openclaw/discrawl) CLI | Native SQLite archive; token-free wiretap mode | BM25, Semantic, Hybrid |
145
+ | **WhatsApp** | `whatsapp` | [`wacrawl`](https://github.com/openclaw/wacrawl) CLI | Local-first incremental archive + FTS5 | Lexical FTS5 |
146
+ | **Telegram** | `telegram` | [`telecrawl`](https://github.com/openclaw/telecrawl) CLI | Local-first desktop archive + FTS5 | Lexical FTS5 |
147
+ | **Slack** | `slack` | [`slacrawl`](https://github.com/openclaw/slacrawl) CLI | Local workspace/channel/thread archive + FTS5 | Lexical FTS5 |
148
+ | **Notion** | `notion` | [`notcrawl`](https://github.com/openclaw/notcrawl) CLI | Local page/database/block archive + FTS5 | Lexical FTS5 |
149
+ | **Email Archives** | `mailcrawl` | [`mailcrawl`](https://github.com/NomaDamas/mailcrawl) CLI | Local Gmail, IMAP, and Maildir storage | BM25, Semantic, Hybrid |
150
+ | **Local Mail Export**| `mail-export` | Built-in `.mbox` / `.eml` parser | Local filesystem mailboxes | Lexical |
151
+ | **Obsidian Vaults** | `obsidian` | [`qmd`](https://github.com/tobi/qmd) CLI | Direct markdown vault indexing | BM25, Semantic |
152
+ | **GitHub** | `github` | GitHub REST API | In-memory fetched Issues and Pull Requests | Lexical, Scoped |
153
+ | **Cloud Drives** | `cloud-drive` | [`rclone`](https://rclone.org) CLI | Google Drive (Tier-1), OneDrive, Dropbox, etc. | Incremental Mirror + BM25 |
154
+ | **Photos & Shots** | `clawgallery` | `clawgallery` CLI | Local screenshot and photo store | Hybrid OCR/Visual Search |
155
+ | **RSS / News** | `rss` | Native HTTP Poller | RSS 2.0 & Atom feeds (24h deduplication) | Lexical |
156
+ | **macOS Spotlight** | `spotlight` | Native `mdfind` CLI | macOS system metadata and content index | System Native |
135
157
 
136
- New `autorag init` configs include `"jikji": {}`. To opt out, set `"jikji": false` in `config.json`; programmatic callers can pass `jikji: false`.
158
+ For configuration syntax and connector details, see [docs/datasource-skills.md](docs/datasource-skills.md).
137
159
 
138
- Programmatic use:
139
-
140
- ```typescript
141
- const agent = new AutoRAGAgent({
142
- searchPaths: ["/path/to/documents"],
143
- });
144
- await agent.prepareJikji();
145
- ```
160
+ ---
146
161
 
147
- ### Duplicate document management with dupey
162
+ ## Installation & Setup
148
163
 
149
- AutoRAG can use the external [`dupey`](https://github.com/NomaDamas/dupey) CLI
150
- to detect exact, near, and containment document families.
164
+ AutoRAG Agent is published as `@autorag/librarian` (requires Node.js ≥ 24 or Bun):
151
165
 
152
166
  ```bash
153
- autorag duplicates /path/to/documents
154
- autorag duplicates --json
155
- ```
156
-
157
- The command is read-only: it reports exact duplicate groups and review
158
- guidance, but never moves or deletes source files. The `scan_duplicate_documents`
159
- Agent tool exposes the same read-only scan to the orchestrator.
160
-
161
- Exact duplicate exclusion is enabled by default during parsed-mirror refresh.
162
- For each exact canonical-text hash, the newest filesystem copy is indexed and
163
- older copies are omitted. Disable it in `config.json` when both copies must be
164
- searchable:
167
+ # Install CLI globally
168
+ bun install -g @autorag/librarian
169
+ # or with npm:
170
+ npm install -g @autorag/librarian
165
171
 
166
- ```json
167
- {
168
- "dupey": { "enabled": true },
169
- "excludeExactDuplicates": false
170
- }
171
- ```
172
-
173
- If `dupey` is not installed or fails, refresh continues without exclusion and
174
- reports no destructive action; install it with `cargo install dupey`.
175
-
176
- The same configuration shape customizes Jikji when needed:
177
-
178
- ```json
179
- {
180
- "enabled": true,
181
- "binaryPath": "jikji",
182
- "timeoutMs": 10000,
183
- "maxBufferBytes": 1048576,
184
- "includeHidden": false,
185
- "includeSensitive": false,
186
- "maxFiles": 0,
187
- "writeAgentRules": false,
188
- "enableMediaIndex": false,
189
- "exclude": []
190
- }
191
- ```
192
-
193
- Call `agent.prepareJikji()` (or `agent.refresh()`) to prepare configured source roots. Hidden files, sensitive files, and media indexing are disabled by default; AutoRAG does not pass `--include-hidden`, `--include-sensitive`, or `--enable-media-index` unless the corresponding option is `true`. AutoRAG-managed prepare runs with `--no-agent-rules` by default, so it never rewrites the consumer repo's `AGENTS.md`/`CLAUDE.md`/`.cursorrules`; an explicit `writeAgentRules: true` opt-in re-enables upstream routing-block injection. AutoRAG passes `--enable-media-index` only when `enableMediaIndex: true`.
194
-
195
- The upstream Rust `PrepareArgs` defines reference defaults that AutoRAG does not override unless explicitly configured: parse timeout `5.0`, max hash bytes `512 MiB`, doc text max chars `2,000,000`, doc text chunk chars `1,000,000`, and media index max MB `25.0`. AutoRAG emits `--parse-timeout`, `--max-hash-bytes`, `--doc-text-max-chars`, `--doc-text-chunk-chars`, and `--media-index-max-mb` only when the matching option is set, so the upstream defaults apply otherwise. AutoRAG answers queries through `jikji find` (find-first) plus the Pi agent loop and its registered retrieval methods; `prepare`/`refresh` are indexing-only.
196
-
197
- ### Datasource skills
198
-
199
- 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.
200
-
201
- Every datasource can be registered multiple times through a connection alias:
202
- use the config key as the unique name and set `type` to the reusable backend
203
- (`mailcrawl`, `github`, `slack`, `discord`, `kakao`, `cloud-drive`, and so on).
204
- Each alias becomes an independently loadable agent skill with its own source
205
- scope and workspace namespace. Chat aliases search all channels by default;
206
- trusted `channels.ids` / `channels.names` allowlists can expose a particular
207
- channel or group chat as its own datasource.
208
-
209
- Security defaults are intentionally strict:
210
-
211
- - datasource access is default-deny unless trusted server/API configuration supplies `datasourceAccess.allowedTags`; `allowedScopes` applies only to datasource methods that advertise the `scoped` capability;
212
- - model/tool arguments never grant datasource tags or scopes;
213
- - `search_datasource_documents` accepts only `{ query, topK?, scope? }`, and `scope` can only narrow trusted access.
214
-
215
- #### Supported datasources
216
-
217
- | Datasource | Skill | Connects via | Notes |
218
- |---|---|---|---|
219
- | KakaoTalk | `katok` | external [`katok`](https://github.com/NomaDamas/katok) CLI | first datasource skill; AutoRAG never reads KakaoTalk databases directly |
220
- | WhatsApp | `whatsapp` | external [`wacrawl`](https://github.com/openclaw/wacrawl) CLI | local-first incremental archive + FTS5 search; live desktop ingestion is macOS-only |
221
- | Telegram | `telegram` | external [`telecrawl`](https://github.com/openclaw/telecrawl) CLI | local-first archive + FTS5 search; live desktop ingestion is macOS-only |
222
- | Slack | `slack` | external [`slacrawl`](https://github.com/openclaw/slacrawl) CLI | local-first workspace/channel/thread archive + FTS5 search |
223
- | Discord | `discord` | external [`discrawl`](https://github.com/openclaw/discrawl) CLI | guild/channel/thread/DM archive; FTS5 + semantic + hybrid retrieval, incremental sync |
224
- | Notion | `notion` | external [`notcrawl`](https://github.com/openclaw/notcrawl) CLI | local-first page/database/block archive + FTS5 search |
225
- | GitHub Issues/PRs | `github` | GitHub REST (token optional) | issues + PR bodies per `owner/repo`; public repos work unauthenticated |
226
- | Cloud drives | `cloud-drive` | **[`rclone`](https://rclone.org) CLI** | Incremental Google Drive Tier-1; OneDrive/network remotes; iCloud experimental |
227
- | Local mail exports | `mail-export` | filesystem (`.mbox` / `.eml`) | classic `From_` splitting, mailparser-based; count-only warnings |
228
- | Mail archives | `mailcrawl` | external [`mailcrawl`](https://github.com/NomaDamas/mailcrawl) CLI | local email sync plus BM25, semantic, and hybrid retrieval |
229
- | 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` |
230
- | RSS / news | `rss` | HTTP feed polling | RSS 2.0 + Atom, feed/category hierarchy, 24h dedupe window |
231
- | ClawGallery | `clawgallery` | external `clawgallery` CLI (`cargo install clawgallery`) | local screenshots and photos; incremental bootstrap + hybrid search |
232
- | macOS Spotlight | `spotlight` | built-in `mdfind` | macOS only; no extra install; Full Disk Access for protected files |
233
-
234
- Connector-backed skills fetch documents into AutoRAG's local chunk store. External-crawler skills such as KakaoTalk, WhatsApp, Telegram, Slack, and Notion leave incremental archive and FTS ownership with their CLI and map query results into the same retrieval pipeline. Obsidian uses the external `qmd` CLI (incremental update + BM25 + semantic). Tokens are referenced by environment variable name only, never stored in config. Process/API failures surface as path/PII-opaque diagnostics. See [docs/manual-qa-datasources.md](docs/manual-qa-datasources.md) for the QA harnesses.
235
-
236
- Configure them in `config.json` (CLI) or pass `datasourceSkills` programmatically:
237
-
238
- ```jsonc
239
- {
240
- "datasources": {
241
- "whatsapp": { "instanceId": "personal", "connector": { "binaryPath": "wacrawl" } },
242
- "telegram": { "instanceId": "personal", "connector": { "binaryPath": "telecrawl" } },
243
- "slack": { "connector": { "binaryPath": "slacrawl", "configPath": "/path/to/slacrawl.yaml", "syncSource": "primary" } },
244
- "notion": { "connector": { "binaryPath": "notcrawl", "configPath": "/path/to/notcrawl.yaml" } },
245
- "github": { "connector": { "repos": ["owner/repo"] } },
246
- "mailcrawl": { "instanceId": "personal", "connector": { "account": "personal", "mailbox": "INBOX", "binaryPath": "mailcrawl" } },
247
- "personal-google-drive": { "type": "cloud-drive", "instanceId": "personal", "connector": { "provider": "google-drive", "remote": "personal-gdrive:", "include": ["**/*.md"] } },
248
- "company-onedrive": { "type": "cloud-drive", "instanceId": "work", "connector": { "provider": "onedrive", "remote": "company-onedrive:Documents" } },
249
- "obsidian": { "connector": { "vaultPath": "/path/to/vault" } },
250
- "rss": { "connector": { "feeds": [{ "url": "https://example.com/feed.xml" }] } }
251
- },
252
- "datasourceAccess": {
253
- "allowedTags": ["whatsapp", "telegram", "slack", "notion", "github", "mailcrawl", "cloud-drive", "obsidian", "rss"],
254
- "allowedScopes": ["/whatsapp/**", "/telegram/**", "/slack/**", "/notion/**", "/github/**", "/mailcrawl/**", "/personal-google-drive/**", "/company-onedrive/**", "/obsidian/**", "/rss/**"]
255
- }
256
- }
172
+ # Add as a TypeScript/JavaScript library
173
+ bun add @autorag/librarian
257
174
  ```
258
175
 
259
- Install wacrawl with `brew install openclaw/tap/wacrawl`. AutoRAG invokes `wacrawl sync` during datasource refresh and `wacrawl --json --sync never search` during retrieval. Optional trusted connector fields are `binaryPath`, `databasePath`, and `sourcePath`. The child process receives only a restricted environment; unrelated model/provider secrets are not forwarded. Live WhatsApp Desktop discovery requires macOS and the permissions documented by wacrawl, while an existing portable archive can be queried on other supported platforms.
176
+ ### System Prerequisites
260
177
 
261
- Install telecrawl with `brew install openclaw/tap/telecrawl`. AutoRAG invokes `telecrawl import` during datasource refresh and `telecrawl --json search` during retrieval. It uses the same optional trusted connector fields and restricted child environment as wacrawl. Live Telegram Desktop discovery requires macOS and the permissions documented by telecrawl, while an existing portable archive can be queried on other supported platforms.
178
+ - **Java 11 or newer:** Required for PDF parsing via `@opendataloader/pdf`. Check with `java -version`.
179
+ - **Rust Toolchain (Optional):** Automatically compiles Jikji (`jikji-cli`) if installed.
180
+ - **MinSync:** Automatically downloaded and installed into `<workspace>/.autorag/bin` on first run.
262
181
 
263
- Install slacrawl with `brew install openclaw/tap/slacrawl`. AutoRAG invokes `slacrawl sync` during datasource refresh and `slacrawl --json search` during retrieval. Optional trusted connector fields are `binaryPath`, `configPath`, and `syncSource`. Slack credentials and source definitions remain in slacrawl's own configuration rather than AutoRAG.
182
+ ---
264
183
 
265
- Install notcrawl with `brew install openclaw/tap/notcrawl`. AutoRAG invokes `notcrawl sync` during datasource refresh and `notcrawl search` during retrieval (notcrawl has no `--json` flag through v0.6.2; AutoRAG parses its tab-separated hits). Optional trusted connector fields are `binaryPath` and `configPath`. Notion credentials and workspace definitions remain in notcrawl's own configuration rather than AutoRAG.
266
-
267
- Install and configure [`mailcrawl`](https://github.com/NomaDamas/mailcrawl)
268
- `@nomadamas/mailcrawl@0.1.6` or newer separately (0.1.4 is the minimum). AutoRAG invokes
269
- `mailcrawl sync` followed by `mailcrawl index` during datasource refresh, then
270
- calls `mailcrawl search` in BM25, semantic, or hybrid mode. The archive remains
271
- in mailcrawl's native store unless the operator explicitly sets
272
- `connector.dataDir`; Himalaya credentials and provider configuration remain
273
- owned by mailcrawl. 0.1.3 and earlier fail a repeated
274
- `index` after a no-op sync.
275
- Use `mailcrawl` for Gmail, IMAP, and Maildir retrieval. The former Gmail REST
276
- datasource and `gmail` + `backend: "himalaya"` connector are removed.
277
-
278
- Install and authenticate rclone separately (`brew install rclone && rclone
279
- config` on macOS), then configure the provider-neutral `cloud-drive` skill.
280
- `cloud-drive` is a reusable `type`: each datasource config key is a connection
281
- alias and becomes a separate agent skill and scope. Multiple Google accounts,
282
- or Google Drive plus OneDrive/iCloud, can therefore be loaded and searched
283
- independently.
284
- AutoRAG inventories with `rclone lsjson`, keeps a workspace-local manifest and
285
- managed mirror, and downloads only added or changed indexable files. Google
286
- Drive is Tier-1. OneDrive, Dropbox, SMB/SFTP/WebDAV, and mounted drives share
287
- the same manifest contract. iCloud Drive is experimental because rclone marks
288
- that backend Tier 4 and Apple ID/2FA sessions periodically require
289
- reauthentication. See [docs/datasource-skills.md](docs/datasource-skills.md)
290
- for filtering, size, concurrency, bandwidth, dry-run, and agent tool-calling
291
- details.
292
-
293
- #### KakaoTalk (katok)
294
-
295
- 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.
184
+ ## Quick Start
296
185
 
297
- ```typescript
298
- import { AutoRAGAgent, KatokSkill } from "@autorag/librarian";
186
+ ### 1. Initialize and Index
299
187
 
300
- const kakao = new KatokSkill({
301
- instanceId: "personal",
302
- tags: ["kakaotalk", "personal", "pii"],
303
- // Optional: client: new KatokClient({ binaryPath: "katok" })
304
- });
188
+ ```bash
189
+ # Initialize configuration for your documents folder
190
+ autorag init --search-paths ~/Documents/research
305
191
 
306
- const agent = new AutoRAGAgent({
307
- searchPaths: ["/path/to/documents"],
308
- datasourceSkills: [kakao],
309
- datasourceAccess: {
310
- allowedTags: ["kakaotalk"],
311
- },
312
- });
192
+ # Index documents (parses PDFs/Markdown, builds BM25 and MinSync vectors)
193
+ autorag refresh
313
194
 
314
- await agent.refresh(); // refreshes parsed mirrors, BM25/MinSync, and datasource indexes
315
- const results = await agent.searchDatasourceDocuments("meeting with Mina", { topK: 5 });
195
+ # Check indexing health
196
+ autorag status
316
197
  ```
317
198
 
318
- #### Discord (discrawl)
319
-
320
- Discord uses the external [`discrawl`](https://github.com/openclaw/discrawl) CLI, which owns the SQLite archive, the FTS5 index, and the message vectors. AutoRAG never calls the Discord API itself.
199
+ ### 2. Search from CLI
321
200
 
322
201
  ```bash
323
- brew install openclaw/tap/discrawl
202
+ # Perform a curated search (uses your configured reasoning model)
203
+ autorag search "What are our primary Q3 deliverables?"
204
+
205
+ # Launch the interactive Terminal UI (beta)
206
+ autorag tui
207
+
208
+ # Open the loopback web management dashboard (127.0.0.1)
209
+ autorag ui
324
210
  ```
325
211
 
326
- AutoRAG reads discrawl's own local archive: `discrawl wiretap` imports the Discord Desktop cache and needs **no token at all**, and every search, embed, and sync step runs against that native store. AutoRAG carries no Discord credential — no bot token, no credential env var, no credential check in `autorag setup` — and it refuses to spawn the CLI when a Discord *user* token is present in the environment, because automating a user account violates Discord's Community Guidelines and can get the account terminated. A bot-backed archive is the CLI's own concern: configure and sync it with `discrawl` itself.
212
+ ### 3. Programmatic Usage (TypeScript API)
327
213
 
328
214
  ```typescript
329
- import { AutoRAGAgent, DiscrawlClient, DiscrawlSkill } from "@autorag/librarian";
330
-
331
- const discord = new DiscrawlSkill({
332
- client: new DiscrawlClient({ root: process.cwd() }),
333
- instanceId: "community",
334
- });
215
+ import { AutoRAGAgent } from "@autorag/librarian";
335
216
 
217
+ // Initialize librarian agent
336
218
  const agent = new AutoRAGAgent({
337
219
  searchPaths: ["/path/to/documents"],
338
- datasourceSkills: [discord],
339
- datasourceAccess: {
340
- allowedTags: ["discord"],
341
- },
342
220
  });
343
- ```
344
-
345
- Or through the trusted config factory:
346
-
347
- ```json
348
- {
349
- "datasources": {
350
- "discord": {
351
- "instanceId": "community",
352
- "connector": {
353
- "embeddingProvider": "ollama",
354
- "embeddingModel": "embeddinggemma",
355
- "defaultMode": "hybrid"
356
- }
357
- }
358
- }
359
- }
360
- ```
361
-
362
- Two defaults are deliberate and worth keeping:
363
-
364
- - **`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).
365
- - **`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).
366
-
367
- 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.
368
221
 
369
- ### Primary target: document collections
222
+ // Run curated search loop
223
+ const response = await agent.searchDocuments("Summarize recent compliance updates");
370
224
 
371
- AutoRAG is built for **non-code document retrieval**: manuals, legal docs, internal wikis, meeting notes, research literature, knowledge bases, PDFs.
372
-
373
- Code repositories work too (direct `grep` is useful), but AutoRAG's real value shows on unstructured text where simple pattern matching isn't enough.
374
-
375
- ## Configuration and state
376
-
377
- The default home state is kept outside the workspace:
378
-
379
- ```text
380
- ~/.autorag/
381
- ├── config.json
382
- ├── memory.json
383
- └── logs/
384
- └── runs.jsonl
385
- ```
386
-
387
- `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:
388
-
389
- ```json
390
- {
391
- "searchPaths": ["/path/to/documents"],
392
- "workspacePath": "/path/to/workspace",
393
- "memoryPath": "/Users/you/.autorag/memory.json",
394
- "model": { "provider": "provider-name", "id": "reasoning-model" }
225
+ console.log("Answer:", response.answer);
226
+ for (const result of response.results) {
227
+ console.log(`[${result.number}] ${result.title} (${result.source})`);
228
+ console.log(` ${result.summary}`);
395
229
  }
396
- ```
397
-
398
- `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.
399
-
400
- For fast interactive search, prefer a model with reliable tool calling, high
401
- output TPS, and low first-token latency. A query can require several short
402
- model turns while AutoRAG alternates between retrieval tools and direct source
403
- reading, so model throughput has a visible effect on end-to-end response time.
404
- It does not accelerate BM25, MinSync, Jikji, filesystem access, or indexing
405
- itself. Larger reasoning models remain useful for difficult synthesis,
406
- conflicting evidence, and specialized domain judgment, but they are not a
407
- requirement for ordinary retrieval.
408
230
 
409
- 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.
231
+ // Record feedback: Result [1] was useful, [2] was not
232
+ agent.recordFeedbackByNumbers(response.sessionId, [1], [2]);
233
+ ```
410
234
 
411
- `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`.
235
+ ---
412
236
 
413
- `autorag refresh` and `autorag index reset|rebuild` accept `--method <csv>` (e.g. `--method minsync,parsed` or `--method datasources,jikji`) to scope which indexing methods run or which index directories are removed. Valid values are `parsed`, `minsync`, `datasources`, `jikji`, and `all`. BM25 is a MinSync retrieval mode, not a `--method` name. When omitted, all methods run. `autorag init` accepts `--embedder-*` flags to configure the MinSync embedder endpoint in the config file.
237
+ ## CLI Command Reference
414
238
 
415
- `autorag refresh --json` reports the MinSync outcome in a `minsync` block (`ok`, `synced`, and a `reason`/`diagnostics` on failure), and the envelope's `ok` is `false` whenever MinSync, a datasource index, or any error-severity diagnostic failed — a green envelope never hides a semantic index that did not update.
239
+ | Command | Description |
240
+ |---|---|
241
+ | `autorag init` | Initialize `~/.autorag/config.json` with search roots and model settings |
242
+ | `autorag refresh` | Refresh parsed mirrors, MinSync CDC chunks, datasources, and Jikji |
243
+ | `autorag search "<query>"` | Run the librarian agent to curate structured answers |
244
+ | `autorag status` | Inspect corpus freshness, indexing status, and vector readiness |
245
+ | `autorag health` | Check model provider authentication, token validity, and API reachability |
246
+ | `autorag tui` | Open the interactive librarian terminal UI |
247
+ | `autorag ui` | Open the local loopback web dashboard to configure datasources visually |
248
+ | `autorag duplicates [DIR]` | Read-only scan for exact and near-duplicate document families with `dupey` |
249
+ | `autorag lite ...` | Model-free indexing, retrieval, report generation, and status |
250
+ | `autorag feedback <session>` | Record useful / not-useful feedback by item number |
251
+ | `autorag evidence <session>` | Inspect exact underlying document chunks and sources for a past query |
252
+ | `autorag serve` | Start the P2P query server over SimpleX (opt-in) |
253
+ | `autorag p2p ...` | Manage peer trust, query approvals, and sharing policies |
416
254
 
417
- `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`.
255
+ ---
418
256
 
419
- `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.
257
+ ## Documentation Links
420
258
 
421
- For a deliberately deployed UI, opt in explicitly in `config.json`. Keep the
422
- session token in the environment, set the public URL used by the browser, and
423
- allow only the frontend origins that should make credentialed API requests:
259
+ Deep dive into AutoRAG Agent's architecture, security, and integration guides:
424
260
 
425
- ```json
426
- {
427
- "ui": {
428
- "host": "0.0.0.0",
429
- "port": 8787,
430
- "allowRemote": true,
431
- "publicOrigin": "https://autorag.example.com",
432
- "corsOrigins": ["https://autorag.example.com"],
433
- "tokenEnv": "AUTORAG_UI_TOKEN"
434
- }
435
- }
436
- ```
261
+ - **[MinSync Setup & Embedding QA](docs/minsync-setup.md):** Automatic binary installation, CDC chunking, and EmbeddingGemma verification.
262
+ - **[Local Embedding Runtime & Gateway](docs/embedding-runtime.md):** AutoRAG-owned local gateway, model prefetching, and zero-egress semantic search.
263
+ - **[Datasource Skills Reference](docs/datasource-skills.md):** Full configuration contracts, connection aliases, and connector options.
264
+ - **[Manual QA & Datasource Test Harnesses](docs/manual-qa-datasources.md):** Real-world testing guides for Discord, KakaoTalk, Slack, Notion, and email.
265
+ - **[P2P SimpleX Sharing & Path Standard](docs/p2p-path-standard.md):** Decentralized peer query sharing with SimpleX, PII redaction, and approval queues.
266
+ - **[Supply Chain Security & License Audits](docs/supply-chain.md):** Software bill of materials (SBOM) and dependency gate policies.
267
+ - **[Competitive Landscape Study](docs/competitive-landscape-2026-09.md):** In-depth analysis of why in-place federation outperforms centralized RAG.
268
+ - **[Legacy AutoRAG (AutoML)](legacy/README.md):** Documentation for the legacy Python AutoML pipeline optimizer (`pip install AutoRAG`).
437
269
 
438
- Start it with `AUTORAG_UI_TOKEN` set to a random value of at least 16
439
- characters. Local use remains the safe default: omit `ui` (or leave
440
- `allowRemote` false) and AutoRAG binds to loopback, including a working
441
- `localhost` URL on systems that resolve it to IPv6.
270
+ ---
442
271
 
443
- ### CLI commands
272
+ ## Contributors & Community
444
273
 
445
- ```bash
446
- autorag init # write ~/.autorag/config.json
447
- autorag refresh # parsed + MinSync + datasources + Jikji
448
- autorag watch [--once] # filesystem watch, or one cron/poll tick
449
- autorag status # corpus freshness (model-free)
450
- autorag search "your question" # curated answer (requires a configured model)
451
- autorag feedback <session> # numbered useful / not-useful feedback
452
- autorag evidence <session> # persisted source/chunk evidence
453
- autorag memory inspect # retrieval memory snapshot
454
- autorag index reset|rebuild # remove or rebuild workspace indexes
455
- autorag health # model/provider auth (no index check)
456
- autorag duplicates [DIR] # read-only duplicate families; never deletes
457
- autorag tui # interactive librarian terminal UI (beta)
458
- autorag ui # loopback page to connect datasources
459
- autorag lite … # model-free setup, retrieve, report, status
460
- autorag setup # install and configure local runtime assets
461
- autorag models prefetch|import|verify
462
- # manage local embedding model profiles
463
- autorag gateway status|stop # inspect or stop the local embedding gateway
464
- autorag serve # P2P peer query server over SimpleX (opt-in)
465
- autorag p2p # peer trust, approvals, and sharing policy
466
- ```
274
+ AutoRAG Agent is an open-source project built by the community. We welcome contributions, bug reports, datasource connectors, and ideas!
467
275
 
468
- `autorag --help` is the command list of record; `autorag <command> --help`
469
- prints that command's flags and subcommands, and `autorag --version` prints the
470
- installed version. See
471
- [docs/embedding-runtime.md](docs/embedding-runtime.md) for the local embedding
472
- runtime and gateway setup.
276
+ - **Contributing:** Feel free to open an issue or pull request. Please check our [Git Workflow in AGENTS.md](AGENTS.md) and run `bun test` before submitting.
277
+ - **GitHub Contributors:** [View all contributors](https://github.com/Marker-Inc-Korea/AutoRAG/graphs/contributors) on GitHub.
473
278
 
474
- ### P2P sharing (SimpleX)
279
+ ---
475
280
 
476
- Peer query sharing is **disabled by default**. Set `p2p.enabled` to `true` in
477
- `config.json`, or pass `--force` to start the server once. Peers reach this
478
- installation through SimpleX; the local control socket binds to loopback
479
- (default port 5225).
281
+ ## Acknowledgements
480
282
 
481
- ```bash
482
- autorag serve # start the peer query server
483
- autorag p2p peers # list trusted peers
484
- autorag p2p peers --add alice --contact-id 1
485
- autorag p2p requests # pending responses held for approval
486
- autorag p2p requests approve <id>
487
- autorag p2p policy list # merged sharing rules (virtual-path keys)
488
- autorag p2p policy set '/docs/**' peers
489
- autorag p2p policy unset '/docs/**'
490
- ```
283
+ AutoRAG Agent stands on the shoulders of fantastic open-source projects:
491
284
 
492
- Inbound queries are screened for injection. Outbound answers are filtered by
493
- sharing policy (`private` / `never` / `always` / `peers`) and PII redaction,
494
- and held until the operator approves them. The librarian can call
495
- `recommend_peer_targets` to suggest local peer personas without contacting
496
- them.
285
+ - **[Pi Framework](https://github.com/earendil-works/pi-mono)** by [@earendil-works](https://github.com/earendil-works) — The foundational agent framework powering AutoRAG's reasoning loop.
286
+ - **[MinSync](https://github.com/Marker-Inc-Korea/minsync)** — Ultra-fast incremental Change Data Capture (CDC) chunking and local BM25/vector indexing.
287
+ - **[Jikji](https://github.com/NomaDamas/jikji)** by [NomaDamas](https://github.com/NomaDamas) — High-performance find-first local document discovery.
288
+ - **[dupey](https://github.com/NomaDamas/dupey)** by [NomaDamas](https://github.com/NomaDamas) — Fast duplicate and near-duplicate document family detection.
289
+ - **Federated CLI Authors:** External datasource tools [`katok`](https://github.com/NomaDamas/katok), [`discrawl`](https://github.com/openclaw/discrawl), [`mailcrawl`](https://github.com/NomaDamas/mailcrawl), [`wacrawl`](https://github.com/openclaw/wacrawl), [`telecrawl`](https://github.com/openclaw/telecrawl), [`slacrawl`](https://github.com/openclaw/slacrawl), [`notcrawl`](https://github.com/openclaw/notcrawl), [`qmd`](https://github.com/tobi/qmd), and [`rclone`](https://rclone.org).
290
+ - **[OpenDataLoader](https://github.com/opendataloader/opendataloader-pdf)** / **Docling** — Robust PDF and document parsing runtimes.
497
291
 
498
- ## Installation
292
+ ---
499
293
 
500
- Published as `@autorag/librarian` (dist bundled with Bun, runtime Node ≥ 24 or Bun):
294
+ ## Troubleshooting
501
295
 
502
- ```bash
503
- bun add @autorag/librarian # library
504
- bun install -g @autorag/librarian # autorag CLI
505
- # or run directly from the repo:
506
- bun add github:Marker-Inc-Korea/AutoRAG
507
- ```
296
+ When search returns nothing, a datasource disappears from results, refresh hangs, or the gateway will not start, run the **`autorag-doctor`** agent skill (`skills/autorag-doctor/SKILL.md`). Point your coding agent at it and say *"check AutoRAG"* — it walks the full diagnose-and-repair procedure and ends with a per-datasource status table showing what is indexed and what actually returns hits.
508
297
 
509
- PDF parsing requires **Java 11 or newer** because the bundled
510
- `@opendataloader/pdf` runtime is compiled for Java 11. This applies to
511
- Windows, macOS, and Linux. Verify the runtime that will be selected from
512
- `PATH` before indexing PDFs:
298
+ The first three commands cover most of it:
513
299
 
514
300
  ```bash
515
- java -version
301
+ autorag status --json # freshness, per-component state, diagnostics
302
+ autorag health --json # model resolution + one live completion probe
303
+ autorag gateway status --format json # on-demand embedding runtime
516
304
  ```
517
305
 
518
- On Windows, ensure a Java 11+ installation appears before older Java
519
- installations in `PATH` (or set `JAVA_HOME` to the Java 11+ installation and
520
- start a new shell). Java 8 is not supported by the PDF parser.
521
-
522
- Git-based installs build `dist/` via the `prepare` script and require Bun on the installing machine.
523
- External tool binaries auto-install on first use into `<workspace>/.autorag/bin`: **MinSync** installs from crates.io via `cargo install minsync` first (on by default; verified GitHub release assets are the fallback when cargo is unavailable; `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.
524
-
525
- ### TUI (beta)
526
-
527
- `autorag tui` opens an interactive Pi-powered librarian terminal UI using the
528
- same config as `autorag search`:
306
+ Indexing is not the same thing as searchability, so always confirm retrieval itself — this needs no model:
529
307
 
530
308
  ```bash
531
- autorag tui
309
+ autorag lite retrieve 'a word that certainly appears' --top-k 3 --json
310
+ autorag lite retrieve 'recent topic' --tags discord --top-k 3 --json
532
311
  ```
533
312
 
534
- Inside the TUI, use `/resume` to browse saved sessions. Selecting a session
535
- replaces the current view with that session instead of mixing the two
536
- conversation histories. The TUI is beta and may still change.
313
+ Common failures and their fix:
537
314
 
538
- ## Quick Start
539
-
540
- ```typescript
541
- import { AutoRAGAgent } from "@autorag/librarian";
542
-
543
- const agent = new AutoRAGAgent({
544
- searchPaths: ["/path/to/documents"],
545
- });
546
-
547
- const response = await agent.searchDocuments("summarize the compliance requirements");
548
- console.log(response.answer);
549
- for (const result of response.results) {
550
- console.log(`[${result.number}] ${result.title} — ${result.summary}`);
551
- }
552
-
553
- // Mark which results were useful — AutoRAG remembers for next time
554
- agent.recordFeedbackByNumbers(response.sessionId, [1, 3], [2]);
555
- ```
556
-
557
- `searchDocuments()` runs the Pi agent loop — it searches, reads, consults memory, curates, and finalizes through the `emit_autorag_results` structured tool — then returns a typed `SearchDocumentsResponse`. The caller consumes the structured payload directly; no assistant text parsing.
558
-
559
- ## How It Works
315
+ | Symptom | Diagnostic code | Fix |
316
+ |---|---|---|
317
+ | Results are missing recent files | `stale-index` | `autorag refresh --method parsed,minsync --json` |
318
+ | Semantic search returns nothing after changing the embedder | `embedding-identity-mismatch` | `autorag index rebuild --method minsync` |
319
+ | Gateway will not start, a previous run was killed | `lock-conflict` | `autorag gateway stop`, then retry |
320
+ | A datasource is healthy in its own CLI but absent from results | — | add its tag/scope to `datasourceAccess` |
321
+ | A datasource errors during refresh | `datasource-index-failed` | run that CLI's own `doctor` |
322
+ | MinSync or Jikji missing | `minsync-unavailable`, `jikji-unavailable` | check the Rust toolchain, re-run refresh |
560
323
 
561
- ```
562
- You ask a question
563
- │
564
- ▼
565
- ┌──────────────┐
566
- │ Plan + search│ ← check_memory, Jikji, and retrieval tools
567
- └──────┬───────┘
568
- ▼
569
- ┌──────────────┐
570
- │ Direct read │ ← bash find/grep/cat
571
- └──────┬──────┘
572
- ▼
573
- ┌─────────────┐
574
- │ Curate │ ← Extract key insights, not raw lines
575
- └──────┬──────┘
576
- ▼
577
- [1] Finding A — summary (location)
578
- [2] Finding B — summary (location)
579
-
580
- │
581
- Caller says "1 was useful, 2 wasn't"
582
- │
583
- ▼
584
- ┌─────────────┐
585
- │ Memory │ ← Remembers what worked, adapts next time
586
- └─────────────┘
587
- ```
324
+ Native datasource stores stay owned by their CLIs — AutoRAG never rebuilds them. Fix a broken archive with `katok doctor`, `discrawl --json metadata`, `slacrawl --json doctor`, `wacrawl --json doctor`, `telecrawl --json doctor`, `notcrawl doctor`, `qmd status`, or `mailcrawl doctor`, then re-run `autorag refresh --method datasources --json`.
588
325
 
589
326
  ## License
590
327
 
591
- MIT for AutoRAG 2.0 (`LICENSE`). The legacy Python package in `legacy/` is Apache-2.0 (`legacy/LICENSE`). Production third-party licenses are listed in `NOTICE`. Supply-chain gates are documented in `docs/supply-chain.md`.
328
+ - **AutoRAG 2.0 (AutoRAG Agent):** Released under the [MIT License](LICENSE).
329
+ - **Legacy Python AutoRAG (`legacy/`):** Released under the [Apache License 2.0](legacy/LICENSE).
330
+ - Production third-party notices and licenses are documented in [`NOTICE`](NOTICE).