Private document AI for Intel hardware. Parse PDFs, invoices, screenshots, and diagrams locally with MinerU 2.5 on OpenVINO GenAI, then turn them into struct...
---
name: local-document-ai-openvino
description: Private document AI for Intel hardware. Parse PDFs, invoices, screenshots, and diagrams locally with MinerU 2.5 on OpenVINO GenAI, then turn them into structured data or executable notebook/code scaffolds. Supports custom key-field extraction for invoice demos, with clear quick-start commands and example prompts.
---
# Private Document AI with OpenVINO
Turn local PDFs, invoices, screenshots, and diagrams into one of two useful outcomes:
1. `to-data`: classify the document and extract structured fields, tables, and JSON, including user-requested key fields.
2. `to-code`: turn screenshots, forms, and architecture diagrams into code or Jupyter notebook scaffolds.
Everything runs locally and is built for Intel CPU/GPU acceleration with OpenVINO GenAI.
The default runtime path in this release is:
- MinerU 2.5 Pro
- preconverted OpenVINO INT4 model bundle
- local PDF rendering with `pypdfium2`
- no local model export step
## Why install this skill
Install this when you want one local workflow for:
- invoice and receipt extraction
- private PDF understanding
- table and key-value extraction
- architecture diagram to notebook generation
- screenshot to HTML/React scaffold generation
This skill is especially good for demos because it already includes:
- medical invoice `to-data` flows
- restaurant invoice `to-data` flows
- custom invoice field extraction such as invoice number, date, seller, and amount due
- architecture diagram `to-code -> jupyter-notebook` flows
- local HTML reports for easy review and screenshots
## 30-second start
Check the environment:
```bash
python "{baseDir}/scripts/check_env.py"
```
Or run directly from the CLI:
```bash
python "{baseDir}/scripts/run_skill.py" --mode to-data --file "/absolute/path/to/invoice.pdf" --out "/absolute/path/to/artifacts/invoice_data" --extract "tables,entities,kv_pairs"
```
For invoice demos with custom key fields:
```bash
python "{baseDir}/scripts/run_skill.py" --mode to-data --file "/absolute/path/to/invoice.pdf" --out "/absolute/path/to/artifacts/invoice_data" --extract "tables,entities,kv_pairs" --fields "invoice_number,invoice_date,total_amount,vendor_name"
```
## Example prompts
Use prompts like these in OpenClaw:
```text
Use $local-document-ai-openvino to parse this local PDF and give me a structured report.
```
```text
Use $local-document-ai-openvino to extract invoice fields, tables, and key-value pairs from this medical invoice.
```
```text
Use $local-document-ai-openvino to classify this receipt and return normalized JSON.
```
```text
Use $local-document-ai-openvino to extract only these invoice fields from this file: invoice_number, invoice_date, total_amount, vendor_name. Return a structured JSON result with just those requested fields.
```
```text
Use $local-document-ai-openvino to extract these custom fields from this invoice: buyer_tax_id, seller_tax_id, amount_due, check_code. Save the full parse artifacts, but highlight the requested fields in the final structured output.
```
```text
Use $local-document-ai-openvino to turn this architecture diagram into a Jupyter notebook scaffold.
```
```text
Use $local-document-ai-openvino to convert this UI screenshot into an HTML scaffold.
```
## What you get
Typical outputs include:
- `parsed.json`
- `parsed.md`
- `result_report.html`
- `task_output/structured_record.json`
- `task_output/normalized.json`
- `task_output/requested_fields.json`
- `task_output/requested_fields_record.json`
- `task_output/notebook.ipynb`
- `code_preview.html`
## Best demo paths
If you are evaluating the skill for the first time, start here:
1. `to-data` on an invoice PDF
2. review `result_report.html`
3. inspect `structured_record.json`
4. rerun with `--fields` and inspect `requested_fields_record.json`
5. then try `to-code` with a diagram image and target `jupyter-notebook`
## Custom key-field extraction
After the skill is installed, users can ask for a custom field list at call time.
This is the recommended pattern for invoice demos.
Use the `fields` parameter with `to-data`:
- CLI: `--fields "invoice_number,invoice_date,total_amount,vendor_name"`
- config JSON: `"fields": "invoice_number,invoice_date,total_amount,vendor_name"`
- slash-command style: `fields=invoice_number,invoice_date,total_amount,vendor_name`
The skill will:
1. parse the full document locally with MinerU on OpenVINO
2. keep the standard `kv_pairs`, `entities`, `tables`, and traceability artifacts
3. resolve the requested field names to canonical keys when possible
4. write a focused structured output for only those requested fields
The two demo-friendly outputs are:
- `task_output/requested_fields.json`
This includes each requested field, the matched canonical key, whether it was found, the primary match, and all matches.
- `task_output/requested_fields_record.json`
This is the compact final record keyed by the user-requested field names.
Recommended invoice demo field names:
- `invoice_number`
- `invoice_code`
- `check_code`
- `invoice_date`
- `buyer_tax_id`
- `seller_tax_id`
- `vendor_name`
- `customer_name`
- `subtotal`
- `tax_amount`
- `total_amount`
- `amount_due`
Common aliases are also supported when they can be normalized to canonical keys, for example:
- `seller`
- `buyer`
- `invoice no`
- `invoice date`
- `total`
- `amount due`
## Core pipeline
Use this skill as a local document-to-action pipeline:
1. Parse the document into a canonical structured representation.
2. Optionally continue into `to-data` or `to-code`.
3. Save outputs into a predictable artifact folder with traceability.
## Read only if needed
Load these references when you need the schema or output contracts:
- `{baseDir}/references/schema.md`
- `{baseDir}/references/mode_guide.md`
- `{baseDir}/references/output_contracts.md`
## Primary entrypoint
Use this published entrypoint:
- CLI orchestrator: `{baseDir}/scripts/run_skill.py`
Do not call these implementation scripts directly from the skill:
- `parse_document.py`
- `transform_doc_to_data.py`
- `transform_doc_to_code.py`
## Local readiness
Check the environment before processing real documents:
```bash
python "{baseDir}/scripts/check_env.py"
```
For workshops, the simplest setup is installing into a skill-local `.vendor` directory.
The entry scripts auto-detect it, so you do not need to edit `PYTHONPATH`:
```bash
python "{baseDir}/scripts/install_local_runtime.py"
```
If you prefer, a normal virtual environment also works:
```bash
python -m pip install -r "{baseDir}/requirements.txt"
```
Download the preconverted MinerU OpenVINO model bundle into the skill-local `models/` folder, or point the skill at it with an environment variable:
```bash
set MINERU_OPENVINO_MODEL_DIR=C:\absolute\path\to\MinerU2.5-Pro-2604-1.2B-int4-ov
```
Recommended model bundle:
- `https://www.modelscope.cn/models/snake7gun/MinerU2.5-Pro-2604-1.2B-int4-ov`
Workshop-friendly download example:
```bash
git clone --depth 1 https://www.modelscope.cn/snake7gun/MinerU2.5-Pro-2604-1.2B-int4-ov.git "{baseDir}/models/MinerU2.5-Pro-2604-1.2B-int4-ov"
```
Run a quick orchestration smoke test:
```bash
python "{baseDir}/scripts/smoke_test.py"
```
Model assets are discovered from:
- `MINERU_OPENVINO_MODEL_DIR`
- `MINERU_MODEL_DIR`
- `{baseDir}/models/MinerU2.5-Pro-2604-1.2B-int4-ov/`
- `{baseDir}/models/mineru2.5-int4-ov/`
Prefer using a predownloaded model bundle for workshops. This skill does not require local export or automatic model download.
## Supported modes
### `parse`
Use when the user wants the structured parse only.
Outputs:
- `parsed.json`
- `parsed.md`
- `result_report.html`
- extracted layout, tables, or figures when available
### `to-data`
Use when the user wants structured extraction, normalization, or document classification.
Typical outputs under `task_output/`:
- `entities.json`
- `kv_pairs.json`
- `table_index.json`
- `normalized.json`
- `structured_record.json`
- `requested_fields.json`
- `requested_fields_record.json`
- `traceability.json`
### `to-code`
Use when the user wants implementation-oriented output from the parse result.
Supported targets:
- `react`
- `html-css`
- `json-schema`
- `jupyter-notebook`
Typical outputs under `task_output/`:
- `component_map.json`
- `field_schema.json`
- `ui_blueprint.json`
- `notes.md`
- `traceability.json`
- target-specific artifacts such as `app.jsx`, `index.html`, `styles.css`, `schema.json`, `notebook.ipynb`, or `notebook_plan.json`
Treat all generated code and notebooks as drafts. Review them before running, publishing, or connecting them to real systems.
## Published package scope
The published ClawHub bundle is intentionally CLI-first.
- main workflow: `scripts/run_skill.py`
- diagnostics: `scripts/check_env.py`
- smoke verification: `scripts/smoke_test.py`
Developer-only local UI helpers are kept out of the public release bundle.
## Pipeline rules
Always follow these rules:
1. Prefer local execution.
2. Always parse first into `parsed.json`.
3. Generate downstream artifacts from `parsed.json`, not raw OCR text alone.
4. Preserve page numbers, reading order, block types, and source anchors when possible.
5. Write traceability for downstream outputs.
6. Mark low-confidence regions or assumptions explicitly.
7. Do not silently drop tables, figures, formulas, charts, or key-value regions.
8. Save outputs into one artifact folder per run.
9. For confidential documents, prefer an explicit private `--out` directory and remove artifacts after review.
## Output contract
Default output folder:
`./artifacts/<document_stem>/`
Expected top-level outputs:
- `effective_config.json`
- `run_report.json`
- `parsed.json`
- `parsed.md`
- `result_report.html`
- `task_output/`
`to-code` runs may also emit:
- `code_preview.html`
## CLI examples
### Parse
```bash
python "{baseDir}/scripts/run_skill.py" \
--mode parse \
--file "/absolute/path/to/report.pdf" \
--out "/absolute/path/to/artifacts/report_parse"
```
### To-data
```bash
python "{baseDir}/scripts/run_skill.py" \
--mode to-data \
--file "/absolute/path/to/invoice.pdf" \
--out "/absolute/path/to/artifacts/invoice_data" \
--extract "tables,entities,kv_pairs"
```
### To-data with custom fields
```bash
python "{baseDir}/scripts/run_skill.py" \
--mode to-data \
--file "/absolute/path/to/invoice.pdf" \
--out "/absolute/path/to/artifacts/invoice_data" \
--extract "tables,entities,kv_pairs" \
--fields "invoice_number,invoice_date,total_amount,vendor_name"
```
### To-code
```bash
python "{baseDir}/scripts/run_skill.py" \
--mode to-code \
--file "/absolute/path/to/ui_mockup.png" \
--out "/absolute/path/to/artifacts/ui_code" \
--target "react" \
--title "Generated App"
```
### To-code notebook target
```bash
python "{baseDir}/scripts/run_skill.py" \
--mode to-code \
--file "/absolute/path/to/architecture_diagram.png" \
--out "/absolute/path/to/artifacts/notebook_code" \
--target "jupyter-notebook" \
--title "OpenVINO Notebook"
```
## Slash-command examples
```text
/skill local-document-ai-openvino parse file=./docs/report.pdf
```
```text
/skill local-document-ai-openvino to-data file=./docs/invoice.pdf extract=tables,entities,kv_pairs
```
```text
/skill local-document-ai-openvino to-data file=./docs/invoice.pdf extract=tables,entities,kv_pairs fields=invoice_number,invoice_date,total_amount,vendor_name
```
```text
/skill local-document-ai-openvino to-code file=./mockups/architecture.png target=jupyter-notebook
```
## Optional local demo UI
Start the local UI when the user wants an interactive demo page:
```bash
python "{baseDir}/scripts/serve_skill_ui.py"
```
The UI lets the user:
- preview a local file
- choose `parse`, `to-data`, or `to-code`
- choose the `to-code` target
- run the pipeline and inspect the generated local HTML reports
The bundled UI only allows preview/run access for local files under the skill directory and common user content folders such as Downloads, Documents, Desktop, and Pictures.
## Failure behavior
If a run fails:
- state which stage failed
- do not claim outputs were created if they were not
- prefer writing `error.json` with failure details
- recommend `parse` first when the downstream request is ambiguous
- surface stderr or a concise failure summary when available
## Safety notes
- Use a virtual environment for dependency installation.
- Review and approve model downloads only when you explicitly intend to.
- Keep outputs in a private local folder when documents are sensitive.
- Review generated code and notebooks before execution.
- Delete artifacts when they are no longer needed.
- The wrapper always uses the bundled local scripts and the current Python interpreter. It does not allow custom interpreter or script-directory overrides.
## Short reminder
Present this skill as a local document-understanding workflow with downstream actions and customizable field extraction, not as a plain OCR wrapper.
don't have the plugin yet? install it then click "run inline in claude" again.
added explicit inputs section with env vars and model paths, expanded procedure into granular numbered steps with input/output contracts, extracted implicit decision logic into decision points covering file not found, missing models, empty results, timeouts, and mode defaults, formalized output contract with location and file listings by mode, and added outcome signals for each mode including error cases.
turn local PDFs, invoices, screenshots, and diagrams into structured data or executable code scaffolds using PaddleOCR-VL or PaddleOCR-VL-1.5 on OpenVINO. run everything locally on Intel CPU/GPU hardware with no cloud API calls. use this when you need to extract tables, key-value pairs, and entities from documents; classify documents by type; or convert UI mockups and architecture diagrams into HTML, React, or Jupyter notebook boilerplate. the skill is built for demos and production workflows where document privacy and local inference are non-negotiable.
required parameters
file: absolute path to PDF, PNG, JPG, or screenshot filemode: one of parse, to-data, or to-codeout: absolute path to output artifact directoryoptional parameters
extract: comma-separated list of extraction targets (e.g. tables,entities,kv_pairs) for to-data modetarget: code generation target for to-code mode; one of react, html-css, json-schema, jupyter-notebooktitle: human-readable title for generated artifacts (used in notebooks and code previews)environment variables and external connections
PADDLEOCR_VL_OPENVINO_MODEL_DIR: path to PaddleOCR-VL model assets (optional; defaults to {baseDir}/models/paddleocr-vl-openvino/)PADDLEOCR_VL_LAYOUT_MODEL_DIR: path to layout detection models (optional)PADDLEOCR_VL_VLM_MODEL_DIR: path to vision-language model files (optional)requirements.txt)local setup
python "{baseDir}/scripts/check_env.py" to verify python, pip, OpenVINO, and model asset paths before any document processingpython -m pip install -r "{baseDir}/requirements.txt" in a dedicated virtual environmentenvironment check (input: none; output: env_status.txt)
python "{baseDir}/scripts/check_env.py"input validation (input: file, mode, out; output: validation result)
file exists and is readable (PDF, PNG, JPG, or screenshot)mode is one of parse, to-data, or to-codeout directory path is writable or can be createdmode is to-data, confirm extract parameter contains valid targetsmode is to-code, confirm target is one of react, html-css, json-schema, jupyter-notebookerror.json with failure details and haltdocument parse (input: file; output: parsed.json, parsed.md, result_report.html)
python "{baseDir}/scripts/run_skill.py" with --mode parse --file <file> --out <out>parsed.json (JSON format with all blocks and metadata)parsed.mdresult_report.html for visual revieweffective_config.jsonrun_report.json (timing, block counts, warnings)mode branch: to-data extraction (input: parsed.json, extract parameter; output: JSON files under task_output/)
to-data, invoke downstream extraction transformextract parameter; default to tables,entities,kv_pairs if not specifiedtables: identify table blocks in parsed.json, extract row/column structure, output table_index.json with page anchorsentities: apply named-entity recognition on text blocks, classify entities (person, org, amount, date, etc.), output entities.jsonkv_pairs: locate key-value patterns (labels followed by values), output kv_pairs.jsonclassification.jsonnormalized.jsonstructured_record.json combining all extracted data into a single flattened document recordtraceability.json linking each extracted field back to its source block ID, page number, and confidencetraceability.json with reasonmode branch: to-code generation (input: parsed.json, target parameter; output: code/notebook under task_output/)
to-code, invoke downstream code generation transformtarget is one of react, html-css, json-schema, jupyter-notebookparsed.json to identify UI components (buttons, fields, text areas, checkboxes, dropdowns)react: generate component hierarchy, map form fields to state, output component_map.json, app.jsx, index.html, styles.csshtml-css: generate static HTML with inline styles, output index.html, styles.cssjson-schema: extract form structure and generate JSON Schema, output schema.json and field_schema.jsonjupyter-notebook: convert diagrams or forms into executable notebook boilerplate, output notebook.ipynb and notebook_plan.json (with explanatory cells and setup instructions)ui_blueprint.json showing field names, types, constraints, and relationshipsnotes.md with assumptions and manual review warningstraceability.json linking generated code elements back to source document blockscode_preview.html showing syntax-highlighted code side-by-side with source document previewartifact organization (input: all generated files; output: {out} directory structure)
{out} if it does not existeffective_config.json, run_report.json, parsed.json, parsed.md, result_report.htmltask_output/ subdirectorytask_output/ (e.g. structured_record.json, notebook.ipynb, component_map.json)to-code, also write code_preview.html at top levelnotebook_1.ipynb, notebook_2.ipynb) if neededsmoke test (optional, diagnostic only) (input: none; output: smoke test report)
python "{baseDir}/scripts/smoke_test.py"if user provides file but no mode: default to parse and proceed to step 3. recommend explicit mode selection in future calls.
if mode is parse: execute steps 1-3 and 6 only; skip extraction and code generation. output parsed.json, parsed.md, result_report.html.
if mode is to-data but extract parameter is missing: default to tables,entities,kv_pairs. if the document contains no tables, do not fail; note in traceability.json that no table blocks were found.
if mode is to-code but target parameter is missing: halt with error message listing valid targets; do not assume a default target.
if file does not exist or is not readable: write error.json with file-not-found message and halt before step 1. do not attempt to create or download the file.
if model assets are not found (e.g. PADDLEOCR_VL_OPENVINO_MODEL_DIR does not exist and models are not in default location): halt with clear message listing expected paths and recommend python "{baseDir}/scripts/check_env.py". do not auto-download models without explicit user approval via a separate approval workflow or flag.
if document parse fails (e.g. corrupted PDF, unsupported image format, model inference error): write error.json with stage name, error message, and stderr excerpt. do not claim partial outputs. recommend retrying with a different file or running smoke_test.py to diagnose environment issues.
if extraction produces empty result set (e.g. document is a blank page or image with no text): write structured_record.json with empty arrays and note in run_report.json that no extractable content was found. do not fail; mark as complete with zero results.
if code generation encounters unsupported diagram type (e.g. flowchart in to-code mode targeting react): write note in notes.md and ui_blueprint.json that the diagram could not be fully converted. provide partial boilerplate. mark as incomplete in traceability.json.
if output directory path is not writable: attempt to create parent directories. if creation fails, write error message to stderr and halt before step 6. do not fall back to temp directory without user consent.
if user requests model auto-download: check for explicit flag or environment variable (e.g. ALLOW_MODEL_DOWNLOAD=1). if not set, halt with message explaining the flag and security implications. do not download without approval.
if runtime encounters network timeout or rate limit (e.g. from a reference lookup): log timeout in run_report.json, continue with available data, and mark affected fields in traceability.json as incomplete. do not retry or hang.
if OpenVINO model inference times out (e.g. document is very large): log timeout, write parsed.json with partial results up to timeout point, and note in run_report.json that processing was interrupted. do not claim full document coverage.
default output location: ./artifacts/<document_stem>/ where <document_stem> is the filename without extension
top-level files (always present)
effective_config.json: JSON object with all runtime parameters and environment paths used in this runrun_report.json: execution report including stage timings, block/table counts, warnings, and final status (success, partial, failure)parsed.json: canonical structured document parse with all blocks, layout info, page numbers, and confidence scores (schema: see {baseDir}/references/schema.md)parsed.md: human-readable markdown summary of extracted contentresult_report.html: interactive HTML report with document preview, extracted tables, and navigable block inspectormode-specific outputs under task_output/ subdirectory
for to-data mode:
entities.json: array of named entities with type labels and source block referenceskv_pairs.json: array of key-value pairs with page numbers and confidence scorestable_index.json: array of table metadata (page, position, row count, column count) with content previewclassification.json: document type classification and confidence (optional, if classification is requested)normalized.json: extracted fields normalized to standard formats (ISO dates, standardized phone/address/currency formats)structured_record.json: single flattened JSON object combining all extracted fields, suitable for database insert or API submissiontraceability.json: mapping of each field in structured_record.json to source block ID, page number, and confidence scorefor to-code mode:
component_map.json: hierarchical component tree for UI generation (fields, labels, groups, relationships)ui_blueprint.json: field schema including names, types (text, number, date, select, checkbox), constraints, and validation rulesfield_schema.json: detailed field metadata (label, placeholder, required, options for selects)notes.md: assumptions made during code generation, manual review checklist, and warningsreact: app.jsx, index.html, styles.css, package.json sketchhtml-css: index.html (with inline or linked styles), styles.cssjson-schema: schema.json (full JSON Schema draft 7)jupyter-notebook: notebook.ipynb (executable Jupyter notebook with setup cells, imports, and explanatory markdown), notebook_plan.json (cell structure and metadata)traceability.json: mapping of generated code elements (e.g. component names, field IDs) back to source document blockscode_preview.html: syntax-highlighted code snippets displayed alongside document preview for visual reviewerror output (on failure)
error.json: JSON object with keys: stage (string: which step failed), error_message (string: concise description), stderr_excerpt (string: up to 500 chars of stderr), timestamp (ISO 8601)all outputs use JSON with 2-space indentation and UTF-8 encoding
the skill worked when:
parse mode: parsed.json exists, contains a top-level blocks array with at least one entry (or zero entries if document is blank), run_report.json shows status success or partial, and result_report.html is viewable in a browser showing document preview and extracted content.
to-data mode: task_output/structured_record.json exists and is valid JSON with at least one field populated (or empty object if document is blank), traceability.json links each field back to a source block, run_report.json shows status success, and user can open the HTML report to verify extracted data matches visual inspection of the document.
to-code mode: task_output/notebook.ipynb or app.jsx (depending on target) exists and is valid code (checked via json.loads() for notebooks, basic syntax validation for JSX), code_preview.html renders the generated code side-by-side with document preview, notes.md contains a review checklist, and user confirms the generated scaffold aligns with the source document layout.
error case: error.json exists, contains stage name and error message, and run_report.json shows status failure; user can see which step failed and take corrective action (e.g. check file format, verify model paths, run diagnostics).
artifact cleanup: if processing sensitive documents, user deletes the entire {out} directory after review to remove local copies.
all outputs are timestamped in run_report.json and traceability files for audit and debugging.