agent-infra: Instructions file for Codex

AGENTS.md

agent-infra AGENTS.md is an instructions file for Codex, OpenCode from fitlab-ai/agent-infra. It costs 3,752 tokens per session, scanned C, original, MIT.

A repository instruction file that tells AI coding tools how to work in the agent-infra project. It covers careful planning, simple changes, and focused edits.

In plain words
What is it for?
It is for guiding agent behavior before and during code changes in a multi-agent infrastructure repository.
Why use it?
It gives coding agents shared rules so their changes are easier to review and less likely to be unnecessarily broad.

Instructions file for CodexOpenCode

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

This is fitlab-ai/agent-infra's own configuration. It tells Codex and OpenCode how to work on agent-infra 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 agent-infra configures →

Reuse

Borrowing it

Nothing to install: this file belongs to fitlab-ai/agent-infra. 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/fitlab-ai/agent-infra/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/fitlab-ai/agent-infra

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 agent-infra AGENTS.md

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

Your own site · 80×15
<a href="https://agentmods.dev/instructions/fitlab-ai/agent-infra/agents-md"><img src="https://agentmods.dev/badge/instructions/fitlab-ai/agent-infra/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 3,752 This file is loaded in full into every session.
When invoked 3,752 The same file — it is already loaded in full.
Security scan C 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.03752 $0.03752
Opus 5.5 $0.01501 $0.01501
Sonnet 5.5 $0.00750 $0.00750
Haiku 4.5 $0.00375 $0.00375

Measured 6d ago against content hash b9f43af0017e, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade C, and why

agent-infra AGENTS.md scanned grade C 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 6d 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.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

- **不可逆 / 已发布的副作用**:已执行的破坏性操作(`rm -rf`、`git push --force`、`gh issue edit` 等)、跨轮次的设计决策与裁决理由。
AGENTS.md · 222 lines

How it starts

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

agent-infra - AI 开发指南

本仓库包含 agent-infra 模板和技能仓库,用于多 AI 协作基础设施。

AI 行为准则(必须遵守)

源自 Andrej Karpathy 总结的 4 条 LLM 编程铁律,本项目所有 AI 工具均需遵守。 与下方项目规范冲突时,以项目规范为准;其余场景以本节为准。 这些准则偏向「稳」而非「快」,琐碎任务可酌情判断。

SKILL 执行场景的特例:在执行任一 SKILL 时,优先遵循 .agents/rules/no-mid-flow-questions.md(默认禁言 + 该规则文件列出的例外)。每次执行 SKILL 前应先 Read 该规则文件,以加载完整例外清单和具体约束。这与下文第 1 条「不确定就提问」不矛盾——SKILL 执行有明确的输入、输出和产物,不确定项应按最稳健方案推进并写入产物的「假设」/「未决问题」段落,由用户在审查检查点统一处理,而不是中途打断对话。

1. 先思考,再动手(Think Before Coding)

不要硬猜,不要藏起困惑,把权衡点摆到台面上。

  • 在 SKILL 执行期间,先按 .agents/rules/no-mid-flow-questions.md 的诊断与恢复顺序处理工具和执行问题;把仍未解决的假设或问题写入产物。
  • 对 SKILL 入口的自然语言需求,若存在会实质影响范围的歧义且不能从已有事实安全推导,再按对应入口规则澄清。
  • 对可逆、低影响的执行细节,优先采用符合现有代码和规则的方案并说明假设,不为一般执行选择中断工作流。
  • 当平台、客户端、协议、工作流、业务规则或算法存在多种行为时,识别各实现共用的流程,并用接口定义可替换的行为;主流程依赖接口,具体策略在注册或装配处选择。新增变体优先实现策略并接入现有装配逻辑,避免给每条链路分别增加分支。方案和实现阶段遵循 .agents/rules/strategy-pattern.md。
  • 有更简单的方案就说出来,必要时反推用户的决定。
  • 需要用户独有的事实或授权、无法验证安全边界或无法安全恢复时,按适用规则升级;其余情况继续独立工作并记录阻塞条件。

2. 简洁优先(Simplicity First)

选择能正确承载需求与真实变化的最简设计,不以最少行数或最少抽象为目标。

  • 不添加未被要求的功能、配置项或缺乏行为差异依据的抽象。为已明确的不同实现定义接口属于正确设计,不是投机扩展。
  • 不为稳定、单一且没有明确变化迹象的逻辑引入抽象层;当需求包含真实的行为变体时,应使用接口和策略模式隔离差异,即使当前只有一个实现。
  • 不为不可能发生的场景写错误处理。
  • 写了 200 行但 50 行就够时,重写它。
  • 自检:"资深工程师会觉得这过度设计吗?"——会,就简化。
兼容性默认关闭(Compatibility by Exception)

没有明确兼容承诺时,只实现当前契约,不主动保留旧行为。

  • 不因“可能有旧调用方”而新增 adapter、wrapper、shim、双写、旧 schema 读取或迁移分支。
  • 兼容性必须有证据:明确的旧消费者或存量数据、不可直接切换的原因、支持期限和删除条件;缺少任一项时按当前版本直接切换。
  • 优先一次性边界迁移或可操作的失败提示,不在主路径长期维护新旧两套状态机。
  • 临时兼容集中在唯一边界,并在该边界用 TODO(compat): Remove ... once ... 标记删除对象和可验证删除条件;任务或 Issue 仅用于可选排期,不是兼容事实源或完成门禁。
  • 当前流程的崩溃恢复、幂等重试和安全校验不等于历史兼容;只保留证明当前操作正确所需的最小事实。
  • 发现任务范围外的既有兼容逻辑时只记录,不顺手删除;新增或延长兼容逻辑则必须遵循 .agents/rules/compatibility-policy.md。

3. 外科手术式修改(Surgical Changes)

只动该动的地方;只清理你自己制造的垃圾。

  • 不顺手"优化"邻近代码、注释、格式。
  • 不重构没坏的东西。
  • 保持现有风格,即使你个人偏好不同。
  • 发现无关的死代码——提醒用户,不要擅自删除。
  • 因你的改动而产生的孤儿 import/变量/函数,必须由你清理。
  • 自检:每一行改动都能直接追溯到用户的请求吗?

4. 目标驱动执行(Goal-Driven Execution)

先定义可验证的成功标准,再循环执行直到达成。

把任务转成可验证的目标:

  • "加校验" → "先写非法输入的失败用例,再让它通过"
  • "修 Bug" → "先写复现该 Bug 的用例,再修到通过"
  • "重构 X" → "确保重构前后测试都通过"

Read the full file on GitHub · 222 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. 6d ago Changed · +4 tokens per session b9f43af0017e
  2. 17d ago Changed · +1 lines · +166 tokens per session f5d1bbe72c01
  3. 24d ago Changed · +1 lines · +101 tokens per session 0d353897a766
  4. 1mo ago Changed · +13 lines · +385 tokens per session 054ab4ba5e54
  5. 1mo ago First seen · 207 lines · 3,096 tokens per session scan C 3ae59d813dc0

Subscribe to this mod's changes

agent-infra AGENTS.md is an instructions file published in the GitHub repository fitlab-ai/agent-infra (86 stars, last pushed yesterday), licensed MIT. It adds 3,752 tokens to every session, about $0.0150 per session on Opus 5.5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other instructions, from other repositories