ToFu: Instructions file for Codex

AGENTS.md

ToFu AGENTS.md is an instructions file for Codex, OpenCode from NiuTrans/ToFu. It costs 3,682 tokens per session, scanned A, original, MIT.

Repository instructions for coding agents working in the NiuTrans/ToFu codebase. They describe where to look, which files to edit, how to run commands, and how to verify changes.

In plain words
What is it for?
Use them when exploring ToFu, debugging, changing frontend code, running commands, or following its test and verification process.
Why use it?
They reduce guesswork in an unfamiliar repository and help avoid editing generated files or wasting context on irrelevant output.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: mentions CLAUDE.md; reads ~/.codex paths; mentions AGENTS.md.

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

Reuse

Borrowing it

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

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 ToFu AGENTS.md

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

Your own site · 80×15
<a href="https://agentmods.dev/instructions/niutrans/tofu/agents-md"><img src="https://agentmods.dev/badge/instructions/niutrans/tofu/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 3,682 This file is loaded in full into every session.
When invoked 3,682 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.03682 $0.03682
Opus 5.5 $0.01473 $0.01473
Sonnet 5.5 $0.00736 $0.00736
Haiku 4.5 $0.00368 $0.00368

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

Security

Grade A, and why

ToFu 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 · 267 lines

How it starts

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

Repository guidance

This file is the single source of repository-wide rules for every coding agent; read it completely before changing code. Keep task quality as the primary objective, then minimize model turns and raw context growth without weakening verification.

  • Use isolated worktrees for sustained changes in a shared checkout. Never reset, clean, or replace the shared tree to prepare a task. When other (uncommitted or in-flight) work exists in the workspace, NEVER run workspace-destroying commands such as git checkout --, git checkout <branch>, git switch, git restore, git stash, git reset --hard, or git clean: they can silently discard concurrent edits. Create each worktree with git -C <shared-checkout> worktree add <path> -b <branch> <shared-current-branch>, never from the platform task workspace's HEAD, which may be a task-input snapshot. Commits made in an isolated worktree never reach the current branch by themselves: the executing agent (the model — never the human user) must land them itself, immediately once the worktree work is finished and verified, not later and never as a hand-off: run python3 scripts/git_land.py <branch> from the shared checkout. Unlike git merge, it does not refuse when other writers have uncommitted edits in the same files; it carries those edits forward with a three-way merge, then removes the worktree and deletes the branch. Known generated outputs are rebuilt from merged sources; uncommitted sources and their outputs stay uncommitted. Do not reset generated files to unblock it. If it refuses, nothing was changed; follow its printed instruction (merge the current branch into the worktree branch to resolve a real conflict, or rerun after another writer's overlapping lines are committed). A task is not complete until its worktree commits are merged into the current branch. The merge commit's first parent is the pre-integration backup; the tool prints it, so record that SHA in the final answer instead of creating backup/* branches.
  • Start unfamiliar work with one bounded discovery batch over the owning modules, contracts, tests, and current changes: use rg/rg --files and targeted ranges instead of repeatedly reading one file at a time. Do not dump the whole dirty worktree, full diffs, generated bundles, or large logs. On this host's FUSE mount, prefer git ls-files and git grep over find/ grep -r: deep find walks intermittently return empty.
  • Use docs/README.md as the first-hop map to the owning module and contract; docs/catalog.json is the machine-readable documentation inventory. Change the authority first, then derive generated clients and bundles. Edit retained browser code in frontend/src/runtime/sections/, never the generated app-runtime.js. Edit styles in frontend/src/styles/{application,settings}/, never generated files under static/.
  • Repo-root local trees that are untracked on purpose (gitignored): promo/ (marketing HTML/PNGs) and codex/ (a local vendored Codex CLI checkout used for comparison/evaluation). Neither is a runtime dependency of tracked code: lib/oauth/codex* and lib/skills/paths.py spawn a codex binary and scan .codex/skills by name only. Do not track or delete these trees.
  • Generated Python modules follow the package-local generated_*.py (or *_generated.py where the name predates the convention) prefix, never loose hand-mixed names in a package root. See CONTRIBUTING.md “Generated files”.
  • Batch independent read-only inspections with the live tools' documented batching or parallel-call interface. Tool schemas, not repository examples, define the available names, arguments, and execution semantics. Return only evidence needed for the next judgment.
  • Background long commands with run_command(background=true) when useful. The receipt and the tool description say whether the completion reaches you automatically: only a task that owns its conversation turn is woken with it. A swarm worker or other delegated run collects its handle with poll before it finishes; a leaf worker's poll and kill reach only the bg_* commands it started. A headless API request runs every command in the foreground. Use poll with a bounded wait only when no useful work remains. Never busy-poll or infer success from an absent session. Keep user progress updates within 60 seconds.
  • Add or update the smallest executable specification for the behavior, then use a test ladder: smallest relevant tests first, then neighboring contracts, then broad gates once the worktree is stable. Do not rerun an unchanged suite. With concurrent writers, report that a full-suite result is a moving target.
  • Update the owning current-state document with the change; delete superseded plans instead of leaving an archive beside authoritative documentation.
  • Batch mechanical edits, but inspect and test semantic boundaries separately. Preserve fault injection, rollback, authority, and user-visible error behavior.
  • Before finishing a tool-heavy task, run python3 audit_codex_session.py <rollout.jsonl> when a session path is available. Treat fewer calls as a win only when the same correctness checks and required evidence still pass.

Read the full file on GitHub · 267 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. 2d ago Changed · +59 lines · +869 tokens per session 9b12d4349d29
  2. 17d ago Changed · +35 lines · +464 tokens per session 85f3de53e607
  3. 19d ago Changed · +17 lines · +273 tokens per session e5f2aff0c62d
  4. 28d ago Changed · +31 lines · +472 tokens per session b92b545c433a
  5. 2mo ago First seen · 125 lines · 1,604 tokens per session scan A bf8eb26216c8

Subscribe to this mod's changes

ToFu AGENTS.md is an instructions file published in the GitHub repository NiuTrans/ToFu (151 stars, last pushed 2d ago), licensed MIT. It adds 3,682 tokens to every session, about $0.0147 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-09-07.

Related

ToFu AGENTS.md compared with instructions from other repositories

ToFu AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
ToFu AGENTS.mdNiuTrans/ToFuInstructions file1512d agoMITA3,682Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA9,719GitHub Copilot
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA5,516GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143ktodayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149ktodayMITA4,680Codex, OpenCode
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA3,093GitHub Copilot
vscode model-prompts.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA2,022GitHub Copilot