collate: Instructions file for Claude Code

AGENTS.md

collate AGENTS.md is an instructions file for Claude Code, Codex, OpenCode from MidnightDarling/collate. It costs 8,385 tokens per session, scanned B, original, Apache-2.0.

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 Claude CodeCodexOpenCode

Written for Claude Code and Codex and OpenCode: ${CLAUDE_PLUGIN_ROOT} variable, but also the file is AGENTS.md. Also seen: mentions subagents; mentions Claude Code; reads ~/.codex paths.

This is MidnightDarling/collate's own configuration. It tells Claude Code, Codex and OpenCode how to work on collate itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything collate configures →

Runs only inside a plugin — its command needs a path that Claude Code sets for a plugin’s own hooks and for nothing else, and the catalogue could not identify which plugin ships it.

Reuse

Borrowing it

Nothing to install: this file belongs to MidnightDarling/collate. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/MidnightDarling/collate/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/MidnightDarling/collate

Made for: Claude Code, Codex, OpenCode.

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 collate AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/midnightdarling/collate/agents-md/github.svg)](https://agentmods.dev/instructions/midnightdarling/collate/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/midnightdarling/collate/agents-md"><img src="https://agentmods.dev/badge/instructions/midnightdarling/collate/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for collate AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/midnightdarling/collate/agents-md"><img src="https://agentmods.dev/badge/instructions/midnightdarling/collate/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
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. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.08385 $0.08385
Opus 5.5 $0.03354 $0.03354
Sonnet 5.5 $0.01677 $0.01677
Haiku 4.5 $0.00839 $0.00839

Measured 1mo ago against content hash 2cd12b701f4d, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo 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.md 由 scripts/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 依赖、poppler、mineru 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. 1mo 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 (7 stars, last pushed 4mo ago), licensed Apache-2.0. It adds 8,385 tokens to every session, about $0.0335 per session on Opus 5.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

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 9,649 tokens

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,384 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, cache eligibility and rollout and applying the notice (cutover).

microsoft/vscode · 5,262 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,680 tokens

vscode copilot-instructions.md

Copilot instructions for microsoft/vscode, covering vs code copilot instructions, project overview, root folders, core architecture (src/ folder) and built-in extensions (extensions/ folder).

microsoft/vscode · 2,731 tokens

deno copilot-instructions.md

Copilot instructions for denoland/deno, covering deno development guide for github copilot, network access, high level overview, key directories and key files to understand first.

denoland/deno · 3,077 tokens