collate GEMINI.md

A project instruction file for Collate, a toolkit that turns scanned Chinese historical documents into corrected Word documents and formatted articles.

In plain words
What is it for?
It describes the pipeline for scan cleanup, OCR, proofreading, comparison, Word export, and article formatting, plus research-oriented reading tools.
Why use it?
It gives coding agents the repository's workflow, available skills, and commands so document processing follows the project's conventions.

Instructions file for Gemini CLI

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

Made for: Gemini CLI.

Per session 1,228 This file is loaded in full into every session.
When invoked 1,228 The same file — it is already loaded in full.
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.01228 $0.01228
Opus 5 $0.00614 $0.00614
Sonnet 5 $0.00246 $0.00246
Haiku 4.5 $0.00123 $0.00123

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

Security

Grade A, and why

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

GEMINI.md · 104 lines

How it starts

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

GEMINI.md — collate

Gemini CLI 在每次会话中自动加载此文件作为项目上下文。完整工作流契约见 AGENTS.md

这个仓库是什么

collate 是一个中文历史文献 OCR + 校对工具包。从扫描件到最终的 Word 稿和公众号推文,agent 自主完成清理、识别、校对、自审、排版。所有中间产物保留在工作区,方便逐行溯源。

pipeline 之上还有一层阅读 skill——用学术方法而非数据提取的方式与文本对话。

15 个 skill

8 个流水线 + 7 个阅读。每个 skill 是一个自包含目录:SKILL.md(指令)+ scripts/(Python)+ references/(知识库)。

流水线

Skill 做什么 何时调用
setup 环境诊断(Python、poppler、OCR 凭据) 首次使用
prep-scan 去水印 / 去馆藏章 / 裁边 → cleaned.pdf 拿到 PDF 后
visual-preview 清理结果三态 HTML 预览 prep-scan 后
ocr-run MinerU / 百度 OCR → raw.md + meta.json visual-preview 后
proofread 五步 checklist → A/B/C 三级校对清单 raw.md 就位后
diff-review raw vs final 语义级审计 HTML final.md 就位后
to-docx 学术 Word 文档 diff-review 后
mp-format 公众号排版 HTML + xiumi sidecar 最后一步

阅读

Skill 做什么
xray-paper 单篇论文 X 光透视(Obsidian 原生)
paper-summary 5–30 篇语料图谱(Obsidian 原生)
chunqiu 读禁忌、裁断与策略性沉默
kaozheng 审引文、来源等级与论证链
prometheus 定义一个概念,渲染 SVG 卡片
real-thesis 挖掘论文绕而未写的真命题
constellatio 跨时代接受史诊断 + 可选星图可视化

调用方式

读取目标 skill 的 SKILL.md 获取完整指令,然后通过 shell 执行 Python 脚本:

# 1. 读 skill 契约
cat skills/<skill-name>/SKILL.md

# 2. 执行脚本(示例:拆页)
python3 skills/prep-scan/scripts/split_pages.py \
    --pdf "$WORK_DIR/original.pdf" --out "$WORK_DIR/pages" --dpi 300

一条命令跑完整 pipeline(不需要 agent 介入):

python3 scripts/run_full_pipeline.py --pdf <input.pdf>

2 个 subagent

Agent 文件 职责
ocr-pipeline-operator agents/ocr-pipeline-operator.md 流水线总调度:机械编排 → 校对 → 自审 → 交付
historical-proofreader agents/historical-proofreader.md 校对领域专家:五步 checklist,产出 A/B/C 分级清单

调度 subagent 的方式:开一个新的 Gemini CLI 会话,把 agent 定义作为上下文加载:

gemini -C agents/historical-proofreader.md \
  "type=modern, 请按五步 checklist 校对 $WORK_DIR/raw.md"

或在当前会话中用 @agents/historical-proofreader.md 引用 agent 定义。

工作区约定

每份 PDF 产生一个 <basename>.ocr/ 目录。详见 references/workspace-layout.md

Read the full file on GitHub · 104 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 · 104 lines · 1,228 tokens per session scan A 5d8aa2556d55

Subscribe to this mod's changes

collate GEMINI.md is an instructions file published in the GitHub repository MidnightDarling/collate (6 stars, last pushed 3mo ago), licensed Apache-2.0. It adds 1,228 tokens to every session, about $0.0061 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.