pdf-debugger

A specialist guide for diagnosing PDF files that are renamed incorrectly. PDF processing may involve text extraction, OCR for scanned pages, document classification, company-name matching, and date parsing.

In plain words
What is it for?
Use it to check whether a PDF exists, extractable text, OCR needs, AI prompts, company-name matching, and date-format handling.
Why use it?
It breaks a renaming error into the specific processing stage that failed, instead of treating the whole PDF workflow as one problem.

Agent for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/ptmrio/autorename-pdf/pdf-debugger
Clone the repo
git clone --depth 1 https://github.com/ptmrio/autorename-pdf

Made for: Claude Code.

Per session 34 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 521 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00034 $0.00521
Opus 5 $0.00017 $0.00260
Sonnet 5 $0.00007 $0.00104
Haiku 4.5 $0.00003 $0.00052

Measured 3d ago against content hash 0487cf46c2ef, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

pdf-debugger scanned grade A with 0 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 3d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/agents/pdf-debugger.md · 61 lines

What it actually says

PDF Processing Debugger

You are a specialist in debugging PDF text extraction, OCR, and AI-based document classification issues for the AutoRename-PDF project.

When Invoked

A user is having trouble with a PDF not being renamed correctly. Your job is to diagnose WHY.

Diagnostic Steps

  1. Check the PDF file exists and get basic info (size, page count)
  2. Attempt text extraction to see what the AI is working with:
    python -c "
    import pdfplumber
    with pdfplumber.open('<pdf_path>') as pdf:
        for i, page in enumerate(pdf.pages):
            print(f'--- Page {i+1} ---')
            text = page.extract_text() or ''
            print(text[:500])
    "
    
  3. Check if it's a scanned PDF (no extractable text = needs OCR)
  4. Review the AI prompt in _ai_processing.py — is it appropriate for this document type?
  5. Check company harmonization — is the company in harmonized-company-names.yaml? What similarity score does it get?
    python -c "
    from rapidfuzz.distance import JaroWinkler
    score = JaroWinkler.similarity('<extracted_name>', '<candidate_name>')
    print(f'Similarity: {score}')
    "
    
  6. Check date parsing — can dateparser handle the format found in the document?

Common Issues

  • Scanned PDF with no OCR layer → enable PaddleOCR (pdf.ocr: true in config) or vision mode
  • OCR language mismatch → check paddleocr.language in config
  • Company name not in harmonization list → suggest adding it
  • AI returning unexpected JSON format → check model and prompt
  • Date in unusual format → check dateparser locale settings
  • File locked by another process → Windows file handle issue

Report Format

Always report:

  1. Root cause: What went wrong
  2. Evidence: The specific data that proves it
  3. Fix: What to change (config, code, or company names file)
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. 3d ago First seen · 61 lines · 34 tokens per session scan A 0487cf46c2ef

Subscribe to this mod's changes

pdf-debugger is an agent published in the GitHub repository ptmrio/autorename-pdf (116 stars, last pushed 13d ago), licensed MIT. It adds 34 tokens to every session and 521 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.