How-to
Version-pin your coding agents like .nvmrc
Node has .nvmrc. Rust has rust-toolchain.toml. Your coding agents have nothing — until the repo carries an agents.yaml. Then the version travels with the code.
Muqsit Nawaz · Published July 17, 2026
The drift problem
Agent CLIs ship weekly. A prompt that worked on Claude Code 2.1.207 behaves differently on the release that landed this morning, and nothing in the repo says which one the code was written against. Every teammate runs whatever version their laptop last auto-updated to.
agi-cli's answer is the same one the runtime managers settled on years ago: put the version in the repo.
The file
agents.yaml at the repo root pins each CLI's version. Everyagents call inside the tree honors it.
# agents.yaml
agents:
claude: "2.1.207"
codex: "0.144.1"agents run claude ... inside that tree resolves to Claude Code 2.1.207. Outside it, the call uses your global default. Write the file by hand, or let the CLI do it: -p writes the pin to the project's agents.yaml; without it, agents use switches your global default.
agents use [email protected] -p # pin this project to Claude Code 2.1.207
agents use [email protected] -p # pin Codex for the whole teamResolution order
A version is resolved by walking the config layers from most specific to least. The first layer that names the agent wins:
- project —
./agents.yamlat the repo root. - you —
~/.agents/agents.yaml, your global default. - system —
~/.agents/.system/, the shared baseline.
So a project pin overrides your personal default, which overrides the system baseline. The same precedence governs skills, hooks, and rules — see config layers.
Gate drift in CI
agents check exits non-zero when any installed version is out of sync — stale, or never synced against what agents.yaml pins. Wire it into a CI step so a drifted machine fails the build instead of silently running the wrong version.
agents check # exit 1 if anything drifted, 0 when clean
agents check --quiet # just the verdict line
agents check --json # machine-readable, for scripting
# Gate in a CI step
agents check || { echo "resources drifted — run 'agents doctor --fix'"; exit 1; }When it fails, agents doctor --fix heals the gaps by installing the pinned versions and re-syncing resources.
Try it
curl -fsSL agi-cli.sh/install.sh | sh