How the Patent-Reader Skill Converts Patent PDFs into Obsidian Notes

The patent-reader skill extracts textual and visual content from patent PDFs using OCR, then assembles structured Obsidian markdown notes with enriched front-matter, embedded figures, claim-tree tables, and linked Canvas files through a six-stage automated pipeline.

The handsomestWei/patent-disclosure-skill repository provides an open-source toolkit for patent analysis and knowledge management. Its patent-reader skill transforms raw patent PDFs into fully-featured Obsidian notes, converting dense legal documents into navigable knowledge-base entries complete with metadata, glossaries, and visual references.

Stage 1: Extracting Text and Figures from PDFs

The conversion pipeline begins with two dedicated extraction modules that parse the raw PDF into structured components.

Text extraction is handled by extract_patent_text.py, which parses the PDF and runs OCR when needed to produce a clean markdown body. This module serves as the foundation for all subsequent processing.

Figure extraction occurs in extract_patent_figures.py, which detects and extracts raster or vector images from the patent document. The module creates a figures/manifest.json manifest file and copies the image files into a temporary work directory for later embedding.

These modules reside in skills/patent-reader/tools/extract/ and produce the initial artifacts required for the assembly phase.

Stage 2: Assembling the Markdown Note

The core orchestration happens in write_patent_obsidian_note.py, which receives the markdown body, patent manifest, lint results, and auxiliary JSON blobs (context anchors, synthesis bundles, claim deltas, etc.). This script performs several enrichment sub-steps:

  • Sanitizing titles – Removes internal "(Agent …)" brackets from user-facing titles to ensure clean note naming.
  • Enriching front-matter – Adds YAML fields including pub_number, domain, ipc_codes, evidence_scope, and links to the original PDF.
  • Injecting figures – Copies extracted images into the note's images/ folder and adds markdown image embeds, or creates "scan-page" preview blocks for scanned PDFs.
  • Merging glossaries – Combines glossary candidates from the synthesis bundle with existing "术语表" section entries, converting them into Obsidian wikilinks.
  • Inserting claim-trees – Renders a claim-tree markdown table using render_claim_tree_markdown and upserts it into the note body.
  • Adding navigation – Builds an "Obsidian 导航" section linking to the global index, domain index, and glossary index.

Stage 3: Building the Obsidian Canvas

Visual knowledge mapping is implemented through the build_canvas() function imported from vault/obsidian.py. This module collects metadata (domain, IPC codes, assignees), the claim-tree structure, figure references, narrative snippets, and public clues to produce a JSON Canvas file (*.canvas). The resulting Canvas file is automatically linked from the note's navigation block, providing a spatial interface for exploring patent relationships.

Stage 4: Updating Vault Indexes and CLI Properties

The skill maintains structured Map of Content (MOC) indexes within the Obsidian vault hierarchy. Notes are placed under papers/<domain>/<pub_slug>/ and indexed through three mechanisms:

  • Global index – Updates the "专利解读索引" MOC via upsert_index_entry.
  • Domain index – Maintains category-specific MOCs for each technical domain.
  • Glossary index – Cross-references terminology across patents.
  • CLI properties – Sets optional Obsidian CLI properties (domain, pub_number, evidence_scope) using try_obsidian_cli_property.

Stage 5: Copying the Original PDF

When the --copy-source-pdf flag is enabled, the pipeline preserves the original document alongside the markdown note. The resolve_source_pdf() function locates the source PDF from either manifest.source_path or workdir/source/, then copy_source_pdf_to_note_dir() copies it into note_dir/source/. A wikilink labeled "官方 PDF" is injected into the navigation block for quick reference.

Stage 6: Final Processing and Output

The pipeline concludes with several refinement operations implemented as helper functions in write_patent_obsidian_note.py:

  • escape_wikilink_pipes_in_tables() – Ensures table markdown compatibility.
  • enhance_note_citations() – Improves citation formatting and linking.
  • materialize_description_paragraphs() – Structures description sections for readability.

The final output includes the markdown note (<pub_slug>_解读_<date>.md), the Canvas JSON, updated index files, and optional source PDF copies.

End-to-End Usage Example

Execute the complete workflow using the following command sequence:


# 1. Extract text and figures from the patent PDF

python -m skills.patent-reader.tools.extract.extract_patent_text \
    --pdf /data/patents/CN1234567A.pdf \
    --out /tmp/patent_note.md

python -m skills.patent-reader.tools.extract.extract_patent_figures \
    --pdf /data/patents/CN1234567A.pdf \
    --workdir /tmp/patent_workdir

# 2. Assemble the Obsidian note with all features enabled

python skills/patent-reader/tools/vault/write_patent_obsidian_note.py \
    --content-file /tmp/patent_note.md \
    --manifest /tmp/patent_workdir/manifest.json \
    --lint-json /tmp/lint_result.json \
    --workdir /tmp/patent_workdir \
    --copy-source-pdf \
    --output /tmp/status.json

This produces:

  • outputs/patent_reader/<pub_slug>_解读_<date>.md – The final markdown note.
  • <pub_slug>_图谱.canvas – The visual canvas file.
  • Updated MOCs (_专利解读索引, <domain>_领域索引, _术语索引).

Summary

  • The patent-reader skill uses extract_patent_text.py and extract_patent_figures.py to parse PDFs and extract visual assets with OCR support.
  • write_patent_obsidian_note.py orchestrates the assembly of enriched markdown with front-matter, wikilinks, and claim-tree tables.
  • The build_canvas() function in obsidian.py generates interactive JSON Canvas files for visual patent exploration.
  • Vault organization follows the papers/<domain>/<pub_slug>/ hierarchy with automated MOC updates via upsert_index_entry.
  • Optional source PDF preservation is handled by resolve_source_pdf() and copy_source_pdf_to_note_dir().

Frequently Asked Questions

What Python modules handle the initial PDF text and figure extraction?

The extract_patent_text.py module parses PDF content and performs OCR when necessary to generate the markdown body, while extract_patent_figures.py extracts raster and vector images, creating a manifest.json file that tracks figure metadata and file locations within the temporary work directory.

How does the skill integrate patent figures into Obsidian notes?

During assembly, write_patent_obsidian_note.py copies extracted images from the work directory into the note's images/ folder and injects standard markdown image embeds. For scanned documents, it generates "scan-page" preview blocks instead of individual figure references.

What Obsidian-specific features does the generated note include?

The output notes contain enriched YAML front-matter with pub_number and ipc_codes, wikilinked glossary terms from the "术语表" section, rendered claim-tree tables, an "Obsidian 导航" section linking to vault indexes, and a companion .canvas file for visual relationship mapping.

Can the pipeline preserve the original patent PDF in the Obsidian vault?

Yes. When invoking write_patent_obsidian_note.py with the --copy-source-pdf flag, the resolve_source_pdf() function locates the original document and copy_source_pdf_to_note_dir() copies it into note_dir/source/, adding a "官方 PDF" wikilink to the navigation block for native Obsidian access.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →