va-cfile-pdf-editor
Vision-first grounded PDF extraction and deterministic page editing workflow. VA C-file is the default profile, but the same pipeline supports general-purpose document extraction with entity/event evi
SKILL.mdskills/va-cfile-pdf-editor/SKILL.md
GitHubVA C-File PDF Editor
Purpose
Produce a case-ready grounded extraction bundle with this locked order:
- Render raw pages.
- Run Codex visual analysis on raw pages.
- Derive deterministic, entity-bound edit intents from raw analysis.
- Optional review gate to approve/reject/override entity boxes.
- Apply targeted page edits.
- Run Codex visual analysis on edited pages.
- Reconcile raw vs edited extraction.
- Build chronologies, citations, timelines, QA report.
Never run blind edits before raw visual analysis. Default annotation policy is entity-level, not broad region-level. Generic broad boxes are fallback-only and must be explicitly flagged in uncertainties.
Domain Notes
- VA profile: use
legalandmedicalevent types for canonical VA timelines. - General-purpose profile:
event_typeandchronology_rolecan be any non-empty domain label (e.g.invoice,policy,lab_result,contract,shipment). - All entity-level extractions should be evidence-linked (
entity_id+ bbox + quote-backed event evidence rows).
Output Bundle
Write outputs to:
output/pdf_cases/<case_id>/manifest.jsonoutput/pdf_cases/<case_id>/pages/raw/*.pngoutput/pdf_cases/<case_id>/pages/edited/*.pngoutput/pdf_cases/<case_id>/pages/edited/edit_manifest.jsonoutput/pdf_cases/<case_id>/edits/edit_intents.jsonoutput/pdf_cases/<case_id>/edits/edit_intents_final.jsonoutput/pdf_cases/<case_id>/edits/review_audit.jsonoutput/pdf_cases/<case_id>/extractions/raw/page_*.jsonoutput/pdf_cases/<case_id>/extractions/edited/page_*.jsonoutput/pdf_cases/<case_id>/extractions/reconciled/page_*.jsonoutput/pdf_cases/<case_id>/extractions/reconciliation_report.jsonoutput/pdf_cases/<case_id>/chronologies/legal_chronology.mdoutput/pdf_cases/<case_id>/chronologies/medical_chronology.mdoutput/pdf_cases/<case_id>/chronologies/all_events_chronology.mdoutput/pdf_cases/<case_id>/chronologies/legal_timeline.mmdoutput/pdf_cases/<case_id>/chronologies/medical_timeline.mmdoutput/pdf_cases/<case_id>/chronologies/all_events_timeline.mmdoutput/pdf_cases/<case_id>/chronologies/event_type_breakdown.mdoutput/pdf_cases/<case_id>/citations/citation_map.jsonoutput/pdf_cases/<case_id>/qa/quality_report.md
Workflow Commands
1) Render PDFs to raw PNG pages
uv run python scripts/render_pdf_pages.py \
--input /path/to/case_pdfs \
--case-id CASE_001 \
--out output/pdf_cases/CASE_001
2) Analyze raw pages (Codex vision normalization)
uv run python scripts/analyze_raw_pages_codex.py \
--pages-dir output/pdf_cases/CASE_001/pages/raw \
--out-dir output/pdf_cases/CASE_001/extractions/raw \
--codex-findings output/pdf_cases/CASE_001/extractions/raw/codex_findings.json
3) Derive deterministic edit intents
uv run python scripts/derive_edit_intents.py \
--raw-extractions output/pdf_cases/CASE_001/extractions/raw \
--out output/pdf_cases/CASE_001/edits/edit_intents.json
4) Resolve intents (review file optional)
uv run python scripts/review_annotation_intents.py \
--edit-intents output/pdf_cases/CASE_001/edits/edit_intents.json \
--out output/pdf_cases/CASE_001/edits/edit_intents_final.json \
--review-file output/pdf_cases/CASE_001/edits/annotation_review.json
If no --review-file is supplied, this step still runs in auto mode:
- high-confidence intents auto-apply
- review-required intents are skipped
5) Apply page edits
uv run python scripts/apply_page_edits.py \
--pages-dir output/pdf_cases/CASE_001/pages/raw \
--edit-intents output/pdf_cases/CASE_001/edits/edit_intents_final.json \
--out-dir output/pdf_cases/CASE_001/pages/edited
6) Analyze edited pages (Codex vision normalization)
uv run python scripts/analyze_edited_pages_codex.py \
--pages-dir output/pdf_cases/CASE_001/pages/edited \
--out-dir output/pdf_cases/CASE_001/extractions/edited \
--codex-findings output/pdf_cases/CASE_001/extractions/edited/codex_findings.json \
--final-intents output/pdf_cases/CASE_001/edits/edit_intents_final.json
7) Reconcile two-pass extraction
uv run python scripts/reconcile_extractions.py \
--raw-dir output/pdf_cases/CASE_001/extractions/raw \
--edited-dir output/pdf_cases/CASE_001/extractions/edited \
--out-dir output/pdf_cases/CASE_001/extractions/reconciled
8) Build case bundle chronologies + citations + timelines + QA
uv run python scripts/build_case_bundle.py \
--case-id CASE_001 \
--base-dir output/pdf_cases/CASE_001 \
--reconciled-dir output/pdf_cases/CASE_001/extractions/reconciled
9) Validate bundle
uv run python scripts/validate_bundle.py \
--base-dir output/pdf_cases/CASE_001
Required Tooling
pdftoppmfor PDF rendering.- Python 3.9+.
Pillowfor deterministic image edits (pip install Pillow).
No Tesseract/traditional OCR fallback is part of this skill.
Raw/edited Codex findings should follow schemas/codex_findings_v2.schema.json.
Iteration 2 Research Track (Segmentation)
Research-only benchmark assets are available for segmentation-assisted parsing experiments.
- Script:
scripts/benchmark_segmentation_iteration2.py - Config:
research/configs/segmentation_benchmark_iteration2.json - Report:
research/segmentation_iteration2.md - Decision memo:
research/segmentation_decision_memo.md
This track is gated by feature flag SEGMENTATION_RESEARCH_V2 and does not modify the v1 production flow.
References
references/jerome_workflow_playbook.mdreferences/extraction_schema.mdreferences/chronology_rules.mdreferences/editor_profiles.md