Turn any AI agent into an AI Scientist. The #1 Agent Skills library for science, used by 250,000+ scientists worldwide. 177 ready-to-use validated skills plus 100+ scientific databases covering biology, chemistry, medicine, and drug discovery. Compatible with Cursor, Claude Code, Codex, Pi, Antigravity, and the open Agent Skills standard.
Python agent-skillsai-scientistbioinformaticschemoinformaticsclaudeclaude-skillsclaudecodeclinical-researchcomputational-biologydata-analysisdrug-discoverygenomicsmaterials-sciencemetabolomicsproteomicsscientific-computingscientific-visualization
Add suppor for LiteParse from LlamaIndex
Timothy Kassis03608abcfee2
diff --git a/README.md b/README.mdindex 7342855e..3589a1b5 100644--- a/README.md+++ b/README.md@@ -2,10 +2,10 @@> **🔔 Claude Scientific Skills is now Scientific Agent Skills.** Same skills, broader compatibility — now works with any AI agent that supports the open [Agent Skills](https://agentskills.io/) standard, not just Claude.-> **New: [K-Dense BYOK](https://github.com/K-Dense-AI/k-dense-byok)** — A free, open-source AI co-scientist that runs on your desktop, powered by Scientific Agent Skills. Bring your own API keys, pick from 40+ models, and get a full research workspace with web search, file handling, 100+ scientific databases, and access to all 138 skills in this repo. Your data stays on your computer, and you can optionally scale to cloud compute via [Modal](https://modal.com/) for heavy workloads. [Get started here.](https://github.com/K-Dense-AI/k-dense-byok)+> **New: [K-Dense BYOK](https://github.com/K-Dense-AI/k-dense-byok)** — A free, open-source AI co-scientist that runs on your desktop, powered by Scientific Agent Skills. Bring your own API keys, pick from 40+ models, and get a full research workspace with web search, file handling, 100+ scientific databases, and access to all 139 skills in this repo. Your data stays on your computer, and you can optionally scale to cloud compute via [Modal](https://modal.com/) for heavy workloads. [Get started here.](https://github.com/K-Dense-AI/k-dense-byok)[](LICENSE.md)-[](#-whats-included)+[](#-whats-included)[](#-whats-included)[](https://agentskills.io/)[](#-getting-started)@@ -13,7 +13,7 @@[](https://www.linkedin.com/company/k-dense-inc)[](https://www.youtube.com/@K-Dense-Inc)-A comprehensive collection of **138 ready-to-use scientific and research skills** (covering cancer genomics, drug-target binding, molecular dynamics, RNA velocity, geospatial science, time series forecasting, scientific ML resource discovery via Hugging Science, 78+ scientific databases, and more) for any AI agent that supports the open [Agent Skills](https://agentskills.io/) standard, created by [K-Dense](https://k-dense.ai). Works with **Cursor, Claude Code, Codex, and more**. Transform your AI agent into a research assistant capable of executing complex multi-step scientific workflows across biology, chemistry, medicine, and beyond.+A comprehensive collection of **139 ready-to-use scientific and research skills** (covering cancer genomics, drug-target binding, molecular dynamics, RNA velocity, geospatial science, time series forecasting, scientific ML resource discovery via Hugging Science, 78+ scientific databases, and more) for any AI agent that supports the open [Agent Skills](https://agentskills.io/) standard, created by [K-Dense](https://k-dense.ai). Works with **Cursor, Claude Code, Codex, and more**. Transform your AI agent into a research assistant capable of executing complex multi-step scientific workflows across biology, chemistry, medicine, and beyond.---@@ -46,7 +46,7 @@ These skills enable your AI agent to seamlessly work with specialized scientific## 📦 What's Included-This repository provides **138 scientific and research skills** organized into the following categories:+This repository provides **139 scientific and research skills** organized into the following categories:- **100+ Scientific & Financial Databases** - A unified database-lookup skill provides direct access to 78 public databases (PubChem, ChEMBL, UniProt, COSMIC, ClinicalTrials.gov, FRED, USPTO, and more), plus dedicated skills for DepMap, Imaging Data Commons, PrimeKG, U.S. Treasury Fiscal Data, and Hugging Science (curated catalog of scientific datasets, models, and demos across 17 scientific domains on Hugging Face). Multi-database packages like BioServices (~40 bioinformatics services), BioPython (38 NCBI sub-databases via Entrez), and gget (20+ genomics databases) add further coverage- **70+ Optimized Python Package Skills** - Explicitly defined skills for RDKit, Scanpy, PyTorch Lightning, scikit-learn, BioPython, pyzotero, BioServices, PennyLane, Qiskit, OpenMM, MDAnalysis, scVelo, TimesFM, and others — with curated documentation, examples, and best practices. Note: the agent can write code using *any* Python package, not just these; these skills simply provide stronger, more reliable performance for the packages listed@@ -91,7 +91,7 @@ Each skill includes:- **Multi-Step Workflows** - Execute complex pipelines with a single prompt### 🎯 **Comprehensive Coverage**-- **138 Skills** - Extensive coverage across all major scientific domains+- **139 Skills** - Extensive coverage across all major scientific domains- **100+ Databases** - Unified access to 78+ databases via database-lookup, plus dedicated data access skills and multi-database packages like BioServices, BioPython, and gget- **70+ Optimized Python Package Skills** - RDKit, Scanpy, PyTorch Lightning, scikit-learn, BioServices, PennyLane, Qiskit, OpenMM, scVelo, TimesFM, and others (the agent can use any Python package; these are the pre-documented, higher-performing paths)@@ -363,7 +363,7 @@ If so, **[K-Dense Web](https://k-dense.ai)** was built for you. It is the full A| Feature | This Repo | K-Dense Web ||---------|-----------|-------------|-| Scientific Skills | 138 skills | **200+ skills** (exclusive access) |+| Scientific Skills | 139 skills | **200+ skills** (exclusive access) || Setup | Manual installation | **Zero setup, works instantly** || Compute | Your machine | **Cloud GPUs and HPC included** || Workflows | Prompt and code | **End-to-end research pipelines** |@@ -423,7 +423,7 @@ If so, **[K-Dense Web](https://k-dense.ai)** was built for you. It is the full A## 📚 Available Skills-This repository contains **138 scientific and research skills** organized across multiple domains. Each skill provides comprehensive documentation, code examples, and best practices for working with scientific libraries, databases, and tools.+This repository contains **139 scientific and research skills** organized across multiple domains. Each skill provides comprehensive documentation, code examples, and best practices for working with scientific libraries, databases, and tools.### Skill Categories@@ -489,7 +489,7 @@ This repository contains **138 scientific and research skills** organized across- Geospatial analysis: GeoPandas, GeoMaster (remote sensing, GIS, satellite imagery, spatial ML, 500+ examples)- Data processing: Dask, Polars, Vaex- Network analysis: NetworkX-- Document processing: Document Skills (PDF, DOCX, PPTX, XLSX)+- Document processing: LiteParse (local PDF/document parsing with bounding boxes and OCR), Document Skills (PDF, DOCX, PPTX, XLSX)- Infographics: Infographics (AI-powered professional infographic creation)- Diagrams: Markdown & Mermaid Writing (text-based diagrams as default documentation standard)- Exploratory data analysis: EDA workflows@@ -517,7 +517,7 @@ This repository contains **138 scientific and research skills** organized across- Web search: Parallel Web (synthesized summaries with citations)- Research notebooks: Open Notebook (self-hosted NotebookLM alternative — PDFs, videos, audio, web pages; 16+ AI providers; multi-speaker podcast generation)- Writing: Scientific Writing, Peer Review-- Document processing: XLSX, MarkItDown, Document Skills+- Document processing: LiteParse, XLSX, MarkItDown, Document Skills- Publishing: Venue Templates- Presentations: Scientific Slides, LaTeX Posters, PPTX Posters- Diagrams: Scientific Schematics, Markdown & Mermaid Writing@@ -723,7 +723,7 @@ If you use Scientific Agent Skills in your research or project, please cite it atitle = {Scientific Agent Skills: A Comprehensive Collection of Scientific Tools for AI Agents},year = {2026},url = {https://github.com/K-Dense-AI/scientific-agent-skills},- note = {138 skills covering databases, packages, integrations, and analysis tools}+ note = {139 skills covering databases, packages, integrations, and analysis tools}}```diff --git a/docs/scientific-skills.md b/docs/scientific-skills.mdindex 27bf5549..1724cbfd 100644--- a/docs/scientific-skills.md+++ b/docs/scientific-skills.md@@ -168,6 +168,7 @@### Document Processing & Conversion- **DOCX** - Create, read, edit, and manipulate Word documents (.docx files). Supports professional documents with formatting like tables of contents, headings, page numbers, letterheads, find-and-replace, tracked changes, comments, and image insertion. Use for reports, memos, letters, templates, and any Word document deliverable- **MarkItDown** - Python utility for converting 20+ file formats to Markdown optimized for LLM processing. Converts Office documents (PDF, DOCX, PPTX, XLSX), images with OCR, audio with transcription, web content (HTML, YouTube transcripts, EPUB), and structured data (CSV, JSON, XML) while preserving document structure (headings, lists, tables, hyperlinks). Key features include: Azure Document Intelligence integration for enhanced PDF table extraction, LLM-powered image descriptions using GPT-4o, batch processing with ZIP archive support, modular installation for specific formats, streaming approach without temporary files, and plugin system for custom converters. Supports Python 3.10+. Use cases: preparing documents for RAG systems, extracting text from PDFs and Office files, transcribing audio to text, performing OCR on images and scanned documents, converting YouTube videos to searchable text, processing HTML and EPUB books, converting structured data to readable format, document analysis pipelines, and LLM training data preparation+- **LiteParse** - Fast, local-first document parser (Rust core, Python/Node bindings) for layout-aware text extraction with bounding boxes—no cloud API required. Parses PDFs natively; converts Office and image formats via LibreOffice/ImageMagick when installed. Outputs layout-preserved plain text or structured JSON with per-page `text_items` (coordinates, font metadata, OCR confidence). Built-in Tesseract OCR with optional HTTP OCR servers (EasyOCR/PaddleOCR-compatible API), page subsets, encrypted PDFs, stdin/bytes parsing, and PNG page screenshots for multimodal agents. CLI (`lit parse`, `lit batch-parse`, `lit screenshot`) and Python API (`LiteParse`, `search_items`). Targets liteparse 2.0.0, Python 3.10+. Use when you need spatial grounding for RAG, batch literature ingestion, or agent vision—not for Markdown (MarkItDown) or PDF merge/split/forms (pdf skill)- **Markdown & Mermaid Writing** - Comprehensive markdown and Mermaid diagram writing skill for creating scientific documents, reports, analyses, and visualizations. Establishes text-based diagrams as the default documentation standard with full style guides, 24 diagram type references, and 9 document templates- **PDF** - Read, create, combine, split, rotate, watermark, encrypt/decrypt, and manipulate PDF files. Supports extracting text/tables, filling forms, OCR on scanned PDFs, image extraction, and format conversion- **PPTX** - Create, read, edit, and manipulate PowerPoint presentations (.pptx files). Use for slide decks, pitch decks, extracting text from presentations, editing existing slides, combining or splitting presentations, and working with templates, layouts, speaker notes, and commentsdiff --git a/pyproject.toml b/pyproject.tomlindex 89b72464..9d132853 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -1,6 +1,6 @@[project]name = "scientific-agent-skills"-version = "2.41.0"+version = "2.42.0"description = "A set of ready to use Agent Skills for research, science, engineering, analysis, finance and writing."readme = "README.md"requires-python = ">=3.13"diff --git a/scientific-skills/liteparse/SKILL.md b/scientific-skills/liteparse/SKILL.mdnew file mode 100644index 00000000..d8965374--- /dev/null+++ b/scientific-skills/liteparse/SKILL.md@@ -0,0 +1,294 @@+---+name: liteparse+description: Local document and PDF parsing with spatial text and bounding boxes. Use for extracting text from PDFs, DOCX, Office files, and images; OCR on scans; layout-preserved JSON for RAG; batch-ingesting paper folders; or page screenshots for multimodal agents — even when the user does not name liteparse. Prefer over MarkItDown when you need bboxes, fast local parsing, or PNG page renders; prefer over the pdf skill for merge/split/forms.+license: Apache-2.0+allowed-tools: Read Write Edit Bash+compatibility: Python 3.10+. Optional LibreOffice (Office formats) and ImageMagick (images). Bundled Tesseract for OCR. All processing is local — no cloud API required.+metadata:+ skill-author: K-Dense Inc.+---++# LiteParse — Local Document Parsing++## Overview++LiteParse is a fast, open-source document parser (Rust core, Python/Node bindings) focused on **local, layout-aware text extraction** with bounding boxes. It does not produce Markdown and does not call cloud LLMs. Outputs are **plain text** (layout-preserved) or **structured JSON** with per-page `text_items` (position, font metadata, optional confidence).++**Version note:** Examples target **liteparse 2.0.0** (PyPI, May 2026). The upstream V1 branch is legacy; this skill documents **V2 / main** only.++For parser selection vs MarkItDown, the `pdf` skill, or LlamaParse, see `references/choosing_a_parser.md`.++## When to Use This Skill++Use LiteParse when you need:++- **Fast local parsing** of PDFs or converted Office/image files without cloud dependencies+- **Spatial text** with bounding boxes for layout-aware RAG, citation grounding, or figure/table region logic+- **OCR** on scanned PDFs or images (bundled Tesseract, or a user-run HTTP OCR server)+- **Page screenshots** (PNG) for multimodal agents that must see charts, figures, or handwriting+- **Batch ingestion** of literature folders, supplementary PDFs, or protocol libraries+- **Page subsets** or **password-protected** PDFs++## When Not to Use++| Task | Use instead |+|------|-------------|+| Markdown for LLM ingestion (EPUB, audio, YouTube, HTML) | `markitdown` skill |+| Merge/split PDFs, forms, watermarks, rotation | `pdf` skill |+| Dense tables, handwriting, production cloud pipelines | [LlamaParse](https://docs.cloud.llamaindex.ai/llamaparse/overview) (cloud; sign up separately) |++## Installation++```bash+uv pip install "liteparse==2.0.0"+```++This installs the Python bindings and the **`lit`** CLI. Verify:++```bash+lit --help+python -c "import liteparse; print(liteparse.__version__)"+```++**Optional system tools** (for non-PDF inputs):++- **LibreOffice** — Word, Excel, PowerPoint, OpenDocument, CSV/TSV+- **ImageMagick** — PNG, JPEG, TIFF, WebP, SVG, etc.++Install commands are in `references/ocr_and_formats.md`.++**Node.js / TypeScript** (optional): `npm i @llamaindex/liteparse` — see `references/api_reference.md`.++---++## Quick Start++### Python++```python+from liteparse import LiteParse++parser = LiteParse(quiet=True)+result = parser.parse("paper.pdf")+print(result.text)++for page in result.pages:+ print(f"Page {page.page_num}: {len(page.text_items)} items")+```++### CLI++```bash+# Layout-preserved text (default)+lit parse paper.pdf++# Structured JSON with bounding boxes+lit parse paper.pdf --format json -o paper.json++# Disable OCR on text-native PDFs (faster)+lit parse paper.pdf --no-ocr+```++---++## Core Workflows++### 1. Parse to layout-preserved text++Best for quick full-document text or feeding chunkers that do not need coordinates.++```python+parser = LiteParse(ocr_enabled=True, quiet=True)+result = parser.parse("document.pdf")+full_text = result.text+```++```bash+lit parse document.pdf -o output.txt+```++### 2. Parse to structured JSON (bounding boxes)++Use when building layout-aware RAG, highlighting source regions, or joining text with screenshots.++```python+import json+from liteparse import LiteParse++parser = LiteParse(output_format="json", quiet=True)+result = parser.parse("document.pdf")++# Programmatic access+for page in result.pages:+ for item in page.text_items:+ bbox = (item.x, item.y, item.width, item.height)+ # item.text, item.confidence, item.font_name, item.font_size+```++```bash+lit parse document.pdf --format json -o document.json+```++JSON field layout: `references/output_formats.md`.++### 3. Parse specific pages++```python+parser = LiteParse(target_pages="1-5,10,15-20", quiet=True)+result = parser.parse("long_paper.pdf")+```++```bash+lit parse long_paper.pdf --target-pages "1-5,10"+```++### 4. Parse from bytes or stdin++Useful for uploads, S3 downloads, or piping remote PDFs.++```python+with open("document.pdf", "rb") as f:+ result = parser.parse(f.read())+```++```bash+curl -sL https://example.com/report.pdf | lit parse -+```++### 5. Page screenshots for multimodal agents++Screenshots capture visual content that text extraction alone misses (figures, complex tables, handwriting).++```python+from pathlib import Path++parser = LiteParse(dpi=150, quiet=True)+shots = parser.screenshot("document.pdf", page_numbers=[1, 2, 3])+out = Path("screenshots")+out.mkdir(exist_ok=True)+for s in shots:+ (out / f"page_{s.page_num}.png").write_bytes(s.image_bytes)+```++```bash+lit screenshot document.pdf --target-pages "1,3,5" -o ./screenshots+lit screenshot document.pdf --dpi 300 -o ./screenshots+```++Combine **JSON parse + screenshots** when an agent needs both coordinates and pixels for the same pages.++### 6. Batch-parse a directory++For large corpora, prefer the CLI (parallel OCR workers) or the bundled script.++```bash+lit batch-parse ./papers ./parsed --format json --recursive+lit batch-parse ./papers ./parsed --extension .pdf --no-ocr+```++```bash+python scripts/batch_parse_dir.py ./papers ./parsed --format json --recursive+```++See `scripts/batch_parse_dir.py` for a Python batch wrapper without network calls.++### 7. OCR configuration++OCR is **on by default**. Tesseract is bundled; no extra install for basic English OCR.++```python+parser = LiteParse(+ ocr_enabled=True,+ ocr_language="eng", # Tesseract codes: fra, deu, etc.+ num_workers=4, # parallel OCR (default: CPU cores - 1)+ dpi=150, # higher DPI → better OCR, slower+)+```++```bash+lit parse scan.pdf --ocr-language fra+lit parse scan.pdf --no-ocr+lit parse scan.pdf --ocr-server-url http://localhost:8080/ocr+```++**Offline / air-gapped:** set `TESSDATA_PREFIX` to a directory of `.traineddata` files, or pass `--tessdata-path`. Details: `references/ocr_and_formats.md`.++### 8. Encrypted PDFs++```python+parser = LiteParse(password="secret", quiet=True)+result = parser.parse("protected.pdf")+```++```bash+lit parse protected.pdf --password secret+```++### 9. Search text items by phrase++Merge adjacent items and return combined bounding boxes for a phrase (e.g. section titles).++```python+from liteparse import search_items++page = result.get_page(1)+matches = search_items(page.text_items, "Materials and Methods", case_sensitive=False)+```++---++## Multi-Format Inputs++| Category | Extensions (examples) | Requirement |+|----------|----------------------|-------------|+| PDF | `.pdf` | Native |+| Office | `.docx`, `.xlsx`, `.pptx`, `.doc`, `.odt`, … | LibreOffice |+| Images | `.png`, `.jpg`, `.tiff`, `.webp`, `.svg`, … | ImageMagick |++Files are converted to PDF internally, then parsed. If conversion tools are missing, parsing fails with an actionable error — install the dependency and retry.++---++## Performance Tips++- **`--no-ocr`** on born-digital PDFs — largest speedup+- **`target_pages`** — parse only methods/supplement sections+- **`num_workers`** — scale OCR across CPU cores+- **`max_pages`** — cap very large files (default 1000)+- **`lit batch-parse`** — directory-scale jobs with `--recursive` and `--extension`+- Lower **`dpi`** (e.g. 100) when OCR quality is already sufficient++---++## Reference Files++| File | Read when |+|------|-----------|+| `references/choosing_a_parser.md` | Unsure whether to use LiteParse, MarkItDown, pdf, or LlamaParse |+| `references/api_reference.md` | Python/TypeScript API, types, `search_items` |+| `references/cli_reference.md` | Full `lit` command flags |+| `references/output_formats.md` | JSON schema, bboxes, confidence scores |+| `references/ocr_and_formats.md` | Tesseract, HTTP OCR, LibreOffice, ImageMagick |++---++## Troubleshooting++| Issue | Fix |+|-------|-----|+| Office file fails | Install LibreOffice; ensure `soffice` is on PATH (Windows: add LibreOffice `program` dir) |+| Image fails | Install ImageMagick; verify `convert` or `magick` works |+| OCR poor quality | Increase `--dpi`; try `--ocr-language`; or HTTP OCR server |+| OCR slow | `--no-ocr` if not needed; reduce pages; increase `num_workers` |+| Air-gapped OCR | `export TESSDATA_PREFIX=/path/to/tessdata` or `--tessdata-path` |+| `ParseError` on bytes | Ensure input is valid PDF bytes (Office bytes need a file path + conversion) |++---++## Resources++- **GitHub**: https://github.com/run-llama/liteparse+- **Docs**: https://developers.llamaindex.ai/liteparse/+- **PyPI**: https://pypi.org/project/liteparse/2.0.0/+- **npm**: https://www.npmjs.com/package/@llamaindex/liteparse+- **OCR API spec**: https://github.com/run-llama/liteparse/blob/main/OCR_API_SPEC.mddiff --git a/scientific-skills/liteparse/references/api_reference.md b/scientific-skills/liteparse/references/api_reference.mdnew file mode 100644index 00000000..625729fb--- /dev/null+++ b/scientific-skills/liteparse/references/api_reference.md@@ -0,0 +1,169 @@+# LiteParse API Reference++Targets **liteparse 2.0.0** (Python) and **@llamaindex/liteparse** (Node). Rust crate: `liteparse = "2"`.++## Python: `LiteParse`++```python+from liteparse import LiteParse, ParseResult, ParsedPage, TextItem, ScreenshotResult, search_items+```++### Constructor options++| Python parameter | Type | Default | Description |+|------------------|------|---------|-------------|+| `ocr_enabled` | bool | `True` | Run OCR on regions needing it |+| `ocr_language` | str | `"eng"` | Tesseract language code |+| `ocr_server_url` | str \| None | `None` | HTTP OCR server (see `ocr_and_formats.md`) |+| `tessdata_path` | str \| None | `None` | Path to tessdata directory |+| `max_pages` | int | `1000` | Maximum pages to parse |+| `target_pages` | str \| None | `None` | e.g. `"1-5,10,15-20"` |+| `dpi` | float | `150` | Render DPI (OCR / screenshots) |+| `output_format` | str | `"json"` | `"json"` or `"text"` (affects native output mode) |+| `preserve_very_small_text` | bool | `False` | Keep very small text runs |+| `password` | str \| None | `None` | Encrypted PDF password |+| `quiet` | bool | `False` | Suppress progress output |+| `num_workers` | int | CPU−1 | Concurrent OCR workers |++### `parse(file_data)`++**Input:** file path (`str` / `Path`) or **raw PDF bytes** (`bytes`).++**Returns:** `ParseResult`++```python+@dataclass+class ParseResult:+ pages: List[ParsedPage]+ text: str # full document text (layout-preserved)++ @property+ def num_pages(self) -> int++ def get_page(self, page_num: int) -> Optional[ParsedPage] # 1-indexed+```++```python+@dataclass+class ParsedPage:+ page_num: int+ width: float+ height: float+ text: str+ text_items: List[TextItem]+```++```python+@dataclass+class TextItem:+ text: str+ x: float+ y: float+ width: float+ height: float+ font_name: Optional[str]+ font_size: Optional[float]+ confidence: Optional[float] # 0.0–1.0 when from OCR+```++**Raises:** `FileNotFoundError`, `ParseError`++### `screenshot(file_path, *, page_numbers=None)`++**Input:** path to document (PDF or convertible format).++**Returns:** `List[ScreenshotResult]` with PNG bytes.++```python+@dataclass+class ScreenshotResult:+ page_num: int+ width: int+ height: int+ image_bytes: bytes+```++Non-PDF formats are converted when LibreOffice/ImageMagick are installed.++### `get_config()`++Returns resolved `LiteParseConfig` dataclass.++### `search_items(items, phrase, *, case_sensitive=False)`++Search a list of `TextItem` for a phrase that may span multiple items. Returns merged `TextItem` objects with combined bounding boxes.++```python+from liteparse import search_items++matches = search_items(page.text_items, "Figure 1", case_sensitive=False)+```++---++## TypeScript / Node.js++```typescript+import { LiteParse } from '@llamaindex/liteparse';++const parser = new LiteParse();+const result = await parser.parse('document.pdf');+console.log(result.text);++for (const page of result.pages) {+ console.log(`Page ${page.pageNum}: ${page.textItems.length} items`);+}+```++### Constructor options (camelCase)++| TypeScript | Python equivalent |+|------------|-------------------|+| `ocrEnabled` | `ocr_enabled` |+| `ocrLanguage` | `ocr_language` |+| `ocrServerUrl` | `ocr_server_url` |+| `tessdataPath` | `tessdata_path` |+| `maxPages` | `max_pages` |+| `targetPages` | `target_pages` |+| `dpi` | `dpi` |+| `preserveVerySmallText` | `preserve_very_small_text` |+| `password` | `password` |+| `quiet` | `quiet` |+| `numWorkers` | `num_workers` |++### Parse from bytes++```typescript+import { readFile } from 'fs/promises';++const pdfBytes = await readFile('document.pdf');+const result = await parser.parse(pdfBytes);+```++### Screenshots++```typescript+const screenshots = parser.screenshot('document.pdf', [1, 2, 3]);+for (const s of screenshots) {+ // s.pageNum, s.width, s.height, s.imageBuffer (PNG)+}+```++Install: `npm i @llamaindex/liteparse` (includes `lit` CLI).++Browser/edge: `@llamaindex/liteparse-wasm` — see upstream WASM README.++---++## Rust (library)++```rust+use liteparse::{LiteParse, LiteParseConfig};++let parser = LiteParse::new(LiteParseConfig::default());+let result = parser.parse("document.pdf").await?;+```++Custom OCR: implement `OcrEngine` trait and `.with_ocr_engine(Arc::new(engine))`.++CLI: `cargo install liteparse`diff --git a/scientific-skills/liteparse/references/choosing_a_parser.md b/scientific-skills/liteparse/references/choosing_a_parser.mdnew file mode 100644index 00000000..9a298353--- /dev/null+++ b/scientific-skills/liteparse/references/choosing_a_parser.md@@ -0,0 +1,70 @@+# Choosing a Document Parser++Use this guide to pick the right tool in the scientific-agent-skills repo (or LlamaParse for cloud escalation).++```mermaid+flowchart TD+ start[User has a document task]+ start --> q1{Need PDF merge split forms or encryption utilities?}+ q1 -->|yes| pdfSkill[pdf skill]+ q1 -->|no| q2{Need Markdown audio video EPUB or Azure table extraction?}+ q2 -->|yes| markitdown[markitdown skill]+ q2 -->|no| q3{Need bounding boxes fast local parse or page PNGs for agents?}+ q3 -->|yes| liteparse[liteparse skill]+ q3 -->|no| q4{Complex tables handwriting or production cloud pipeline?}+ q4 -->|yes| llamaparse[LlamaParse cloud]+ q4 -->|no| liteparse+```++## Comparison table++| Criterion | LiteParse | MarkItDown | pdf skill | LlamaParse |+|-----------|-----------|------------|-----------|------------|+| **Primary output** | Layout text + JSON with bboxes | Markdown | PDF bytes / extracted text | Structured markdown / JSON (cloud) |+| **Runs locally** | Yes | Yes | Yes | No (cloud API) |+| **Bounding boxes** | Yes | No | Limited | Yes (cloud) |+| **OCR** | Tesseract + optional HTTP OCR | Yes (images/PDF) | Via external tools | Advanced |+| **Page screenshots** | Yes (PNG) | No | Image extract only | Varies |+| **Office → text** | Via LibreOffice convert | Native converters | N/A | Yes |+| **Audio / video / EPUB** | No | Yes | No | Some formats |+| **PDF merge / split / forms** | No | No | Yes | No |+| **Best for** | RAG grounding, agent vision, batch PDF corpus | LLM-friendly Markdown pipelines | PDF manipulation | Hard documents at scale |++## Decision rules++### Choose **LiteParse** when++- You need **coordinates** for citations, highlighting, or layout-aware chunking.+- You want **fast local** parsing without API keys.+- You are building **multimodal** workflows (parse JSON + page screenshots).+- You are batch-processing **folders of PDFs** for a literature review pipeline.+- Scanned PDFs need **OCR** with optional custom HTTP OCR backends.++### Choose **MarkItDown** when++- The downstream step expects **Markdown** (RAG, summarization, notebook ingestion).+- Inputs include **HTML, EPUB, audio, YouTube**, or you want **Azure Document Intelligence** for tables.+- You do not need per-span bounding boxes.++### Choose the **pdf** skill when++- The task is **PDF file operations**: merge, split, rotate, watermark, fill forms, encrypt/decrypt.+- You only need simple text extraction without spatial layout or OCR orchestration.++### Choose **LlamaParse** when++- Documents have **dense tables, multi-column layouts, charts, or handwriting** beyond what local parsers handle well.+- You are building a **production document pipeline** and accept cloud dependency and signup.++Link: https://docs.cloud.llamaindex.ai/llamaparse/overview++## Combining tools++Common pipelines:++1. **LiteParse → chunk + embed** — JSON/text for vector store; bboxes for UI highlights.+2. **LiteParse screenshots + vision model** — figures and tables; text JSON for search.+3. **LiteParse text → MarkItDown-style post-processing** — only if you must have Markdown; otherwise use LiteParse text directly.+4. **pdf skill merge** → **LiteParse parse** — assemble supplementary PDFs, then extract.++Avoid running LiteParse and MarkItDown on the same file unless you have distinct consumers (coordinates vs Markdown).diff --git a/scientific-skills/liteparse/references/cli_reference.md b/scientific-skills/liteparse/references/cli_reference.mdnew file mode 100644index 00000000..0fc45066--- /dev/null+++ b/scientific-skills/liteparse/references/cli_reference.md@@ -0,0 +1,118 @@+# LiteParse CLI Reference (`lit`)++The **`lit`** command ships with `liteparse` (Python), `@llamaindex/liteparse` (npm), and `cargo install liteparse` (Rust). Behavior is the same across installs.++```bash+lit --help+lit parse --help+lit batch-parse --help+lit screenshot --help+```++---++## `lit parse`++Parse a single file or stdin.++```+lit parse [OPTIONS] <file>+```++| Option | Description |+|--------|-------------|+| `-o, --output <file>` | Write output to file (default: stdout) |+| `--format <format>` | `json` or `text` (default: `text`) |+| `--no-ocr` | Disable OCR |+| `--ocr-language <lang>` | Tesseract language (default: `eng`) |+| `--ocr-server-url <url>` | HTTP OCR server base URL |+| `--tessdata-path <path>` | Tessdata directory |+| `--max-pages <n>` | Max pages (default: 1000) |+| `--target-pages <pages>` | e.g. `1-5,10,15-20` |+| `--dpi <dpi>` | Rendering DPI (default: 150) |+| `--preserve-small-text` | Keep very small text |+| `--password <password>` | Encrypted document password |+| `--num-workers <n>` | Concurrent OCR workers |+| `-q, --quiet` | Suppress progress |+| `-h, --help` | Help |++### Examples++```bash+lit parse document.pdf+lit parse document.pdf --format json -o output.json+lit parse document.pdf --target-pages "1-5,10" --no-ocr+lit parse scan.pdf --ocr-language fra --dpi 200+lit parse protected.pdf --password secret+curl -sL https://example.com/paper.pdf | lit parse - -o paper.txt+```++---++## `lit batch-parse`++Parse every supported file in a directory.++```+lit batch-parse [OPTIONS] <input-dir> <output-dir>+```++| Option | Description |+|--------|-------------|+| `--format <format>` | `json` or `text` (default: `text`) |+| `--no-ocr` | Disable OCR |+| `--ocr-language <lang>` | Tesseract language (default: `eng`) |+| `--ocr-server-url <url>` | HTTP OCR server |+| `--tessdata-path <path>` | Tessdata directory |+| `--max-pages <n>` | Max pages per file (default: 1000) |+| `--dpi <dpi>` | Rendering DPI (default: 150) |+| `--recursive` | Recurse into subdirectories |+| `--extension <ext>` | Only files with extension (e.g. `.pdf`) |+| `--password <password>` | Password for encrypted documents |+| `--num-workers <n>` | Concurrent OCR workers |+| `-q, --quiet` | Suppress progress |+| `-h, --help` | Help |++### Examples++```bash+lit batch-parse ./papers ./parsed+lit batch-parse ./papers ./parsed --format json --recursive+lit batch-parse ./pdfs ./out --extension .pdf --no-ocr+```++Output files mirror input basenames with `.txt` or `.json` extension.++---++## `lit screenshot`++Render pages to PNG files.++```+lit screenshot [OPTIONS] <file>+```++| Option | Description |+|--------|-------------|+| `-o, --output-dir <dir>` | Output directory (default: `./screenshots`) |+| `--target-pages <pages>` | Pages to render (e.g. `1,3,5` or `1-5`) |+| `--dpi <dpi>` | Rendering DPI (default: 150) |+| `--password <password>` | Encrypted document password |+| `-q, --quiet` | Suppress progress |+| `-h, --help` | Help |++### Examples++```bash+lit screenshot document.pdf -o ./screenshots+lit screenshot document.pdf --target-pages "1,3,5" --dpi 300+```++---++## Environment variables++| Variable | Description |+|----------|-------------|+| `TESSDATA_PREFIX` | Directory containing Tesseract `.traineddata` files (offline/air-gapped) |diff --git a/scientific-skills/liteparse/references/ocr_and_formats.md b/scientific-skills/liteparse/references/ocr_and_formats.mdnew file mode 100644index 00000000..5b654745--- /dev/null+++ b/scientific-skills/liteparse/references/ocr_and_formats.md@@ -0,0 +1,143 @@+# OCR and Supported Input Formats++## Built-in OCR (Tesseract)++- **Default:** OCR enabled on parse.+- **Engine:** Tesseract bundled with the library (zero extra setup for typical English PDFs).+- **Disable** when PDFs have selectable text: `--no-ocr` or `ocr_enabled=False`.++```bash+lit parse document.pdf+lit parse document.pdf --ocr-language fra+lit parse document.pdf --no-ocr+```++```python+parser = LiteParse(ocr_enabled=True, ocr_language="eng", num_workers=4)+```++### Language codes++Use **Tesseract** codes (not ISO alone): `eng`, `fra`, `deu`, `spa`, `chi_sim`, etc. Map HTTP OCR `language=en` separately (see below).++### Offline / air-gapped environments++Pre-download `.traineddata` files, then either:++```bash+export TESSDATA_PREFIX=/path/to/tessdata+lit parse document.pdf --ocr-language eng+```++or:++```bash+lit parse document.pdf --tessdata-path /path/to/tessdata+```++---++## HTTP OCR servers (optional)++For higher accuracy or GPU-backed OCR, run a server implementing the LiteParse OCR API and point LiteParse at it:++```bash+lit parse document.pdf --ocr-server-url http://localhost:8080/ocr+```++```python+parser = LiteParse(ocr_server_url="http://localhost:8080/ocr")+```++### API contract (summary)++- **POST** `{base_url}/ocr` (typically `http://host:8080/ocr`)+- **Content-Type:** `multipart/form-data`+- **Fields:** `file` (image bytes, required), `language` (optional, ISO 639-1, default `en`)+- **Response JSON:**++```json+{+ "results": [+ {+ "text": "recognized text",+ "bbox": [x1, y1, x2, y2],+ "confidence": 0.95+ }+ ]+}+```++- Origin top-left; bbox axis-aligned in pixels.+- Full spec: https://github.com/run-llama/liteparse/blob/main/OCR_API_SPEC.md++### Reference server implementations (upstream repo)++- `ocr/easyocr/` — EasyOCR wrapper+- `ocr/paddleocr/` — PaddleOCR wrapper++You only need a server if you choose HTTP OCR; Tesseract is sufficient for many workflows.++---++## Supported input formats++### PDF (native)++`.pdf` — no conversion step.++### Office documents (LibreOffice)++Requires LibreOffice installed and on PATH.++| Type | Extensions |+|------|------------|+| Word | `.doc`, `.docx`, `.docm`, `.odt`, `.rtf`, `.pages` |+| PowerPoint | `.ppt`, `.pptx`, `.pptm`, `.odp`, `.key` |+| Spreadsheets | `.xls`, `.xlsx`, `.xlsm`, `.ods`, `.csv`, `.tsv`, `.numbers` |++**Install LibreOffice:**++```bash+# macOS+brew install --cask libreoffice++# Ubuntu/Debian+sudo apt-get install libreoffice++# Windows (Chocolatey)+choco install libreoffice-fresh+```++On Windows, add LibreOffice `program` directory to PATH (often `C:\Program Files\LibreOffice\program`).++### Images (ImageMagick)++Requires ImageMagick.++| Formats |+|---------|+| `.jpg`, `.jpeg`, `.png`, `.gif`, `.bmp`, `.tiff`, `.webp`, `.svg` |++**Install ImageMagick:**++```bash+# macOS+brew install imagemagick++# Ubuntu/Debian+sudo apt-get install imagemagick++# Windows+choco install imagemagick.app+```++---++## Conversion pipeline++```text+Office / image → (LibreOffice or ImageMagick) → PDF → PDFium extract → optional OCR → grid projection → text + JSON+```++If conversion fails, install the missing tool and retry. Plain-text-only paths cannot be screenshot-rendered.diff --git a/scientific-skills/liteparse/references/output_formats.md b/scientific-skills/liteparse/references/output_formats.mdnew file mode 100644index 00000000..3a529976--- /dev/null+++ b/scientific-skills/liteparse/references/output_formats.md@@ -0,0 +1,146 @@+# LiteParse Output Formats++## Text output (`--format text`)++- **CLI:** layout-preserved plain text written to stdout or `-o` file.+- **Python:** `ParseResult.text` — full document; each `ParsedPage.text` — page-level text.+- Reading order follows reconstructed spatial layout (grid projection), not raw PDF content stream order.++Use text output when feeding chunkers, summarizers, or keyword search that do not need coordinates.++---++## JSON output (`--format json`)++### CLI++```bash+lit parse document.pdf --format json -o document.json+```++The CLI serializes the native parse result. Structure aligns with the Python object model below.++### Python object model++After `parser.parse(path)`, use `result.pages` and `result.text`. To emit JSON manually:++```python+import json+from dataclasses import asdict++# Simple serialization pattern (adapt fields as needed)+def page_to_dict(page):+ return {+ "page_num": page.page_num,+ "width": page.width,+ "height": page.height,+ "text": page.text,+ "text_items": [+ {+ "text": item.text,+ "x": item.x,+ "y": item.y,+ "width": item.width,+ "height": item.height,+ "font_name": item.font_name,+ "font_size": item.font_size,+ "confidence": item.confidence,+ }+ for item in page.text_items+ ],+ }++payload = {+ "text": result.text,+ "pages": [page_to_dict(p) for p in result.pages],+}+json.dump(payload, open("out.json", "w"), indent=2)+```++### Example JSON shape++```json+{+ "text": "Full document text...\n",+ "pages": [+ {+ "page_num": 1,+ "width": 612.0,+ "height": 792.0,+ "text": "Page 1 text...",+ "text_items": [+ {+ "text": "Introduction",+ "x": 72.0,+ "y": 100.0,+ "width": 120.0,+ "height": 14.0,+ "font_name": "Times-Bold",+ "font_size": 12.0,+ "confidence": null+ },+ {+ "text": "scanned phrase",+ "x": 80.0,+ "y": 400.0,+ "width": 200.0,+ "height": 12.0,+ "font_name": null,+ "font_size": null,+ "confidence": 0.94+ }+ ]+ }+ ]+}+```++Exact CLI JSON keys may match upstream serialization; treat `text_items` geometry as authoritative for grounding.++---++## Bounding box coordinate system++- Origin **(0, 0)** is **top-left** of the page.+- **x** increases right; **y** increases down.+- Each `TextItem` uses **(x, y, width, height)** — top-left corner plus size in page units (typically PDF points).+- HTTP OCR servers return `[x1, y1, x2, y2]`; LiteParse normalizes into `x, y, width, height` internally.++### Convert corner box to width/height++```python+x1, y1, x2, y2 = bbox+x, y, width, height = x1, y1, x2 - x1, y2 - y1+```++---++## Confidence scores++- Present on OCR-derived `text_items` (since upstream v1.4.0).+- Range **0.0–1.0** when set; `null` for native PDF text extraction.+- Filter low-confidence items in downstream pipelines if needed.++---++## Phrase search across items++Use `search_items()` when a query spans multiple `text_items`:++```python+from liteparse import search_items++hits = search_items(page.text_items, "Supplementary Table 1")+for hit in hits:+ # hit.text — matched phrase+ # hit.x, hit.y, hit.width, hit.height — merged bbox+```++---++## Layout-aware RAG patterns++1. **Chunk by page** — `page.text` or group `text_items` by vertical bands.+2. **Ground citations** — store `(page_num, x, y, width, height)` with each chunk.+3. **Multimodal** — pair JSON chunks with `screenshot()` PNGs for the same `page_num`.+4. **Quality gate** — drop items with `confidence` below threshold on OCR-heavy pages.diff --git a/scientific-skills/liteparse/scripts/batch_parse_dir.py b/scientific-skills/liteparse/scripts/batch_parse_dir.pynew file mode 100644index 00000000..fb80799e--- /dev/null+++ b/scientific-skills/liteparse/scripts/batch_parse_dir.py@@ -0,0 +1,163 @@+#!/usr/bin/env python3+"""+Batch-parse documents in a directory with LiteParse (local only, no network).++Usage:+ python batch_parse_dir.py INPUT_DIR OUTPUT_DIR [--format json|text] [--no-ocr] [--recursive] [--extension .pdf]+"""++from __future__ import annotations++import argparse+import json+import sys+from pathlib import Path+from typing import Iterable, List, Optional++from liteparse import LiteParse, ParseResult++DEFAULT_EXTENSIONS = {+ ".pdf",+ ".doc",+ ".docx",+ ".docm",+ ".odt",+ ".rtf",+ ".ppt",+ ".pptx",+ ".pptm",+ ".odp",+ ".xls",+ ".xlsx",+ ".xlsm",+ ".ods",+ ".csv",+ ".tsv",+ ".png",+ ".jpg",+ ".jpeg",+ ".gif",+ ".bmp",+ ".tiff",+ ".webp",+ ".svg",+}+++def _text_item_dict(item) -> dict:+ return {+ "text": item.text,+ "x": item.x,+ "y": item.y,+ "width": item.width,+ "height": item.height,+ "font_name": item.font_name,+ "font_size": item.font_size,+ "confidence": item.confidence,+ }+++def _result_to_dict(result: ParseResult) -> dict:+ return {+ "text": result.text,+ "pages": [+ {+ "page_num": p.page_num,+ "width": p.width,+ "height": p.height,+ "text": p.text,+ "text_items": [_text_item_dict(i) for i in p.text_items],+ }+ for p in result.pages+ ],+ }+++def iter_files(+ input_dir: Path,+ *,+ recursive: bool,+ extension: Optional[str],+) -> Iterable[Path]:+ ext_filter = {extension.lower()} if extension else DEFAULT_EXTENSIONS+ pattern = "**/*" if recursive else "*"+ for path in sorted(input_dir.glob(pattern)):+ if path.is_file() and path.suffix.lower() in ext_filter:+ yield path+++def parse_one(+ parser: LiteParse,+ file_path: Path,+ output_dir: Path,+ fmt: str,+) -> tuple[bool, str, str]:+ try:+ result = parser.parse(file_path)+ out_name = f"{file_path.stem}.{'json' if fmt == 'json' else 'txt'}"+ out_path = output_dir / out_name+ if fmt == "json":+ out_path.write_text(+ json.dumps(_result_to_dict(result), indent=2),+ encoding="utf-8",+ )+ else:+ out_path.write_text(result.text, encoding="utf-8")+ return True, str(file_path), f"OK -> {out_name}"+ except Exception as exc:+ return False, str(file_path), str(exc)+++def main(argv: Optional[List[str]] = None) -> int:+ p = argparse.ArgumentParser(description="Batch-parse documents with LiteParse")+ p.add_argument("input_dir", type=Path, help="Directory of input files")+ p.add_argument("output_dir", type=Path, help="Directory for parsed output")+ p.add_argument(+ "--format",+ choices=("json", "text"),+ default="text",+ help="Output format (default: text)",+ )+ p.add_argument("--no-ocr", action="store_true", help="Disable OCR")+ p.add_argument("--recursive", action="store_true", help="Search subdirectories")+ p.add_argument(+ "--extension",+ help="Only process this extension (e.g. .pdf); default: all supported types",+ )+ p.add_argument("-q", "--quiet", action="store_true", help="Less console output")+ args = p.parse_args(argv)++ if not args.input_dir.is_dir():+ print(f"Input directory not found: {args.input_dir}", file=sys.stderr)+ return 1++ args.output_dir.mkdir(parents=True, exist_ok=True)++ parser = LiteParse(+ ocr_enabled=not args.no_ocr,+ output_format=args.format,+ quiet=args.quiet,+ )++ files = list(iter_files(args.input_dir, recursive=args.recursive, extension=args.extension))+ if not files:+ print("No matching files found.", file=sys.stderr)+ return 1++ ok, fail = 0, 0+ for fp in files:+ success, path, msg = parse_one(parser, fp, args.output_dir, args.format)+ if success:+ ok += 1+ if not args.quiet:+ print(f"✓ {path}: {msg}")+ else:+ fail += 1+ print(f"✗ {path}: {msg}", file=sys.stderr)++ print(f"Done: {ok} succeeded, {fail} failed, {len(files)} total")+ return 0 if fail == 0 else 1+++if __name__ == "__main__":+ sys.exit(main())