AgenticParser parses Markdown, PDF, and DOCX files into a unified intermediate representation, applies auditable cleanup rules, and exports clean Markdown with JSON reports.
- Unified IR for documents, pages, blocks, and spans.
- Rule-based cleanup with traceable policy decisions.
- Markdown, PDF, and DOCX input support.
- Page inspection metadata for PDF/DOCX workflows.
- Quality scoring and issue reports.
- Single-file and batch parsing commands.
Install the package in editable mode:
pip install -e .For PDF parsing, install the optional PDF dependency:
pip install -e ".[pdf]"For local source execution without installation:
$env:PYTHONPATH="src"Parse one document:
python -m agentic_parser parse `
path\to\input.md `
--memory memory\rules `
--out outputs\latestParse a PDF or DOCX file the same way:
python -m agentic_parser parse `
path\to\input.pdf `
--memory memory\rules `
--out outputs\latestBatch parse a directory:
python -m agentic_parser parse-batch `
path\to\documents `
--memory memory\rules `
--out outputs\batchEach parse run writes:
parsed.md: cleaned Markdown.parsed.ir.json: full intermediate representation.report.json: applied rules, issues, backend report, and quality score.
Batch parsing also writes:
batch_summary.json: status and score summary for each file.
Rules are Markdown files in memory/rules/ with TOML frontmatter.
Example:
id = "drop_strike_text_contract"
priority = 100
action = "drop_span"
reason = "Drop obsolete revision text."
[scope]
doc_family = "contract"
[trigger]
style = "strike"Supported actions:
drop_spandrop_block
Common trigger fields:
block_typestyletext_contains
Common scope fields:
doc_familytemplate_cluster
Useful options:
--backend: chooseplain-markdown,pdf, ordocx; defaults to auto.--doc-family: pass a document family used by scoped rules.--revision-agent: usenoneorheuristic.--memory: path to rule files.--out: output directory.
from pathlib import Path
from agentic_parser.pipeline import run_parse_pipeline
result = run_parse_pipeline(
input_path=Path("path/to/input.md"),
memory_dir=Path("memory/rules"),
doc_family="contract",
)
print(result.markdown)
print(result.report())$env:PYTHONPATH="src"
python -m unittest discover -s tests