lean-agents
AGENTS.md4 starsChanged 3 days agoMITView on GitHub
Instructions for coding agents (Claude Code, OpenCode, Copilot CLI) that work on this repository. Not to be confused with core/AGENTS.md, which is the rule set lean-agents installs on users' machines.
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 35,266 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.
In this repository8 other files it gives its agents.
- core/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- release-trainSkill
- coordinateSkill
- parallel-sessionsSkill
- setup-doctorSkill
- token-auditSkill
- update-modelsSkill
The file
We split this AGENTS.md into the rules it gives an agent
7 rules. About 0 are common, 1 is distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 26
Never touch the real HOME: Every engine run in development or tests uses --home <temp dir>.
- Very specific: line 27
Public repo: no private data: No usernames, home paths, employer names or internal tools, cloud project IDs, emails, keys or tokens.
- Very specific: line 28
Verify, don't guess: Every install command, config key and CLI flag comes from the tool's current upstream docs or from a real binary in CI.
- Very specific: line 30
Never overwrite user files: Use the engine's action kinds in scripts/lib/fsops.mjs: file (owned files with the managed by lean-agents …
- Very specific: line 44
Commit as the owner (their GitHub no-reply email is already in the clone's git config) and add a Co-Authored-By: trailer for the agent.
- Very specific: line 45
Add changes/<issue>.md (see changes/README.md).
- Distinctive: line 50
Search before reading; open only the relevant lines.
≈ “Common” is an estimate: at least 1 in 5 of the 45,344 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
Working on lean-agents
Instructions for coding agents (Claude Code, OpenCode, Copilot CLI) that work on this repository. Not to be confused with core/AGENTS.md, which is the rule set lean-agents installs on users' machines.
Read first
docs/SPEC.mdsection 0 (current state) and section 2 (non-negotiable rules).- The next unchecked session in
docs/SPEC.mdsection 14. Work only on that session.
Commands
| Task | Command |
| Install dev dependencies | npm ci |
| Engine tests (temp HOME, no external commands) | npm test |
| Shell lint | shellcheck install.sh scripts/*.sh tests/*.sh |
| Workflow lint | node scripts/lint-workflows.mjs |
| Privacy check (run before every commit) | bash scripts/check-private.sh |
| Try the installer safely | node scripts/lean.mjs --home "$(mktemp -d)" --no-exec --yes --dry-run --agents claude,opencode-v2 --all-tools |
Real OpenCode 2 check (needs opencode on PATH) | bash tests/real-opencode.sh |
| Real Skills CLI undo check (safe locally, throwaway HOME) | bash tests/real-skills-undo.sh claude,opencode-v2 |
| Interactive menus in a pseudo-terminal (macOS; temp HOME, dry run) | python3 tests/real-interactive.py |
Hard rules
- Never touch the real HOME. Every engine run in development or tests uses
--home <temp dir>; use--no-execunless the task is to test real tool installs inside a throwaway HOME or CI. Never runinstall.shorscripts/lean.mjswithout--homeon the owner's machine. - Public repo: no private data. No usernames, home paths, employer names or internal tools, cloud project IDs, emails, keys or tokens.
scripts/check-private.shmust pass; it also reads the gitignored.private-denylist. - Verify, don't guess. Every install command, config key and CLI flag comes from the tool's current upstream docs or from a real binary in CI. Record source and date in
docs/compatibility.md. Mark anything unverified as VERIFY. - Prove it in CI. The owner does not test on their working machines. A feature is done when a CI job with real binaries and a throwaway HOME shows it works.
- Never overwrite user files. Use the engine's action kinds in
scripts/lib/fsops.mjs:file(owned files with themanaged by lean-agentsmark),json(JSONC edits that keep comments and user values),block(marked block in text files). Every change must be undone by--uninstall. - Do not add tools the owner rejected: Oh My OpenAgent, Graphify. Warp and Orca are config-only integrations (terminal desktop app installers were removed in 2.0.0).
- Ask before pushing, opening PRs, or anything irreversible.
Code style
- Node 22.20+, ES modules, no dependencies beyond
jsonc-parserand@clack/prompts(pinned; menus only, loaded only on a real terminal). Ask the owner before adding any other. Small pure functions; adapters return{ actions, commands }. - Bash 3.2 compatible (macOS default) and shellcheck clean. PowerShell 5.1 compatible and PSScriptAnalyzer clean.
- Match the comment density of the surrounding code: a short header per file, comments only where the why is not obvious.
- Tests in
tests/*.test.mjswithnode:test, always against a temp HOME.
Git
- One branch per session:
session-<n>-<short-name>. Conventional commits (feat:,fix:,docs:,ci:,chore:). - Commit as the owner (their GitHub no-reply email is already in the clone's git config) and add a
Co-Authored-By:trailer for the agent. - Add
changes/<issue>.md(seechanges/README.md);node scripts/changelog.mjs <version>folds them into CHANGELOG.md in the release PR. Update the README compatibility tables (EN and ES) anddocs/compatibility.mdin the same PR as the feature. - Mark the session
[x]indocs/SPEC.mdsection 14 when its PR merges.
Token efficiency while working here
- Search before reading; open only the relevant lines. Use Serena symbol tools if available.
- Delegate exploration and upstream research to cheap subagents (
explore,research), review the diff withreviewbefore reporting done. - Report: what changed, how it was verified (command + result), what is pending.
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.

