Unified agent rules for Cursor, Claude Code, Codex, and Gemini. One source of truth, shared via symlinks.
project-template/
AGENTS.md # Global agent rules (source of truth)
bin/
setup-global.sh # Set up ~/.agents/ and symlinks to all tools
new-project.sh # Scaffold agent config into a new project
template/ # Project-level template files
AGENTS.md # Project rules template (name, principles, @imports)
.agents/
commands/ # Agent commands (slash commands for Claude Code)
COMMIT.md # Structured commit workflow
FIX.md # Systematic debugging workflow
rules/ # Domain-specific rules (canonical location)
web-frontend.mdc # Semantic HTML, vanilla CSS, a11y, design tokens
javascript.mdc # JS/Node.js standards
markdown.mdc # Markdown formatting rules
content.mdc # Content authoring guidelines
testing.mdc # Testing philosophy and requirements
memory.mdc # Cross-session agent memory scaffold
reference/ # Research material (gitignored)
In each project:
.cursor/rulesis a symlink to../.agents/rules, so Cursor reads the same rule files without duplication.claude/commandsis a symlink to../.agents/commands, so Claude Code picks up commands as/slashcommands
AGENTS.md at the repo root contains the core protocol: behavioral rules, communication style, code standards. It gets deployed to every AI tool via bin/setup-global.sh.
The setup script:
- Copies
AGENTS.mdto~/.agents/AGENTS.md - Symlinks tool-specific files to it:
~/.claude/CLAUDE.md->~/.agents/AGENTS.md~/.codex/instructions.md->~/.agents/AGENTS.md~/.gemini/GEMINI.md->~/.agents/AGENTS.md
- Copies content to clipboard for Cursor User Rules (manual paste required — Cursor has no file-based global config)
./bin/setup-global.shRun this whenever you edit AGENTS.md.
Each project gets its own AGENTS.md (from the template) plus .agents/rules/*.mdc files for domain-specific rules. Cursor reads the .mdc files via a .cursor/rules symlink that points to .agents/rules. Claude Code reads AGENTS.md natively, which @-imports the same .mdc files.
./bin/new-project.sh /path/to/your/projectThe script:
- Copies
template/AGENTS.md,.agents/rules/*.mdc, and.agents/commands/*.mdinto the project (skips existing) - Creates
CLAUDE.mdas a symlink toAGENTS.md - Creates
.cursor/rulesas a symlink to../.agents/rules - Creates
.claude/commandsas a symlink to../.agents/commands
Then customize:
- Edit
AGENTS.md— update project name, description, key principles - Add project-specific rules to
.agents/rules/as needed - Add
@imports toAGENTS.mdfor project docs
.agents/rules/memory.mdc is the cross-session memory file. Both Cursor and Claude Code read and write to it. Keep entries concise; remove anything outdated.
.agents/commands/ contains reusable agent workflows. Claude Code exposes these as slash commands (e.g. /COMMIT, /FIX) via the .claude/commands symlink. Other tools can reference them manually.
Included commands:
- COMMIT — reviews changes, drafts a commit message, waits for confirmation
- FIX — systematic debugging: reproduce, hypothesize, isolate, fix, verify
To add a new command, create a .md file in template/.agents/commands/ and re-run bin/new-project.sh on active projects.
- Edit
AGENTS.mdin this repo - Run
bin/setup-global.shto deploy globally - Paste into Cursor User Rules when prompted
- For project-level template changes, edit files in
template/and re-runbin/new-project.shon active projects