Agent skill
review-pdf
Comprehensive PDF extraction fidelity auditor for extractor pipeline quality. Compares S00 estimates, S11 structural output, and source PDF signals; emits per-document and aggregate reports; routes failures into classifier/prompt/ fixture/debug self-improvement loops.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/review-pdf
Metadata
Additional technical details for this skill
- version
- 2.0.0
- short description
- PDF extraction QC gate with self-improvement escalation
SKILL.md
review-pdf
review-pdf is the hard quality gate for PDF extraction in:
/home/graham/workspace/experiments/extractor/src/extractor/pipeline
It validates quality at document level and corpus level, then drives automatic escalation into helper skills when regressions are detected.
Scope
The skill validates:
- S00 estimate quality vs S11 extracted structure
- section/table/figure/equation recall
- content coverage and structural integrity
- ordering quality, including y+x multi-column behavior
- classifier/prompt/heuristic drift signals
The skill is intended to be a composable module in a larger learn-datalake workflow.
Inputs
You can pass:
- one run directory containing
00_profile_detector/profile.jsonand11_json_exporter/structural.json - one
profile.json - a corpus root containing many runs
Corpus example:
/mnt/storage12tb/extractor_corpus
Outputs (Required)
For every run:
- per-document reports (
per_doc/*.json) - aggregate report (
aggregate.json,aggregate.md) - memory event append (mandatory) to:
/home/graham/workspace/experiments/pi-mono/.pi/skills/memory/.artifacts/review_pdf_events.jsonl
- optional graph-memory acquire calls per reviewed PDF (
--ingest-memory) - optional taxonomy tags attached to per-doc reports (
--taxonomy-collection)
Commands
cd /home/graham/workspace/experiments/pi-mono/.pi/skills/review-pdf
# Single run/doc check
./run.sh check /path/to/run_dir
# Corpus batch audit
./run.sh batch /mnt/storage12tb/extractor_corpus --limit 500
# Self-improvement loop (check -> escalate -> re-check)
./run.sh iterate /mnt/storage12tb/extractor_corpus --cycles 3 --execute-jobs
# Continuous datalake mode (watch + auto-extract missing + target integrity)
./run.sh loop /mnt/storage12tb/extractor_corpus \
--target-score 0.95 \
--execute-jobs \
--extract-missing \
--ingest-memory \
--taxonomy-collection operational
# Compare two aggregate runs
./run.sh compare reports/run_a/aggregate.json reports/run_b/aggregate.json
# Convergence from history file
./run.sh convergence reports/review_pdf_iter_history.jsonl
# Quick status and recent memory history
./run.sh status reports/<run_id>/aggregate.json
./run.sh history --limit 50
Quality Dimensions
Weighted dimensions:
- section alignment (18%)
- table fidelity (16%)
- figure fidelity (10%)
- equation fidelity (14%)
- content coverage (22%)
- ordering y+x (12%)
- data quality (8%)
Grading:
A+>= 0.95A>= 0.88B>= 0.78C>= 0.65- else
F
Verdict:
FAILif any critical issue or score < 0.70WARNif high issues existPASSotherwise
Critical Failure Rules
- formulas expected in S00 but zero equations in S11 => critical fail
- major text loss vs source PDF => critical fail
- severe section/table under-recall => critical fail
- y+x ordering violations in positioned content => high/critical attention
Self-Improvement Escalation
Issue signatures route to helper skills. Primary routes include:
table-lab,create-table-classifier,create-tablecreate-classifier,classifier-lab,create-intent-mapdebug-pdf,create-pdf-fixture,fixture-trickyprompt-lab,normalize,pdf-screenshotextractor,fetcher
Execution modes:
- planned mode: jobs listed in report (
escalation_jobs) - auto mode: use
--execute-jobsto run auto-executable jobs immediately - continuous mode:
loop/watchruns until integrity targets are met and keeps monitoring new PDFs
Classifier policy for escalations:
classifier-labbenchmark is mandatory before classifier promotion.create-classifiermust run with:--benchmark-first--classifier-lab-first--require-classifier-lab--require-selection-pass
- if selection fails, treat as hard failure and keep the issue unresolved (no silent fallback).
Recommended promotion gate (quality-first):
- holdout
macro_f1 >= 0.90 - holdout
accuracy >= 0.90 - minimum per-class recall
>= 0.80for all supported classes - no class with support below review threshold without explicit waiver
Recommended HF augmentation license allowlist:
mitapache-2.0bsd-3-clausebsd-2-clausecc0-1.0
Recommended Compose Pattern
For full learning loop, compose:
review-pdf(measure + detect regressions)- helper skills (fix generation and model/prompt retraining)
review-pdf(re-check)quality-auditandbatch-quality(statistical quality gating)corpus-report/analytics/monitor-pdfs(trend and ops views)
Integration Notes
- This skill does not replace extractor; it audits extractor outcomes.
- Memory append is mandatory to track progress/regressions across iterations.
- Heuristics are not sufficient alone; escalation is classifier/prompt-first for persistent error classes.
- Keep outputs deterministic when possible (
--execute-jobsoff for pure measurement runs). - For
learn-datalakecomposition across formats, pair this with modality-specific reviewers (for exampleextract-html) and normalize all outputs into shared memory event contracts.
Memory/storage policy:
- store both success and failure events; failures are first-class training signals.
- retain unresolved failure buckets with issue signature + input artifacts + attempted fixes.
- write aggregate and per-doc events to memory sink each cycle so
classifier-labandcreate-classifiercan mine historical regressions, not only latest runs.
Visualization
After generating reports, offer to visualize via /create-figure:
# Quality dimension radar chart (section alignment, table fidelity, etc.)
create-figure radar --input aggregate.json --output quality-radar.pdf
# Grade distribution across corpus
create-figure metrics --input aggregate.json --output grades.png --type bar --title "Corpus Grade Distribution"
# Convergence curve across iterations
create-figure metrics --input review_pdf_iter_history.jsonl --output convergence.png --type line --title "Quality Convergence"
# Failure type breakdown
create-figure metrics --input aggregate.json --output failures.png --type pie --title "Failure Categories"
# Per-dimension heatmap across documents
create-figure heatmap --input aggregate.json --output dimension-heatmap.png
When to offer: After batch, iterate, or loop runs that produce aggregate reports. Especially useful for convergence tracking across self-improvement cycles.
Definition of Done (for a review cycle)
- all target docs processed with per-doc reports
- aggregate report generated
- memory event appended for each doc and aggregate
- fail/warn issues mapped to concrete helper-skill escalations
- convergence history produced for iterative runs
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?