extract-pdf
Multi-session pipeline for extracting content from large PDF files and distributing it into raw reference source documents under sources/. Use when importing an existing PDF (rulebook, novel, technical manual, source document) into a domain (R) across multiple sessions. Operates on the generic domain-layout convention; applies the JDR profile (lore/rules split, canon pipeline) only when the domain is JDR. Do NOT use for web research — use `overcode:research` instead; do NOT use for writing new content — use the available writing workflow instead. Do NOT use to produce final synthesized reference (`reference/` generically, `canon/` under the JDR profile) — that is a downstream ventilation role.
- License 许可
- MIT
- 最近更新
- 2026-11-11
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- extract-pdf
- metadata
- { "tags": "obsidian, parsing, notes, documentation, pdf, ingestion", "author": "fxgui", "version": "0.38.0" }
- description
- Multi-session pipeline for extracting content from large PDF files and distributing it into raw reference source documents under sources/. Use when importing an existing PDF (rulebook, novel, technical manual, source document) into a domain (R) across multiple sessions. Operates on the generic domain-layout convention; applies the JDR profile (lore/rules split, canon pipeline) only when the domain is JDR. Do NOT use for web research — use `overcode:research` instead; do NOT use for writing new content — use the available writing workflow instead. Do NOT use to produce final synthesized reference (`reference/` generically, `canon/` under the JDR profile) — that is a downstream ventilation role.
02 资源文件 17
- 参考文档actions/01-setup.md5.1 KB
- 参考文档actions/02-process-chunk.md5.0 KB
- 参考文档actions/03-distribute.md9.7 KB
- 参考文档actions/04-debug.md4.2 KB
- 参考文档agents/openai.yaml229 B
- 参考文档evals/extract-pdf-scenarios.md30.7 KB
- 参考文档evals/scenarios.json841 B
- 参考文档prompts/extract-chunk.prompt.md3.4 KB
- 参考文档prompts/extract-debug.prompt.md4.0 KB
- 参考文档prompts/extract-distribute.prompt.md10.1 KB
- 参考文档prompts/extract.prompt.md6.0 KB
- 参考文档references/bank-yml.md2.4 KB
- 参考文档references/domain-layout.md4.0 KB
- 参考文档references/host-portability.md655 B
- 脚本scripts/extract-pdf.py24.8 KB
- 脚本scripts/normalize-text.py12.9 KB
- 脚本scripts/split-pdf.py13.1 KB
03 SKILL.md 正文
Read host portability before resolving skill files, invoking sibling skills, or persisting project guidance.
Extract PDF
Four-phase pipeline for large PDF extraction across multiple Claude Code sessions.
Generic model, conditional profile.
extract-pdfoperates on the generic working-directory convention${EXTRACT_PDF_SKILL_ROOT}/references/domain-layout.md(R= subcategory, working-dir bucketsR/_<bucket>/,bank.yml, rawsources/+ synthesizedreference/, scopesshared/project). A JDR game domain is one profile of that model: the JDR profile (documented in${EXTRACT_PDF_SKILL_ROOT}/references/domain-layout.md§ JDR profile) is applied only when the domain is JDR (see Profile detection below).
Role in the pipeline:
extract-pdfproduces raw reference sources under<target>/sources/<source>/. It never ventilates into the synthesized layer —reference/generically, orcanon//mj/under the JDR profile. No downstream ventilation skill is bundled or named: stop after extraction and let the user select an installed compatible role explicitly.
Profile detection
Resolve R, then decide which layout applies before writing anything:
- JDR profile — apply if
R/bank.ymldeclaresprofile: jdr, or (zero-config fallback)Rcontains the signature buckets_univers/or_systeme/. Under this profile: raw sources split by provenance (lore →_univers/<u>/sources/, rules →_systeme/sources/); the synthesizedcanon//mj/layer remains downstream and untouched; theUniversfield names the target universe; the marker shortcut (_campagnes//_univers//_pjs/) is used to locateR. - Generic core — otherwise. Raw sources land under a single resolved target
<target>/sources/<source>/(<target>= a working-dir bucketR/_<bucket>/or the work-unit/project directory); ventilation (downstream, out of scope here) goes to<bucket>/reference/. TheUniversfield holds the target bucket/scope slug.
Two modes
| Mode | Trigger | Usage |
|---|---|---|
| Manual | /overcode:extract-pdf <action> |
Session by session, full control |
| Automated | python scripts/extract-pdf.py <project> <pdf> |
Complete orchestration, automatic restart |
In automated mode, the Python script handles session chaining, retries and the final commit. It calls the prompts in docs/prompts/workshop/ — the setup skill checks for their presence and reports the missing files.
Available actions
| # | Action | Role | Input |
|---|---|---|---|
| 01 | setup |
Session 1 — validate, chunk the PDF, write progress.md | <project-dir> + <source-document> |
| 02 | process-chunk |
Sessions 2-N — extract a chunk into classified/*.md | <project-dir> + <source-name> + chunk id |
| 03 | distribute |
Final session — merge into the reference sources | <project-dir> + <source-name> |
| 04 | debug |
Any session — diagnose extraction anomalies | <project-dir> + <source-name> [chunk-id] |
<project-dir>= the work-unit / writing project directory (R/<AAAA>/<MM>/<projet>/), or any directory located under anRdomain.Ris discovered locally (see Transversal rules); no global path. See${EXTRACT_PDF_SKILL_ROOT}/references/domain-layout.md.
Default flow
01 → 02 (×N) → 03. 04 on demand at any point.
Trigger-to-action mapping:
- "extract PDF", "start extraction", "import PDF" →
setup - "extract chunk", "process chunk", "next chunk" →
process-chunk - "distribute extraction", "merge extraction", "final session" →
distribute - "debug extraction", "extraction anomaly", "fix extraction" →
debug
Python scripts
Three scripts available in this skill's scripts/ folder in the overlay (to deploy into the project's scripts/):
| Script | Role |
|---|---|
extract-pdf.py |
Multi-session orchestrator (--resume, --retry, --status, --distribute, --normalize) |
split-pdf.py |
Physical splitting of the PDF into chunks (requires pypdf) |
normalize-text.py |
PDF encoding/ligature correction on the raw files |
# Full automated extraction
python scripts/extract-pdf.py <project-path> <source.pdf>
# Resume after interruption
python scripts/extract-pdf.py --resume docs/extraction/<source>/progress.md
# Status
python scripts/extract-pdf.py --status docs/extraction/<source>/progress.md
Transversal rules
- Call the skill from the work-unit directory (
R/<AAAA>/<MM>/<projet>/). All relative working paths (docs/,scripts/) are resolved from this directory. R(the domain root = a subcategory(Perso|Pro)/<Category>/<Subcategory>/) is discovered locally, never hardcoded:- Generic core: start from the reference directory (argument or CWD) and walk up to a
Perso/Prosegment; the subcategory level isR(thePerso/Proanchor mechanism). No domain marker required. - JDR profile shortcut: walk up the parents to the first folder containing one of the markers
_campagnes/,_univers/or_pjs/; that folder isR. This is the JDR profile's fast path. No global path, no per-machine config. See${EXTRACT_PDF_SKILL_ROOT}/references/domain-layout.md(§ JDR profile for the JDR-specific rules).
- Generic core: start from the reference directory (argument or CWD) and walk up to a
- The extracted reference sources land under
<target>/sources/<source>/— never in the synthesized layer (reference/generically;canon//mj/under the JDR profile):- Generic core: a single resolved
<target>(a working-dir bucketR/_<bucket>/or the work-unit directory) →<target>/sources/<source>/. - JDR profile: split by provenance — lore/terminology →
<univers-root>/sources/<source>/(<univers-root> = R/_univers/<univers>/), rules →<systeme-root>/sources/<source>/(<systeme-root> = R/_systeme/).
- Generic core: a single resolved
- Preserve the raw text. Every populated
sources/<source>/ALSO containsfulltext.md— the document's full normalized text, assembled from the chunks. This is "the content of the extraction": it must never be destroyed during cleanup. The classified files (lore.md,terminology.md,rules.md…) are reference bundles placed alongside it as inputs for an explicitly selected downstream role. Thussources/= raw + input bundles; the synthesized layer (reference/generically,canon/under JDR) is produced downstream. - Companion documents. A source line often ships related material in SEPARATE files (character booklets, MC screen, accessories, supplements, appendices). The detail (e.g. lists of names/appearances from the player booklets) is NOT in the core book. Treat each file as a distinct source (one
setupper file, or per coherent batch), with its own<source>. - One chunk per session for large PDFs (>50 pages).
- Working artifacts (PDF chunks, working folder) stored in
docs/extraction/<source-name>/; onlyfulltext.mdand the classified bundles survive insources/after cleanup. - NEVER invent content not present in the source PDF.
- Verify each extracted segment against the source before writing.
- Ask user validation before writing classified files.
progress.mdtracks which chunks are done and which remain.- Valid statuses in
progress.md:pending/done/failed(notTODO/DONE).
References
${EXTRACT_PDF_SKILL_ROOT}/references/domain-layout.md— primary generic convention of anRdomain:R= subcategory (discovered via thePerso/Proanchor), working-dir bucketsR/_<bucket>/,bank.yml, rawsources/+ synthesizedreference/, scopesshared/project, profile detection.- JDR profile (documented in
${EXTRACT_PDF_SKILL_ROOT}/references/domain-layout.md§ JDR profile) — applied when the domain is JDR: bucket names_univers/_systeme,canon/+mj/provenance split, marker-basedRshortcut, and an explicit boundary between extraction and downstream synthesis.
External data
docs/extraction/<source-name>/progress.md— session tracking state; also carries theUniversfield, filled in at setup. Under the JDR profile it is the slug of the target universe; in the generic core it is the target bucket/scope slug.docs/prompts/workshop/extract.prompt.md— setup Phase A (template inprompts/).docs/prompts/workshop/extract-chunk.prompt.md— extraction of a chunk (template inprompts/).docs/prompts/workshop/extract-distribute.prompt.md— distribution Phase C (template inprompts/).docs/prompts/workshop/extract-debug.prompt.md— diagnostic (template inprompts/).
04 同仓库更多 Skills
web-optimize
暂无简介
data-optimize
暂无简介
ap-optimize
暂无简介
web-optimize
暂无简介
data-optimize
暂无简介
ap-optimize
暂无简介