agentleFS
Lukk17Lukk17/agent-standards/AGENTS.md

agent-standards

AGENTS.md1 starsChanged 56 days agoMITView on GitHub

Instructions for agents working on agent-standards itself. This file is never shipped. Consumers get AGENTS.md.example, the only .example file, because every other configuration file ships unchanged. Before any code work on a task, name the skill(s) and subagent(s) that own it and invoke them, or state "none apply" and why, as the first line of your reply. This is a hard gate. Follow .agents/instructions/reply-rules.md when writing to the user. Name skills and ownership in the footer status tail it defines,…

  • Reads credentials
  • Installs packages

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

14 rules. About 0 are common, 7 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before any code work on a task, name the skill(s) and subagent(s) that own it and invoke them, or state "none apply" and why, as the first …

    line 11
  2. Distinctive:

    Follow .agents/instructions/reply-rules.md when writing to the user.

    line 14
  3. Very specific:

    Every rule fires only on a caller positively identified as the main thread.

    line 34
  4. Very specific:

    No MCP tool is gated, and playwright and chrome-devtools in .mcp.json can write local files.

    line 40
  5. Very specific:

    Every hook runs on -S -E under python3, falling back to python.

    line 63
  6. Very specific:

    No hook uses argparse, which exits 2 on a usage error.

    line 64
  7. Distinctive:

    Every wiring moves to the project root before it calls a hook, and forces a zero exit where its format allows, so a missing script allows.

    line 66
  8. Distinctive:

    Every wiring that can reach a subagent injects the subagent text and never the reminder.

    line 88
  9. Distinctive:

    Test detail is in sandbox-agent/README.md.

    line 95
  10. Very specific:

    There is no lock file: Every version in tools/pyproject.toml is an exact pin, and --group needs pip 25.1 or newer.

    line 188
  11. Very specific:

    A skill: create .agents/skills/<name>/SKILL.md, with depth in references/.

    line 233
  12. Very specific:

    An MCP server: add the block to all five MCP files (the ones listed under Repo conventions), document it in docs/MCP_SETUP.md, and bump the …

    line 241
  13. Distinctive:

    Simplicity first: Write the minimum that solves the problem.

    line 273
  14. Distinctive:

    Number every question: Every question put to the user is numbered, one continuous sequence per conversation, subpoints like 13.1.

    line 285

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md

Instructions for agents working on agent-standards itself. This file is never shipped. Consumers get AGENTS.md.example, the only .example file, because every other configuration file ships unchanged.


Required opening move

Before any code work on a task, name the skill(s) and subagent(s) that own it and invoke them, or state "none apply" and why, as the first line of your reply. This is a hard gate.

Follow .agents/instructions/reply-rules.md when writing to the user. Name skills and ownership in the footer status tail it defines, never as the reply first line.

The gate is enforcing, not advisory. One shared rule in .agents/hooks/preflight_gate.py decides every tool call, on every agent:

  • It denies the main thread a write of any file inside the repository, by any tool or shell, with no exemption for markdown, configuration, or documentation, and tells it to delegate the change instead. The repository is the process working directory, the project root the payload names in cwd, and the gate's own project two folders up. A write outside it, a write to the null device, a write to tasks.md at the project root, and git branch switching stay allowed. How the gate places a path and reads commands, wrappers and inline code is in docs/agent-compatibility.md under "Hook enforcement".
  • It denies any tool call, not only an edit, from a subagent whose own definition declares no skills, because that agent is not a specialist. The rule reads agent_type out of the payload and looks the definition up in the six agent trees, so an unknown or unreadable agent_type allows rather than denies.
  • It denies the main thread a web fetch or web search tool on Claude Code, the one format whose tool names are confirmed. Codex has no confirmed tool name for this yet. The main thread spawns a subagent to do the research.
  • It denies the main thread running a script or a module, because the gate cannot see what a script writes, unless the command passes MAIN_THREAD_ALLOWLIST in the gate or an entry of the project's own main-thread-allowlist.txt. The rules are in docs/GLOBAL_SETUP.md under "What the main thread may run". This repository's own checks sit in main-thread-allowlist.txt, which never ships.
  • Every rule fires only on a caller positively identified as the main thread. Claude Code and Codex send agent_id only inside a subagent. An unknown caller is allowed: GitHub Copilot on every call, and an OpenCode or Kilo Code call whose session the plugin could not read.
  • It fails open: a parse error, a missing key, an unexpected payload, an unknown --format, or a top-level command it cannot lex allows the call. The exception is a path or write target the gate cannot place, such as the $f in rm $f, which denies on the main thread. The list is in docs/agent-compatibility.md.
  • No MCP tool is gated, and playwright and chrome-devtools in .mcp.json can write local files. The vendor quotes are in docs/agent-compatibility.md.
  • Known limits of the write rule, accepted rather than open: a write form the gate does not know passes, a top-level command it cannot parse allows, MCP tools are not gated, code run by an allowlisted tool is trusted rather than read, Copilot's main thread is not gated, the risky variable and option lists come from knowledge rather than vendor documentation, and a loopback share whose folder cannot be determined denies. Re-audit only when the rule changes, and record a new limit here rather than chasing it.

