One config file for all your AI coding agents.
Write your AI instructions once. Claude Code, Gemini, Codex, Copilot — they all get them.
You use multiple AI coding agents. Each reads instructions from a different file:
| Agent | Reads from |
|---|---|
| Claude Code | ~/.claude/CLAUDE.md |
| Gemini CLI | ~/.gemini/GEMINI.md |
| Codex CLI | ~/.codex/AGENTS.md |
| GitHub Copilot | ~/.copilot/copilot-instructions.md |
When you add a rule to CLAUDE.md ("fix root causes, not symptoms"), your other agents don't know about it. You end up maintaining 4 files that drift apart.
Maintain one file. Run agentrc. All agents get the same instructions.
~/.claude/CLAUDE.md (you edit this)
|
v agentrc
|
+---> ~/.gemini/GEMINI.md
+---> ~/.codex/AGENTS.md
+---> ~/.copilot/copilot-instructions.md
+---> ~/AGENTS.md (cross-tool fallback)
# Download
curl -fsSL https://raw.githubusercontent.com/bkrisetya/agentrc/main/agentrc.sh \
-o ~/.local/bin/agentrc
chmod +x ~/.local/bin/agentrc
# Or clone
git clone https://github.com/bkrisetya/agentrc.git
cp agentrc/agentrc.sh ~/.local/bin/agentrc# Sync from default source (~/.claude/CLAUDE.md)
agentrc
# Sync from a custom source file
agentrc ~/my-instructions.md
# See what's current vs stale
agentrc --list
# Preview without writing
agentrc --dry-runagentrc v0.1.0 — syncing from /home/you/.claude/CLAUDE.md
[ok] /home/you/.gemini/GEMINI.md
[ok] /home/you/.codex/AGENTS.md
[ok] /home/you/.copilot/copilot-instructions.md
[ok] /home/you/AGENTS.md
Done. Wrote 4 targets.
Add to ~/.claude/settings.json:
{
"hooks": {
"Stop": [
{ "command": "agentrc --quiet" }
]
}
}*/15 * * * * ~/.local/bin/agentrc --quietecho '#!/bin/sh
agentrc --quiet' > .git/hooks/post-commit
chmod +x .git/hooks/post-commitAdd extra target paths to ~/.config/agentrc/targets.conf:
# One path per line
~/.cursor/rules/instructions.md
~/.aider/conventions.md
~/.continue/config.md
Set AGENTRC_SOURCE to use a different source file:
export AGENTRC_SOURCE=~/my-ai-rules.md
agentrc- Reads your source file (default:
~/.claude/CLAUDE.md) - For each target agent, writes the source content with a small header comment
- Handles Windows (OneDrive path redirect, Git Bash compatibility)
- Skips targets where the directory can't be created (no errors, just
[skip])
The script is 200 lines of bash with zero dependencies. It works on Linux, macOS, and Windows (Git Bash).
Q: Does it modify my source file? No. It only reads the source and writes to target locations.
Q: What if I don't use all these agents? It only writes to directories that exist or can be created. Missing agents are silently skipped.
Q: Does it work on Windows?
Yes, via Git Bash. It handles the USERPROFILE / OneDrive path redirect that Windows users encounter.
Q: Can I use something other than CLAUDE.md as the source?
Yes. Pass any markdown file as an argument, or set AGENTRC_SOURCE.
Q: What about agent-specific instructions?
Use your source file for shared rules. For agent-specific overrides, edit the target files directly — agentrc will overwrite them on next run, so keep agent-specific rules in a separate section of your source file.
- Overwrites target files. Each run replaces the target files entirely. If you've manually edited
~/.gemini/GEMINI.md, those edits are lost on the nextagentrcrun. Keep all instructions in your source file. - Not all instructions are portable. Your CLAUDE.md may reference Claude Code-specific features (tools like
Read,Edit,Glob; skills; plan mode; subagents). Other agents will see these instructions but may not understand them. This is usually harmless — agents ignore what they don't support. - Agent path conventions may change. The target paths (
~/.gemini/GEMINI.md,~/.codex/AGENTS.md, etc.) are based on current agent CLI versions as of early 2026. If an agent changes where it reads instructions, you may need to updatetargets.conf. - Requires bash 4+ for associative arrays. macOS ships bash 3 but most users have bash 4+ via Homebrew. The script will error clearly if bash is too old.
- No merge, just overwrite. This is a fan-out tool, not a sync tool. It does not merge agent-specific changes back into your source. The source file is the single source of truth.
MIT