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.
npx agentmods add instructions/ww-ai-lab/any2markdown/agents-mdgit clone --depth 1 https://github.com/WW-AI-Lab/any2markdownWhat 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.
| Model | Per session | Once 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 |
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.
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 服务,当前实现目标是:
- 同时提供
MCP与RESTful API两种调用方式; - 支持
PDF、Word(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。 - 默认最大文件大小:
100MB(max_file_size)。 - 默认服务端口:
3000,MCP 路径:/mcp,REST 前缀:/api/v1。 - 转换接口默认
include_content=false,避免在响应中返回大文本正文。
资源与运行约束
- 首次 PDF 能力使用可能触发模型下载,依赖
~/.cache/marker与 HuggingFace/Torch 缓存目录。 - 项目当前文档中存在“规划态”和“实现态”混合内容;修改功能时应同步更新文档,避免与实际代码偏离。
- 仓库当前未包含
tests/目录;如新增测试需与现有pytest配置保持一致。
修改原则(给协作代理)
- 优先做“最小可验证改动”,避免无关重构。
- 变更接口或配置项时,至少同步更新以下文档之一:
README.mddocs/*.md对应专题文档openspec/project.md(项目约定变更)
- 涉及新增能力、破坏性变更、架构级调整时,先按
openspec/AGENTS.md走 proposal 流程,再实现代码。
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.
- 2d ago First seen · 66 lines · 829 tokens per session scan A e58d0e46c78e
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.
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.
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).
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.
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.
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).
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.