Each agent wires that one script, and the hooks beside it, to its own hook surface. The events per surface are in docs/agent-compatibility.md.

AgentWiringGate matcher
Claude Code.claude/settings.json^(Edit|Write|MultiEdit|NotebookEdit|Bash|PowerShell|WebFetch|WebSearch)$
Codexinline [[hooks.*]] tables in .codex/config.toml^(Bash|shell|apply_patch|Edit|Write|NotebookEdit)$
OpenCode and Kilo Code.agents/plugin/hooks.js, declared once by path in the plugin array of opencode.json, which both tools readnone, every tool call
GitHub Copilot.github/hooks/preflight.jsonbash|powershell|create|edit|apply_patch

Per-surface details worth knowing before you touch any of them:

  • Claude Code's SessionStart also injects the subagent supervision text, plain context with no script behind it. docs/GLOBAL_SETUP.md and sandbox-agent/setup-global.sh carry it word for word.
  • Every hook runs on -S -E under python3, falling back to python.
  • No hook uses argparse, which exits 2 on a usage error. Two is the deny code in the plain format, so a stray flag would read as a block. Each hook scans sys.argv by hand instead and treats an unknown flag as an allow.
  • Every wiring moves to the project root before it calls a hook, and forces a zero exit where its format allows, so a missing script allows. A session started in a subdirectory once denied every call, because Python exits 2 on a file it cannot open. Codex's commandWindows runs under PowerShell and ends in ; exit 0, because Windows PowerShell 5.1 has no ||. The plugin cannot force a zero exit, so it drops a hook file it cannot open.
  • Claude Code runs every command hook in shell form, Git Bash on Windows (https://code.claude.com/docs/en/hooks#exec-form-and-shell-form, measured on 2.1.281). Without Git Bash every Claude hook fails to parse and allows, so the setup docs require Git for Windows.
  • The Claude Code matcher names PowerShell beside Bash, because on Windows "A hook that matches only Bash never fires there" (https://code.claude.com/docs/en/hooks#powershell).
  • Codex hooks live inline in .codex/config.toml. Codex warns when one layer also carries a hooks.json, so .codex/hooks.json does not exist.
  • Copilot hooks are no longer CLI-only. They run in VS Code and in JetBrains as well, from the same .github/hooks/ path. Event names are camelCase, and a hook entry carries bash and powershell as sibling string fields next to type, not a nested command object. A nested one is silently ignored, which leaves that surface ungated.
  • The Copilot CLI also runs the hooks in .claude/settings.json, with a Claude-shaped payload and no agent_id. The gate reads a claude-format call carrying COPILOT_CLI=1 and no transcript_path as an unknown caller. Do not widen the Claude matcher to Copilot's tool names. The measurements are in docs/hooks-contract.md.
  • The formatting checker fixes what it can on every surface that can rewrite the display, and blocks only on what is left. Detail is in docs/hooks-contract.md.
  • OpenCode and Kilo Code run every hook directly in .agents/hooks/ on every tool.execute.before, through the plugin runner. Adding a hook file is the whole registration step. The contract is in docs/hooks-contract.md.
  • Every wiring that can reach a subagent injects the subagent text and never the reminder. The per-agent evidence is in docs/hooks-contract.md.
  • Copilot gets the reminder on every prompt from userPromptTransformed through .agents/hooks/copilot/prompt_reminder.py, which sits in a subdirectory so the OpenCode and Kilo Code runner skips it.
  • sandbox-agent/live/ proves the wiring against a real model, run by the manual live workflow under Repo conventions. On Copilot, tests 1 and 2 can report KNOWN-GAP, as the Maintenance follow-ups record. Test detail is in sandbox-agent/README.md.

Verified against Claude Code 2.1.281, Codex 0.156.1, OpenCode 1.18.32, and Kilo Code 7.7.9. GitHub Copilot CLI was last verified on 1.0.81 and is not installed here, so nothing above was re-measured against it.


What this repo is

agent-standards is a single source of AI-agent configuration (skills, subagents, MCP servers, preflight hooks, shared instructions) imported into other projects via Git selective checkout. Consumer projects pull production-ready folders and pull updates with one git fetch. The canonical subagents/ source and the tools/ generator stay here and are never imported downstream.

The load-bearing distinction is canonical vs generated. Some trees are hand-edited here, some are emitted by a script and must never be hand-edited, and some are symlinks the generator creates and repairs.

TreeStatusHow to edit
subagents/*.mdcanonicaledit directly, then regenerate
.agents/skills/*/SKILL.md and its references/*.mdcanonicaledit directly, keep the manifest short and the depth in references/
.agents/hooks/preflight_gate.py, .agents/hooks/no_ai_markers_check.py, .agents/hooks/task_list_sync.py, .agents/hooks/markdown_lint_check.py, .agents/hooks/question_numbering_check.py, .agents/hooks/status_block_check.py, .agents/hooks/copilot/prompt_reminder.pycanonicaledit directly, then run the pytest suite
tasks.mdruntime state, git-ignoredwritten by the hook and by the model, never committed
.agents/plugin/hooks.jscanonicaledit directly
AGENTS.md.example, docs/*.mdcanonicaledit directly
tools/*.py, tools/tests/*.py, tools/pyproject.tomlcanonicaledit directly, then run the pytest suite
global/bin/update-global.sh, global/bin/update-global.ps1canonical, shipped only by the global install to ~/.agents/binedit both together, then run python -m pytest tools/tests/test_update_global.py
main-thread-allowlist.txtcanonical, this repo only, never shippededit directly, then run python -m pytest tools/
.claude/agents/*.mdgenerated (Claude front matter with a skills key)never hand-edit, run the generator
.agents/agents/*.mdgenerated (OpenCode format)never hand-edit, run the generator
.codex/agents/*.tomlgenerated (Codex TOML)never hand-edit, run the generator
.github/agents/*.agent.mdgenerated (Copilot *.agent.md)never hand-edit, run the generator
.opencode/agents, .kilo/agentssymlinks to ../.agents/agentscreated and repaired by the generator
.claude/skillssymlink to ../.agents/skillsnever edit through the link

The generated subagent trees are per tool because no shared subagent format exists.

Regenerate the subagent trees and repair the symlinks after any subagents/*.md change:

python tools/gen_subagents.py

On Windows, turn on Developer Mode and set the Git option below before cloning, or every symlink checks out as a plain text file:

git config core.symlinks true

Full layout reference: docs/repository-layout.md. Which agent reads which part of .agents/ is in docs/agent-compatibility.md. This repo does not use OpenSpec itself. The OpenSpec sections in the .example are for consumers.


Repo conventions

On top of the global rules in ~/.claude/CLAUDE.md:

  • The consumer boundary is the filename case. A consumer receives exactly two kinds of thing: the agent configuration files the import pulls, and the UPPERCASE-named markdown documents under docs/. Every lowercase document under docs/ is ours and never ships. README.md is the one uppercase file that stays here. e2e/, sandbox-agent/, subagents/, and tools/ are test and build material and never reach a consumer, so no shipped document may link into them. A shipped document linking to a lowercase one is the same defect: the link resolves here and 404s there. global/ ships only through the global install in docs/GLOBAL_SETUP.md, which copies global/bin/ to ~/.agents/bin, and never through a project import, so no project-import pathspec may name it. main-thread-allowlist.txt is this repository's own and never ships by either route.
  • Markdown lint. tools/check-markdown.py checks README.md, AGENTS.md.example, docs/*.md, .agents/skills/**/*.md and subagents/*.md for dashes, prose lines over 120 characters, level-2 headings, and skill and subagent front matter. This AGENTS.md is out of scope, but match the style anyway.
  • One runnable command per fenced code block in any doc a human copies, with the matching language tag and no # comment lines inside the block (global rule).
  • One server set, one schema per file. Change all five MCP files together: .mcp.json for Claude Code, opencode.json for OpenCode and Kilo Code, .codex/config.toml for Codex, .vscode/mcp.json for Copilot in VS Code, and .github/mcp.json for the Copilot CLI. Only the top-level key, the type value, and the environment-variable syntax differ. Why the CLI has its own file, and why .mcp.json still shadows it, is in docs/MCP_SETUP.md. The per-surface matrix is in docs/agent-compatibility.md.
  • No substitution token may appear in opencode.json. Kilo Code rejects the whole file on a {env:VAR}, which drops the MCP block and the plugin array that declares the gate. Local servers inherit the environment instead, and context7 ships with no headers block. The detail is in docs/MCP_SETUP.md and nowhere else.
  • One gate, one rule, one wording. A behaviour change is a change to .agents/hooks/preflight_gate.py plus a case in tools/tests/test_preflight_gate.py, never a second copy of the logic. The per-surface reminder text, where a surface still injects one, is kept in that surface's own wiring file, and tools/tests/test_prompt_reminder.py compares every copy to its canonical source.
  • One tail, one check, one wording. .agents/instructions/reply-rules.md, .agents/hooks/status_block_check.py and its tests ship as one consistent set with no conflicts, and the hook is the enforcement.
  • The tooling is a package under tools/. tools/pyproject.toml is the only place a dependency or a version is written by hand, and it holds the pytest configuration too.
  • There is no lock file. Every version in tools/pyproject.toml is an exact pin, and --group needs pip 25.1 or newer.
  • CI runs on every pull request and every push to master, with three parallel jobs: actionlint, validate for the local checks below, and sandbox for the containerised suite. Verify locally before you push.
  • .github/workflows/agent-live-tests.yml is a separate workflow and never part of CI. Its only trigger is workflow_dispatch, so no push and no pull request ever starts it. It needs two repository secrets, because it drives each agent against a real model: REQUESTY_API_KEY for Claude Code, OpenCode and Kilo Code on Requesty, and OPENAI_API_KEY for Codex and GitHub Copilot on OpenAI's own API with gpt-6-luna. Each job receives only the key its agent needs. Every run spends money on those keys. Start it only with the user's explicit approval for that one run.

Local verification (the same checks CI runs). Install the pinned dependencies first, with pip 25.1 or newer:

pip install ./tools --group ./tools/pyproject.toml:dev
python tools/gen_subagents.py --check
python tools/check-markdown.py
python tools/check-badges.py
python -m pytest tools/
python -c "import json; [json.load(open(f)) for f in ['.mcp.json','opencode.json','.vscode/mcp.json','.github/mcp.json','.claude/settings.json','.github/hooks/preflight.json']]"
python -c "import tomllib; tomllib.load(open('.codex/config.toml','rb'))"

Adding or changing things

  • A skill: create .agents/skills/<name>/SKILL.md, with depth in references/. No wiring is needed. The front matter carries name, description, and optionally license, compatibility or metadata (https://agentskills.io/specification). Write the description in trigger form: what it covers, the phrases a user says, and what it is not for. Prefer one hub with a reference file per topic. Bump the skill-count badge in README.md.
  • A subagent: edit subagents/<name>.md, run the generator, and commit the source and the four generated trees together. The generator rejects a skill with no folder, an unknown tool, and an unknown model. Bump the subagent-count badge.
  • An MCP server: add the block to all five MCP files (the ones listed under Repo conventions), document it in docs/MCP_SETUP.md, and bump the MCP-count badge.
  • A shipped document: name it in UPPERCASE under docs/, add its path to every git checkout agent-standards/master -- pathspec that delivers documents (the Quickstart and all five per-agent blocks in README.md, the import in docs/AGENT_TOOLING.md, and both shell sections of docs/AGENTS-UPDATE.md), and list it under Shipped in the README docs map. A document a consumer cannot pull is not shipped, whatever its name says.
  • A gate rule: edit .agents/hooks/preflight_gate.py, add the case to tools/tests/test_preflight_gate.py, and leave the wiring files alone unless the hook surface itself changed. A wiring change also needs the containerised sandbox in sandbox-agent/.

Subagents and skills

For this repo specifically: agent-engineer owns the agent configuration itself, which is every skill, every subagent definition, every hook wiring, every MCP server block, and this file. It is also the agent the main thread hands web research to, because the gate denies the main thread a web fetch or web search directly. markdown-writer owns doc work, python-patterns owns the generator, the hook scripts, and the lint scripts, code-reviewer runs before any merge, and bash and powershell own the update scripts in docs/AGENTS-UPDATE.md.


Working Principles

Apply these to every task, in order. They govern how you work, and the coding-standards skill governs what the code should look like.

  1. Think before coding. State assumptions. When the prompt is ambiguous, surface the interpretations and ask rather than silently picking one. Propose a simpler approach if one exists.
  2. Simplicity first. Write the minimum that solves the problem. No unrequested features, abstractions, or configurability. If 200 lines could be 50, rewrite it.
  3. Surgical changes. Touch only what the task requires. Do not "improve" adjacent code or reformat untouched lines. Match existing style. Remove only the imports and helpers your own change orphans.
  4. Goal-driven execution. Convert vague asks into verifiable checks, state the plan, then loop until each check passes. Do not claim a task is done without running the verification.
  5. Live progress by tool, not prose. For any task with more than one step, create a todo list with the todowrite tool and keep it current at every step. For long-running work, start a session goal with the goal tool so the mobile app and widgets show live state. Use the notify_user tool only when the user must act right now. The status tail at the end of every reply follows .agents/instructions/reply-rules.md: one Running: line per live agent, State in its own fenced block, and Waiting on: last.
  6. Number every question. Every question put to the user is numbered, one continuous sequence per conversation, subpoints like 13.1. The question_numbering_check hook denies the next tool call when a reply carries an unnumbered question.

Maintenance follow-ups

  • Copilot userPromptTransformed is documented only for the CLI and the cloud agent (https://docs.github.com/en/copilot/reference/hooks-reference). Confirm that VS Code and JetBrains fire it, or at least tolerate the entry, and record the result here.
  • The Copilot preToolUse payload carries no agent identifier. The gate therefore cannot tell a Copilot subagent from the main thread, and no rule ever fires on that surface. Recheck the hooks reference for an agent identifier and pass it with --subagent from .github/hooks/preflight.json when one lands. In the same change set GATE_KNOWN_GAP=0 in sandbox-agent/live/copilot.sh, so live test 1 has to pass there.
  • The Copilot CLI tells every custom subagent not to write files. Copilot CLI 1.0.81 appends **CRITICAL: Do NOT write output to files.** to a custom subagent's system prompt, and in live run 36176881215 the subagent wrote nothing. Live test 2 reports KNOWN-GAP for it through SUBAGENT_NO_WRITE_MARKER in sandbox-agent/live/copilot.sh. Recheck each CLI release, and remove that marker in the same change that sees the block gone.
  • Codex runs the formatting check on Stop, but whether that Stop can reject a reply is not measured. Confirm it and say so plainly here. The markdown lint stays Claude-only, because Codex has no post-tool event.
  • JetBrains Copilot MCP is global-only and officially undocumented. The plugin reads MCP from ~/.config/github-copilot/intellij/mcp.json. There is no per-project MCP file, and GitHub documents only the in-IDE UI rather than the path, so no JetBrains MCP file ships here. Recheck whether GitHub adds a documented per-project path (https://docs.github.com/en/copilot/how-tos/provide-context/use-mcp/extend-copilot-chat-with-mcp) and ship one if it lands.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.