collate AGENTS.md

A set of instructions for an automated document pipeline that turns a PDF into editable documents and audit materials. OCR, or optical character recognition, extracts text from scanned pages.

In plain words
What is it for?
Use it to process PDFs into DOCX and HTML outputs, retain intermediate artifacts, run checklist-based proofreading, and produce a difference review.
Why use it?
It gives an agent a defined sequence for preparation, OCR, proofreading, final editing, and review while preserving intermediate files and making failures visible.

Instructions file for CodexOpenCode

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 instructions/midnightdarling/collate/agents-md
Clone the repo
git clone --depth 1 https://github.com/MidnightDarling/collate

Made for: Codex, OpenCode.

Per session 8,385 This file is loaded in full into every session.
When invoked 8,385 The same file — it is already loaded in full.
Security scan B 1 finding. 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.08385 $0.08385
Opus 5 $0.04193 $0.04193
Sonnet 5 $0.01677 $0.01677
Haiku 4.5 $0.00839 $0.00839

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

Security

Grade B, and why

collate AGENTS.md scanned grade B with 1 finding 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 2d 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.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

- `~/.codex/config.toml` 里的 `command_attribution` 必须保持 `false`
AGENTS.md · 560 lines

How it starts

The opening of the file, as written. The whole thing — 560 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AGENTS.md

面向任何运行此 pipeline 的 agent 运行时(Claude Code / Codex CLI / Cursor / Gemini CLI / Hermes agents)。描述完整的自动化工作流、每个 skill 的调用契约、agent 自主决策点、失败处理。人类只负责提供 PDF、接收最终产物与审计报告。

范围说明:本文档覆盖 8 步 pipeline 层。仓库还包含 7 个阅读层 skill(xray-paper / paper-summary / chunqiu / kaozheng / prometheus / real-thesis / constellatio),它们独立于 pipeline,使用各自 skills/<name>/SKILL.md 作为调用契约,本文档不重复展开。


总原则

  1. 端到端自主:从 PDF 到 .docx + .mp.html 由 agent 独立完成。不要把中间步骤暴露给人类确认,除非失败降级到人类决策(见「失败处理」)。
  2. 保留可追溯性:每一步的中间产物全部落盘,不清理。diff-review 的审计报告是交付的一部分,不是调试工具。
  3. 按 checklist 执行 proofread:结果是机器可读的结构化清单(A/B/C 分级),由 agent 消化后修改 raw.md → final.md。不做超出清单的结构性改写。
  4. 不替换学术判断:C 类(存疑待考)条目不要替人做决定;在 final.md 里保留原文 + 脚注标注,由读者判断。
  5. 失败要显性:引擎调用失败、依赖缺失、输入不合规 → 立即终止并回传结构化错误,不要静默兜底。

Pipeline 全景

Human ──► PDF
           │
           ▼
  ┌──────────────────────────────────────────────────┐
  │ 1. prep-scan       产 <ws>.ocr/prep/cleaned.pdf   │
  │ 2. visual-preview  产 previews/visual-prep.html   │
  │ 3. ocr-run         产 raw.md + meta.json + assets │
  │ 4. proofread       产 review/raw.review.md        │
  │ 5. (agent 按 checklist 写 final.md)              │
  │ 6. diff-review     产 previews/diff-review.html   │
  │ 7. to-docx         产 output/<title>_…_final.docx │
  │ 8. mp-format       产 output/<title>_…_wechat.*   │
  └──────────────────────────────────────────────────┘
           │
           ▼
Human ◄── <ws>.ocr/README.md  (指向 output/ 与 previews/)

整个 .ocr/ 工作区自描述:根目录 README.mdscripts/workspace_readme.py 在每个 skill 结束时刷新,给人类一个清晰的入口。

一条命令模式

  • shell / CI / 本地编排python3 scripts/run_full_pipeline.py --pdf <input.pdf>
  • agent runtime:以 agents/ocr-pipeline-operator.md 作为单一入口;它负责调用上面的总编排脚本、在 raw.md 就位后起 historical-proofreader subagent、再重入总编排脚本完成 final.md / diff-review / docx / wechat

每一步的详细契约见下。


1. setup(首次/环境校验)

何时调用:新环境、依赖缺失、OCR 凭证未配置或怀疑失效。稳定环境下不重复调用。

做什么:按 skills/setup/SKILL.md 检查 Python 依赖、popplermineru CLI 可用性;探活 OCR_ENGINE 指向的引擎(本地 mineru 跑一个 --help、云 API 或百度跑一次空探测)。

Read the full file on GitHub · 560 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. 2d ago First seen · 560 lines · 8,385 tokens per session scan B 2cd12b701f4d

Subscribe to this mod's changes

collate AGENTS.md is an instructions file published in the GitHub repository MidnightDarling/collate (6 stars, last pushed 3mo ago), licensed Apache-2.0. It adds 8,385 tokens to every session, about $0.0419 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other instructions, from other repositories

codedb AGENTS.md

AGENTS.md instructions for justrach/codedb, covering codedb agent guidelines, what codedb is (and isn't), review guidelines, pre-merge verification and security-sensitive areas.

justrach/codedb · 509 tokens

honey-for-devs copilot-instructions.md

Instructions for Green-PT/honey-for-devs, covering honey (i shrunk the ai), intensity, lever 1 — minimum code that needs to exist, never cut (lazy ≠ broken) and lever 2 — say less about it.

Green-PT/honey-for-devs · 3,168 tokens

Puppetmaster AGENTS.md

Instructions for professorpalmer/Puppetmaster, covering agents.md, first: are you a puppetmaster worker?, default subagent runtime: puppetmaster, when to start a puppetmaster swarm (do this by default) and match the verb to the task shape (single feature ≠ swarm).

professorpalmer/Puppetmaster · 4,520 tokens

claude-code-blueprint CLAUDE.md

Instructions for faizkhairi/claude-code-blueprint, covering global claude behavior rules, verify-after-complete (mandatory), what to verify depends on what was built, verification mindset and after verification.

faizkhairi/claude-code-blueprint · 3,009 tokens

claude-code-blueprint AGENTS.md

Instructions for faizkhairi/claude-code-blueprint, covering agents.md: repository orientation for ai assistants, what this repo is, what this repo is not, repository layout and how to help the user.

faizkhairi/claude-code-blueprint · 1,135 tokens

agent-native-setup AGENTS.md

Instructions for luca-mastrostefano/agent-native-setup, covering agent-native-setup — agent contract, navigation and command surface.

luca-mastrostefano/agent-native-setup · 400 tokens