paper-drift 0.1.1 → 0.1.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.
- package/README.md +11 -13
- package/package.json +1 -1
- package/skills/paper-drift/SKILL.md +7 -7
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
> **Zero-Python, zero-Chromium WebAssembly document parser, HTML renderer, and Markdown engine with GFM tables and math.**
|
|
9
9
|
|
|
10
|
-
Convert complex academic research papers and enterprise PDFs directly into clean, structured **Markdown** or standalone **HTML** with pixel-perfect visual fidelity—without Puppeteer, Python, Docker, or external servers.
|
|
10
|
+
Convert complex academic research papers and enterprise PDFs directly into clean, structured **Markdown** or standalone **HTML** with pixel-perfect visual fidelity—without Puppeteer, Python, Docker, or external servers. Drastically reduces LLM token consumption compared to sending raw PDFs or vision images.
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
@@ -18,7 +18,7 @@ Most PDF conversion pipelines in JavaScript suffer from two major flaws:
|
|
|
18
18
|
2. **The "Text Soup" Trap**: Spatially naive parsers that dump unordered lines, break multi-column layouts, and butcher tabular grids.
|
|
19
19
|
|
|
20
20
|
**`paper-drift` solves this natively:**
|
|
21
|
-
* **Zero-Python & Zero-Chromium**: Runs compiled WebAssembly directly in any V8 runtime (Node.js, Bun, or modern browsers).
|
|
21
|
+
* **Zero-Python & Zero-Chromium**: Runs compiled WebAssembly directly in any V8 runtime (Node.js, Bun, or modern browsers). Zero external microservices or headless browsers required.
|
|
22
22
|
* **Direct Markdown Engine**: Converts directly into GitHub Flavored Markdown (GFM) with auto-detected `#`, `##` headings, list markers, and clean math.
|
|
23
23
|
* **Geometric Table Reconstruction**: Discovers column gutters and slices cells into standard pipe tables (`| col1 | col2 |`) with clean universal math exponents (`O(n² · d)`, `10¹⁹`).
|
|
24
24
|
* **Multi-Column Spatial Ordering**: Resolves 2-column papers via Recursive XY-Cut without column interweaving.
|
|
@@ -116,17 +116,15 @@ const { markdown } = await convertPdfToMarkdown(Buffer.from(pdfBuffer));
|
|
|
116
116
|
|
|
117
117
|
---
|
|
118
118
|
|
|
119
|
-
## 💸
|
|
119
|
+
## 💸 Reduce Token Costs for AI Agents
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
Sending raw PDF documents or full-page screenshots to LLMs wastes massive amounts of context window tokens and introduces vision hallucinations on formulas and tabular data.
|
|
122
122
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
> **Net Savings:** Over **90% token reduction** and **12x faster ingestion**.
|
|
123
|
+
**`paper-drift` converts PDFs into clean, structured Markdown before sending them to the model:**
|
|
124
|
+
* **Drastically Reduced Token Footprint**: Markdown transmits only the actual text, pipe tables, and math equations—eliminating the heavy pixel-tiling token overhead of multimodal vision models and unstructured OCR dumps.
|
|
125
|
+
* **100% Reading Order Accuracy**: Recursive XY-Cut sequences multi-column research papers in natural human reading order without column line-mixing.
|
|
126
|
+
* **High-Fidelity Tables & Math**: Tables are converted to clean GFM pipe tables (`| col1 | col2 |`) and math is preserved as clean Unicode/LaTeX without visual distortion.
|
|
127
|
+
* **Fast & Lightweight Ingestion**: Ingests pages locally via WebAssembly in milliseconds, slashing API latency and context costs.
|
|
130
128
|
|
|
131
129
|
---
|
|
132
130
|
|
|
@@ -134,7 +132,7 @@ When feeding 10-page academic papers into LLMs (Claude, GPT-4, Cursor, Antigravi
|
|
|
134
132
|
|
|
135
133
|
`paper-drift` is built from the ground up as a native **AI Agent Skill** to eliminate the **"Multimodal PDF Token Tax"**.
|
|
136
134
|
|
|
137
|
-
When an AI coding or research agent ingests raw PDFs as images, it burns
|
|
135
|
+
When an AI coding or research agent ingests raw PDFs as images, it burns thousands of vision tokens per page and quickly crowds context windows. By equipping your agent with the `paper-drift` skill, the agent pre-processes PDFs locally via WebAssembly into clean Markdown, GFM tables, and LaTeX equations in milliseconds—drastically reducing token consumption compared to sending raw PDFs.
|
|
138
136
|
|
|
139
137
|
### 1-Click Skill Installation
|
|
140
138
|
|
|
@@ -168,7 +166,7 @@ Agent (Internal):
|
|
|
168
166
|
1. Detects paper-drift skill
|
|
169
167
|
2. Executes: npx -y paper-drift attention-is-all-you-need.pdf --format md --pages 6-8
|
|
170
168
|
3. Receives clean GFM Table 1 and BLEU score comparisons in < 250ms
|
|
171
|
-
4. Answers your query
|
|
169
|
+
4. Answers your query directly from clean Markdown text without burning multimodal vision tokens!
|
|
172
170
|
```
|
|
173
171
|
|
|
174
172
|
- 📖 **Skill Specification:** [`skills/paper-drift/SKILL.md`](skills/paper-drift/SKILL.md)
|
package/package.json
CHANGED
|
@@ -11,15 +11,15 @@ Instead, invoke `paper-drift` locally via WebAssembly to convert the document in
|
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
-
## 1. Why Use `paper-drift` (
|
|
14
|
+
## 1. Why Use `paper-drift` (Token Savings & Fidelity)
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
| :--- | :--- | :--- | :--- |
|
|
18
|
-
| **Multimodal Vision (PDF $\rightarrow$ Image)** | ~16,000 – 20,000 vision tokens | ~$0.20 – $0.40 | 10–25s (image rendering & transfer) |
|
|
19
|
-
| **`paper-drift` WASM Preprocessing** | **~1,200 – 1,800 text tokens** | **~$0.01 – $0.02** | **< 400ms (100% local WASM)** |
|
|
20
|
-
| **Savings** | **~92% Token Reduction** | **15x Cheaper** | **30x–40x Faster** |
|
|
16
|
+
Sending raw PDF documents or full-page screenshots to LLMs burns massive vision tokens and causes severe hallucinations on dense math and tables.
|
|
21
17
|
|
|
22
|
-
|
|
18
|
+
Converting PDFs to Markdown with `paper-drift` provides:
|
|
19
|
+
- **Drastically Reduced Token Costs**: Markdown sends only pure text, pipe tables, and math—eliminating the heavy pixel-tiling token bloat of multimodal vision models and unstructured OCR dumps.
|
|
20
|
+
- **Accurate Reading Order**: Multi-column papers are properly ordered via Recursive XY-Cut without line interleaving.
|
|
21
|
+
- **Intact Tables & Math**: Reconstructs multi-tier data tables into standard Markdown grids (`| col1 | col2 |`) and math into clean LaTeX/Unicode.
|
|
22
|
+
- **Fast Local Execution**: Runs locally in milliseconds via compiled WebAssembly with zero external dependencies (no Python, no Poppler, no Chromium).
|
|
23
23
|
|
|
24
24
|
---
|
|
25
25
|
|