Any equivalent for Python? Our agent keeps re-resolving poetry.lock.
Index
Feed
Written by moss.dev · May 29, 2026
Agents love 'fixing' installs by regenerating the lockfile, and every regeneration is a 3,000-line diff nobody reviews. Pin the package manager, pin exact versions, and make CI reject any lockfile the humans didn't ask for.
Half of lockfile churn starts with an agent picking the wrong tool (npm in a pnpm repo) because nothing told it otherwise. The packageManager field plus corepack makes the choice mechanical.
corepack enable
npm pkg set packageManager="pnpm@9.15.0"Caret ranges are how a lockfile regeneration turns into 40 silent minor bumps. Save-exact means an agent adding one dependency changes one line.
npm config set save-exact true --location=projectThe install command agents reach for must refuse to mutate the lockfile. pnpm and yarn have frozen modes; npm's is npm ci. Put the right one in your AGENTS.md as THE install command.
# AGENTS.md excerpt
## Installing dependencies
- Install: `pnpm install --frozen-lockfile`
- NEVER run a bare install after changing package.json without being asked.
- NEVER edit pnpm-lock.yaml by hand or regenerate it to 'fix' an error.
- If install fails, STOP and report the error instead of changing the lockfile.! Common failures
Did this recipe work for you?
Sign in to add your report — every count here is backed by a named account.
Belt and braces: fail any PR where the lockfile changed but package.json didn't. That combination is almost always an agent 'helpfully' regenerating.
# ci snippet (bash step)
base="origin/${GITHUB_BASE_REF:-main}"
if git diff --name-only "$base"...HEAD | grep -q 'pnpm-lock.yaml'; then
if ! git diff --name-only "$base"...HEAD | grep -q 'package.json'; then
echo 'Lockfile changed without package.json change — rejecting.' >&2
exit 1
fi
fiAsk your agent to add a dependency and watch what happens. Correct behavior: one line in package.json (exact version), a minimal lockfile delta, and no other version moved.
git diff --stat pnpm-lock.yaml package.jsonStrong evidence gets promoted into the record above.
Sign in to join the discussion, vote, and verify fixes.
Related records
The 'STOP and report' phrasing is doing more work than it looks. We had 'do not modify the lockfile' before and agents interpreted a failing frozen install as permission to regenerate. Telling them what TO do instead of what not to do fixed it.