Skip to content

Commit 48e3be4

Browse files
authored
Merge pull request #82 from vectorlessflow/dev
Dev
2 parents c441a31 + 3d084c3 commit 48e3be4

185 files changed

Lines changed: 11483 additions & 24236 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CLAUDE.md

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,51 @@
11
# CLAUDE.md
22

3-
A hierarchical, reasoning-native document intelligence engine written in Rust.
3+
Vectorless is a reasoning-native document intelligence engine written in Rust.
4+
5+
## Principles
6+
7+
- **Reason, don't vector.** — Every retrieval decision is an LLM decision.
8+
- **Model fails, we fail.** — No silent degradation. No heuristic fallbacks.
9+
- **No thought, no answer.** — Only LLM-reasoned output counts as an answer.
410

511
## Project Structure
612

713
- `rust/` - Rust core engine
8-
- `src/client/` - Client API (EngineBuilder, Engine)
9-
- `src/config/` - Configuration types
10-
- `src/document/` - Document parsers (Markdown, PDF)
11-
- `src/index/` - Index building and pipeline
12-
- `src/retrieval/` - Retrieval engine (beam search, MCTS, greedy, hybrid strategies)
13-
- `src/storage/` - Storage layer
14-
- `src/llm/` - LLM client abstraction
14+
- `src/client/` - Client API (EngineBuilder, Engine) - facade layer, no business logic
15+
- `src/document/` - Document data structures (DocumentTree, NavigationIndex, ReasoningIndex)
16+
- `src/index/` - Compile pipeline (8-stage, checkpointing, incremental update)
17+
- `src/retrieval/` - Retrieval dispatch layer (preprocessing, dispatch, postprocessing, cache, streaming)
18+
- `src/query/` - Query understanding and planning (intent classification, rewrite, decomposition)
19+
- `src/agent/` - Retrieval execution (Worker: doc navigation, Orchestrator: supervisor loop + multi-doc fusion)
20+
- `src/rerank/` - Result reranking and answer synthesis (dedup, scoring, fusion, synthesis)
21+
- `src/scoring/` - Scoring and ranking strategies (BM25, relevance scoring, score combination)
22+
- `src/llm/` - LLM client (connection pool, memo/caching, throttle/rate-limiting, fallback)
23+
- `src/storage/` - Persistence (Workspace, LRU cache, backend abstraction file/memory)
1524
- `src/graph/` - Cross-document relationship graph
16-
- `src/memo/` - Caching and reasoning memo
17-
- `src/metrics/` - Metrics and usage tracking
25+
- `src/metrics/` - Metrics collection and reporting
1826
- `src/events/` - Event system for progress monitoring
19-
- `src/throttle/` - Rate limiting
20-
- `src/utils/` - Utility functions
27+
- `src/config/` - Configuration types and validation
28+
- `src/error.rs` - Unified error types
29+
- `src/utils/` - Utility functions (token counting, fingerprinting, validation)
2130
- `examples/` - Rust examples (flow, indexing, pdf, batch, etc.)
22-
- `python/` - Python SDK (PyO3 bindings)
31+
- `python/` - Python SDK (PyO3 bindings) + CLI
2332
- `docs/` - Docusaurus documentation site
2433
- `samples/` - Sample files
2534

35+
### Retrieval Call Flow
36+
37+
```
38+
Engine.query()
39+
→ retrieval/dispatcher
40+
→ query/understand() → QueryPlan (LLM intent + concepts + strategy)
41+
→ Orchestrator (always, single or multi-doc)
42+
→ analyze(QueryPlan) → dispatch plan
43+
→ supervisor loop:
44+
dispatch Workers → evaluate() →
45+
if insufficient → replan() → loop
46+
→ rerank/ (dedup → BM25 score → synthesis/fusion)
47+
```
48+
2649
## Build Commands
2750

