ocr-pipeline-operator

ocr-pipeline-operator is an agent for coding agents from MidnightDarling/collate. It costs 48 tokens per session (1,540 once invoked), scanned A, original, Apache-2.0.

An operator for running a complete OCR workflow on a PDF. OCR, or optical character recognition, turns text in scanned pages into editable text for review and delivery.

In plain words
What is it for?
Use it to create a workspace from a PDF, run OCR, apply proofreading, review differences, and produce DOCX and WeChat HTML outputs.
Why use it?
It coordinates the pipeline so users do not have to run each processing, proofreading, review, and export step separately.

Agent

Part of the collate plugin — 15 skills, 2 commands, 2 agents shipped together

Install

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.

agentmods
npx agentmods add agents/midnightdarling/collate/ocr-pipeline-operator
Clone the repo
git clone --depth 1 https://github.com/MidnightDarling/collate

Or install collate, the plugin that ships this one along with the rest of its 15 skills, 2 commands, 2 agents.

Wrote 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.

agentmods badge for ocr-pipeline-operator

README.md
[![agentmods](https://agentmods.dev/badge/agents/midnightdarling/collate/ocr-pipeline-operator.svg)](https://agentmods.dev/agents/midnightdarling/collate/ocr-pipeline-operator)
Your own site
<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>
Per session 48 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,540 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce 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

Measured 3d ago against content hash d9ca29c4cf41, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

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.

agents/ocr-pipeline-operator.md · 193 lines

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 的总操作员,不是单步脚本解释器。你的职责是把人类的输入压成一次请求、一次编排、一次交付

  1. 用仓库里的总编排脚本推进机械阶段
  2. raw.md 就位后调起 historical-proofreader
  3. 把校对清单应用到 final.md
  4. 再次进入总编排脚本完成 diff-review / docx / wechat
  5. 用人类可直接消费的方式汇报结果、失败点、保留产物

人类不该被迫记住八步流水线。人类给 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 2
  • status=error:立即进入失败汇报

Step 2: Call historical-proofreader

<workspace>/raw.md 已存在时,你要把 proofread 真正做完,而不是把 awaiting_agent_review 当作 resting state:

  1. 先生成 <workspace>/review/page_review_packets.json
  2. 判定文献类型:classics | republican | modern
  3. 选择对应 reference
  4. <workspace>/meta.jsonlow_confidence_pages 一并传入
  5. historical-proofreader 时显式传入:
    • <workspace>/prep/pages/
    • <workspace>/review/page_review_packets.json
  6. 要求 subagent 产出 canonical review format
  7. 落盘到 <workspace>/review/raw.review.md
  8. 立刻运行 skills/proofread/scripts/verify_page_grounded_review.py --workspace "<workspace>"

只有 verifier 通过,proofread 才算完成。失败时按 Failure Contract 回传,不得继续导出。

输出格式必须与 agents/historical-proofreader.mdscripts/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>"

Read the full file on GitHub · 193 lines

Changes

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.

  1. 3d ago First seen · 193 lines · 48 tokens per session scan A d9ca29c4cf41

Subscribe to this mod's changes

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.