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/ag2ai/ag2/agents-mdgit clone --depth 1 https://github.com/ag2ai/ag2What 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.03671 | $0.03671 |
| Opus 5 | $0.01835 | $0.01835 |
| Sonnet 5 | $0.00734 | $0.00734 |
| Haiku 4.5 | $0.00367 | $0.00367 |
Grade A, and why
ag2 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.
How it starts
The opening of the file, as written. The whole thing — 242 lines — stays where its author put it; the contents beside it link to each section on GitHub.
AG2 Development Guidelines
AI-assisted contribution policy
Before opening a PR, read and follow .github/AI_POLICY.md.
- Do not open PRs with unverified AI-generated code or text.
- Ensure the PR description explains the real problem or use case and accurately reflects the diff.
- Include validation and testing information in the PR body.
- Be prepared to explain and revise the contribution in response to reviewer questions.
- Write the PR description using
.github/PULL_REQUEST_TEMPLATE.md. Keep its section headings (## Why are these changes needed?,## Related issue number,## Checks,## AI assistance), fill each one in, and only check a checklist box once it is actually true.
Architecture Decision Records (ADR)
Cross-cutting and hard-to-reverse design decisions are recorded in docs/adr/, sequentially numbered (0001-*.md, 0002-*.md, …) with status / date frontmatter and a short Context / Decision / Consequences body.
- Consult them before changing established public API or architecture. They explain why something is the way it is — e.g.
0003-eval-run-api-takes-agent-instances.mdrecords that the evalrun_*API takes prebuiltAgentinstances (not factories) and explicitly-builtSuites. If a change contradicts an ADR, supersede it rather than silently reverting the code. - Add one when a decision qualifies: it is hard to reverse, surprising without context (a reader would assume the opposite), and the result of a real trade-off. Scan
docs/adr/for the highest number and increment. Keep it short — recording that a decision was made and why is the value.
Code Style Guidelines
- Do not use
from __future__ import annotations. - With
@contextmanager/@asynccontextmanager, annotate the return type asGenerator[T]/AsyncGenerator[T], neverIterator[T]/AsyncIterator[T]. The decorator needs a real generator — it callsthrow()/athrow()on it — so the iterator form is an under-specification that typeshed marks deprecated. Import them fromcollections.abc(nottyping) and omit the default send type:AsyncGenerator[None], notAsyncGenerator[None, None]. - Do not use global variables or top-level side-effect function calls unless the user explicitly allows it.
- For filesystem paths, use
pathlib.Pathinternally. Public signatures should acceptstr | os.PathLike[str]. - Top-level imports from
ag2.*are for common APIs that are broadly reusable across scenarios and core agent flows. Good:ag2.[Input]— common structures usable inawait agent.ask(Input())and as tool results. Bad:ag2.middleware.BaseMiddleware— this is advanced/specialized and should be imported only when implementing custom middleware. - Do not use function-level imports unless the user explicitly allows it.
# === BAD - import inside function === def execute_tool(): from .tool import Tool ... # === GOOD - top-level import === from .tool import Tool def execute_tool(): ... - Do not create nested functions inside runtime execution paths.
# === BAD - function will be created each call === def execute_tool(): def _inner_function(): pass _inner_function() # === GOOD - function created once, executed each call === def execute_tool(): _inner_function() def _inner_function(): pass # === GOOD - decorator executed import time, so we can use closure functions here === def decorator(func): def wrapper(): return func() return wrapper - Do not perform side effects in initialization methods. Apply side effects only at runtime.
# === BAD - create directory in initial method === class KnowledgeStore: def __init__(self, path: str | os.PathLike[str]) -> None: self.path = Path(path) # side effect - directory creation self.path.parent.mkdir(parents=True, exist_ok=True) def run(self) -> None: ... # === GOOD - create directory in runtime method === class KnowledgeStore: def __init__(self, path: str | os.PathLike[str]) -> None: self.path = Path(path) def run(self) -> None: self.path.parent.mkdir(parents=True, exist_ok=True) ...
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 · 242 lines · 3,671 tokens per session scan A b3aa0e039a71
ag2 AGENTS.md is an instructions file published in the GitHub repository ag2ai/ag2 (4,896 stars, last pushed today), licensed Apache-2.0. It adds 3,671 tokens to every session, about $0.0184 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
nuwax AGENTS.md
Instructions for nuwax-ai/nuwax, covering ai agent system documentation, 系统概述, ai agent 架构, 核心组件 and ai 功能特性.
nuwax CLAUDE.md
Instructions for nuwax-ai/nuwax, covering claude ai agent platform frontend, 系统概述, ai agent 架构, 核心组件 and ai 功能特性.
EnterpriseAgentFramework AGENTS.md
Instructions for w8123/EnterpriseAgentFramework, covering reachai agent rules, 工作原则, windows powershell 与原生程序 utf-8 硬约束, 项目定位 and 关键目录.
pi-agent-dashboard AGENTS.md
Instructions for BlackBeltTechnology/pi-agent-dashboard, covering pi dashboard, docs-first gate — kb before grep (per-turn doctrine), code instructions (per-turn doctrine), investigation protocol — index first and documentation update protocol.
agents-universe CLAUDE.md
Instructions for agents-universe/agents-universe, covering agents universe — enterprise ai agent framework, project overview, monorepo layout, development commands and api (from packages/api/).
maidan CLAUDE.md
Instructions for david-engelmann/maidan, covering agent guide, 30-second orientation, read order, the cluster model in one paragraph and pr workflow (the short version).