2851
```bash

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ members = ["rust", "python"]
33
resolver = "2"
44

55
[workspace.package]
6-
version = "0.1.29"
6+
version = "0.1.30"
77
edition = "2024"
88
authors = ["zTgx <beautifularea@gmail.com>"]
99
license = "Apache-2.0"

README.md

Lines changed: 4 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -13,58 +13,15 @@
1313

1414
</div>
1515

16-
**Vectorless** is a reasoning-native document engine designed to be the foundational layer for AI applications that need structured access to documents, with the core written in Rust. It does not use vector databases, embeddings, or similarity search. Instead, it will reason through any of your structured documents — **PDFs, Markdown, reports, contracts** — and retrieve only what's relevant. Nothing more, nothing less.
16+
**Vectorless** is a reasoning-native document engine with the core written in Rust. It will reason through any of your structured documents — **PDFs, Markdown, reports, contracts** — and retrieve only what's relevant. Nothing more, nothing less.
1717

18+
- **Reason, don't vector.** — Retrieval is guided by reasoning over document structure.
19+
- **Model fails, we fail.** — No silent degradation. No heuristic fallbacks.
20+
- **No thought, no answer.** — Only LLM-reasoned output counts as an answer.
1821

1922

20-
## How It Works
21-
22-
<div align="center">
23-
<img src="https://vectorless.dev/img/workflow.svg" alt="Vectorless Workflow" width="900">
24-
</div>
25-
26-
<div align="center">
27-
<img src="https://vectorless.dev/img/demo.gif" alt="Vectorless Demo" width="900">
28-
</div>
29-
3023
## Quick Start
3124

32-
### Rust
33-
34-
```toml
35-
[dependencies]
36-
vectorless = "0.1"
37-
```
38-
39-
```rust
40-
use vectorless::{EngineBuilder, IndexContext, QueryContext};
41-
42-
#[tokio::main]
43-
async fn main() -> vectorless::Result<()> {
44-
let engine = EngineBuilder::new()
45-
.with_key("sk-...")
46-
.with_model("gpt-4o")
47-
.with_endpoint("https://api.openai.com/v1")
48-
.build()
49-
.await?;
50-
51-
// Index a document
52-
let result = engine.index(IndexContext::from_path("./report.pdf")).await?;
53-
let doc_id = result.doc_id().unwrap();
54-
55-
// Query
56-
let result = engine.query(
57-
QueryContext::new("What is the total revenue?")
58-
.with_doc_ids(vec![doc_id.to_string()])
59-
).await?;
60-
println!("{}", result.content);
61-
62-
Ok(())
63-
}
64-
```
65-
66-
### Python
67-
6825
```bash
6926
pip install vectorless
7027
```
@@ -89,52 +46,6 @@ async def main():
8946
asyncio.run(main())
9047
```
9148

92-
## Core Concepts
93-
94-
### Semantic Tree Index
95-
96-
When you index a document, Vectorless builds a tree structure that mirrors the document's hierarchy:
97-
98-
```
99-
Annual Report 2024
100-
├── Executive Summary
101-
│ ├── Financial Highlights
102-
│ └── Strategic Outlook
103-
├── Financial Statements
104-
│ ├── Revenue Analysis ← "What is the total revenue?" lands here
105-
│ ├── Operating Expenses
106-
│ └── Net Income
107-
└── Risk Factors
108-
├── Market Risks
109-
└── Regulatory Risks
110-
```
111-
112-
Each node contains a summary generated by the LLM. During retrieval, the engine uses these summaries to reason about which path to follow — just like a human would scan a table of contents.
113-
114-
### Cross-Document Graph
115-
116-
When multiple documents are indexed, Vectorless builds a relationship graph connecting them through shared keywords and concepts. This enables queries across your entire document collection.
117-
118-
```python
119-
# Query across all indexed documents
120-
result = await engine.query(
121-
QueryContext("Compare revenue trends across all reports")
122-
)
123-
```
124-
125-
### Workspace Persistence
126-
127-
Indexed documents are stored in a workspace — there's no need to reprocess files between sessions:
128-
129-
```python
130-
engine = Engine(api_key="sk-...", model="gpt-4o", endpoint="https://api.openai.com/v1")
131-
132-
# List all indexed documents
133-
docs = await engine.list()
134-
for doc in docs:
135-
print(f"{doc.name} ({doc.format}) — {doc.page_count} pages")
136-
```
137-
13849
## What It's For
13950

14051
Vectorless is designed for applications that need **precise** document retrieval:

docs/docs/architecture.mdx

Lines changed: 54 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,29 +55,66 @@ TreeNode
5555

5656
## Retrieval Pipeline
5757

