any2markdown AGENTS.md

Repository instructions for any2markdown, a service that converts PDF, Word, and Excel files into Markdown through MCP tools or a web API. MCP is a standard way for AI assistants to call tools.

In plain words
What is it for?
Building, testing, and extending file conversion, image extraction, document checks, batch processing, and basic document structure analysis.
Why use it?
They explain the project layout, required Python version, and rules for changing the document-conversion service.

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/ww-ai-lab/any2markdown/agents-md
Clone the repo
git clone --depth 1 https://github.com/WW-AI-Lab/any2markdown

Made for: Codex, OpenCode.

Per session 829 This file is loaded in full into every session.
When invoked 829 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.00829 $0.00829
Opus 5 $0.00415 $0.00415
Sonnet 5 $0.00166 $0.00166
Haiku 4.5 $0.00083 $0.00083

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

Security

Grade A, and why

any2markdown AGENTS.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 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.

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.md · 66 lines

What it actually says

OpenSpec Instructions

These instructions are for AI assistants working in this project.

Always open @/openspec/AGENTS.md when the request:

  • Mentions planning or proposals (words like proposal, spec, change, plan)
  • Introduces new capabilities, breaking changes, architecture shifts, or big performance/security work
  • Sounds ambiguous and you need the authoritative spec before coding

Use @/openspec/AGENTS.md to learn:

  • How to create and apply change proposals
  • Spec format and conventions
  • Project structure and guidelines

Keep this managed block so 'openspec update' can refresh the instructions.

项目定位与目标

any2markdown 是一个文档转 Markdown 服务,当前实现目标是:

  • 同时提供 MCPRESTful API 两种调用方式;
  • 支持 PDFWord(docx/doc)Excel(xlsx/xls) 转换;
  • 提供图片提取、文档校验、批量转换、基础结构分析能力;
  • 统一由 src/any2markdown_mcp/ 下处理器与工具层实现核心逻辑。

代码结构速览

  • src/any2markdown_mcp/server.py:FastMCP 入口,注册 MCP 工具与 REST 路由。
  • src/any2markdown_mcp/tools/:MCP 工具函数层(参数协议、响应组装)。
  • src/any2markdown_mcp/processors/:文档处理核心逻辑(PDF/Word/Excel)。
  • src/any2markdown_mcp/api/:REST API Handler 与请求/响应模型。
  • src/any2markdown_mcp/config.py:环境变量与默认配置。

代码规范与工程约束

Python 与风格

  • Python 版本基线:>=3.10,<3.14(推荐 3.13,见 pyproject.toml)。
  • 行宽按 88 字符控制(Black/isort 配置已定义)。
  • 新增或修改函数优先补全类型注解,保持 mypy 严格配置兼容。
  • 保持异步接口一致性:工具与处理链路使用 async

功能与接口约束

  • 输入文件类型受 allowed_file_types 限制:pdf/docx/doc/xlsx/xls
  • 默认最大文件大小:100MBmax_file_size)。
  • 默认服务端口:3000,MCP 路径:/mcp,REST 前缀:/api/v1
  • 转换接口默认 include_content=false,避免在响应中返回大文本正文。

资源与运行约束

  • 首次 PDF 能力使用可能触发模型下载,依赖 ~/.cache/marker 与 HuggingFace/Torch 缓存目录。
  • 项目当前文档中存在“规划态”和“实现态”混合内容;修改功能时应同步更新文档,避免与实际代码偏离。
  • 仓库当前未包含 tests/ 目录;如新增测试需与现有 pytest 配置保持一致。

修改原则(给协作代理)

  • 优先做“最小可验证改动”,避免无关重构。
  • 变更接口或配置项时,至少同步更新以下文档之一:
    • README.md
    • docs/*.md 对应专题文档
    • openspec/project.md(项目约定变更)
  • 涉及新增能力、破坏性变更、架构级调整时,先按 openspec/AGENTS.md 走 proposal 流程,再实现代码。
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 · 66 lines · 829 tokens per session scan A e58d0e46c78e

Subscribe to this mod's changes

any2markdown AGENTS.md is an instructions file published in the GitHub repository WW-AI-Lab/any2markdown (50 stars, last pushed 6mo ago), licensed MIT. It adds 829 tokens to every session, about $0.0041 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-30.

Related

Other instructions, from other repositories

spec-kit AGENTS.md

AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.

github/spec-kit · 7,104 tokens

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 · 6,785 tokens

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex · 5,182 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,345 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, applying the notice (cutover) and fallback chain (never fail the build).

microsoft/vscode · 5,001 tokens

next.js 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,296 tokens