factorio-docs-mcp: Instructions file for Codex

AGENTS.md

factorio-docs-mcp AGENTS.md is an instructions file for Codex, OpenCode from hjfmailbox/factorio-docs-mcp. It costs 1,130 tokens per session, scanned A, original, MIT.

Repository instructions for a Factorio documentation MCP server, a tool that helps developers search official Factorio mod documentation locally. It also compares documentation between game versions to help with mod upgrades.

In plain words
What is it for?
Use them when changing documentation synchronisation, version indexes, search, the MCP server, or migration support for Factorio mods.
Why use it?
They preserve the project’s architecture and recovery process when coding work is interrupted. They also clarify which layer handles downloading, indexing, or searching documentation.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: mentions CLAUDE.md; mentions AGENTS.md.

This is hjfmailbox/factorio-docs-mcp's own configuration. It tells Codex and OpenCode how to work on factorio-docs-mcp 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 factorio-docs-mcp configures →

Reuse

Borrowing it

Nothing to install: this file belongs to hjfmailbox/factorio-docs-mcp. 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/hjfmailbox/factorio-docs-mcp/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/hjfmailbox/factorio-docs-mcp

Made for: 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 factorio-docs-mcp AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/hjfmailbox/factorio-docs-mcp/agents-md/github.svg)](https://agentmods.dev/instructions/hjfmailbox/factorio-docs-mcp/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/hjfmailbox/factorio-docs-mcp/agents-md"><img src="https://agentmods.dev/badge/instructions/hjfmailbox/factorio-docs-mcp/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 factorio-docs-mcp AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/hjfmailbox/factorio-docs-mcp/agents-md"><img src="https://agentmods.dev/badge/instructions/hjfmailbox/factorio-docs-mcp/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,130 This file is loaded in full into every session.
When invoked 1,130 The same file — it is already loaded in full.
Security scan A 0 findings. 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.01130 $0.01130
Opus 5.5 $0.00452 $0.00452
Sonnet 5.5 $0.00226 $0.00226
Haiku 4.5 $0.00113 $0.00113

Measured 2mo ago against content hash 253efd04cf70, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

factorio-docs-mcp 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 2mo 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 · 62 lines

How it starts

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

AGENTS.md — Factorio Docs MCP

本文件是本项目对 AI 编码助手约束与指南的唯一事实源。CLAUDE.md 仅通过 @AGENTS.md 引用本文件,禁止在两处重复维护。

项目概述

同步 Factorio 官方 mod API 文档到本地,并通过 MCP server 辅助 mod 开发与跨大版本升级迁移。能力范围:检索 + 版本对比(不做 mod 源码扫描)。

设计文档:docs/superpowers/specs/2026-07-29-factorio-docs-mcp-design.md

上下文/进度恢复(上下文丢失时必读)

当会话上下文被压缩或清空、或你对自己此前的执行状态没有记忆时,不要凭记忆猜测进度,按以下顺序恢复:

  1. 读进度台账 docs/superpowers/PROGRESS.md——任务状态表、决策记录、断点都在里面(唯一事实源)。
  2. 对照 git log 验证台账记载的上个提交真实存在,防止台账与实际脱节。
  3. 读当前任务的计划 docs/superpowers/plans/2026-07-29-factorio-docs-mcp.md 与规格 docs/superpowers/specs/2026-07-29-factorio-docs-mcp-design.md。
  4. 从台账标记的第一个未完成任务继续,绝不重复已完成任务。

每次完成一个任务,必须同步更新 PROGRESS.md 并随代码提交,保证任何时刻都能从 git 恢复断点。

架构约束(必须遵守)

  • 三层边界:sync/ 只写 raw/;index/ 只读写 index.db;mcp/ 只读 index.db。数据流向单向,禁止各层的数据处理逻辑跨层耦合(如 mcp 层读取 raw 文件并解析、sync 的下载逻辑直接拼 SQL 写库)。
  • 组合根例外:编排入口(sync/orchestrate.ts、cli.ts、mcp.ts)是组合根,允许为「串联三层」而调用各层的公开接口(如编排器调用 buildVersion 建索引)。但组合根只负责编排,不得在其中新增属于某一层的具体数据处理逻辑(如下载细节、SQL、解析规则)。
  • 检索接口:所有检索必须经过 SearchProvider 接口,禁止在 MCP 工具内直接写 SQL。
  • 数据保真:api_entries.data 列必须原样存储官方 JSON 子树,禁止裁剪字段。

已知技术债 / 重构提醒

  • 编排逻辑当前寄生于 sync/orchestrate.ts:它作为组合根同时调用 sync 下载与 index 建库,功能正确但归属不纯粹。当未来编排逻辑变复杂时(如增加并发同步、断点续传、多阶段流水线、更细的失败恢复),应将其重构到中立位置(如 src/app/),使 sync/ 回归「只写 raw/」的字面纯粹。 目前按 YAGNI 暂不重构。

数据源纪律

  • 仅使用官方数据源:lua-api.factorio.com(runtime/prototype JSON + archive.zip)、wube/factorio-data(含 changelog.txt)。
  • 禁止引入社区/第三方数据作为 API 事实来源。
  • 同步必须增量:已有版本数据只增不改;单版本失败不得影响其他版本。

语言与交互

  • 与用户交互使用中文(专业名词、代码标识符除外)。
  • 代码注释使用中文,遵循周边代码风格。

操作规则

  • 修改任何文件之前,必须先 READ 该文件。 禁止在未读取文件的情况下直接执行 Edit 或 Write(即使全局配置已有此规则,此处重复以确保生效)。

测试要求

  • 测试框架:Vitest。
  • 新功能先写测试再实现(TDD)。
  • L3 迁移知识的 breaking 判定规则变更时,必须同步更新召回测试 fixture。
  • 运行测试:npm test;类型检查:npm run typecheck; lint:npm run lint。

工程约定

  • Node.js ≥ 22(依赖内置 node:sqlite),TS 严格模式 + ESM。
  • 构建:tsup(单包双 bin:fdocs / fdocs-mcp)。
  • Lint/Format:Biome,提交前必须通过。
  • 数据目录由 FACTORIO_DOCS_DATA 或平台用户数据目录解析,禁止硬编码路径。

Read the full file on GitHub · 62 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. 2mo ago First seen · 62 lines · 1,130 tokens per session scan A 253efd04cf70

Subscribe to this mod's changes

factorio-docs-mcp AGENTS.md is an instructions file published in the GitHub repository hjfmailbox/factorio-docs-mcp (0 stars, last pushed 3mo ago), licensed MIT. It adds 1,130 tokens to every session, about $0.0045 per session on Opus 5.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.

Related

factorio-docs-mcp AGENTS.md compared with instructions from other repositories

factorio-docs-mcp AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
factorio-docs-mcp AGENTS.mdhjfmailbox/factorio-docs-mcpInstructions file03mo agoMITA1,130Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143kyesterdayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149kyesterdayMITA4,680Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA5,516GitHub Copilot
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file274k2d agoMITA4,313Codex, OpenCode