seeklink
AGENTS.md11 starsChanged 7 months agoMITView on GitHub
The source of truth is the repository and git history. Sessions, chat context, local notes, and worktrees are convenience layers only. Important state must be recoverable from repo files or git history. Keep this file short. Add rules only when they affect agent behavior or prevent repeated mistakes. Before editing: Do not rely on chat history as project memory. Use docs/current_focus.md for current work state only. Keep it under 30 lines. It should contain: - current task; - branch; -…
- Reads credentials
- Commits and pushes
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,691 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
43 rules. About 0 are common, 34 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈34
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 10
Keep this file short. Add rules only when they affect agent behavior or prevent repeated mistakes.
- Very specific: line 17
Read docs/current_focus.md if it exists.
- Distinctive: line 18
Check branch and git status.
- Distinctive: line 22
Do not rely on chat history as project memory.
- Very specific: line 26
Use docs/current_focus.md for current work state only.
- Distinctive: line 46
Do not create changelog, backlog, task tracker, memory, or per-agent state files unless explicitly requested.
- Distinctive: line 51
Commit messages are the primary history layer.
- Distinctive: line 53
Use commit bodies to explain why non-trivial changes were made.
- Very specific: line 55
Use docs/decisions.md only for decisions that remain active constraints on future work.
- Distinctive: line 64
Do not mirror every commit into decision docs.
- Very specific: line 69
If docs/decisions.md grows beyond roughly 10 active decisions, propose moving to docs/decisions/YYYY-MM-DD-<slug>.md ADR files.
- Distinctive: line 74
When you need to understand why code is shaped a certain way:
- Very specific: line 77
Read docs/decisions.md if present.
- Distinctive: line 83
Do not infer historical intent from code alone when relevant git history exists.
- Distinctive: line 87
Use one logical change per commit when practical.
- Distinctive: line 97
Do not use commit bodies as file-by-file summaries.
- Distinctive: line 117
use the current session unless the task truly branches.
- Distinctive: line 119
Use a worktree only when both are true:
- Distinctive: line 123
When parallel work is needed:
- Distinctive: line 125
use consistent names for branch, worktree, and main session when practical.
- Distinctive: line 129
If the current task should be isolated in a new worktree, stop before editing and tell the human:
- Very specific: line 136
Do not create a generic worktree for a role such as codex-review.
- Distinctive: line 148
Do not reuse a long-running reviewer session across unrelated tasks.
- Distinctive: line 154
If review fixes require editing, use the primary implementation session or create a task-specific branch/worktree.
- Very specific: line 159
Never merge to main unless docs/current_focus.md contains a human-written marker:
- Distinctive: line 166
When feature branch work is complete:
- Distinctive: line 169
Commit and push the feature branch.
- Very specific: line 170
Update docs/current_focus.md with a handoff marked ready for review.
- Distinctive: line 173
When the approval marker is present, use the standard merge sequence unless repo state makes it unsafe:
- Distinctive: line 179
Do not rebase, squash, or choose a different merge strategy unless the human explicitly says so.
- Very specific: line 182
If there are merge conflicts, stop, list conflict files in docs/current_focus.md, and wait for the human.
- Distinctive: line 185
Do not reuse a stale approval marker for a later merge.
- Distinctive: line 194
Do not modify unless explicitly required:
- Distinctive: line 200
If a protected file must change, explain why before changing it.
- Distinctive: line 204
Before claiming work is done, run the relevant project checks.
- Distinctive: line 206
If verification commands are missing or unclear, discover them before asking the human:
- Distinctive: line 208
read README and project docs.
- Distinctive: line 213
Do not ask the human to name test commands before inspecting the project.
- Distinctive: line 215
When commands are discovered and proven useful, propose updating this section with:
- Distinctive: line 227
If checks cannot run, report the exact reason and what was verified instead.
- Distinctive: line 234
Do not make broad refactors while fixing a narrow bug.
- Distinctive: line 235
Ask before adding production dependencies.
- Distinctive: line 236
If corrected twice on the same issue in one session, stop and reassess the approach.
≈ “Common” is an estimate: at least 1 in 5 of the 16,597 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.
Files
Project conventions for AI coding agents
Core model
The source of truth is the repository and git history.
Sessions, chat context, local notes, and worktrees are convenience layers only. Important state must be recoverable from repo files or git history.
Keep this file short. Add rules only when they affect agent behavior or prevent repeated mistakes.
Start of session
Before editing:
- Read
docs/current_focus.mdif it exists. - Check branch and git status.
- Identify relevant verification commands.
- For non-trivial changes, state the approach before writing code.
Do not rely on chat history as project memory.
Current focus
Use docs/current_focus.md for current work state only. Keep it under 30 lines.
It should contain:
- current task;
- branch;
- next concrete step;
- open questions;
- verification commands;
- at most the latest two handoff notes.
Rewrite stale content instead of appending indefinitely.
Handoff format:
Handoff (YYYY-MM-DD, Agent, branch)
Done: <completed work>
Open: <unresolved items>
Next: <next concrete step>
Status: <in progress / blocked / ready for review>
Do not create changelog, backlog, task tracker, memory, or per-agent state files unless explicitly requested.
History and decisions
Commit messages are the primary history layer.
Use commit bodies to explain why non-trivial changes were made.
Use docs/decisions.md only for decisions that remain active constraints on
future work. Do not create it by default.
Decision docs are appropriate when a decision:
- spans multiple commits or subsystems;
- involves external context not visible in code;
- prevents a recurring wrong choice;
- affects public API, data model, deployment, security, or product behavior.
Do not mirror every commit into decision docs.
Agents may propose decision entries, but must not create or update long-lived decision records unless the human approves the decision text.
If docs/decisions.md grows beyond roughly 10 active decisions, propose moving
to docs/decisions/YYYY-MM-DD-<slug>.md ADR files.
History lookup
When you need to understand why code is shaped a certain way:
- Read
docs/current_focus.md. - Read
docs/decisions.mdif present. - Use git history:
git log --oneline -- <path>git show <commit>git blame <path>
Do not infer historical intent from code alone when relevant git history exists.
Commits
Use one logical change per commit when practical.
Small obvious commits may use only a subject line.
For non-trivial commits, include a body with:
- Why: reason this change exists
- Decision: design choice made, if any
- Rejected: alternatives considered, if useful
- Verification: checks run
Do not use commit bodies as file-by-file summaries.
Example:
refactor(auth): move token parsing into middleware
Why: upcoming API routes need consistent auth behavior, and handler-level parsing was causing inconsistent error responses.
Decision: middleware is the single enforcement point for request auth.
Rejected: a shared helper would reduce duplication but still rely on each route remembering to call it.
Verification: pnpm test auth, pnpm typecheck
Branches, sessions, and worktrees
Default:
- one task = one branch;
- use the current session unless the task truly branches.
Use a worktree only when both are true:
- files will be modified; and
- another branch, task, or agent may need to modify files at the same time.
When parallel work is needed:
- one task = one branch = one worktree = one primary session;
- use consistent names for branch, worktree, and main session when practical.
Agents must not silently create new worktrees or assume a new session exists.
If the current task should be isolated in a new worktree, stop before editing and tell the human:
- why a worktree is needed;
- proposed branch name;
- proposed worktree path;
- command to create it.
Do not create a generic worktree for a role such as codex-review. Worktrees are
task/branch containers, not reviewer containers.
Second review
A second-review agent is read-only by default.
For Claude-triggered Codex reviews, prefer a fresh ephemeral non-interactive run per branch, commit, or diff:
codex exec --ephemeral --sandbox read-only "<review prompt>"
Do not reuse a long-running reviewer session across unrelated tasks.
A reviewer may inspect files and report findings, but must not modify files,
commit, push, or update docs/current_focus.md unless the human explicitly asks
for a patch.
If review fixes require editing, use the primary implementation session or create a task-specific branch/worktree.
Merge protocol
Never merge to main unless docs/current_focus.md contains a human-written
marker:
APPROVED FOR MERGE: <branch-name>
The marker is single-use and applies only to the named branch.
When feature branch work is complete:
- Run required verification.
- Commit and push the feature branch.
- Update
docs/current_focus.mdwith a handoff markedready for review. - Stop.
When the approval marker is present, use the standard merge sequence unless repo state makes it unsafe:
git switch main && git pull && git merge --no-ff <branch> && git push
git worktree remove <path> && git branch -d <branch>
Do not rebase, squash, or choose a different merge strategy unless the human explicitly says so.
If there are merge conflicts, stop, list conflict files in docs/current_focus.md,
and wait for the human.
Do not reuse a stale approval marker for a later merge.
Boundaries
Do not modify:
.env,.env.*- secrets, credentials, private keys
- generated output directories such as
dist/,build/,.next/,coverage/
Do not modify unless explicitly required:
- lockfiles
- applied migrations
- vendored dependencies
- generated client code
If a protected file must change, explain why before changing it.
Verification
Before claiming work is done, run the relevant project checks.
If verification commands are missing or unclear, discover them before asking the human:
- read README and project docs;
- inspect package scripts and build files;
- identify the smallest useful smoke check;
- identify full test, lint, typecheck, and build commands when available.
Do not ask the human to name test commands before inspecting the project.
When commands are discovered and proven useful, propose updating this section with:
Smoke:
<command>
Full:
<command>
Lint/typecheck/build:
<command>
If checks cannot run, report the exact reason and what was verified instead.
Done means verified, not merely implemented.
Working style
Prefer small diffs. Do not make broad refactors while fixing a narrow bug. Ask before adding production dependencies. If corrected twice on the same issue in one session, stop and reassess the approach.
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
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.

