Skip to content
Back to skills

Extract Pdf

ASecurity

Self-improving PDF extraction engine. Rust-native via pdf_oxide. Replaces PyMuPDF (AGPL) with MIT-licensed extraction: text, blocks, sections, tables, figures, profiling, engineering detection. Shadow-LEGO cascade for automatic quality improvement via predict-extract-verify loop.

  • 6 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added September 11, 2026
code-qualitypythonrustgobash

Works with

  • cli

Security analysis

A100/100

Pro scans all 20 files and shows the line behind each finding

Scanned September 11, 2026

npx -y skills add grahama1970/agent-skills --skill extract-pdf --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Extract Pdf?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Extract Pdf
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/grahama1970-extract-pdf/badge)](https://www.skillsdirectory.com/skills/grahama1970-extract-pdf)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: extract-pdf
description: >
  Self-improving PDF extraction engine. Rust-native via pdf_oxide.
  Replaces PyMuPDF (AGPL) with MIT-licensed extraction: text, blocks,
  sections, tables, figures, profiling, engineering detection. Shadow-LEGO
  cascade for automatic quality improvement via predict-extract-verify loop.
allowed-tools: Bash, Read, Write
triggers:
  - extract pdf
  - pdf extraction
  - process pdf
  - extract text from pdf
  - survey pdf
  - profile pdf
metadata:
  short-description: "Rust-native PDF extraction replacing PyMuPDF (MIT)"
  project-path: ${HOME}/workspace/experiments/pdf_oxide

provides:
  - pdf-extraction
  - pdf-text
  - pdf-tables
  - pdf-figures
  - pdf-profiling
  - pdf-sections
  - pdf-annotations

composes:
  - assistant       # Shadow classifier: extraction strategy, header validation
  - memory          # Learned extraction parameters per document domain
  - extract-tables  # Camelot delegation for complex table extraction
  - taxonomy        # Bridge tagging for cross-domain parameter transfer
  - task-monitor    # Progress tracking for batch extraction
  - pdf-lab         # Convergence loop: extract -> compare -> tune
  - analytics       # Prediction accuracy metrics across corpus
  - agentic-evals
taxonomy:
  - extraction
  - precision
  - ingestion
disciplines:
  - extraction
---

> STOP. READ THIS ENTIRE SKILL.MD BEFORE CALLING ANY ENDPOINT.

# /extract-pdf

Rust-native PDF extraction engine via pdf_oxide. MIT-licensed replacement for
PyMuPDF across the Embry OS pipeline.

## Quick Start

```bash
# Extract a single PDF (full pipeline: profile + blocks + sections + tables + figures)
./run.sh extract document.pdf

# Extract with JSON output to directory
./run.sh extract document.pdf --output-dir ./results/

# Survey a PDF (lightweight profiling — no full extraction)
./run.sh survey document.pdf

# Batch extraction
./run.sh batch /path/to/pdfs/ --output-dir ./results/

# Raw text extraction (fast, no pipeline)
./run.sh text document.pdf

# Health check
./sanity.sh
```

## Architecture

```
PDF input
    |
    v
[pdf_oxide PdfDocument] ---- Rust: parse, decrypt, text, spans, images
    |
    v
[survey_document()] -------- Python: page-by-page scan (tables, figures,
    |                         equations, columns, sections, TOC)
    |                         + Rust profile_document() enrichment
    v
[extract_document()] ------- Rust: full pipeline
    |   - profile_document()     domain, preset, complexity, is_scanned
    |   - classify_blocks()      header, body, equation, boilerplate, etc.
    |   - build_flat_sections()  section hierarchy from headers
    |   - predict_extraction()   cascade decision points
    v
[Post-extraction] ---------- Python: thin orchestrator
    |   - LLM calls (via /assistant, /scillm)
    |   - Camelot delegation (via /extract-tables)
    |   - Output assembly (JSON envelope)
    v
[Shadow Logger] ------------ Self-correction: log predictions vs outcomes
```

## Pipeline Output

Returns a JSON envelope consumed by `/extractor` or directly:

```json
{
  "version": "1.0",
  "engine": "pdf_oxide",
  "profile": { "domain": "...", "preset": "...", "complexity_score": 3, "is_scanned": false },
  "blocks": [{ "id": "...", "page": 0, "bbox": [...], "text": "...", "block_type": "header" }],
  "sections": [{ "title": "...", "level": 1, "page_start": 0, "page_end": 3 }],
  "tables": [{ "page": 5, "bbox": [...], "strategy": "lattice", "rows": [...] }],
  "figures": [{ "page": 2, "bbox": [...], "image_path": "..." }],
  "diagnostics": { "cascade_decisions": [...] }
}
```

## Shadow-LEGO Cascade

| Decision Point | Tier 0 (Heuristic) | Tier 0.5 (Classifier) | Tier 2 (LLM) |
|---|---|---|---|
| PDF profile/preset | filename + text regex | `preset_classifier` (sklearn) | DeepSeek domain classification |
| Header validation | font/size/numbering rules | `header-verdict` classifier | `/assistant` escalation |
| Extraction strategy | scanned→OCR, simple→native | `extraction-error-classifier` | DeepSeek strategy |
| Table strategy | line density routing | `table-strategy-selector` | -- |

## Commands

| Command | Description |
|---------|-------------|
| `./run.sh extract <pdf>` | Full extraction pipeline |
| `./run.sh survey <pdf>` | Lightweight page-by-page survey |
| `./run.sh text <pdf>` | Raw text extraction only |
| `./run.sh batch <dir>` | Batch extraction |
| `./run.sh profile <pdf>` | Document profiling only |
| `./run.sh shadow` | Show shadow correction log |
| `./run.sh status` | Health check |

## Key Files (in pdf_oxide project)

| File | Role |
|------|------|
| `src/document.rs` | Core extraction: extract_text, extract_spans, extract_document |
| `src/extractors/block_classifier.rs` | Block type classification + header validation |
| `src/extractors/section_hierarchy.rs` | Section tree builder |
| `src/extractors/document_extractor.rs` | Full pipeline: profile + classify + sections + predict |
| `src/python.rs` | PyO3 bindings |
| `python/pdf_oxide/survey.py` | Page-by-page survey (canonical profiler) |
| `python/pdf_oxide/pipeline.py` | Plugin-based pipeline orchestrator |

## Dependencies

- `pdf_oxide` (local wheel or editable install from `PDF_OXIDE_ROOT`)
- `loguru` for logging
- `typer` for CLI
- `httpx` for async HTTP (LLM calls)

Files in this skill

  • SKILL.md5.2 KB
  • extract_pdf/__init__.py246 B
  • extract_pdf/cascade/__init__.py253 B
  • extract_pdf/cascade/wiring.py16.8 KB
  • extract_pdf/main.py7.6 KB
  • extract_pdf/pipeline_adapter.py13.3 KB
  • fixtures/agentic_eval.json489 B
  • policy.yaml1.3 KB
  • pyproject.toml284 B
  • run.sh3.2 KB
  • sanity.sh3.9 KB
  • viewer/index.html367 B
  • viewer/run.sh24 B
  • viewer/src/App.tsx2.9 KB
  • viewer/src/components/TaxonomyChip.tsx1.5 KB
  • viewer/src/index.css23 B
  • viewer/src/loader.ts2.3 KB
  • viewer/src/main.tsx230 B
  • viewer/src/types.ts2.2 KB
  • viewer/src/types/d3-force-shim.d.ts1.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.