negentropy: Skill for Claude Code

.agent/skills/pdf-fidelity-restore/SKILL.md

pdf-fidelity-restore is a skill for Claude Code from ThreeFish-AI/negentropy. It costs 107 tokens per session (2,699 once invoked), scanned C, original, Apache-2.0.

A workflow for turning PDF files into Markdown documents that closely preserve the original text, layout, images, tables, formulas, code, contents list, and notes.

In plain words
What is it for?
Use it to import or restore PDFs for display in a knowledge-base Documents section, including long documents with images, tables, mathematical formulas, or code.
Why use it?
It helps prevent formatting and content differences when a PDF is imported into a knowledge base. Large PDFs can be processed in batches and checked page by page against the source.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions Claude Code.

This is ThreeFish-AI/negentropy's own configuration. It tells Claude Code how to work on negentropy itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything negentropy configures →

Reuse

Borrowing it

Nothing to install: this file belongs to ThreeFish-AI/negentropy. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/ThreeFish-AI/negentropy/master/.agent/skills/pdf-fidelity-restore/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/ThreeFish-AI/negentropy

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for pdf-fidelity-restore

README.md
[![agentmods](https://agentmods.dev/badge/skills/threefish-ai/negentropy/pdf-fidelity-restore/github.svg)](https://agentmods.dev/skills/threefish-ai/negentropy/pdf-fidelity-restore)
Your own site
<a href="https://agentmods.dev/skills/threefish-ai/negentropy/pdf-fidelity-restore"><img src="https://agentmods.dev/badge/skills/threefish-ai/negentropy/pdf-fidelity-restore/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for pdf-fidelity-restore

Your own site · 80×15
<a href="https://agentmods.dev/skills/threefish-ai/negentropy/pdf-fidelity-restore"><img src="https://agentmods.dev/badge/skills/threefish-ai/negentropy/pdf-fidelity-restore.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 107 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,699 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 2 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00107 $0.02699
Opus 5 $0.00053 $0.01350
Sonnet 5 $0.00021 $0.00540
Haiku 4.5 $0.00011 $0.00270

Measured 5d ago against content hash 896f26c6482e, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade C, and why

pdf-fidelity-restore scanned grade C with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

- **热更铁律(改 perceives `src/` 后必做,否则改动不生效)**:① 重启 perceives MCP 进程(Python 无热重载);② 清 checkpoint `rm -rf <output_dir>/output/.batch_state/*`(auto_batch resume 按 PDF 内容 SHA-1 缓存切片,不清则复用旧切片、跳过新代码,且完成异常快)。

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

- **inner-loop staging wiki 不 bake/serve 图片(V1 工具链限制,process 层 carve-out)**:`patrol_wiki_env publish-candidate` 仅写 entry Markdown、不烘焙资产;staging dev server(主仓 `negentropy-wiki`,`public/assets/` 无文档资产)对候选 MD 的 `./images/..
.agent/skills/pdf-fidelity-restore/SKILL.md · 89 lines

How it starts

The opening of the file, as written. The whole thing — 89 lines — stays where its author put it; the contents beside it link to each section on GitHub.

PDF 高保真还原 (PDF Fidelity Restore)

SSOT:本文件与 apps/negentropy/src/negentropy/agents/skill_templates/pdf_fidelity_restore.yaml 同源 (文件技能供 Routine 的 Claude Code 发现,DB 技能供一核五翼)。两处正文骨架须保持一致。

你是「PDF 高保真还原」专家。目标:把 PDF 一比一还原为可在 Knowledge / Documents 页正确渲染的 Markdown,并通过浏览器逐页对比将差异修复至完全一致。

输入

  • pdf_source:本地绝对路径或 http(s) URL
  • corpus_name:目标 Corpus(默认 Harness Engineering
  • method:perceives 引擎(auto / smart / docling / mineru / marker / pymupdf / pypdf
  • 分批:batch_page_size(默认 40)、batch_threshold_pages(默认 60)

一比一还原范围(缺一不可)

文字、段落顺序、高清原图、图片显示尺寸、目录(TOC/锚点)、表格、数学公式(LaTeX/KaTeX)、 代码块(语言与高亮)、脚注/注释。

流程(自驱闭环)

  1. 基准:用用户常用浏览器(真实登录态)打开源 PDF(file:// 或 URL)作为对照基线;不得绕过/模拟任何登录。
  2. 路由就绪:确认目标 Corpus 的 config.extractor_routes 已把 source_kind=pdf 路由到 negentropy-perceives.parse_pdf_to_markdowntool_options 开启 extract_images/tables/formulas, 并设 auto_batch=true 与合适的 batch_page_size
  3. 分批摄取:经 Documents Ingest 上传 PDF。大文件依赖 perceives 的 auto_batch (总页数 > batch_threshold_pages 时自动切片,resume 断点续传),确保整本最终合并为单一 Markdown 文档。
  4. 等待完成:轮询文档 markdown_extract_statuscompleted(失败则查 markdown_extract_errorrefresh_markdown 重试)。
  5. 渲染核对:在 Documents 页 View 渲染结果(react-markdown + remark-gfm/math + rehype-katex/raw/highlight/sanitize)。
  6. 逐页对比:按上「一比一还原范围」逐页 / 逐模块比对源 PDF 与渲染 Markdown,逐条记录差异(页号 + 类别 + 现象)。
  7. 发现一处修一处(三杠杆分层修复路由 + 归因):每个缺陷先走「双源验证决策树」归因到杠杆/层,再定点改(单轮一个逻辑根因,≤3 文件 ≤2 杠杆):
    • ①工程代码·管线层:perceives 引擎选型、分批边界、跨片合并(图片去重、边界图注补救)、图片分辨率与显示尺寸提取(pipeline/stages/pdf/*engine_selector.pyops/pdf.py)。
    • ①工程代码·摄取层:图片链接重写、资产存储、元数据(knowledge/ingestion/extraction.pyknowledge/_shared.py)。
    • ①工程代码·导出层:wiki 发布资产 bake / 链接重写(knowledge/lifecycle/wiki_export_service.py)。
    • ①工程代码·渲染层 wikiMarkdownRenderer.tsx / ZoomableImage / ResponsiveTable / CodeBlock / sanitize schema(图片宽高、表格、KaTeX、代码高亮、TOC 锚点)。
    • ①工程代码·渲染层 uiDocumentMarkdownRenderer.tsx / DocumentImage figcaption / parsePixelValue / documentSanitizeSchema(注意 wiki 与 ui 的 sanitize style 放行 / figcaption 行为不对称)。
    • ②Skills 本体:本 Skill 的规则集——发现的跨 doc 结构性 insight 回写此处(如「图注双源铁律」),升级归因路由表。
    • ③流程自身:巡检/还原流程的采样、评分、归因编排(慎改,影响面大)。
    • 双源验证决策树(归因前必走,防误归到 perceives):Step A 缺陷在候选 Markdown 源码里?是→管线/摄取;否→渲染层或流程伪缺陷。Step B 图片链接形式判摄取/导出。Step C wiki 错还是 ui 错→render_wiki/render_ui;皆对仅旧模拟栈错→流程伪缺陷(不计分)。
    • 热更铁律(改 perceives src/ 后必做,否则改动不生效):① 重启 perceives MCP 进程(Python 无热重载);② 清 checkpoint rm -rf <output_dir>/output/.batch_state/*(auto_batch resume 按 PDF 内容 SHA-1 缓存切片,不清则复用旧切片、跳过新代码,且完成异常快)。 改后经 refresh_markdown(resume=false) 重摄取(清 checkpoint 全量重跑)或重载页面,复核该项。
  8. 循环:重复 6–7,直到逐页校验清单全绿;保留关键页源 PDF vs 渲染 Markdown 对比截图为证。

Read the full file on GitHub · 89 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago Changed · +10 lines 896f26c6482e
  2. 11d ago First seen · 79 lines · 107 tokens per session scan C 2ab519998781

Subscribe to this mod's changes

pdf-fidelity-restore is a skill published in the GitHub repository ThreeFish-AI/negentropy (10 stars, last pushed today), licensed Apache-2.0. It adds 107 tokens to every session and 2,699 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it C with 2 findings (recursive force delete, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

literature

Load when extracting GEO accessions, dataset metadata, and downloadable references from a scientific paper (PDF / URL / DOI / PubMed ID / raw text) for downstream omics analysis. Skip when the dataset is already in hand; only routing a query (use orchestrator).

TianGzlab/OmicsClaw · 58 tokens

wechat-article-ingest

A tool that converts public WeChat Official Account articles, or PDF copies of them, into Markdown notes. It can also extract the article's main viewpoints and create linked questions for further thinking.

chubbyguan/chubbyskills · 39 tokens

pdf-fill

Fill PDF form fields from a data dict.

hardness1020/awesome-agent-architecture · 12 tokens

ocr

Extract text from images and scanned PDFs using local OCR (Tesseract). Keyless, offline. Use when asked to "read text from this image", "OCR this", "extract text from a screenshot/scan", or given an image with text.

diillson/chatcli · 53 tokens

paper-writing

Write and typeset formal documents — academic papers, reports, articles — using Markdown + Pandoc and LaTeX. Convert between formats (md↔pdf↔docx↔tex), manage citations with BibTeX/CSL. Keyless, local. Use when asked to "write a paper", "format this as LaTeX", "convert to PDF/Word", "add citations".

diillson/chatcli · 86 tokens

pdf-tools

Manipulate PDFs locally — merge, split, extract pages, rotate, compress, extract text, convert images↔PDF. Uses keyless local CLIs (pdftk/qpdf/pdftotext/poppler/img2pdf/Ghostscript). Use when asked to "merge PDFs", "split this PDF", "extract text from PDF", "compress PDF", "PDF to images".

diillson/chatcli · 82 tokens