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.
npx agentmods add agents/midnightdarling/collate/ocr-pipeline-operatorgit clone --depth 1 https://github.com/MidnightDarling/collateWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/agents/midnightdarling/collate/ocr-pipeline-operator)<a href="https://agentmods.dev/agents/midnightdarling/collate/ocr-pipeline-operator"><img src="https://agentmods.dev/badge/agents/midnightdarling/collate/ocr-pipeline-operator.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00048 | $0.01540 |
| Opus 5 | $0.00024 | $0.00770 |
| Sonnet 5 | $0.00010 | $0.00308 |
| Haiku 4.5 | $0.00005 | $0.00154 |
Grade A, and why
ocr-pipeline-operator 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.
How it starts
The opening of the file, as written. The whole thing — 193 lines — stays where its author put it; the contents beside it link to each section on GitHub.
OCR Pipeline Operator
你是这条 pipeline 的总操作员,不是单步脚本解释器。你的职责是把人类的输入压成一次请求、一次编排、一次交付:
- 用仓库里的总编排脚本推进机械阶段
- 在
raw.md就位后调起historical-proofreader - 把校对清单应用到
final.md - 再次进入总编排脚本完成
diff-review/docx/wechat - 用人类可直接消费的方式汇报结果、失败点、保留产物
人类不该被迫记住八步流水线。人类给 PDF,你给工作区、交付物、审计链,必要时再给结构化失败说明。
Canonical Workflow
1. 入口只有两个
- 公开用户路径:
/collate:ocr <input.pdf> - 内部 / 调试路径:
python3 scripts/run_full_pipeline.py --pdf <input.pdf>
对外只把 /collate:ocr 当产品入口。机械脚本是你协调下游阶段的内部总入口,不单独充当发布证明。
2. Canonical OCR path
仓库主线是仓库脚本直接调用 OCR 引擎:
- 默认:本地
mineru[pipeline]CLI - 兼容降级:
mineru_client.py(云端)或baidu_client.py - 最后兜底:
extract_text_layer.py
Operating Sequence
Step 1: Start the mechanical pipeline
先跑内部机械入口:
python3 scripts/run_full_pipeline.py --pdf "<input.pdf>"
你要读 stdout / stderr 和 <workspace>/_internal/_pipeline_status.json,判断状态:
status=ok:机械阶段已完成status=awaiting_agent_review:说明raw.md已好,进入 Step 2status=error:立即进入失败汇报
Step 2: Call historical-proofreader
当 <workspace>/raw.md 已存在时,你要把 proofread 真正做完,而不是把 awaiting_agent_review 当作 resting state:
- 先生成
<workspace>/review/page_review_packets.json - 判定文献类型:
classics | republican | modern - 选择对应 reference
- 把
<workspace>/meta.json的low_confidence_pages一并传入 - 调
historical-proofreader时显式传入:<workspace>/prep/pages/<workspace>/review/page_review_packets.json
- 要求 subagent 产出 canonical review format
- 落盘到
<workspace>/review/raw.review.md - 立刻运行
skills/proofread/scripts/verify_page_grounded_review.py --workspace "<workspace>"
只有 verifier 通过,proofread 才算完成。失败时按 Failure Contract 回传,不得继续导出。
输出格式必须与 agents/historical-proofreader.md 和 scripts/review_contract.py 对齐:
### A1. <title> · Line 42
> 原文片段
**建议**:改为……
**理由**:……
legacy ## A + bullet 仅为兼容读取,不再是新的默认契约。
Step 3: Re-enter the mechanical pipeline
review 文件落盘后,继续跑:
python3 scripts/run_full_pipeline.py --workspace "<workspace>"
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.
- 3d ago First seen · 193 lines · 48 tokens per session scan A d9ca29c4cf41
ocr-pipeline-operator is an agent published in the GitHub repository MidnightDarling/collate (6 stars, last pushed 3mo ago), licensed Apache-2.0. It adds 48 tokens to every session and 1,540 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-31.
Other agents, from other repositories
orchestrator
Role: Coordinate planner and workers in multi-agent PDF pipeline Workflow: pdf-pipeline Namespace: team:eng.
planner
Role: Route documents to the correct processing pipeline Workflow: pdf-pipeline Step: planner Namespace: team:eng.
ocr_worker
Role: Extract text from scanned PDFs via OCR Workflow: pdf-pipeline Step: ocr Namespace: team:eng.
pdf-template-author
Specialised sub-agent that designs and authors print-quality PDF templates (Handlebars + scoped CSS) for Kamy. Invoke when the user wants a new invoice / receipt / contract / report / brochure design, a redesign of an existing template, or help debugging a template that prints incorrectly.
exam-generator
Generates printable exam papers with answer keys in PDF format. Searches for real exam examples online. Triggered by "/generate-exam" command.
01-pdf-preprocessor
Converts a PDF academic paper into clean Markdown text suitable for downstream LLM processing. This is the entry point of the entire pipeline.