Agent Skill
Extract and configure
Discover the installed interface with afpdf --help, afpdf --docs, and
afpdf config show. Before the first extraction on a machine, run
afpdf engine status; if the library is not available, run
afpdf engine install once, which fetches the pinned PDFium build for this
platform, verifies it, and probes it. Use afpdf extract INPUT; document
facts, organized article structure, and continuous text are returned by
default in AFDATA events. Read diagnostics and each page’s status before
trusting text: a capped, failed, or scanned page is reported, never hidden.
- Add
--set output.basic=truefor per-page raw text, glyph styles, and geometry. - Add
--set extract.image_mode=embeddedfor encoded bitmap payloads, orrender_pagesfor full-page renders. Bytes appear once inimagesas base64. - Use
--set extract.processing.remove_page_furniture=falseto keep furniture. - Use
config show/get/set/unsetand dot paths for durable settings; extraction’s--set KEY=VALUEis invocation-only. The default file is.afpdf/config.jsonin the current directory; reads do not create it.
Isolated execution is the default. The worker memory limit is enforced on
Linux only and defaults off elsewhere; do not set it nonzero on another
platform. --stdout-file/--stderr-file work on Unix only; on Windows use
--output-to or shell redirection. Report missing text layers and failed
pages; there is no implicit OCR or external model.
Develop or integrate
Read README.md for design principles, docs/configuration.md for settings,
and docs/design.md for the engine choice, result model, and limitations.
Native extraction uses the engine feature; pure organization can rerun from
BasicDocument without I/O. IsolatedParser requires the afpdf executable
in the worker environment, without native linkage in its caller; its
EngineOptions name the PDFium library the worker binds.
Every extraction rule needs a real-page fixture, and engine changes are accepted only after diffing old and new builds over the consumer corpus with every class of change explained. Build and run the engine inside a container. Services that ingest PDFs from the web use the isolated (child process) mode.
When implementing extraction, focus on article reading order, natural paragraphs without layout-induced line breaks, page-furniture removal, and source locations. Keep images, captions, tables, formulas, and footnotes distinguishable from prose. Indexing and semantic interpretation belong to callers.
Keep extraction in the Rust library and CLI behavior at the executable
boundary. Discover current commands with afpdf --help and afpdf --docs.
Use the fixed scripts/test.sh entrypoint for checks; prerequisites and modes
are in CONTRIBUTING.md. After changing the CLI registry, regenerate its
reference with scripts/test.sh docs.