58-
The retrieval pipeline consists of four phases:
58+
The retrieval pipeline is a supervisor loop driven entirely by LLM reasoning. Every decision — which documents to query, how to navigate, whether evidence is sufficient — is made by the model, not by heuristics.
5959

60-
1. **Analyze** — Detect query complexity, extract keywords, decompose complex queries
61-
2. **Plan** — Select retrieval strategy and search algorithm
62-
3. **Search** — Execute tree traversal with Pilot guidance
63-
4. **Evaluate** — Score, deduplicate, and aggregate results
60+
### Principles
6461

65-
### Pilot
62+
- **Reason, don't vector.** — Every retrieval decision is an LLM decision.
63+
- **Model fails, we fail.** — No silent degradation. No heuristic fallbacks.
64+
- **No thought, no answer.** — Only LLM-reasoned output counts as an answer.
6665

67-
The Pilot is the core intelligence component. It provides LLM-guided navigation at key decision points:
66+
### Flow
6867

69-
- **Fork points** — When multiple children exist, Pilot evaluates which path to follow
70-
- **Backtracking** — When a path yields insufficient results, Pilot suggests alternatives
71-
- **Binary pruning** — Quick relevance filter for nodes with many children
68+
```text
69+
Engine.query()
70+
→ Dispatcher
71+
→ Query Understanding (LLM) → QueryPlan (intent, concepts, strategy)
72+
→ Orchestrator (always — single or multi-doc)
73+
→ Analyze (LLM selects documents + tasks)
74+
→ Supervisor Loop:
75+
Dispatch Workers → Evaluate (LLM sufficiency check)
76+
→ if insufficient → Replan (LLM) → loop
77+
→ Rerank (dedup → BM25 score → synthesis/fusion)
78+
```
79+
80+
### Query Understanding
81+
82+
Every query first passes through LLM-based understanding:
83+
84+
| Field | Description |
85+
|-------|-------------|
86+
| **Intent** | Factual, Analytical, Navigational, or Summary |
87+
| **Complexity** | Simple, Moderate, or Complex |
88+
| **Key Concepts** | LLM-extracted concepts (distinct from keywords) |
89+
| **Strategy Hint** | focused, exploratory, comparative, or summary |
90+
91+
### Orchestrator (Supervisor)
92+
93+
The Orchestrator is the central coordinator. It always runs — even for single-document queries. Its supervisor loop:
94+
95+
1. **Analyze** — LLM reviews DocCards and selects relevant documents with specific tasks
96+
2. **Dispatch** — Fan-out Workers in parallel (one per document)
97+
3. **Evaluate** — LLM checks if collected evidence is sufficient to answer the query
98+
4. **Replan** (if insufficient) — LLM identifies missing information and dispatches additional Workers
99+
100+
### Worker (Evidence Collector)
101+
102+
Each Worker navigates a single document's tree to collect evidence:
103+
104+
1. **Bird's-eye**`ls` the root for an overview
105+
2. **Plan** — LLM generates a navigation plan
106+
3. **Navigate** — Loop: LLM → command → execute → repeat (with budget)
107+
4. **Return** — Collected evidence only — no answer synthesis
108+
109+
Workers use tree commands (`ls`, `cd`, `cat`, `grep`, `find`, `findtree`) and a `check` command for self-evaluation.
110+
111+
### Rerank Pipeline
72112

73-
### Search Algorithms
113+
After all Workers complete, the Orchestrator runs the final pipeline:
74114

75-
| Algorithm | Description | Use Case |
76-
|-----------|-------------|----------|
77-
| **Beam Search** | Explores multiple paths with backtracking | General purpose (recommended) |
78-
| **MCTS** | Monte Carlo Tree Search with UCT selection | Complex multi-hop queries |
79-
| **Pure Pilot** | Greedy single-path, Pilot at every level | High-accuracy, higher token cost |
80-
| **ToC Navigator** | Table-of-contents based location | Broad queries ("what is this about?") |
115+
1. **Dedup** — Remove duplicate and low-quality evidence
116+
2. **BM25 Scoring** — Rank evidence by keyword relevance
117+
3. **Answer Generation** — LLM synthesizes or fuses evidence into a final answer
81118

82119
## Cross-Document Graph
83120

0 commit comments

Comments
 (0)